public void partActivated(IWorkbenchPart part) { if (part instanceof MapEditor) { activeEditor = (MapEditor) part; undoAction.setEnabled(activeEditor.canUndo()); redoAction.setEnabled(activeEditor.canRedo()); } }
public void propertyChanged(Object source, int propId) { if (source == activeEditor) { if (propId == MapEditor.PROPERTY_CANUNDO) { undoAction.setEnabled(activeEditor.canUndo()); } else if (propId == MapEditor.PROPERTY_CANREDO) { redoAction.setEnabled(activeEditor.canRedo()); } } }
public void propertyChange(PropertyChangeEvent event) { if (activeEditor == null) { return; } if (event.getSource() == undoAction) { if (event.getProperty().equals("chosen")) { activeEditor.undo(); } } else if (event.getSource() == redoAction) { if (event.getProperty().equals("chosen")) { activeEditor.redo(); } } }
public boolean action(Event evt, Object arg) { if (evt.target instanceof Button) { String selectedButton = arg.toString(); if (selectedButton == "Play") { String x[] = {"A", "B"}; Game.main(x); } if (selectedButton == "Map Editor") { String x[] = {"A", "B"}; MapEditor.main(x); } if (selectedButton == "Exit DuskFire") { System.out.println("Exiting Game"); if (JOptionPane.showConfirmDialog( null, "Are you sure you want to exit DuskFire", "Exiting DuskFire", JOptionPane.YES_NO_OPTION) == 0) { dispose(); } } } return true; }