Author: rob.stryker(a)jboss.com
Date: 2012-05-04 05:03:28 -0400 (Fri, 04 May 2012)
New Revision: 40784
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBInitialSelectionProvider.java
Log:
JBIDE-11205
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBInitialSelectionProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBInitialSelectionProvider.java 2012-05-04
07:57:03 UTC (rev 40783)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBInitialSelectionProvider.java 2012-05-04
09:03:28 UTC (rev 40784)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.wst.server.core.IServer;
@@ -30,7 +31,9 @@
*
*/
public class JBInitialSelectionProvider extends InitialSelectionProvider implements
IServerLifecycleListener {
-
+ private static String LAST_SERVER_CREATED_KEY =
"org.jboss.ide.eclipse.as.ui.wizards.LAST_SERVER_CREATED"; //$NON-NLS-1$
+ private static String DEFAULT_INITIAL_SERVER_TYPE = "DEFAULT_SERVER_TYPE";
//$NON-NLS-1$
+
public JBInitialSelectionProvider() {
}
@@ -39,8 +42,10 @@
types.addAll(Arrays.asList(serverTypes));
// Find the last-selected one
+ IEclipsePreferences defaults =
DefaultScope.INSTANCE.getNode(JBossServerUIPlugin.PLUGIN_ID);
IEclipsePreferences prefs =
InstanceScope.INSTANCE.getNode(JBossServerUIPlugin.PLUGIN_ID);
- String last = prefs.get(LAST_SERVER_CREATED_KEY, null);
+ String last = prefs.get(LAST_SERVER_CREATED_KEY,
defaults.get(DEFAULT_INITIAL_SERVER_TYPE, null));
+
IServer lastServer = last == null ? null : ServerCore.findServer(last);
IServerType lastType = lastServer == null ? null : lastServer.getServerType();
if( lastType != null && types.contains(lastType))
@@ -60,8 +65,6 @@
return ServerCore.findServerType(newestJBoss);
}
- private static String LAST_SERVER_CREATED_KEY =
"org.jboss.ide.eclipse.as.ui.wizards.LAST_SERVER_CREATED"; //$NON-NLS-1$
-
public void serverAdded(IServer server) {
if( server != null ) {
IEclipsePreferences prefs =
InstanceScope.INSTANCE.getNode(JBossServerUIPlugin.PLUGIN_ID);
Show replies by date