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 void
handle(CopyEvent event)
Copy selected content if focusedvoid
handle(CutEvent event)
Cut selected content if focusedvoid
handle(LanguageChangedEvent event)
Refreshes the syntax highlighting when the Programming language is changedvoid
handle(OpenFileEvent event)
Updates the CodeArea whenever a new file is opened.void
handle(PasteEvent event)
Paste from clipboard if focusedvoid
handle(RedoEvent event)
Redo if focusedvoid
handle(SaveFileEvent event)
Saves the editor content to a filevoid
handle(ToggleCommentEvent event)
Toggles a comment based on the editor statevoid
handle(ToggleWrapTextEvent event)
Toggles the WrapText settingvoid
handle(UndoEvent event)
Undo if focusedvoid
initialize(java.net.URL url, java.util.ResourceBundle resourceBundle)
Initializes the controller, and binds the event of change in editor content toeditorChanged
void
saveCodeArea(boolean isNewFile)
Saving/Writing to the file based on the active filepath inModel
if it is a new File.void
setEventBus(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:
initialize
in interfacejavafx.fxml.Initializable
-
setEventBus
public void setEventBus(com.google.common.eventbus.EventBus eventBus)Description copied from interface:Controller
Registers the main EventBus into the controller.- Specified by:
setEventBus
in interfaceController
-
saveCodeArea
public void saveCodeArea(boolean isNewFile)Saving/Writing to the file based on the active filepath inModel
if 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
-
-