ApplicationWorkbenchAdvisor.java
Go to the documentation of this file.00001 package edu.rice.cs.hpc.viewer.framework;
00002
00003 import org.eclipse.ui.IWindowListener;
00004 import org.eclipse.ui.IWorkbench;
00005 import org.eclipse.ui.IWorkbenchWindow;
00006 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
00007 import org.eclipse.ui.application.WorkbenchAdvisor;
00008 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
00009 import org.eclipse.ui.application.IWorkbenchConfigurer;
00010
00011 import edu.rice.cs.hpc.viewer.window.ViewerWindow;
00012 import edu.rice.cs.hpc.viewer.window.ViewerWindowManager;
00013
00014 public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
00015
00016 public static final String PERSPECTIVE_ID = "edu.rice.cs.hpc.perspective";
00017 private String[] args;
00018
00019
00020 public void initialize(IWorkbenchConfigurer configurer) {
00021 super.initialize(configurer);
00022
00023 configurer.setSaveAndRestore(true);
00024 }
00025
00026 public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
00027 IWorkbenchWindowConfigurer configurer) {
00028 return new ApplicationWorkbenchWindowAdvisor(configurer, this.args);
00029 }
00030
00031 public String getInitialWindowPerspectiveId() {
00032 return PERSPECTIVE_ID;
00033 }
00034
00035 public ApplicationWorkbenchAdvisor() {
00036 super();
00037 }
00038
00039 public ApplicationWorkbenchAdvisor(String []arguments) {
00040 super();
00041 this.args = arguments;
00042 }
00043
00044
00045
00046
00047
00048
00049 public void postStartup() {
00050 super.postStartup();
00051
00052 final IWorkbench workbench = this.getWorkbenchConfigurer().getWorkbench();
00053
00054
00055
00056
00057
00058
00059
00060
00061 workbench.addWindowListener( new IWindowListener() {
00062
00063 public void windowActivated(IWorkbenchWindow window)
00064 {
00065 ViewerWindow vWin = ViewerWindowManager.getViewerWindow(window);
00066 if (vWin != null)
00067 {
00068 vWin.checkService();
00069 }
00070 }
00071
00072 public void windowDeactivated(IWorkbenchWindow window) {}
00073 public void windowClosed(IWorkbenchWindow window) {}
00074 public void windowOpened(IWorkbenchWindow window) {}
00075
00076 });
00077 }
00078 }