@Override public final IServiceLocator getServiceLocator() { return configurer.getWindow(); }
/** * Constructs a new action builder which contributes actions * to the given window. * * @param configurer the action bar configurer for the window */ public WorkbenchActionBuilder(IActionBarConfigurer configurer) { super(configurer); window = configurer.getWindowConfigurer().getWindow(); }
@Override public void fillActionBars(int flags) { IActionBarConfigurer abc = getActionBarConfigurer(); wbAdvisor.fillActionBars(abc.getWindowConfigurer().getWindow(), abc, flags); }
@Override public boolean preWindowShellClose() { if (getWorkbench().getWorkbenchWindowCount() > 1) { return true; } // the user has asked to close the last window, while will cause the // workbench to close in due course - prompt the user for confirmation return promptOnExit(getWindowConfigurer().getWindow().getShell()); }
configurer.getWindow().addPageListener(new IPageListener() { @Override public void pageActivated(IWorkbenchPage page) { configurer.getWindow().addPerspectiveListener(new PerspectiveAdapter() { @Override public void perspectiveActivated(IWorkbenchPage page, configurer.getWindow().getPartService().addPartListener( new IPartListener2() { @Override
private void setTitlePath() { String titlePath = null; if (lastActiveEditor != null) { IEditorInput editorInput = lastActiveEditor.getEditorInput(); if (editorInput instanceof IFileEditorInput) { titlePath = computeTitlePath((IFileEditorInput) editorInput); } else if (editorInput instanceof FileStoreEditorInput) { titlePath = computeTitlePath((FileStoreEditorInput) editorInput); } } titlePathUpdater.updateTitlePath(getWindowConfigurer().getWindow().getShell(), titlePath); }
if (definitionId != null) { IActionCommandMappingService mapping = getActionBarConfigurer() .getWindowConfigurer().getWindow() .getService(IActionCommandMappingService.class); if (mapping != null) {
IWorkbenchPage currentPage = configurer.getWindow().getActivePage(); IEditorPart activeEditor = null; if (currentPage != null) {
/** * Create an instance of this Dialog. * * @param configurer * the configurer * @param persp * the perspective * @param context * The runtime context for this window */ public CustomizePerspectiveDialog(IWorkbenchWindowConfigurer configurer, Perspective persp, IEclipseContext context) { super(configurer.getWindow().getShell()); this.treeManager = new TreeManager(); this.configurer = configurer; this.context = context; perspective = persp; window = (WorkbenchWindow) configurer.getWindow(); windowPage = (WorkbenchPage) window.getActivePage(); menuMngrRenderer = context.get(MenuManagerRenderer.class); toolbarMngrRenderer = context.get(ToolBarManagerRenderer.class); resUtils = (ISWTResourceUtilities) context.get(IResourceUtilities.class); initializeIcons(); initializeActionSetInput(); loadMenuAndToolbarStructure(); }
@Override public Control createEmptyWindowContents(Composite parent) { final IWorkbenchWindow window = getWindowConfigurer().getWindow(); Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); Display display = composite.getDisplay(); Color bgCol = display .getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); composite.setBackground(bgCol); Label label = new Label(composite, SWT.WRAP); label.setForeground(display .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)); label.setBackground(bgCol); label.setFont(JFaceResources.getFontRegistry().getBold( JFaceResources.DEFAULT_FONT)); String msg = IDEWorkbenchMessages.IDEWorkbenchAdvisor_noPerspective; label.setText(msg); ToolBarManager toolBarManager = new ToolBarManager(); // TODO: should obtain the open perspective action from ActionFactory openPerspectiveAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG .create(window); toolBarManager.add(openPerspectiveAction); ToolBar toolBar = toolBarManager.createControl(composite); toolBar.setBackground(bgCol); return composite; } @Override
/** * Tries to open the intro, if one exists and otherwise will open the legacy * Welcome pages. * * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#openIntro() */ @Override public void openIntro() { if (editorsAndIntrosOpened) { return; } editorsAndIntrosOpened = true; // don't try to open the welcome editors if there is an intro if (wbAdvisor.hasIntro()) { super.openIntro(); } else { openWelcomeEditors(getWindowConfigurer().getWindow()); // save any preferences changes caused by the above actions IDEWorkbenchPlugin.getDefault().savePluginPreferences(); } }
makeActions(actionBarConfigurer.getWindowConfigurer().getWindow());
.showIntro(getWindowConfigurer().getWindow(), false);
IWorkbenchWindow window = configurer.getWindow(); IEditorPart activeEditor = null; IWorkbenchPage currentPage = window.getActivePage();
.showIntro(configurer.getWindow(), false);
@Override public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); // show the shortcut bar and progress indicator, which are hidden by // default configurer.setShowPerspectiveBar(true); configurer.setShowProgressIndicator(true); // add the drag and drop support for the editor area configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance()); configurer.addEditorAreaTransfer(ResourceTransfer.getInstance()); configurer.addEditorAreaTransfer(FileTransfer.getInstance()); configurer.addEditorAreaTransfer(MarkerTransfer.getInstance()); configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter( configurer.getWindow())); hookTitleUpdateListeners(configurer); }
@Override public void postWindowRestore() throws WorkbenchException { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); IWorkbenchWindow window = configurer.getWindow();