use of org.eclipse.ui.internal.actions.CommandAction in project netxms by netxms.
the class ApplicationActionBarAdvisor method makeActions.
/* (non-Javadoc)
* @see org.eclipse.ui.application.ActionBarAdvisor#makeActions(org.eclipse.ui.IWorkbenchWindow)
*/
@Override
protected void makeActions(final IWorkbenchWindow window) {
contribItemShowView = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
contribItemOpenPerspective = ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(window);
actionExit = ActionFactory.QUIT.create(window);
register(actionExit);
actionAbout = new Action(String.format(Messages.get().ApplicationActionBarAdvisor_AboutActionName, BrandingManager.getInstance().getConsoleProductName())) {
@Override
public void run() {
Dialog dlg = BrandingManager.getInstance().getAboutDialog(window.getShell());
if (dlg != null) {
dlg.open();
} else {
MessageDialogHelper.openInformation(window.getShell(), Messages.get().ApplicationActionBarAdvisor_AboutTitle, String.format(Messages.get().ApplicationActionBarAdvisor_AboutText, NXCommon.VERSION + " (" + BuildNumber.TEXT + ")"));
}
}
};
actionShowPreferences = ActionFactory.PREFERENCES.create(window);
register(actionShowPreferences);
actionCustomizePerspective = ActionFactory.EDIT_ACTION_SETS.create(window);
register(actionCustomizePerspective);
actionSavePerspective = ActionFactory.SAVE_PERSPECTIVE.create(window);
register(actionSavePerspective);
actionResetPerspective = ActionFactory.RESET_PERSPECTIVE.create(window);
register(actionResetPerspective);
actionClosePerspective = ActionFactory.CLOSE_PERSPECTIVE.create(window);
register(actionClosePerspective);
actionCloseAllPerspectives = ActionFactory.CLOSE_ALL_PERSPECTIVES.create(window);
register(actionCloseAllPerspectives);
actionMinimize = ActionFactory.MINIMIZE.create(window);
register(actionMinimize);
actionMaximize = ActionFactory.MAXIMIZE.create(window);
register(actionMaximize);
actionClose = new CommandAction(window, IWorkbenchCommandConstants.WINDOW_CLOSE_PART);
register(actionClose);
actionPrevView = ActionFactory.PREVIOUS_PART.create(window);
register(actionPrevView);
actionNextView = ActionFactory.NEXT_PART.create(window);
register(actionNextView);
actionShowViewMenu = ActionFactory.SHOW_VIEW_MENU.create(window);
register(actionShowViewMenu);
actionOpenProgressView = new Action() {
@Override
public void run() {
IWorkbench wb = PlatformUI.getWorkbench();
if (wb != null) {
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
if (win != null) {
IWorkbenchPage page = win.getActivePage();
if (page != null) {
try {
// $NON-NLS-1$
page.showView("org.eclipse.ui.views.ProgressView");
} catch (PartInitException e) {
e.printStackTrace();
}
}
}
}
}
};
actionOpenProgressView.setText(Messages.get().ApplicationActionBarAdvisor_Progress);
// $NON-NLS-1$
actionOpenProgressView.setImageDescriptor(Activator.getImageDescriptor("icons/pview.gif"));
}
Aggregations