add skeleton launcher for osgi runtimes
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@806293 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/eclipse/runtime/.classpath b/sigil/eclipse/runtime/.classpath
new file mode 100644
index 0000000..fce9fdb
--- /dev/null
+++ b/sigil/eclipse/runtime/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.apache.felix.sigil.classpathContainer"/>
+ <classpathentry kind="lib" path="lib/org.eclipse.swt.carbon.macosx.jar"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
diff --git a/sigil/eclipse/runtime/.project b/sigil/eclipse/runtime/.project
new file mode 100644
index 0000000..7145f7e
--- /dev/null
+++ b/sigil/eclipse/runtime/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.apache.felix.sigil.eclipse.runtime</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.apache.felix.sigil.eclipse.core.sigilBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.apache.felix.sigil.sigilnature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sigil/eclipse/runtime/build.xml b/sigil/eclipse/runtime/build.xml
new file mode 100644
index 0000000..c5435a0
--- /dev/null
+++ b/sigil/eclipse/runtime/build.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project name="eclipse.runtime" default="build"
+ xmlns:ivy="antlib:org.apache.ivy.ant">
+ <import file="../build.xml"/>
+ <target name="init">
+ <ivy:retrieve organisation="org.eclipse" module="org.eclipse.swt.carbon.macosx" revision="3.4.1.v3452b" inline="true" pattern="lib/[artifact].[ext]" transitive="false"/>
+ </target>
+</project>
diff --git a/sigil/eclipse/runtime/ivy.xml b/sigil/eclipse/runtime/ivy.xml
new file mode 100644
index 0000000..a428817
--- /dev/null
+++ b/sigil/eclipse/runtime/ivy.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<ivy-module version="1.0">
+ <info
+ organisation="org.apache"
+ module="felix.sigil.eclipse.runtime"
+ status="integration"/>
+ <publications>
+ <artifact name="org.apache.felix.sigil.eclipse.runtime" />
+ </publications>
+</ivy-module>
diff --git a/sigil/eclipse/runtime/plugin.xml b/sigil/eclipse/runtime/plugin.xml
new file mode 100644
index 0000000..49d9878
--- /dev/null
+++ b/sigil/eclipse/runtime/plugin.xml
@@ -0,0 +1,534 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<?eclipse version="3.2"?>
+<plugin>
+ <extension point = "org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ id="org.apache.felix.sigil.eclipse.runtime.OSGi"
+ name="OSGi Application"
+ delegate="org.apache.felix.sigil.eclipse.runtime.OSGiLauncher"
+ modes= "run, debug"
+ sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
+ sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
+ </launchConfigurationType>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ class="org.apache.felix.sigil.eclipse.runtime.config.OSGiLaunchConfigurationTabGroup"
+ id="org.apache.felix.sigil.eclipse.runtime.config.OSGiLaunchConfigurationTabGroup"
+ type="org.apache.felix.sigil.eclipse.runtime.OSGi"/>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ class="org.apache.felix.sigil.eclipse.runtime.shortcut.OSGiLaunchShortCut"
+ icon="etc/images/newton.png"
+ id="org.cauldron.sigil.launching.shortcut"
+ label="OSGi Application"
+ modes="run,debug">
+ <contextualLaunch>
+ <enablement>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <or>
+ <instanceof value="org.eclipse.jdt.core.IJavaProject"/>
+ <test
+ property="org.apache.felix.sigil.isSigilProject"
+ value="true"/>
+ </or>
+ </iterate>
+ </with>
+ </enablement>
+ </contextualLaunch>
+ </shortcut>
+ </extension>
+ <extension
+ point="org.eclipse.jdt.launching.classpathProviders">
+ <classpathProvider
+ class="org.cauldron.sigil.runtime.launch.NewtonSourcePathProvider"
+ id="org.cauldron.sigil.classpath.Provider"/>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ configTypeID="org.apache.felix.sigil.eclipse.runtime.OSGi"
+ icon="etc/images/newton.png"
+ id="org.apache.felix.sigil.eclipse.runtime.OSGi">
+ </launchConfigurationTypeImage>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.apache.felix.sigil.runtime.commands.installProject"
+ name="%commandInstallProject">
+ </command>
+ <command
+ id="org.apache.felix.sigil.runtime.commands.uninstallProject"
+ name="%commandUninstallProject">
+ </command>
+ <command
+ id="org.apache.felix.sigil.runtime.commands.reinstallProject"
+ name="%commandReinstallProject">
+ </command>
+ <command
+ id="org.apache.felix.sigil.runtime.commands.startProject"
+ name="%commandStartProject">
+ </command>
+ <command
+ id="org.apache.felix.sigil.runtime.commands.stopProject"
+ name="%commandStopProject">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.apache.felix.sigil.runtime.commands.installProject"
+ icon="etc/images/installBundle.png">
+ </image>
+ <image
+ commandId="org.apache.felix.sigil.runtime.commands.uninstallProject"
+ icon="etc/images/uninstallBundle.png">
+ </image>
+ <image
+ commandId="org.apache.felix.sigil.runtime.commands.reinstallProject"
+ icon="etc/images/refreshBundle.png">
+ </image>
+ <image
+ commandId="org.apache.felix.sigil.runtime.commands.startProject"
+ icon="etc/images/startBundle.png">
+ </image>
+ <image
+ commandId="org.apache.felix.sigil.runtime.commands.stopProject"
+ icon="etc/images/stopBundle.png">
+ </image>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.cauldron.sigil.runtime.handlers.project.SelectionProjectHandler:install"
+ commandId="org.apache.felix.sigil.runtime.commands.installProject">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <and>
+ <or>
+ <instanceof
+ value="org.eclipse.core.resources.IFile">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ </or>
+ <test
+ property="org.cauldron.sigil.isSigilProject"
+ value="true">
+ </test>
+ </and>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.cauldron.sigil.runtime.handlers.project.SelectionProjectHandler:start"
+ commandId="org.apache.felix.sigil.runtime.commands.startProject">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <and>
+ <or>
+ <instanceof
+ value="org.eclipse.core.resources.IFile">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ </or>
+ <test
+ property="org.cauldron.sigil.isSigilProject"
+ value="true">
+ </test>
+ </and>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.cauldron.sigil.runtime.handlers.project.SelectionProjectHandler:stop"
+ commandId="org.apache.felix.sigil.runtime.commands.stopProject">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <and>
+ <or>
+ <instanceof
+ value="org.eclipse.core.resources.IFile">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ </or>
+ <test
+ property="org.cauldron.sigil.isSigilProject"
+ value="true">
+ </test>
+ </and>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.cauldron.sigil.runtime.handlers.project.SelectionProjectHandler:uninstall"
+ commandId="org.apache.felix.sigil.runtime.commands.uninstallProject">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <and>
+ <or>
+ <instanceof
+ value="org.eclipse.core.resources.IFile">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ </or>
+ <test
+ property="org.cauldron.sigil.isSigilProject"
+ value="true">
+ </test>
+ </and>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.cauldron.sigil.runtime.handlers.project.SelectionProjectHandler:reinstall"
+ commandId="org.apache.felix.sigil.runtime.commands.reinstallProject">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <and>
+ <or>
+ <instanceof
+ value="org.eclipse.core.resources.IFile">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ </or>
+ <test
+ property="org.cauldron.sigil.isSigilProject"
+ value="true">
+ </test>
+ </and>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.cauldron.sigil.runtime.handlers.project.EditorProjectHandler:install"
+ commandId="org.apache.felix.sigil.runtime.commands.installProject">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.cauldron.sigil.editors.SigilProjectEditor">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.cauldron.sigil.runtime.handlers.project.EditorProjectHandler:uninstall"
+ commandId="org.apache.felix.sigil.runtime.commands.uninstallProject">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.cauldron.sigil.editors.SigilProjectEditor">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.cauldron.sigil.runtime.handlers.project.EditorProjectHandler:reinstall"
+ commandId="org.apache.felix.sigil.runtime.commands.reinstallProject">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.cauldron.sigil.editors.SigilProjectEditor">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.ui.popup.any">
+ <separator
+ name="org.cauldron.sigil.runtime.separator"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.installProject"
+ label="Install Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.uninstallProject"
+ label="Uninstall Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.reinstallProject"
+ label="Reinstall Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.startProject"
+ label="Start Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.stopProject"
+ label="Stop Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar">
+ <toolbar
+ id="org.cauldron.sigil.runtime.toolbar1">
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.installProject"
+ label="Install Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="activePartId">
+ <equals
+ value="org.cauldron.sigil.editors.SigilProjectEditor">
+ </equals>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.uninstallProject"
+ label="Uninstall Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="activePartId">
+ <equals
+ value="org.cauldron.sigil.editors.SigilProjectEditor">
+ </equals>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.reinstallProject"
+ label="Re Install Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="activePartId">
+ <equals
+ value="org.cauldron.sigil.editors.SigilProjectEditor">
+ </equals>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.startProject"
+ label="Start Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="activePartId">
+ <equals
+ value="org.cauldron.sigil.editors.SigilProjectEditor">
+ </equals>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.apache.felix.sigil.runtime.commands.stopProject"
+ label="Stop Project"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="activePartId">
+ <equals
+ value="org.cauldron.sigil.editors.SigilProjectEditor">
+ </equals>
+ </with>
+ </visibleWhen>
+ </command>
+ </toolbar>
+ </menuContribution>
+ </extension>
+ <!-- extension
+ point="org.eclipse.ui.contexts">
+ <context
+ id="org.cauldron.sigil.runtime.contexts.compositeEditor"
+ name="Composite Editor"
+ parentId="org.eclipse.ui.textEditorScope">
+ </context>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.apache.felix.sigil.runtime.commands.installComposite"
+ contextId="org.cauldron.sigil.runtime.contexts.compositeEditor"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+I">
+ </key>
+ <key
+ commandId="org.apache.felix.sigil.runtime.commands.uninstallComposite"
+ contextId="org.cauldron.sigil.runtime.contexts.compositeEditor"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+U">
+ </key>
+ <key
+ commandId="org.apache.felix.sigil.runtime.commands.reinstallComposite"
+ contextId="org.cauldron.sigil.runtime.contexts.compositeEditor"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+M2+I">
+ </key>
+ </extension -->
+ <!-- extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.cauldron.sigil.ui.views"
+ class="org.cauldron.sigil.runtime.views.NewtonInstancesView"
+ icon="etc/images/newton.png"
+ id="org.cauldron.sigil.runtime.newtonInstancesView"
+ name="Newton Instances"
+ restorable="true">
+ </view>
+ </extension -->
+ <!-- extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.cauldron.sigil.runtime.registry.INewtonRegistry"
+ class="org.cauldron.sigil.runtime.views.DeferredAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.progress.IDeferredWorkbenchAdapter">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.cauldron.sigil.runtime.registry.INewtonInstance"
+ class="org.cauldron.sigil.runtime.views.DeferredAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.progress.IDeferredWorkbenchAdapter">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.cauldron.sigil.runtime.model.IBundleState"
+ class="org.cauldron.sigil.runtime.views.DeferredAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.progress.IDeferredWorkbenchAdapter">
+ </adapter>
+ </factory>
+ </extension -->
+ <!-- extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.cauldron.sigil.ui.perspective1">
+ <viewShortcut
+ id="org.cauldron.sigil.runtime.newtonInstancesView">
+ </viewShortcut>
+ </perspectiveExtension>
+ </extension -->
+ <!-- extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.cauldron.sigil.runtime.prefs.PreferenceInitializer">
+ </initializer>
+ </extension -->
+ <!-- extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.cauldron.sigil.ui.preferences.SigilPreferencePage"
+ class="org.cauldron.sigil.runtime.prefs.RuntimePreferencesPage"
+ id="org.cauldron.sigil.runtime.preferences.RuntimePreferencesPage"
+ name="Runtime">
+ </page>
+ </extension -->
+ <!-- extension
+ point="org.cauldron.sigil.installbuilder">
+ <builder
+ class="org.cauldron.sigil.runtime.install.NewtonV1_2InstallBuilder">
+ </builder>
+ <builder
+ class="org.cauldron.sigil.runtime.install.NewtonV1_3InstallBuilder">
+ </builder>
+ <builder
+ class="org.cauldron.sigil.runtime.install.NewtonV1_4InstallBuilder">
+ </builder>
+ </extension -->
+ <!-- extension
+ point="org.cauldron.sigil.repositoryprovider">
+ <provider
+ class="org.cauldron.sigil.runtime.repository.PlatformRepositoryProvider"
+ defaultLevel="-2"
+ dynamic="false"
+ id="org.cauldron.sigil.runtime.provider"
+ type="OSGi Platform Repository">
+ </provider>
+ </extension -->
+</plugin>
diff --git a/sigil/eclipse/runtime/sigil.properties b/sigil/eclipse/runtime/sigil.properties
new file mode 100644
index 0000000..4c4738e
--- /dev/null
+++ b/sigil/eclipse/runtime/sigil.properties
@@ -0,0 +1,33 @@
+
+# sigil project file, saved by plugin.
+
+-singleton: true
+
+-bundles: \
+ org.apache.felix.sigil.eclipse.runtime, \
+
+-resources: \
+ plugin.xml, \
+
+-sourcedirs: \
+ src, \
+
+-imports: \
+ org.apache.felix.sigil.common.runtime;version=0.9.0, \
+ org.apache.felix.sigil.eclipse;version=0.9.0, \
+ org.apache.felix.sigil.eclipse.install, \
+ org.eclipse.core.resources, \
+ org.eclipse.jdt.debug.ui.launchConfigurations, \
+ org.eclipse.jface.viewers, \
+ org.eclipse.swt.graphics, \
+ org.eclipse.swt.widgets, \
+
+-requires: \
+ org.eclipse.core.runtime;version=3.4.0, \
+ org.eclipse.debug.core;version=3.4.1, \
+ org.eclipse.debug.ui;version=3.4.2, \
+ org.eclipse.equinox.common;version=3.4.0, \
+ org.eclipse.jdt.launching;version=3.4.1, \
+ org.eclipse.ui.workbench;version=3.4.2, \
+
+# end
diff --git a/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/LaunchHelper.java b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/LaunchHelper.java
new file mode 100644
index 0000000..5a86712
--- /dev/null
+++ b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/LaunchHelper.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.eclipse.runtime;
+
+import java.util.Properties;
+
+import org.apache.felix.sigil.common.runtime.Runtime;
+import org.apache.felix.sigil.eclipse.install.IOSGiInstall;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+public class LaunchHelper {
+
+ public static IOSGiInstall getInstall(ILaunchConfiguration config) {
+// OSGiInstall install = new OSGiInstall( "felix" );
+// OSGiInstallType type = new OSGiInstallType();
+// type.setMainClass( "org.apache.felix.main.Main" );
+// type.setClassPath( new String[] { "/Users/dave/development/felix-trunk/main/target/org.apache.felix.main-1.9.0-SNAPSHOT.jar" } );
+// install.setType( type );
+// return install;
+ return null;
+ }
+
+ public static int getRetries( ILaunchConfiguration config )
+ {
+ return 5;
+ }
+
+ public static Properties buildClientProps( ILaunchConfiguration config )
+ {
+ Properties props = new Properties();
+ props.put( Runtime.ADDRESS_PROPERTY, "localhost" );
+ props.put( Runtime.PORT_PROPERTY, "9090" );
+ return props;
+ }
+
+ public static String[] getProgramArgs( ILaunchConfiguration config )
+ {
+ return new String[] { "-p", "9090", "-a", "localhost" };
+ }
+
+ public static long getBackoff( ILaunchConfiguration config )
+ {
+ return 1000;
+ }
+}
diff --git a/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/OSGiLauncher.java b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/OSGiLauncher.java
new file mode 100644
index 0000000..7b8b98c
--- /dev/null
+++ b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/OSGiLauncher.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.eclipse.runtime;
+
+
+import java.io.IOException;
+import java.net.ConnectException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.apache.felix.sigil.common.runtime.Client;
+import org.apache.felix.sigil.common.runtime.Main;
+import org.apache.felix.sigil.eclipse.SigilCore;
+import org.apache.felix.sigil.eclipse.install.IOSGiInstall;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
+import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMRunner;
+import org.eclipse.jdt.launching.VMRunnerConfiguration;
+
+
+public class OSGiLauncher extends AbstractJavaLaunchConfigurationDelegate implements ILaunchConfigurationDelegate,
+ ILaunchConfigurationDelegate2
+{
+
+ public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor )
+ throws CoreException
+ {
+ IOSGiInstall osgi = LaunchHelper.getInstall( config );
+
+ VMRunnerConfiguration vmconfig = new VMRunnerConfiguration( Main.class.getName(), buildClasspath( osgi, config ) );
+
+ String vm = getVMArguments( config );
+ if ( vm != null && vm.trim().length() > 0 )
+ vmconfig.setVMArguments( vm.split( " " ) );
+
+ IPath path = getWorkingDirectoryPath( config );
+ vmconfig.setWorkingDirectory( path == null ? null : path.toOSString() );
+
+ vmconfig.setBootClassPath( getBootpath( config ) );
+ vmconfig.setEnvironment( getEnvironment( config ) );
+ vmconfig.setProgramArguments( LaunchHelper.getProgramArgs( config ) );
+
+ IVMInstall install = getVMInstall( config );
+
+ IVMRunner runner = install.getVMRunner( mode );
+
+ setDefaultSourceLocator( launch, config );
+
+ SigilCore.log( "VM=" + install.getName() );
+ SigilCore.log( "Main=" + vmconfig.getClassToLaunch() );
+ SigilCore.log( "VMArgs=" + Arrays.asList( vmconfig.getVMArguments() ) );
+ SigilCore.log( "Classpath=" + Arrays.asList( vmconfig.getClassPath() ) );
+ SigilCore.log( "Args=" + Arrays.asList( vmconfig.getProgramArguments() ) );
+ SigilCore.log( "Working Dir=" + vmconfig.getWorkingDirectory() );
+
+ runner.run( vmconfig, launch, monitor );
+
+ Client client = connect( config );
+
+ SigilCore.log( "Connected " + client.isConnected() );
+ }
+
+
+ private Client connect( ILaunchConfiguration config ) throws CoreException
+ {
+ Properties props = LaunchHelper.buildClientProps( config );
+
+ int retry = LaunchHelper.getRetries( config );
+
+ Client client = null;
+
+ for ( int i = 0; i < retry; i++ )
+ {
+ client = new Client();
+ try
+ {
+ client.connect( props );
+ break;
+ }
+ catch ( ConnectException e )
+ {
+ SigilCore.log( "Failed to connect to client: " + e.getMessage() );
+ }
+ catch ( IOException e )
+ {
+ throw SigilCore.newCoreException( "Failed to connect client", e );
+ }
+
+ try
+ {
+ Thread.sleep( LaunchHelper.getBackoff( config ) );
+ }
+ catch ( InterruptedException e )
+ {
+ SigilCore.log( "Interrupted during backoff" );
+ }
+ }
+
+ if ( client == null )
+ {
+ throw SigilCore.newCoreException( "Failed to connect client after retries, check error log for details",
+ null );
+ }
+
+ return client;
+ }
+
+
+ public String[] getBootpath( ILaunchConfiguration configuration ) throws CoreException
+ {
+ String[] bootpath = super.getBootpath( configuration );
+
+ ArrayList<String> filtered = new ArrayList<String>();
+
+ if ( bootpath != null )
+ {
+ for ( String bp : bootpath )
+ {
+ if ( !SigilCore.isBundledPath( bp ) )
+ {
+ filtered.add( bp );
+ }
+ }
+ }
+
+ return filtered.toArray( new String[filtered.size()] );
+ }
+
+
+ private String[] buildClasspath( IOSGiInstall osgi, ILaunchConfiguration config ) throws CoreException
+ {
+ ArrayList<String> cp = new ArrayList<String>();
+
+ cp.add( Main.class.getProtectionDomain().getCodeSource().getLocation().getFile() );
+
+ for ( String c : getClasspath( config ) )
+ {
+ cp.add( c );
+ }
+
+ if ( osgi != null )
+ {
+ for ( String c : osgi.getType().getClassPath() )
+ {
+ cp.add( c );
+ }
+ }
+
+ return cp.toArray( new String[cp.size()] );
+ }
+
+}
diff --git a/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiConfigurationView.java b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiConfigurationView.java
new file mode 100644
index 0000000..0af9ba6
--- /dev/null
+++ b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiConfigurationView.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.eclipse.runtime.config;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author dave
+ *
+ */
+public class OSGiConfigurationView extends Composite
+{
+
+ /**
+ * @param parent
+ * @param osGiLaunchConfigurationTab
+ */
+ public OSGiConfigurationView( Composite parent, OSGiLaunchConfigurationTab osGiLaunchConfigurationTab )
+ {
+ super(parent, SWT.NONE);
+ initLayout();
+ }
+
+ /**
+ *
+ */
+ private void initLayout()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiLaunchConfigurationTab.java b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiLaunchConfigurationTab.java
new file mode 100644
index 0000000..abff591
--- /dev/null
+++ b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiLaunchConfigurationTab.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.eclipse.runtime.config;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author dave
+ *
+ */
+public class OSGiLaunchConfigurationTab extends AbstractLaunchConfigurationTab
+{
+
+ private OSGiConfigurationView configurationView;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName()
+ {
+ return "OSGi";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl( Composite parent )
+ {
+ configurationView = new OSGiConfigurationView(parent, this);
+ setControl(configurationView);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom( ILaunchConfiguration config )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply( ILaunchConfigurationWorkingCopy config )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults( ILaunchConfigurationWorkingCopy config )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiLaunchConfigurationTabGroup.java b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiLaunchConfigurationTabGroup.java
new file mode 100644
index 0000000..77834a0
--- /dev/null
+++ b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiLaunchConfigurationTabGroup.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.eclipse.runtime.config;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+
+/**
+ * @author dave
+ *
+ */
+public class OSGiLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup
+{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs( ILaunchConfigurationDialog arg0, String arg1 )
+ {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new OSGiLaunchConfigurationTab(),
+ new CommonTab(),
+ new JavaArgumentsTab(),
+ new JavaClasspathTab(),
+ new EnvironmentTab()
+ };
+ setTabs(tabs);
+ }
+
+}
diff --git a/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/shortcut/OSGiLaunchShortCut.java b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/shortcut/OSGiLaunchShortCut.java
new file mode 100644
index 0000000..8b83917
--- /dev/null
+++ b/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/shortcut/OSGiLaunchShortCut.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.eclipse.runtime.shortcut;
+
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * @author dave
+ *
+ */
+public class OSGiLaunchShortCut implements ILaunchShortcut
+{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.jface.viewers.ISelection, java.lang.String)
+ */
+ public void launch( ISelection arg0, String arg1 )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.ui.IEditorPart, java.lang.String)
+ */
+ public void launch( IEditorPart arg0, String arg1 )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}