Merge "Issue #2631 - Set preference defaults in the Activator. Removed unused file." into development

Former-commit-id: f4b3acbac0 [formerly c1f4fbfbd4] [formerly 9a3f60a216] [formerly f4b3acbac0 [formerly c1f4fbfbd4] [formerly 9a3f60a216] [formerly dd00fd1445 [formerly 9a3f60a216 [formerly 4399b11d3958de1cf8cce2bc66085aa43efb6519]]]]
Former-commit-id: dd00fd1445
Former-commit-id: 7e1f0c83f0 [formerly 62596de046] [formerly c42919a9792330f82dd0366f0bf2df51b0bd4270 [formerly 7b1cf570f4]]
Former-commit-id: 754bf0fc435e75c3a8361d2486b24d67e7070105 [formerly d75023418b]
Former-commit-id: 34a56bc0ce
This commit is contained in:
Nate Jensen 2014-02-20 17:55:35 -06:00 committed by Gerrit Code Review
commit 8dabb82010
3 changed files with 22 additions and 83 deletions

View file

@ -147,10 +147,6 @@
icon="icons/remove_editor.gif">
</editorMenuAddition>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer class="com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefInitializer"/>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page

View file

@ -22,12 +22,14 @@ package com.raytheon.uf.viz.collaboration.ui;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jivesoftware.smack.packet.Presence.Mode;
import org.osgi.framework.BundleContext;
import com.raytheon.uf.common.localization.exception.LocalizationException;
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.collaboration.ui.prefs.CollabPrefConstants;
import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
/**
@ -41,6 +43,7 @@ import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation
* Feb 19, 2014 2631 mpduff Changed to use the HierarchicalPreferenceStore.
* Feb 20, 2014 2631 mpduff Need to set defaults here since we changed to use the HierarchicalPreferenceStore
*
* </pre>
*
@ -109,7 +112,26 @@ public class Activator extends AbstractUIPlugin {
try {
if (prefs == null) {
prefs = new HierarchicalPreferenceStore(this);
prefs.setDefault(CollabPrefConstants.P_SERVER, "");
prefs.setDefault(CollabPrefConstants.AUTO_JOIN, true);
// TODO better default?
prefs.setDefault(CollabPrefConstants.P_USERNAME,
System.getProperty("user.name"));
prefs.setDefault(CollabPrefConstants.P_STATUS,
Mode.available.toString());
prefs.setDefault(CollabPrefConstants.P_MESSAGE, "");
prefs.setDefault(CollabPrefConstants.AWAY_ON_IDLE, true);
prefs.setDefault(CollabPrefConstants.AWAY_TIMEOUT,
CollabPrefConstants.AWAY_TIMEOUT_DEFAULT);
prefs.setDefault(CollabPrefConstants.AUTO_ACCEPT_SUBSCRIBE,
false);
prefs.setDefault(CollabPrefConstants.DEFAULT_HANDLE,
CollabPrefConstants.HandleOption.USERNAME.name());
prefs.setDefault(CollabPrefConstants.CUSTOM_HANDLE, "");
}
} catch (LocalizationException e) {
UFStatus.getHandler().handle(
Priority.PROBLEM,

View file

@ -1,79 +0,0 @@
/**
* 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.ui.prefs;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.jivesoftware.smack.packet.Presence.Mode;
import com.raytheon.uf.viz.collaboration.ui.Activator;
/**
* Initialization for collaboration preference store properties
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 24, 2012 njensen Initial creation
* Jan 14, 2014 2630 bclement added away on idle defaults
* Jan 27, 2014 2700 bclement added auto accept subscribe
* Feb 3, 2014 2699 bclement added handle preferences
* Feb 11, 2014 2699 bclement handle defaults to userid
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class CollabPrefInitializer extends AbstractPreferenceInitializer {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
* initializeDefaultPreferences()
*/
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setDefault(CollabPrefConstants.P_SERVER, "");
store.setDefault(CollabPrefConstants.AUTO_JOIN, true);
// TODO better default?
store.setDefault(CollabPrefConstants.P_USERNAME,
System.getProperty("user.name"));
store.setDefault(CollabPrefConstants.P_STATUS,
Mode.available.toString());
store.setDefault(CollabPrefConstants.P_MESSAGE, "");
store.setDefault(CollabPrefConstants.AWAY_ON_IDLE, true);
store.setDefault(CollabPrefConstants.AWAY_TIMEOUT,
CollabPrefConstants.AWAY_TIMEOUT_DEFAULT);
store.setDefault(CollabPrefConstants.AUTO_ACCEPT_SUBSCRIBE, false);
store.setDefault(CollabPrefConstants.DEFAULT_HANDLE,
CollabPrefConstants.HandleOption.USERNAME.name());
store.setDefault(CollabPrefConstants.CUSTOM_HANDLE, "");
}
}