本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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
}
示例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);
}
示例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()));
}
};
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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 );
}
示例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());
}
示例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());
}
示例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));
}