当前位置: 首页>>代码示例>>Java>>正文


Java ContextMenuProvider类代码示例

本文整理汇总了Java中org.eclipse.gef.ContextMenuProvider的典型用法代码示例。如果您正苦于以下问题:Java ContextMenuProvider类的具体用法?Java ContextMenuProvider怎么用?Java ContextMenuProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContextMenuProvider类属于org.eclipse.gef包,在下文中一共展示了ContextMenuProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createOutline

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
protected JDReportOutlineView createOutline(TreeViewer viewer) {
	outlinePage = new JDReportOutlineView(this, viewer) {
		protected void initActions(ActionRegistry registry, IActionBars bars) {
			String id = CreateStyleTemplateReferenceAction.ID;
			bars.setGlobalActionHandler(id, registry.getAction(id));

			id = CreateStyleAction.ID;
			bars.setGlobalActionHandler(id, registry.getAction(id));
		}

		protected org.eclipse.gef.ContextMenuProvider getMenuContentProvider() {
			return createContextMenuProvider(getViewer());
		}
	};
	outlinePage.setEditPartFactory(new StyleTreeEditPartFactory());
	return outlinePage;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:18,代码来源:StyleTemplateEditor.java

示例2: configureGraphicalViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	GraphicalViewer viewer = getGraphicalViewer();

	viewer.setRootEditPart(new ScalableFreeformRootEditPart());
	viewer.setEditPartFactory(new FormDesignerEditPartFactory(this));
	ContextMenuProvider provider = new FormContextMenuProvider(viewer,
			actionIds, getActionRegistry());
	viewer.setContextMenu(provider);

	viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));

	((FigureCanvas) viewer.getControl())
			.setScrollBarVisibility(FigureCanvas.ALWAYS);
}
 
开发者ID:snakerflow,项目名称:snaker-designer,代码行数:17,代码来源:SnakerFormDesignerEditor.java

示例3: configureGraphicalViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	GraphicalViewer viewer = getGraphicalViewer();

	viewer.setRootEditPart(new ScalableFreeformRootEditPart());
	viewer.setEditPartFactory(new TaskFieldEditPartFactory(
			getParentEditor()));
	ContextMenuProvider provider = new FormContextMenuProvider(viewer,
			getParentEditor().getEditActionList(), getParentEditor()
					.getActionRegistry());
	viewer.setContextMenu(provider);

	viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));

	((FigureCanvas) viewer.getControl())
			.setScrollBarVisibility(FigureCanvas.ALWAYS);
}
 
开发者ID:snakerflow,项目名称:snaker-designer,代码行数:19,代码来源:TaskFieldDesignerEditor.java

示例4: createControl

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
public void createControl(Composite parent) {
	// create outline viewer page
	getViewer().createControl(parent);
	// configure outline viewer
	getViewer().setEditDomain(getEditDomain());
	getViewer().setEditPartFactory(new ShapesTreeEditPartFactory());
	// configure & add context menu to viewer
	ContextMenuProvider cmProvider = new ShapesEditorContextMenuProvider(getViewer(), getActionRegistry());
	getViewer().setContextMenu(cmProvider);
	getSite().registerContextMenu("org.eclipse.gef.examples.shapes.outline.contextmenu", cmProvider,
		getSite().getSelectionProvider());
	// hook outline viewer
	getSelectionSynchronizer().addViewer(getViewer());
	// initialize outline viewer with model
	getViewer().setContents(getModel());
	// show outline viewer
}
 
开发者ID:lunifera,项目名称:lunifera-sharky-m2m,代码行数:18,代码来源:ShapesEditor.java

示例5: configureViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
private void configureViewer(GraphicalViewer viewer) {
	viewer.setEditPartFactory(new ComponentsEditPartFactory());
	ContextMenuProvider cmProvider = new ComponentsEditorContextMenuProvider(
			viewer, getActionRegistry());
	viewer.setContextMenu(cmProvider);
	getSite().registerContextMenu(cmProvider, viewer);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:8,代码来源:ELTGraphicalEditor.java

示例6: createContextMenuManager

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
private MenuManager createContextMenuManager(){
	return new ContextMenuProvider(graphicalViewer){
		@Override
		public void buildContextMenu(IMenuManager menu) {
			menu.add(getActionRegistry().getAction(ActionFactory.DELETE.getId()));
		}
	};
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:9,代码来源:GraphicalEditorPage.java

示例7: configureGraphicalViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	GraphicalViewer viewer = getGraphicalViewer();
	ScalableRootEditPart root = new ScalableRootEditPart();
	viewer.setRootEditPart(root);
	viewer.setEditPartFactory(new GraphEditPartFactory(viewer));
	viewer.setContents("Loading graph... This can take several minutes");
	ContextMenuProvider cmProvider = new RevisionGraphMenuProvider(viewer, this);
	viewer.setContextMenu(cmProvider);
	getSite().setSelectionProvider(viewer);
	IEditorInput input = getEditorInput();
	if(input instanceof FileEditorInput) {
		FileEditorInput fileEditorInput = (FileEditorInput) input;
		showGraphFor(fileEditorInput.getFile());
	} else if(input instanceof RevisionGraphEditorInput) {
		RevisionGraphEditorInput editorInput = (RevisionGraphEditorInput) input;
		showGraphFor(editorInput);
	}
	
	// zoom stuff
	ZoomManager zoomManager = ((ScalableRootEditPart) viewer.getRootEditPart()).getZoomManager();
	IAction zoomIn = new ZoomInAction(zoomManager);
	IAction zoomOut = new ZoomOutAction(zoomManager);
	getActionRegistry().registerAction(zoomIn);
	getActionRegistry().registerAction(zoomOut);
	// keyboard
	getSite().getKeyBindingService().registerAction(zoomIn); // FIXME, deprecated
	getSite().getKeyBindingService().registerAction(zoomOut); // FIXME, deprecated
	List zoomContributions = Arrays.asList(new String[] { 
		     ZoomManager.FIT_ALL, 
		     ZoomManager.FIT_HEIGHT, 
		     ZoomManager.FIT_WIDTH });
	zoomManager.setZoomLevelContributions(zoomContributions);
	// mouse wheel
	viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
			MouseWheelZoomHandler.SINGLETON);
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:38,代码来源:RevisionGraphEditor.java

示例8: configureOutlineViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
protected void configureOutlineViewer(){
	getViewer().setEditDomain(editor.getEditorEditDomain());
	getViewer().setEditPartFactory(new DiagramTreePartFactory());
	ContextMenuProvider cmProvider = new GUIEditorContextMenuProvider(
			getViewer(), editor.getEditorActionRegistry());
	getViewer().setContextMenu(cmProvider);
	getSite().registerContextMenu(
			"com.forgedui.editor.view.outline.contextmenu",
			cmProvider, getSite().getSelectionProvider());
	// Making this view as a selection provider to the workbench.
	editor.getEditorSelectionSynchronizer().addViewer(getViewer());
	getViewer().addDropTargetListener((TransferDropTargetListener)
		new MyTemplateTransferDropTargetListener(getViewer(), diagram));
	
	IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
	showOutlineAction = new Action() {
		public void run() {
			showPage(ID_OUTLINE);
		}
	};
	showOutlineAction.setImageDescriptor(GUIEditorPlugin.getImageDescriptor("icons/outline.gif")); //$NON-NLS-1$
	showOutlineAction.setToolTipText("Show Outline");
	tbm.add(showOutlineAction);
	showOverviewAction = new Action() {
		public void run() {
			showPage(ID_OVERVIEW);
		}
	};
	showOverviewAction.setImageDescriptor(GUIEditorPlugin.getImageDescriptor("icons/overview.gif")); //$NON-NLS-1$
	showOverviewAction.setToolTipText("Show Overview");
	tbm.add(showOverviewAction);
	showPage(ID_OUTLINE);
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:34,代码来源:DiagramOutlinePage2.java

示例9: createOutlineViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
/**
 * Creates the hierarchical Outline viewer.
 */
protected void createOutlineViewer() {
  // set the standard handlers
  getViewer().setEditDomain(_editDomain);
  getViewer().setKeyHandler(_keyHandler);

  // add a context-menu
  ContextMenuProvider contextMenuProvider = createContextMenuProvider();
  if (contextMenuProvider != null)
    getViewer().setContextMenu(contextMenuProvider);

  // add buttons outline/overview to toolbar
  IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
  _showOutlineAction = new Action() {

    @Override
    public void run() {
      showPage(ID_OUTLINE);
    }
  };
  _showOutlineAction.setImageDescriptor(GraphitiUi.getImageService().getImageDescriptorForId(TriqDiagramTypeProvider.ID, ImageConstants.IMG_OUTLINE_TREE));
  tbm.add(_showOutlineAction);
  _showOverviewAction = new Action() {

    @Override
    public void run() {
      showPage(ID_THUMBNAIL);
    }
  };
  _showOverviewAction
      .setImageDescriptor(GraphitiUi.getImageService().getImageDescriptorForId(TriqDiagramTypeProvider.ID, ImageConstants.IMG_OUTLINE_THUMBNAIL));
  tbm.add(_showOverviewAction);

  // by default show the outline-page
  showPage(ID_OUTLINE);
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:39,代码来源:DiagramEditorOutlinePage.java

示例10: createOutlineViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
/**
 * Creates the hierarchical Outline viewer.
 */
protected void createOutlineViewer() {
	// set the standard handlers
	getViewer().setEditDomain(_editDomain);
	getViewer().setKeyHandler(_keyHandler);

	// add a context-menu
	ContextMenuProvider contextMenuProvider = createContextMenuProvider();
	if (contextMenuProvider != null)
		getViewer().setContextMenu(contextMenuProvider);

	// add buttons outline/overview to toolbar
	IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
	_showOutlineAction = new Action() {

		@Override
		public void run() {
			showPage(ID_OUTLINE);
		}
	};
	_showOutlineAction.setImageDescriptor(GraphitiUi.getImageService().getImageDescriptorForId(ISampleImageConstants.IMG_OUTLINE_TREE));
	tbm.add(_showOutlineAction);
	_showOverviewAction = new Action() {

		@Override
		public void run() {
			showPage(ID_THUMBNAIL);
		}
	};
	_showOverviewAction.setImageDescriptor(GraphitiUi.getImageService().getImageDescriptorForId(
			ISampleImageConstants.IMG_OUTLINE_THUMBNAIL));
	tbm.add(_showOverviewAction);

	// by default show the outline-page
	showPage(ID_OUTLINE);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:39,代码来源:GraphicsEditorOutlinePage.java

示例11: createContextMenu

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
@Override
protected void createContextMenu()
{
  final ContextMenuProvider manager = createContextMenuProvider();
  viewer.setContextMenu(manager);
  // Register the context menu such that other plug-ins may contribute to it
  getSite().registerContextMenu(manager, viewer);
}
 
开发者ID:UBPL,项目名称:jive,代码行数:9,代码来源:AbstractGraphicalJiveView.java

示例12: configureGraphicalViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
protected void configureGraphicalViewer( )
{
	super.configureGraphicalViewer( );

	GraphicalViewer viewer = getGraphicalViewer( );
	ActionRegistry actionRegistry = getActionRegistry( );
	ReportRootEditPart root = new ReportRootEditPart( );
	viewer.setRootEditPart( root );

	// hook zoom actions
	hookZoom( root );

	// set key events
	viewer.setKeyHandler( new ReportViewerKeyHandler( viewer,
			actionRegistry ) );

	// configure the context menu
	ContextMenuProvider provider = new SchematicContextMenuProvider( viewer,
			actionRegistry );
	viewer.setContextMenu( provider );

	// hook the viewer into the EditDomain TODO create a function
	getEditDomain( ).addViewer( viewer );
	// acticate the viewer as selection provider for Eclipse
	getSite( ).setSelectionProvider( viewer );

	// initialize the viewer with input
	viewer.setEditPartFactory( getEditPartFactory( ) );

	ModuleHandle model = getModel( );
	WrapperCommandStack commandStack = new WrapperCommandStack( model == null ? null
			: model.getCommandStack( ) );

	viewer.getEditDomain( ).setCommandStack( commandStack );

}
 
开发者ID:eclipse,项目名称:birt,代码行数:37,代码来源:ReportEditorWithPalette.java

示例13: configureGraphicalViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer()
{
	super.configureGraphicalViewer();
	getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
	getGraphicalViewer().setEditPartFactory(new PartFactory());
	getGraphicalViewer().setKeyHandler(
			new GraphicalViewerKeyHandler(getGraphicalViewer())
					.setParent(getCommonKeyHandler()));
	// configure the context menu provider
	ContextMenuProvider cmProvider = new MyDiagramContextMenuProvider(getGraphicalViewer(),
			getActionRegistry());
	getGraphicalViewer().setContextMenu(cmProvider);
	getSite().registerContextMenu(cmProvider, getGraphicalViewer());
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:16,代码来源:QueryDesignerEditor.java

示例14: configureGraphicalViewer

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
protected void configureGraphicalViewer()
{
	super.configureGraphicalViewer();
	getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
	//getGraphicalViewer().setEditPartFactory(new BODesignerEditorPartFactory());
	ContextMenuProvider cmProvider = new ImportContextMenuProvider(getGraphicalViewer(),
			getActionRegistry());
       getGraphicalViewer().setContextMenu(cmProvider);
       getSite().registerContextMenu(cmProvider, getGraphicalViewer());
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:11,代码来源:BODesignerEditor.java

示例15: configureOutlineViewerDetails

import org.eclipse.gef.ContextMenuProvider; //导入依赖的package包/类
/**
 * @param viewer
 *            for the outline
 * @param treeEditPartFactory
 *            is the factory for the outline
 */
private void configureOutlineViewerDetails(EditPartViewer viewer, TreeEditPartFactory treeEditPartFactory) {
    if (viewer.getEditDomain() instanceof UrnEditDomain) {
        ((UrnEditDomain) viewer.getEditDomain()).dispose();
    }

    viewer.setEditDomain(new UrnEditDomain(multieditor));
    viewer.setEditPartFactory(treeEditPartFactory);

    // configure & add context menu to viewer
    ContextMenuProvider cmProvider = new UrnContextMenuProvider(viewer, multieditor.getActionRegistry());
    viewer.setContextMenu(cmProvider);
    getSite().registerContextMenu("seg.jUCMNav.editors.actionContributors.UrnContextMenuProvider", cmProvider, getSite().getSelectionProvider()); //$NON-NLS-1$

    // hook outline viewer
    multieditor.getSelectionSynchronizer().addViewer(viewer);

    // initialize outline viewer with the URNspec
    viewer.setContents(multieditor);

    // currently not implemented
    // ((TreeViewer) getViewer())
    // .addDropTargetListener(new MSCTransferDropTargetListener(
    // getViewer()));

    viewer.addDragSourceListener(new UrnTemplateTransferDragSourceListener(viewer));
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:33,代码来源:UrnOutlinePage.java


注:本文中的org.eclipse.gef.ContextMenuProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。