Author: rob.stryker(a)jboss.com
Date: 2012-03-15 10:41:01 -0400 (Thu, 15 Mar 2012)
New Revision: 39536
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
Log:
JBIDE-11330 - as7.1 needs higher exec environment (missed commit) and JBIDE-11331 -
storing as7 last-used runtime location
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java 2012-03-15
14:24:59 UTC (rev 39535)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java 2012-03-15
14:41:01 UTC (rev 39536)
@@ -18,6 +18,7 @@
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.model.RuntimeDelegate;
import org.jboss.ide.eclipse.as.core.Messages;
@@ -112,7 +113,7 @@
return getExecutionEnvironment().getDefaultVM();
}
- public static IVMInstall[] getValidJREs(IRuntimeType type) {
+ public IVMInstall[] getValidJREs(IRuntimeType type) {
return getDefaultExecutionEnvironment(type) == null ? new IVMInstall[0]
: getDefaultExecutionEnvironment(type).getCompatibleVMs();
}
@@ -123,7 +124,7 @@
EnvironmentsManager.getDefault().getEnvironment(id);
}
- public static IExecutionEnvironment getDefaultExecutionEnvironment(IRuntimeType rtType)
{
+ public IExecutionEnvironment getDefaultExecutionEnvironment(IRuntimeType rtType) {
// NEW_SERVER_ADAPTER Subclasses override this
String typeId = rtType.getId();
if( typeId.equals(IConstants.EAP_50)
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java 2012-03-15
14:24:59 UTC (rev 39535)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java 2012-03-15
14:41:01 UTC (rev 39536)
@@ -93,7 +93,7 @@
return ""; //$NON-NLS-1$
}
- public static IExecutionEnvironment getDefaultExecutionEnvironment(IRuntimeType rtType)
{
+ public IExecutionEnvironment getDefaultExecutionEnvironment(IRuntimeType rtType) {
return EnvironmentsManager.getDefault().getEnvironment("JavaSE-1.6");
//$NON-NLS-1$
- }
+ }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java 2012-03-15
14:24:59 UTC (rev 39535)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java 2012-03-15
14:41:01 UTC (rev 39536)
@@ -254,6 +254,7 @@
exit();
IRuntime rt = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
((IRuntimeWorkingCopy) rt).setLocation(new Path(homeDir));
+ saveRuntimeLocationInPreferences(rt);
}
@Override
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2012-03-15
14:24:59 UTC (rev 39535)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2012-03-15
14:41:01 UTC (rev 39536)
@@ -20,7 +20,8 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -70,6 +71,7 @@
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.bean.JBossServerType;
import org.jboss.ide.eclipse.as.core.server.bean.ServerBeanLoader;
+import org.jboss.ide.eclipse.as.core.server.internal.AbstractLocalJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.ide.eclipse.as.core.util.IConstants;
@@ -80,6 +82,7 @@
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
import org.jboss.ide.eclipse.as.ui.UIUtil;
+import org.osgi.service.prefs.BackingStoreException;
/**
* @author Stryker
@@ -179,9 +182,9 @@
protected void fillHomeDir(IRuntime rt) {
if( rt.getLocation() == null ) {
// new runtime creation
- Preferences prefs = JBossServerUIPlugin.getDefault().getPluginPreferences();
- String value = prefs.getString(IPreferenceKeys.RUNTIME_HOME_PREF_KEY_PREFIX +
rt.getRuntimeType().getId());
-
+ IEclipsePreferences prefs2 =
InstanceScope.INSTANCE.getNode(JBossServerUIPlugin.PLUGIN_ID);
+ String value = prefs2.get(IPreferenceKeys.RUNTIME_HOME_PREF_KEY_PREFIX +
rt.getRuntimeType().getId(), null);
+
String locationDefault = Platform.getOS().equals(Platform.WS_WIN32)
? "c:/program files/jboss-" : "/usr/bin/jboss-"; //$NON-NLS-1$
//$NON-NLS-2$
if( isEAP() )
@@ -762,7 +765,9 @@
protected List<IVMInstall> getValidJREs() {
- return Arrays.asList(LocalJBossServerRuntime.getValidJREs(getRuntimeType()));
+ IRuntime r = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ AbstractLocalJBossServerRuntime jbsrt =
(AbstractLocalJBossServerRuntime)r.loadAdapter(AbstractLocalJBossServerRuntime.class,
null);
+ return Arrays.asList(jbsrt.getValidJREs(getRuntimeType()));
}
// WST API methods
@@ -792,11 +797,20 @@
if( rt instanceof IRuntimeWorkingCopy ) {
IRuntimeWorkingCopy r = (IRuntimeWorkingCopy) rt;
IRuntime saved = r.save(false, new NullProgressMonitor());
- Preferences prefs = JBossServerUIPlugin.getDefault().getPluginPreferences();
- prefs.setValue(IPreferenceKeys.RUNTIME_HOME_PREF_KEY_PREFIX +
saved.getRuntimeType().getId(), homeDir);
getTaskModel().putObject(TaskModel.TASK_RUNTIME, saved);
+ saveRuntimeLocationInPreferences(saved);
}
}
+
+ protected void saveRuntimeLocationInPreferences(IRuntime runtime) {
+ IEclipsePreferences prefs =
InstanceScope.INSTANCE.getNode(JBossServerUIPlugin.PLUGIN_ID);
+ prefs.put(IPreferenceKeys.RUNTIME_HOME_PREF_KEY_PREFIX +
runtime.getRuntimeType().getId(), homeDir);
+ try {
+ prefs.flush();
+ } catch(BackingStoreException e) {
+ // TODO when adding tracing. This is not important enough for an error log entry
+ }
+ }
public boolean isComplete() {
return beenEntered && (getErrorString() == null ? true : false);