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


Java IPageSite.setSelectionProvider方法代码示例

本文整理汇总了Java中org.eclipse.ui.part.IPageSite.setSelectionProvider方法的典型用法代码示例。如果您正苦于以下问题:Java IPageSite.setSelectionProvider方法的具体用法?Java IPageSite.setSelectionProvider怎么用?Java IPageSite.setSelectionProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.part.IPageSite的用法示例。


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

示例1: init

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
public void init(IPageSite pageSite) {
	super.init(pageSite);

	IActionBars bars = pageSite.getActionBars();

	bars.getToolBarManager().add(getActionRegistry().getAction(ClearEdgeBendpointLayoutAction.ID));
	bars.getToolBarManager().add(getActionRegistry().getAction(ActionFactory.DELETE.getId()));
	bars.getToolBarManager().add(getActionRegistry().getAction(ActionFactory.UNDO.getId()));
	bars.getToolBarManager().add(getActionRegistry().getAction(ActionFactory.REDO.getId()));

	bars.setGlobalActionHandler(ClearEdgeBendpointLayoutAction.ID,
			getActionRegistry().getAction(ClearEdgeBendpointLayoutAction.ID));
	bars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
			getActionRegistry().getAction(ActionFactory.UNDO.getId()));
	bars.setGlobalActionHandler(ActionFactory.REDO.getId(),
			getActionRegistry().getAction(ActionFactory.REDO.getId()));
	bars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
			getActionRegistry().getAction(ActionFactory.DELETE.getId()));
	bars.updateActionBars();

	getViewer().setKeyHandler(keyHandler);

	pageSite.setSelectionProvider(getViewer());
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:25,代码来源:GW4EEditor.java

示例2: selectionChanged

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
      	if (!isRelevantChange(part)) 
      		return;
      	IPageSite site = getSite(); 
      	if ((site != null) && (site.getSelectionProvider() == null)) {
      		ISelectionProvider partSelectionProvider = associatedPart.getSite().getSelectionProvider();
      		site.setSelectionProvider(partSelectionProvider);
      	}
      	if ((selection != null) && (selection instanceof IStructuredSelection)) {
       	try {
       		updateSelection((IStructuredSelection)selection);
       	} catch (Exception e) {
       		printException(e);
       		trace.error("DetailPage.updateSelection", e);
       	}
      	}
      }
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:19,代码来源:DetailPage.java

示例3: selectionChanged

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
      	if (part != editorPart) 
      		return;
      	IPageSite site = getSite(); 
      	if ((site != null) && (site.getSelectionProvider() == null)) {
      		ISelectionProvider partSelectionProvider = editorPart.getSite().getSelectionProvider();
      		site.setSelectionProvider(partSelectionProvider);
      	}
      	if ((selection != null) && (selection instanceof IStructuredSelection)) {
       	try {
       		updateSelection((IStructuredSelection)selection);
       	} catch (Exception e) {
       		LogUtil.error("Error updating selection from editor", e);
       	}
      	}
      }
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:SPIFeTemplatePlanPage.java

示例4: createActionControls

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
private void createActionControls(Tree tree) {
	String outlineId = FluentMkUI.PLUGIN_ID + ".outline";
	MenuManager menuMgr = new MenuManager(outlineId, outlineId);
	menuMgr.setRemoveAllWhenShown(true);
	menuMgr.addMenuListener(new IMenuListener() {

		@Override
		public void menuAboutToShow(IMenuManager m) {
			contextMenuAboutToShow(m);
		}
	});
	menu = menuMgr.createContextMenu(tree);
	tree.setMenu(menu);

	IPageSite site = getSite();
	site.registerContextMenu(outlineId, menuMgr, viewer); // $NON-NLS-1$
	site.setSelectionProvider(viewer);

	actionGroups = new CompositeActionGroup(new ActionGroup[] { new OpenViewActionGroup(this) });

	setAction(ACTION_EXPAND, new ExpandAllAction(viewer));
	setAction(ACTION_COLLAPSE, new CollapseAllAction(viewer));
	setAction(ACTION_TOGGLE, new ToggleLinkingAction(editor));

	setAction(ACTION_COPY, new OutlineCopyAction(this));
	setAction(ACTION_CUT, new OutlineCutAction(this));
	setAction(ACTION_PASTE, new OutlinePasteAction(this));
	setAction(ACTION_DELETE, new OutlineDeleteAction(this));

	createToolBar();
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:32,代码来源:MkOutlinePage.java

示例5: createControl

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
@Override
public void createControl(Composite parent) {
	EditingDomain editingDomain = planEditorModel.getEditingDomain();

	composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new FillLayout());

	tabFolder = new TabFolder(composite, SWT.BORDER);
	equalityTableViewer = createEMFTreeTableViewer(editingDomain, tabFolder, 0, "Equality Requirements");
	envelopeTableViewer = createEMFTreeTableViewer(editingDomain, tabFolder, 1, "Min/Max Requirements");
	effectTableViewer = createEMFTreeTableViewer(editingDomain, tabFolder, 2, "Effects");
	effectTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			ISelection selection = event.getSelection();
			if (!selection.equals(selectionProvider.getSelection())) {
				selectionProvider.setSelection(selection);
			}
		}
	});

	IPageSite site = getSite();
	site.setSelectionProvider(selectionProvider);
	IWorkbenchPage page = site.getPage();
	page.addPostSelectionListener(listener);
	listener.selectionChanged(null, selectionProvider.getSelection());

	UndoRedoUtils.setupUndoRedo(site.getActionBars(), viewSite, planEditorModel.getUndoContext());
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:30,代码来源:ProfileEffectsAndRequirementsPage.java

示例6: dispose

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
@Override
public void dispose() {
	removePostSelectionChangedListeners(cutAction);
	removePostSelectionChangedListeners(copyAction);
	removePostSelectionChangedListeners(pasteAction);
	removePostSelectionChangedListeners(deleteAction);

	composite = null;
	planEditorModel = null;
	IPageSite site = getSite();
	site.setSelectionProvider(null);
	IWorkbenchPage page = site.getPage();
	page.removePostSelectionListener(listener);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:15,代码来源:ProfileEffectsAndRequirementsPage.java

示例7: updateSelectionProvider

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
private void updateSelectionProvider(IPageSite site) {
	ISelectionProvider provider= fOutlineViewer;
	if (fInput != null) {
		ICompilationUnit cu= (ICompilationUnit)fInput.getAncestor(IJavaElement.COMPILATION_UNIT);
		if (cu != null && !JavaModelUtil.isPrimary(cu))
			provider= new EmptySelectionProvider();
	}
	site.setSelectionProvider(provider);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:JavaOutlinePage.java

示例8: createControl

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
@Override
	public void createControl(Composite parent) {
	    toolkit = new FormToolkit(parent.getDisplay());
	    toolkit.setBorderStyle(SWT.NONE);
	    form = toolkit.createScrolledForm(parent);
        form.setExpandHorizontal(true);
        form.setExpandVertical(true);
	    originalLayout = new TableWrapLayout();
		form.getBody().setLayout(originalLayout);
	    IPageSite site = getSite();
	    if (site != null) {
		    IWorkbenchPage page = site.getPage();
		    page.addPostSelectionListener(selectionListener);
	    	ISelectionProvider partSelectionProvider = associatedPart.getSite().getSelectionProvider();
	    	site.setSelectionProvider(partSelectionProvider);
		    if (associatedPart instanceof IEditorPart) {
				IEditorPart editorPart = (IEditorPart) associatedPart;
				IUndoContext undoContext = (IUndoContext)editorPart.getAdapter(IUndoContext.class);
				if (undoContext != null) {
					UndoRedoUtils.setupUndoRedo(site.getActionBars(), viewSite, undoContext);
				}
		    }
		    ISelection selection = partSelectionProvider.getSelection();
		    if ((selection != null) && (selection instanceof IStructuredSelection)) {
	        	try {
	        		updateSelection((IStructuredSelection)selection, false);
	        	} catch (Exception e) {
	        		printException(e);
	        		trace.error("DetailPage.updateSelection", e);
	        	}
        	}
		    createActions();
//		    page.addPartListener(new IPartListener2() {
//				@Override
//				public void partVisible(IWorkbenchPartReference partRef) {
//					System.out.println("visible");
//				}
//				@Override
//				public void partOpened(IWorkbenchPartReference partRef) {
//					System.out.println("opened");
//				}
//				@Override
//				public void partInputChanged(IWorkbenchPartReference partRef) {
//					System.out.println("inputChanged");
//				}
//				@Override
//				public void partHidden(IWorkbenchPartReference partRef) {
//					System.out.println("hidden");
//				}
//				@Override
//				public void partDeactivated(IWorkbenchPartReference partRef) {
//					System.out.println("deactivated");
//				}
//				@Override
//				public void partClosed(IWorkbenchPartReference partRef) {
//					System.out.println("closed");
//				}
//				@Override
//				public void partBroughtToTop(IWorkbenchPartReference partRef) {
//					System.out.println("top");
//				}
//				@Override
//				public void partActivated(IWorkbenchPartReference partRef) {
//					System.out.println("activated");
//				}
//			});
	    }
	}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:69,代码来源:DetailPage.java

示例9: init

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
public void init( IPageSite pageSite )
{
	super.init( pageSite );
	pageSite.setSelectionProvider( this );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:6,代码来源:LibraryExplorerViewPage.java

示例10: init

import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
@Override
public void init(IPageSite pageSite) {
    super.init(pageSite);
    pageSite.setSelectionProvider(this);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:6,代码来源:ContentOutlinePageWithFilter.java


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