diff --git a/cave/build/p2-build.xml b/cave/build/p2-build.xml index 943f86f751..998d4a334d 100644 --- a/cave/build/p2-build.xml +++ b/cave/build/p2-build.xml @@ -120,12 +120,6 @@ includes="it.*/**" /> - - - - - @@ -162,6 +156,10 @@ + + + @@ -422,20 +420,6 @@ - - - - - - - - - - - com.raytheon.uf.viz.eclipse.feature + com.raytheon.uf.viz.base.feature diff --git a/cave/com.raytheon.uf.viz.eclipse.feature/build.properties b/cave/com.raytheon.uf.viz.base.feature/build.properties similarity index 100% rename from cave/com.raytheon.uf.viz.eclipse.feature/build.properties rename to cave/com.raytheon.uf.viz.base.feature/build.properties diff --git a/cave/com.raytheon.uf.viz.base.feature/feature.xml b/cave/com.raytheon.uf.viz.base.feature/feature.xml new file mode 100644 index 0000000000..5aa3cbdc9d --- /dev/null +++ b/cave/com.raytheon.uf.viz.base.feature/feature.xml @@ -0,0 +1,250 @@ + + + + + [Enter Feature Description here.] + + + + [Enter Copyright Description here.] + + + + [Enter License Description here.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml b/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml index 122bb60914..36e33b2ec2 100644 --- a/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml @@ -21,7 +21,6 @@ - @@ -144,4 +143,11 @@ version="0.0.0" unpack="false"/> + + diff --git a/cave/com.raytheon.uf.viz.common.core.feature/feature.xml b/cave/com.raytheon.uf.viz.common.core.feature/feature.xml index 2f9468f542..53313fd60a 100644 --- a/cave/com.raytheon.uf.viz.common.core.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.common.core.feature/feature.xml @@ -28,13 +28,6 @@ version="0.0.0" unpack="false"/> - - + + + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.core.feature/feature.xml b/cave/com.raytheon.uf.viz.core.feature/feature.xml index 4525e24ec8..d6be8c7440 100644 --- a/cave/com.raytheon.uf.viz.core.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.core.feature/feature.xml @@ -19,48 +19,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.core.maps.feature/feature.xml b/cave/com.raytheon.uf.viz.core.maps.feature/feature.xml index 807f63b31b..b9d6ed6647 100644 --- a/cave/com.raytheon.uf.viz.core.maps.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.core.maps.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/cave/com.raytheon.uf.viz.cots.feature/feature.xml b/cave/com.raytheon.uf.viz.cots.feature/feature.xml index 2a9dc8502f..93c524c534 100644 --- a/cave/com.raytheon.uf.viz.cots.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.cots.feature/feature.xml @@ -16,95 +16,17 @@ [Enter License Description here.] - + - - - - - - - - - - - - - - - - - - - - - - diff --git a/cave/com.raytheon.uf.viz.d2d.skewt.feature/feature.xml b/cave/com.raytheon.uf.viz.d2d.skewt.feature/feature.xml index 396988d69e..0173b1030c 100644 --- a/cave/com.raytheon.uf.viz.d2d.skewt.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.d2d.skewt.feature/feature.xml @@ -26,7 +26,6 @@ - diff --git a/cave/com.raytheon.uf.viz.d2d.xy.feature/feature.xml b/cave/com.raytheon.uf.viz.d2d.xy.feature/feature.xml index 4e2c0af16b..44d0d43efb 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.d2d.xy.feature/feature.xml @@ -28,7 +28,6 @@ - - diff --git a/cave/com.raytheon.uf.viz.displays.feature/feature.xml b/cave/com.raytheon.uf.viz.displays.feature/feature.xml index 23b89fcbe1..06faad812e 100644 --- a/cave/com.raytheon.uf.viz.displays.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.displays.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/cave/com.raytheon.uf.viz.eclipse.feature/com.raytheon.uf.viz.eclipse.feature.ecl b/cave/com.raytheon.uf.viz.eclipse.feature/com.raytheon.uf.viz.eclipse.feature.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/cave/com.raytheon.uf.viz.eclipse.feature/feature.xml b/cave/com.raytheon.uf.viz.eclipse.feature/feature.xml deleted file mode 100644 index 0a9acf2813..0000000000 --- a/cave/com.raytheon.uf.viz.eclipse.feature/feature.xml +++ /dev/null @@ -1,613 +0,0 @@ - - - - - [Enter Feature Description here.] - - - - [Enter Copyright Description here.] - - - - [Enter License Description here.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cave/com.raytheon.uf.viz.gisdatastore.feature/feature.xml b/cave/com.raytheon.uf.viz.gisdatastore.feature/feature.xml index 12b476b470..2e6d6d16eb 100644 --- a/cave/com.raytheon.uf.viz.gisdatastore.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.gisdatastore.feature/feature.xml @@ -20,7 +20,6 @@ - diff --git a/cave/com.raytheon.uf.viz.localization.perspective.feature/feature.xml b/cave/com.raytheon.uf.viz.localization.perspective.feature/feature.xml index 90cae5af42..b59da369c9 100644 --- a/cave/com.raytheon.uf.viz.localization.perspective.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.localization.perspective.feature/feature.xml @@ -18,7 +18,6 @@ - @@ -209,4 +208,158 @@ install-size="0" version="0.0.0"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.ncep.displays.feature/feature.xml b/cave/com.raytheon.uf.viz.ncep.displays.feature/feature.xml index e454f6a4b0..b33de0a608 100644 --- a/cave/com.raytheon.uf.viz.ncep.displays.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.ncep.displays.feature/feature.xml @@ -29,7 +29,6 @@ - - diff --git a/cave/com.raytheon.uf.viz.nwsauth.feature/feature.xml b/cave/com.raytheon.uf.viz.nwsauth.feature/feature.xml index 02cb3f4570..528e4fd55b 100644 --- a/cave/com.raytheon.uf.viz.nwsauth.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.nwsauth.feature/feature.xml @@ -18,7 +18,6 @@ - diff --git a/cave/com.raytheon.uf.viz.personalities.cave/.classpath b/cave/com.raytheon.uf.viz.personalities.cave/.classpath new file mode 100644 index 0000000000..1fa3e6803d --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cave/com.raytheon.uf.viz.personalities.cave/.project b/cave/com.raytheon.uf.viz.personalities.cave/.project new file mode 100644 index 0000000000..19c60e57b6 --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.viz.personalities.cave + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/cave/com.raytheon.uf.viz.personalities.cave/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.personalities.cave/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..f6f04f6fa4 --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Mar 19 16:21:24 CDT 2013 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/cave/com.raytheon.uf.viz.personalities.cave/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.personalities.cave/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..0176ac108a --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/META-INF/MANIFEST.MF @@ -0,0 +1,24 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: CAVE UI Personalities +Bundle-SymbolicName: com.raytheon.uf.viz.personalities.cave;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: com.raytheon.uf.viz.personalities.cave.Activator +Bundle-Vendor: RAYTHEON +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + com.raytheon.uf.viz.application;bundle-version="1.0.0", + com.raytheon.uf.viz.core;bundle-version="1.12.1174", + com.raytheon.viz.core;bundle-version="1.12.1174", + com.raytheon.viz.ui;bundle-version="1.12.1174", + com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174", + javax.measure;bundle-version="1.0.0", + com.raytheon.viz.alerts;bundle-version="1.12.1174", + com.raytheon.uf.common.pypies;bundle-version="1.12.1174" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Export-Package: com.raytheon.uf.viz.personalities.cave, + com.raytheon.uf.viz.personalities.cave.component, + com.raytheon.uf.viz.personalities.cave.menu, + com.raytheon.uf.viz.personalities.cave.presentation, + com.raytheon.uf.viz.personalities.cave.workbench diff --git a/cave/com.raytheon.uf.viz.personalities.cave/build.properties b/cave/com.raytheon.uf.viz.personalities.cave/build.properties new file mode 100644 index 0000000000..e1d2deade8 --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + splash.bmp diff --git a/cave/com.raytheon.uf.viz.personalities.cave/plugin.xml b/cave/com.raytheon.uf.viz.personalities.cave/plugin.xml new file mode 100644 index 0000000000..935d9c4d4d --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/plugin.xml @@ -0,0 +1,483 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.personalities.cave/splash.bmp b/cave/com.raytheon.uf.viz.personalities.cave/splash.bmp new file mode 100644 index 0000000000..01f7516d38 Binary files /dev/null and b/cave/com.raytheon.uf.viz.personalities.cave/splash.bmp differ diff --git a/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/Activator.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/Activator.java new file mode 100644 index 0000000000..1f3537ea86 --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/Activator.java @@ -0,0 +1,50 @@ +package com.raytheon.uf.viz.personalities.cave; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "com.raytheon.uf.viz.personalities.cave"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/component/CAVEApplication.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/component/CAVEApplication.java new file mode 100644 index 0000000000..3f4067ff9b --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/component/CAVEApplication.java @@ -0,0 +1,294 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.personalities.cave.component; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +import javax.xml.bind.JAXBException; + +import org.eclipse.core.internal.runtime.InternalPlatform; +import org.eclipse.core.runtime.ILogListener; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.equinox.app.IApplication; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.internal.WorkbenchPlugin; + +import com.raytheon.uf.common.datastorage.DataStoreFactory; +import com.raytheon.uf.common.pypies.PyPiesDataStoreFactory; +import com.raytheon.uf.common.pypies.PypiesProperties; +import com.raytheon.uf.common.serialization.SerializationUtil; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.time.SimulatedTime; +import com.raytheon.uf.viz.application.ProgramArguments; +import com.raytheon.uf.viz.application.component.IStandaloneComponent; +import com.raytheon.uf.viz.core.RecordFactory; +import com.raytheon.uf.viz.core.VizApp; +import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserver; +import com.raytheon.uf.viz.core.localization.LocalizationInitializer; +import com.raytheon.uf.viz.personalities.cave.workbench.VizWorkbenchAdvisor; +import com.raytheon.viz.alerts.jobs.AutoUpdater; +import com.raytheon.viz.alerts.jobs.MenuUpdater; +import com.raytheon.viz.alerts.observers.ProductAlertObserver; +import com.raytheon.viz.core.CorePlugin; +import com.raytheon.viz.core.mode.CAVEMode; +import com.raytheon.viz.core.preferences.PreferenceConstants; +import com.raytheon.viz.core.units.UnitRegistrar; + +/** + * {@link IStandaloneComponent} that starts and initializes the CAVE Workbench + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 20, 2013            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class CAVEApplication implements IStandaloneComponent { + + protected static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(CAVEApplication.class, "CAVE"); + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.application.component.IStandaloneComponent#startComponent + * (java.lang.String) + */ + @Override + @SuppressWarnings("restriction") + public Object startComponent(String componentName) throws Exception { + InternalPlatform.getDefault() + .getLog(WorkbenchPlugin.getDefault().getBundle()) + .addLogListener(new ILogListener() { + + @Override + public void logging(IStatus status, String plugin) { + if (status.getMessage() != null) { + System.out.println(status.getMessage()); + } + if (status.getException() != null) { + status.getException().printStackTrace(); + } + } + + }); + + UnitRegistrar.registerUnits(); + CAVEMode.performStartupDuties(); + + Display display = PlatformUI.createDisplay(); + + try { + initializeLocalization(); + } catch (Exception e) { + e.printStackTrace(); + statusHandler.handle( + Priority.CRITICAL, + "Could not connect to localization server: " + + e.getLocalizedMessage(), e); + // we return EXIT_OK here so eclipse doesn't try to pop up an error + // dialog which would break gfeClient-based cron jobs. + return IApplication.EXIT_OK; + } + initializeSerialization(); + initializeDataStoreFactory(); + initializeObservers(); + initializeSimulatedTime(); + + int returnCode = IApplication.EXIT_OK; + + try { + returnCode = PlatformUI.createAndRunWorkbench(display, + getWorkbenchAdvisor()); + } catch (Throwable t) { + t.printStackTrace(); + MessageDialog + .openError( + null, + "Error!", "Error instantiating workbench: " + t.getMessage()); //$NON-NLS-1$" + + } finally { + try { + if (CAVEMode.getMode() == CAVEMode.PRACTICE) { + saveUserTime(); + } + } catch (RuntimeException e) { + // catch any exceptions to ensure rest of finally block + // executes + } + } + + if (returnCode == PlatformUI.RETURN_RESTART) { + return IApplication.EXIT_RESTART; + } + return returnCode; + } + + protected void initializeLocalization() throws Exception { + new LocalizationInitializer(true, false).run(); + } + + /** + * Initializes the DataStoreFactory for the component. + */ + protected void initializeDataStoreFactory() { + PypiesProperties pypiesProps = new PypiesProperties(); + pypiesProps.setAddress(VizApp.getPypiesServer()); + DataStoreFactory.getInstance().setUnderlyingFactory( + new PyPiesDataStoreFactory(pypiesProps)); + } + + protected void initializeSerialization() { + new Job("Loading Serialization") { + + @Override + protected IStatus run(IProgressMonitor monitor) { + try { + SerializationUtil.getJaxbContext(); + } catch (JAXBException e) { + statusHandler.handle(Priority.CRITICAL, + "An error occured initializing Serialization", e); + } + return Status.OK_STATUS; + } + + }.schedule(); + } + + /** + * Initialize any observers needed by the application + */ + protected void initializeObservers() { + // Setup cave notification observer + CAVELocalizationNotificationObserver.register(); + registerProductAlerts(); + } + + protected void registerProductAlerts() { + // Register product observers + ProductAlertObserver.addObserver(null, new MenuUpdater()); + for (String plugin : RecordFactory.getInstance().getSupportedPlugins()) { + // Create separate AutoUpdater per plugin + ProductAlertObserver.addObserver(plugin, new AutoUpdater()); + } + } + + /** + * Save the current state of SimulatedTime + * + * @throws IOException + */ + protected void saveUserTime() throws IOException { + /* + * Save the current workstation time + */ + long timeValue = 0; + if (!SimulatedTime.getSystemTime().isRealTime()) { + timeValue = SimulatedTime.getSystemTime().getTime().getTime(); + } + CorePlugin.getDefault().getPreferenceStore() + .setValue(PreferenceConstants.P_LAST_USER_TIME, timeValue); + CorePlugin + .getDefault() + .getPreferenceStore() + .setValue(PreferenceConstants.P_LAST_USER_TIME_FROZEN, + SimulatedTime.getSystemTime().isFrozen()); + CorePlugin.getDefault().getPreferenceStore().save(); + } + + /** + * Restore the prior state of SimulatedTime + */ + protected void initializeSimulatedTime() { + long timeValue = 0; + boolean isFrozen = false; + + // If CorePlugin.getDefault() == null, assume running from a unit test + if (CorePlugin.getDefault() != null) { + String dateString = ProgramArguments.getInstance().getString( + "-time"); + if (dateString != null && !dateString.isEmpty()) { + try { + DateFormat dateParser = new SimpleDateFormat( + "yyyyMMdd_HHmm"); + dateParser.setTimeZone(TimeZone.getTimeZone("GMT")); + Date newSimTime = dateParser.parse(dateString); + timeValue = newSimTime.getTime(); + } catch (ParseException e) { + statusHandler + .handle(Priority.WARN, + "Invalid argument specified for command-line parameter '-time'.", + e); + } + } + } + + // if we're in practice mode and the user did not specify a DRT value on + // the CLI, restore their previous time setting + if ((CAVEMode.getMode() == CAVEMode.PRACTICE) && (timeValue == 0)) { + // Get the last saved time from the localization settings + timeValue = CorePlugin.getDefault().getPreferenceStore() + .getLong(PreferenceConstants.P_LAST_USER_TIME); + + // Get if the last saved time was a frozen modified time + isFrozen = CorePlugin.getDefault().getPreferenceStore() + .getBoolean(PreferenceConstants.P_LAST_USER_TIME_FROZEN); + } + + SimulatedTime systemTime = SimulatedTime.getSystemTime(); + systemTime.notifyListeners(false); + systemTime.setRealTime(); + systemTime.setFrozen(isFrozen); + if (timeValue != 0) { + systemTime.setTime(new Date(timeValue)); + } + systemTime.notifyListeners(true); + } + + /** + * Get the workbench advisor for the application + * + * @return + */ + protected WorkbenchAdvisor getWorkbenchAdvisor() { + return new VizWorkbenchAdvisor(); + } +} diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CloseAllPerspectivesHandler.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/CloseAllPerspectivesHandler.java similarity index 97% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CloseAllPerspectivesHandler.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/CloseAllPerspectivesHandler.java index 8f3f6492a0..be1251324b 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CloseAllPerspectivesHandler.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/CloseAllPerspectivesHandler.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.viz.ui.personalities.awips; +package com.raytheon.uf.viz.personalities.cave.menu; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/ClosePerspectiveHandler.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/ClosePerspectiveHandler.java similarity index 95% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/ClosePerspectiveHandler.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/ClosePerspectiveHandler.java index ec41d9b264..0abfc8ef1e 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/ClosePerspectiveHandler.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/ClosePerspectiveHandler.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.viz.ui.personalities.awips; +package com.raytheon.uf.viz.personalities.cave.menu; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; @@ -28,6 +28,8 @@ import org.eclipse.ui.IWorkbenchCommandConstants; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.handlers.HandlerUtil; +import com.raytheon.uf.viz.personalities.cave.workbench.OpenPerspectiveList; + /** * Close perspective handler, only runs if not last perspective * diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/OpenPerspectiveMenu.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/OpenPerspectiveMenu.java similarity index 97% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/OpenPerspectiveMenu.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/OpenPerspectiveMenu.java index c9b2cac458..f8350789c4 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/OpenPerspectiveMenu.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/OpenPerspectiveMenu.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.viz.ui.personalities.awips; +package com.raytheon.uf.viz.personalities.cave.menu; import org.eclipse.ui.IPerspectiveDescriptor; import org.eclipse.ui.PlatformUI; diff --git a/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/SystemIdItem.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/SystemIdItem.java new file mode 100644 index 0000000000..a937d346f6 --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/SystemIdItem.java @@ -0,0 +1,133 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.personalities.cave.menu; + +import java.lang.management.ManagementFactory; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.ui.actions.CompoundContributionItem; + +import sun.management.Agent; + +/** + * Command that displays the system id + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Aug 10, 2011            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class SystemIdItem extends CompoundContributionItem { + + /** + * Boolean to mark if we can use the file names as a connection checking + * method for determining orphaned locks + */ + private static boolean canCheckConnection = false; + + static { + try { + String val = System + .getProperty("com.sun.management.jmxremote.port"); + // If the port is set, then the Agent is already started and we + // would shutdown if we couldn't connect + if (val == null) { + // Get starting jmx remote port, default to 20000 + boolean connectionFailed = true; + int startPort = 20000; + int i = 0; + System.setProperty("com.sun.management.jmxremote.port", "" + + startPort); + do { + // Stop at 50 since at that point, may be underlying issue + // (firewall) blocking it and less likely there are 50 + // instances + try { + ++i; + Agent.startAgent(); + // jmx manager successfully started + connectionFailed = false; + canCheckConnection = true; + } catch (Exception e) { + System.setProperty("com.sun.management.jmxremote.port", + "" + (startPort + i)); + Agent.getManagementProperties() + .setProperty( + "com.sun.management.jmxremote.port", + System.getProperty("com.sun.management.jmxremote.port")); + + } + } while (connectionFailed && i < 50); + } else { + canCheckConnection = true; + } + } catch (Throwable t) { + t.printStackTrace(); + } + } + + private static final String jmxPort = System + .getProperty("com.sun.management.jmxremote.port"); + + private static final String NAME = ManagementFactory.getRuntimeMXBean() + .getName(); + + private static final String HOST = NAME.split("[@]")[1]; + + private static final String PID = NAME.split("[@]")[0]; + + // name is in form processid@host, ID = host:port if we can check + // connections or we will just use processid@host + private static final String ID = HOST + ":" + + (canCheckConnection ? jmxPort : PID); + + static { + System.out.println(ID); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.actions.CompoundContributionItem#getContributionItems() + */ + @Override + protected IContributionItem[] getContributionItems() { + return new IContributionItem[] { new ActionContributionItem(new Action( + HOST + ":" + PID) { + @Override + public boolean isEnabled() { + return false; + } + }) }; + } + +} diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizEditorSystemMenu.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/VizEditorSystemMenu.java similarity index 99% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizEditorSystemMenu.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/VizEditorSystemMenu.java index c5ff639969..b43d60ffd5 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizEditorSystemMenu.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/menu/VizEditorSystemMenu.java @@ -1,4 +1,4 @@ -package com.raytheon.viz.ui.personalities.awips; +package com.raytheon.uf.viz.personalities.cave.menu; import java.util.ArrayList; import java.util.List; @@ -43,6 +43,7 @@ import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.actions.ContributedEditorMenuAction; import com.raytheon.viz.ui.editor.AbstractEditor; +@SuppressWarnings("restriction") public class VizEditorSystemMenu implements ISystemMenu { private static final String EDITOR_MENU_EXTENSION_POINT = "com.raytheon.viz.ui.editorMenuAddition"; diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizPresentationFactory.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/presentation/VizPresentationFactory.java similarity index 97% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizPresentationFactory.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/presentation/VizPresentationFactory.java index 92d331b045..144d70aa75 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizPresentationFactory.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/presentation/VizPresentationFactory.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.viz.ui.personalities.awips; +package com.raytheon.uf.viz.personalities.cave.presentation; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.SWT; @@ -34,6 +34,8 @@ import org.eclipse.ui.presentations.IStackPresentationSite; import org.eclipse.ui.presentations.StackPresentation; import org.eclipse.ui.presentations.WorkbenchPresentationFactory; +import com.raytheon.uf.viz.personalities.cave.menu.VizEditorSystemMenu; + /** * Presentation Factory for the system * diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizTabFolder.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/presentation/VizTabFolder.java similarity index 97% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizTabFolder.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/presentation/VizTabFolder.java index 26c4b269e2..d3eef5f699 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizTabFolder.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/presentation/VizTabFolder.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.viz.ui.personalities.awips; +package com.raytheon.uf.viz.personalities.cave.presentation; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CloseNonRestorableDetachedViewsListener.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/CloseNonRestorableDetachedViewsListener.java similarity index 97% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CloseNonRestorableDetachedViewsListener.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/CloseNonRestorableDetachedViewsListener.java index 6c1e3eeee5..cfb9d564a3 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CloseNonRestorableDetachedViewsListener.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/CloseNonRestorableDetachedViewsListener.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.viz.ui.personalities.awips; +package com.raytheon.uf.viz.personalities.cave.workbench; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; @@ -50,6 +50,7 @@ import org.eclipse.ui.views.IViewRegistry; * @version 1.0 */ +@SuppressWarnings("restriction") public class CloseNonRestorableDetachedViewsListener implements Listener { /** @@ -59,7 +60,6 @@ public class CloseNonRestorableDetachedViewsListener implements Listener { } @Override - @SuppressWarnings("restriction") public void handleEvent(Event event) { IViewRegistry reg = PlatformUI.getWorkbench().getViewRegistry(); for (IWorkbenchWindow win : PlatformUI.getWorkbench() diff --git a/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/HiddenWorkbenchAdvisor.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/HiddenWorkbenchAdvisor.java new file mode 100644 index 0000000000..350c81144f --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/HiddenWorkbenchAdvisor.java @@ -0,0 +1,98 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.personalities.cave.workbench; + +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.viz.application.component.IStandaloneComponent; +import com.raytheon.uf.viz.core.VizApp; + +/** + * {@link WorkbenchAdvisor} to use which allows for the workbench to be started + * but not visible. This is usedby {@link IStandaloneComponent}s that need the + * workbench to start but do not utilize it + * + *
+ * 
+ * SOFTWARE HISTORY
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Nov 11, 2009            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class HiddenWorkbenchAdvisor extends WorkbenchAdvisor { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(HiddenWorkbenchAdvisor.class); + + private IStandaloneComponent component; + + private String componentName; + + public HiddenWorkbenchAdvisor(String componentName, + IStandaloneComponent component) { + this.component = component; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.application.WorkbenchAdvisor#getInitialWindowPerspectiveId + * () + */ + @Override + public String getInitialWindowPerspectiveId() { + return null; + } + + @Override + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor( + IWorkbenchWindowConfigurer configurer) { + return new HiddenWorkbenchWindowAdvisor(configurer); + } + + @Override + public boolean openWindows() { + boolean rval = super.openWindows(); + VizApp.runAsync(new Runnable() { + public void run() { + try { + component.startComponent(componentName); + PlatformUI.getWorkbench().close(); + } catch (Exception e) { + statusHandler.handle(Priority.CRITICAL, + "error running component", e); + } + } + }); + return rval; + } +} diff --git a/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/HiddenWorkbenchWindowAdvisor.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/HiddenWorkbenchWindowAdvisor.java new file mode 100644 index 0000000000..cefc2a29f2 --- /dev/null +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/HiddenWorkbenchWindowAdvisor.java @@ -0,0 +1,60 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.personalities.cave.workbench; + +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +import com.raytheon.uf.viz.application.component.IStandaloneComponent; + +/** + * Workbench window advisor to use which allows for the workbench to be started + * but not visible. This is used by {@link HiddenWorkbenchAdvisor} for + * {@link IStandaloneComponent}s that need the workbench to start but do not + * utilize it + * + *
+ * 
+ * SOFTWARE HISTORY
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Aug 9, 2010            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class HiddenWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { + + /** + * @param configurer + */ + public HiddenWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + super(configurer); + } + + @Override + public void postWindowOpen() { + getWindowConfigurer().getWindow().getShell().setVisible(false); + } + +} diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/OpenPerspectiveList.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/OpenPerspectiveList.java similarity index 98% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/OpenPerspectiveList.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/OpenPerspectiveList.java index 0f85ec48b1..bdb4f7ccaf 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/OpenPerspectiveList.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/OpenPerspectiveList.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.viz.ui.personalities.awips; +package com.raytheon.uf.viz.personalities.cave.workbench; import java.util.ArrayList; import java.util.HashMap; diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizWorkbenchAdvisor.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchAdvisor.java similarity index 66% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizWorkbenchAdvisor.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchAdvisor.java index 0135edd37c..77ec972082 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizWorkbenchAdvisor.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchAdvisor.java @@ -18,23 +18,14 @@ * further licensing information. **/ -package com.raytheon.viz.ui.personalities.awips; - -//import gov.noaa.nws.ost.awips.viz.CaveCommandExecutionListener; -//import gov.noaa.nws.ost.awips.viz.CaveJobChangeListener; +package com.raytheon.uf.viz.personalities.cave.workbench; import java.util.HashSet; import java.util.Set; -import org.eclipse.core.commands.IExecutionListener; import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.jobs.IJobChangeListener; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.PreferenceManager; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.ui.IPerspectiveDescriptor; import org.eclipse.ui.IPerspectiveRegistry; import org.eclipse.ui.PlatformUI; @@ -42,14 +33,12 @@ import org.eclipse.ui.application.IWorkbenchConfigurer; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.application.WorkbenchAdvisor; import org.eclipse.ui.application.WorkbenchWindowAdvisor; -import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.contexts.IContextService; import com.raytheon.uf.viz.application.ProgramArguments; -import com.raytheon.uf.viz.core.Activator; -import com.raytheon.uf.viz.core.preferences.PreferenceConstants; import com.raytheon.uf.viz.ui.menus.DiscoverMenuContributions; import com.raytheon.viz.ui.VizWorkbenchManager; +import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager; import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; /** @@ -60,8 +49,7 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 7/1/06 chammack Initial Creation. - * Mar 5, 2013 1753 njensen Added shutdown printout - * Mar 20, 2013 1638 mschenke Added overrideable method for dynamic menu creation + * Mar 5, 2013 1753 njensen Added shutdown printout * * * @@ -70,38 +58,12 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; */ public class VizWorkbenchAdvisor extends WorkbenchAdvisor { - protected boolean logPeformance = false; - - protected IExecutionListener performanceListener; - - protected IJobChangeListener jobChangeListener; - protected CloseNonRestorableDetachedViewsListener detachedViewsListener; - protected boolean singlePerspective; - private boolean createdMenus = false; public VizWorkbenchAdvisor() { - performanceListener = CaveCommandExecutionListener.getInstance(); - jobChangeListener = CaveJobChangeListener.getInstance(); detachedViewsListener = new CloseNonRestorableDetachedViewsListener(); - - Activator.getDefault().getPreferenceStore() - .addPropertyChangeListener(new IPropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent event) { - if (PreferenceConstants.P_LOG_PERF.equals(event - .getProperty())) { - Boolean log = (Boolean) event.getNewValue(); - if (log != logPeformance) { - toggleLogging(); - } - } - } - }); - singlePerspective = ProgramArguments.getInstance().getString( - "-perspective") != null; } /* @@ -176,7 +138,8 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor { } /** - * Removes perspectives from the rcp perspectives menu + * Removes perspectives from the rcp perspectives menu that are not managed + * by an {@link AbstractVizPerspectiveManager} */ @SuppressWarnings("restriction") private void removeExtraPerspectives() { @@ -187,10 +150,14 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor { for (IPerspectiveDescriptor perspective : reg.getPerspectives()) { if (managed.contains(perspective.getId()) == false) { org.eclipse.ui.internal.registry.PerspectiveDescriptor sync = (org.eclipse.ui.internal.registry.PerspectiveDescriptor) perspective; - IExtension ext = sync.getConfigElement() - .getDeclaringExtension(); - ((org.eclipse.ui.internal.registry.PerspectiveRegistry) reg) - .removeExtension(ext, new Object[] { perspective }); + if (sync.getConfigElement() != null) { + IExtension ext = sync.getConfigElement() + .getDeclaringExtension(); + ((org.eclipse.ui.internal.registry.PerspectiveRegistry) reg) + .removeExtension(ext, new Object[] { perspective }); + } else { + sync.deleteCustomDefinition(); + } } } } @@ -218,28 +185,48 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor { */ @Override public String getInitialWindowPerspectiveId() { - if (singlePerspective) { - String perspective = ProgramArguments.getInstance().getString( - "-perspective"); + String perspective = ProgramArguments.getInstance().getString( + "-perspective"); + IPerspectiveDescriptor desc = getSpecifiedPerspective(perspective); + if (desc != null) { + return desc.getId(); + } + IPerspectiveRegistry registry = PlatformUI.getWorkbench() + .getPerspectiveRegistry(); + perspective = registry.getDefaultPerspective(); + desc = getSpecifiedPerspective(perspective); + if (desc != null) { + return desc.getId(); + } + + // No default perspective specified in preference, look for managed + for (String pid : VizPerspectiveListener.getManagedPerspectives()) { + perspective = pid; + break; + } + return null; + } + + protected IPerspectiveDescriptor getSpecifiedPerspective(String perspective) { + IPerspectiveRegistry registry = PlatformUI.getWorkbench() + .getPerspectiveRegistry(); + + if (perspective != null) { // Check Id first - for (IPerspectiveDescriptor desc : PlatformUI.getWorkbench() - .getPerspectiveRegistry().getPerspectives()) { + for (IPerspectiveDescriptor desc : registry.getPerspectives()) { if (perspective.equals(desc.getId())) { - return perspective; + return desc; } } // Check label second - for (IPerspectiveDescriptor desc : PlatformUI.getWorkbench() - .getPerspectiveRegistry().getPerspectives()) { + for (IPerspectiveDescriptor desc : registry.getPerspectives()) { if (perspective.equalsIgnoreCase(desc.getLabel())) { - return desc.getId(); + return desc; } } } - - // Fall back to a reasonable default if not available - return "com.raytheon.uf.viz.d2d.ui.perspectives.D2D5Pane"; + return null; } /* @@ -256,7 +243,7 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor { createdMenus = true; createDynamicMenus(); } - return new VizWorkbenchWindowAdvisor(configurer, singlePerspective); + return new VizWorkbenchWindowAdvisor(configurer); } /* @@ -284,24 +271,13 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor { return bResult; } - /** - * Added by Wufeng Zhou to hook up command execution listener and job - * listener - * - */ @Override public void postStartup() { super.postStartup(); - Boolean log = Activator.getDefault().getPreferenceStore() - .getBoolean(PreferenceConstants.P_LOG_PERF); - - if (log != logPeformance) { - toggleLogging(); - } IContextService service = (IContextService) PlatformUI.getWorkbench() .getService(IContextService.class); - service.activateContext("com.raytheon.uf.viz.application.awips"); + service.activateContext("com.raytheon.uf.viz.application.cave"); } /** @@ -312,34 +288,4 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor { DiscoverMenuContributions.discoverContributions(); } - /** - * Toggle whether we are logging or not - */ - private void toggleLogging() { - logPeformance = !logPeformance; - - // add command execution listener - ICommandService service = (ICommandService) PlatformUI.getWorkbench() - .getService(ICommandService.class); - if (logPeformance) { - service.addExecutionListener(performanceListener); - } else { - service.removeExecutionListener(performanceListener); - } - - // add job change listener - IJobManager jobManager = Job.getJobManager(); - if (logPeformance) { - jobManager.addJobChangeListener(jobChangeListener); - } else { - jobManager.removeJobChangeListener(jobChangeListener); - } - } - - @Override - public void preStartup() { - // only restore state if no perspective passed in - getWorkbenchConfigurer().setSaveAndRestore(!singlePerspective); - } - } diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizWorkbenchWindowAdvisor.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchWindowAdvisor.java similarity index 89% rename from cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizWorkbenchWindowAdvisor.java rename to cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchWindowAdvisor.java index 379c265c96..87b6e0e01b 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/VizWorkbenchWindowAdvisor.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchWindowAdvisor.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.viz.ui.personalities.awips; +package com.raytheon.uf.viz.personalities.cave.workbench; import org.eclipse.core.runtime.IStatus; import org.eclipse.swt.graphics.Point; @@ -32,7 +32,6 @@ import org.eclipse.ui.application.IActionBarConfigurer; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.application.WorkbenchWindowAdvisor; -import com.raytheon.uf.viz.ui.menus.widgets.tearoff.TearOffMenuListener; import com.raytheon.viz.ui.dialogs.ModeListener; import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager; import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; @@ -47,7 +46,6 @@ import com.raytheon.viz.ui.statusline.VizActionBarAdvisor; * ------------ ---------- ----------- -------------------------- * 7/1/06 chammack Initial Creation. * Oct 21, 2008 #1450 randerso Fixed to support multipane editors - * Mar 20, 2013 1638 mschenke Removed call to DiscoverMenuContributions as now handled in VizWorkbenchAdvisor * * * @@ -56,8 +54,6 @@ import com.raytheon.viz.ui.statusline.VizActionBarAdvisor; */ public class VizWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { - private boolean singlePerspective; - private VizPerspectiveListener listener; private boolean firstTime = true; @@ -67,10 +63,8 @@ public class VizWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { * * @param configurer */ - public VizWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer, - boolean singlePerspective) { + public VizWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { super(configurer); - this.singlePerspective = singlePerspective; } /* @@ -85,7 +79,6 @@ public class VizWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { configurer.setShowProgressIndicator(true); configurer.setInitialSize(new Point(1024, 768)); // Don't show perspective bar if running a specific perspective? - configurer.setShowPerspectiveBar(!singlePerspective); configurer.setShowCoolBar(true); configurer.setShowStatusLine(true); @@ -135,9 +128,6 @@ public class VizWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { if (perspective != null) { listener.perspectiveActivated(page, perspective); } - - new TearOffMenuListener(VizActionBarAdvisor.getInstance(window) - .getMenuManager()); } /* diff --git a/cave/com.raytheon.uf.viz.product.alertviz/alertviz.product b/cave/com.raytheon.uf.viz.product.alertviz/alertviz.product index aeb66f6041..22fe0dfd63 100644 --- a/cave/com.raytheon.uf.viz.product.alertviz/alertviz.product +++ b/cave/com.raytheon.uf.viz.product.alertviz/alertviz.product @@ -20,7 +20,7 @@ Developed on the Raytheon Visualization Environment (viz) -data @user.home/caveData -user @user.home/caveData -clean -consoleLog - -Xincgc -Xmx256M -Xss2024k -Dosgi.instance.area.readOnly=true -Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler -Dorg.eclipse.update.reconcile=false -Dqpid.dest_syntax=BURL -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dlog4j.configuration=log4j-alertviz.xml + -Xincgc -Xms16M -Xmx256M -Xss2024k -Dosgi.instance.area.readOnly=true -Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler -Dorg.eclipse.update.reconcile=false -Dqpid.dest_syntax=BURL -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dlog4j.configuration=log4j-alertviz.xml diff --git a/cave/com.raytheon.uf.viz.thinclient.cave/src/com/raytheon/uf/viz/thinclient/cave/ThinClientWorkbenchAdvisor.java b/cave/com.raytheon.uf.viz.thinclient.cave/src/com/raytheon/uf/viz/thinclient/cave/ThinClientWorkbenchAdvisor.java index ae0add4bdd..bdf53dec80 100644 --- a/cave/com.raytheon.uf.viz.thinclient.cave/src/com/raytheon/uf/viz/thinclient/cave/ThinClientWorkbenchAdvisor.java +++ b/cave/com.raytheon.uf.viz.thinclient.cave/src/com/raytheon/uf/viz/thinclient/cave/ThinClientWorkbenchAdvisor.java @@ -29,7 +29,7 @@ import com.raytheon.uf.viz.thinclient.cave.preferences.ThinClientCachePreference import com.raytheon.uf.viz.thinclient.cave.preferences.ThinClientConnectionPreferences; import com.raytheon.uf.viz.thinclient.cave.preferences.ThinClientPreferencePage; import com.raytheon.uf.viz.thinclient.cave.preferences.ThinClientServerPreferences; -import com.raytheon.viz.ui.personalities.awips.VizWorkbenchAdvisor; +import com.raytheon.viz.ui.personalities.awips.AWIPSWorkbenchAdvisor; /** * Thin Client workbench advisor, adds the thin client preference page @@ -49,7 +49,7 @@ import com.raytheon.viz.ui.personalities.awips.VizWorkbenchAdvisor; * @version 1.0 */ -public class ThinClientWorkbenchAdvisor extends VizWorkbenchAdvisor { +public class ThinClientWorkbenchAdvisor extends AWIPSWorkbenchAdvisor { /* * (non-Javadoc) diff --git a/cave/com.raytheon.uf.viz.useradmin.feature/feature.xml b/cave/com.raytheon.uf.viz.useradmin.feature/feature.xml index d0370bc4ab..eda3578435 100644 --- a/cave/com.raytheon.uf.viz.useradmin.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.useradmin.feature/feature.xml @@ -18,7 +18,6 @@ - diff --git a/cave/com.raytheon.viz.avnfps.feature/feature.xml b/cave/com.raytheon.viz.avnfps.feature/feature.xml index e80430dce0..c62664aebc 100644 --- a/cave/com.raytheon.viz.avnfps.feature/feature.xml +++ b/cave/com.raytheon.viz.avnfps.feature/feature.xml @@ -26,7 +26,6 @@ - - - - @@ -175,21 +171,7 @@ version="0.0.0"/> - + - - - - diff --git a/cave/com.raytheon.viz.feature.awips/feature.xml b/cave/com.raytheon.viz.feature.awips/feature.xml index 2cfa1e53a7..21adf22e07 100644 --- a/cave/com.raytheon.viz.feature.awips/feature.xml +++ b/cave/com.raytheon.viz.feature.awips/feature.xml @@ -34,7 +34,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.gfe.feature/feature.xml b/cave/com.raytheon.viz.gfe.feature/feature.xml index 773f55e76b..aaa39de8bb 100644 --- a/cave/com.raytheon.viz.gfe.feature/feature.xml +++ b/cave/com.raytheon.viz.gfe.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/cave/com.raytheon.viz.grib.feature/feature.xml b/cave/com.raytheon.viz.grib.feature/feature.xml index a2d20aaebc..26e3d1ac94 100644 --- a/cave/com.raytheon.viz.grib.feature/feature.xml +++ b/cave/com.raytheon.viz.grib.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/cave/com.raytheon.viz.hydro.feature/feature.xml b/cave/com.raytheon.viz.hydro.feature/feature.xml index c016d90e58..9b7a71b961 100644 --- a/cave/com.raytheon.viz.hydro.feature/feature.xml +++ b/cave/com.raytheon.viz.hydro.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/cave/com.raytheon.viz.product.awips/developer.product b/cave/com.raytheon.viz.product.awips/developer.product index 5374b87bfb..5af9bf8c5d 100644 --- a/cave/com.raytheon.viz.product.awips/developer.product +++ b/cave/com.raytheon.viz.product.awips/developer.product @@ -42,16 +42,15 @@ - jdk1.6.0 - + diff --git a/cave/com.raytheon.viz.product.awips/plugin.xml b/cave/com.raytheon.viz.product.awips/plugin.xml index 3652b63b7e..82db54a5e1 100644 --- a/cave/com.raytheon.viz.product.awips/plugin.xml +++ b/cave/com.raytheon.viz.product.awips/plugin.xml @@ -56,33 +56,4 @@ - - - - - - - - - - - - - - - diff --git a/cave/com.raytheon.viz.radar.feature/feature.xml b/cave/com.raytheon.viz.radar.feature/feature.xml index c8e6b30b0d..ca2662192f 100644 --- a/cave/com.raytheon.viz.radar.feature/feature.xml +++ b/cave/com.raytheon.viz.radar.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/cave/com.raytheon.viz.satellite.feature/feature.xml b/cave/com.raytheon.viz.satellite.feature/feature.xml index 3baf8c0d14..5e0f7b4981 100644 --- a/cave/com.raytheon.viz.satellite.feature/feature.xml +++ b/cave/com.raytheon.viz.satellite.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/cave/com.raytheon.viz.text.feature/feature.xml b/cave/com.raytheon.viz.text.feature/feature.xml index ded083c729..a455507f1a 100644 --- a/cave/com.raytheon.viz.text.feature/feature.xml +++ b/cave/com.raytheon.viz.text.feature/feature.xml @@ -18,7 +18,6 @@ - diff --git a/cave/com.raytheon.viz.ui.personalities.awips/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.ui.personalities.awips/META-INF/MANIFEST.MF index df286feb86..f545b76526 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.ui.personalities.awips/META-INF/MANIFEST.MF @@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.menus;bundle-version="1.12.1174", com.raytheon.uf.viz.application;bundle-version="1.0.0", com.raytheon.viz.alerts;bundle-version="1.12.1174", - com.raytheon.uf.common.comm;bundle-version="1.12.1174" + com.raytheon.uf.common.comm;bundle-version="1.12.1174", + com.raytheon.uf.viz.personalities.cave;bundle-version="1.0.0";visibility:=reexport Bundle-ActivationPolicy: lazy Bundle-ClassPath: . Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/cave/com.raytheon.viz.ui.personalities.awips/plugin.xml b/cave/com.raytheon.viz.ui.personalities.awips/plugin.xml index 663383e8f3..d6de51394d 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/plugin.xml +++ b/cave/com.raytheon.viz.ui.personalities.awips/plugin.xml @@ -23,158 +23,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + locationURI="menu:file.new"> + - - - - - - - - - - - - - - - - - + + @@ -184,91 +40,8 @@ id="com.raytheon.viz.ui.personalities.awips" name="AWIPS" description="Command category for AWIPS"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -499,7 +61,17 @@ point="org.eclipse.ui.contexts"> + + + + diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchAdvisor.java b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchAdvisor.java index 54832355df..7657ccaf8c 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchAdvisor.java +++ b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchAdvisor.java @@ -19,12 +19,27 @@ **/ package com.raytheon.viz.ui.personalities.awips; +import org.eclipse.core.commands.IExecutionListener; +import org.eclipse.core.runtime.jobs.IJobChangeListener; +import org.eclipse.core.runtime.jobs.IJobManager; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.ui.IPerspectiveDescriptor; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.contexts.IContextService; + import com.raytheon.uf.common.menus.MenuCreationRequest; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.viz.application.ProgramArguments; +import com.raytheon.uf.viz.core.Activator; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.localization.LocalizationManager; +import com.raytheon.uf.viz.core.preferences.PreferenceConstants; import com.raytheon.uf.viz.core.requests.ThriftClient; +import com.raytheon.uf.viz.personalities.cave.workbench.VizWorkbenchAdvisor; /** * AWIPS {@link VizWorkbenchAdvisor} that reqeusts menu creation service to run @@ -46,6 +61,93 @@ import com.raytheon.uf.viz.core.requests.ThriftClient; public class AWIPSWorkbenchAdvisor extends VizWorkbenchAdvisor { + protected boolean logPeformance = false; + + protected IExecutionListener performanceListener; + + protected IJobChangeListener jobChangeListener; + + protected boolean singlePerspective; + + public AWIPSWorkbenchAdvisor() { + performanceListener = CaveCommandExecutionListener.getInstance(); + jobChangeListener = CaveJobChangeListener.getInstance(); + + Activator.getDefault().getPreferenceStore() + .addPropertyChangeListener(new IPropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent event) { + if (PreferenceConstants.P_LOG_PERF.equals(event + .getProperty())) { + Boolean log = (Boolean) event.getNewValue(); + if (log != logPeformance) { + toggleLogging(); + } + } + } + }); + + singlePerspective = ProgramArguments.getInstance().getString( + "-perspective") != null; + } + + @Override + public String getInitialWindowPerspectiveId() { + if (singlePerspective) { + IPerspectiveDescriptor desc = getSpecifiedPerspective(ProgramArguments + .getInstance().getString("-perspective")); + if (desc != null) { + return desc.getId(); + } + } + // Fall back to a reasonable default if not available + return "com.raytheon.uf.viz.d2d.ui.perspectives.D2D5Pane"; + } + + /** + * Toggle whether we are logging or not + */ + private void toggleLogging() { + logPeformance = !logPeformance; + + // add command execution listener + ICommandService service = (ICommandService) PlatformUI.getWorkbench() + .getService(ICommandService.class); + if (logPeformance) { + service.addExecutionListener(performanceListener); + } else { + service.removeExecutionListener(performanceListener); + } + + // add job change listener + IJobManager jobManager = Job.getJobManager(); + if (logPeformance) { + jobManager.addJobChangeListener(jobChangeListener); + } else { + jobManager.removeJobChangeListener(jobChangeListener); + } + } + + /** + * Added by Wufeng Zhou to hook up command execution listener and job + * listener + * + */ + @Override + public void postStartup() { + super.postStartup(); + + Boolean log = Activator.getDefault().getPreferenceStore() + .getBoolean(PreferenceConstants.P_LOG_PERF); + + if (log != logPeformance) { + toggleLogging(); + } + IContextService service = (IContextService) PlatformUI.getWorkbench() + .getService(IContextService.class); + service.activateContext("com.raytheon.uf.viz.application.awips"); + } + @Override protected void createDynamicMenus() { // create the request to send to EDEX to generate the menus @@ -60,4 +162,9 @@ public class AWIPSWorkbenchAdvisor extends VizWorkbenchAdvisor { super.createDynamicMenus(); } + @Override + public void preStartup() { + // only restore state if no perspective passed in + getWorkbenchConfigurer().setSaveAndRestore(!singlePerspective); + } } diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchWindowAdvisor.java b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchWindowAdvisor.java new file mode 100644 index 0000000000..5e3f4cd347 --- /dev/null +++ b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchWindowAdvisor.java @@ -0,0 +1,65 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.viz.ui.personalities.awips; + +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; + +import com.raytheon.uf.viz.personalities.cave.workbench.VizWorkbenchWindowAdvisor; + +/** + * AWIPS window advisor, doesn't show perspective bar when -perspective argument + * is used to launch the application + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 15, 2013            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class AWIPSWorkbenchWindowAdvisor extends VizWorkbenchWindowAdvisor { + + private boolean singlePerspective; + + /** + * @param configurer + * @param singlePerspective + */ + public AWIPSWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer, + boolean singlePerspective) { + super(configurer); + this.singlePerspective = singlePerspective; + } + + @Override + public void preWindowOpen() { + super.preWindowOpen(); + IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); + configurer.setShowPerspectiveBar(!singlePerspective); + } + +} diff --git a/cave/com.raytheon.viz.volumebrowser.feature/feature.xml b/cave/com.raytheon.viz.volumebrowser.feature/feature.xml index 9338cfa946..59af733309 100644 --- a/cave/com.raytheon.viz.volumebrowser.feature/feature.xml +++ b/cave/com.raytheon.viz.volumebrowser.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/cave/com.raytheon.viz.warngen.feature/feature.xml b/cave/com.raytheon.viz.warngen.feature/feature.xml index f62e6e9d73..8f9efa7233 100644 --- a/cave/com.raytheon.viz.warngen.feature/feature.xml +++ b/cave/com.raytheon.viz.warngen.feature/feature.xml @@ -20,7 +20,6 @@ - diff --git a/ncep/com.raytheon.uf.viz.ncep.core.feature/feature.xml b/ncep/com.raytheon.uf.viz.ncep.core.feature/feature.xml index 5ed79db3d9..32a52106fc 100644 --- a/ncep/com.raytheon.uf.viz.ncep.core.feature/feature.xml +++ b/ncep/com.raytheon.uf.viz.ncep.core.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/ncep/com.raytheon.uf.viz.ncep.nsharp.feature/feature.xml b/ncep/com.raytheon.uf.viz.ncep.nsharp.feature/feature.xml index 5d71e4bd2f..64254aa144 100644 --- a/ncep/com.raytheon.uf.viz.ncep.nsharp.feature/feature.xml +++ b/ncep/com.raytheon.uf.viz.ncep.nsharp.feature/feature.xml @@ -19,7 +19,6 @@ - diff --git a/ncep/com.raytheon.uf.viz.ncep.perspective.feature/feature.xml b/ncep/com.raytheon.uf.viz.ncep.perspective.feature/feature.xml index 18765f021c..4b208f4d11 100644 --- a/ncep/com.raytheon.uf.viz.ncep.perspective.feature/feature.xml +++ b/ncep/com.raytheon.uf.viz.ncep.perspective.feature/feature.xml @@ -19,7 +19,6 @@ -