Package app.controllers
Class EditorController
java.lang.Object
app.controllers.EditorController
- All Implemented Interfaces:
Controller,javafx.fxml.Initializable
public class EditorController extends java.lang.Object implements javafx.fxml.Initializable, Controller
An FXML controller that controls the CodeArea
-
Constructor Summary
Constructors Constructor Description EditorController() -
Method Summary
Modifier and Type Method Description voidhandle(CopyEvent event)Copy selected content if focusedvoidhandle(CutEvent event)Cut selected content if focusedvoidhandle(LanguageChangedEvent event)Refreshes the syntax highlighting when the Programming language is changedvoidhandle(OpenFileEvent event)Updates the CodeArea whenever a new file is opened.voidhandle(PasteEvent event)Paste from clipboard if focusedvoidhandle(RedoEvent event)Redo if focusedvoidhandle(SaveFileEvent event)Saves the editor content to a filevoidhandle(ToggleCommentEvent event)Toggles a comment based on the editor statevoidhandle(ToggleWrapTextEvent event)Toggles the WrapText settingvoidhandle(UndoEvent event)Undo if focusedvoidinitialize(java.net.URL url, java.util.ResourceBundle resourceBundle)Initializes the controller, and binds the event of change in editor content toeditorChangedvoidsaveCodeArea(boolean isNewFile)Saving/Writing to the file based on the active filepath inModelif it is a new File.voidsetEventBus(com.google.common.eventbus.EventBus eventBus)Registers the main EventBus into the controller.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
EditorController
public EditorController()
-
-
Method Details
-
initialize
public void initialize(java.net.URL url, java.util.ResourceBundle resourceBundle)Initializes the controller, and binds the event of change in editor content toeditorChanged- Specified by:
initializein interfacejavafx.fxml.Initializable
-
setEventBus
public void setEventBus(com.google.common.eventbus.EventBus eventBus)Description copied from interface:ControllerRegisters the main EventBus into the controller.- Specified by:
setEventBusin interfaceController
-
saveCodeArea
public void saveCodeArea(boolean isNewFile)Saving/Writing to the file based on the active filepath inModelif it is a new File. Otherwise it will open a dialog to ask the user where to save the file.- Parameters:
isNewFile- Whether or not the file already has a path
-
handle
Updates the CodeArea whenever a new file is opened.- Parameters:
event-
-
handle
Saves the editor content to a file- Parameters:
event-
-
handle
Refreshes the syntax highlighting when the Programming language is changed- Parameters:
event-
-
handle
Toggles a comment based on the editor state- Parameters:
event-
-
handle
Toggles the WrapText setting- Parameters:
event-
-
handle
Undo if focused- Parameters:
event-
-
handle
Redo if focused- Parameters:
event-
-
handle
Copy selected content if focused- Parameters:
event-
-
handle
Cut selected content if focused- Parameters:
event-
-
handle
Paste from clipboard if focused- Parameters:
event-
-