use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.
the class AbstractCommandResults method createActions.
/**
* Create actions
*/
protected void createActions() {
final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
actionClear = new Action(Messages.get().LocalCommandResults_ClearConsole, SharedIcons.CLEAR_LOG) {
@Override
public void run() {
console.clear();
}
};
// $NON-NLS-1$
actionClear.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.clear_output");
handlerService.activateHandler(actionClear.getActionDefinitionId(), new ActionHandler(actionClear));
actionScrollLock = new Action(Messages.get().LocalCommandResults_ScrollLock, Action.AS_CHECK_BOX) {
@Override
public void run() {
console.setAutoScroll(!actionScrollLock.isChecked());
}
};
// $NON-NLS-1$
actionScrollLock.setImageDescriptor(Activator.getImageDescriptor("icons/scroll_lock.gif"));
actionScrollLock.setChecked(false);
// $NON-NLS-1$
actionScrollLock.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.scroll_lock");
handlerService.activateHandler(actionScrollLock.getActionDefinitionId(), new ActionHandler(actionScrollLock));
actionCopy = new Action(Messages.get().LocalCommandResults_Copy) {
@Override
public void run() {
console.copy();
}
};
actionCopy.setEnabled(false);
// $NON-NLS-1$
actionCopy.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.copy");
handlerService.activateHandler(actionCopy.getActionDefinitionId(), new ActionHandler(actionCopy));
actionSelectAll = new Action(Messages.get().LocalCommandResults_SelectAll) {
@Override
public void run() {
console.selectAll();
}
};
// $NON-NLS-1$
actionSelectAll.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.select_all");
handlerService.activateHandler(actionSelectAll.getActionDefinitionId(), new ActionHandler(actionSelectAll));
}
use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.
the class NodePollerView method createActions.
/**
* Create actions
*/
private void createActions() {
final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
actionRestart = new Action(Messages.get().NodePollerView_ActionRestart, SharedIcons.RESTART) {
@Override
public void run() {
startPoll();
}
};
// $NON-NLS-1$
actionRestart.setActionDefinitionId("org.netxms.ui.eclipse.objectmanager.commands.restart_poller");
handlerService.activateHandler(actionRestart.getActionDefinitionId(), new ActionHandler(actionRestart));
actionClearOutput = new Action(Messages.get().NodePollerView_ActionClear, SharedIcons.CLEAR_LOG) {
@Override
public void run() {
// $NON-NLS-1$
textArea.setText("");
}
};
// $NON-NLS-1$
actionClearOutput.setActionDefinitionId("org.netxms.ui.eclipse.objectmanager.commands.clear_output");
handlerService.activateHandler(actionClearOutput.getActionDefinitionId(), new ActionHandler(actionClearOutput));
}
use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.
the class ObjectToolsEditor method createActions.
/**
* Create actions
*/
private void createActions() {
final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
actionShowFilter = new Action("Show filter", Action.AS_CHECK_BOX) {
@Override
public void run() {
enableFilter(!initShowFilter);
actionShowFilter.setChecked(initShowFilter);
}
};
actionShowFilter.setChecked(initShowFilter);
// $NON-NLS-1$
actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.showFilter");
handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
actionRefresh = new RefreshAction() {
@Override
public void run() {
refreshToolList();
}
};
actionNew = new Action(Messages.get().ObjectToolsEditor_New) {
@Override
public void run() {
createTool();
}
};
actionNew.setImageDescriptor(SharedIcons.ADD_OBJECT);
actionEdit = new PropertyDialogAction(getSite(), viewer) {
@Override
public void run() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
final long toolId = ((ObjectTool) selection.getFirstElement()).getId();
// If there will be error, adapter factory will show error message to user
if (Platform.getAdapterManager().getAdapter(selection.getFirstElement(), ObjectToolDetails.class) == null)
return;
super.run();
ObjectToolDetails details = ObjectToolsAdapterFactory.getDetailsFromCache(toolId);
if ((details != null) && details.isModified()) {
saveObjectTool(details);
}
}
};
actionEdit.setImageDescriptor(SharedIcons.EDIT);
actionDelete = new Action(Messages.get().ObjectToolsEditor_Delete) {
@Override
public void run() {
deleteTools();
}
};
actionDelete.setImageDescriptor(SharedIcons.DELETE_OBJECT);
actionDisable = new Action(Messages.get().ObjectToolsEditor_Disable) {
@Override
public void run() {
setSelectedDisabled();
}
};
actionEnable = new Action(Messages.get().ObjectToolsEditor_Enable) {
@Override
public void run() {
setSelectedEnabled();
}
};
actionClone = new Action(Messages.get().ObjectToolsEditor_Clone) {
@Override
public void run() {
cloneTool();
}
};
}
use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.
the class MibExplorer method createActions.
/**
* Create actions
*/
private void createActions() {
final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
actionRefresh = new RefreshAction() {
@Override
public void run() {
mibBrowser.refreshTree();
}
};
actionWalk = new Action(Messages.get().MibExplorer_Walk) {
@Override
public void run() {
doWalk();
}
};
actionWalk.setEnabled(currentNode != null);
actionSetNode = new Action(Messages.get().MibExplorer_SetNodeObject) {
@Override
public void run() {
ObjectSelectionDialog dlg = new ObjectSelectionDialog(MibExplorer.this.getSite().getShell(), null, ObjectSelectionDialog.createNodeSelectionFilter(false));
dlg.enableMultiSelection(false);
if (dlg.open() == Window.OK) {
setNode((AbstractNode) dlg.getSelectedObjects().get(0));
}
}
};
actionSelect = new Action("Select in MIB tree") {
@Override
public void run() {
selectInTree();
}
};
actionSelect.setEnabled(false);
actionExportToCsv = new ExportToCsvAction(this, viewer, true);
actionShowFilter = new Action("Show filter", Action.AS_CHECK_BOX) {
@Override
public void run() {
enableFilter(!initShowFilter);
actionShowFilter.setChecked(initShowFilter);
}
};
actionShowFilter.setChecked(initShowFilter);
// $NON-NLS-1$
actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.snmp.commands.showFilter");
handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
}
use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.
the class MappingTableEditor method createActions.
/**
* Create actions
*/
private void createActions() {
final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
actionRefresh = new RefreshAction(this) {
@Override
public void run() {
if (modified)
if (!MessageDialogHelper.openQuestion(getSite().getShell(), Messages.get().MappingTableEditor_RefreshConfirmation, Messages.get().MappingTableEditor_RefreshConfirmationText))
return;
refresh();
}
};
actionNewRow = new Action(Messages.get().MappingTableEditor_NewRow, SharedIcons.ADD_OBJECT) {
@Override
public void run() {
addNewRow();
}
};
actionNewRow.setEnabled(false);
// $NON-NLS-1$
actionNewRow.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.add_new_row");
handlerService.activateHandler(actionNewRow.getActionDefinitionId(), new ActionHandler(actionNewRow));
actionDelete = new Action(Messages.get().MappingTableEditor_Delete, SharedIcons.DELETE_OBJECT) {
@Override
public void run() {
deleteRows();
}
};
actionDelete.setEnabled(false);
// $NON-NLS-1$
actionDelete.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.delete_rows");
handlerService.activateHandler(actionDelete.getActionDefinitionId(), new ActionHandler(actionDelete));
actionSave = new Action(Messages.get().MappingTableEditor_Save, SharedIcons.SAVE) {
@Override
public void run() {
new SaveJob().start();
}
};
actionSave.setEnabled(false);
}
Aggregations