use of org.eclipse.jface.action.IAction in project jbosstools-hibernate by jbosstools.
the class DiagramViewer method configureGraphicalViewer.
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
//
loadProperties();
// Actions
IAction showRulers = new ToggleRulerVisibilityAction(getGraphicalViewer());
getActionRegistry().registerAction(showRulers);
IAction snapAction = new ToggleSnapToGeometryAction(getGraphicalViewer());
getActionRegistry().registerAction(snapAction);
IAction showGrid = new ToggleGridAction(getGraphicalViewer());
getActionRegistry().registerAction(showGrid);
}
use of org.eclipse.jface.action.IAction in project org.csstudio.display.builder by kasemir.
the class DataBrowserEditor method fillContextMenu.
/**
* Dynamically fill context menu
* @param manager
*/
private void fillContextMenu(final IMenuManager manager) {
final Activator activator = Activator.getDefault();
final Shell shell = getSite().getShell();
final UndoableActionManager op_manager = plot.getPlot().getUndoableActionManager();
manager.add(toggle_toolbar);
manager.add(toggle_legend);
manager.add(new Separator());
manager.add(new AddPVAction(op_manager, shell, model, false));
manager.add(new AddPVAction(op_manager, shell, model, true));
final boolean is_rcp = SingleSourcePlugin.getUIHelper().getUI() == UI.RCP;
if (is_rcp) {
try {
for (IAction imp : SampleImporters.createImportActions(op_manager, shell, model)) manager.add(imp);
} catch (Exception ex) {
ExceptionDetailsErrorDialog.openError(shell, Messages.Error, ex);
}
}
manager.add(new RemoveUnusedAxesAction(op_manager, model));
manager.add(new RefreshAction(controller));
manager.add(new Separator());
manager.add(new OpenPropertiesAction());
manager.add(new OpenViewAction(SearchView.ID, Messages.OpenSearchView, activator.getImageDescriptor("icons/search.gif")));
if (is_rcp)
manager.add(new OpenViewAction(ExportView.ID, Messages.OpenExportView, activator.getImageDescriptor("icons/export.png")));
manager.add(new OpenViewAction(SampleView.ID, Messages.InspectSamples, activator.getImageDescriptor("icons/inspect.gif")));
manager.add(new OpenPerspectiveAction(activator.getImageDescriptor("icons/databrowser.png"), Messages.OpenDataBrowserPerspective, Perspective.ID));
manager.add(new OpenViewAction(WaveformView.ID, Messages.OpenWaveformView, activator.getImageDescriptor("icons/wavesample.gif")));
manager.add(new Separator());
manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
if (is_rcp) {
manager.add(new Separator());
manager.add(snapshot);
if (EMailSender.isEmailSupported())
manager.add(new SendEMailAction(shell, plot.getPlot()));
manager.add(new PrintAction(shell, plot.getPlot()));
if (SendToElogAction.isElogAvailable())
manager.add(new SendToElogAction(shell, plot.getPlot()));
}
}
use of org.eclipse.jface.action.IAction in project org.csstudio.display.builder by kasemir.
the class DisplayEditorToolbarContributor method setActiveEditor.
@Override
public void setActiveEditor(final IEditorPart part) {
if (!(part instanceof DisplayEditorPart))
return;
final DisplayEditorPart editor = (DisplayEditorPart) part;
final IActionBars bars = getActionBars();
if (bars == null)
return;
// otherwise the global action remains disabled.
for (IAction action : global_actions) bars.setGlobalActionHandler(action.getId(), editor.getRetargetActionHandler(action.getId()));
bars.updateActionBars();
}
use of org.eclipse.jface.action.IAction in project eclipse-cs by checkstyle.
the class MarkerStatsView method hookContextMenu.
/**
* Adds the actions to the tableviewer context menu.
*
* @param actions
* a collection of IAction objets
*/
private void hookContextMenu(final Collection<Object> actions, StructuredViewer viewer) {
MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
for (Iterator<Object> iter = actions.iterator(); iter.hasNext(); ) {
Object item = iter.next();
if (item instanceof IContributionItem) {
manager.add((IContributionItem) item);
} else if (item instanceof IAction) {
manager.add((IAction) item);
}
}
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
});
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
}
use of org.eclipse.jface.action.IAction in project mylyn.docs by eclipse.
the class MarkupEditor method createActions.
@Override
protected void createActions() {
super.createActions();
IAction action;
// action = new ShowCheatSheetAction(this);
// setAction(action.getId(),action);
// $NON-NLS-1$
action = new ContentAssistAction(new NlsResourceBundle(Messages.class), "ContentAssistProposal_", this);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
// $NON-NLS-1$
setAction("ContentAssistProposal", action);
// $NON-NLS-1$
markAsStateDependentAction("ContentAssistProposal", true);
}
Aggregations