From 08724fefd791fbf051289322700aaa1b26364174 Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Wed, 2 Jul 2014 09:52:48 -0500 Subject: [PATCH] Omaha #1255 added collaboration specific color presets Change-Id: I57bb20d0de10fdc256f6177489760e12c297662f Former-commit-id: eac871eed7fdd3964144b320595d98f3ea799325 [formerly 87ed36851c390058ab4c92977ecc552cab869d26] Former-commit-id: 8b5ad1ec33a7ab99fbdc39bc6140709b66b95612 --- .../config.xml | 54 ++++++++++++++++ .../viz/collaboration/display/Activator.java | 63 +++++++++++++++++++ .../display/data/SessionColorManager.java | 20 +++++- 3 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 cave/com.raytheon.uf.viz.collaboration.display/config.xml diff --git a/cave/com.raytheon.uf.viz.collaboration.display/config.xml b/cave/com.raytheon.uf.viz.collaboration.display/config.xml new file mode 100644 index 0000000000..70362011fc --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.display/config.xml @@ -0,0 +1,54 @@ + + + + DeepSkyBlue3 + DarkOrange3 + ForestGreen + firebrick3 + MediumPurple3 + DarkGoldenrod3 + HotPink3 + burlywood4 + CornflowerBlue + OrangeRed2 + DarkOliveGreen4 + BlueViolet + SkyBlue3 + orange3 + chartreuse4 + brown2 + gold4 + magenta3 + CadetBlue4 + green3 + coral3 + khaki4 + DarkOrchid3 + chocolate3 + DodgerBlue2 + OliveDrab4 + DarkRed + tan3 + DeepPink3 + SeaGreen + DarkViolet + DarkTurquoise + diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/Activator.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/Activator.java index 18bcb0917d..cc9087d084 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/Activator.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/Activator.java @@ -1,12 +1,51 @@ +/** + * 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.collaboration.display; +import org.eclipse.jface.preference.IPersistentPreferenceStore; +import org.eclipse.jface.preference.IPreferenceStore; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.viz.core.jobs.StatsJob; +import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore; +/** + * Activator for Collaboration Display bundle + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * 2012         ?           ?          Initial creation            
+ * Jul 02, 2014 1255       bclement    added prefs store
+ * 
+ * 
+ * + * @author bclement + * @version 1.0 + */ public class Activator implements BundleActivator { public static final IUFStatusHandler statusHandler = UFStatus @@ -14,6 +53,11 @@ public class Activator implements BundleActivator { private static BundleContext context; + // The shared instance + private static Activator plugin; + + private IPersistentPreferenceStore prefs; + private StatsJob statsJob = new StatsJob( "Collaboration Network Statistics", com.raytheon.uf.viz.collaboration.comm.Activator.getDefault() @@ -33,6 +77,7 @@ public class Activator implements BundleActivator { public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; statsJob.schedule(); + plugin = this; } /* @@ -46,4 +91,22 @@ public class Activator implements BundleActivator { statsJob.shutdown(); } + /** + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * @return the preference store + */ + public IPreferenceStore getPreferenceStore() { + if (prefs == null) { + prefs = new HierarchicalPreferenceStore(context + .getBundle().getSymbolicName()); + } + return prefs; + } + } diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/data/SessionColorManager.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/data/SessionColorManager.java index 034916164f..15bb50a7a8 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/data/SessionColorManager.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/data/SessionColorManager.java @@ -25,7 +25,9 @@ import java.util.Map; import org.eclipse.swt.graphics.RGB; import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; -import com.raytheon.viz.core.ColorUtil; +import com.raytheon.uf.viz.collaboration.display.Activator; +import com.raytheon.uf.viz.core.RGBColors; +import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore; /** * @@ -41,6 +43,7 @@ import com.raytheon.viz.core.ColorUtil; * Apr 03, 2012 mnash Initial creation * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant * Mar 06, 2014 2848 bclement synchronized color access + * Jul 02, 2014 1255 bclement collaboration specific RGB presets * * * @@ -50,9 +53,22 @@ import com.raytheon.viz.core.ColorUtil; public class SessionColorManager { + public static final String SESSION_COLOR_PREFERENCE_KEY = "collaborationParticipantColor"; + private final Map colors = new HashMap(); - private static final RGB[] rgbPresets = ColorUtil.getResourceColorPresets(); + private static final RGB[] rgbPresets; + + static { + HierarchicalPreferenceStore prefs = (HierarchicalPreferenceStore) Activator + .getDefault().getPreferenceStore(); + String[] names = prefs.getStringArray(SESSION_COLOR_PREFERENCE_KEY); + rgbPresets = new RGB[names.length]; + int i = 0; + for (String name : names) { + rgbPresets[i++] = RGBColors.getRGBColor(name); + } + } /** * Get a map of venue participants to their assigned colors used for