本文整理汇总了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());
}
示例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);
}
}
}
示例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);
}
}
}
示例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();
}
示例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());
}
示例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);
}
示例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);
}
示例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");
// }
// });
}
}
示例9: init
import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
public void init( IPageSite pageSite )
{
super.init( pageSite );
pageSite.setSelectionProvider( this );
}
示例10: init
import org.eclipse.ui.part.IPageSite; //导入方法依赖的package包/类
@Override
public void init(IPageSite pageSite) {
super.init(pageSite);
pageSite.setSelectionProvider(this);
}