KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ide > application > IDEWorkbenchWindowAdvisor


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.ide.application;
12
13 import java.net.URL JavaDoc;
14 import java.util.ArrayList JavaDoc;
15 import java.util.Iterator JavaDoc;
16 import java.util.List JavaDoc;
17 import java.util.Map JavaDoc;
18
19 import org.eclipse.core.runtime.IAdaptable;
20 import org.eclipse.core.runtime.IProduct;
21 import org.eclipse.core.runtime.IStatus;
22 import org.eclipse.core.runtime.Platform;
23 import org.eclipse.core.runtime.Status;
24 import org.eclipse.jface.action.IAction;
25 import org.eclipse.jface.action.ToolBarManager;
26 import org.eclipse.jface.dialogs.ErrorDialog;
27 import org.eclipse.jface.dialogs.IDialogConstants;
28 import org.eclipse.jface.dialogs.MessageDialogWithToggle;
29 import org.eclipse.jface.preference.IPreferenceStore;
30 import org.eclipse.jface.resource.JFaceResources;
31 import org.eclipse.osgi.util.NLS;
32 import org.eclipse.swt.SWT;
33 import org.eclipse.swt.dnd.FileTransfer;
34 import org.eclipse.swt.graphics.Color;
35 import org.eclipse.swt.layout.GridLayout;
36 import org.eclipse.swt.widgets.Composite;
37 import org.eclipse.swt.widgets.Control;
38 import org.eclipse.swt.widgets.Display;
39 import org.eclipse.swt.widgets.Label;
40 import org.eclipse.swt.widgets.ToolBar;
41 import org.eclipse.ui.IEditorPart;
42 import org.eclipse.ui.IEditorReference;
43 import org.eclipse.ui.IPageListener;
44 import org.eclipse.ui.IPartListener2;
45 import org.eclipse.ui.IPerspectiveDescriptor;
46 import org.eclipse.ui.IPerspectiveRegistry;
47 import org.eclipse.ui.IPropertyListener;
48 import org.eclipse.ui.IWorkbench;
49 import org.eclipse.ui.IWorkbenchPage;
50 import org.eclipse.ui.IWorkbenchPartConstants;
51 import org.eclipse.ui.IWorkbenchPartReference;
52 import org.eclipse.ui.IWorkbenchWindow;
53 import org.eclipse.ui.PartInitException;
54 import org.eclipse.ui.PerspectiveAdapter;
55 import org.eclipse.ui.WorkbenchException;
56 import org.eclipse.ui.actions.ActionFactory;
57 import org.eclipse.ui.application.ActionBarAdvisor;
58 import org.eclipse.ui.application.IActionBarConfigurer;
59 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
60 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
61 import org.eclipse.ui.internal.ide.AboutInfo;
62 import org.eclipse.ui.internal.ide.EditorAreaDropAdapter;
63 import org.eclipse.ui.internal.ide.IDEInternalPreferences;
64 import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
65 import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
66 import org.eclipse.ui.internal.ide.WorkbenchActionBuilder;
67 import org.eclipse.ui.internal.ide.dialogs.WelcomeEditorInput;
68 import org.eclipse.ui.part.EditorInputTransfer;
69 import org.eclipse.ui.part.MarkerTransfer;
70 import org.eclipse.ui.part.ResourceTransfer;
71 import org.eclipse.ui.statushandlers.StatusManager;
72 import org.eclipse.update.configurator.ConfiguratorUtils;
73 import org.eclipse.update.configurator.IPlatformConfiguration;
74 import org.osgi.framework.Bundle;
75 import org.osgi.framework.BundleException;
76
77 /**
78  * Window-level advisor for the IDE.
79  */

80 public class IDEWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
81
82     private static final String JavaDoc WELCOME_EDITOR_ID = "org.eclipse.ui.internal.ide.dialogs.WelcomeEditor"; //$NON-NLS-1$
83

84     private IDEWorkbenchAdvisor wbAdvisor;
85     private boolean editorsAndIntrosOpened = false;
86     private IEditorPart lastActiveEditor = null;
87     private IPerspectiveDescriptor lastPerspective = null;
88
89     private IWorkbenchPage lastActivePage;
90     private String JavaDoc lastEditorTitle = ""; //$NON-NLS-1$
91

92     private IPropertyListener editorPropertyListener = new IPropertyListener() {
93         public void propertyChanged(Object JavaDoc source, int propId) {
94             if (propId == IWorkbenchPartConstants.PROP_TITLE) {
95                 if (lastActiveEditor != null) {
96                     String JavaDoc newTitle = lastActiveEditor.getTitle();
97                     if (!lastEditorTitle.equals(newTitle)) {
98                         recomputeTitle();
99                     }
100                 }
101             }
102         }
103     };
104
105     private IAdaptable lastInput;
106
107     /**
108      * Crates a new IDE workbench window advisor.
109      *
110      * @param wbAdvisor
111      * the workbench advisor
112      * @param configurer
113      * the window configurer
114      */

115     public IDEWorkbenchWindowAdvisor(IDEWorkbenchAdvisor wbAdvisor,
116             IWorkbenchWindowConfigurer configurer) {
117         super(configurer);
118         this.wbAdvisor = wbAdvisor;
119     }
120
121     /*
122      * (non-Javadoc)
123      *
124      * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer)
125      */

126     public ActionBarAdvisor createActionBarAdvisor(
127             IActionBarConfigurer configurer) {
128         return new WorkbenchActionBuilder(configurer);
129     }
130
131     /**
132      * Returns the workbench.
133      *
134      * @return the workbench
135      */

136     private IWorkbench getWorkbench() {
137         return getWindowConfigurer().getWorkbenchConfigurer().getWorkbench();
138     }
139
140     /*
141      * (non-Javadoc)
142      *
143      * @see org.eclipse.ui.application.WorkbenchAdvisor#preWindowShellClose
144      */

145     public boolean preWindowShellClose() {
146         if (getWorkbench().getWorkbenchWindowCount() > 1) {
147             return true;
148         }
149         // the user has asked to close the last window, while will cause the
150
// workbench to close in due course - prompt the user for confirmation
151
IPreferenceStore store = IDEWorkbenchPlugin.getDefault()
152                 .getPreferenceStore();
153         boolean promptOnExit = store
154                 .getBoolean(IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW);
155
156         if (promptOnExit) {
157             String JavaDoc message;
158
159             String JavaDoc productName = null;
160             IProduct product = Platform.getProduct();
161             if (product != null) {
162                 productName = product.getName();
163             }
164             if (productName == null) {
165                 message = IDEWorkbenchMessages.PromptOnExitDialog_message0;
166             } else {
167                 message = NLS.bind(
168                         IDEWorkbenchMessages.PromptOnExitDialog_message1,
169                         productName);
170             }
171
172             MessageDialogWithToggle dlg = MessageDialogWithToggle
173                     .openOkCancelConfirm(getWindowConfigurer().getWindow()
174                             .getShell(),
175                             IDEWorkbenchMessages.PromptOnExitDialog_shellTitle,
176                             message,
177                             IDEWorkbenchMessages.PromptOnExitDialog_choice,
178                             false, null, null);
179             if (dlg.getReturnCode() != IDialogConstants.OK_ID) {
180                 return false;
181             }
182             if (dlg.getToggleState()) {
183                 store
184                         .setValue(
185                                 IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW,
186                                 false);
187                 IDEWorkbenchPlugin.getDefault().savePluginPreferences();
188             }
189         }
190
191         return true;
192     }
193
194     /*
195      * (non-Javadoc)
196      *
197      * @see org.eclipse.ui.application.WorkbenchAdvisor#preWindowOpen
198      */

199     public void preWindowOpen() {
200         IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
201
202         // show the shortcut bar and progress indicator, which are hidden by
203
// default
204
configurer.setShowPerspectiveBar(true);
205         configurer.setShowFastViewBars(true);
206         configurer.setShowProgressIndicator(true);
207
208         // add the drag and drop support for the editor area
209
configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance());
210         configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
211         configurer.addEditorAreaTransfer(FileTransfer.getInstance());
212         configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
213         configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(
214                 configurer.getWindow()));
215
216         hookTitleUpdateListeners(configurer);
217     }
218
219     /**
220      * Hooks the listeners needed on the window
221      *
222      * @param configurer
223      */

224     private void hookTitleUpdateListeners(IWorkbenchWindowConfigurer configurer) {
225         // hook up the listeners to update the window title
226
configurer.getWindow().addPageListener(new IPageListener() {
227             public void pageActivated(IWorkbenchPage page) {
228                 updateTitle();
229             }
230
231             public void pageClosed(IWorkbenchPage page) {
232                 updateTitle();
233             }
234
235             public void pageOpened(IWorkbenchPage page) {
236                 // do nothing
237
}
238         });
239         configurer.getWindow().addPerspectiveListener(new PerspectiveAdapter() {
240             public void perspectiveActivated(IWorkbenchPage page,
241                     IPerspectiveDescriptor perspective) {
242                 updateTitle();
243             }
244
245             public void perspectiveSavedAs(IWorkbenchPage page,
246                     IPerspectiveDescriptor oldPerspective,
247                     IPerspectiveDescriptor newPerspective) {
248                 updateTitle();
249             }
250
251             public void perspectiveDeactivated(IWorkbenchPage page,
252                     IPerspectiveDescriptor perspective) {
253                 updateTitle();
254             }
255         });
256         configurer.getWindow().getPartService().addPartListener(
257                 new IPartListener2() {
258                     public void partActivated(IWorkbenchPartReference ref) {
259                         if (ref instanceof IEditorReference) {
260                             updateTitle();
261                         }
262                     }
263
264                     public void partBroughtToTop(IWorkbenchPartReference ref) {
265                         if (ref instanceof IEditorReference) {
266                             updateTitle();
267                         }
268                     }
269
270                     public void partClosed(IWorkbenchPartReference ref) {
271                         updateTitle();
272                     }
273
274                     public void partDeactivated(IWorkbenchPartReference ref) {
275                         // do nothing
276
}
277
278                     public void partOpened(IWorkbenchPartReference ref) {
279                         // do nothing
280
}
281
282                     public void partHidden(IWorkbenchPartReference ref) {
283                         // do nothing
284
}
285
286                     public void partVisible(IWorkbenchPartReference ref) {
287                         // do nothing
288
}
289
290                     public void partInputChanged(IWorkbenchPartReference ref) {
291                         // do nothing
292
}
293                 });
294     }
295
296     private String JavaDoc computeTitle() {
297         IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
298         IWorkbenchPage currentPage = configurer.getWindow().getActivePage();
299         IEditorPart activeEditor = null;
300         if (currentPage != null) {
301             activeEditor = currentPage.getActiveEditor();
302         }
303
304         String JavaDoc title = null;
305         IProduct product = Platform.getProduct();
306         if (product != null) {
307             title = product.getName();
308         }
309         if (title == null) {
310             title = ""; //$NON-NLS-1$
311
}
312
313         if (currentPage != null) {
314             if (activeEditor != null) {
315                 lastEditorTitle = activeEditor.getTitleToolTip();
316                 title = NLS.bind(
317                         IDEWorkbenchMessages.WorkbenchWindow_shellTitle,
318                         lastEditorTitle, title);
319             }
320             IPerspectiveDescriptor persp = currentPage.getPerspective();
321             String JavaDoc label = ""; //$NON-NLS-1$
322
if (persp != null) {
323                 label = persp.getLabel();
324             }
325             IAdaptable input = currentPage.getInput();
326             if (input != null && !input.equals(wbAdvisor.getDefaultPageInput())) {
327                 label = currentPage.getLabel();
328             }
329             if (label != null && !label.equals("")) { //$NON-NLS-1$
330
title = NLS.bind(
331                         IDEWorkbenchMessages.WorkbenchWindow_shellTitle, label,
332                         title);
333             }
334         }
335
336         String JavaDoc workspaceLocation = wbAdvisor.getWorkspaceLocation();
337         if (workspaceLocation != null) {
338             title = NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle,
339                     title, workspaceLocation);
340         }
341
342         return title;
343     }
344
345     private void recomputeTitle() {
346         IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
347         String JavaDoc oldTitle = configurer.getTitle();
348         String JavaDoc newTitle = computeTitle();
349         if (!newTitle.equals(oldTitle)) {
350             configurer.setTitle(newTitle);
351         }
352     }
353
354     /**
355      * Updates the window title. Format will be: [pageInput -]
356      * [currentPerspective -] [editorInput -] [workspaceLocation -] productName
357      */

358     private void updateTitle() {
359         IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
360         IWorkbenchWindow window = configurer.getWindow();
361         IEditorPart activeEditor = null;
362         IWorkbenchPage currentPage = window.getActivePage();
363         IPerspectiveDescriptor persp = null;
364         IAdaptable input = null;
365
366         if (currentPage != null) {
367             activeEditor = currentPage.getActiveEditor();
368             persp = currentPage.getPerspective();
369             input = currentPage.getInput();
370         }
371
372         // Nothing to do if the editor hasn't changed
373
if (activeEditor == lastActiveEditor && currentPage == lastActivePage
374                 && persp == lastPerspective && input == lastInput) {
375             return;
376         }
377
378         if (lastActiveEditor != null) {
379             lastActiveEditor.removePropertyListener(editorPropertyListener);
380         }
381
382         lastActiveEditor = activeEditor;
383         lastActivePage = currentPage;
384         lastPerspective = persp;
385         lastInput = input;
386
387         if (activeEditor != null) {
388             activeEditor.addPropertyListener(editorPropertyListener);
389         }
390
391         recomputeTitle();
392     }
393
394     /*
395      * (non-Javadoc)
396      *
397      * @see org.eclipse.ui.application.WorkbenchAdvisor#postWindowRestore
398      */

399     public void postWindowRestore() throws WorkbenchException {
400         IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
401         IWorkbenchWindow window = configurer.getWindow();
402
403         int index = getWorkbench().getWorkbenchWindowCount() - 1;
404
405         AboutInfo[] welcomePerspectiveInfos = wbAdvisor
406                 .getWelcomePerspectiveInfos();
407         if (index >= 0 && welcomePerspectiveInfos != null
408                 && index < welcomePerspectiveInfos.length) {
409             // find a page that exist in the window
410
IWorkbenchPage page = window.getActivePage();
411             if (page == null) {
412                 IWorkbenchPage[] pages = window.getPages();
413                 if (pages != null && pages.length > 0) {
414                     page = pages[0];
415                 }
416             }
417
418             // if the window does not contain a page, create one
419
String JavaDoc perspectiveId = welcomePerspectiveInfos[index]
420                     .getWelcomePerspectiveId();
421             if (page == null) {
422                 IAdaptable root = wbAdvisor.getDefaultPageInput();
423                 page = window.openPage(perspectiveId, root);
424             } else {
425                 IPerspectiveRegistry reg = getWorkbench()
426                         .getPerspectiveRegistry();
427                 IPerspectiveDescriptor desc = reg
428                         .findPerspectiveWithId(perspectiveId);
429                 if (desc != null) {
430                     page.setPerspective(desc);
431                 }
432             }
433
434             // set the active page and open the welcome editor
435
window.setActivePage(page);
436             page.openEditor(new WelcomeEditorInput(
437                     welcomePerspectiveInfos[index]), WELCOME_EDITOR_ID, true);
438         }
439     }
440
441     /**
442      * Tries to open the intro, if one exists and otherwise will open the legacy
443      * Welcome pages.
444      *
445      * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#openIntro()
446      */

447     public void openIntro() {
448         if (editorsAndIntrosOpened) {
449             return;
450         }
451
452         editorsAndIntrosOpened = true;
453
454         // don't try to open the welcome editors if there is an intro
455
if (wbAdvisor.hasIntro()) {
456             super.openIntro();
457         } else {
458             openWelcomeEditors(getWindowConfigurer().getWindow());
459             // save any preferences changes caused by the above actions
460
IDEWorkbenchPlugin.getDefault().savePluginPreferences();
461         }
462     }
463
464     /*
465      * Open the welcome editor for the primary feature and for any newly
466      * installed features.
467      */

468     private void openWelcomeEditors(IWorkbenchWindow window) {
469         if (IDEWorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
470                 IDEInternalPreferences.WELCOME_DIALOG)) {
471             // show the welcome page for the product the first time the
472
// workbench opens
473
IProduct product = Platform.getProduct();
474             if (product == null) {
475                 return;
476             }
477
478             AboutInfo productInfo = new AboutInfo(product);
479             URL JavaDoc url = productInfo.getWelcomePageURL();
480             if (url == null) {
481                 return;
482             }
483
484             IDEWorkbenchPlugin.getDefault().getPreferenceStore().setValue(
485                     IDEInternalPreferences.WELCOME_DIALOG, false);
486             openWelcomeEditor(window, new WelcomeEditorInput(productInfo), null);
487         } else {
488             // Show the welcome page for any newly installed features
489
List JavaDoc welcomeFeatures = new ArrayList JavaDoc();
490             for (Iterator JavaDoc it = wbAdvisor.getNewlyAddedBundleGroups().entrySet()
491                     .iterator(); it.hasNext();) {
492                 Map.Entry JavaDoc entry = (Map.Entry JavaDoc) it.next();
493                 String JavaDoc versionedId = (String JavaDoc) entry.getKey();
494                 String JavaDoc featureId = versionedId.substring(0, versionedId
495                         .indexOf(':'));
496                 AboutInfo info = (AboutInfo) entry.getValue();
497
498                 if (info != null && info.getWelcomePageURL() != null) {
499                     welcomeFeatures.add(info);
500                     // activate the feature plug-in so it can run some install
501
// code
502
IPlatformConfiguration platformConfiguration = ConfiguratorUtils
503                             .getCurrentPlatformConfiguration();
504                     IPlatformConfiguration.IFeatureEntry feature = platformConfiguration
505                             .findConfiguredFeatureEntry(featureId);
506                     if (feature != null) {
507                         String JavaDoc pi = feature.getFeaturePluginIdentifier();
508                         if (pi != null) {
509                             // Start the bundle if there is one
510
Bundle bundle = Platform.getBundle(pi);
511                             if (bundle != null) {
512                                 try {
513                                     bundle.start(Bundle.START_TRANSIENT);
514                                 } catch (BundleException exception) {
515                                     StatusManager
516                                             .getManager()
517                                             .handle(
518                                                     new Status(
519                                                             IStatus.ERROR,
520                                                             IDEApplication.PLUGIN_ID,
521                                                             "Failed to load feature", exception));//$NON-NLS-1$
522
}
523                             }
524                         }
525                     }
526                 }
527             }
528
529             int wCount = getWorkbench().getWorkbenchWindowCount();
530             for (int i = 0; i < welcomeFeatures.size(); i++) {
531                 AboutInfo newInfo = (AboutInfo) welcomeFeatures.get(i);
532                 String JavaDoc id = newInfo.getWelcomePerspectiveId();
533                 // Other editors were already opened in postWindowRestore(..)
534
if (id == null || i >= wCount) {
535                     openWelcomeEditor(window, new WelcomeEditorInput(newInfo),
536                             id);
537                 }
538             }
539         }
540     }
541
542     /**
543      * Open a welcome editor for the given input
544      */

545     private void openWelcomeEditor(IWorkbenchWindow window,
546             WelcomeEditorInput input, String JavaDoc perspectiveId) {
547         if (getWorkbench().getWorkbenchWindowCount() == 0) {
548             // Something is wrong, there should be at least
549
// one workbench window open by now.
550
return;
551         }
552
553         IWorkbenchWindow win = window;
554         if (perspectiveId != null) {
555             try {
556                 win = getWorkbench().openWorkbenchWindow(perspectiveId,
557                         wbAdvisor.getDefaultPageInput());
558                 if (win == null) {
559                     win = window;
560                 }
561             } catch (WorkbenchException e) {
562                 IDEWorkbenchPlugin
563                         .log(
564                                 "Error opening window with welcome perspective.", e.getStatus()); //$NON-NLS-1$
565
return;
566             }
567         }
568
569         if (win == null) {
570             win = getWorkbench().getWorkbenchWindows()[0];
571         }
572
573         IWorkbenchPage page = win.getActivePage();
574         String JavaDoc id = perspectiveId;
575         if (id == null) {
576             id = getWorkbench().getPerspectiveRegistry()
577                     .getDefaultPerspective();
578         }
579
580         if (page == null) {
581             try {
582                 page = win.openPage(id, wbAdvisor.getDefaultPageInput());
583             } catch (WorkbenchException e) {
584                 ErrorDialog.openError(win.getShell(),
585                         IDEWorkbenchMessages.Problems_Opening_Page, e
586                                 .getMessage(), e.getStatus());
587             }
588         }
589         if (page == null) {
590             return;
591         }
592
593         if (page.getPerspective() == null) {
594             try {
595                 page = getWorkbench().showPerspective(id, win);
596             } catch (WorkbenchException e) {
597                 ErrorDialog
598                         .openError(
599                                 win.getShell(),
600                                 IDEWorkbenchMessages.Workbench_openEditorErrorDialogTitle,
601                                 IDEWorkbenchMessages.Workbench_openEditorErrorDialogMessage,
602                                 e.getStatus());
603                 return;
604             }
605         }
606
607         page.setEditorAreaVisible(true);
608
609         // see if we already have an editor
610
IEditorPart editor = page.findEditor(input);
611         if (editor != null) {
612             page.activate(editor);
613             return;
614         }
615
616         try {
617             page.openEditor(input, WELCOME_EDITOR_ID);
618         } catch (PartInitException e) {
619             ErrorDialog
620                     .openError(
621                             win.getShell(),
622                             IDEWorkbenchMessages.Workbench_openEditorErrorDialogTitle,
623                             IDEWorkbenchMessages.Workbench_openEditorErrorDialogMessage,
624                             e.getStatus());
625         }
626         return;
627     }
628
629     /*
630      * (non-Javadoc)
631      *
632      * @see org.eclipse.ui.application.WorkbenchAdvisor#createEmptyWindowContents(org.eclipse.ui.application.IWorkbenchWindowConfigurer,
633      * org.eclipse.swt.widgets.Composite)
634      */

635     public Control createEmptyWindowContents(Composite parent) {
636         final IWorkbenchWindow window = getWindowConfigurer().getWindow();
637         Composite composite = new Composite(parent, SWT.NONE);
638         composite.setLayout(new GridLayout(2, false));
639         Display display = composite.getDisplay();
640         Color bgCol = display
641                 .getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
642         composite.setBackground(bgCol);
643         Label label = new Label(composite, SWT.WRAP);
644         label.setForeground(display
645                 .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
646         label.setBackground(bgCol);
647         label.setFont(JFaceResources.getFontRegistry().getBold(
648                 JFaceResources.DEFAULT_FONT));
649         String JavaDoc msg = IDEWorkbenchMessages.IDEWorkbenchAdvisor_noPerspective;
650         label.setText(msg);
651         ToolBarManager toolBarManager = new ToolBarManager();
652         // TODO: should obtain the open perspective action from ActionFactory
653
IAction openPerspectiveAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG
654                 .create(window);
655         toolBarManager.add(openPerspectiveAction);
656         ToolBar toolBar = toolBarManager.createControl(composite);
657         toolBar.setBackground(bgCol);
658         return composite;
659     }
660
661 }
662
Popular Tags