Java Code Examples for org.eclipse.swt.widgets.Menu

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala.editor/src-gen/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/model/scala/presentation/.

Source file: ScalaEditor.java

  22 
vote

/** 
 * 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");
  contextMenu.add(new Separator("additions"));
  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()};
  viewer.addDragSupport(dndOperations,transfers,new ViewerDragAdapter(viewer));
  viewer.addDropSupport(dndOperations,transfers,new EditingDomainViewerDropAdapter(editingDomain,viewer));
}
 

Example 2

From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.webapp.editor/src-gen/org/eclipse/acceleo/tutorial/webapp/presentation/.

Source file: WebappEditor.java

  22 
vote

/** 
 * 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");
  contextMenu.add(new Separator("additions"));
  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()};
  viewer.addDragSupport(dndOperations,transfers,new ViewerDragAdapter(viewer));
  viewer.addDropSupport(dndOperations,transfers,new EditingDomainViewerDropAdapter(editingDomain,viewer));
}
 

Example 3

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.ec2/src/com/amazonaws/eclipse/ec2/ui/.

Source file: SelectionTable.java

  22 
vote

/** 
 * Hooks a context (popup) menu for the table control.
 */
private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new AcountValidatingMenuListener());
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  menuMgr.createContextMenu(this);
}
 

Example 4

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/views/.

Source file: ResourceView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    IMenuManager manager){
      ResourceView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 5

From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/views/.

Source file: BioPEPAInvariantsView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      BioPEPAInvariantsView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 6

From project bpelunit, under directory /tycho/net.bpelunit.toolsupport/editors/sections/.

Source file: StructuredSection.java

  22 
vote

protected void hookMenu(){
  MenuManager popupMenuManager=new MenuManager();
  IMenuListener listener=new IMenuListener(){
    public void menuAboutToShow(    IMenuManager mng){
      fillContextMenu(mng);
    }
  }
;
  popupMenuManager.addMenuListener(listener);
  popupMenuManager.setRemoveAllWhenShown(true);
  Control control=getViewer().getControl();
  Menu menu=popupMenuManager.createContextMenu(control);
  control.setMenu(menu);
}
 

Example 7

From project bundlemaker, under directory /main/org.bundlemaker.core.ui.projecteditor/src/org/bundlemaker/core/ui/projecteditor/.

Source file: ProjectEditorPage.java

  22 
vote

/** 
 */
private void createMenuManager(){
  MenuManager menuMgr=new MenuManager();
  Menu menu=menuMgr.createContextMenu(_treeViewer.getControl());
  menuMgr.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    IMenuManager manager){
      fillContextMenu(manager);
    }
  }
);
  menuMgr.setRemoveAllWhenShown(true);
  _treeViewer.getControl().setMenu(menu);
}
 

Example 8

From project Database-Designer, under directory /plugins/org.obeonetwork.dsl.database.editor/src/org/obeonetwork/dsl/database/presentation/.

Source file: DatabaseEditor.java

  22 
vote

/** 
 * 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");
  contextMenu.add(new Separator("additions"));
  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()};
  viewer.addDragSupport(dndOperations,transfers,new ViewerDragAdapter(viewer));
  viewer.addDropSupport(dndOperations,transfers,new EditingDomainViewerDropAdapter(editingDomain,viewer));
}
 

Example 9

From project dawn-isenciaui, under directory /com.isencia.passerelle.workbench.model.editor.ui/src/main/java/com/isencia/passerelle/workbench/model/editor/ui/views/.

Source file: ActorTreeViewerPage.java

  22 
vote

private void createContextMenus(){
  MenuManager menuManager=new ActorTreeMenuProvider(getTreeViewer());
  Menu menu=menuManager.createContextMenu(getTreeViewer().getControl());
  getTreeViewer().getControl().setMenu(menu);
  getSite().registerContextMenu("#Pop up",menuManager,getSite().getSelectionProvider());
}
 

Example 10

From project dawn-workflow, under directory /org.dawb.passerelle.actors/src/org/dawb/passerelle/editors/.

Source file: UserModifyComposite.java

  22 
vote

/** 
 * Create the actions.
 */
protected void initializePopup(IActionBars bars){
  MenuManager man=new MenuManager();
  man.add(confirm);
  man.add(stop);
  man.add(new Separator(getClass().getName() + ".sep1"));
  man.add(add);
  man.add(delete);
  final Menu menu=man.createContextMenu(tableViewer.getTable());
  tableViewer.getTable().setMenu(menu);
}
 

Example 11

From project Diver, under directory /ca.uvic.chisel.javasketch/src/ca/uvic/chisel/javasketch/ui/internal/presentation/.

Source file: TimeLineAnnotationHook.java

  22 
vote

private void hookContextMenu(){
  MenuManager manager=new MenuManager();
  manager.addMenuListener(this);
  manager.setRemoveAllWhenShown(true);
  Menu menu=manager.createContextMenu(editor.getTimeRange());
  editor.getTimeRange().setMenu(menu);
}
 

Example 12

From project droolsjbpm-tools, under directory /drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/views/.

Source file: RepositoryView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      RepositoryView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 13

From project e4-rendering, under directory /com.toedter.e4.ui.workbench.renderers.swt/src/com/toedter/e4/ui/workbench/renderers/swt/.

Source file: MenuItemRenderer.java

  22 
vote

@Override public void createWidget(MUIElement element,MElementContainer<MUIElement> parent){
  if (parent != null && element instanceof MMenuItem) {
    Menu menu=(Menu)parent.getWidget();
    MenuItem menuItem=new MenuItem(menu,SWT.PUSH);
    setItemText((MMenuItem)element,menuItem);
    element.setWidget(menuItem);
  }
}
 

Example 14

From project Eclipse, under directory /com.mobilesorcery.sdk.ui/src/com/mobilesorcery/sdk/ui/internal/actions/.

Source file: ChangeBuildConfigContextAction.java

  22 
vote

public Menu getMenu(Menu parent){
  Menu menu=new Menu(parent);
  menu.addMenuListener(new MenuAdapter(){
    public void menuShown(    MenuEvent e){
      fillMenu((Menu)e.widget);
    }
  }
);
  return menu;
}
 

Example 15

From project eclipse-instasearch, under directory /instasearch/src/it/unibz/instasearch/ui/.

Source file: DropdownMenuProvider.java

  22 
vote

/** 
 * Called when either the button itself or the dropdown arrow is clicked
 * @param event the event that trigged this call
 */
@Override public void widgetSelected(SelectionEvent event){
  ToolItem item=(ToolItem)event.widget;
  if (item != toolItem)   return;
  Rectangle rect=item.getBounds();
  Point pt=item.getParent().toDisplay(new Point(rect.x,rect.y));
  Menu menu=menuManager.createContextMenu(item.getParent());
  menu.setLocation(pt.x,pt.y + rect.height);
  menu.setVisible(true);
  if (event.detail != SWT.ARROW) {
  }
}
 

Example 16

From project eclipse-integration-cloudfoundry, under directory /org.cloudfoundry.ide.eclipse.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/editor/.

Source file: ApplicationActionMenuControl.java

  22 
vote

protected void showViewMenu(MenuManager manager,ToolBar toolBar){
  if (!isVisible()) {
    return;
  }
  Menu menu=manager.createContextMenu(applicationActionButton);
  applicationActionButton.setMenu(menu);
  Rectangle bounds=toolBar.getBounds();
  Point topRight=new Point(bounds.x + bounds.x / 10,bounds.height);
  topRight=applicationActionButton.toDisplay(topRight);
  menu.setLocation(topRight.x,topRight.y);
  menu.setVisible(true);
}
 

Example 17

From project eclipse-integration-gradle, under directory /org.springsource.ide.eclipse.gradle.ui.taskview/src/org/springsource/ide/eclipse/gradle/ui/taskview/.

Source file: GradleTasksView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      GradleTasksView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 18

From project eclipse.pde.build, under directory /org.eclipse.pde.build.tests/resources/309572/plugins/test.flex.root/src/my/view/views/.

Source file: SampleView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      SampleView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 19

From project edna-rcp, under directory /org.edna.mxv1/src/org/edna/mxv1/views/.

Source file: CharacterisationView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      CharacterisationView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 20

From project EMF-IncQuery, under directory /tests/org.eclipse.viatra2.emf.incquery.snapshot.editor/src/org/eclipse/viatra2/emf/incquery/snapshot/EIQSnapshot/presentation/.

Source file: EIQSnapshotEditor.java

  22 
vote

/** 
 * 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");
  contextMenu.add(new Separator("additions"));
  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()};
  viewer.addDragSupport(dndOperations,transfers,new ViewerDragAdapter(viewer));
  viewer.addDropSupport(dndOperations,transfers,new EditingDomainViewerDropAdapter(editingDomain,viewer));
}
 

Example 21

From project fr.obeo.performance, under directory /fr.obeo.performance.editor/src-gen/fr/obeo/performance/presentation/.

Source file: PerformanceEditor.java

  22 
vote

/** 
 * 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");
  contextMenu.add(new Separator("additions"));
  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()};
  viewer.addDragSupport(dndOperations,transfers,new ViewerDragAdapter(viewer));
  viewer.addDropSupport(dndOperations,transfers,new EditingDomainViewerDropAdapter(editingDomain,viewer));
}
 

Example 22

From project gmc, under directory /src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/views/.

Source file: NavigationView.java

  22 
vote

private void setupContextMenu(){
  MenuManager menuManager=new MenuManager("&Gluster","gluster.context.menu");
  Menu contextMenu=menuManager.createContextMenu(treeViewer.getControl());
  treeViewer.getTree().setMenu(contextMenu);
  getSite().registerContextMenu(menuManager,treeViewer);
}
 

Example 23

From project gted, under directory /net.sf.gted.editor/src/net/sf/gted/editor/entry/master/.

Source file: POMasterDetailsBlock.java

  22 
vote

private void createPopupMenu(){
  MenuManager popupMenu=new MenuManager();
  IProject project=this.getPage().getEditor().getPoEditor().getIFile().getProject();
  IAction newRowAction=new RenameMsgidAction(this,project);
  popupMenu.add(newRowAction);
  Menu menu=popupMenu.createContextMenu(table);
  table.setMenu(menu);
}
 

Example 24

From project incubator, under directory /net.karlmartens.ui/src/net/karlmartens/ui/widget/.

Source file: TableColumnManager.java

  22 
vote

@Override public void menuDetected(MenuDetectEvent e){
  final Point cord=_table.toControl(e.x,e.y);
  final Point cell=_table.getCellForCoordinates(cord.x,cord.y);
  if (cell.y < _table.getModel().getFixedHeaderRowCount()) {
    final Menu menu=buildMenu(cell.x);
    menu.setData(Table.DATA_COLUMN,cell.x);
    if (menu != null && !menu.isDisposed()) {
      menu.setLocation(e.x,e.y);
      menu.setVisible(true);
    }
  }
}
 

Example 25

From project ivyde, under directory /org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/.

Source file: ResolveVisualizerView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      ResolveVisualizerView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 26

From project libra, under directory /plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/dependencies/.

Source file: BundleDependencyEditorPage.java

  22 
vote

private void initPopupMenu(){
  zoomContributionItem=new ZoomContributionViewItem(this);
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 27

From project logsaw-app, under directory /net.sf.logsaw.ui/src/net/sf/logsaw/ui/editors/.

Source file: LogViewEditor.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    IMenuManager manager){
      manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 28

From project m2eclipse-hudson, under directory /org.sonatype.m2e.hudson.ui/src/main/java/com/sonatype/buildserver/eclipse/ui/job/view/.

Source file: ScmChangesPage.java

  22 
vote

private void createContextMenu(){
  MenuManager menuMgr=new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      populateContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(treeViewer.getControl());
  treeViewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,treeViewer);
}
 

Example 29

From project m2eclipse-webby, under directory /org.sonatype.m2e.webby/src/org/sonatype/m2e/webby/internal/view/.

Source file: WebbyView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager(null);
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      manager.add(browse);
      manager.add(new Separator());
      manager.add(stop);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(table);
  table.setMenu(menu);
}
 

Example 30

From project minerva, under directory /minerva-eclipse-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__.ui/src/org/aniszczyk/minerva/ui/views/.

Source file: SampleView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("${symbol_pound}PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      SampleView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 31

From project mwe, under directory /plugins/org.eclipse.emf.mwe.ewm.editor/src/org/eclipse/emf/mwe/ewm/orchestration/presentation/.

Source file: OrchestrationEditor.java

  22 
vote

/** 
 * 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");
  contextMenu.add(new Separator("additions"));
  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()};
  viewer.addDragSupport(dndOperations,transfers,new ViewerDragAdapter(viewer));
  viewer.addDropSupport(dndOperations,transfers,new EditingDomainViewerDropAdapter(editingDomain,viewer));
}
 

Example 32

From project mylyn.builds, under directory /org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/view/.

Source file: BuildsView.java

  22 
vote

protected void createPopupMenu(Composite parent){
  MenuManager menuManager=new MenuManager();
  menuManager.add(new GroupMarker("group.open"));
  menuManager.add(new Separator("group.edit"));
  menuManager.add(new Separator("group.file"));
  menuManager.add(new Separator("group.run"));
  menuManager.add(new Separator("group.refresh"));
  menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  menuManager.add(new Separator(BuildsUiConstants.GROUP_PROPERTIES));
  Menu contextMenu=menuManager.createContextMenu(parent);
  viewer.getTree().setMenu(contextMenu);
  getSite().registerContextMenu(menuManager,viewer);
}
 

Example 33

From project mylyn.incubator, under directory /org.eclipse.mylyn.sandbox.dev/src/org/eclipse/mylyn/internal/sandbox/dev/views/.

Source file: RepositorySpyView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      RepositorySpyView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 34

From project neoclipse, under directory /org.neo4j.neoclipse/src/main/java/org/neo4j/neoclipse/reltype/.

Source file: RelationshipTypeView.java

  22 
vote

/** 
 * Create and hook up the context menu.
 */
private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    final IMenuManager manager){
      RelationshipTypeView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 35

From project netifera, under directory /platform/com.netifera.platform.host/com.netifera.platform.host.filesystem.ui/src/com/netifera/platform/host/filesystem/ui/.

Source file: FileSystemView.java

  22 
vote

/** 
 * Initialise right-click menu, but does not display it. 
 */
private void createContextMenu(){
  MenuManager menuManager=new MenuManager("#PopupMenu");
  menuManager.setRemoveAllWhenShown(true);
  menuManager.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      fillContextMenu(manager);
    }
  }
);
  Menu menu=menuManager.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuManager,viewer);
}
 

Example 36

From project Newsreader, under directory /bundles/org.eclipse.ecf.salvo.ui/src/org/eclipse/ecf/salvo/ui/internal/editor/.

Source file: ArticlePanel.java

  22 
vote

private void addContextMenu(TreeViewer viewer){
  MenuManager menuMgr=new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager mgr){
      fillContextMenu(mgr);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 37

From project org.openscada.dakara, under directory /org.openscada.vi.model.editor/src/org/openscada/vi/model/VisualInterface/presentation/.

Source file: VisualInterfaceEditor.java

  22 
vote

/** 
 * 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");
  contextMenu.add(new Separator("additions"));
  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()};
  viewer.addDragSupport(dndOperations,transfers,new ViewerDragAdapter(viewer));
  viewer.addDropSupport(dndOperations,transfers,new EditingDomainViewerDropAdapter(editingDomain,viewer));
}
 

Example 38

From project org.openscada.external, under directory /org.eclipse.albireo/src/org/eclipse/albireo/core/.

Source file: SwingControl.java

  22 
vote

/** 
 * Returns the popup menu to be used on a given component. <p> The default implementation walks up the component hierarchy, looking for popup menus registered with  {@link SwtPopupRegistry#setMenu} and asfallback at the popup menu registered on this <code>Control</code>. <p> This method can be overridden, to achieve dynamic popup menus.
 * @param component The component on which a popup event was received.
 * @param x The x coordinate, relative to the component's top left corner, of the mouse cursor when the event occurred.
 * @param y The y coordinate, relative to the component's top left corner, of the mouse cursor when the event occurred.
 * @param xAbsolute The x coordinate, relative to this control's top left corner, of the mouse cursor when the event occurred.
 * @param yAbsolute The y coordinate, relative to this control's top left corner, of the mouse cursor when the event occurred.
 */
public Menu getMenu(final java.awt.Component component,final int x,final int y,final int xAbsolute,final int yAbsolute){
  checkWidget();
  Menu menu=SwtPopupRegistry.getInstance().findMenu(component,x,y,xAbsolute,yAbsolute);
  if (menu == null) {
    menu=getMenu();
  }
  return menu;
}
 

Example 39

From project org.openscada.orilla, under directory /org.openscada.ae.ui.testing/src/org/openscada/ae/ui/testing/views/.

Source file: EventQueryView.java

  22 
vote

private void hookContextMenu(){
  final MenuManager menuMgr=new MenuManager("#PopupMenu",VIEW_ID);
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    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 40

From project org.openscada.othala, under directory /org.openscada.da.project/src/org/openscada/da/project/editor/realtimelist/.

Source file: RealtimeListEditor.java

  22 
vote

private void hookContextMenu(){
  final MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    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 41

From project radrails, under directory /plugins/com.aptana.rdt.profiling/src/com/aptana/rdt/internal/profiling/.

Source file: CallGraphView.java

  22 
vote

/** 
 * Creates and registers the context menu
 */
private void createPopupMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      manager.add(new OpenMethodCallAction(tree));
      manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    }
  }
);
  Menu menu=menuMgr.createContextMenu(fViewer.getControl());
  fViewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,fViewer);
}
 

Example 42

From project samolisov-demo, under directory /Eclipse/RCP/Hyperbola/org.rcpbook.hyperbola.ui/src/org/rcpbook/hyperbola/ui/.

Source file: ApplicationWorkbenchWindowAdvisor.java

  22 
vote

private void hookPopupMenu(final IWorkbenchWindow window){
  trayItem.addListener(SWT.MenuDetect,new Listener(){
    public void handleEvent(    Event event){
      MenuManager trayMenu=new MenuManager();
      actionBarAdvisor.fillTrayItem(trayMenu);
      Menu menu=trayMenu.createContextMenu(window.getShell());
      menu.setVisible(true);
    }
  }
);
}
 

Example 43

From project scisoft-ui, under directory /uk.ac.diamond.sda.polling/src/uk/ac/diamond/sda/polling/views/.

Source file: PollingView.java

  22 
vote

private void hookContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    IMenuManager manager){
      PollingView.this.fillContextMenu(manager);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}
 

Example 44

From project Siafu, under directory /Siafu/src/main/java/de/nec/nle/siafu/graphics/.

Source file: GUI.java

  22 
vote

/** 
 * Create the context menu that appears when right clicking on the simulation canvas.
 * @return the contextual menu
 */
private Menu createContextMenu(){
  Menu newContextMenu=new Menu(shell);
  contextMenuListener=new ContextMenuListener(control,newContextMenu,shell,canvas);
  newContextMenu.addMenuListener(contextMenuListener);
  return newContextMenu;
}
 

Example 45

From project substeps-eclipse-plugin, under directory /com.technophobia.substeps.testlauncher/src/main/java/com/technophobia/substeps/junit/ui/component/.

Source file: FeatureViewer.java

  22 
vote

private void initContextMenu(){
  final MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    final IMenuManager manager){
      handleMenuAboutToShow(manager);
    }
  }
);
  siteSupplier.get().registerContextMenu(menuMgr,selectionProvider);
  final Menu menu=menuMgr.createContextMenu(viewerbook);
  treeViewer.getTree().setMenu(menu);
  tableViewer.getTable().setMenu(menu);
}
 

Example 46

From project sveditor, under directory /sveditor/plugins/net.sf.sveditor.ui/src/net/sf/sveditor/ui/views/diagram/.

Source file: SVDiagramView.java

  22 
vote

private void createContextMenu(){
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager mgr){
      SVDiagramView.this.fillContextMenu(mgr);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(fGraphViewer.getControl());
  fGraphViewer.getControl().setMenu(menu);
}
 

Example 47

From project swtbot, under directory /org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/.

Source file: AddressBook.java

  22 
vote

/** 
 * Creates the menu at the top of the shell where most of the programs functionality is accessed.
 * @return The <code>Menu</code> widget that was created
 */
private Menu createMenuBar(){
  Menu menuBar=new Menu(shell,SWT.BAR);
  shell.setMenuBar(menuBar);
  createFileMenu(menuBar);
  createEditMenu(menuBar);
  createSearchMenu(menuBar);
  createHelpMenu(menuBar);
  return menuBar;
}
 

Example 48

From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/rcp/exception/.

Source file: ExceptionDetailsErrorDialog.java

  21 
vote

/** 
 * Create this dialog's drop-down list component.
 * @param parent the parent composite
 * @return the drop-down list component
 */
protected Text createDropDownList(Composite parent){
  text=new Text(parent,SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL| SWT.MULTI);
  populateList(text);
  GridData data=new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL| GridData.GRAB_VERTICAL);
  data.horizontalSpan=2;
  text.setLayoutData(data);
  text.setFont(parent.getFont());
  Menu copyMenu=new Menu(text);
  MenuItem copyItem=new MenuItem(copyMenu,SWT.NONE);
  copyItem.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      copyToClipboard();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
      copyToClipboard();
    }
  }
);
  copyItem.setText(JFaceResources.getString("copy"));
  text.setMenu(copyMenu);
  listCreated=true;
  return text;
}
 

Example 49

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.specmol/src/net/bioclipse/specmol/editor/.

Source file: AssignmentPage.java

  21 
vote

public void createPartControl444(Composite parent){
  JChemPaintEditorWidget widget=new JChemPaintEditorWidget(parent,SWT.NONE);
  IAtomContainer atomContainer=null;
  IChemModel model=null;
  try {
    List<CMLElement> moleculeList=this.getCmlcml().getDescendants("molecule",null,true);
    String moleculestring=moleculeList.get(0).toXML();
    CMLReader reader=new CMLReader(new ByteArrayInputStream(moleculestring.getBytes()));
    IChemFile chemfile=(IChemFile)reader.read(new org.openscience.cdk.ChemFile());
    model=chemfile.getChemSequence(0).getChemModel(0);
  }
 catch (  CDKException e) {
    throw new RuntimeException(e);
  }
  if (model != null)   atomContainer=model.getMoleculeSet().getAtomContainer(0);
  MenuManager menuMgr=new MenuManager();
  menuMgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
  getSite().registerContextMenu("net.bioclipse.cdk.ui.editors.jchempaint.menu",menuMgr,widget);
  Menu menu=menuMgr.createContextMenu(widget);
  widget.setMenu(menu);
  getSite().setSelectionProvider(widget);
  widget.setAtomContainer(atomContainer);
}
 

Example 50

From project bndtools, under directory /bndtools.core/src/bndtools/views/.

Source file: RepositoriesView.java

  21 
vote

void createContextMenu(){
  MenuManager mgr=new MenuManager();
  Menu menu=mgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  mgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
  getSite().registerContextMenu(mgr,viewer);
  mgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      try {
        manager.removeAll();
        IStructuredSelection selection=(IStructuredSelection)viewer.getSelection();
        if (!selection.isEmpty()) {
          Object firstElement=selection.getFirstElement();
          if (firstElement instanceof Actionable) {
            Actionable act=(Actionable)firstElement;
            Map<String,Runnable> actions=act.actions();
            if (actions != null) {
              for (              final Entry<String,Runnable> e : actions.entrySet()) {
                final String label=e.getKey();
                final Action a=new Action(label){
                  @Override public void run(){
                    e.getValue().run();
                  }
                }
;
                manager.add(a);
              }
            }
          }
        }
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
);
}
 

Example 51

From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/.

Source file: ImprovedAdvancedPropertiesComposite.java

  21 
vote

public void setSheetPage(TabbedPropertySheetPage aTabbedPropertySheetPage){
  this.aTabbedPropertySheetPage=aTabbedPropertySheetPage;
  MenuManager manager=new MenuManager("#PropertiesMenu");
  manager.setRemoveAllWhenShown(true);
  manager.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    IMenuManager manager){
      ImprovedAdvancedPropertiesComposite.this.buildMenu((MenuManager)manager);
    }
  }
);
  Tree tree=treeViewer.getTree();
  Menu menu=manager.createContextMenu(tree);
  tree.setMenu(menu);
  aTabbedPropertySheetPage.getSite().registerContextMenu("#PropertiesMenu",manager,treeViewer);
}
 

Example 52

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/modulesearch/.

Source file: ModuleSearchViewPart.java

  21 
vote

private void initActions(){
  removeSelectedAction=new RemoveSelectedAction();
  removeAllAction=new RemoveAllAction();
  expandAllAction=new ExpandAllAction();
  collapseAllAction=new CollapseAllAction(moduleTreeViewer);
  fetchNextAction=new FetchNextAction();
  copyImportModuleAction=new CopyImportModuleAction();
  showDocAction=new ShowDocAction();
  showRepositoriesAction=new ShowRepositoriesAction();
  IToolBarManager toolBarManager=getViewSite().getActionBars().getToolBarManager();
  toolBarManager.add(fetchNextAction);
  toolBarManager.add(new Separator());
  toolBarManager.add(removeSelectedAction);
  toolBarManager.add(removeAllAction);
  toolBarManager.add(new Separator());
  toolBarManager.add(expandAllAction);
  toolBarManager.add(collapseAllAction);
  toolBarManager.add(new Separator());
  toolBarManager.add(showDocAction);
  toolBarManager.add(showRepositoriesAction);
  MenuManager menuManager=new MenuManager();
  menuManager.add(copyImportModuleAction);
  menuManager.add(new Separator());
  menuManager.add(removeSelectedAction);
  menuManager.add(removeAllAction);
  menuManager.add(new Separator());
  menuManager.add(expandAllAction);
  menuManager.add(collapseAllAction);
  Menu menu=menuManager.createContextMenu(moduleTreeViewer.getTree());
  moduleTreeViewer.getTree().setMenu(menu);
}
 

Example 53

From project dawn-common, under directory /org.dawb.common.ui/src/org/dawb/common/ui/menu/.

Source file: MenuAction.java

  21 
vote

@Override public Menu getMenu(Menu parent){
  if (fMenu != null)   fMenu.dispose();
  fMenu=new Menu(parent);
  for (  IAction action : actions) {
    addActionToMenu(fMenu,action);
  }
  for (int i=0; i < iSeparator; i++)   addSeparatorToMenu(fMenu,i);
  return fMenu;
}
 

Example 54

From project dawn-tango, under directory /org.dawb.tango.extensions/src/org/dawb/tango/extensions/editors/actions/.

Source file: SharedMemoryNamesAction.java

  21 
vote

@Override public Menu getMenu(Control parent){
  if (fMenu != null)   fMenu.dispose();
  fMenu=new Menu(parent);
  group=new CheckableActionGroup();
  final List<String> sharedNames=getSharedNames();
  for (  String name : sharedNames) {
    addActionToMenu(fMenu,name);
  }
  return fMenu;
}
 

Example 55

From project eclipse.platform.runtime, under directory /bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/.

Source file: BaseTextView.java

  21 
vote

public void createPartControl(Composite parent){
  viewer=new TextViewer(parent,SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
  viewer.setDocument(new Document());
  IActionBars bars=getViewSite().getActionBars();
  GlobalAction selectAllAction=new SelectAllAction(viewer);
  selectAllAction.registerAsGlobalAction(bars);
  GlobalAction copyAction=new CopyTextSelectionAction(viewer);
  copyAction.registerAsGlobalAction(bars);
  bars.updateActionBars();
  MenuManager menuMgr=new MenuManager();
  menuMgr.add(copyAction);
  menuMgr.add(selectAllAction);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
}
 

Example 56

From project egit-github, under directory /org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/issue/.

Source file: IssueLabelAttributeEditor.java

  21 
vote

private void refreshLabels(){
  for (  CLabel labelControl : this.labelControls)   labelControl.dispose();
  this.labelControls.clear();
  Image labelImage=GitHubImages.get(GitHubImages.GITHUB_ISSUE_LABEL_OBJ);
  List<String> labels=new LinkedList<String>(getTaskAttribute().getValues());
  Collections.sort(labels,this.labelComparator);
  if (!labels.isEmpty())   for (  final String label : labels) {
    CLabel cLabel=new CLabel(labelsArea,SWT.NONE);
    MenuManager manager=new MenuManager();
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(new IMenuListener(){
      public void menuAboutToShow(      IMenuManager manager){
        manager.add(new RemoveLabelAction(label));
      }
    }
);
    Menu menu=manager.createContextMenu(cLabel);
    cLabel.setMenu(menu);
    String shortened=TaskDiffUtil.shortenText(displayArea,label,LABEL_WIDTH);
    cLabel.setImage(labelImage);
    cLabel.setText(shortened);
    cLabel.setForeground(toolkit.getColors().getForeground());
    if (!shortened.equals(label))     cLabel.setToolTipText(label);
    this.labelControls.add(cLabel);
  }
 else   this.labelControls.add(new CLabel(labelsArea,SWT.NONE));
  if (this.layout)   displayArea.getParent().getParent().layout(true,true);
}
 

Example 57

From project eik, under directory /plugins/info.evanchik.eclipse.karaf.workbench/src/main/java/info/evanchik/eclipse/karaf/workbench/ui/views/bundle/.

Source file: BundlesView.java

  21 
vote

protected void initContextMenu(){
  final MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    final IMenuManager manager){
      menuMgr.add(propertiesAction);
      menuMgr.add(new Separator());
      menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    }
  }
);
  final Menu menu=menuMgr.createContextMenu(treeTableViewer.getControl());
  treeTableViewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,treeTableViewer);
}
 

Example 58

From project gda-common-rcp, under directory /uk.ac.gda.common.rcp/src/uk/ac/gda/ui/actions/.

Source file: MenuAction.java

  21 
vote

@Override public Menu getMenu(Control parent){
  if (fMenu != null)   fMenu.dispose();
  fMenu=new Menu(parent);
  for (  IAction action : actions) {
    addActionToMenu(fMenu,action);
  }
  return fMenu;
}
 

Example 59

From project grails-ide, under directory /org.grails.ide.eclipse.explorer/src/org/grails/ide/eclipse/actions/.

Source file: GrailsRefactorActionGroup.java

  21 
vote

private void refactorMenuShown(IMenuManager refactorSubmenu){
  Menu menu=((MenuManager)refactorSubmenu).getMenu();
  menu.addMenuListener(new MenuAdapter(){
    public void menuHidden(    MenuEvent e){
      refactorMenuHidden();
    }
  }
);
  ITextSelection textSelection=(ITextSelection)fEditor.getSelectionProvider().getSelection();
  JavaTextSelection javaSelection=new JavaTextSelection(getEditorInput(),getDocument(),textSelection.getOffset(),textSelection.getLength());
  for (Iterator iter=fActions.iterator(); iter.hasNext(); ) {
    SelectionDispatchAction action=(SelectionDispatchAction)iter.next();
    action.update(javaSelection);
  }
  refactorSubmenu.removeAll();
  if (fillRefactorMenu(refactorSubmenu) == 0)   refactorSubmenu.add(fNoActionAvailable);
}
 

Example 60

From project modeler, under directory /test-src/org/pentaho/agilebi/modeler/debug/.

Source file: SwtModelerUI.java

  21 
vote

public void setupTestMenuBar(){
  SwtWindow window=(SwtWindow)runner.getXulDomContainers().get(0).getDocumentRoot().getRootElement();
  shell=(Shell)window.getManagedObject();
  Menu menuBar=new Menu(shell,SWT.BAR);
  MenuItem fileMenuHeader=new MenuItem(menuBar,SWT.CASCADE);
  fileMenuHeader.setText("&File");
  Menu fileMenu=new Menu(shell,SWT.DROP_DOWN);
  fileMenuHeader.setMenu(fileMenu);
  MenuItem fileOpenItem=new MenuItem(fileMenu,SWT.PUSH);
  fileOpenItem.setText("&Open...");
  MenuItem fileSaveItem=new MenuItem(fileMenu,SWT.PUSH);
  fileSaveItem.setText("&Save...");
  MenuItem fileExitItem=new MenuItem(fileMenu,SWT.PUSH);
  fileExitItem.setText("E&xit");
  shell.setMenuBar(menuBar);
  fileOpenItem.addSelectionListener(new FileOpenItemListener());
  fileSaveItem.addSelectionListener(new FileSaveItemListener());
  fileExitItem.addSelectionListener(new FileExitItemListener());
}
 

Example 61

From project mylyn.context, under directory /org.eclipse.mylyn.context.tasks.ui/src/org/eclipse/mylyn/internal/context/tasks/ui/editors/.

Source file: ContextEditorFormPage.java

  21 
vote

private void hookContextMenu(){
  MenuManager menuManager=new MenuManager("#PopupMenu"){
    private final IMenuListener listener=new IMenuListener(){
      public void menuAboutToShow(      IMenuManager manager){
        fillContextMenu(manager);
      }
    }
;
{
      addMenuListener(listener);
    }
    @Override public void addMenuListener(    IMenuListener listener){
      super.removeMenuListener(this.listener);
      super.addMenuListener(listener);
      super.addMenuListener(this.listener);
    }
  }
;
  Menu menu=menuManager.createContextMenu(commonViewer.getControl());
  commonViewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuManager,commonViewer);
}
 

Example 62

From project RegexUtil, under directory /RegexUtil/src/com/ess/regexutil/views/.

Source file: RegexEditor.java

  21 
vote

public RegexEditor(Composite parent,int style,Flags flags,final IAction[] actions){
  super(parent,SWT.SINGLE | style);
  setFont(new Font(Display.getDefault(),"Courier New",10,0));
  adapter=new SWTAdapter(this);
  highlighter=new RegexHighlighter(adapter,flags);
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      for (      IAction action : actions) {
        manager.add(action);
      }
    }
  }
);
  Menu menu=menuMgr.createContextMenu(this);
  this.setMenu(menu);
}
 

Example 63

From project mylyn.docs, under directory /org.eclipse.mylyn.htmltext.ui/src/org/eclipse/mylyn/htmltext/.

Source file: HtmlComposer.java

  20 
vote

/** 
 * Constructs a new instance of a  {@link Browser} and includes a ckeditorinstance.
 * @param parent a composite control which will be the parent of the new instance (cannot be null)
 * @param style the style of control to construct
 * @param config the configuration for the html-widget
 * @see Browser#Browser(Composite,int)
 * @since 0.8
 */
public HtmlComposer(final Composite parent,final int style,Configuration config){
  browser=new Browser(parent,style);
  browser.setMenu(new Menu(browser));
  new RenderCompleteFunction(browser);
  URL baseUrl;
  try {
    baseUrl=FileLocator.resolve(FileLocator.find(HtmlTextActivator.getDefault().getBundle(),new Path("/eclipsebridge/base.html"),Collections.EMPTY_MAP));
    browser.setUrl(baseUrl.toString() + (config != null ? "?" + config.toQuery() : ""));
    browser.addProgressListener(new ProgressAdapter(){
      @Override public void completed(      ProgressEvent event){
        browser.execute("integration.eclipseRunning = true;");
        browser.removeProgressListener(this);
      }
    }
);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
 

Example 64

From project dawn-ui, under directory /org.dawb.workbench.ui/src/org/dawb/workbench/ui/editors/.

Source file: PlotImageEditor.java

  19 
vote

@Override public void createPartControl(final Composite parent){
  final Composite main=new Composite(parent,SWT.NONE);
  final GridLayout gridLayout=new GridLayout(1,false);
  gridLayout.verticalSpacing=0;
  gridLayout.marginWidth=0;
  gridLayout.marginHeight=0;
  gridLayout.horizontalSpacing=0;
  main.setLayout(gridLayout);
  this.tools=new Composite(main,SWT.RIGHT);
  tools.setLayout(new GridLayout(2,false));
  GridUtils.removeMargins(tools);
  tools.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
  ToolBarManager toolMan=new ToolBarManager(SWT.FLAT | SWT.RIGHT | SWT.WRAP);
  final ToolBar toolBar=toolMan.createControl(tools);
  toolBar.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,true,false));
  ToolBarManager rightMan=new ToolBarManager(SWT.FLAT | SWT.RIGHT | SWT.WRAP);
  final ToolBar rightBar=rightMan.createControl(tools);
  rightBar.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,false));
  final MenuManager menuMan=new MenuManager();
  final IActionBars bars=this.getEditorSite().getActionBars();
  ActionBarWrapper wrapper=new ActionBarWrapper(toolMan,menuMan,null,(IActionBars2)bars);
  final String plotName=this.getEditorInput().getName();
  final Composite plot=new Composite(main,SWT.NONE);
  plot.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  plot.setLayout(new FillLayout());
  plottingSystem.createPlotPart(plot,plotName,wrapper,PlotType.IMAGE,this);
  Action menuAction=new Action("",Activator.getImageDescriptor("/icons/DropDown.png")){
    @Override public void run(){
      final Menu mbar=menuMan.createContextMenu(toolBar);
      mbar.setVisible(true);
    }
  }
;
  rightMan.add(menuAction);
  if (toolMan != null)   toolMan.update(true);
  if (rightMan != null)   rightMan.update(true);
  createPlot();
  getEditorSite().setSelectionProvider(plottingSystem.getSelectionProvider());
}
 

Example 65

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.frameworks.test.util/src/org/springsource/ide/eclipse/commons/frameworks/test/util/.

Source file: SubMenusMatching.java

  19 
vote

public SubMenusMatching(SWTBot bot,final SWTBotMenu parentMenuBot,Matcher<MenuItem> matcher){
  super(bot);
  this.parentMenu=UIThreadRunnable.syncExec(new Result<Menu>(){
    public Menu run(){
      return parentMenuBot.widget.getMenu();
    }
  }
);
  this.matcher=matcher;
}
 

Example 66

From project m2e-apt, under directory /org.jboss.tools.maven.apt.ui/src/org/jboss/tools/maven/apt/ui/preferences/xpl/.

Source file: SWTUtil.java

  19 
vote

/** 
 * Returns the shell for the given widget. If the widget doesn't represent a SWT object that manage a shell, <code>null</code> is returned.
 * @param widget the widget
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget){
  if (widget instanceof Control)   return ((Control)widget).getShell();
  if (widget instanceof Caret)   return ((Caret)widget).getParent().getShell();
  if (widget instanceof DragSource)   return ((DragSource)widget).getControl().getShell();
  if (widget instanceof DropTarget)   return ((DropTarget)widget).getControl().getShell();
  if (widget instanceof Menu)   return ((Menu)widget).getParent().getShell();
  if (widget instanceof ScrollBar)   return ((ScrollBar)widget).getParent().getShell();
  return null;
}
 

Example 67

From project studio3-ruby, under directory /plugins/com.aptana.ruby.rake/src/com/aptana/ruby/internal/rake/actions/.

Source file: RakeTasksContributionItem.java

  19 
vote

/** 
 * For inserting submenus at first level.
 * @param parent
 * @param item
 * @return
 */
private int getInsertIndex(Menu parent,MenuManager item){
  String text=item.getMenuText();
  MenuItem[] items=parent.getItems();
  int index=0;
  for (int i=0; i < items.length; i++) {
    String other=items[i].getText();
    if (text.compareTo(other) >= 0) {
      index=i + 1;
    }
 else {
      break;
    }
  }
  return index;
}