]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Release Eclipse plugin v0.13.0.D20100708_1940
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 8 Jul 2010 17:42:54 +0000 (17:42 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 8 Jul 2010 17:42:54 +0000 (17:42 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3655 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

13 files changed:
eclipse/features/org.argeo.slc.ide/category.xml
eclipse/features/org.argeo.slc.ide/feature.xml
eclipse/plugins/org.argeo.slc.ide.branding/META-INF/MANIFEST.MF
eclipse/plugins/org.argeo.slc.ide.ui/META-INF/MANIFEST.MF
eclipse/plugins/org.argeo.slc.ide.ui/plugin.xml
eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/AbstractOsgiLaunchShortcut.java [deleted file]
eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootEquinoxLaunchConfiguration.java
eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootLaunchShortcut.java
eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootLauncherTabGroup.java
eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootMainTab.java
eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiLaunchHelper.java
eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiLauncherConstants.java
eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/SlcLaunchShortcut.java [deleted file]

index 0ee8ee4c2dfbc34e4e501d623a41d7e1c29ff77f..1fa1693e69ad27c6eb52627268b168d8cae7db6c 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <site>
-   <feature url="features/org.argeo.slc.ide_0.12.1.D20100506_0949.jar" id="org.argeo.slc.ide" version="0.12.1.D20100506_0949">
+   <feature url="features/org.argeo.slc.ide_0.13.0.D20100708_1940.jar" id="org.argeo.slc.ide" version="0.13.0.D20100708_1940">
       <category name="slcIDE"/>
    </feature>
    <category-def name="slcIDE" label="SLC IDE">
index 22ad27d769639a003318fe6fcbf2d9cc105361d7..a9b490be741d68b98b82e3354dc2bd0929bcaa4c 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="org.argeo.slc.ide"
       label="Argeo Java IDE"
-      version="0.12.1.D20100506_0949"
+      version="0.13.0.D20100708_1940"
       provider-name="Argeo"
       plugin="org.argeo.slc.ide.branding"
       image="icons/argeo-icon-100104-256.png">
@@ -64,14 +64,14 @@ and limitations under the License.
          id="org.argeo.slc.ide.ui"
          download-size="0"
          install-size="0"
-         version="0.12.1.D20100506_0949"
+         version="0.13.0.D20100708_1940"
          unpack="false"/>
 
    <plugin
          id="org.argeo.slc.ide.branding"
          download-size="0"
          install-size="0"
-         version="0.12.1.D20100506_0949"
+         version="0.13.0.D20100708_1940"
          unpack="false"/>
 
 </feature>
index 2bd726dd1af5ec9f38896da6c4a646d62f8d68fb..c3aa024bddf1ee2875a02b6edd478016301ffe2e 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Argeo IDE
 Bundle-SymbolicName: org.argeo.slc.ide.branding;singleton:=true
-Bundle-Version: 0.12.1.D20100506_0949
+Bundle-Version: 0.13.0.D20100708_1940
 Bundle-Vendor: Argeo.org
 Require-Bundle: org.eclipse.ui;bundle-version="3.5.1",
  org.eclipse.osgi;bundle-version="3.5.1",
index b8eb16f5c7edba0f5a2292d7d239efa310cd0a62..df8eb2208709e49eecb873613f31a90feaaf749d 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: SLC IDE UI
 Bundle-SymbolicName: org.argeo.slc.ide.ui;singleton:=true
-Bundle-Version: 0.12.1.D20100506_0949
+Bundle-Version: 0.13.0.D20100708_1940
 Bundle-Activator: org.argeo.slc.ide.ui.SlcIdeUiPlugin
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
index 74517a6bfad51796ad84583a65c177cb07437dc7..ca6221abbba1744ddf37b5c4b73f942f00c1d179 100644 (file)
 -->\r
 <extension\r
       point="org.eclipse.debug.ui.launchShortcuts">\r
-   <shortcut\r
-         class="org.argeo.slc.ide.ui.launch.osgi.SlcLaunchShortcut"\r
-         icon="icons/slc-launch.gif"\r
-         id="org.argeo.slc.ide.ui.slcOsgiLaunchShortcut"\r
-         label="SLC"\r
-         modes="run,debug">\r
-    \r
-         <contextualLaunch>\r
-            <enablement>\r
-               <with variable="selection">\r
-                         <iterate>\r
-                               <and>\r
-                                       <test property="org.eclipse.debug.ui.projectNature" value="org.eclipse.pde.PluginNature"/>\r
-                                       <or>\r
-                                       <adapt type="org.eclipse.core.resources.IProject"/>\r
-                                       <test property="org.eclipse.debug.ui.matchesPattern" value="MANIFEST.MF"/>\r
-                                       </or>\r
-                                </and>\r
-                             </iterate>\r
-               </with>\r
-           </enablement>\r
-         </contextualLaunch>         \r
-   </shortcut>\r
    <shortcut\r
          class="org.argeo.slc.ide.ui.launch.osgi.OsgiBootLaunchShortcut"\r
          icon="icons/slc-launch.gif"\r
diff --git a/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/AbstractOsgiLaunchShortcut.java b/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/AbstractOsgiLaunchShortcut.java
deleted file mode 100644 (file)
index 08c06e0..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.argeo.slc.ide.ui.launch.osgi;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.IVMInstall2;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.pde.ui.launcher.OSGiLaunchShortcut;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-public abstract class AbstractOsgiLaunchShortcut extends OSGiLaunchShortcut {
-       protected StringBuffer name = null;
-
-       protected List<String> bundlesToStart = new ArrayList<String>();
-       protected Map<String, String> systemPropertiesToAppend = new HashMap<String, String>();
-
-       @Override
-       public void launch(ISelection selection, String mode) {
-               super.launch(selection, mode);
-               name = null;
-               bundlesToStart.clear();
-               systemPropertiesToAppend.clear();
-       }
-
-       protected void initializeConfiguration(
-                       ILaunchConfigurationWorkingCopy configuration) {
-               try {
-                       super.initializeConfiguration(configuration);
-
-                       configuration
-                                       .setAttribute(
-                                                       OsgiLauncherConstants.ATTR_DEFAULT_VM_ARGS,
-                                                       configuration
-                                                                       .getAttribute(
-                                                                                       IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
-                                                                                       ""));
-//                     String defaultProgArgs = configuration.getAttribute(
-//                                     IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
-//                                     "");
-//                     configuration.setAttribute(
-//                                     OsgiLauncherConstants.ATTR_DEFAULT_PROGRAM_ARGS,
-//                                     defaultProgArgs);
-
-                       configuration.setAttribute(
-                                       IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
-                                       findWorkingDirectory());
-                       OsgiLaunchHelper.updateLaunchConfiguration(configuration,
-                                       bundlesToStart, systemPropertiesToAppend, null);
-               } catch (CoreException e) {
-                       Shell shell = Display.getCurrent().getActiveShell();
-                       ErrorDialog.openError(shell, "Error",
-                                       "Cannot execute initalize configuration", e.getStatus());
-               }
-
-       }
-
-       protected String findWorkingDirectory() {
-               // Choose working directory
-               Shell shell = Display.getCurrent().getActiveShell();
-               DirectoryDialog dirDialog = new DirectoryDialog(shell);
-               dirDialog.setText("Working Directory");
-               dirDialog.setMessage("Choose the working directory");
-               return dirDialog.open();
-       }
-
-       protected void printVm(String prefix, IVMInstall vmInstall) {
-               System.out.println(prefix + " vmInstall: id=" + vmInstall.getId()
-                               + ", name=" + vmInstall.getName() + ", installLocation="
-                               + vmInstall.getInstallLocation() + ", toString=" + vmInstall);
-               if (vmInstall instanceof IVMInstall2) {
-                       IVMInstall2 vmInstall2 = (IVMInstall2) vmInstall;
-                       System.out.println("  vmInstall: javaVersion="
-                                       + vmInstall2.getJavaVersion());
-               }
-       }
-
-       protected String getName(ILaunchConfigurationType type) {
-               if (name != null && !name.toString().trim().equals(""))
-                       return name.toString();
-               else
-                       return "SLC";
-       }
-
-       @Override
-       protected boolean isGoodMatch(ILaunchConfiguration configuration) {
-               if (name != null) {
-                       return name.toString().equals(configuration.getName());
-               }
-               return super.isGoodMatch(configuration);
-       }
-
-}
index 853775ac6fdc2e05dbf3fa321688a80c38d3998b..6d1ebaf8b98281d310546ae889ac44e0d55d58cf 100644 (file)
@@ -10,6 +10,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.pde.ui.launcher.EquinoxLaunchConfiguration;
 
+/** OSGiBoot launch configuration. */
 public class OsgiBootEquinoxLaunchConfiguration extends
                EquinoxLaunchConfiguration {
        public final static String ID = SlcIdeUiPlugin.ID
index 097adc836067f34a3b86e1cf8517a259e9410dbd..b1994e8144388a680deb8cabe4130a80cdb56204 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.pde.ui.launcher.OSGiLaunchShortcut;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 
+/** OSGiBoot launch shortcut. */
 public class OsgiBootLaunchShortcut extends OSGiLaunchShortcut implements
                OsgiLauncherConstants {
        private StringBuffer name = null;
index 48d9268f03f302db801da6c463052bf3f646d5f0..de3b20cafbc9a574cd6af4d59466cffb4183c558 100644 (file)
@@ -11,28 +11,29 @@ import org.eclipse.pde.ui.launcher.OSGiLauncherTabGroup;
 import org.eclipse.pde.ui.launcher.OSGiSettingsTab;
 import org.eclipse.pde.ui.launcher.TracingTab;
 
+/** Definition of the set of tabs used in OSGiBoot launch configuration UI. */
 public class OsgiBootLauncherTabGroup extends OSGiLauncherTabGroup {
 
        @Override
        public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
-//             JavaArgumentsTab javaArgumentsTab = new JavaArgumentsTab() {
-//                     private boolean initializing = false;
-//
-//                     @Override
-//                     public void performApply(
-//                                     ILaunchConfigurationWorkingCopy configuration) {
-//                             if (initializing)
-//                                     return;
-//                             initializing = true;
-//                             initializeFrom(configuration);
-//                             initializing = false;
-//                     }
-//
-//                     @Override
-//                     public boolean isValid(ILaunchConfiguration config) {
-//                             return true;
-//                     }
-//             };
+               // JavaArgumentsTab javaArgumentsTab = new JavaArgumentsTab() {
+               // private boolean initializing = false;
+               //
+               // @Override
+               // public void performApply(
+               // ILaunchConfigurationWorkingCopy configuration) {
+               // if (initializing)
+               // return;
+               // initializing = true;
+               // initializeFrom(configuration);
+               // initializing = false;
+               // }
+               //
+               // @Override
+               // public boolean isValid(ILaunchConfiguration config) {
+               // return true;
+               // }
+               // };
 
                ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
                                new OsgiBootMainTab(),
index c52c767cc3c23b1258f1744f30f51886aaceb36a..cbe41cdc9d3a1f5ecd4fca93095b5e21b448305e 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
+/** Main tab of OSGiBoot launch configuration UI. */
 public class OsgiBootMainTab extends AbstractLaunchConfigurationTab implements
                OsgiLauncherConstants {
        private Listener listener = new Listener();
@@ -55,7 +56,7 @@ public class OsgiBootMainTab extends AbstractLaunchConfigurationTab implements
                syncBundles = new Button(container, SWT.CHECK);
                syncBundles.addSelectionListener(listener);
                new Label(container, SWT.NONE)
-                               .setText("Always keep bundle in line with the target platform");
+                               .setText("Keep bundles in line with target platform and workspace (recommended)");
                clearDataDirectory = new Button(container, SWT.CHECK);
                clearDataDirectory.addSelectionListener(listener);
                new Label(container, SWT.NONE)
index 3646a7b6d03b82758e1b0be8d7756906e371497a..340f4b211bef036f2c26f6ef3b26fe52d6a4563d 100644 (file)
@@ -5,6 +5,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -12,7 +13,9 @@ import java.util.StringTokenizer;
 
 import org.argeo.slc.ide.ui.SlcIdeUiPlugin;
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
@@ -26,6 +29,9 @@ import org.eclipse.jdt.launching.IVMInstall2;
 import org.eclipse.jdt.launching.IVMInstallType;
 import org.eclipse.jdt.launching.JavaRuntime;
 import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.service.resolver.BundleDescription;
 import org.eclipse.pde.core.plugin.IPluginModelBase;
 import org.eclipse.pde.core.plugin.PluginRegistry;
 import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
@@ -34,27 +40,28 @@ import org.eclipse.swt.widgets.Display;
 public class OsgiLaunchHelper implements OsgiLauncherConstants {
        private static Boolean debug = false;
 
-       /** Expect properties file to be set as mapped resources */
+       /** Expects properties file to be set as mapped resources */
        public static void updateLaunchConfiguration(
                        ILaunchConfigurationWorkingCopy configuration) {
                try {
+                       // Finds the properties file and load it
                        IFile propertiesFile = (IFile) configuration.getMappedResources()[0];
                        propertiesFile.refreshLocal(IResource.DEPTH_ONE, null);
+                       Properties properties = readProperties(propertiesFile);
 
-                       Properties properties = OsgiLaunchHelper
-                                       .readProperties(propertiesFile);
-
+                       // Extract information from the properties file
                        List<String> bundlesToStart = new ArrayList<String>();
                        Map<String, String> systemPropertiesToAppend = new HashMap<String, String>();
-                       OsgiLaunchHelper.interpretProperties(properties, bundlesToStart,
+                       interpretProperties(properties, bundlesToStart,
                                        systemPropertiesToAppend);
 
+                       // Define directories
                        File workingDir = getWorkingDirectory(configuration);
                        File dataDir = new File(workingDir, "data");
 
-                       OsgiLaunchHelper.updateLaunchConfiguration(configuration,
-                                       bundlesToStart, systemPropertiesToAppend, dataDir
-                                                       .getAbsolutePath());
+                       // Update the launch configuration accordingly
+                       updateLaunchConfiguration(configuration, bundlesToStart,
+                                       systemPropertiesToAppend, dataDir.getAbsolutePath());
                } catch (Exception e) {
                        ErrorDialog.openError(Display.getCurrent().getActiveShell(),
                                        "Error", "Cannot read properties",
@@ -64,28 +71,41 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                }
        }
 
-       static void updateLaunchConfiguration(
+       /**
+        * Actually modifies the launch configuration in order to reflect the
+        * current state read from the properties file and the launch configuration
+        * UI.
+        */
+       protected static void updateLaunchConfiguration(
                        ILaunchConfigurationWorkingCopy configuration,
                        List<String> bundlesToStart,
                        Map<String, String> systemPropertiesToAppend, String dataDir)
                        throws CoreException {
                // Convert bundle lists
                final String targetBundles;
+               final String wkSpaceBundles;
                if (configuration.getAttribute(ATTR_SYNC_BUNDLES, true)) {
-                       StringBuffer buf = new StringBuffer();
+                       StringBuffer tBuf = new StringBuffer();
                        for (IPluginModelBase model : PluginRegistry.getExternalModels()) {
-                               buf.append(model.getBundleDescription().getSymbolicName());
-                               buf.append(',');
+                               tBuf.append(model.getBundleDescription().getSymbolicName());
+                               tBuf.append(',');
+                       }
+                       targetBundles = tBuf.toString();
+                       StringBuffer wBuf = new StringBuffer();
+                       for (IPluginModelBase model : PluginRegistry.getWorkspaceModels()) {
+                               wBuf.append(model.getBundleDescription().getSymbolicName());
+                               wBuf.append(',');
                        }
-                       targetBundles = buf.toString();
-               } else
+                       wkSpaceBundles = wBuf.toString();
+               } else {
                        targetBundles = configuration.getAttribute(
                                        IPDELauncherConstants.TARGET_BUNDLES, "");
+                       wkSpaceBundles = configuration.getAttribute(
+                                       IPDELauncherConstants.WORKSPACE_BUNDLES, "");
+               }
                configuration.setAttribute(IPDELauncherConstants.TARGET_BUNDLES,
                                convertBundleList(bundlesToStart, targetBundles));
 
-               String wkSpaceBundles = configuration.getAttribute(
-                               IPDELauncherConstants.WORKSPACE_BUNDLES, "");
                configuration.setAttribute(IPDELauncherConstants.WORKSPACE_BUNDLES,
                                convertBundleList(bundlesToStart, wkSpaceBundles));
 
@@ -137,17 +157,47 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                                progArgs.toString());
        }
 
-       private static void deleteDir(File dir) {
-               File[] files = dir.listFiles();
-               for (File file : files) {
-                       if (file.isDirectory())
-                               deleteDir(file);
+       /**
+        * Interprets special properties and register the others as system
+        * properties to append.
+        */
+       protected static void interpretProperties(Properties properties,
+                       List<String> bundlesToStart,
+                       Map<String, String> systemPropertiesToAppend) {
+               String argeoOsgiStart = properties
+                               .getProperty(OsgiLauncherConstants.ARGEO_OSGI_START);
+               if (argeoOsgiStart != null) {
+                       StringTokenizer st = new StringTokenizer(argeoOsgiStart, ",");
+                       while (st.hasMoreTokens())
+                               bundlesToStart.add(st.nextToken());
+               }
+
+               propKeys: for (Object keyObj : properties.keySet()) {
+                       String key = keyObj.toString();
+                       if (OsgiLauncherConstants.ARGEO_OSGI_START.equals(key))
+                               continue propKeys;
+                       else if (OsgiLauncherConstants.ARGEO_OSGI_BUNDLES.equals(key))
+                               continue propKeys;
+                       else if (OsgiLauncherConstants.ARGEO_OSGI_LOCATIONS.equals(key))
+                               continue propKeys;
+                       else if (OsgiLauncherConstants.OSGI_BUNDLES.equals(key))
+                               continue propKeys;
                        else
-                               file.delete();
+                               systemPropertiesToAppend.put(key, properties.getProperty(key));
                }
-               dir.delete();
+
        }
 
+       /** Adds a regular system property. */
+       protected static void addSysProperty(StringBuffer vmArgs, String key,
+                       String value) {
+               surroundSpaces(value);
+               String str = "-D" + key + "=" + value;
+               // surroundSpaces(str);
+               vmArgs.append(' ').append(str);
+       }
+
+       /** Adds JVMS registered in the workspace as special system properties. */
        protected static void addVms(StringBuffer vmArgs) {
                addVmSysProperty(vmArgs, "default", JavaRuntime.getDefaultVMInstall());
                IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
@@ -175,20 +225,14 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
 
        }
 
+       /** Adds a special system property pointing to one of the registered JVMs. */
        protected static void addVmSysProperty(StringBuffer vmArgs, String suffix,
                        IVMInstall vmInstall) {
                addSysProperty(vmArgs, OsgiLauncherConstants.VMS_PROPERTY_PREFIX + "."
                                + suffix, vmInstall.getInstallLocation().getPath());
        }
 
-       protected static void addSysProperty(StringBuffer vmArgs, String key,
-                       String value) {
-               surroundSpaces(value);
-               String str = "-D" + key + "=" + value;
-               // surroundSpaces(str);
-               vmArgs.append(' ').append(str);
-       }
-
+       /** Surround the string with quotes if it contains spaces. */
        protected static String surroundSpaces(String str) {
                if (str.indexOf(' ') >= 0)
                        return '\"' + str + '\"';
@@ -196,8 +240,15 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                        return str;
        }
 
+       /**
+        * Reformat the bundle list in order to reflect which bundles have to be
+        * started.
+        */
        protected static String convertBundleList(List<String> bundlesToStart,
                        String original) {
+               if (debug)
+                       System.out.println("Original bundle list: " + original);
+
                StringBuffer bufBundles = new StringBuffer(1024);
                StringTokenizer stComa = new StringTokenizer(original, ",");
                boolean first = true;
@@ -240,7 +291,21 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                return output;
        }
 
-       protected static Properties readProperties(IFile file) throws CoreException {
+       // UTILITIES
+       /** Recursively deletes a directory tree. */
+       private static void deleteDir(File dir) {
+               File[] files = dir.listFiles();
+               for (File file : files) {
+                       if (file.isDirectory())
+                               deleteDir(file);
+                       else
+                               file.delete();
+               }
+               dir.delete();
+       }
+
+       /** Loads a properties file. */
+       private static Properties readProperties(IFile file) throws CoreException {
                Properties props = new Properties();
 
                InputStream in = null;
@@ -261,36 +326,9 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                return props;
        }
 
-       protected static void interpretProperties(Properties properties,
-                       List<String> bundlesToStart,
-                       Map<String, String> systemPropertiesToAppend) {
-               String argeoOsgiStart = properties
-                               .getProperty(OsgiLauncherConstants.ARGEO_OSGI_START);
-               if (argeoOsgiStart != null) {
-                       StringTokenizer st = new StringTokenizer(argeoOsgiStart, ",");
-                       while (st.hasMoreTokens())
-                               bundlesToStart.add(st.nextToken());
-               }
-
-               propKeys: for (Object keyObj : properties.keySet()) {
-                       String key = keyObj.toString();
-                       if (OsgiLauncherConstants.ARGEO_OSGI_START.equals(key))
-                               continue propKeys;
-                       else if (OsgiLauncherConstants.ARGEO_OSGI_BUNDLES.equals(key))
-                               continue propKeys;
-                       else if (OsgiLauncherConstants.ARGEO_OSGI_LOCATIONS.equals(key))
-                               continue propKeys;
-                       else if (OsgiLauncherConstants.OSGI_BUNDLES.equals(key))
-                               continue propKeys;
-                       else
-                               systemPropertiesToAppend.put(key, properties.getProperty(key));
-               }
-
-       }
-
        // Hacked from
        // org.eclipse.pde.internal.ui.launcher.LaunchArgumentsHelper.getWorkingDirectory(ILaunchConfiguration)
-       public static File getWorkingDirectory(ILaunchConfiguration configuration)
+       private static File getWorkingDirectory(ILaunchConfiguration configuration)
                        throws CoreException {
                String working;
                try {
@@ -317,9 +355,63 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants {
                return mgr.performStringSubstitution(text);
        }
 
-       // static void initializeConfiguration(
-       // ILaunchConfigurationWorkingCopy configuration) {
-       // new OSGiLaunchConfigurationInitializer().initialize(configuration);
-       // }
+       /**
+        * Not used anymore, but kept because this routine may be useful in the
+        * future.
+        */
+       protected void addSelectedProjects(StringBuffer name, ISelection selection,
+                       List<String> bundlesToStart) {
+               Assert.isNotNull(selection);
+
+               Map<String, IPluginModelBase> bundleProjects = new HashMap<String, IPluginModelBase>();
+               for (IPluginModelBase modelBase : PluginRegistry.getWorkspaceModels()) {
+                       IProject bundleProject = modelBase.getUnderlyingResource()
+                                       .getProject();
+                       bundleProjects.put(bundleProject.getName(), modelBase);
+               }
+
+               IStructuredSelection sSelection = (IStructuredSelection) selection;
+               for (Iterator<?> it = sSelection.iterator(); it.hasNext();) {
+                       Object obj = it.next();
+                       if (obj instanceof IProject) {
+                               IProject project = (IProject) obj;
+                               if (bundleProjects.containsKey(project.getName())) {
+                                       IPluginModelBase modelBase = bundleProjects.get(project
+                                                       .getName());
+
+                                       BundleDescription bundleDescription = null;
+                                       if (modelBase.isFragmentModel()) {
+                                               BundleDescription[] hosts = modelBase
+                                                               .getBundleDescription().getHost().getHosts();
+                                               for (BundleDescription bd : hosts) {
+                                                       if (debug)
+                                                               System.out.println("Host for "
+                                                                               + modelBase.getBundleDescription()
+                                                                                               .getSymbolicName() + ": "
+                                                                               + bd.getSymbolicName());
+                                                       bundleDescription = bd;
+                                               }
+                                       } else {
+                                               bundleDescription = modelBase.getBundleDescription();
+                                       }
+
+                                       if (bundleDescription != null) {
+                                               String symbolicName = bundleDescription
+                                                               .getSymbolicName();
+                                               String bundleName = bundleDescription.getName();
+
+                                               bundlesToStart.add(symbolicName);
+
+                                               if (name.length() > 0)
+                                                       name.append(" ");
+                                               if (bundleName != null)
+                                                       name.append(bundleName);
+                                               else
+                                                       name.append(symbolicName);
+                                       }
+                               }
+                       }
+               }
+       }
 
 }
index 7a2d531b61adc9a93a17b789c2d4ee1f7cf79238..0586caf9322ae85aa9ec3fbcfaf55105c667516e 100644 (file)
@@ -2,6 +2,7 @@ package org.argeo.slc.ide.ui.launch.osgi;
 
 import org.argeo.slc.ide.ui.SlcIdeUiPlugin;
 
+/** Constants used by OSGi launch. */
 public interface OsgiLauncherConstants {
 
        public final static String ARGEO_OSGI_START = "argeo.osgi.start";
diff --git a/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/SlcLaunchShortcut.java b/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/SlcLaunchShortcut.java
deleted file mode 100644 (file)
index e8e61ef..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.argeo.slc.ide.ui.launch.osgi;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.pde.core.plugin.IPluginModelBase;
-import org.eclipse.pde.core.plugin.PluginRegistry;
-
-public class SlcLaunchShortcut extends AbstractOsgiLaunchShortcut {
-       private Boolean debug = false;
-
-       private String springOsgiExtenderId = "org.springframework.osgi.extender";
-       private String slcSupportEquinoxId = "org.argeo.slc.support.equinox";
-       // private String slcAgentId = "org.argeo.slc.agent";
-       // private String osgiBootId = "org.argeo.slc.osgiboot";
-
-       private ISelection selection = null;
-
-       private final List<String> defaultBundlesToStart = new ArrayList<String>();
-       public SlcLaunchShortcut() {
-               super();
-               defaultBundlesToStart.add(springOsgiExtenderId);
-               defaultBundlesToStart.add(slcSupportEquinoxId);
-               // defaultBundlesToStart.add(slcAgentId);
-       }
-
-       public void launch(ISelection selection, String mode) {
-               this.selection = selection;
-               this.name = new StringBuffer();
-
-               bundlesToStart = new ArrayList<String>();
-               bundlesToStart.addAll(defaultBundlesToStart);
-               // Evaluate selection
-               if (selection != null) {
-                       addSelectedProjects(bundlesToStart);
-               }
-
-               super.launch(selection, mode);
-
-               // Reset
-               this.selection = null;
-       }
-
-       protected void addSelectedProjects(List<String> bundlesToStart) {
-               Assert.isNotNull(selection);
-
-               Map<String, IPluginModelBase> bundleProjects = new HashMap<String, IPluginModelBase>();
-               for (IPluginModelBase modelBase : PluginRegistry.getWorkspaceModels()) {
-                       IProject bundleProject = modelBase.getUnderlyingResource()
-                                       .getProject();
-                       bundleProjects.put(bundleProject.getName(), modelBase);
-               }
-
-               IStructuredSelection sSelection = (IStructuredSelection) selection;
-               for (Iterator<?> it = sSelection.iterator(); it.hasNext();) {
-                       Object obj = it.next();
-                       if (obj instanceof IProject) {
-                               IProject project = (IProject) obj;
-                               if (bundleProjects.containsKey(project.getName())) {
-                                       IPluginModelBase modelBase = bundleProjects.get(project
-                                                       .getName());
-
-                                       BundleDescription bundleDescription = null;
-                                       if (modelBase.isFragmentModel()) {
-                                               BundleDescription[] hosts = modelBase
-                                                               .getBundleDescription().getHost().getHosts();
-                                               for (BundleDescription bd : hosts) {
-                                                       if (debug)
-                                                               System.out.println("Host for "
-                                                                               + modelBase.getBundleDescription()
-                                                                                               .getSymbolicName() + ": "
-                                                                               + bd.getSymbolicName());
-                                                       bundleDescription = bd;
-                                               }
-                                       } else {
-                                               bundleDescription = modelBase.getBundleDescription();
-                                       }
-
-                                       if (bundleDescription != null) {
-                                               String symbolicName = bundleDescription
-                                                               .getSymbolicName();
-                                               String bundleName = bundleDescription.getName();
-
-                                               bundlesToStart.add(symbolicName);
-
-                                               if (name.length() > 0)
-                                                       name.append(" ");
-                                               if (bundleName != null)
-                                                       name.append(bundleName);
-                                               else
-                                                       name.append(symbolicName);
-                                       }
-                               }
-                       }
-               }
-       }
-}