### Eclipse Workspace Patch 1.0 #P org.jboss.tools.runtime Index: META-INF/MANIFEST.MF =================================================================== --- META-INF/MANIFEST.MF (revision 32361) +++ META-INF/MANIFEST.MF (working copy) @@ -9,7 +9,8 @@ org.eclipse.core.resources;bundle-version="3.7.0", org.eclipse.ui;bundle-version="3.7.0", org.jboss.tools.runtime.core, - org.eclipse.ui.navigator;bundle-version="3.5.100" + org.eclipse.ui.navigator;bundle-version="3.5.100", + org.jboss.tools.runtime.ui Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin Index: src/org/jboss/tools/runtime/JBossRuntimeStartup.java =================================================================== --- src/org/jboss/tools/runtime/JBossRuntimeStartup.java (revision 32361) +++ src/org/jboss/tools/runtime/JBossRuntimeStartup.java (working copy) @@ -41,13 +41,15 @@ import org.jboss.tools.runtime.core.JBossRuntimeLocator; import org.jboss.tools.runtime.core.RuntimeCoreActivator; import org.jboss.tools.runtime.core.model.IRuntimeDetector; +import org.jboss.tools.runtime.core.model.RuntimePath; import org.jboss.tools.runtime.core.model.ServerDefinition; +import org.jboss.tools.runtime.ui.RuntimeUIActivator; import org.osgi.framework.Bundle; import org.osgi.service.prefs.BackingStoreException; public class JBossRuntimeStartup implements IStartup { - private static final String JBOSS_EAP_HOME = "../../../../jboss-eap"; // JBoss EAP home directory (relative to plugin)- /jbossas. //$NON-NLS-1$ + private static final String JBOSS_EAP_HOME = "../../jboss-eap"; // JBoss EAP home directory (relative to plugin)- /jbossas. //$NON-NLS-1$ private static final String SERVERS_FILE_NAME = "application_platforms.properties"; //$NON-NLS-1$ private static final String SERVERS_FILE = "../../../../studio/" + SERVERS_FILE_NAME; //$NON-NLS-1$ private static final String SERVERS_FILE_CONFIGURATION = "../../studio/" + SERVERS_FILE_NAME; //$NON-NLS-1$ @@ -66,8 +68,8 @@ private void initializeIncludedRuntimes() { try { - String pluginLocation = FileLocator.resolve(Activator.getDefault().getBundle().getEntry("/")).getPath(); //$NON-NLS-1$ - File directory = new File(pluginLocation, JBOSS_EAP_HOME); + String configuration = getConfiguration(); + File directory = new File(configuration, JBOSS_EAP_HOME); if (directory.isDirectory()) { IPath path = new Path(directory.getAbsolutePath()); JBossRuntimeLocator locator = new JBossRuntimeLocator(); @@ -119,6 +121,15 @@ Activator.log(e); } } + Set runtimePaths = RuntimeUIActivator.getDefault().getRuntimePaths(); + for (ServerDefinition serverDefinition:serverDefinitions) { + File location = serverDefinition.getLocation(); + RuntimePath runtimePath = new RuntimePath(location.getAbsolutePath()); + runtimePaths.add(runtimePath); + } + if (runtimePaths.size() > 0) { + RuntimeUIActivator.getDefault().saveRuntimePaths(); + } } /** @@ -189,9 +200,7 @@ File serversFile = new File(pluginLocation, SERVERS_FILE); if (!serversFile.isFile()) { - Location configLocation = Platform.getConfigurationLocation(); - URL configURL = configLocation.getURL(); - String configuration = FileLocator.resolve(configURL).getPath(); + String configuration = getConfiguration(); serversFile = new File(configuration, SERVERS_FILE_CONFIGURATION).getCanonicalFile(); } else { serversFile = serversFile.getCanonicalFile(); @@ -236,5 +245,12 @@ } catch (IOException e) { Activator.log(e); } + } + + private String getConfiguration() throws IOException { + Location configLocation = Platform.getConfigurationLocation(); + URL configURL = configLocation.getURL(); + String configuration = FileLocator.resolve(configURL).getPath(); + return configuration; } } \ No newline at end of file