use of org.eclipse.gef.ui.actions.DeleteAction in project dbeaver by serge-rider.
the class ERDEditorPropertyTester method test.
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (!(receiver instanceof ERDEditorPart)) {
return false;
}
ERDEditorPart erdEditor = (ERDEditorPart) receiver;
switch(property) {
case PROP_CAN_UNDO:
return erdEditor.getCommandStack().canUndo();
case PROP_CAN_REDO:
return erdEditor.getCommandStack().canRedo();
case PROP_EDITABLE:
return !erdEditor.isReadOnly();
case PROP_CAN_DELETE:
DeleteAction deleteAction = new DeleteAction((IWorkbenchPart) erdEditor);
deleteAction.update();
return deleteAction.isEnabled();
}
return false;
}
use of org.eclipse.gef.ui.actions.DeleteAction in project dbeaver by dbeaver.
the class ERDEditorPropertyTester method test.
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (!(receiver instanceof ERDEditorPart)) {
return false;
}
ERDEditorPart erdEditor = (ERDEditorPart) receiver;
switch(property) {
case PROP_CAN_UNDO:
return erdEditor.getCommandStack().canUndo();
case PROP_CAN_REDO:
return erdEditor.getCommandStack().canRedo();
case PROP_EDITABLE:
return !erdEditor.isReadOnly();
case PROP_CAN_DELETE:
DeleteAction deleteAction = new DeleteAction((IWorkbenchPart) erdEditor);
deleteAction.update();
return deleteAction.isEnabled();
}
return false;
}
use of org.eclipse.gef.ui.actions.DeleteAction in project dbeaver by dbeaver.
the class ERDHandlerDelete method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Control control = (Control) HandlerUtil.getVariable(event, ISources.ACTIVE_FOCUS_CONTROL_NAME);
if (control != null) {
ERDEditorPart editor = ERDEditorAdapter.getEditor(control);
if (editor != null && !editor.isReadOnly()) {
DeleteAction deleteAction = new DeleteAction((IWorkbenchPart) editor);
deleteAction.update();
if (deleteAction.isEnabled()) {
deleteAction.run();
}
}
}
return null;
}
use of org.eclipse.gef.ui.actions.DeleteAction in project archi by archimatetool.
the class GraphicalEditor method createActions.
/**
* Creates actions for this editor. Subclasses should override this method
* to create and register actions with the {@link ActionRegistry}.
*/
protected void createActions() {
ActionRegistry registry = getActionRegistry();
IAction action;
action = new UndoAction(this);
registry.registerAction(action);
getStackActions().add(action.getId());
action = new RedoAction(this);
registry.registerAction(action);
getStackActions().add(action.getId());
action = new SelectAllAction(this);
registry.registerAction(action);
action = new DeleteAction((IWorkbenchPart) this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
action = new SaveAction(this);
registry.registerAction(action);
getPropertyActions().add(action.getId());
registry.registerAction(new PrintAction(this));
}
use of org.eclipse.gef.ui.actions.DeleteAction in project dbeaver by serge-rider.
the class ERDHandlerDelete method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Control control = (Control) HandlerUtil.getVariable(event, ISources.ACTIVE_FOCUS_CONTROL_NAME);
if (control != null) {
ERDEditorPart editor = ERDEditorAdapter.getEditor(control);
if (editor != null && !editor.isReadOnly()) {
DeleteAction deleteAction = new DeleteAction((IWorkbenchPart) editor);
deleteAction.update();
if (deleteAction.isEnabled()) {
deleteAction.run();
}
}
}
return null;
}
Aggregations