Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed the "createAction*" methods in the EventAction class to accept …

…plain Actions, and modified the EditorWindow to use RTextEditor's cut/copy/paste Actions.
  • Loading branch information...
commit b1db52b5dd83d30800da19a62a8e5d5e45bd93b8 1 parent 273d2e6
raceimaztion authored
View
6 create/simulator/utils/EventAction.java
@@ -154,7 +154,7 @@ public static EventAction createEventAction(String description, String command,
* @param ea The EventAction to have the JButton wrap.
* @return The new JButton.
*/
- public static JButton createActionButton(EventAction ea)
+ public static JButton createActionButton(Action ea)
{
return new JButton(ea);
}
@@ -164,7 +164,7 @@ public static JButton createActionButton(EventAction ea)
* @param ea The EventAction to have the JButton wrap.
* @return The new JButton.
*/
- public static JButton createActionToolbarButton(EventAction ea)
+ public static JButton createActionToolbarButton(Action ea)
{
JButton button = new JButton(ea);
if (button.getIcon() != null)
@@ -181,7 +181,7 @@ public static JButton createActionToolbarButton(EventAction ea)
* @param ea The EventAction to have the JMenuItem wrap.
* @param ea The EventAction to have the JMenuItem wrap.
*/
- public static JMenuItem createActionMenuItem(EventAction ea)
+ public static JMenuItem createActionMenuItem(Action ea)
{
JMenuItem item = new JMenuItem(ea);
item.setIcon(null);
View
19 create/simulator/window/EditorWindow.java
@@ -83,9 +83,12 @@
protected EventAction actionProjectProperties;
protected EventAction actionProjectExit;
- protected EventAction actionEditCut;
- protected EventAction actionEditCopy;
- protected EventAction actionEditPaste;
+// protected EventAction actionEditCut;
+// protected EventAction actionEditCopy;
+// protected EventAction actionEditPaste;
+ protected Action actionEditCut;
+ protected Action actionEditCopy;
+ protected Action actionEditPaste;
protected EventAction actionEditFind;
protected EventAction actionRunSimulator;
@@ -135,14 +138,18 @@ private void setup()
actionProjectClose = EventAction.createEventAction("Close project", COMMAND_CLOSE_PROJECT, this);
actionProjectProperties = EventAction.createEventAction("Project properties...", COMMAND_PROJECT_PROPERTIES, this);
actionProjectExit = EventAction.createEventAction("Exit", COMMAND_PROJECT_EXIT, this);
- actionEditCut = EventAction.createEventAction("Cut", COMMAND_EDIT_CUT, this);
- actionEditCopy = EventAction.createEventAction("Copy", COMMAND_EDIT_COPY, this);
- actionEditPaste = EventAction.createEventAction("Paste", COMMAND_EDIT_PASTE, this);
+// actionEditCut = EventAction.createEventAction("Cut", COMMAND_EDIT_CUT, this);
+// actionEditCopy = EventAction.createEventAction("Copy", COMMAND_EDIT_COPY, this);
+// actionEditPaste = EventAction.createEventAction("Paste", COMMAND_EDIT_PASTE, this);
actionEditFind = EventAction.createEventAction("Find...", COMMAND_EDIT_FIND, this);
actionRunSimulator = EventAction.createEventAction("Run simulator...", COMMAND_RUN_SIMULATOR, this);
actionRunSerial = EventAction.createEventAction("Run serial control...", COMMAND_RUN_SERIAL, this);
actionRunEmbedded = EventAction.createEventAction("Run on Command Module...", COMMAND_RUN_EMBEDDED, this);
+ actionEditCut = RTextArea.getAction(RTextArea.CUT_ACTION);
+ actionEditCopy = RTextArea.getAction(RTextArea.COPY_ACTION);
+ actionEditPaste = RTextArea.getAction(RTextArea.PASTE_ACTION);
+
actionModuleSave.setEnabled(false);
// The Editing card:
View
19 create/simulator/window/MainLauncher.java
@@ -2,6 +2,9 @@
import create.simulator.utils.*;
import java.io.*;
+import javax.swing.Action;
+
+import org.fife.ui.rtextarea.RTextArea;
public class MainLauncher
{
@@ -93,6 +96,22 @@ else if (RUNTIME_PLATFORM == Platform.LINUX)
// Debugging:
System.out.printf("Sketchbook folder: %s\n", SKETCHBOOK_FOLDER);
+ // Set up the RTextArea Action parameters:
+ {
+ @SuppressWarnings("unused")
+ RTextArea textArea = new RTextArea();
+
+ Action cut = RTextArea.getAction(RTextArea.CUT_ACTION);
+ cut.putValue(Action.NAME, "Cut");
+ cut.putValue(Action.SHORT_DESCRIPTION, null);
+ Action copy = RTextArea.getAction(RTextArea.COPY_ACTION);
+ copy.putValue(Action.NAME, "Copy");
+ copy.putValue(Action.SHORT_DESCRIPTION, null);
+ Action paste = RTextArea.getAction(RTextArea.PASTE_ACTION);
+ paste.putValue(Action.NAME, "Paste");
+ paste.putValue(Action.SHORT_DESCRIPTION, null);
+ }
+
// Launch the EditorWindow:
EditorWindow window = new EditorWindow();
window.show();
View
4 create/simulator/window/ProjectTab.java
@@ -31,7 +31,9 @@
* The list of listeners.
*/
protected Vector<TabSelectionListener> listeners = new Vector<TabSelectionListener>();
-
+ /**
+ * Whether we are the currently-selected tab.
+ */
protected boolean isUs;
public ProjectTab(CreateProject project, TextEditorPane editor, JTabbedPane tabbedPane)
Please sign in to comment.
Something went wrong with that request. Please try again.