ApplicationWorkbenchWindowAdvisor.java
Go to the documentation of this file.00001 package edu.rice.cs.hpc.traceviewer.framework;
00002
00003 import org.eclipse.jface.action.IStatusLineManager;
00004 import org.eclipse.ui.IWorkbenchWindow;
00005 import org.eclipse.ui.application.ActionBarAdvisor;
00006 import org.eclipse.ui.application.IActionBarConfigurer;
00007 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
00008 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
00009
00010 import edu.rice.cs.hpc.common.ui.Util;
00011 import edu.rice.cs.hpc.traceviewer.db.TraceDatabase;
00012
00013 public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
00014
00015 final private String args[];
00016
00017 public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer, String []_args) {
00018 super(configurer);
00019 args = _args;
00020 }
00021
00022
00023
00024
00025
00026 public ActionBarAdvisor createActionBarAdvisor(
00027 IActionBarConfigurer configurer) {
00028 return new ApplicationActionBarAdvisor(configurer);
00029 }
00030
00031
00032
00033
00034
00035 public void preWindowOpen() {
00036 IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
00037
00038 configurer.setShowCoolBar(false);
00039 configurer.setShowStatusLine(true);
00040 configurer.setShowProgressIndicator(true);
00041
00042 final IWorkbenchWindow window = configurer.getWindow();
00043 if (!Util.checkJavaVendor(window.getShell()))
00044 window.close();
00045 }
00046
00047
00048
00049
00050
00051
00052 public void postWindowOpen() {
00053
00054
00055
00056
00057
00058 final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
00059 final IStatusLineManager status = configurer.getActionBarConfigurer().getStatusLineManager();
00060
00061
00062 if (args != null && args.length > 0) {
00063 for (String arg : args) {
00064 if (arg != null && arg.charAt(0) != '-') {
00065
00066 TraceDatabase.openDatabase(configurer.getWindow(), arg, status);
00067 return;
00068 }
00069 }
00070 }
00071
00072
00073
00074 TraceDatabase.openDatabase(configurer.getWindow(), status);
00075 }
00076
00077
00078
00079
00080
00081 public void postWindowClose() {
00082
00083
00084 TraceDatabase.removeInstance(this.getWindowConfigurer().getWindow());
00085 }
00086 }