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

The following examples show how to use org.eclipse.jface.action.Separator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * fill the popup menu for the table
 */
private void fillTableMenu(IMenuManager manager) {
	manager.add(getRefreshAction());

	Action action = getAddPropertyAction();
	try { 		
		if (resource != null)
			action.setEnabled(resource.isManaged());
		else
			action.setEnabled(false);
	} catch (SVNException e) {
		action.setEnabled(false);
	}
	manager.add(action);

	manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
 
Example 2
protected void fillCallHierarchyViewerContextMenu(IMenuManager menu) {
      JavaPlugin.createStandardGroups(menu);

menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fRefreshSingleElementAction);
      menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS));

      if (fFocusOnSelectionAction.canActionBeAdded()) {
          menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction);
      }
      if (fExpandWithConstructorsAction.canActionBeAdded()) {
      	menu.appendToGroup(GROUP_FOCUS, fExpandWithConstructorsAction);
      }
      
      if (fRemoveFromViewAction.canActionBeAdded()){
      	menu.appendToGroup(GROUP_FOCUS, fRemoveFromViewAction);
      }

      fActionGroups.setContext(new ActionContext(getSelection()));
      fActionGroups.fillContextMenu(menu);
      fActionGroups.setContext(null);

if (fCopyAction.canActionBeAdded()) {
	menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, fCopyAction);
}
  }
 
Example 3
Source Project: birt   Source File: DataSetNodeProvider.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the context menu for the given object. Gets the action from the
 * actionRegistry and adds the action to the menu.
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	super.createContextMenu( sourceViewer, object, menu );

	menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
			new ShowPropertyAction( object ) );

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
	IAction action = new RefreshAction( sourceViewer );
	if (action.isEnabled( ))
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
	}
}
 
Example 4
Source Project: elexis-3-core   Source File: ViewMenus.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void fillContextMenu(IMenuManager manager, List<IContributionItem> contributionItems){
	manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
	for (IContributionItem contributionItem : contributionItems) {
		if (contributionItem == null) {
			manager.add(new Separator());
			continue;
		} else if (contributionItem instanceof ActionContributionItem) {
			ActionContributionItem ac = (ActionContributionItem) contributionItem;
			if (ac.getAction() instanceof RestrictedAction) {
				((RestrictedAction) ac.getAction()).reflectRight();
			}
		}
		contributionItem.update();
		manager.add(contributionItem);
	}
}
 
Example 5
Source Project: ADT_Frontend   Source File: AbapGitStagingObjectMenuFactory.java    License: MIT License 6 votes vote down vote up
private void buildContextMenu(IMenuManager menuManager) {
	TreeSelection selection = (TreeSelection) this.treeViewer.getSelection();

	//open object action
	this.menuManager.add(this.openAction);
	this.menuManager.add(new Separator());
	if (this.unstaged) {
		//stage objects action
		this.menuManager.add(this.stageAction);
	} else {
		//unstage objects action
		this.menuManager.add(this.unstageAction);
	}
	//TODO: remove this check after the 2002 upgrade
	if (this.stagingService.isFileCompareSupported(selection.getFirstElement())) {
		//file compare
		this.menuManager.add(this.compareAction);
	}
	if (selection.size() == 1) {
		this.menuManager.add(new Separator());
		//copy name to clipboard action
		this.menuManager.add(this.copyAction);
	}
}
 
Example 6
Source Project: typescript.java   Source File: ReferencesSearchGroup.java    License: MIT License 6 votes vote down vote up
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM = new MenuManager(getName(), IContextMenuConstants.GROUP_SEARCH);
	// addAction(fFindReferencesAction, javaSearchMM);
	addAction(fFindReferencesInProjectAction, javaSearchMM);
	// addAction(fFindReferencesInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());
	//
	// Iterator iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	// while (iter.hasNext()) {
	// addWorkingSetAction((IWorkingSet[]) iter.next(), javaSearchMM);
	// }
	// addAction(fFindReferencesInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example 7
Source Project: tracecompass   Source File: FlameChartView.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @since 1.2
 */
@Override
protected void fillLocalToolBar(@Nullable IToolBarManager manager) {
    if (manager == null) {
        return;
    }
    makeActions();
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getConfigureSymbolsAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getShowFilterDialogAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getResetScaleAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getPreviousEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getNextEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getToggleBookmarkAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getPreviousMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getNextMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fPreviousItemAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fNextItemAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getZoomInAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getZoomOutAction());
}
 
Example 8
private void createContextMenu() {
  MenuManager menuMgr = new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener() {
    @Override
    public void menuAboutToShow(IMenuManager manager) {
      populateBrowserActions(launchConfiguration, manager);
      manager.add(new Separator());

      manager.add(new Action("&Copy") {
        @Override
        public void run() {
          copySelectionToClipboard();
        }
      });
    }
  });
  Menu menu = menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
}
 
Example 9
Source Project: neoscada   Source File: ProtocolEditor.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
 
Example 10
@Override
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindImplementorsAction, javaSearchMM);
	addAction(fFindImplementorsInProjectAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindImplementorsInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example 11
Source Project: olca-app   Source File: RcpActionBarAdvisor.java    License: Mozilla Public License 2.0 6 votes vote down vote up
private void fillFileMenu(IMenuManager menuBar) {
	MenuManager menu = new MenuManager(
			M.File, IWorkbenchActionConstants.M_FILE);
	menu.add(saveAction);
	menu.add(saveAsAction);
	menu.add(saveAllAction);
	menu.add(new Separator());
	menu.add(closeAction);
	menu.add(closeAllAction);
	menu.add(new Separator());
	menu.add(preferencesAction);
	menu.add(new Separator());
	menu.add(new ImportAction());
	menu.add(new ExportAction());
	menu.add(new Separator());
	menu.add(exitAction);
	menuBar.add(menu);
}
 
Example 12
Source Project: typescript.java   Source File: EditTemplateDialog.java    License: MIT License 6 votes vote down vote up
private void fillContextMenu(IMenuManager menu) {
	menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.UNDO));

	menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.CUT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.COPY));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.PASTE));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));

	menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
	menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, (IAction) fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$
}
 
Example 13
Source Project: neoscada   Source File: AbstractChartView.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void fillToolbar ( final IContributionManager contributionManager )
{
    contributionManager.add ( new SetTimespanAction ( 1, TimeUnit.MINUTES, "<1m>", "Scale to one minute" ) );
    contributionManager.add ( new SetTimespanAction ( 1, TimeUnit.HOURS, "<1h>", "Scale to one hour" ) );
    contributionManager.add ( new SetTimespanAction ( 1, TimeUnit.DAYS, "<1d>", "Scale to one day" ) );

    contributionManager.add ( new CenterNowAction () );

    contributionManager.add ( new Separator () );

    contributionManager.add ( new PageTimespanAction ( -1, TimeUnit.DAYS, "<1d", "Move back 1 day" ) );
    contributionManager.add ( new PageTimespanAction ( -1, TimeUnit.HOURS, "<1h", "Move back 1 hour" ) );
    contributionManager.add ( new PageTimespanAction ( -1, TimeUnit.MINUTES, "<1m", "Move back 1 minute" ) );

    contributionManager.add ( new Separator () );

    contributionManager.add ( new PageTimespanAction ( 1, TimeUnit.MINUTES, "1m>", "Move forward 1 minute" ) );
    contributionManager.add ( new PageTimespanAction ( 1, TimeUnit.HOURS, "1h>", "Move forward 1 hour" ) );
    contributionManager.add ( new PageTimespanAction ( 1, TimeUnit.DAYS, "1d>", "Move forward 1 day" ) );

    contributionManager.add ( new Separator () );

    contributionManager.add ( new HelpAction () );
}
 
Example 14
Source Project: neoscada   Source File: ChartConfiguratorView.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createPartControl ( final Composite parent )
{
    this.container = parent;
    createEditingDomain ();

    parent.setLayout ( new FillLayout () );
    this.viewer = new TreeViewer ( parent );
    this.viewer.setAutoExpandLevel ( 2 );

    this.viewer.setContentProvider ( new AdapterFactoryContentProvider ( this.factory ) );
    this.viewer.setLabelProvider ( new AdapterFactoryLabelProvider ( this.factory ) );

    createContextMenuFor ( this.viewer );

    new AdapterFactoryTreeEditor ( this.viewer.getTree (), this.factory );
    getViewSite ().setSelectionProvider ( this.viewer );

    attachSelectionService ();

    getViewSite ().getActionBars ().getMenuManager ().add ( new Separator ( "additions" ) );

    this.actionBarContributor.init ( getViewSite ().getActionBars () );
    this.actionBarContributor.setViewPart ( this );
}
 
Example 15
/**
 * 创建帮助菜单
 * @return 返回帮助菜单的 menu manager;
 */
private MenuManager createHelpMenu() {
	MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"),
			IWorkbenchActionConstants.M_HELP);
	// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
	menu.add(helpAction);
	// menu.add(helpSearchAction);
	// menu.add(dynamicHelpAction);
	// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
	menu.add(new GroupMarker("help.keyAssist"));
	menu.add(new Separator());
	menu.add(new GroupMarker("help.updatePlugin"));
	menu.add(new Separator());
	menu.add(new GroupMarker("help.license"));
	// 关于菜单需要始终显示在最底端
	menu.add(new GroupMarker("group.about"));
	// ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
	// aboutItem.setVisible(!Util.isMac());
	// menu.add(aboutItem);
	return menu;
}
 
Example 16
Source Project: neoscada   Source File: GlobalizeEditor.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
 
Example 17
private int fillViewSubMenu(IMenuManager source) {
	int added= 0;
	source.add(new Separator(GROUP_COMMENT));
	added+= addAction(source, fAddJavaDocStub);
	source.add(new Separator(GROUP_EDIT));
	added+= addAction(source, fFormatAll);
	source.add(new Separator(GROUP_IMPORT));
	added+= addAction(source, fAddImport);
	added+= addAction(source, fOrganizeImports);
	added+= addAction(source, fSortMembers);
	added+= addAction(source, fCleanUp);
	source.add(new Separator(GROUP_GENERATE));
	added+= addAction(source, fOverrideMethods);
	added+= addAction(source, fAddGetterSetter);
	added+= addAction(source, fAddDelegateMethods);
	added+= addAction(source, fHashCodeEquals);
	added+= addAction(source, fToString);
	added+= addAction(source, fGenerateConstructorUsingFields);
	added+= addAction(source, fAddUnimplementedConstructors);
	source.add(new Separator(GROUP_CODE));
	source.add(new Separator(GROUP_EXTERNALIZE));
	added+= addAction(source, fExternalizeStrings);
	added+= addAction(source, fFindNLSProblems);
	return added;
}
 
Example 18
Source Project: elexis-3-core   Source File: FaelleComposite.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public FaelleComposite(Composite parent, int style){
	super(parent, style);
	setLayout(new GridLayout(1, false));
	tableViewerFaelle = new TableViewer(this, SWT.None);
	tableViewerFaelle.getTable().setBackground(UiDesk.getColor(UiDesk.COL_WHITE));
	tableViewerFaelle.getTable().setLayoutData(
		new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	
	tableViewerFaelle.setLabelProvider(new FaelleLabelProvider());
	tableViewerFaelle.setContentProvider(new FaelleContentProvider());
	MenuManager menuManager = new MenuManager();
	menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
	
	tableViewerFaelle.getTable().setMenu(
		menuManager.createContextMenu(tableViewerFaelle.getTable()));
	menuManager.add(GlobalActions.openFallaction);
	menuManager.add(GlobalActions.makeBillAction);
	menuManager.add(GlobalActions.delFallAction);
	menuManager.add(GlobalActions.reopenFallAction);
	
	tableViewerFaelle.addSelectionChangedListener(new FallSelectionChangedToEventDispatcher());
}
 
Example 19
Source Project: neoscada   Source File: VisualInterfaceEditor.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
 
Example 20
private void addExportMenu(IMenuManager aMenu) {

		exportWizardActionGroup.setContext(getContext());
		if (exportWizardActionGroup.getWizardActionIds().length == 0) {
			aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, exportAction);
			return;
		}
		IMenuManager submenu = new MenuManager(
				WorkbenchNavigatorMessages.PortingActionProvider_ExportResourcesMenu_label,
				COMMON_NAVIGATOR_EXPORT_MENU);
		exportWizardActionGroup.fillContextMenu(submenu);

		submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
		submenu.add(new Separator());
		submenu.add(exportAction);
		aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu);
	}
 
Example 21
@Override
public void init(IPageSite site) {
	super.init(site);
	IMenuManager menuManager = site.getActionBars().getMenuManager();
	menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator(GROUP_FILTERING));
	fActionGroup.fillActionBars(site.getActionBars());
	menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action(SearchMessages.JavaSearchResultPage_preferences_label) {
		@Override
		public void run() {
			String pageId= "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$
			String[] displayedPages= { pageId,
					"org.eclipse.ui.editors.preferencePages.Annotations", //$NON-NLS-1$
					"org.eclipse.ui.preferencePages.ColorsAndFonts" //$NON-NLS-1$
			};
			PreferencesUtil.createPreferenceDialogOn(JavaPlugin.getActiveWorkbenchShell(), pageId, displayedPages, null).open();
		}
	});
}
 
Example 22
Source Project: neoscada   Source File: ProfileEditor.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
 
Example 23
Source Project: tracecompass   Source File: SDView.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Creates the menu group.
 */
protected void createMenuGroup() {
    IActionBars bar = getViewSite().getActionBars();
    if (bar == null) {
        return;
    }
    bar.getToolBarManager().add(new Separator(UML2SD_VIEW_MODES_SEPARATOR));
    bar.getToolBarManager().add(new Separator(UML2SD_WORKING_SET_SEPARATOR));
    bar.getToolBarManager().add(new Separator(UML2SD_SORTING_SEPARATOR));
    bar.getToolBarManager().add(new Separator(UML2SD_FILTERING_SEPARATOR));
    bar.getToolBarManager().add(new Separator(UML2SD_VIEW_LAYOUT_SEPARATOR));
    bar.getToolBarManager().add(new Separator(UML2SD_LINK_EDITOR_SEPARATOR));
    bar.getToolBarManager().add(new Separator(UML2SD_OTHER_COMMANDS_SEPARATOR));
    bar.getToolBarManager().add(new Separator(UML2SD_OTHER_PLUGINS_COMMANDS_SEPARATOR));
    bar.getMenuManager().add(new Separator(UML2SD_VIEW_MODES_SEPARATOR));
    bar.getMenuManager().add(new Separator(UML2SD_WORKING_SET_SEPARATOR));
    bar.getMenuManager().add(new Separator(UML2SD_SORTING_SEPARATOR));
    bar.getMenuManager().add(new Separator(UML2SD_FILTERING_SEPARATOR));
    bar.getMenuManager().add(new Separator(UML2SD_VIEW_LAYOUT_SEPARATOR));
    bar.getMenuManager().add(new Separator(UML2SD_LINK_EDITOR_SEPARATOR));
    bar.getMenuManager().add(new Separator(UML2SD_OTHER_COMMANDS_SEPARATOR));
    bar.getMenuManager().add(new Separator(UML2SD_OTHER_PLUGINS_COMMANDS_SEPARATOR));
}
 
Example 24
Source Project: neoscada   Source File: ComponentEditor.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This creates a context menu for the viewer and adds a listener as well
 * registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
protected void createContextMenuFor ( final StructuredViewer viewer )
{
    final MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    final Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    final Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance (), ItemTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new DropAdapterExtension ( this.editingDomain, viewer ) );
}
 
Example 25
Source Project: birt   Source File: ReportExamplesView.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void registerActions( )
{
	final IActionBars actionBars = getViewSite( ).getActionBars( );
	IToolBarManager toolbarManager = actionBars.getToolBarManager( );
	exportAction = new ExportSampleReportAction( instance );
	toolbarManager.add( exportAction );
	toolbarManager.add( new Separator( ) );

	Object adapter = null;
	int status = Platform.getAdapterManager( ).queryAdapter( this,
			IAction.class.getName( ) );

	if ( status == IAdapterManager.LOADED )
	{
		adapter = Platform.getAdapterManager( ).getAdapter( this,
				IAction.class );
	}
	else if ( status == IAdapterManager.NOT_LOADED )
	{
		// Cause the plug-in loading first
		adapter = Platform.getAdapterManager( ).loadAdapter( this,
				IAction.class.getName( ) );
	}
	if ( adapter != null )
	{
		importAction = ( (IOpenSampleReportAction) adapter );
		importAction.setMainComposite( instance );
		toolbarManager.add( (Action) importAction );
	}

	actionBars.updateActionBars( );
}
 
Example 26
@Override
public void fillContextMenu(IMenuManager menu) {
	selProvider.setSelection(selProvider.getSelection());
	menu.add(newProjectAction);
	menu.add(bindAction);
	menu.add(new Separator());
	menu.add(manageRegistriesAction);
	menu.add(manageReposAction);
	menu.add(new Separator());
	if (openTektonDashboardAction.showAction()) {
		menu.add(openTektonDashboardAction);
		menu.add(new Separator());
	}
	menu.add(connectDisconnectAction);
	menu.add(editConnectionAction);
	menu.add(removeConnectionAction);
	boolean supportSeparator = false;
	if (logLevelAction.showAction()) {
		menu.add(new Separator());
		supportSeparator = true;
		menu.add(logLevelAction);
	}
	if (diagnosticsAction.showAction()) {
		if (!supportSeparator) {
			menu.add(new Separator());
		}
		menu.add(diagnosticsAction);
	}
}
 
Example 27
private void addLogFileSubMenu(IMenuManager menu) {
	final ICommonViewerSite viewSite = getActionSite().getViewSite();
	ISelection selection = viewSite.getSelectionProvider().getSelection();
	if (!(selection instanceof IStructuredSelection)) {
		return;
	}

	IStructuredSelection sel = (IStructuredSelection) selection;
	if (sel.size() == 1) {
		Object obj = sel.getFirstElement();
		if (obj instanceof CodewindEclipseApplication) {
			final CodewindEclipseApplication app = (CodewindEclipseApplication) obj;
			if (app.isAvailable() && app.getLogInfos() != null && !app.getLogInfos().isEmpty()) {
				MenuManager menuMgr = new MenuManager(Messages.ShowLogFilesMenu, "ShowLogFiles");
				showAllLogsAction.setApp(app);
				menuMgr.add(showAllLogsAction);
				hideAllLogsAction.setApp(app);
				menuMgr.add(hideAllLogsAction);
				menuMgr.add(new Separator());
				for (ProjectLogInfo logInfo : app.getLogInfos()) {
					menuMgr.add(new LogFileAction(app, logInfo, viewSite));
				}
				menu.add(menuMgr);
			}
		}
	}
}
 
Example 28
private void fillContextMenu(IMenuManager menu) {
	menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO, fGlobalActions.get(ITextEditorActionConstants.UNDO));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO, fGlobalActions.get(ITextEditorActionConstants.REDO));

	menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.CUT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.COPY));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.PASTE));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));

	menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
	menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$
}
 
Example 29
Source Project: lapse-plus   Source File: SinkView.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void fillContextMenu(IMenuManager manager) {
    
    ViewMatch match = (ViewMatch) ((IStructuredSelection) viewer.getSelection())
        .getFirstElement();
    if (match != null && match.isError()) {
        manager.add(doBackwardPropagationAction);
    }
    manager.add(runAction);
    manager.add(copyToClipboardAction);
    
    // Other plug-ins can contribute there actions here
    manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
 
Example 30
/**
 * This adds Separators for editor additions to the tool bar.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void contributeToToolBar ( IToolBarManager toolBarManager )
{
    toolBarManager.add ( new Separator ( "security-settings" ) ); //$NON-NLS-1$
    toolBarManager.add ( new Separator ( "security-additions" ) ); //$NON-NLS-1$
}