Java Code Examples for org.eclipse.jface.action.IMenuManager

The following are top voted examples for showing how to use org.eclipse.jface.action.IMenuManager. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: n4js   File: SelectAllProjectExplorer_PluginUITest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests that the Top Level Elements
 */
@Test
public void testTopLevelElementsEntryNoDuplicates() {
	IActionBars actionBars = projectExplorer.getViewSite().getActionBars();
	IMenuManager menuManager = actionBars.getMenuManager();

	int topLevelElementsEntriesFound = 0;

	for (IContributionItem item : menuManager.getItems()) {
		if (item instanceof MenuManager) {
			String escapedMenuText = LegacyActionTools.removeMnemonics(((MenuManager) item).getMenuText());
			if (escapedMenuText.equals("Top Level Elements")) {
				topLevelElementsEntriesFound++;
			}
		}
	}

	assertEquals("There was more than one 'Top Level Elements' entry in the navigator action bar.",
			topLevelElementsEntriesFound, 1);
}
 
Example 2
Project: n4js   File: N4JSNavigatorActionProvider.java   Source Code and License 6 votes vote down vote up
@Override
public void fillContextMenu(final IMenuManager menu) {
	// {@link N4JSProjectActionGroup} does enablement-logic
	// on its own, thus always invoke it here
	projectGroup.fillContextMenu(menu);

	// Only delegate to {@link N4JSWorkingSetActionProvider},
	// if the current selection contains working sets.
	if (selectionContainsWorkingSet) {
		workingSetActionProvider.fillContextMenu(menu);
	}

	if (assignWorkingSetsAction.isEnabled()) {
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, assignWorkingSetsAction);
	}
}
 
Example 3
Project: n4js   File: N4JSProjectActionGroup.java   Source Code and License 6 votes vote down vote up
@Override
public void fillContextMenu(final IMenuManager menu) {
	super.fillContextMenu(menu);

	// If disabled, do not contribute
	if (!enableContribution) {
		return;
	}

	if (openAction.isEnabled() && enableOpenInContextMenu)
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, openAction);
	if (closeAction.isEnabled())
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, closeAction);
	if (closeUnrelatedAction.isEnabled()
			&& areOnlyProjectsSelected(closeUnrelatedAction.getStructuredSelection()))
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, closeUnrelatedAction);
}
 
Example 4
Project: avro-schema-editor   File: StudioPopupMenuConfigurationImpl.java   Source Code and License 6 votes vote down vote up
@Override
public void fillPopupMenu(IMenuManager manager, SchemaViewer viewer) {
	// add element
	ContextualAction action = new AddElementAction("Add", IAction.AS_PUSH_BUTTON, Notifications.notifyRefreshReveal(getContext()));
	action.init(getContext(), true);
	manager.add(action);
	// remove element
	action = new RemoveElementAction("Remove", IAction.AS_PUSH_BUTTON, Notifications.NOT_REF);
	action.init(getContext(), true);
	manager.add(action);		
	// copy
	action = new CopyElementAction("Copy", IAction.AS_PUSH_BUTTON, Notifications.NONE);
	action.init(getContext(), true);
	manager.add(action);
	// paste
	action = new PasteElementAction("Paste", IAction.AS_PUSH_BUTTON, Notifications.NOT_REF);
	action.init(getContext(), true);
	manager.add(action);
}
 
Example 5
Project: eZooKeeper   File: ZnodeModelChildrenFormPage.java   Source Code and License 6 votes vote down vote up
private void fillContextMenu(IMenuManager manager) {

        if (_TableViewer.getSelection().isEmpty()) {
            return;
        }

        manager.add(_NewZnodeAction);
        manager.add(new Separator());
        manager.add(_OpenAction);
        manager.add(new Separator());
        manager.add(_TableEditAction);
        manager.add(_TableEditChildrenAction);
        manager.add(new Separator());

        if (_DeleteAction.isEnabled()) {
            manager.add(_DeleteAction);
        }

        manager.add(new Separator());
        manager.add(_RefreshAction);
    }
 
Example 6
Project: bdf2   File: DbToolGefEditorContextMenuProvider.java   Source Code and License 6 votes vote down vote up
public void buildContextMenu(IMenuManager menu) {
	GEFActionConstants.addStandardActionGroups(menu);

	menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.UNDO.getId()));
	menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.REDO.getId()));
	menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.DELETE.getId()));
	menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionIdConstants.MODIFY_ACTION_ID));

	IAction saveAction = getAction(ActionFactory.SAVE.getId());
	saveAction.setImageDescriptor(Activator.getImageDescriptor(Activator.IMAGE_SAVE));

	menu.appendToGroup(GEFActionConstants.GROUP_SAVE, saveAction);
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, createExportMenuManager());
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.IMPORT_DATABASE_ACTION_ID));
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.CHANGE_DATABASE_ACTION_ID));

}
 
Example 7
Project: n4js   File: N4JSEditor.java   Source Code and License 5 votes vote down vote up
@Override
protected void editorContextMenuAboutToShow(final IMenuManager menu) {
	super.editorContextMenuAboutToShow(menu);

	final IContributionItem[] items = menu.getItems();
	for (int i = 0; i < items.length; i++) {
		if (items[i] instanceof IMenuManager) {
			final IMenuManager subMenu = (IMenuManager) items[i];
			final IContributionItem testShowIn = subMenu.find(ContributionItemFactory.VIEWS_SHOW_IN.getId());
			if (null != testShowIn) {
				menu.remove(subMenu);
			}
		}
	}
}
 
Example 8
Project: OCCI-Studio   File: MonitoringActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 9
Project: n4js   File: N4JSOpenActions.java   Source Code and License 5 votes vote down vote up
@Override
public void fillContextMenu(final IMenuManager menu) {
	if (inViewPart && canEnableOpenAction()) {
		if (openGroup.getOpenAction().isEnabled()) {
			openGroup.fillContextMenu(menu);
		}
	}
}
 
Example 10
Project: n4js   File: SelectTopLevelElementActionGroup.java   Source Code and License 5 votes vote down vote up
@Override
public void fillActionBars(final IActionBars actionBars) {
	if (hasContributedToViewMenu) {
		return;
	}
	final IMenuManager topLevelSubMenu = new MenuManager("Top Level Elements");
	addActions(topLevelSubMenu);
	final IMenuManager menuManager = actionBars.getMenuManager();
	menuManager.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, topLevelSubMenu);
	hasContributedToViewMenu = true;
}
 
Example 11
Project: n4js   File: TestResultsView.java   Source Code and License 5 votes vote down vote up
private void fillContextMenu(IMenuManager manager) {
	manager.add(actionRelaunch);
	manager.add(actionRelaunchFailed);
	manager.add(actionStop);
	manager.add(new Separator());
	manager.add(actionLock);
	manager.add(new Separator());
	// Other plug-ins can contribute their actions here
	manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
 
Example 12
Project: n4js   File: TestResultsView.java   Source Code and License 5 votes vote down vote up
private void fillLocalPullDown(IMenuManager manager) {
	manager.add(actionRelaunch);
	manager.add(actionRelaunchFailed);
	manager.add(actionStop);
	manager.add(new Separator());
	manager.add(actionLock);
}
 
Example 13
Project: n4js   File: PerformanceView.java   Source Code and License 5 votes vote down vote up
private void createMenu() {
	IMenuManager mgr = getViewSite().getActionBars().getMenuManager();
	mgr.setRemoveAllWhenShown(true);
	addDynamicVisualisationSelection(mgr);
	mgr.addMenuListener(new IMenuListener() {
		@Override
		public void menuAboutToShow(IMenuManager m) {
			addDynamicVisualisationSelection(m);
		}
	});
}
 
Example 14
Project: n4js   File: N4JSApplicationActionBarAdvisor.java   Source Code and License 5 votes vote down vote up
@Override
public void fillActionBars(final int flags) {
	delegate.fillActionBars(flags);

	// To remove 'Build Working Set' contribution item from the main menu.
	final IMenuManager menuManager = configurer.getMenuManager();
	final MenuManager projectManager = getMenuManager(PROJECT_MENU_PREDICATE, menuManager);
	if (null != projectManager) {
		final MenuManager workingSetManager = getMenuManager(WORKING_SET_MENU_PREDICATE, projectManager);
		projectManager.remove(workingSetManager);
		projectManager.update(true);
	}
}
 
Example 15
Project: OCCI-Studio   File: OCCIActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 16
Project: OCCI-Studio   File: InfrastructureActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 17
Project: xmontiarc   File: RuntimeActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 18
Project: gemoc-studio-modeldebugging   File: TracingannotationsActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 19
Project: OCCI-Studio   File: SlaActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 20
Project: time4sys   File: ConstraintsActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 21
Project: eZooKeeper   File: ViewerFactory.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new {@link TableViewer} with {@link DataModel} elements.
 * 
 * @param site The {@link IWorkbenchPartSite} used to register the table's context menu.
 * @param table The {@link Table}.
 * @param dataModelClass The {@link DataModel} element {@link Class}.
 * @param dataModelElementType The {@link DataModel} {@link IElementType}.
 * @param input The {@link TableViewer} input.
 * @param inputElementType The input {@link IElementType}.
 * @return A new {@link TableViewer}.
 */
public static TableViewer createDataModelTableViewer(IWorkbenchPartSite site, Table table, Class<?> dataModelClass,
        final IElementType dataModelElementType, Object input, IElementType inputElementType) {

    TableViewer tableViewer = createTableViewer(table, dataModelClass, dataModelElementType, input,
            inputElementType, new DataModelElementBinding());

    List<BaseAction> tableActions = dataModelElementType.getActions();
    if (tableActions != null) {
        for (BaseAction action : tableActions) {
            action.setSelectionProvider(tableViewer);
        }

        MenuManager menuManager = new MenuManager("#PopupMenu");
        menuManager.setRemoveAllWhenShown(true);
        menuManager.addMenuListener(new IMenuListener() {

            public void menuAboutToShow(IMenuManager manager) {
                dataModelElementType.fillContextMenu(manager);
            }

        });

        Menu menu = menuManager.createContextMenu(table);
        table.setMenu(menu);
        site.registerContextMenu(menuManager, tableViewer);
    }

    return tableViewer;
}
 
Example 22
Project: neoscada   File: MemoryActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) );
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction );

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction );

    super.addGlobalActions ( menuManager );
}
 
Example 23
Project: gemoc-studio   File: GexpressionsActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 24
Project: eZooKeeper   File: ZnodeModelChildrenFormPage.java   Source Code and License 5 votes vote down vote up
private void hookTableContextMenu() {
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            fillContextMenu(manager);
        }
    });

    Menu menu = menuMgr.createContextMenu(_TableViewer.getControl());
    _TableViewer.getControl().setMenu(menu);
    getSite().registerContextMenu(menuMgr, _TableViewer);
}
 
Example 25
Project: time4sys   File: LibraryActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 26
Project: eZooKeeper   File: JmxExplorerView.java   Source Code and License 5 votes vote down vote up
private void hookContextMenu() {
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            fillContextMenu(manager);
        }
    });

    Menu menu = menuMgr.createContextMenu(_TreeViewer.getControl());
    _TreeViewer.getControl().setMenu(menu);
    getSite().registerContextMenu(menuMgr, _TreeViewer);
}
 
Example 27
Project: eZooKeeper   File: AbstractJmxDataModelElementType.java   Source Code and License 5 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {

    BaseOpenAction openAction = getOpenAction();
    if (openAction != null && !openAction.getSelectionProvider().getSelection().isEmpty()) {
        manager.add(openAction);
    }

    RefreshAction refreshAction = getRefreshAction();
    if (refreshAction != null && !refreshAction.getSelectionProvider().getSelection().isEmpty()) {
        manager.add(new Separator());
        manager.add(refreshAction);
    }
}
 
Example 28
Project: neoscada   File: ProtocolActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 29
Project: time4sys   File: AnalysisActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 30
Project: neoscada   File: CommonActionProvider.java   Source Code and License 5 votes vote down vote up
@Override
public void fillContextMenu ( final IMenuManager menu )
{
    if ( this.openAction.isEnabled () )
    {
        // menu.appendToGroup ( ICommonMenuConstants.GROUP_OPEN, this.openAction );
    }
}
 
Example 31
Project: neoscada   File: ApplicationActionBarAdvisor.java   Source Code and License 5 votes vote down vote up
@Override
protected void fillMenuBar ( final IMenuManager menuBar )
{
    final MenuManager fileMenu = new MenuManager ( "&File", IWorkbenchActionConstants.M_FILE );
    final MenuManager windowMenu = new MenuManager ( "&Window", IWorkbenchActionConstants.M_WINDOW );
    final MenuManager helpMenu = new MenuManager ( "&Help", IWorkbenchActionConstants.M_HELP );
    final MenuManager fileNewMenu = new MenuManager ( "&New", IWorkbenchActionConstants.NEW_EXT );
    final MenuManager windowNewMenu = new MenuManager ( "Show &View", IWorkbenchActionConstants.SHOW_EXT );

    menuBar.add ( fileMenu );
    // Add a group marker indicating where action set menus will appear.
    menuBar.add ( new GroupMarker ( IWorkbenchActionConstants.MB_ADDITIONS ) );
    menuBar.add ( windowMenu );
    menuBar.add ( helpMenu );

    // File
    fileMenu.add ( this.newWindowAction );
    fileMenu.add ( new Separator () );
    fileMenu.add ( fileNewMenu );
    fileMenu.add ( getAction ( ActionFactory.SAVE.getId () ) );
    fileMenu.add ( getAction ( ActionFactory.NEW_EDITOR.getId () ) );
    fileMenu.add ( new GroupMarker ( IWorkbenchActionConstants.OPEN_EXT ) );

    fileMenu.add ( new Separator () );
    fileMenu.add ( this.exitAction );

    fileNewMenu.add ( this.newWizards );

    // Window
    windowNewMenu.add ( this.showViews );
    windowMenu.add ( windowNewMenu );
    windowMenu.add ( getAction ( ActionFactory.PREFERENCES.getId () ) );

    // Help
    helpMenu.add ( this.aboutAction );
    helpMenu.add ( getAction ( ActionFactory.INTRO.getId () ) );
}
 
Example 32
Project: scanning   File: DetectorView.java   Source Code and License 5 votes vote down vote up
/**
 * Create the actions.
 */
private void createActions() {

	IMenuManager popup = new MenuManager();
	List<IContributionManager> mans = Arrays.asList(getViewSite().getActionBars().getToolBarManager(), getViewSite().getActionBars().getMenuManager(), popup);

	IAction showHardware   = createPreferenceAction("Show Devices",   DevicePreferenceConstants.SHOW_HARDWARE,   "icons/camera-lens.png");
	IAction showMalcolm   = createPreferenceAction("Show Malcolm Devices",   DevicePreferenceConstants.SHOW_MALCOLM,   "icons/alarm-clock-select.png");
	IAction showProcessing = createPreferenceAction("Show Processing", DevicePreferenceConstants.SHOW_PROCESSING, "icons/processing.png");
	ViewUtil.addGroups("visibility", mans, showHardware, showMalcolm, showProcessing);

	IAction refresh = new Action("Refresh", Activator.getImageDescriptor("icons/recycle.png")) {
		@Override
		public void run() {
			refresh();
		}
	};

	ViewUtil.addGroups("refresh", mans, refresh);

	IAction configure = new Action("Configure", Activator.getImageDescriptor("icons/configure.png")) {
		@Override
		public void run() {
			configure();
		}
	};
	ViewUtil.addGroups("camera", mans, configure);

}
 
Example 33
Project: neoscada   File: ChartActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator. <!-- begin-user-doc --> <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
protected void addGlobalActions ( final IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) );
    menuManager.insertAfter ( "ui-actions", this.showPropertiesViewAction );

    this.refreshViewerAction.setEnabled ( this.refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", this.refreshViewerAction );
    menuManager.insertAfter ( "ui-actions", this.saveAsAction );

    super.addGlobalActions ( menuManager );
}
 
Example 34
Project: neoscada   File: ItemActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 35
Project: time4sys   File: GqamActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 36
Project: neoscada   File: MonitorsView.java   Source Code and License 5 votes vote down vote up
private void hookContextMenu ()
{
    final MenuManager menuMgr = new MenuManager ( "#PopupMenu", VIEW_ID );
    menuMgr.setRemoveAllWhenShown ( true );
    menuMgr.addMenuListener ( new IMenuListener () {
        @Override
        public void menuAboutToShow ( final IMenuManager manager )
        {
            fillContextMenu ( manager );
        }
    } );
    final Menu menu = menuMgr.createContextMenu ( this.viewer.getControl () );
    this.viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( menuMgr, this.viewer );
}
 
Example 37
Project: neoscada   File: MonitorsViewTable.java   Source Code and License 5 votes vote down vote up
protected void hookContextMenu ( final Control control, final ISelectionProvider selectionProvider, final IViewSite viewSite )
{
    final MenuManager menuMgr = new MenuManager ( "#PopupMenu" ); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown ( true );
    menuMgr.addMenuListener ( new IMenuListener () {
        @Override
        public void menuAboutToShow ( final IMenuManager manager )
        {
            fillContextMenu ( manager );
        }
    } );
    final Menu menu = menuMgr.createContextMenu ( control );
    control.setMenu ( menu );
    viewSite.registerContextMenu ( menuMgr, selectionProvider );
}
 
Example 38
Project: neoscada   File: EventViewTable.java   Source Code and License 5 votes vote down vote up
protected void hookContextMenu ( final Control control, final ISelectionProvider selectionProvider, final IViewSite viewSite )
{
    final MenuManager menuMgr = new MenuManager ( "#PopupMenu" ); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown ( true );
    menuMgr.addMenuListener ( new IMenuListener () {
        @Override
        public void menuAboutToShow ( final IMenuManager manager )
        {
            fillContextMenu ( manager );
        }
    } );
    final Menu menu = menuMgr.createContextMenu ( control );
    control.setMenu ( menu );
    viewSite.registerContextMenu ( menuMgr, selectionProvider );
}
 
Example 39
Project: neoscada   File: DetailViewActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 40
Project: time4sys   File: MappingActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 41
Project: time4sys   File: GrmActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 42
Project: neoscada   File: ConfigurationActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 43
Project: Open_Source_ECOA_Toolset_AS5   File: ContextMenuProvider.java   Source Code and License 5 votes vote down vote up
@Override
public void buildContextMenu(IMenuManager menu) {
	GEFActionConstants.addStandardActionGroups(menu);
	IAction rAction;
	rAction = getActionRegistry().getAction("OSETS_FREFRESH_COMMANDS");
	if (rAction != null) {
		menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, rAction);
	}
	rAction = getActionRegistry().getAction("OSETS_DREFRESH_COMMANDS");
	if (rAction != null) {
		menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, rAction);
	}
	rAction = getActionRegistry().getAction("OSETS_CREFRESH_COMMANDS");
	if (rAction != null) {
		menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, rAction);
	}
	IAction eAction;
	eAction = getActionRegistry().getAction("OSETS_EXPORT_COMMANDS");
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, eAction);
	IAction action;
	action = getActionRegistry().getAction("OSETS_COMMANDS");
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, action);
	IAction cAction;
	cAction = getActionRegistry().getAction("OSETS_CLEAR_COMMANDS");
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, cAction);
	IAction uAction;
	uAction = getActionRegistry().getAction("OSETS_UID_COMMANDS");
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, uAction);
	IAction aAction;
	aAction = getActionRegistry().getAction("OSETS_API_COMMANDS");
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, aAction);
	IAction iAction;
	iAction = getActionRegistry().getAction("OSETS_INT_COMMANDS");
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, iAction);
}
 
Example 44
Project: OCCI-Studio   File: PlatformActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 45
Project: time4sys   File: SrmActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 46
Project: scanning   File: ScanView.java   Source Code and License 5 votes vote down vote up
private void setDynamicMenuOptions(IMenuManager mm) {

		mm.add(add);
		mm.add(delete);
		mm.add(clear);
		mm.add(new Separator());

		IPointGenerator<?> gen = null;

		try {
			ISeriesItemDescriptor selected = seriesTable.getSelected();
			if (!(selected instanceof GeneratorDescriptor)) return;
			gen = ((GeneratorDescriptor)selected).getSeriesObject();
		} catch (Exception e1) {

		}

		final IAction passUnMod = new Action("Enabled", IAction.AS_CHECK_BOX) {
			@Override
			public void run() {
				ISeriesItemDescriptor current = seriesTable.getSelected();
				if (current instanceof GeneratorDescriptor) {
					try {
						((GeneratorDescriptor)current).getSeriesObject().setEnabled(isChecked());
						seriesTable.refreshTable();
					} catch (Exception e) {
						logger.error("Problem refreshing series table!", e);
					}
				}
			}
		};

		if (gen != null && !gen.isEnabled()) passUnMod.setChecked(true);
		mm.add(passUnMod);
	}
 
Example 47
Project: neoscada   File: RecipeActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 48
Project: time4sys   File: TraceActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 49
Project: neoscada   File: DeploymentActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 50
Project: neoscada   File: ProfileActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 51
Project: gemoc-studio   File: AbstractTimelineView.java   Source Code and License 5 votes vote down vote up
/**
 * Creates the {@link MenuManager}.
 */
private void createMenuManager() {
	menuManager = new MenuManager();
	menuManager.setRemoveAllWhenShown(true);
	menuManager.addMenuListener(new IMenuListener() {
		public void menuAboutToShow(IMenuManager mgr) {
			fillContextMenu(mgr);
		}
	});
	Menu menu = menuManager.createContextMenu(timelineViewer.getControl());
	timelineViewer.getControl().setMenu(menu);
	getSite().registerContextMenu(menuManager, timelineViewer);
	// make the selection available
	getSite().setSelectionProvider(timelineViewer);
}
 
Example 52
Project: neoscada   File: OsgiActionBarContributor.java   Source Code and License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 53
Project: convertigo-eclipse   File: ProjectExplorerView.java   Source Code and License 4 votes vote down vote up
private void fillContextMenu(IMenuManager manager) {
	// Other plug-ins can contribute there actions here
	manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
 
Example 54
Project: n4js   File: ApiCompareView.java   Source Code and License 4 votes vote down vote up
private void fillContextMenu(IMenuManager manager) {
	manager.add(actionUpdate);
	// Other plug-ins can contribute there actions here
	manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
 
Example 55
Project: time4sys   File: MappingEditor.java   Source Code and License 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage() {
	if (contentOutlinePage == null) {
		// The content outline is just a tree.
		//
		class MyContentOutlinePage extends ContentOutlinePage {
			@Override
			public void createControl(Composite parent) {
				super.createControl(parent);
				contentOutlineViewer = getTreeViewer();
				contentOutlineViewer.addSelectionChangedListener(this);

				// Set up the tree viewer.
				//
				contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
				contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
				contentOutlineViewer.setInput(editingDomain.getResourceSet());

				// Make sure our popups work.
				//
				createContextMenuFor(contentOutlineViewer);

				if (!editingDomain.getResourceSet().getResources().isEmpty()) {
				  // Select the root object in the view.
				  //
				  contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
				}
			}

			@Override
			public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
				super.makeContributions(menuManager, toolBarManager, statusLineManager);
				contentOutlineStatusLineManager = statusLineManager;
			}

			@Override
			public void setActionBars(IActionBars actionBars) {
				super.setActionBars(actionBars);
				getActionBarContributor().shareGlobalActions(this, actionBars);
			}
		}

		contentOutlinePage = new MyContentOutlinePage();

		// Listen to selection so that we can handle it is a special way.
		//
		contentOutlinePage.addSelectionChangedListener
			(new ISelectionChangedListener() {
				 // This ensures that we handle selections correctly.
				 //
				 public void selectionChanged(SelectionChangedEvent event) {
					 handleContentOutlineSelection(event.getSelection());
				 }
			 });
	}

	return contentOutlinePage;
}
 
Example 56
Project: Open_Source_ECOA_Toolset_AS5   File: ServicesEditorContributor.java   Source Code and License 4 votes vote down vote up
public void contributeToMenu(IMenuManager manager) {
	IMenuManager menu = new MenuManager("Editor &Menu");
	manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
	menu.add(sampleAction);
}
 
Example 57
Project: neoscada   File: SecurityEditor.java   Source Code and License 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage ()
{
    if ( contentOutlinePage == null )
    {
        // The content outline is just a tree.
        //
        class MyContentOutlinePage extends ContentOutlinePage
        {
            @Override
            public void createControl ( Composite parent )
            {
                super.createControl ( parent );
                contentOutlineViewer = getTreeViewer ();
                contentOutlineViewer.addSelectionChangedListener ( this );

                // Set up the tree viewer.
                //
                contentOutlineViewer.setContentProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
                contentOutlineViewer.setLabelProvider ( new AdapterFactoryLabelProvider ( adapterFactory ) );
                contentOutlineViewer.setInput ( editingDomain.getResourceSet () );

                // Make sure our popups work.
                //
                createContextMenuFor ( contentOutlineViewer );

                if ( !editingDomain.getResourceSet ().getResources ().isEmpty () )
                {
                    // Select the root object in the view.
                    //
                    contentOutlineViewer.setSelection ( new StructuredSelection ( editingDomain.getResourceSet ().getResources ().get ( 0 ) ), true );
                }
            }

            @Override
            public void makeContributions ( IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager )
            {
                super.makeContributions ( menuManager, toolBarManager, statusLineManager );
                contentOutlineStatusLineManager = statusLineManager;
            }

            @Override
            public void setActionBars ( IActionBars actionBars )
            {
                super.setActionBars ( actionBars );
                getActionBarContributor ().shareGlobalActions ( this, actionBars );
            }
        }

        contentOutlinePage = new MyContentOutlinePage ();

        // Listen to selection so that we can handle it is a special way.
        //
        contentOutlinePage.addSelectionChangedListener
                ( new ISelectionChangedListener ()
                {
                    // This ensures that we handle selections correctly.
                    //
                    public void selectionChanged ( SelectionChangedEvent event )
                    {
                        handleContentOutlineSelection ( event.getSelection () );
                    }
                } );
    }

    return contentOutlinePage;
}
 
Example 58
Project: time4sys   File: SrmEditor.java   Source Code and License 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage() {
	if (contentOutlinePage == null) {
		// The content outline is just a tree.
		//
		class MyContentOutlinePage extends ContentOutlinePage {
			@Override
			public void createControl(Composite parent) {
				super.createControl(parent);
				contentOutlineViewer = getTreeViewer();
				contentOutlineViewer.addSelectionChangedListener(this);

				// Set up the tree viewer.
				//
				contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
				contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
				contentOutlineViewer.setInput(editingDomain.getResourceSet());

				// Make sure our popups work.
				//
				createContextMenuFor(contentOutlineViewer);

				if (!editingDomain.getResourceSet().getResources().isEmpty()) {
				  // Select the root object in the view.
				  //
				  contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
				}
			}

			@Override
			public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
				super.makeContributions(menuManager, toolBarManager, statusLineManager);
				contentOutlineStatusLineManager = statusLineManager;
			}

			@Override
			public void setActionBars(IActionBars actionBars) {
				super.setActionBars(actionBars);
				getActionBarContributor().shareGlobalActions(this, actionBars);
			}
		}

		contentOutlinePage = new MyContentOutlinePage();

		// Listen to selection so that we can handle it is a special way.
		//
		contentOutlinePage.addSelectionChangedListener
			(new ISelectionChangedListener() {
				 // This ensures that we handle selections correctly.
				 //
				 public void selectionChanged(SelectionChangedEvent event) {
					 handleContentOutlineSelection(event.getSelection());
				 }
			 });
	}

	return contentOutlinePage;
}
 
Example 59
Project: smarthome-cep-demonstrator   File: SmarthomeEditor.java   Source Code and License 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   public IContentOutlinePage getContentOutlinePage() {
	if (contentOutlinePage == null) {
		// The content outline is just a tree.
		//
		class MyContentOutlinePage extends ContentOutlinePage {
			@Override
			public void createControl(Composite parent) {
				super.createControl(parent);
				contentOutlineViewer = getTreeViewer();
				contentOutlineViewer.addSelectionChangedListener(this);

				// Set up the tree viewer.
				//
				contentOutlineViewer.setUseHashlookup(true);
				contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
				contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
				contentOutlineViewer.setInput(editingDomain.getResourceSet());

				// Make sure our popups work.
				//
				createContextMenuFor(contentOutlineViewer);

				if (!editingDomain.getResourceSet().getResources().isEmpty()) {
				  // Select the root object in the view.
				  //
				  contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
				}
			}

			@Override
			public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
				super.makeContributions(menuManager, toolBarManager, statusLineManager);
				contentOutlineStatusLineManager = statusLineManager;
			}

			@Override
			public void setActionBars(IActionBars actionBars) {
				super.setActionBars(actionBars);
				getActionBarContributor().shareGlobalActions(this, actionBars);
			}
		}

		contentOutlinePage = new MyContentOutlinePage();

		// Listen to selection so that we can handle it is a special way.
		//
		contentOutlinePage.addSelectionChangedListener
			(new ISelectionChangedListener() {
				 // This ensures that we handle selections correctly.
				 //
				 public void selectionChanged(SelectionChangedEvent event) {
					 handleContentOutlineSelection(event.getSelection());
				 }
			 });
	}

	return contentOutlinePage;
}
 
Example 60
Project: SimQRI   File: MetamodelEditor.java   Source Code and License 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage() {
	if (contentOutlinePage == null) {
		// The content outline is just a tree.
		//
		class MyContentOutlinePage extends ContentOutlinePage {
			@Override
			public void createControl(Composite parent) {
				super.createControl(parent);
				contentOutlineViewer = getTreeViewer();
				contentOutlineViewer.addSelectionChangedListener(this);

				// Set up the tree viewer.
				//
				contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
				contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
				contentOutlineViewer.setInput(editingDomain.getResourceSet());

				// Make sure our popups work.
				//
				createContextMenuFor(contentOutlineViewer);

				if (!editingDomain.getResourceSet().getResources().isEmpty()) {
				  // Select the root object in the view.
				  //
				  contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
				}
			}

			@Override
			public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
				super.makeContributions(menuManager, toolBarManager, statusLineManager);
				contentOutlineStatusLineManager = statusLineManager;
			}

			@Override
			public void setActionBars(IActionBars actionBars) {
				super.setActionBars(actionBars);
				getActionBarContributor().shareGlobalActions(this, actionBars);
			}
		}

		contentOutlinePage = new MyContentOutlinePage();

		// Listen to selection so that we can handle it is a special way.
		//
		contentOutlinePage.addSelectionChangedListener
			(new ISelectionChangedListener() {
				 // This ensures that we handle selections correctly.
				 //
				 public void selectionChanged(SelectionChangedEvent event) {
					 handleContentOutlineSelection(event.getSelection());
				 }
			 });
	}

	return contentOutlinePage;
}