/** * Returns if the specified part reference is to this view part (if the part * reference is the console view or not) * * @param partRef the workbench part reference * @return true if the specified part reference is the console view */ protected boolean isThisPart(IWorkbenchPartReference partRef) { if (partRef instanceof IViewReference) { IViewReference viewRef = (IViewReference) partRef; if (getViewSite() != null && viewRef.getId().equals(getViewSite().getId())) { String secId = viewRef.getSecondaryId(); String mySec = null; if (getSite() instanceof IViewSite) { mySec = ((IViewSite)getSite()).getSecondaryId(); } if (mySec == null) { return secId == null; } return mySec.equals(secId); } } return false; }
protected boolean isThisPart(IWorkbenchPartReference partRef) { if (partRef instanceof IViewReference) { IViewReference viewRef = (IViewReference) partRef; if (viewRef.getId().equals(getViewSite().getId())) { String secId = viewRef.getSecondaryId(); String mySec = null; if (getSite() instanceof IViewSite) { mySec = ((IViewSite)getSite()).getSecondaryId(); } if (mySec == null) { return secId == null; } return mySec.equals(secId); } } return false; }
/** * Creates this view's underlying viewer and actions. * Hooks a pop-up menu to the underlying viewer's control, * as well as a key listener. When the delete key is pressed, * the <code>REMOVE_ACTION</code> is invoked. Hooks help to * this view. Subclasses must implement the following methods * which are called in the following order when a view is * created:<ul> * <li><code>createViewer(Composite)</code> - the context * menu is hooked to the viewer's control.</li> * <li><code>createActions()</code></li> * <li><code>configureToolBar(IToolBarManager)</code></li> * <li><code>getHelpContextId()</code></li> * </ul> * @see IWorkbenchPart#createPartControl(Composite) */ public void createPartControl(Composite parent) { super.createPartControl(parent); createActions(); IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager(); configureToolBar(tbm); updateForExistingConsoles(); getViewSite().getActionBars().updateActionBars(); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IConsoleHelpContextIds.CONSOLE_VIEW); getViewSite().getPage().addPartListener((IPartListener2)this); }
/** * Creates this view's underlying viewer and actions. * Hooks a pop-up menu to the underlying viewer's control, * as well as a key listener. When the delete key is pressed, * the <code>REMOVE_ACTION</code> is invoked. Hooks help to * this view. Subclasses must implement the following methods * which are called in the following order when a view is * created:<ul> * <li><code>createViewer(Composite)</code> - the context * menu is hooked to the viewer's control.</li> * <li><code>createActions()</code></li> * <li><code>configureToolBar(IToolBarManager)</code></li> * <li><code>getHelpContextId()</code></li> * </ul> * @see IWorkbenchPart#createPartControl(Composite) */ @Override public void createPartControl(Composite parent) { super.createPartControl(parent); createActions(); IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager(); configureToolBar(tbm); updateForExistingConsoles(); getViewSite().getActionBars().updateActionBars(); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IConsoleHelpContextIds.CONSOLE_VIEW); getViewSite().getPage().addPartListener((IPartListener2)this); initPageSwitcher(); }
public void dispose() { super.dispose(); getViewSite().getPage().removePartListener((IPartListener2)this); ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager(); consoleManager.removeConsoleListener(this); consoleManager.unregisterConsoleView(this); }
@Override public void dispose() { IViewSite site = getViewSite(); if(site != null) { site.getPage().removePartListener((IPartListener2)this); } super.dispose(); ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager(); consoleManager.removeConsoleListener(this); consoleManager.unregisterConsoleView(this); if (fDisplayConsoleAction != null) { fDisplayConsoleAction.dispose(); fDisplayConsoleAction = null; } }