View | Details | Raw Unified | Return to bug 278845 | Differences between
and this patch

Collapse All | Expand All

(-)org.eclipse.pde.launching/META-INF/MANIFEST.MF (+23 lines)
Line 0 Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %name
4
Bundle-SymbolicName: org.eclipse.pde.launching;singleton:=true
5
Bundle-Version: 3.5.0.qualifier
6
Bundle-RequiredExecutionEnvironment: J2SE-1.4
7
Bundle-Vendor: %provider-name
8
Require-Bundle: org.eclipse.jdt.junit.core;bundle-version="[3.6.0,4.0.0)",
9
 org.eclipse.jdt.launching;bundle-version="[3.2.0,4.0.0)",
10
 org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
11
 org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)",
12
 org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
13
 org.eclipse.core.variables;bundle-version="[3.1.0,4.0.0)",
14
 org.eclipse.pde.build;bundle-version="[3.2.0,4.0.0)",
15
 org.eclipse.pde.core;bundle-version="[3.2.0,4.0.0)",
16
 org.eclipse.jdt.debug;bundle-version="[3.2.0,4.0.0)",
17
 org.eclipse.core.filesystem;bundle-version="[1.0.0,2.0.0)"
18
Bundle-Activator: org.eclipse.pde.launching.launcher.PDELaunchingPlugin
19
Export-Package: org.eclipse.pde.internal.launching;x-friends:="org.eclipse.pde.ui",
20
 org.eclipse.pde.internal.launching.launcher;x-friends:="org.eclipse.pde.ui",
21
 org.eclipse.pde.launching.launcher
22
Bundle-ActivationPolicy: lazy
23
Bundle-Localization: plugin
0
  + text/plain
24
  + text/plain
(-)org.eclipse.pde.launching/.classpath (+7 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
0
  + text/plain
8
  + text/plain
(-)org.eclipse.pde.launching/schema/osgiFrameworks.exsd (+164 lines)
Line 0 Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.pde.ui" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
5
      <appinfo>
6
         <meta.schema plugin="org.eclipse.pde.ui" id="osgiFrameworks" name="OSGi Frameworks"/>
7
      </appinfo>
8
      <documentation>
9
         &lt;p&gt;
10
This extension point is used to register new OSGi frameworks. Each framework is associated with a launcher delegate that is called when the OSGi framework is selected in the &lt;b&gt;OSGi Framework&lt;/b&gt; launch configuration.
11
&lt;/p&gt;
12
&lt;p&gt;Registered OSGi frameworks appear on the &lt;b&gt;Plug-in Development &gt; OSGi frameworks&lt;/b&gt; preference page, where a default framework can be set.
13
&lt;/p&gt;
14
      </documentation>
15
   </annotation>
16
17
   <element name="extension">
18
      <annotation>
19
         <appinfo>
20
            <meta.element />
21
         </appinfo>
22
      </annotation>
23
      <complexType>
24
         <sequence>
25
            <element ref="framework" minOccurs="1" maxOccurs="unbounded"/>
26
         </sequence>
27
         <attribute name="point" type="string" use="required">
28
            <annotation>
29
               <documentation>
30
                  
31
               </documentation>
32
            </annotation>
33
         </attribute>
34
         <attribute name="id" type="string">
35
            <annotation>
36
               <documentation>
37
                  
38
               </documentation>
39
            </annotation>
40
         </attribute>
41
         <attribute name="name" type="string">
42
            <annotation>
43
               <documentation>
44
                  
45
               </documentation>
46
               <appinfo>
47
                  <meta.attribute translatable="true"/>
48
               </appinfo>
49
            </annotation>
50
         </attribute>
51
      </complexType>
52
   </element>
53
54
   <element name="framework">
55
      <complexType>
56
         <attribute name="id" type="string" use="required">
57
            <annotation>
58
               <documentation>
59
                  a unique identifier of the framework
60
               </documentation>
61
            </annotation>
62
         </attribute>
63
         <attribute name="name" type="string" use="required">
64
            <annotation>
65
               <documentation>
66
                  human-readable name of the OSGi framework
67
               </documentation>
68
               <appinfo>
69
                  <meta.attribute translatable="true"/>
70
               </appinfo>
71
            </annotation>
72
         </attribute>
73
         <attribute name="launcherDelegate" type="string" use="required">
74
            <annotation>
75
               <documentation>
76
                  a launch configuration delegate to launch the OSGi framework. The value of this attribute is the fully qualified name of the Java class that extends &lt;code&gt;org.eclipse.pde.launcher.AbstractPDELaunchConfiguration&lt;/code&gt;.
77
               </documentation>
78
               <appinfo>
79
                  <meta.attribute kind="java" basedOn="org.eclipse.pde.launcher.AbstractPDELaunchConfiguration"/>
80
               </appinfo>
81
            </annotation>
82
         </attribute>
83
         <attribute name="initializer" type="string">
84
            <annotation>
85
               <documentation>
86
                  initializes new OSGi Framework launch configurations with suitable defaults.  The value of this attribute must be a fully-qualified name of a Java class that extends the default implementation &lt;code&gt;org.eclipse.pde.launcher.OSGiLaunchConfigurationInitializer&lt;/code&gt;.  If not specified, the default initializer &lt;code&gt;org.eclipse.pde.launcher.OSGiLaunchConfigurationInitializer&lt;/code&gt; is instantiated.
87
               </documentation>
88
               <appinfo>
89
                  <meta.attribute kind="java" basedOn="org.eclipse.pde.launcher.OSGiLaunchConfigurationInitializer"/>
90
               </appinfo>
91
            </annotation>
92
         </attribute>
93
      </complexType>
94
   </element>
95
96
   <annotation>
97
      <appinfo>
98
         <meta.section type="since"/>
99
      </appinfo>
100
      <documentation>
101
         3.6
102
      </documentation>
103
   </annotation>
104
105
   <annotation>
106
      <appinfo>
107
         <meta.section type="examples"/>
108
      </appinfo>
109
      <documentation>
110
         &lt;p&gt;
111
The following is an example of the extension point:
112
&lt;pre&gt;
113
   &lt;extension
114
         point=&quot;org.eclipse.pde.launching.osgiFrameworks&quot;&gt;
115
      &lt;framework
116
            launcherDelegate=&quot;org.eclipse.pde.launcher.EquinoxLaunchConfiguration&quot;
117
            id=&quot;org.eclipse.pde.ui.EquinoxFramework&quot;
118
            name=&quot;%Equinox.shortcut.label&quot; 
119
            initializer=&quot;org.eclipse.pde.internal.launcher.EquinoxInitializer&quot;/&gt;
120
   &lt;/extension&gt;
121
&lt;/pre&gt;
122
      </documentation>
123
   </annotation>
124
125
   <annotation>
126
      <appinfo>
127
         <meta.section type="apiInfo"/>
128
      </appinfo>
129
      <documentation>
130
         &lt;p&gt;
131
The value of the attribute &lt;code&gt;launcherDelegate&lt;/code&gt; must be a fully qualified name of a Java class that extends &lt;code&gt;org.eclipse.pde.launcher.AbstractPDELaunchConfiguration&lt;/code&gt;.  If the launcher is to provide its own source lookup order, then the method &lt;code&gt;setDefaultSourceLocator&lt;/code&gt; should be overridden.
132
&lt;/p&gt;
133
&lt;p&gt;
134
The value of the attribute &lt;code&gt;initializer&lt;/code&gt; must be a fully qualified name of a Java class that extends &lt;code&gt;org.eclipse.launcher.OSGiLaunchConfigurationInitializer&lt;/code&gt;.
135
&lt;/p&gt;
136
      </documentation>
137
   </annotation>
138
139
   <annotation>
140
      <appinfo>
141
         <meta.section type="implementation"/>
142
      </appinfo>
143
      <documentation>
144
         &lt;p&gt;
145
PDE supplies the Equinox OSGi Framework extension to launch Equinox frameworks.
146
&lt;/p&gt;
147
      </documentation>
148
   </annotation>
149
150
   <annotation>
151
      <appinfo>
152
         <meta.section type="copyright"/>
153
      </appinfo>
154
      <documentation>
155
         Copyright (c) 2006 IBM Corporation and others.
156
&lt;br&gt;
157
All rights reserved. This program and the accompanying materials are made 
158
available under the terms of the Eclipse Public License v1.0 which 
159
accompanies this distribution, and is available at 
160
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;.
161
      </documentation>
162
   </annotation>
163
164
</schema>
0
  + text/plain
165
  + text/plain
1
  + *
166
  + *
(-)org.eclipse.pde.launching/.project (+28 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.pde.launching</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
0
  + text/plain
29
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/OSGiLaunchConfigurationDelegate.java (+63 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.launching.launcher;
12
13
import org.eclipse.pde.internal.launching.IPDEConstants;
14
import org.eclipse.pde.internal.launching.PDEMessages;
15
import org.eclipse.pde.internal.launching.launcher.LaunchPluginValidator;
16
import org.eclipse.pde.internal.launching.launcher.OSGiFrameworkManager;
17
18
import org.eclipse.core.resources.IProject;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.debug.core.ILaunch;
21
import org.eclipse.debug.core.ILaunchConfiguration;
22
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
23
import org.eclipse.osgi.util.NLS;
24
25
/**
26
 * A launch delegate for launching OSGi frameworks
27
 * <p>
28
 * Clients may subclass and instantiate this class.
29
 * </p>
30
 * @since 3.3
31
 */
32
public class OSGiLaunchConfigurationDelegate extends LaunchConfigurationDelegate {
33
34
	/**
35
	 * Delegates to the launcher delegate associated with the OSGi framework
36
	 * selected in the launch configuration.
37
	 * 
38
	 * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
39
	 */
40
	public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
41
		OSGiFrameworkManager manager = PDELaunchingPlugin.getDefault().getOSGiFrameworkManager();
42
		String id = configuration.getAttribute(IPDELauncherConstants.OSGI_FRAMEWORK_ID, manager.getDefaultFramework());
43
		LaunchConfigurationDelegate launcher = manager.getFrameworkLauncher(id);
44
		if (launcher != null) {
45
			launcher.launch(configuration, mode, launch, monitor);
46
		} else {
47
			String name = manager.getFrameworkName(id);
48
			if (name == null)
49
				name = PDEMessages.OSGiLaunchConfiguration_selected;
50
			String message = NLS.bind(PDEMessages.OSGiLaunchConfiguration_cannotFindLaunchConfiguration, name);
51
			IStatus status = new Status(IStatus.ERROR, IPDEConstants.PLUGIN_ID, IStatus.OK, message, null);
52
			throw new CoreException(status);
53
		}
54
	}
55
56
	/* (non-Javadoc)
57
	 * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
58
	 */
59
	protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
60
		return computeBuildOrder(LaunchPluginValidator.getAffectedProjects(configuration));
61
	}
62
63
}
0
  + text/plain
64
  + text/plain
1
  + *
65
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/AbstractPDELaunchConfiguration.java (+422 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2009 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.launching.launcher;
12
13
import org.eclipse.pde.internal.launching.IPDEConstants;
14
import org.eclipse.pde.internal.launching.PDEMessages;
15
import org.eclipse.pde.internal.launching.launcher.*;
16
17
import java.io.File;
18
import java.util.ArrayList;
19
import java.util.Map;
20
import org.eclipse.core.resources.IMarker;
21
import org.eclipse.core.resources.IProject;
22
import org.eclipse.core.runtime.*;
23
import org.eclipse.debug.core.*;
24
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
25
import org.eclipse.jdt.core.IJavaModelMarker;
26
import org.eclipse.jdt.launching.*;
27
import org.eclipse.pde.core.plugin.TargetPlatform;
28
import org.eclipse.pde.internal.core.TargetPlatformHelper;
29
import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
30
31
/**
32
 * An abstract launch delegate for PDE-based launch configurations
33
 * <p>
34
 * Clients may subclass this class.
35
 * </p>
36
 * @since 3.2
37
 */
38
public abstract class AbstractPDELaunchConfiguration extends LaunchConfigurationDelegate {
39
40
	protected File fConfigDir = null;
41
42
	protected IPDELaunchConfigurationHelper helper = PDELaunchingPlugin.getDefault().getLauncherSettings().getPDELaunchConfigurationHelper();
43
44
	/* (non-Javadoc)
45
	 * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#isLaunchProblem(org.eclipse.core.resources.IMarker)
46
	 */
47
	protected boolean isLaunchProblem(IMarker problemMarker) throws CoreException {
48
		return super.isLaunchProblem(problemMarker) && (problemMarker.getType().equals(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER) || problemMarker.getType().equals(PDEMarkerFactory.MARKER_ID));
49
	}
50
51
	/*
52
	 * (non-Javadoc)
53
	 * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
54
	 */
55
	public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
56
		try {
57
			fConfigDir = null;
58
			monitor.beginTask("", 4); //$NON-NLS-1$
59
			try {
60
				preLaunchCheck(configuration, launch, new SubProgressMonitor(monitor, 2));
61
			} catch (CoreException e) {
62
				if (e.getStatus().getSeverity() == IStatus.CANCEL) {
63
					monitor.setCanceled(true);
64
					return;
65
				}
66
				throw e;
67
			}
68
			// if restarting, remove the restart flag from the launch config
69
			if (configuration.getAttribute(IPDEConstants.RESTART, false) && configuration instanceof ILaunchConfigurationWorkingCopy) {
70
				((ILaunchConfigurationWorkingCopy) configuration).setAttribute(IPDEConstants.RESTART, false);
71
				((ILaunchConfigurationWorkingCopy) configuration).doSave();
72
			}
73
			VMRunnerConfiguration runnerConfig = new VMRunnerConfiguration(getMainClass(), getClasspath(configuration));
74
			runnerConfig.setVMArguments(getVMArguments(configuration));
75
			runnerConfig.setProgramArguments(getProgramArguments(configuration));
76
			runnerConfig.setWorkingDirectory(getWorkingDirectory(configuration).getAbsolutePath());
77
			runnerConfig.setEnvironment(getEnvironment(configuration));
78
			runnerConfig.setVMSpecificAttributesMap(getVMSpecificAttributesMap(configuration));
79
80
			monitor.worked(1);
81
82
			setDefaultSourceLocator(configuration);
83
			manageLaunch(launch);
84
			IVMRunner runner = getVMRunner(configuration, mode);
85
			if (runner != null)
86
				runner.run(runnerConfig, launch, monitor);
87
			else
88
				monitor.setCanceled(true);
89
			monitor.done();
90
		} catch (final CoreException e) {
91
			monitor.setCanceled(true);
92
			helper.handleCoreException(e);
93
		}
94
	}
95
96
	/**
97
	 * Returns the VM runner for the given launch mode to use when launching the
98
	 * given configuration.
99
	 *  
100
	 * @param configuration launch configuration
101
	 * @param mode launch node
102
	 * @return VM runner to use when launching the given configuration in the given mode
103
	 * @throws CoreException if a VM runner cannot be determined
104
	 */
105
	public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException {
106
		IVMInstall launcher = VMHelper.createLauncher(configuration);
107
		return launcher.getVMRunner(mode);
108
	}
109
110
	/**
111
	 * Assigns a default source locator to the given launch if a source locator
112
	 * has not yet been assigned to it, and the associated launch configuration
113
	 * does not specify a source locator.
114
	 * 
115
	 * @param configuration
116
	 *            configuration being launched
117
	 * @exception CoreException
118
	 *                if unable to set the source locator
119
	 */
120
	protected void setDefaultSourceLocator(ILaunchConfiguration configuration) throws CoreException {
121
		ILaunchConfigurationWorkingCopy wc = null;
122
		if (configuration.isWorkingCopy()) {
123
			wc = (ILaunchConfigurationWorkingCopy) configuration;
124
		} else {
125
			wc = configuration.getWorkingCopy();
126
		}
127
		String id = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, (String) null);
128
		if (!PDESourcePathProvider.ID.equals(id)) {
129
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, PDESourcePathProvider.ID);
130
			wc.doSave();
131
		}
132
	}
133
134
	/**
135
	 * Returns the entries that should appear on boot classpath.
136
	 * 
137
	 * @param configuration
138
	 *            launch configuration
139
	 * @return the location of startup.jar and 
140
	 * 		the bootstrap classpath specified by the given launch configuration
141
	 *        
142
	 * @exception CoreException
143
	 *                if unable to find startup.jar
144
	 */
145
	public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException {
146
		String[] classpath = LaunchArgumentsHelper.constructClasspath(configuration);
147
		if (classpath == null) {
148
			String message = PDEMessages.WorkbenchLauncherConfigurationDelegate_noStartup;
149
			throw new CoreException(PDELaunchingPlugin.getDefault().getLauncherUtils().createErrorStatus(message));
150
		}
151
		return classpath;
152
	}
153
154
	/** 
155
	 * Returns an array of environment variables to be used when
156
	 * launching the given configuration or <code>null</code> if unspecified.
157
	 * 
158
	 * @param configuration launch configuration
159
	 * @throws CoreException if unable to access associated attribute or if
160
	 * unable to resolve a variable in an environment variable's value
161
	 */
162
	public String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException {
163
		return DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);
164
	}
165
166
	/**
167
	 * Returns the working directory path specified by the given launch
168
	 * configuration, or <code>null</code> if none.
169
	 * 
170
	 * @param configuration
171
	 *            launch configuration
172
	 * @return the working directory path specified by the given launch
173
	 *         configuration, or <code>null</code> if none
174
	 * @exception CoreException
175
	 *                if unable to retrieve the attribute
176
	 */
177
	public File getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
178
		return LaunchArgumentsHelper.getWorkingDirectory(configuration);
179
	}
180
181
	/**
182
	 * Returns the Map of VM-specific attributes specified by the given launch
183
	 * configuration, or <code>null</code> if none.
184
	 * 
185
	 * @param configuration
186
	 *            launch configuration
187
	 * @return the <code>Map</code> of VM-specific attributes
188
	 * @exception CoreException
189
	 *                if unable to retrieve the attribute
190
	 */
191
	public Map getVMSpecificAttributesMap(ILaunchConfiguration configuration) throws CoreException {
192
		return LaunchArgumentsHelper.getVMSpecificAttributesMap(configuration);
193
	}
194
195
	/**
196
	 * Returns the VM arguments specified by the given launch configuration, as
197
	 * an array of strings. 
198
	 * 
199
	 * @param configuration
200
	 *            launch configuration
201
	 * @return the VM arguments specified by the given launch configuration,
202
	 *         possibly an empty array
203
	 * @exception CoreException
204
	 *                if unable to retrieve the attribute
205
	 */
206
	public String[] getVMArguments(ILaunchConfiguration configuration) throws CoreException {
207
		String[] vmArgs = new ExecutionArguments(LaunchArgumentsHelper.getUserVMArguments(configuration), "").getVMArgumentsArray(); //$NON-NLS-1$
208
		// For p2 target, add "-Declipse.p2.data.area=@config.dir/p2" unless already specified by user
209
		Map bundleMap = BundleLauncherHelper.getMergedBundleMap(configuration, false);
210
		if (bundleMap.containsKey("org.eclipse.equinox.p2.core")) { //$NON-NLS-1$
211
			for (int i = 0; i < vmArgs.length; i++) {
212
				String arg = vmArgs[i];
213
				if (arg.startsWith("-Declipse.p2.data.area=")) { //$NON-NLS-1$
214
					return vmArgs;
215
				}
216
			}
217
			String[] temp = new String[vmArgs.length + 1];
218
			System.arraycopy(vmArgs, 0, temp, 0, vmArgs.length);
219
			temp[vmArgs.length] = "-Declipse.p2.data.area=@config.dir" + File.separator + "p2"; //$NON-NLS-1$ //$NON-NLS-2$
220
			return temp;
221
		}
222
		return vmArgs;
223
	}
224
225
	/**
226
	 * Returns the program arguments to launch with.
227
	 * This list is a combination of arguments computed by PDE based on attributes
228
	 * specified in the given launch configuration, followed by the program arguments
229
	 * that the entered directly into the launch configuration.
230
	 * 
231
	 * @param configuration
232
	 *            launch configuration
233
	 * @return the program arguments necessary for launching
234
	 * 
235
	 * @exception CoreException
236
	 *                if unable to retrieve the attribute or create the
237
	 *                necessary configuration files      
238
	 */
239
	public String[] getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
240
		ArrayList programArgs = new ArrayList();
241
242
		// add tracing, if turned on	
243
		if (configuration.getAttribute(IPDELauncherConstants.TRACING, false) && !IPDELauncherConstants.TRACING_NONE.equals(configuration.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null))) {
244
			programArgs.add("-debug"); //$NON-NLS-1$
245
			programArgs.add(LaunchArgumentsHelper.getTracingFileArgument(configuration, getConfigDir(configuration).toString() + IPath.SEPARATOR + ".options")); //$NON-NLS-1$
246
		}
247
248
		// add the program args specified by the user
249
		String[] userArgs = LaunchArgumentsHelper.getUserProgramArgumentArray(configuration);
250
		ArrayList userDefined = new ArrayList();
251
		for (int i = 0; i < userArgs.length; i++) {
252
			// be forgiving if people have tracing turned on and forgot
253
			// to remove the -debug from the program args field.
254
			if (userArgs[i].equals("-debug") && programArgs.contains("-debug")) //$NON-NLS-1$ //$NON-NLS-2$
255
				continue;
256
			userDefined.add(userArgs[i]);
257
		}
258
259
		if (!configuration.getAttribute(IPDEConstants.APPEND_ARGS_EXPLICITLY, false)) {
260
261
			if (!userDefined.contains("-os")) { //$NON-NLS-1$
262
				programArgs.add("-os"); //$NON-NLS-1$
263
				programArgs.add(TargetPlatform.getOS());
264
			}
265
			if (!userDefined.contains("-ws")) { //$NON-NLS-1$
266
				programArgs.add("-ws"); //$NON-NLS-1$
267
				programArgs.add(TargetPlatform.getWS());
268
			}
269
			if (!userDefined.contains("-arch")) { //$NON-NLS-1$
270
				programArgs.add("-arch"); //$NON-NLS-1$
271
				programArgs.add(TargetPlatform.getOSArch());
272
			}
273
		}
274
275
		if (userDefined.size() > 0) {
276
			programArgs.addAll(userDefined);
277
		}
278
279
		return (String[]) programArgs.toArray(new String[programArgs.size()]);
280
	}
281
282
	/**
283
	 * Does sanity checking before launching.  The criteria whether the launch should 
284
	 * proceed or not is specific to the launch configuration type.
285
	 * 
286
	 * @param configuration launch configuration
287
	 * @param launch the launch object to contribute processes and debug targets to
288
	 * @param monitor a progress monitor
289
	 * 
290
	 * @throws CoreException exception thrown if launch fails or canceled or if unable to retrieve attributes
291
	 * from the launch configuration
292
	 * 				
293
	 */
294
	protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
295
		boolean autoValidate = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, false);
296
		monitor.beginTask("", autoValidate ? 3 : 4); //$NON-NLS-1$
297
		if (autoValidate)
298
			validatePluginDependencies(configuration, new SubProgressMonitor(monitor, 1));
299
		validateProjectDependencies(configuration, new SubProgressMonitor(monitor, 1));
300
		clear(configuration, new SubProgressMonitor(monitor, 1));
301
		launch.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, getConfigDir(configuration).toString());
302
		synchronizeManifests(configuration, new SubProgressMonitor(monitor, 1));
303
	}
304
305
	/**
306
	 * Returns the configuration area specified by the given launch
307
	 * configuration.
308
	 * 
309
	 * @param configuration
310
	 *            launch configuration
311
	 * @return the directory path specified by the given launch
312
	 *         configuration
313
	 */
314
	protected File getConfigDir(ILaunchConfiguration configuration) {
315
		if (fConfigDir == null)
316
			fConfigDir = LaunchConfigurationHelper.getConfigurationArea(configuration);
317
		return fConfigDir;
318
	}
319
320
	/*
321
	/* (non-Javadoc)
322
	 * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
323
	 */
324
	protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
325
		return computeBuildOrder(LaunchPluginValidator.getAffectedProjects(configuration));
326
	}
327
328
	/*
329
	 * (non-Javadoc)
330
	 * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getProjectsForProblemSearch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
331
	 */
332
	protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) throws CoreException {
333
		return LaunchPluginValidator.getAffectedProjects(configuration);
334
	}
335
336
	/**
337
	 * Returns the fully-qualified name of the class to launch. 
338
	 * 
339
	 * @return the fully-qualified name of the class to launch.  Must not return <code>null</code>. 
340
	 * @since 3.3
341
	 */
342
	public String getMainClass() {
343
		if (TargetPlatformHelper.getTargetVersion() >= 3.3)
344
			return "org.eclipse.equinox.launcher.Main"; //$NON-NLS-1$
345
		return "org.eclipse.core.launcher.Main"; //$NON-NLS-1$
346
	}
347
348
	/**
349
	 * Adds a listener to the launch to be notified at interesting launch lifecycle
350
	 * events such as when the launch terminates.
351
	 * 
352
	 * @param launch
353
	 * 			the launch 		
354
	 * 
355
	 * @since 3.3	
356
	 */
357
	protected void manageLaunch(ILaunch launch) {
358
		PDELaunchingPlugin.getDefault().getLaunchListener().manage(launch);
359
	}
360
361
	/**
362
	 * Checks for old-style plugin.xml files that have become stale since the last launch.
363
	 * For any stale plugin.xml files found, the corresponding MANIFEST.MF is deleted 
364
	 * from the runtime configuration area so that it gets regenerated upon startup.
365
	 * 
366
	 * @param configuration
367
	 * 			the launch configuration
368
	 * @param monitor
369
	 * 			a progress monitor
370
	 * 
371
	 * @since 3.3
372
	 */
373
	protected void synchronizeManifests(ILaunchConfiguration configuration, IProgressMonitor monitor) {
374
		LaunchConfigurationHelper.synchronizeManifests(configuration, getConfigDir(configuration));
375
		monitor.done();
376
	}
377
378
	/**
379
	 * Checks if the Automated Management of Dependencies option is turned on.
380
	 * If so, it makes aure all manifests are updated with the correct dependencies.
381
	 * 
382
	 * @param configuration
383
	 * 			the launch configuration
384
	 * @param monitor
385
	 * 			a progress monitor
386
	 * 
387
	 * @since 3.3
388
	 */
389
	protected void validateProjectDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) {
390
		PDELaunchingPlugin.getDefault().getLauncherUtils().validateProjectDependencies(configuration, monitor);
391
	}
392
393
	/**
394
	 * By default, this method does nothing.  Clients should override, if appropriate.
395
	 * 
396
	 * @param configuration
397
	 * 			the launch configuration
398
	 * @param monitor
399
	 * 			the progress monitor
400
	 * @throws CoreException
401
	 * 			if unable to retrieve launch attribute values
402
	 * @since 3.3
403
	 */
404
	protected void clear(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
405
	}
406
407
	/**
408
	 * Validates inter-bundle dependencies automatically prior to launching
409
	 * if that option is turned on.
410
	 * 
411
	 * @param configuration
412
	 * 			the launch configuration
413
	 * @param monitor
414
	 * 			a progress monitor
415
	 * @since 3.3
416
	 */
417
	protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
418
		EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, PDELaunchingPlugin.getDefault().getLauncherSettings().getEclipsePluginValidationOperationHelper());
419
		LaunchPluginValidator.runValidationOperation(op, monitor);
420
	}
421
422
}
0
  + text/plain
423
  + text/plain
1
  + *
424
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/IPDELauncherConstants.java (+398 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.launching.launcher;
12
13
/**
14
 * Constant definitions for PDE launch configurations.
15
 * <p>
16
 * Constant definitions only; not to be implemented.
17
 * </p>
18
 * @since 3.2
19
 * 
20
 * @noimplement This interface is not intended to be implemented by clients.
21
 * @noextend This interface is not intended to be extended by clients.
22
 */
23
public interface IPDELauncherConstants {
24
25
	/**
26
	 * Launch configuration attribute key. The value is a string specifying
27
	 * workspace data location for an Eclipse application.
28
	 */
29
	String LOCATION = "location"; //$NON-NLS-1$
30
31
	/**
32
	 * Launch configuration attribute key. The value is a boolean specifying
33
	 * workspace data location for an Eclipse application should be cleared
34
	 * prior to launching.
35
	 */
36
	String DOCLEAR = "clearws"; //$NON-NLS-1$
37
38
	/**
39
	 * Launch configuration attribute key. The value is a boolean specifying
40
	 * whether the user should be prompted prior to clearing the workspace.
41
	 * 
42
	 * @see IPDELauncherConstants#DOCLEAR
43
	 */
44
	String ASKCLEAR = "askclear"; //$NON-NLS-1$
45
46
	/**
47
	 * Launch configuration attribute key. The value is a string specifying
48
	 * the application to run.  If the value is <code>null</code>, the default 
49
	 * application as specified in the target platform will be used.
50
	 */
51
	String APPLICATION = "application"; //$NON-NLS-1$
52
53
	/**
54
	 * Launch configuration attribute key. The value is a string specifying
55
	 * the product to run.
56
	 * 
57
	 * @see IPDELauncherConstants#APPLICATION
58
	 */
59
	String PRODUCT = "product"; //$NON-NLS-1$
60
61
	/**
62
	 * Launch configuration attribute key. The value is a boolean specifying
63
	 * if the launch should appear in product-mode.  If the value is <code>false</code>,
64
	 * the launch takes place in application-mode.
65
	 * 
66
	 * @see IPDELauncherConstants#PRODUCT
67
	 * @see IPDELauncherConstants#APPLICATION
68
	 */
69
	String USE_PRODUCT = "useProduct"; //$NON-NLS-1$
70
71
	/**
72
	 * Launch configuration attribute key used in Plug-in JUnit launch configurations only. 
73
	 * The value is a string specifying the application to be tested.  
74
	 * If the value is <code>null</code>, the default UI workbench application is tested.
75
	 */
76
	String APP_TO_TEST = "testApplication"; //$NON-NLS-1$
77
78
	/**
79
	 * Launch configuration attribute key. The value is a string specifying
80
	 * the name of the VM to launch with.  If the value is <code>null</code>,
81
	 * the default workspace VM is used.
82
	 * 
83
	 * @deprecated use IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH
84
	 */
85
	String VMINSTALL = "vminstall"; //$NON-NLS-1$
86
87
	/**
88
	 * Launch configuration attribute key. The value is a string specifying
89
	 * the user-entered bootstrap classpath entries. 
90
	 */
91
	String BOOTSTRAP_ENTRIES = "bootstrap"; //$NON-NLS-1$
92
93
	/**
94
	 * Launch configuration attribute key. The value is a boolean specifying
95
	 * if the default self-hosting mode should be used when launching.
96
	 * The default being to launch with all workspace plug-ins and all the 
97
	 * plug-ins that are explicitly checked on the Target Platform preference page.
98
	 */
99
	String USE_DEFAULT = "default"; //$NON-NLS-1$
100
101
	/**
102
	 * Launch configuration attribute key. The value is a boolean specifying
103
	 * if the feature-based self-hosting mode should be used.
104
	 * The workspace must be set up properly for the feature-based self-hosting
105
	 * to succeed.
106
	 * Check the PDE Tips and Tricks section for how to set up feature-based self-hosting.
107
	 */
108
	String USEFEATURES = "usefeatures"; //$NON-NLS-1$
109
110
	/**
111
	 * Launch configuration attribute key. The value is a string specifying
112
	 * a comma-separated list of IDs of workspace plug-ins to launch with.
113
	 * This value is only used when the Automatic Add option is off.
114
	 * 
115
	 * @see IPDELauncherConstants#AUTOMATIC_ADD
116
	 */
117
	String SELECTED_WORKSPACE_PLUGINS = "selected_workspace_plugins"; //$NON-NLS-1$
118
119
	/**
120
	 * Launch configuration attribute key. The value is a string specifying
121
	 * a comma-separated list of IDs of workspace plug-ins that are to be excluded from
122
	 * the launch.
123
	 * This value is only used when the Automatic Add option is on.
124
	 * 
125
	 * @see IPDELauncherConstants#AUTOMATIC_ADD
126
	 */
127
	String DESELECTED_WORKSPACE_PLUGINS = "deselected_workspace_plugins"; //$NON-NLS-1$
128
129
	/**
130
	 * Launch configuration attribute key. The value is a boolean specifying
131
	 * whether workspace plug-in created after the creation of a launch configuration
132
	 * should be added to the list of plug-ins to launch with.
133
	 * 
134
	 * If the value is <code>true</code>, then DESELECTED_WORKSPACE_PLUGINS should be used.
135
	 * Otherwise, SELECTED_WORKSPACE_PLUGINS should be used.
136
	 * 
137
	 * @see IPDELauncherConstants#DESELECTED_WORKSPACE_PLUGINS
138
	 * @see IPDELauncherConstants#SELECTED_WORKSPACE_PLUGINS
139
	 */
140
	String AUTOMATIC_ADD = "automaticAdd"; //$NON-NLS-1$
141
142
	/**
143
	 * Launch configuration attribute key. The value is a boolean specifying
144
	 * whether the list of plug-ins to run should be validate prior to launching.
145
	 * If problems are found, they will be reported and the user will be able to cancel or
146
	 * continue.
147
	 * If no problems are found, the launch continues as normal.
148
	 */
149
	String AUTOMATIC_VALIDATE = "automaticValidate"; //$NON-NLS-1$
150
151
	/**
152
	 * Launch configuration attribute key. The value is a string specifying
153
	 * a comma-separated list of IDs of target platform plug-ins to launch with.
154
	 * This value is only used when the Automatic Add option is off.
155
	 */
156
	String SELECTED_TARGET_PLUGINS = "selected_target_plugins"; //$NON-NLS-1$
157
158
	/**
159
	 * Launch configuration attribute key. The value is a boolean indicating
160
	 * whether the computation of required plug-ins on the Plug-ins tab should include
161
	 * the traversal of optional dependencies.
162
	 */
163
	String INCLUDE_OPTIONAL = "includeOptional"; //$NON-NLS-1$
164
165
	/**
166
	 * Launch configuration attribute key. The value is a boolean indicating
167
	 * whether tracing is enabled or disabled.
168
	 */
169
	String TRACING = "tracing"; //$NON-NLS-1$
170
171
	/**
172
	 * Launch configuration attribute key. The value is a map containing the list
173
	 * of options to debug with.
174
	 */
175
	String TRACING_OPTIONS = "tracingOptions"; //$NON-NLS-1$
176
177
	/**
178
	 * Launch configuration attribute key. The value is the id of the last plug-in 
179
	 * that was selected on the Tracing tab.
180
	 */
181
	String TRACING_SELECTED_PLUGIN = "selectedPlugin"; //$NON-NLS-1$
182
183
	/**
184
	 * Launch configuration attribute key. The value is the IDs of all plug-ins
185
	 * checked on the Tracing tab.  The value may also be "[NONE]"
186
	 * 
187
	 * @see IPDELauncherConstants#TRACING_NONE
188
	 */
189
	String TRACING_CHECKED = "checked"; //$NON-NLS-1$
190
191
	/**
192
	 * Launch configuration attribute value indicating that, although tracing is enabled,
193
	 * no plug-ins have been selected to be traced.
194
	 */
195
	String TRACING_NONE = "[NONE]"; //$NON-NLS-1$
196
197
	/**
198
	 * Launch configuration attribute key. The value is a boolean specifying 
199
	 * if PDE should generate a default configuration area for the launch.
200
	 * 
201
	 * If <code>true</code>, a configuration location in the PDE metadata area 
202
	 * is created.  Otherwise, the user is expected to specify a location.
203
	 * 
204
	 * @see IPDELauncherConstants#CONFIG_LOCATION
205
	 */
206
	String CONFIG_USE_DEFAULT_AREA = "useDefaultConfigArea"; //$NON-NLS-1$
207
208
	/**
209
	 * Launch configuration attribute key. The value is a string specifying 
210
	 * the configuration area location for an Eclipse application launch.
211
	 * 
212
	 * This key is only used when CONFIG_USE_DEFAULT_AREA is <code>false</code>.
213
	 * 
214
	 * @see IPDELauncherConstants#CONFIG_USE_DEFAULT_AREA
215
	 */
216
	String CONFIG_LOCATION = "configLocation"; //$NON-NLS-1$
217
218
	/**
219
	 * Launch configuration attribute key. The value is a boolean specifying 
220
	 * if the configuration area location should be cleared prior to launching
221
	*/
222
	String CONFIG_CLEAR_AREA = "clearConfig"; //$NON-NLS-1$
223
224
	/**
225
	 * Launch configuration atribute key.  The value is a boolean specifying
226
	 * if PDE should generate a default config.ini file for the launch.
227
	 * 
228
	 * If <code>true</code>, a configuration file is created.  
229
	 * Otherwise, the user is expected to specify a config.ini to be used as a template.
230
	 * 
231
	 * @see IPDELauncherConstants#CONFIG_TEMPLATE_LOCATION
232
	 */
233
	String CONFIG_GENERATE_DEFAULT = "useDefaultConfig"; //$NON-NLS-1$
234
235
	/**
236
	 * Launch configuration attribute key. The value is a string specifying 
237
	 * the location of the config.ini file to be used as a template for an 
238
	 * Eclipse application launch.
239
	 * 
240
	 * This key is only used when CONFIG_GENERATE_DEFAULT is <code>false</code>.
241
	 * 
242
	 * @see IPDELauncherConstants#CONFIG_GENERATE_DEFAULT
243
	 */
244
	String CONFIG_TEMPLATE_LOCATION = "templateConfig"; //$NON-NLS-1$
245
246
	/**
247
	 * Launch configuration attribute key. The value is a string specifying 
248
	 * the location of the .product file with which this launch configuration 
249
	 * is associated.
250
	 */
251
	String PRODUCT_FILE = "productFile"; //$NON-NLS-1$
252
253
	/**
254
	 * Launch configuration attribute key.  The value is the ID of an OSGi framework
255
	 * declared in an <code>org.eclipse.pde.ui.osgiLaunchers</code> extension point.
256
	 * 
257
	 * @since 3.3
258
	 */
259
	String OSGI_FRAMEWORK_ID = "osgi_framework_id"; //$NON-NLS-1$
260
261
	/**
262
	 * Launch configuration attribute key.  The value is a boolean specifying
263
	 * if the default Auto-Start for an OSGi Framework launch configuration 
264
	 * is <code>true</code> or <code>false</code>
265
	 * 
266
	 * @see IPDELauncherConstants#DEFAULT_START_LEVEL
267
	 */
268
	String DEFAULT_AUTO_START = "default_auto_start"; //$NON-NLS-1$
269
270
	/**
271
	 * Launch configuration attribute key.  The value is an integer specifying
272
	 * the default start level for bundles in an OSGi Framework launch configuration.
273
	 * 
274
	 * @see IPDELauncherConstants#DEFAULT_AUTO_START
275
	 */
276
	String DEFAULT_START_LEVEL = "default_start_level"; //$NON-NLS-1$
277
278
	/**
279
	 * Launch configuration attribute key.  The value is a comma-separated list
280
	 * of workspace bundles to launch with the OSGi framework.
281
	 * 
282
	 * Each token in the list is of the format:
283
	 * <plugin-id>@<start-level>:<auto-start>
284
	 * 
285
	 * @see IPDELauncherConstants#DEFAULT_AUTO_START
286
	 * @see IPDELauncherConstants#DEFAULT_START_LEVEL
287
	 */
288
	String WORKSPACE_BUNDLES = "workspace_bundles"; //$NON-NLS-1$
289
290
	/**
291
	 * Launch configuration attribute key.  The value is a comma-separated list
292
	 * of non-workspace bundles to launch with the OSGi framework.
293
	 * 
294
	 * Each token in the list is of the format:
295
	 * <plugin-id>@<start-level>:<auto-start>
296
	 * 
297
	 * @see IPDELauncherConstants#DEFAULT_AUTO_START
298
	 * @see IPDELauncherConstants#DEFAULT_START_LEVEL
299
	 */
300
	String TARGET_BUNDLES = "target_bundles"; //$NON-NLS-1$
301
302
	/**
303
	 * Launch configuration attribute key.  The value can be either the full path
304
	 * to the workspace location of a Target Definition (ie. .target file), or
305
	 * the ID of a target defined in an org.eclipse.pde.core.targets extension.
306
	 */
307
	String DEFINED_TARGET = "defined_target"; //$NON-NLS-1$
308
309
	/**
310
	 * Launch configuration attribute key. The value is a boolean indicating
311
	 * whether or not to display only selected plug-ins. 
312
	 * 
313
	 * @since 3.4
314
	 */
315
	String SHOW_SELECTED_ONLY = "show_selected_only"; //$NON-NLS-1$
316
317
	/**
318
	 * The unique tab identifier for the bundles tab
319
	 * 
320
	 * @since 3.5
321
	 * @see BundlesTab
322
	 */
323
	String TAB_BUNDLES_ID = "org.eclipse.pde.ui.launch.tab.osgi.bundles"; //$NON-NLS-1$
324
325
	/**
326
	 * The unique tab identifier for the configuration tab
327
	 * 
328
	 * @since 3.5
329
	 * @see ConfigurationTab
330
	 */
331
	String TAB_CONFIGURATION_ID = "org.eclipse.pde.ui.launch.tab.configuration"; //$NON-NLS-1$
332
333
	/**
334
	 * The unique tab identifier for the main tab
335
	 * 
336
	 * @since 3.5
337
	 * @see MainTab
338
	 */
339
	String TAB_MAIN_ID = "org.eclipse.pde.ui.launch.tab.main"; //$NON-NLS-1$
340
341
	/**
342
	 * The unique tab identifier for the osgi settings tab
343
	 * 
344
	 * @since 3.5
345
	 * @see OSGiSettingsTab
346
	 */
347
	String TAB_OSGI_SETTINGS_ID = "org.eclipse.pde.ui.launch.tab.osgi.settings"; //$NON-NLS-1$
348
349
	/**
350
	 * The unique tab identifier for the plug-in junit tab
351
	 * 
352
	 * @since 3.5
353
	 * @see PluginJUnitMainTab
354
	 */
355
	String TAB_PLUGIN_JUNIT_MAIN_ID = "org.eclipse.pde.ui.launch.tab.junit.main"; //$NON-NLS-1$
356
357
	/**
358
	 * The unique tab identifier for the plug-ins tab
359
	 * 
360
	 * @since 3.5
361
	 * @see PluginsTab
362
	 */
363
	String TAB_PLUGINS_ID = "org.eclipse.pde.ui.launch.tab.plugins"; //$NON-NLS-1$
364
365
	/**
366
	 * The unique tab identifier for the tracing tab
367
	 * 
368
	 * @since 3.5
369
	 * @see TracingTab
370
	 */
371
	String TAB_TRACING_ID = "org.eclipse.pde.ui.launch.tab.tracing"; //$NON-NLS-1$
372
373
	/**
374
	 * The unique tab identifier for the tracing tab
375
	 * 
376
	 * @since 3.5
377
	 * @see TestTab
378
	 */
379
	String TAB_TEST_ID = "org.eclipse.pde.ui.launch.tab.test"; //$NON-NLS-1$
380
381
	/**
382
	 * The launch configuration type id for OSGi launches.
383
	 * 
384
	 * @since 3.5
385
	 * @see OSGiLaunchShortcut
386
	 */
387
	String OSGI_CONFIGURATION_TYPE = "org.eclipse.pde.ui.EquinoxLauncher"; //$NON-NLS-1$
388
389
	/**
390
	 * Launch configuration attribute key. The value is a boolean specifying 
391
	 * whether the tests should run on the UI thread.
392
	 * 
393
	 * The default value is <code>true</code>
394
	 * 
395
	 * @since 3.5
396
	 */
397
	String RUN_IN_UI_THREAD = "run_in_ui_thread"; //$NON-NLS-1$
398
}
0
  + text/plain
399
  + text/plain
1
  + *
400
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/PDELaunchingPlugin.java (+201 lines)
Line 0 Link Here
1
package org.eclipse.pde.launching.launcher;
2
3
import org.eclipse.pde.internal.launching.IPDEConstants;
4
import org.eclipse.pde.internal.launching.launcher.*;
5
6
import java.lang.reflect.InvocationTargetException;
7
import java.net.URL;
8
import java.util.Hashtable;
9
import org.eclipse.core.resources.IWorkspace;
10
import org.eclipse.core.resources.ResourcesPlugin;
11
import org.eclipse.core.runtime.*;
12
import org.eclipse.debug.core.DebugPlugin;
13
import org.eclipse.debug.core.ILaunchConfigurationListener;
14
import org.eclipse.pde.internal.core.PDEPreferencesManager;
15
import org.osgi.framework.*;
16
17
public class PDELaunchingPlugin extends Plugin implements IPDEConstants {
18
19
	// Shared instance
20
	private static PDELaunchingPlugin fInstance;
21
22
	private BundleContext fBundleContext;
23
24
	private Hashtable fCounters;
25
26
	private IPDELauncherSettings launcherSettings;
27
28
	/**
29
	 * Utility class to help setup the launch configuration listener
30
	 * without loading the debug plugin
31
	 */
32
	private DebugPluginUtil fDebugPluginUtil;
33
34
	/**
35
	 * The shared text file document provider.
36
	 * @since 3.2
37
	 */
38
	private OSGiFrameworkManager fOSGiFrameworkManager;
39
40
	private PDEPreferencesManager fPreferenceManager;
41
42
	public PDELaunchingPlugin() {
43
		fInstance = this;
44
	}
45
46
	public PDEPreferencesManager getPreferenceManager() {
47
		if (fPreferenceManager == null) {
48
			fPreferenceManager = new PDEPreferencesManager(PLUGIN_ID);
49
		}
50
		return fPreferenceManager;
51
	}
52
53
	public URL getInstallURL() {
54
		return getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
55
	}
56
57
	public static PDELaunchingPlugin getDefault() {
58
		return fInstance;
59
	}
60
61
	public Hashtable getDefaultNameCounters() {
62
		if (fCounters == null)
63
			fCounters = new Hashtable();
64
		return fCounters;
65
	}
66
67
	public static String getPluginId() {
68
		return getDefault().getBundle().getSymbolicName();
69
	}
70
71
	public static IWorkspace getWorkspace() {
72
		return ResourcesPlugin.getWorkspace();
73
	}
74
75
	public static void log(IStatus status) {
76
		ResourcesPlugin.getPlugin().getLog().log(status);
77
	}
78
79
	public static void logErrorMessage(String message) {
80
		log(new Status(IStatus.ERROR, getPluginId(), IStatus.ERROR, message, null));
81
	}
82
83
	public static void log(Throwable e) {
84
		if (e instanceof InvocationTargetException)
85
			e = ((InvocationTargetException) e).getTargetException();
86
		IStatus status = null;
87
		if (e instanceof CoreException)
88
			status = ((CoreException) e).getStatus();
89
		else
90
			status = new Status(IStatus.ERROR, getPluginId(), IStatus.OK, e.getMessage(), e);
91
		log(status);
92
	}
93
94
	/* (non-Javadoc)
95
	 * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
96
	 */
97
	public void start(BundleContext context) throws Exception {
98
		super.start(context);
99
		fBundleContext = context;
100
		setupLaunchConfigurationListener();
101
	}
102
103
	/**
104
	 * Add the launch configuration listener if the debug plugin
105
	 * is started.  Otherwise, setup a bundle listener to install
106
	 * the listener when the debug plugin loads.
107
	 * @param context bundle context needed to get current bundles
108
	 */
109
	private void setupLaunchConfigurationListener() {
110
		boolean listenerStarted = false;
111
		Bundle bundle = Platform.getBundle("org.eclipse.debug.core"); //$NON-NLS-1$
112
		if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
113
			fDebugPluginUtil = new DebugPluginUtil();
114
			fDebugPluginUtil.addListener();
115
			listenerStarted = true;
116
		}
117
		if (!listenerStarted) {
118
			fBundleContext.addBundleListener(new BundleListener() {
119
				public void bundleChanged(BundleEvent event) {
120
					if (event.getType() == BundleEvent.STARTED && "org.eclipse.debug.core".equals(event.getBundle().getSymbolicName())) { //$NON-NLS-1$
121
						fDebugPluginUtil = new DebugPluginUtil();
122
						fDebugPluginUtil.addListener();
123
						fBundleContext.removeBundleListener(this);
124
					}
125
				}
126
			});
127
		}
128
	}
129
130
	public BundleContext getBundleContext() {
131
		return fBundleContext;
132
	}
133
134
	/* (non-Javadoc)
135
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
136
	 */
137
	public void stop(BundleContext context) throws Exception {
138
//		if (fLaunchListener != null)
139
//			fLaunchListener.shutdown();
140
//		if (fFormColors != null) {
141
//			fFormColors.dispose();
142
//			fFormColors = null;
143
//		}
144
//		if (fLabelProvider != null) {
145
//			fLabelProvider.dispose();
146
//			fLabelProvider = null;
147
//		}
148
		if (fDebugPluginUtil != null) {
149
			fDebugPluginUtil.removeListener();
150
		}
151
		getLauncherUtils().shutdown();
152
		super.stop(context);
153
	}
154
155
	public IPDELaunchListener getLaunchListener() {
156
		return getLauncherSettings().getLaunchListener();
157
	}
158
159
	public OSGiFrameworkManager getOSGiFrameworkManager() {
160
		if (fOSGiFrameworkManager == null)
161
			fOSGiFrameworkManager = new OSGiFrameworkManager();
162
		return fOSGiFrameworkManager;
163
	}
164
165
	public void setLauncherSettings(IPDELauncherSettings launcherSettings) {
166
		this.launcherSettings = launcherSettings;
167
	}
168
169
	public IPDELauncherSettings getLauncherSettings() {
170
		if (launcherSettings == null)
171
			launcherSettings = new HeadlessPDELauncherSettings();
172
		return launcherSettings;
173
	}
174
175
	public ILauncherUtils getLauncherUtils() {
176
		return getLauncherSettings().getLauncherUtils();
177
	}
178
179
	/**
180
	 * Utility class that creates and controls a the PDE launch configuration listener.
181
	 * This is done in a separate class to avoid loading the debug plugin.
182
	 * @since 3.4
183
	 */
184
	private class DebugPluginUtil {
185
		private ILaunchConfigurationListener fLaunchConfigurationListener;
186
187
		public void addListener() {
188
			if (fLaunchConfigurationListener == null) {
189
				fLaunchConfigurationListener = new LaunchConfigurationListener();
190
			}
191
			DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(fLaunchConfigurationListener);
192
		}
193
194
		public void removeListener() {
195
			if (fLaunchConfigurationListener != null) {
196
				DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(fLaunchConfigurationListener);
197
				fLaunchConfigurationListener = null;
198
			}
199
		}
200
	}
201
}
0
  + text/plain
202
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/PDESourcePathProvider.java (+147 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2006, 2008 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.launching.launcher;
12
13
import org.eclipse.pde.internal.launching.launcher.LaunchPluginValidator;
14
import org.eclipse.pde.internal.launching.launcher.VMHelper;
15
16
import java.util.ArrayList;
17
import java.util.List;
18
19
import org.eclipse.core.resources.IProject;
20
import org.eclipse.core.resources.IResource;
21
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.IPath;
23
import org.eclipse.core.runtime.Path;
24
import org.eclipse.debug.core.ILaunchConfiguration;
25
import org.eclipse.jdt.core.IJavaProject;
26
import org.eclipse.jdt.core.IPackageFragmentRoot;
27
import org.eclipse.jdt.core.JavaCore;
28
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
29
import org.eclipse.jdt.launching.IVMInstall;
30
import org.eclipse.jdt.launching.JavaRuntime;
31
import org.eclipse.jdt.launching.StandardSourcePathProvider;
32
import org.eclipse.pde.internal.core.util.PDEJavaHelper;
33
34
/**
35
 * Generates a source lookup path for all PDE-based launch configurations
36
 * <p>
37
 * Clients may subclass this class.
38
 * </p>
39
 * @since 3.3
40
 */
41
public class PDESourcePathProvider extends StandardSourcePathProvider {
42
43
	public static final String ID = "org.eclipse.pde.ui.workbenchClasspathProvider"; //$NON-NLS-1$
44
45
	/*
46
	 * (non-Javadoc)
47
	 * @see org.eclipse.jdt.launching.StandardSourcePathProvider#computeUnresolvedClasspath(org.eclipse.debug.core.ILaunchConfiguration)
48
	 */
49
	public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration configuration) throws CoreException {
50
		List sourcePath = new ArrayList();
51
		sourcePath.add(getJREEntry(configuration));
52
		IProject[] projects = getJavaProjects(configuration);
53
		for (int i = 0; i < projects.length; i++) {
54
			sourcePath.add(JavaRuntime.newProjectRuntimeClasspathEntry(JavaCore.create(projects[i])));
55
		}
56
		return (IRuntimeClasspathEntry[]) sourcePath.toArray(new IRuntimeClasspathEntry[sourcePath.size()]);
57
	}
58
59
	/**
60
	 * Returns a JRE runtime classpath entry
61
	 * 
62
	 * @param configuration
63
	 * 			the launch configuration
64
	 * @return a JRE runtime classpath entry
65
	 * @throws CoreException
66
	 * 			if the JRE associated with the launch configuration cannot be found
67
	 * 			or if unable to retrieve the launch configuration attributes
68
	 */
69
	private IRuntimeClasspathEntry getJREEntry(ILaunchConfiguration configuration) throws CoreException {
70
		IVMInstall jre = VMHelper.createLauncher(configuration);
71
		IPath containerPath = new Path(JavaRuntime.JRE_CONTAINER);
72
		containerPath = containerPath.append(jre.getVMInstallType().getId());
73
		containerPath = containerPath.append(jre.getName());
74
		return JavaRuntime.newRuntimeContainerClasspathEntry(containerPath, IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
75
	}
76
77
	/**
78
	 * Returns an array of sorted plug-in projects that represent plug-ins participating
79
	 * in the launch
80
	 * 
81
	 * @param configuration
82
	 * 			the launch configuration
83
	 * @return an array of ordered projects
84
	 * @throws CoreException
85
	 * 			if unable to retrieve attributes from the launch configuration or if 
86
	 * 			an error occurs when checking the nature of the project
87
	 * 			
88
	 */
89
	private IProject[] getJavaProjects(ILaunchConfiguration configuration) throws CoreException {
90
		IProject[] projects = LaunchPluginValidator.getAffectedProjects(configuration);
91
		return PDELaunchingPlugin.getWorkspace().computeProjectOrder(projects).projects;
92
	}
93
94
	/*
95
	 * (non-Javadoc)
96
	 * @see org.eclipse.jdt.launching.StandardSourcePathProvider#resolveClasspath(org.eclipse.jdt.launching.IRuntimeClasspathEntry[], org.eclipse.debug.core.ILaunchConfiguration)
97
	 */
98
	public IRuntimeClasspathEntry[] resolveClasspath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) throws CoreException {
99
		List all = new ArrayList(entries.length);
100
		for (int i = 0; i < entries.length; i++) {
101
			if (entries[i].getType() == IRuntimeClasspathEntry.PROJECT) {
102
				// a project resolves to itself for source lookup (rather than
103
				// the class file output locations)
104
				all.add(entries[i]);
105
				// also add non-JRE libraries
106
				IResource resource = entries[i].getResource();
107
				if (resource instanceof IProject) {
108
					addBinaryPackageFragmentRoots(JavaCore.create((IProject) resource), all);
109
				}
110
			} else {
111
				IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveRuntimeClasspathEntry(entries[i], configuration);
112
				for (int j = 0; j < resolved.length; j++) {
113
					all.add(resolved[j]);
114
				}
115
			}
116
		}
117
		return (IRuntimeClasspathEntry[]) all.toArray(new IRuntimeClasspathEntry[all.size()]);
118
	}
119
120
	/**
121
	 * Adds runtime classpath entries for binary package fragment roots contained within
122
	 * the project
123
	 * 
124
	 * @param jProject
125
	 * 			the Java project whose roots are to be enumerated
126
	 * @param all
127
	 * 			a list of accumulated runtime classpath entries
128
	 * @throws CoreException
129
	 * 			if unable to evaluate the package fragment roots
130
	 */
131
	private void addBinaryPackageFragmentRoots(IJavaProject jProject, List all) throws CoreException {
132
		IPackageFragmentRoot[] roots = jProject.getPackageFragmentRoots();
133
		for (int j = 0; j < roots.length; j++) {
134
			if (roots[j].getKind() == IPackageFragmentRoot.K_BINARY && !PDEJavaHelper.isJRELibrary(roots[j])) {
135
				IRuntimeClasspathEntry rte = JavaRuntime.newArchiveRuntimeClasspathEntry(roots[j].getPath());
136
				IPath path = roots[j].getSourceAttachmentPath();
137
				if (path != null) {
138
					rte.setSourceAttachmentPath(path);
139
					rte.setSourceAttachmentRootPath(roots[j].getSourceAttachmentRootPath());
140
				}
141
				if (!all.contains(rte))
142
					all.add(rte);
143
			}
144
		}
145
146
	}
147
}
0
  + text/plain
148
  + text/plain
1
  + *
149
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/IPDELaunchListener.java (+11 lines)
Line 0 Link Here
1
package org.eclipse.pde.launching.launcher;
2
3
import org.eclipse.debug.core.ILaunch;
4
5
public interface IPDELaunchListener {
6
7
	void manage(ILaunch launch);
8
9
	public void shutdown();
10
	
11
}
0
  + text/plain
12
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/IPDELaunchConfigurationHelper.java (+9 lines)
Line 0 Link Here
1
package org.eclipse.pde.launching.launcher;
2
3
import org.eclipse.core.runtime.CoreException;
4
5
public interface IPDELaunchConfigurationHelper {
6
7
	void handleCoreException(CoreException e);
8
9
}
0
  + text/plain
10
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/IPDELauncherSettings.java (+15 lines)
Line 0 Link Here
1
package org.eclipse.pde.launching.launcher;
2
3
import org.eclipse.pde.internal.launching.launcher.IEclipsePluginValidationOperationHelper;
4
5
public interface IPDELauncherSettings {
6
7
	ILauncherUtils getLauncherUtils();
8
9
	IPDELaunchListener getLaunchListener();
10
11
	IEclipsePluginValidationOperationHelper getEclipsePluginValidationOperationHelper();
12
13
	IPDELaunchConfigurationHelper getPDELaunchConfigurationHelper();
14
	
15
}
0
  + text/plain
16
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/JUnitLaunchConfigurationDelegate.java (+494 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *     David Saff <saff@mit.edu> - bug 102632
12
 *     Ketan Padegaonkar <KetanPadegaonkar@gmail.com> - bug 250340
13
 *******************************************************************************/
14
package org.eclipse.pde.launching.launcher;
15
16
import org.eclipse.pde.internal.launching.IPDEConstants;
17
import org.eclipse.pde.internal.launching.PDEMessages;
18
import org.eclipse.pde.internal.launching.launcher.*;
19
20
import java.io.File;
21
import java.util.*;
22
import org.eclipse.core.resources.IProject;
23
import org.eclipse.core.runtime.*;
24
import org.eclipse.debug.core.*;
25
import org.eclipse.jdt.core.IJavaProject;
26
import org.eclipse.jdt.internal.junit.launcher.*;
27
import org.eclipse.jdt.launching.*;
28
import org.eclipse.osgi.service.resolver.BundleDescription;
29
import org.eclipse.osgi.util.NLS;
30
import org.eclipse.pde.core.plugin.*;
31
import org.eclipse.pde.internal.core.*;
32
import org.eclipse.pde.internal.core.util.CoreUtility;
33
import org.eclipse.pde.internal.core.util.VersionUtil;
34
import org.osgi.framework.Version;
35
36
/**
37
 * A launch delegate for launching JUnit Plug-in tests.
38
 *
39
 * @since 3.3
40
 */
41
public class JUnitLaunchConfigurationDelegate extends org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate {
42
43
	/**
44
	 * To avoid duplicating variable substitution (and duplicate prompts)
45
	 * this variable will store the substituted workspace location.
46
	 */
47
	private String fWorkspaceLocation;
48
49
	protected File fConfigDir = null;
50
51
	// used to generate the dev classpath entries
52
	// key is bundle ID, value is a model
53
	private Map fAllBundles;
54
55
	// key is a model, value is startLevel:autoStart
56
	private Map fModels;
57
58
	/*
59
	 * (non-Javadoc)
60
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getVMRunner(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
61
	 */
62
	public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException {
63
		IVMInstall launcher = VMHelper.createLauncher(configuration);
64
		return launcher.getVMRunner(mode);
65
	}
66
67
	/* (non-Javadoc)
68
	 * @see org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate#verifyMainTypeName(org.eclipse.debug.core.ILaunchConfiguration)
69
	 */
70
	public String verifyMainTypeName(ILaunchConfiguration configuration) throws CoreException {
71
		if (TargetPlatformHelper.getTargetVersion() >= 3.3)
72
			return "org.eclipse.equinox.launcher.Main"; //$NON-NLS-1$
73
		return "org.eclipse.core.launcher.Main"; //$NON-NLS-1$
74
	}
75
76
	private String getTestPluginId(ILaunchConfiguration configuration) throws CoreException {
77
		IJavaProject javaProject = getJavaProject(configuration);
78
		IPluginModelBase model = PluginRegistry.findModel(javaProject.getProject());
79
		if (model == null)
80
			abort(NLS.bind(PDEMessages.JUnitLaunchConfiguration_error_notaplugin, javaProject.getProject().getName()), null, IStatus.OK);
81
		if (model instanceof IFragmentModel)
82
			return ((IFragmentModel) model).getFragment().getPluginId();
83
84
		return model.getPluginBase().getId();
85
	}
86
87
	/*
88
	 * (non-Javadoc)
89
	 * @see org.eclipse.jdt.internal.junit.launcher.JUnitBaseLaunchConfiguration#abort(java.lang.String, java.lang.Throwable, int)
90
	 */
91
	protected void abort(String message, Throwable exception, int code) throws CoreException {
92
		throw new CoreException(new Status(IStatus.ERROR, IPDEConstants.PLUGIN_ID, code, message, exception));
93
	}
94
95
	/* (non-Javadoc)
96
	 * @see org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate#collectExecutionArguments(org.eclipse.debug.core.ILaunchConfiguration, java.util.List, java.util.List)
97
	 */
98
	protected void collectExecutionArguments(ILaunchConfiguration configuration, List/*String*/vmArguments, List/*String*/programArgs) throws CoreException {
99
		super.collectExecutionArguments(configuration, vmArguments, programArgs);
100
101
		// Specify the JUnit Plug-in test application to launch
102
		programArgs.add("-application"); //$NON-NLS-1$
103
		String application = getApplication(configuration);
104
105
		programArgs.add(application);
106
107
		// If a product is specified, then add it to the program args
108
		if (configuration.getAttribute(IPDELauncherConstants.USE_PRODUCT, false)) {
109
			programArgs.add("-product"); //$NON-NLS-1$
110
			programArgs.add(configuration.getAttribute(IPDELauncherConstants.PRODUCT, "")); //$NON-NLS-1$
111
		} else {
112
			// Specify the application to test
113
			String defaultApplication = IPDEConstants.CORE_TEST_APPLICATION.equals(application) ? null : TargetPlatform.getDefaultApplication();
114
			String testApplication = configuration.getAttribute(IPDELauncherConstants.APP_TO_TEST, defaultApplication);
115
			if (testApplication != null) {
116
				programArgs.add("-testApplication"); //$NON-NLS-1$
117
				programArgs.add(testApplication);
118
			}
119
		}
120
121
		// Specify the location of the runtime workbench
122
		if (fWorkspaceLocation == null) {
123
			fWorkspaceLocation = LaunchArgumentsHelper.getWorkspaceLocation(configuration);
124
		}
125
		if (fWorkspaceLocation.length() > 0) {
126
			programArgs.add("-data"); //$NON-NLS-1$
127
			programArgs.add(fWorkspaceLocation);
128
		}
129
130
		// Create the platform configuration for the runtime workbench
131
		String productID = LaunchConfigurationHelper.getProductID(configuration);
132
		LaunchConfigurationHelper.createConfigIniFile(configuration, productID, fAllBundles, fModels, getConfigurationDirectory(configuration));
133
		String brandingId = LaunchConfigurationHelper.getContributingPlugin(productID);
134
		TargetPlatform.createPlatformConfiguration(getConfigurationDirectory(configuration), (IPluginModelBase[]) fAllBundles.values().toArray(new IPluginModelBase[fAllBundles.size()]), brandingId != null ? (IPluginModelBase) fAllBundles.get(brandingId) : null);
135
		TargetPlatformHelper.checkPluginPropertiesConsistency(fAllBundles, getConfigurationDirectory(configuration));
136
137
		programArgs.add("-configuration"); //$NON-NLS-1$
138
		programArgs.add("file:" + new Path(getConfigurationDirectory(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$
139
140
		// Specify the output folder names
141
		programArgs.add("-dev"); //$NON-NLS-1$
142
		programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigurationDirectory(configuration).toString() + "/dev.properties", fAllBundles)); //$NON-NLS-1$
143
144
		// necessary for PDE to know how to load plugins when target platform = host platform
145
		// see PluginPathFinder.getPluginPaths()
146
		IPluginModelBase base = findPlugin(PDECore.PLUGIN_ID);
147
		if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) < 0) //$NON-NLS-1$
148
			programArgs.add("-pdelaunch"); //$NON-NLS-1$				
149
150
		// Create the .options file if tracing is turned on
151
		if (configuration.getAttribute(IPDELauncherConstants.TRACING, false) && !IPDELauncherConstants.TRACING_NONE.equals(configuration.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null))) {
152
			programArgs.add("-debug"); //$NON-NLS-1$
153
			String path = getConfigurationDirectory(configuration).getPath() + IPath.SEPARATOR + ".options"; //$NON-NLS-1$
154
			programArgs.add(LaunchArgumentsHelper.getTracingFileArgument(configuration, path));
155
		}
156
157
		// add the program args specified by the user
158
		String[] userArgs = LaunchArgumentsHelper.getUserProgramArgumentArray(configuration);
159
		for (int i = 0; i < userArgs.length; i++) {
160
			// be forgiving if people have tracing turned on and forgot
161
			// to remove the -debug from the program args field.
162
			if (userArgs[i].equals("-debug") && programArgs.contains("-debug")) //$NON-NLS-1$ //$NON-NLS-2$
163
				continue;
164
			programArgs.add(userArgs[i]);
165
		}
166
167
		if (!configuration.getAttribute(IPDEConstants.APPEND_ARGS_EXPLICITLY, false)) {
168
			if (!programArgs.contains("-os")) { //$NON-NLS-1$
169
				programArgs.add("-os"); //$NON-NLS-1$
170
				programArgs.add(TargetPlatform.getOS());
171
			}
172
			if (!programArgs.contains("-ws")) { //$NON-NLS-1$
173
				programArgs.add("-ws"); //$NON-NLS-1$
174
				programArgs.add(TargetPlatform.getWS());
175
			}
176
			if (!programArgs.contains("-arch")) { //$NON-NLS-1$
177
				programArgs.add("-arch"); //$NON-NLS-1$
178
				programArgs.add(TargetPlatform.getOSArch());
179
			}
180
		}
181
182
		programArgs.add("-testpluginname"); //$NON-NLS-1$
183
		programArgs.add(getTestPluginId(configuration));
184
	}
185
186
	/**
187
	 * Returns the application to launch plug-in tests with
188
	 * 
189
	 * @since 3.5
190
	 * 
191
	 * @param configuration
192
	 * @return the application
193
	 */
194
	protected String getApplication(ILaunchConfiguration configuration) {
195
		String application = null;
196
197
		boolean shouldRunInUIThread = true;
198
		try {
199
			shouldRunInUIThread = configuration.getAttribute(IPDELauncherConstants.RUN_IN_UI_THREAD, true);
200
		} catch (CoreException e) {
201
		}
202
203
		if (!shouldRunInUIThread) {
204
			return IPDEConstants.NON_UI_THREAD_APPLICATION;
205
		}
206
207
		try {
208
			// if application is set, it must be a headless app.
209
			application = configuration.getAttribute(IPDELauncherConstants.APPLICATION, (String) null);
210
		} catch (CoreException e) {
211
		}
212
213
		// if application is not set, we should launch the default UI test app
214
		// Check to see if we should launch the legacy UI app
215
		if (application == null) {
216
			IPluginModelBase model = (IPluginModelBase) fAllBundles.get("org.eclipse.pde.junit.runtime"); //$NON-NLS-1$
217
			BundleDescription desc = model != null ? model.getBundleDescription() : null;
218
			if (desc != null) {
219
				Version version = desc.getVersion();
220
				int major = version.getMajor();
221
				// launch legacy UI app only if we are launching a target that does 
222
				// not use the new application model and we are launching with a 
223
				// org.eclipse.pde.junit.runtime whose version is >= 3.3
224
				if (major >= 3 && version.getMinor() >= 3 && !TargetPlatformHelper.usesNewApplicationModel()) {
225
					application = IPDEConstants.LEGACY_UI_TEST_APPLICATION;
226
				}
227
			}
228
		}
229
230
		// launch the UI test application
231
		if (application == null)
232
			application = IPDEConstants.UI_TEST_APPLICATION;
233
		return application;
234
	}
235
236
	private IPluginModelBase findPlugin(String id) throws CoreException {
237
		IPluginModelBase model = PluginRegistry.findModel(id);
238
		if (model == null)
239
			model = PDECore.getDefault().findPluginInHost(id);
240
		if (model == null)
241
			abort(NLS.bind(PDEMessages.JUnitLaunchConfiguration_error_missingPlugin, id), null, IStatus.OK);
242
		return model;
243
	}
244
245
	/*
246
	 * (non-Javadoc)
247
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration)
248
	 */
249
	public String getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
250
		return LaunchArgumentsHelper.getUserProgramArguments(configuration);
251
	}
252
253
	/*
254
	 * (non-Javadoc)
255
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getVMArguments(org.eclipse.debug.core.ILaunchConfiguration)
256
	 */
257
	public String getVMArguments(ILaunchConfiguration configuration) throws CoreException {
258
		String vmArgs = LaunchArgumentsHelper.getUserVMArguments(configuration);
259
260
		// necessary for PDE to know how to load plugins when target platform = host platform
261
		IPluginModelBase base = (IPluginModelBase) fAllBundles.get(PDECore.PLUGIN_ID);
262
		if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) >= 0) { //$NON-NLS-1$
263
			vmArgs = concatArg(vmArgs, "-Declipse.pde.launch=true"); //$NON-NLS-1$
264
		}
265
		// For p2 target, add "-Declipse.p2.data.area=@config.dir/p2" unless already specified by user
266
		if (fAllBundles.containsKey("org.eclipse.equinox.p2.core")) { //$NON-NLS-1$
267
			if (vmArgs.indexOf("-Declipse.p2.data.area=") < 0) { //$NON-NLS-1$
268
				vmArgs = concatArg(vmArgs, "-Declipse.p2.data.area=@config.dir" + File.separator + "p2"); //$NON-NLS-1$ //$NON-NLS-2$
269
			}
270
		}
271
		return vmArgs;
272
	}
273
274
	/**
275
	 * Returns the result of concatenating the given argument to the
276
	 * specified vmArgs.
277
	 * 
278
	 * @param vmArgs existing VM arguments
279
	 * @param arg argument to concatenate
280
	 * @return result of concatenation
281
	 */
282
	private String concatArg(String vmArgs, String arg) {
283
		if (vmArgs.length() > 0 && !vmArgs.endsWith(" ")) //$NON-NLS-1$
284
			vmArgs = vmArgs.concat(" "); //$NON-NLS-1$
285
		return vmArgs.concat(arg);
286
	}
287
288
	/*
289
	 * (non-Javadoc)
290
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getEnvironment(org.eclipse.debug.core.ILaunchConfiguration)
291
	 */
292
	public String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException {
293
		return DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);
294
	}
295
296
	/*
297
	 * (non-Javadoc)
298
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getClasspath(org.eclipse.debug.core.ILaunchConfiguration)
299
	 */
300
	public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException {
301
		String[] classpath = LaunchArgumentsHelper.constructClasspath(configuration);
302
		if (classpath == null) {
303
			abort(PDEMessages.WorkbenchLauncherConfigurationDelegate_noStartup, null, IStatus.OK);
304
		}
305
		return classpath;
306
	}
307
308
	/*
309
	 * (non-Javadoc)
310
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getWorkingDirectory(org.eclipse.debug.core.ILaunchConfiguration)
311
	 */
312
	public File getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
313
		return LaunchArgumentsHelper.getWorkingDirectory(configuration);
314
	}
315
316
	/*
317
	 * (non-Javadoc)
318
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getVMSpecificAttributesMap(org.eclipse.debug.core.ILaunchConfiguration)
319
	 */
320
	public Map getVMSpecificAttributesMap(ILaunchConfiguration configuration) throws CoreException {
321
		return LaunchArgumentsHelper.getVMSpecificAttributesMap(configuration);
322
	}
323
324
	/*
325
	 * (non-Javadoc)
326
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#setDefaultSourceLocator(org.eclipse.debug.core.ILaunch, org.eclipse.debug.core.ILaunchConfiguration)
327
	 */
328
	protected void setDefaultSourceLocator(ILaunch launch, ILaunchConfiguration configuration) throws CoreException {
329
		ILaunchConfigurationWorkingCopy wc = null;
330
		if (configuration.isWorkingCopy()) {
331
			wc = (ILaunchConfigurationWorkingCopy) configuration;
332
		} else {
333
			wc = configuration.getWorkingCopy();
334
		}
335
		String id = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, (String) null);
336
		if (!PDESourcePathProvider.ID.equals(id)) {
337
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, PDESourcePathProvider.ID);
338
			wc.doSave();
339
		}
340
341
		manageLaunch(launch);
342
	}
343
344
	/**
345
	 * Returns the location of the configuration area
346
	 * 
347
	 * @param configuration
348
	 * 				the launch configuration
349
	 * @return a directory where the configuration area is located
350
	 */
351
	protected File getConfigurationDirectory(ILaunchConfiguration configuration) {
352
		if (fConfigDir == null)
353
			fConfigDir = LaunchConfigurationHelper.getConfigurationArea(configuration);
354
		return fConfigDir;
355
	}
356
357
	/*
358
	 * (non-Javadoc)
359
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
360
	 */
361
	protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
362
		return computeBuildOrder(LaunchPluginValidator.getAffectedProjects(configuration));
363
	}
364
365
	/*
366
	 * (non-Javadoc)
367
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getProjectsForProblemSearch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
368
	 */
369
	protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) throws CoreException {
370
		return LaunchPluginValidator.getAffectedProjects(configuration);
371
	}
372
373
	/**
374
	 * Adds a listener to the launch to be notified at interesting launch lifecycle
375
	 * events such as when the launch terminates.
376
	 * 
377
	 * @param launch
378
	 * 			the launch 			
379
	 */
380
	protected void manageLaunch(ILaunch launch) {
381
		PDELaunchingPlugin.getDefault().getLaunchListener().manage(launch);
382
	}
383
384
	/* (non-Javadoc)
385
	 * @see org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
386
	 */
387
	protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
388
		fWorkspaceLocation = null;
389
		fModels = BundleLauncherHelper.getMergedBundleMap(configuration, false);
390
		fAllBundles = new HashMap(fModels.size());
391
		Iterator iter = fModels.keySet().iterator();
392
		while (iter.hasNext()) {
393
			IPluginModelBase model = (IPluginModelBase) iter.next();
394
			fAllBundles.put(model.getPluginBase().getId(), model);
395
		}
396
397
		// implicitly add the plug-ins required for JUnit testing if necessary
398
		String[] requiredPlugins = getRequiredPlugins(configuration);
399
		for (int i = 0; i < requiredPlugins.length; i++) {
400
			String id = requiredPlugins[i];
401
			if (!fAllBundles.containsKey(id)) {
402
				IPluginModelBase model = findPlugin(id);
403
				fAllBundles.put(id, model);
404
				fModels.put(model, "default:default"); //$NON-NLS-1$
405
			}
406
		}
407
408
		boolean autoValidate = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, false);
409
		monitor.beginTask("", autoValidate ? 3 : 4); //$NON-NLS-1$
410
		if (autoValidate)
411
			validatePluginDependencies(configuration, new SubProgressMonitor(monitor, 1));
412
		validateProjectDependencies(configuration, new SubProgressMonitor(monitor, 1));
413
		clear(configuration, new SubProgressMonitor(monitor, 1));
414
		launch.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, getConfigurationDirectory(configuration).toString());
415
		synchronizeManifests(configuration, new SubProgressMonitor(monitor, 1));
416
	}
417
418
	private String[] getRequiredPlugins(ILaunchConfiguration configuration) {
419
		// if we are using JUnit4, we need to include the junit4 specific bundles
420
		ITestKind testKind = JUnitLaunchConfigurationConstants.getTestRunnerKind(configuration);
421
		if (TestKindRegistry.JUNIT4_TEST_KIND_ID.equals(testKind.getId()))
422
			return new String[] {"org.junit", "org.eclipse.jdt.junit.runtime", "org.eclipse.pde.junit.runtime", "org.junit4", "org.eclipse.jdt.junit4.runtime"}; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
423
		return new String[] {"org.junit", "org.eclipse.jdt.junit.runtime", "org.eclipse.pde.junit.runtime"}; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
424
	}
425
426
	/**
427
	 * Checks for old-style plugin.xml files that have become stale since the last launch.
428
	 * For any stale plugin.xml files found, the corresponding MANIFEST.MF is deleted 
429
	 * from the runtime configuration area so that it gets regenerated upon startup.
430
	 * 
431
	 * @param configuration
432
	 * 			the launch configuration
433
	 * @param monitor
434
	 * 			the progress monitor
435
	 */
436
	protected void synchronizeManifests(ILaunchConfiguration configuration, IProgressMonitor monitor) {
437
		LaunchConfigurationHelper.synchronizeManifests(configuration, getConfigurationDirectory(configuration));
438
		monitor.done();
439
	}
440
441
	/**
442
	 * Clears the workspace prior to launching if the workspace exists and the option to 
443
	 * clear it is turned on.  Also clears the configuration area if that option is chosen.
444
	 * 
445
	 * @param configuration
446
	 * 			the launch configuration
447
	 * @param monitor
448
	 * 			the progress monitor
449
	 * @throws CoreException
450
	 * 			if unable to retrieve launch attribute values
451
	 * @since 3.3
452
	 */
453
	protected void clear(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
454
		if (fWorkspaceLocation == null) {
455
			fWorkspaceLocation = LaunchArgumentsHelper.getWorkspaceLocation(configuration);
456
		}
457
		// Clear workspace and prompt, if necessary
458
		if (!PDELaunchingPlugin.getDefault().getLauncherUtils().clearWorkspace(configuration, fWorkspaceLocation, new SubProgressMonitor(monitor, 1))) {
459
			monitor.setCanceled(true);
460
			return;
461
		}
462
463
		// clear config area, if necessary
464
		if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false))
465
			CoreUtility.deleteContent(getConfigurationDirectory(configuration));
466
	}
467
468
	/**
469
	 * Checks if the Automated Management of Dependencies option is turned on.
470
	 * If so, it makes aure all manifests are updated with the correct dependencies.
471
	 * 
472
	 * @param configuration
473
	 * 			the launch configuration
474
	 * @param monitor
475
	 * 			a progress monitor
476
	 */
477
	protected void validateProjectDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) {
478
		PDELaunchingPlugin.getDefault().getLauncherUtils().validateProjectDependencies(configuration, monitor);
479
	}
480
481
	/**
482
	 * Validates inter-bundle dependencies automatically prior to launching
483
	 * if that option is turned on.
484
	 * 
485
	 * @param configuration
486
	 * 			the launch configuration
487
	 * @param monitor
488
	 * 			a progress monitor
489
	 */
490
	protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
491
		EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration, PDELaunchingPlugin.getDefault().getLauncherSettings().getEclipsePluginValidationOperationHelper());
492
		LaunchPluginValidator.runValidationOperation(op, monitor);
493
	}
494
}
0
  + text/plain
495
  + text/plain
1
  + *
496
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/OSGiLaunchConfigurationInitializer.java (+118 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.launching.launcher;
12
13
14
import org.eclipse.pde.launching.launcher.PDESourcePathProvider;
15
16
import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper;
17
18
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
19
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
20
import org.eclipse.pde.core.plugin.IPluginModelBase;
21
import org.eclipse.pde.core.plugin.PluginRegistry;
22
23
/**
24
 * Initializes launch configuration attributes for newly-created OSGi Framework 
25
 * launch configurations
26
 * 
27
 * <p>
28
 * Clients may instantiate or subclass this class
29
 * </p>
30
 * 
31
 * @since 3.3
32
 */
33
public class OSGiLaunchConfigurationInitializer {
34
35
	protected static final String DEFAULT = "default"; //$NON-NLS-1$
36
37
	/**
38
	 * Initializes some attributes on a newly-created launch configuration
39
	 * 
40
	 * @param configuration
41
	 * 			the launch configuration
42
	 */
43
	public void initialize(ILaunchConfigurationWorkingCopy configuration) {
44
		initializeFrameworkDefaults(configuration);
45
		initializeBundleState(configuration);
46
		initializeSourcePathProvider(configuration);
47
	}
48
49
	/**
50
	 * Sets the source provider ID
51
	 * 
52
	 * @param configuration
53
	 * 			the launch configuration
54
	 */
55
	protected void initializeSourcePathProvider(ILaunchConfigurationWorkingCopy configuration) {
56
		configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, PDESourcePathProvider.ID);
57
	}
58
59
	/**
60
	 * Initializes the start level and auto-start attributes
61
	 * 
62
	 * @param configuration
63
	 * 			the launch configuration
64
	 */
65
	protected void initializeFrameworkDefaults(ILaunchConfigurationWorkingCopy configuration) {
66
		configuration.setAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, true);
67
		configuration.setAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4);
68
	}
69
70
	/**
71
	 * Initializes the checked/unchecked state of bundles
72
	 * 
73
	 * @param configuration
74
	 * 			the launch configuration
75
	 */
76
	protected void initializeBundleState(ILaunchConfigurationWorkingCopy configuration) {
77
		StringBuffer explugins = new StringBuffer();
78
		StringBuffer wsplugins = new StringBuffer();
79
		IPluginModelBase[] models = PluginRegistry.getActiveModels();
80
		for (int i = 0; i < models.length; i++) {
81
			boolean inWorkspace = models[i].getUnderlyingResource() != null;
82
			appendBundle(inWorkspace ? wsplugins : explugins, models[i]);
83
		}
84
		configuration.setAttribute(IPDELauncherConstants.WORKSPACE_BUNDLES, wsplugins.toString());
85
		configuration.setAttribute(IPDELauncherConstants.TARGET_BUNDLES, explugins.toString());
86
		configuration.setAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true);
87
	}
88
89
	private void appendBundle(StringBuffer buffer, IPluginModelBase model) {
90
		if (buffer.length() > 0)
91
			buffer.append(","); //$NON-NLS-1$
92
		String id = model.getPluginBase().getId();
93
		String value = BundleLauncherHelper.writeBundleEntry(model, getStartLevel(id), getAutoStart(id));
94
		buffer.append(value);
95
	}
96
97
	/**
98
	 * Returns the bundle's start level
99
	 * 
100
	 * @param bundleID
101
	 * 			the bundle ID
102
	 * @return the start level for the given bundle or the string <code>default</code>
103
	 */
104
	protected String getStartLevel(String bundleID) {
105
		return DEFAULT;
106
	}
107
108
	/**
109
	 * Returns whether the bundle should be started automatically
110
	 * @param bundleID
111
	 * 			the bundle ID
112
	 * @return <code>true</code>, <code>false</code>, or <code>default</code>
113
	 */
114
	protected String getAutoStart(String bundleID) {
115
		return DEFAULT;
116
	}
117
118
}
0
  + text/plain
119
  + text/plain
1
  + *
120
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/ILauncherUtils.java (+25 lines)
Line 0 Link Here
1
package org.eclipse.pde.launching.launcher;
2
3
import org.eclipse.core.runtime.CoreException;
4
import org.eclipse.core.runtime.IProgressMonitor;
5
import org.eclipse.core.runtime.IStatus;
6
import org.eclipse.debug.core.ILaunchConfiguration;
7
8
public interface ILauncherUtils {
9
10
	boolean clearWorkspace(ILaunchConfiguration configuration, String workspace, IProgressMonitor monitor)
11
			throws CoreException;
12
13
	void validateProjectDependencies(ILaunchConfiguration launch, final IProgressMonitor monitor);
14
15
	void shutdown();
16
17
	boolean requiresUI(ILaunchConfiguration configuration);
18
19
	boolean clearWorkspaceLog(String workspace);
20
	
21
	IStatus createErrorStatus(String message);
22
23
	boolean generateConfigIni();
24
25
}
0
  + text/plain
26
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/ILauncherUtilsHelper.java (+19 lines)
Line 0 Link Here
1
package org.eclipse.pde.launching.launcher;
2
3
import java.util.ArrayList;
4
import java.util.Properties;
5
import org.eclipse.core.runtime.IProgressMonitor;
6
7
public interface ILauncherUtilsHelper {
8
9
	void handleWorkspaceLocked(String workspace);
10
11
	int doClearLog();
12
13
	int doDeleteWorkspace(String path);
14
15
	void organizeManifests(final ArrayList projects, final IProgressMonitor monitor, final Properties lastRun);
16
17
	boolean generateConfigIni();
18
19
}
0
  + text/plain
20
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/EclipseApplicationLaunchConfiguration.java (+290 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.launching.launcher;
13
14
import org.eclipse.pde.internal.launching.PDEMessages;
15
import org.eclipse.pde.internal.launching.launcher.*;
16
17
import java.io.File;
18
import java.util.*;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.core.variables.IStringVariableManager;
21
import org.eclipse.core.variables.VariablesPlugin;
22
import org.eclipse.debug.core.ILaunch;
23
import org.eclipse.debug.core.ILaunchConfiguration;
24
import org.eclipse.pde.core.plugin.IPluginModelBase;
25
import org.eclipse.pde.core.plugin.TargetPlatform;
26
import org.eclipse.pde.internal.core.*;
27
import org.eclipse.pde.internal.core.util.CoreUtility;
28
import org.eclipse.pde.internal.core.util.VersionUtil;
29
import org.osgi.framework.Version;
30
31
/**
32
 * A launch delegate for launching Eclipse applications
33
 * <p>
34
 * Clients may subclass and instantiate this class.
35
 * </p>
36
 * @since 3.2
37
 */
38
public class EclipseApplicationLaunchConfiguration extends AbstractPDELaunchConfiguration {
39
40
	// used to generate the dev classpath entries
41
	// key is bundle ID, value is a model
42
	private Map fAllBundles;
43
44
	// key is a model, value is startLevel:autoStart
45
	private Map fModels;
46
47
	/**
48
	 * To avoid duplicating variable substitution (and duplicate prompts)
49
	 * this variable will store the substituted workspace location.
50
	 */
51
	private String fWorkspaceLocation;
52
53
	/*
54
	 * (non-Javadoc)
55
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration)
56
	 */
57
	public String[] getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
58
		ArrayList programArgs = new ArrayList();
59
60
		// If a product is specified, then add it to the program args
61
		if (configuration.getAttribute(IPDELauncherConstants.USE_PRODUCT, false)) {
62
			String product = configuration.getAttribute(IPDELauncherConstants.PRODUCT, ""); //$NON-NLS-1$
63
			if (product.length() > 0) {
64
				programArgs.add("-product"); //$NON-NLS-1$
65
				programArgs.add(product);
66
			} else { // TODO product w/o an application and product... how to handle gracefully?
67
				programArgs.add("-application"); //$NON-NLS-1$
68
				programArgs.add(configuration.getAttribute(IPDELauncherConstants.APPLICATION, "")); //$NON-NLS-1$
69
			}
70
		} else {
71
			// specify the application to launch
72
			programArgs.add("-application"); //$NON-NLS-1$
73
			programArgs.add(configuration.getAttribute(IPDELauncherConstants.APPLICATION, TargetPlatform.getDefaultApplication()));
74
		}
75
76
		// specify the workspace location for the runtime workbench
77
		if (fWorkspaceLocation == null) {
78
			fWorkspaceLocation = LaunchArgumentsHelper.getWorkspaceLocation(configuration);
79
		}
80
		if (fWorkspaceLocation.length() > 0) {
81
			programArgs.add("-data"); //$NON-NLS-1$
82
			programArgs.add(fWorkspaceLocation);
83
		}
84
85
		boolean showSplash = true;
86
		if (configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false)) {
87
			validateFeatures();
88
			IPath installPath = PDELaunchingPlugin.getWorkspace().getRoot().getLocation();
89
			programArgs.add("-install"); //$NON-NLS-1$
90
			programArgs.add("file:" + installPath.removeLastSegments(1).addTrailingSeparator().toString()); //$NON-NLS-1$
91
			if (!configuration.getAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, true)) {
92
				programArgs.add("-configuration"); //$NON-NLS-1$
93
				programArgs.add("file:" + new Path(getConfigDir(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$
94
			}
95
			programArgs.add("-update"); //$NON-NLS-1$
96
			// add the output folder names
97
			programArgs.add("-dev"); //$NON-NLS-1$
98
			programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigDir(configuration).toString() + "/dev.properties", true)); //$NON-NLS-1$
99
		} else {
100
			String productID = LaunchConfigurationHelper.getProductID(configuration);
101
			Properties prop = LaunchConfigurationHelper.createConfigIniFile(configuration, productID, fAllBundles, fModels, getConfigDir(configuration));
102
			showSplash = prop.containsKey("osgi.splashPath") || prop.containsKey("splashLocation"); //$NON-NLS-1$ //$NON-NLS-2$
103
			String brandingId = LaunchConfigurationHelper.getContributingPlugin(productID);
104
			TargetPlatform.createPlatformConfiguration(getConfigDir(configuration), (IPluginModelBase[]) fAllBundles.values().toArray(new IPluginModelBase[fAllBundles.size()]), brandingId != null ? (IPluginModelBase) fAllBundles.get(brandingId) : null);
105
			TargetPlatformHelper.checkPluginPropertiesConsistency(fAllBundles, getConfigDir(configuration));
106
			programArgs.add("-configuration"); //$NON-NLS-1$
107
			programArgs.add("file:" + new Path(getConfigDir(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$
108
109
			// add the output folder names
110
			programArgs.add("-dev"); //$NON-NLS-1$
111
			programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigDir(configuration).toString() + "/dev.properties", fAllBundles)); //$NON-NLS-1$
112
		}
113
		// necessary for PDE to know how to load plugins when target platform = host platform
114
		// see PluginPathFinder.getPluginPaths() and PluginPathFinder.isDevLaunchMode()
115
		IPluginModelBase base = (IPluginModelBase) fAllBundles.get(PDECore.PLUGIN_ID);
116
		if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) < 0) //$NON-NLS-1$
117
			programArgs.add("-pdelaunch"); //$NON-NLS-1$
118
119
		String[] args = super.getProgramArguments(configuration);
120
		for (int i = 0; i < args.length; i++) {
121
			programArgs.add(args[i]);
122
		}
123
124
		if (!programArgs.contains("-nosplash") && showSplash) { //$NON-NLS-1$
125
			if (TargetPlatformHelper.getTargetVersion() >= 3.1) {
126
				programArgs.add(0, "-launcher"); //$NON-NLS-1$
127
128
				IPath path = null;
129
				if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$
130
					path = new Path(TargetPlatform.getLocation()).append("Eclipse.app/Contents/MacOS/eclipse"); //$NON-NLS-1$
131
				} else {
132
					path = new Path(TargetPlatform.getLocation()).append("eclipse"); //$NON-NLS-1$
133
					if (TargetPlatform.getOS().equals("win32")) { //$NON-NLS-1$
134
						path = path.addFileExtension("exe"); //$NON-NLS-1$
135
					}
136
				}
137
138
				programArgs.add(1, path.toOSString()); //This could be the branded launcher if we want (also this does not bring much)
139
				programArgs.add(2, "-name"); //$NON-NLS-1$
140
				programArgs.add(3, "Eclipse"); //This should be the name of the product //$NON-NLS-1$
141
				programArgs.add(4, "-showsplash"); //$NON-NLS-1$
142
				programArgs.add(5, "600"); //$NON-NLS-1$
143
			} else {
144
				programArgs.add(0, "-showsplash"); //$NON-NLS-1$
145
				programArgs.add(1, computeShowsplashArgument());
146
			}
147
		}
148
		return (String[]) programArgs.toArray(new String[programArgs.size()]);
149
	}
150
151
	private void validateFeatures() throws CoreException {
152
		IPath installPath = PDELaunchingPlugin.getWorkspace().getRoot().getLocation();
153
		String lastSegment = installPath.lastSegment();
154
		boolean badStructure = lastSegment == null;
155
		if (!badStructure) {
156
			IPath featuresPath = installPath.removeLastSegments(1).append("features"); //$NON-NLS-1$
157
			badStructure = !lastSegment.equalsIgnoreCase("plugins") //$NON-NLS-1$
158
					|| !featuresPath.toFile().exists();
159
		}
160
		if (badStructure) {
161
			throw new CoreException(PDELaunchingPlugin.getDefault().getLauncherUtils().createErrorStatus(PDEMessages.WorkbenchLauncherConfigurationDelegate_badFeatureSetup));
162
		}
163
		// Ensure important files are present
164
		ensureProductFilesExist(getProductPath());
165
	}
166
167
	private IPath getProductPath() {
168
		return PDELaunchingPlugin.getWorkspace().getRoot().getLocation().removeLastSegments(1);
169
	}
170
171
	private String computeShowsplashArgument() {
172
		IPath eclipseHome = new Path(TargetPlatform.getLocation());
173
		IPath fullPath = eclipseHome.append("eclipse"); //$NON-NLS-1$
174
		return fullPath.toOSString() + " -showsplash 600"; //$NON-NLS-1$
175
	}
176
177
	private void ensureProductFilesExist(IPath productArea) {
178
		File productDir = productArea.toFile();
179
		File marker = new File(productDir, ".eclipseproduct"); //$NON-NLS-1$
180
		IPath eclipsePath = new Path(TargetPlatform.getLocation());
181
		if (!marker.exists())
182
			CoreUtility.copyFile(eclipsePath, ".eclipseproduct", marker); //$NON-NLS-1$
183
184
		File configDir = new File(productDir, "configuration"); //$NON-NLS-1$
185
		if (!configDir.exists())
186
			configDir.mkdirs();
187
		File ini = new File(configDir, "config.ini"); //$NON-NLS-1$
188
		if (!ini.exists())
189
			CoreUtility.copyFile(eclipsePath.append("configuration"), "config.ini", ini); //$NON-NLS-1$ //$NON-NLS-2$
190
	}
191
192
	/*
193
	 * (non-Javadoc)
194
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#getConfigDir(org.eclipse.debug.core.ILaunchConfiguration)
195
	 */
196
	protected File getConfigDir(ILaunchConfiguration config) {
197
		if (fConfigDir == null) {
198
			try {
199
				if (config.getAttribute(IPDELauncherConstants.USEFEATURES, false) && config.getAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, true)) {
200
					String root = getProductPath().toString();
201
					root += "/configuration"; //$NON-NLS-1$
202
					fConfigDir = new File(root);
203
					if (!fConfigDir.exists())
204
						fConfigDir.mkdirs();
205
				} else {
206
					fConfigDir = LaunchConfigurationHelper.getConfigurationArea(config);
207
				}
208
			} catch (CoreException e) {
209
				fConfigDir = LaunchConfigurationHelper.getConfigurationArea(config);
210
			}
211
		}
212
		return fConfigDir;
213
	}
214
215
	/**
216
	 * Clears the workspace prior to launching if the workspace exists and the option to 
217
	 * clear it is turned on.  Also clears the configuration area if that option is chosen.
218
	 * 
219
	 * @param configuration
220
	 * 			the launch configuration
221
	 * @param monitor
222
	 * 			the progress monitor
223
	 * @throws CoreException
224
	 * 			if unable to retrieve launch attribute values
225
	 * @since 3.3
226
	 */
227
	protected void clear(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
228
		if (fWorkspaceLocation == null) {
229
			fWorkspaceLocation = LaunchArgumentsHelper.getWorkspaceLocation(configuration);
230
		}
231
		// Clear workspace and prompt, if necessary
232
		if (!PDELaunchingPlugin.getDefault().getLauncherUtils().clearWorkspace(configuration, fWorkspaceLocation, monitor))
233
			throw new CoreException(Status.CANCEL_STATUS);
234
235
		// clear config area, if necessary
236
		if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false))
237
			CoreUtility.deleteContent(getConfigDir(configuration));
238
	}
239
240
	/* (non-Javadoc)
241
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
242
	 */
243
	protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
244
		fWorkspaceLocation = null;
245
246
		fModels = BundleLauncherHelper.getMergedBundleMap(configuration, false);
247
		fAllBundles = new HashMap(fModels.size());
248
		Iterator iter = fModels.keySet().iterator();
249
		while (iter.hasNext()) {
250
			IPluginModelBase model = (IPluginModelBase) iter.next();
251
			fAllBundles.put(model.getPluginBase().getId(), model);
252
		}
253
		validateConfigIni(configuration);
254
		super.preLaunchCheck(configuration, launch, monitor);
255
	}
256
257
	private void validateConfigIni(ILaunchConfiguration configuration) throws CoreException {
258
		if (!configuration.getAttribute(IPDELauncherConstants.CONFIG_GENERATE_DEFAULT, true)) {
259
			String templateLoc = configuration.getAttribute(IPDELauncherConstants.CONFIG_TEMPLATE_LOCATION, ""); //$NON-NLS-1$
260
			IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
261
			templateLoc = mgr.performStringSubstitution(templateLoc);
262
263
			File templateFile = new File(templateLoc);
264
			if (!templateFile.exists()) {
265
				if (!PDELaunchingPlugin.getDefault().getLauncherUtils().generateConfigIni())
266
					throw new CoreException(Status.CANCEL_STATUS);
267
				// with the way the launcher works, if a config.ini file is not found one will be generated automatically.
268
				// This check was to warn the user a config.ini needs to be generated. - bug 161265, comment #7
269
			}
270
		}
271
	}
272
273
	/* (non-Javadoc)
274
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#getVMArguments(org.eclipse.debug.core.ILaunchConfiguration)
275
	 */
276
	public String[] getVMArguments(ILaunchConfiguration configuration) throws CoreException {
277
		String[] vmArgs = super.getVMArguments(configuration);
278
		IPluginModelBase base = (IPluginModelBase) fAllBundles.get(PDECore.PLUGIN_ID);
279
		if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) >= 0) { //$NON-NLS-1$
280
			// necessary for PDE to know how to load plugins when target platform = host platform
281
			// see PluginPathFinder.getPluginPaths() and PluginPathFinder.isDevLaunchMode()
282
			String[] result = new String[vmArgs.length + 1];
283
			System.arraycopy(vmArgs, 0, result, 0, vmArgs.length);
284
			result[vmArgs.length] = "-Declipse.pde.launch=true"; //$NON-NLS-1$
285
			return result;
286
		}
287
		return vmArgs;
288
	}
289
290
}
0
  + text/plain
291
  + text/plain
1
  + *
292
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/launching/launcher/EquinoxLaunchConfiguration.java (+206 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.launching.launcher;
13
14
import org.eclipse.pde.internal.launching.IPDEConstants;
15
import org.eclipse.pde.internal.launching.PDEMessages;
16
import org.eclipse.pde.internal.launching.launcher.*;
17
18
import java.io.File;
19
import java.net.URL;
20
import java.util.*;
21
import org.eclipse.core.runtime.*;
22
import org.eclipse.debug.core.ILaunch;
23
import org.eclipse.debug.core.ILaunchConfiguration;
24
import org.eclipse.pde.core.plugin.*;
25
import org.eclipse.pde.internal.build.IPDEBuildConstants;
26
import org.eclipse.pde.internal.core.ClasspathHelper;
27
import org.eclipse.pde.internal.core.P2Utils;
28
import org.eclipse.pde.internal.core.util.CoreUtility;
29
30
/**
31
 * A launch delegate for launching the Equinox framework
32
 * <p>
33
 * Clients may subclass and instantiate this class.
34
 * </p>
35
 * @since 3.2
36
 */
37
public class EquinoxLaunchConfiguration extends AbstractPDELaunchConfiguration {
38
39
	// used to generate the dev classpath entries
40
	// key is bundle ID, value is a model
41
	protected Map fAllBundles;
42
43
	// key is a model, value is startLevel:autoStart
44
	private Map fModels;
45
46
	/*
47
	 * (non-Javadoc)
48
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration)
49
	 */
50
	public String[] getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
51
		ArrayList programArgs = new ArrayList();
52
53
		programArgs.add("-dev"); //$NON-NLS-1$
54
		programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigDir(configuration).toString() + "/dev.properties", fAllBundles)); //$NON-NLS-1$
55
56
		saveConfigurationFile(configuration);
57
		programArgs.add("-configuration"); //$NON-NLS-1$
58
		programArgs.add("file:" + new Path(getConfigDir(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$
59
60
		String[] args = super.getProgramArguments(configuration);
61
		for (int i = 0; i < args.length; i++) {
62
			programArgs.add(args[i]);
63
		}
64
		return (String[]) programArgs.toArray(new String[programArgs.size()]);
65
	}
66
67
	private void saveConfigurationFile(ILaunchConfiguration configuration) throws CoreException {
68
		Properties properties = new Properties();
69
		properties.setProperty("osgi.install.area", "file:" + TargetPlatform.getLocation()); //$NON-NLS-1$ //$NON-NLS-2$
70
		properties.setProperty("osgi.configuration.cascaded", "false"); //$NON-NLS-1$ //$NON-NLS-2$
71
		properties.put("osgi.framework", LaunchConfigurationHelper.getBundleURL(IPDEBuildConstants.BUNDLE_OSGI, fAllBundles, false)); //$NON-NLS-1$
72
		int start = configuration.getAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4);
73
		properties.put("osgi.bundles.defaultStartLevel", Integer.toString(start)); //$NON-NLS-1$
74
		boolean autostart = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, true);
75
76
		String bundles = null;
77
		if (fAllBundles.containsKey(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR)) {
78
			// If simple configurator is being used, we need to write out the bundles.txt instead of writing out the list in the config.ini
79
			URL bundlesTxt = P2Utils.writeBundlesTxt(fModels, start, autostart, getConfigDir(configuration), null);
80
			if (bundlesTxt != null) {
81
				properties.setProperty("org.eclipse.equinox.simpleconfigurator.configUrl", bundlesTxt.toString()); //$NON-NLS-1$
82
				if (fAllBundles.get(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR) != null) {
83
					properties.setProperty("org.eclipse.update.reconcile", "false"); //$NON-NLS-1$ //$NON-NLS-2$
84
				}
85
			}
86
			StringBuffer buffer = new StringBuffer();
87
			IPluginModelBase model = (IPluginModelBase) fAllBundles.get(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR);
88
			buffer.append(LaunchConfigurationHelper.getBundleURL(model, true));
89
			appendStartData(buffer, (String) fModels.get(model), autostart);
90
			bundles = buffer.toString();
91
		} else {
92
			bundles = getBundles(autostart);
93
		}
94
		if (bundles.length() > 0)
95
			properties.put("osgi.bundles", bundles); //$NON-NLS-1$
96
97
		if (!"3.3".equals(configuration.getAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, ""))) { //$NON-NLS-1$ //$NON-NLS-2$
98
			properties.put("eclipse.ignoreApp", "true"); //$NON-NLS-1$ //$NON-NLS-2$
99
			properties.put("osgi.noShutdown", "true"); //$NON-NLS-1$ //$NON-NLS-2$
100
		}
101
102
		LaunchConfigurationHelper.save(new File(getConfigDir(configuration), "config.ini"), properties); //$NON-NLS-1$
103
	}
104
105
	private String getBundles(boolean defaultAuto) {
106
		StringBuffer buffer = new StringBuffer();
107
		Iterator iter = fModels.keySet().iterator();
108
		while (iter.hasNext()) {
109
			IPluginModelBase model = (IPluginModelBase) iter.next();
110
			String id = model.getPluginBase().getId();
111
			if (!IPDEBuildConstants.BUNDLE_OSGI.equals(id)) {
112
				if (buffer.length() > 0)
113
					buffer.append(","); //$NON-NLS-1$
114
				buffer.append(LaunchConfigurationHelper.getBundleURL(model, true));
115
116
				// fragments must not be started or have a start level
117
				if (model instanceof IFragmentModel)
118
					continue;
119
120
				String data = fModels.get(model).toString();
121
				appendStartData(buffer, data, defaultAuto);
122
			}
123
		}
124
		return buffer.toString();
125
	}
126
127
	/**
128
	 * Convenience method to parses the startData ("startLevel:autoStart"), convert it to the
129
	 * format expected by the OSGi bundles property, and append to a StringBuffer.
130
	 * @param buffer buffer to append the data to
131
	 * @param startData data to parse ("startLevel:autoStart")
132
	 * @param defaultAuto default auto start setting
133
	 */
134
	private void appendStartData(StringBuffer buffer, String startData, boolean defaultAuto) {
135
		int index = startData.indexOf(':');
136
		String level = index > 0 ? startData.substring(0, index) : "default"; //$NON-NLS-1$
137
		String auto = index > 0 && index < startData.length() - 1 ? startData.substring(index + 1) : "default"; //$NON-NLS-1$
138
		if ("default".equals(auto)) //$NON-NLS-1$
139
			auto = Boolean.toString(defaultAuto);
140
		if (!level.equals("default") || "true".equals(auto)) //$NON-NLS-1$ //$NON-NLS-2$
141
			buffer.append("@"); //$NON-NLS-1$
142
143
		if (!level.equals("default")) { //$NON-NLS-1$
144
			buffer.append(level);
145
			if ("true".equals(auto)) //$NON-NLS-1$
146
				buffer.append(":"); //$NON-NLS-1$
147
		}
148
		if ("true".equals(auto)) { //$NON-NLS-1$
149
			buffer.append("start"); //$NON-NLS-1$
150
		}
151
	}
152
153
	/*
154
	 * (non-Javadoc)
155
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
156
	 */
157
	protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
158
		fModels = BundleLauncherHelper.getMergedBundleMap(configuration, true);
159
		fAllBundles = new HashMap(fModels.size());
160
		Iterator iter = fModels.keySet().iterator();
161
		while (iter.hasNext()) {
162
			IPluginModelBase model = (IPluginModelBase) iter.next();
163
			fAllBundles.put(model.getPluginBase().getId(), model);
164
		}
165
166
		if (!fAllBundles.containsKey(IPDEBuildConstants.BUNDLE_OSGI)) {
167
			// implicitly add it
168
			IPluginModelBase model = PluginRegistry.findModel(IPDEBuildConstants.BUNDLE_OSGI);
169
			if (model != null) {
170
				fModels.put(model, "default:default"); //$NON-NLS-1$
171
				fAllBundles.put(IPDEBuildConstants.BUNDLE_OSGI, model);
172
			} else {
173
				String message = PDEMessages.EquinoxLaunchConfiguration_oldTarget;
174
				throw new CoreException(PDELaunchingPlugin.getDefault().getLauncherUtils().createErrorStatus(message));
175
			}
176
		}
177
		super.preLaunchCheck(configuration, launch, monitor);
178
	}
179
180
	/*
181
	 * (non-Javadoc)
182
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#validatePluginDependencies(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor)
183
	 */
184
	protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
185
		OSGiValidationOperation op = new OSGiValidationOperation(configuration);
186
		LaunchPluginValidator.runValidationOperation(op, monitor);
187
	}
188
189
	/**
190
	 * Clears the configuration area if the area exists and that option is selected.
191
	 * 
192
	 * @param configuration
193
	 * 			the launch configuration
194
	 * @param monitor
195
	 * 			the progress monitor
196
	 * @throws CoreException
197
	 * 			if unable to retrieve launch attribute values
198
	 * @since 3.3
199
	 */
200
	protected void clear(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
201
		// clear config area, if necessary
202
		if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false))
203
			CoreUtility.deleteContent(getConfigDir(configuration));
204
	}
205
206
}
0
  + text/plain
207
  + text/plain
1
  + *
208
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/PDEMessages.java (+39 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Code 9 Corporation - on going enhancements and maintenance
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching;
13
14
import org.eclipse.osgi.util.NLS;
15
16
public class PDEMessages extends NLS {
17
	private static final String BUNDLE_NAME = "org.eclipse.pde.internal.pderesources";//$NON-NLS-1$
18
19
	static {
20
		// load message values from bundle file
21
		NLS.initializeMessages(BUNDLE_NAME, PDEMessages.class);
22
	}
23
24
	public static String LauncherUtils_cannotLaunchApplication;
25
26
	public static String WorkbenchLauncherConfigurationDelegate_noJRE;
27
	public static String WorkbenchLauncherConfigurationDelegate_jrePathNotFound;
28
	public static String WorkbenchLauncherConfigurationDelegate_badFeatureSetup;
29
	public static String WorkbenchLauncherConfigurationDelegate_noStartup;
30
	public static String JUnitLaunchConfiguration_error_notaplugin;
31
	public static String JUnitLaunchConfiguration_error_missingPlugin;
32
33
	public static String OSGiLaunchConfiguration_cannotFindLaunchConfiguration;
34
	public static String OSGiLaunchConfiguration_selected;
35
36
	public static String EquinoxLaunchConfiguration_oldTarget;
37
38
	public static String VMHelper_cannotFindExecEnv;
39
}
0
  + text/plain
40
  + text/plain
1
  + *
41
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/EclipsePluginValidationOperation.java (+127 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching.launcher;
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
16
17
import org.eclipse.pde.internal.launching.IPDEConstants;
18
19
import java.util.HashMap;
20
import java.util.Map;
21
22
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.IProgressMonitor;
24
import org.eclipse.debug.core.ILaunchConfiguration;
25
import org.eclipse.osgi.service.resolver.BundleDescription;
26
import org.eclipse.pde.core.plugin.IPluginAttribute;
27
import org.eclipse.pde.core.plugin.IPluginElement;
28
import org.eclipse.pde.core.plugin.IPluginExtension;
29
import org.eclipse.pde.core.plugin.IPluginModelBase;
30
import org.eclipse.pde.core.plugin.PluginRegistry;
31
import org.eclipse.pde.core.plugin.TargetPlatform;
32
import org.eclipse.pde.internal.core.util.IdUtil;
33
34
public class EclipsePluginValidationOperation extends LaunchValidationOperation {
35
36
	private Map fExtensionErrors = new HashMap(2);
37
	private static Object[] EMPTY = new Object[0];
38
	private final IEclipsePluginValidationOperationHelper helper;
39
40
	public EclipsePluginValidationOperation(ILaunchConfiguration configuration, IEclipsePluginValidationOperationHelper helper) {
41
		super(configuration);
42
		this.helper = helper;
43
	}
44
45
	protected IPluginModelBase[] getModels() throws CoreException {
46
		return BundleLauncherHelper.getMergedBundles(fLaunchConfiguration, false);
47
	}
48
49
	public void run(IProgressMonitor monitor) throws CoreException {
50
		super.run(monitor);
51
		if (fExtensionErrors.size() > 0)
52
			fExtensionErrors.clear();
53
		validateExtensions();
54
	}
55
56
	private void validateExtensions() {
57
		try {
58
			if (fLaunchConfiguration.getAttribute(IPDELauncherConstants.USE_PRODUCT, false)) {
59
				String product = fLaunchConfiguration.getAttribute(IPDELauncherConstants.PRODUCT, (String) null);
60
				if (product != null) {
61
					validateExtension(product);
62
					String application = getApplication(product);
63
					if (application != null)
64
						validateExtension(application);
65
				}
66
			} else {
67
				String configType = fLaunchConfiguration.getType().getIdentifier();
68
				String attribute = helper.getAttribute(configType);
69
				String application = fLaunchConfiguration.getAttribute(attribute, TargetPlatform.getDefaultApplication());
70
				if (!IPDEConstants.CORE_TEST_APPLICATION.equals(application)) {
71
					validateExtension(application);
72
				}
73
			}
74
		} catch (CoreException e) {
75
			PDELaunchingPlugin.log(e);
76
		}
77
	}
78
79
	private String getApplication(String product) {
80
		String bundleID = product.substring(0, product.lastIndexOf('.'));
81
		BundleDescription bundle = getState().getBundle(bundleID, null);
82
		if (bundle != null) {
83
			IPluginModelBase model = PluginRegistry.findModel(bundle);
84
			if (model != null) {
85
				IPluginExtension[] extensions = model.getPluginBase().getExtensions();
86
				for (int i = 0; i < extensions.length; i++) {
87
					IPluginExtension ext = extensions[i];
88
					String point = ext.getPoint();
89
					if ("org.eclipse.core.runtime.products".equals(point) //$NON-NLS-1$
90
							&& product.equals(IdUtil.getFullId(ext))) {
91
						if (ext.getChildCount() == 1) {
92
							IPluginElement prod = (IPluginElement) ext.getChildren()[0];
93
							if (prod.getName().equals("product")) { //$NON-NLS-1$
94
								IPluginAttribute attr = prod.getAttribute("application"); //$NON-NLS-1$
95
								return attr != null ? attr.getValue() : null;
96
							}
97
						}
98
					}
99
				}
100
			}
101
		}
102
		return null;
103
	}
104
105
	private void validateExtension(String id) {
106
		int index = id.lastIndexOf('.');
107
		if (index == -1)
108
			return;
109
		String bundleID = id.substring(0, index);
110
		BundleDescription bundle = getState().getBundle(bundleID, null);
111
		if (bundle == null) {
112
			Object extensionError = helper.createExtensionError(bundleID);
113
			fExtensionErrors.put(extensionError, EMPTY);
114
		}
115
	}
116
117
	public boolean hasErrors() {
118
		return super.hasErrors() || fExtensionErrors.size() >= 1;
119
	}
120
121
	public Map getInput() {
122
		Map map = super.getInput();
123
		map.putAll(fExtensionErrors);
124
		return map;
125
	}
126
127
}
0
  + text/plain
128
  + text/plain
1
  + *
129
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchPluginValidator.java (+151 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
15
import org.eclipse.pde.internal.launching.IPDEConstants;
16
17
import java.util.ArrayList;
18
import java.util.Collection;
19
import java.util.HashMap;
20
import java.util.HashSet;
21
import java.util.Map;
22
import java.util.Set;
23
24
import org.eclipse.core.resources.IProject;
25
import org.eclipse.core.runtime.CoreException;
26
import org.eclipse.core.runtime.IProgressMonitor;
27
import org.eclipse.core.runtime.Status;
28
import org.eclipse.debug.core.ILaunchConfiguration;
29
import org.eclipse.jdt.core.IJavaProject;
30
import org.eclipse.jdt.core.JavaCore;
31
import org.eclipse.pde.core.plugin.IPluginModelBase;
32
import org.eclipse.pde.core.plugin.ModelEntry;
33
import org.eclipse.pde.core.plugin.PluginRegistry;
34
import org.eclipse.pde.internal.core.PDECore;
35
import org.eclipse.pde.internal.core.SearchablePluginsManager;
36
37
public class LaunchPluginValidator {
38
39
	private static IPluginModelBase[] getSelectedWorkspacePlugins(ILaunchConfiguration configuration) throws CoreException {
40
41
		boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true);
42
		boolean useFeatures = configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false);
43
44
		IPluginModelBase[] models = PluginRegistry.getWorkspaceModels();
45
46
		if (usedefault || useFeatures || models.length == 0)
47
			return models;
48
49
		Collection result = null;
50
		Map bundles = BundleLauncherHelper.getWorkspaceBundleMap(configuration, null, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS);
51
		result = bundles.keySet();
52
		return (IPluginModelBase[]) result.toArray(new IPluginModelBase[result.size()]);
53
	}
54
55
	/**
56
	 * 
57
	 * @param configuration launchConfiguration to get the attribute value
58
	 * @param attribute launch configuration attribute to containing plug-in information
59
	 * @return a TreeSet containing IPluginModelBase objects which are represented by the value of the attribute
60
	 * @throws CoreException
61
	 */
62
	public static Set parsePlugins(ILaunchConfiguration configuration, String attribute) throws CoreException {
63
		HashSet set = new HashSet();
64
		String ids = configuration.getAttribute(attribute, (String) null);
65
		if (ids != null) {
66
			String[] entries = ids.split(","); //$NON-NLS-1$
67
			Map unmatchedEntries = new HashMap();
68
			for (int i = 0; i < entries.length; i++) {
69
				int index = entries[i].indexOf('@');
70
				if (index < 0) { // if no start levels, assume default
71
					entries[i] = entries[i].concat("@default:default"); //$NON-NLS-1$
72
					index = entries[i].indexOf('@');
73
				}
74
				String idVersion = entries[i].substring(0, index);
75
				int versionIndex = entries[i].indexOf(BundleLauncherHelper.VERSION_SEPARATOR);
76
				String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion;
77
				String version = (versionIndex > 0) ? idVersion.substring(versionIndex + 1) : null;
78
				ModelEntry entry = PluginRegistry.findEntry(id);
79
				if (entry != null) {
80
					IPluginModelBase matchingModels[] = attribute.equals(IPDELauncherConstants.SELECTED_TARGET_PLUGINS) ? entry.getExternalModels() : entry.getWorkspaceModels();
81
					for (int j = 0; j < matchingModels.length; j++) {
82
						if (matchingModels[j].isEnabled()) {
83
							// TODO Very similar logic to BundleLauncherHelper
84
							// the logic here is this (see bug 225644)
85
							// a) if we come across a bundle that has the right version, immediately add it
86
							// b) if there's no version, add it
87
							// c) if there's only one instance of that bundle in the list of ids... add it
88
							if (version == null || matchingModels[j].getPluginBase().getVersion().equals(version)) {
89
								set.add(matchingModels[j]);
90
							} else if (matchingModels.length == 1) {
91
								if (unmatchedEntries.remove(id) == null) {
92
									unmatchedEntries.put(id, matchingModels[j]);
93
								}
94
							}
95
						}
96
					}
97
				}
98
			}
99
			set.addAll(unmatchedEntries.values());
100
		}
101
		return set;
102
	}
103
104
	public static IProject[] getAffectedProjects(ILaunchConfiguration config) throws CoreException {
105
		// if restarting, no need to check projects for errors
106
		if (config.getAttribute(IPDEConstants.RESTART, false))
107
			return new IProject[0];
108
		ArrayList projects = new ArrayList();
109
		IPluginModelBase[] models = getSelectedWorkspacePlugins(config);
110
		for (int i = 0; i < models.length; i++) {
111
			IProject project = models[i].getUnderlyingResource().getProject();
112
			if (project.hasNature(JavaCore.NATURE_ID))
113
				projects.add(project);
114
		}
115
116
		// add fake "Java Search" project
117
		SearchablePluginsManager manager = PDECore.getDefault().getSearchablePluginsManager();
118
		IJavaProject proxy = manager.getProxyProject();
119
		if (proxy != null) {
120
			projects.add(proxy.getProject());
121
		}
122
		return (IProject[]) projects.toArray(new IProject[projects.size()]);
123
	}
124
125
	public interface IValidationErrorHandler {
126
		
127
		void handleError(LaunchValidationOperation operation) throws CoreException;
128
		
129
	}
130
	
131
	public static class ValidationErrorPropagator implements IValidationErrorHandler {
132
133
		public void handleError(LaunchValidationOperation operation)
134
				throws CoreException {
135
			throw new CoreException(Status.CANCEL_STATUS);
136
		}
137
		
138
	}
139
	
140
	public static void runValidationOperation(final LaunchValidationOperation op, IProgressMonitor monitor) throws CoreException {
141
		runValidationOperation(op, monitor, new ValidationErrorPropagator());
142
	}
143
	
144
	public static void runValidationOperation(final LaunchValidationOperation op, IProgressMonitor monitor, IValidationErrorHandler errorHandler) throws CoreException {
145
		op.run(monitor);
146
		if (op.hasErrors()) {
147
			errorHandler.handleError(op);
148
		}
149
	}
150
151
}
0
  + text/plain
152
  + text/plain
1
  + *
153
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java (+352 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
15
import java.io.File;
16
import java.io.IOException;
17
import java.net.URL;
18
import java.util.ArrayList;
19
import java.util.HashMap;
20
import java.util.HashSet;
21
import java.util.Map;
22
import java.util.StringTokenizer;
23
24
import org.eclipse.core.resources.IProject;
25
import org.eclipse.core.resources.IResource;
26
import org.eclipse.core.runtime.CoreException;
27
import org.eclipse.core.runtime.FileLocator;
28
import org.eclipse.core.runtime.IPath;
29
import org.eclipse.core.runtime.Path;
30
import org.eclipse.core.runtime.Platform;
31
import org.eclipse.core.variables.IStringVariableManager;
32
import org.eclipse.core.variables.VariablesPlugin;
33
import org.eclipse.debug.core.ILaunchConfiguration;
34
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
35
import org.eclipse.jdt.core.IClasspathEntry;
36
import org.eclipse.jdt.core.IJavaProject;
37
import org.eclipse.jdt.core.IPackageFragmentRoot;
38
import org.eclipse.jdt.core.JavaCore;
39
import org.eclipse.jdt.launching.ExecutionArguments;
40
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
41
import org.eclipse.pde.core.plugin.IPluginModelBase;
42
import org.eclipse.pde.core.plugin.ModelEntry;
43
import org.eclipse.pde.core.plugin.PluginRegistry;
44
import org.eclipse.pde.core.plugin.TargetPlatform;
45
import org.eclipse.pde.internal.build.IPDEBuildConstants;
46
import org.eclipse.pde.internal.core.ICoreConstants;
47
import org.eclipse.pde.internal.core.PDECore;
48
import org.eclipse.pde.internal.core.PDEPreferencesManager;
49
import org.eclipse.pde.internal.core.TargetPlatformHelper;
50
import org.eclipse.pde.internal.core.TracingOptionsManager;
51
import org.eclipse.pde.internal.core.target.provisional.ITargetHandle;
52
import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
53
import org.osgi.framework.Bundle;
54
55
public class LaunchArgumentsHelper {
56
57
	/**
58
	 * Returns the location that will be used as the workspace when launching.  Will
59
	 * replace variables, so this method should only be called
60
	 * when variable substitution (may prompt the user) is appropriate.
61
	 * @param configuration the launch configuration to get the workspace value for
62
	 * @return workspace location path as a string
63
	 * @throws CoreException if there is a problem with the configuration
64
	 */
65
	public static String getWorkspaceLocation(ILaunchConfiguration configuration) throws CoreException {
66
		String location = configuration.getAttribute(IPDELauncherConstants.LOCATION, (String) null);
67
		if (location == null) {
68
			// backward compatibility
69
			location = configuration.getAttribute(IPDELauncherConstants.LOCATION + "0", (String) null); //$NON-NLS-1$
70
			if (location != null) {
71
				ILaunchConfigurationWorkingCopy wc = null;
72
				if (configuration.isWorkingCopy()) {
73
					wc = (ILaunchConfigurationWorkingCopy) configuration;
74
				} else {
75
					wc = configuration.getWorkingCopy();
76
				}
77
				wc.setAttribute(IPDELauncherConstants.LOCATION + "0", (String) null); //$NON-NLS-1$
78
				wc.setAttribute(IPDELauncherConstants.LOCATION, location);
79
				wc.doSave();
80
			}
81
		}
82
		return getSubstitutedString(location);
83
	}
84
85
	public static String[] getUserProgramArgumentArray(ILaunchConfiguration configuration) throws CoreException {
86
		String args = getUserProgramArguments(configuration);
87
		return new ExecutionArguments("", args).getProgramArgumentsArray(); //$NON-NLS-1$
88
	}
89
90
	public static String getUserProgramArguments(ILaunchConfiguration configuration) throws CoreException {
91
		String args = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String) null);
92
		if (args == null) {
93
			// backward compatibility
94
			args = configuration.getAttribute("progargs", (String) null); //$NON-NLS-1$
95
			if (args != null) {
96
				ILaunchConfigurationWorkingCopy wc = null;
97
				if (configuration.isWorkingCopy()) {
98
					wc = (ILaunchConfigurationWorkingCopy) configuration;
99
				} else {
100
					wc = configuration.getWorkingCopy();
101
				}
102
				wc.setAttribute("progargs", (String) null); //$NON-NLS-1$
103
				wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args);
104
				wc.doSave();
105
			}
106
		}
107
		return args == null ? "" : getSubstitutedString(args); //$NON-NLS-1$
108
	}
109
110
	public static String getUserVMArguments(ILaunchConfiguration configuration) throws CoreException {
111
		String args = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, (String) null);
112
		if (args == null) {
113
			// backward compatibility
114
			args = configuration.getAttribute("vmargs", (String) null); //$NON-NLS-1$
115
			if (args != null) {
116
				ILaunchConfigurationWorkingCopy wc = null;
117
				if (configuration.isWorkingCopy()) {
118
					wc = (ILaunchConfigurationWorkingCopy) configuration;
119
				} else {
120
					wc = configuration.getWorkingCopy();
121
				}
122
				wc.setAttribute("vmargs", (String) null); //$NON-NLS-1$
123
				wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, args);
124
				wc.doSave();
125
			}
126
		}
127
		return args == null ? "" : getSubstitutedString(args); //$NON-NLS-1$
128
	}
129
130
	/**
131
	 * Fetches the VM Arguments from the current Target Platform
132
	 *  
133
	 * @return	VM Arguments from the current Target Platform or empty string if none found
134
	 */
135
	public static String getInitialVMArguments() {
136
137
		try {
138
			ITargetPlatformService service = (ITargetPlatformService) PDECore.getDefault().acquireService(ITargetPlatformService.class.getName());
139
			if (service != null) {
140
				ITargetHandle target = service.getWorkspaceTargetHandle();
141
				if (target != null) {
142
					String result = target.getTargetDefinition().getVMArguments();
143
					result = result != null ? result : ""; //$NON-NLS-1$
144
					return result;
145
				}
146
			}
147
		} catch (CoreException e) {
148
		}
149
150
		// TODO: Generally, once the new preference target platform preference page is in use,
151
		// this code path will not be used. Once we decide to remove support for old targets/preferences
152
		// this code can be removed.
153
		PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager();
154
		StringBuffer result = new StringBuffer(preferences.getString(ICoreConstants.VM_ARGS));
155
156
		if (preferences.getBoolean(ICoreConstants.VM_LAUNCHER_INI)) {
157
			// hack on the arguments from eclipse.ini
158
			result.append(TargetPlatformHelper.getIniVMArgs());
159
		}
160
		return result.toString();
161
	}
162
163
	public static String getInitialProgramArguments() {
164
		StringBuffer buffer = new StringBuffer("-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"); //$NON-NLS-1$
165
166
		PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager();
167
		String programArgs = preferences.getString(ICoreConstants.PROGRAM_ARGS);
168
		if (programArgs.length() > 0) {
169
			buffer.append(" "); //$NON-NLS-1$
170
			buffer.append(programArgs);
171
		}
172
		return buffer.toString();
173
	}
174
175
	public static File getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
176
		String working;
177
		try {
178
			working = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, new File(".").getCanonicalPath()); //$NON-NLS-1$
179
		} catch (IOException e) {
180
			working = "${workspace_loc}/../"; //$NON-NLS-1$
181
		}
182
		File dir = new File(getSubstitutedString(working));
183
		if (!dir.exists())
184
			dir.mkdirs();
185
		return dir;
186
	}
187
188
	public static Map getVMSpecificAttributesMap(ILaunchConfiguration config) throws CoreException {
189
		Map map = new HashMap(2);
190
		String javaCommand = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_JAVA_COMMAND, (String) null);
191
		map.put(IJavaLaunchConfigurationConstants.ATTR_JAVA_COMMAND, javaCommand);
192
		if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$
193
			ModelEntry entry = PluginRegistry.findEntry("org.eclipse.jdt.debug"); //$NON-NLS-1$
194
			if (entry != null) {
195
				IPluginModelBase[] models = entry.getExternalModels();
196
				for (int i = 0; i < models.length; i++) {
197
					File file = new File(models[i].getInstallLocation());
198
					if (!file.isFile())
199
						file = new File(file, "jdi.jar"); //$NON-NLS-1$
200
					if (file.exists()) {
201
						map.put(IJavaLaunchConfigurationConstants.ATTR_BOOTPATH_PREPEND, new String[] {file.getAbsolutePath()});
202
						break;
203
					}
204
				}
205
			}
206
		}
207
		return map;
208
	}
209
210
	public static String getTracingFileArgument(ILaunchConfiguration config, String optionsFileName) throws CoreException {
211
		try {
212
			TracingOptionsManager mng = PDECore.getDefault().getTracingOptionsManager();
213
			Map options = config.getAttribute(IPDELauncherConstants.TRACING_OPTIONS, (Map) null);
214
			String selected = config.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null);
215
			if (selected == null) {
216
				mng.save(optionsFileName, options);
217
			} else if (!selected.equals(IPDELauncherConstants.TRACING_NONE)) {
218
				HashSet result = new HashSet();
219
				StringTokenizer tokenizer = new StringTokenizer(selected, ","); //$NON-NLS-1$
220
				while (tokenizer.hasMoreTokens()) {
221
					result.add(tokenizer.nextToken());
222
				}
223
				mng.save(optionsFileName, options, result);
224
			}
225
		} catch (CoreException e) {
226
			return ""; //$NON-NLS-1$
227
		}
228
		return optionsFileName;
229
	}
230
231
	public static String[] constructClasspath(ILaunchConfiguration configuration) throws CoreException {
232
		double targetVersion = TargetPlatformHelper.getTargetVersion();
233
		String jarPath = targetVersion >= 3.3 ? getEquinoxStartupPath(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER) : getStartupJarPath();
234
		if (jarPath == null && targetVersion < 3.3)
235
			jarPath = getEquinoxStartupPath("org.eclipse.core.launcher"); //$NON-NLS-1$
236
237
		if (jarPath == null)
238
			return null;
239
240
		ArrayList entries = new ArrayList();
241
		entries.add(jarPath);
242
243
		String bootstrap = configuration.getAttribute(IPDELauncherConstants.BOOTSTRAP_ENTRIES, ""); //$NON-NLS-1$
244
		StringTokenizer tok = new StringTokenizer(getSubstitutedString(bootstrap), ","); //$NON-NLS-1$
245
		while (tok.hasMoreTokens())
246
			entries.add(tok.nextToken().trim());
247
		return (String[]) entries.toArray(new String[entries.size()]);
248
	}
249
250
	private static String getEquinoxStartupPath(String packageName) throws CoreException {
251
		IPluginModelBase model = PluginRegistry.findModel(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER);
252
		if (model != null) {
253
			IResource resource = model.getUnderlyingResource();
254
			// found in the target
255
			if (resource == null)
256
				return model.getInstallLocation();
257
258
			// find it in the workspace
259
			IProject project = resource.getProject();
260
			if (project.hasNature(JavaCore.NATURE_ID)) {
261
				IJavaProject jProject = JavaCore.create(project);
262
				IClasspathEntry[] entries = jProject.getRawClasspath();
263
				for (int i = 0; i < entries.length; i++) {
264
					int kind = entries[i].getEntryKind();
265
					if (kind == IClasspathEntry.CPE_SOURCE || kind == IClasspathEntry.CPE_LIBRARY) {
266
						IPackageFragmentRoot[] roots = jProject.findPackageFragmentRoots(entries[i]);
267
						for (int j = 0; j < roots.length; j++) {
268
							if (roots[j].getPackageFragment(packageName).exists()) {
269
								// if source folder, find the output folder
270
								if (kind == IClasspathEntry.CPE_SOURCE) {
271
									IPath path = entries[i].getOutputLocation();
272
									if (path == null)
273
										path = jProject.getOutputLocation();
274
									path = path.removeFirstSegments(1);
275
									return project.getLocation().append(path).toOSString();
276
								}
277
								// else if is a library jar, then get the location of the jar itself
278
								IResource jar = roots[j].getResource();
279
								if (jar != null) {
280
									return jar.getLocation().toOSString();
281
								}
282
							}
283
						}
284
					}
285
				}
286
			}
287
		}
288
		Bundle bundle = Platform.getBundle(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER);
289
		if (bundle != null) {
290
			try {
291
				URL url = FileLocator.resolve(bundle.getEntry("/")); //$NON-NLS-1$
292
				url = FileLocator.toFileURL(url);
293
				String path = url.getFile();
294
				if (path.startsWith("file:")) //$NON-NLS-1$
295
					path = path.substring(5);
296
				path = new File(path).getAbsolutePath();
297
				if (path.endsWith("!")) //$NON-NLS-1$
298
					path = path.substring(0, path.length() - 1);
299
				return path;
300
			} catch (IOException e) {
301
			}
302
		}
303
		return null;
304
	}
305
306
	private static String getStartupJarPath() throws CoreException {
307
		IPluginModelBase model = PluginRegistry.findModel("org.eclipse.platform"); //$NON-NLS-1$
308
		if (model != null && model.getUnderlyingResource() != null) {
309
			IProject project = model.getUnderlyingResource().getProject();
310
			if (project.hasNature(JavaCore.NATURE_ID)) {
311
				IJavaProject jProject = JavaCore.create(project);
312
				IPackageFragmentRoot[] roots = jProject.getPackageFragmentRoots();
313
				for (int i = 0; i < roots.length; i++) {
314
					if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE && roots[i].getPackageFragment("org.eclipse.core.launcher").exists()) { //$NON-NLS-1$
315
						IPath path = jProject.getOutputLocation().removeFirstSegments(1);
316
						return project.getLocation().append(path).toOSString();
317
					}
318
				}
319
			}
320
			if (project.getFile("startup.jar").exists()) //$NON-NLS-1$
321
				return project.getFile("startup.jar").getLocation().toOSString(); //$NON-NLS-1$
322
		}
323
		File startupJar = new Path(TargetPlatform.getLocation()).append("startup.jar").toFile(); //$NON-NLS-1$
324
325
		// if something goes wrong with the preferences, fall back on the startup.jar 
326
		// in the running eclipse.  
327
		if (!startupJar.exists())
328
			startupJar = new Path(TargetPlatform.getDefaultLocation()).append("startup.jar").toFile(); //$NON-NLS-1$
329
330
		return startupJar.exists() ? startupJar.getAbsolutePath() : null;
331
	}
332
333
	private static String getSubstitutedString(String text) throws CoreException {
334
		if (text == null)
335
			return ""; //$NON-NLS-1$
336
		IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
337
		return mgr.performStringSubstitution(text);
338
	}
339
340
	public static String getDefaultWorkspaceLocation(String uniqueName) {
341
		return "${workspace_loc}/../runtime-" + uniqueName.replaceAll("\\s", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
342
	}
343
344
	public static String getDefaultJUnitWorkspaceLocation() {
345
		return "${workspace_loc}/../junit-workspace"; //$NON-NLS-1$
346
	}
347
348
	public static String getDefaultJUnitConfigurationLocation() {
349
		return "${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"; //$NON-NLS-1$
350
	}
351
352
}
0
  + text/plain
353
  + text/plain
1
  + *
354
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/PDEMessages.java (+2818 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Code 9 Corporation - on going enhancements and maintenance
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching.launcher;
13
14
import org.eclipse.osgi.util.NLS;
15
16
public class PDEMessages extends NLS {
17
	private static final String BUNDLE_NAME = "org.eclipse.pde.internal.ui.pderesources";//$NON-NLS-1$
18
19
	public static String AbstractLauncherToolbar_noProblems;
20
21
	public static String AbstractLauncherToolbar_noSelection;
22
23
	public static String AbstractSchemaDetails_descriptionLabel;
24
25
	public static String AbstractTargetPage_setTarget;
26
27
	public static String AddActivationHeaderResolution_label;
28
29
	public static String AddLibraryDialog_nospaces;
30
31
	public static String BaseExtensionPointMainPage_errorMsgPluginNotFound;
32
33
	public static String BuildSiteJob_name;
34
35
	public static String BundleSourcePage_renameActionText;
36
37
	public static String BundlesTab_title;
38
39
	public static String CalculateUsesOperation_calculatingDirective;
40
41
	public static String ContentSection_0;
42
43
	public static String ContentSection_1;
44
45
	public static String DefinitionPage_0;
46
47
	public static String DefinitionPage_1;
48
49
	public static String DependenciesViewPage_showFragments;
50
51
	public static String DependenciesViewPage_showOptional;
52
53
	public static String DependencyPropertiesDialog_exportGroupText;
54
55
	public static String EclipsePluginValidationOperation_pluginMissing;
56
57
	public static String ExternalizeStringsOperation_editNames_addComment;
58
59
	public static String ExternalizeStringsOperation_editNames_insertProperty;
60
61
	public static String ExternalizeStringsOperation_editNames_replaceText;
62
63
	public static String ExternalizeStringsOperation_pluginChangeName;
64
65
	public static String ExternalizeStringsProcessor_errorMessage;
66
67
	public static String FeatureEditor_exportTooltip;
68
69
	public static String JavaArgumentsTab_addVMArgs;
70
71
	public static String OrganizeManifestsProcessor_invalidParam;
72
73
	public static String OrganizeManifestsProcessor_rootMessage;
74
75
	public static String PDECompilersConfigurationBlock_general;
76
	public static String PDECompilersConfigurationBlock_versioning;
77
	public static String PDECompilersConfigurationBlock_references;
78
	public static String PDECompilersConfigurationBlock_setting_changed_project;
79
	public static String PDECompilersConfigurationBlock_settings_changed;
80
	public static String PDECompilersConfigurationBlock_settings_changed_all;
81
	public static String PDECompilersConfigurationBlock_usage;
82
83
	public static String PDEWizardNewFileCreationPage_errorMsgStartsWithDot;
84
85
	public static String CommandComposerPart_formTitle;
86
87
	public static String CommandCopyFilter_cheatsheet;
88
89
	public static String CommandCopyFilter_cheatsheetDesc;
90
91
	public static String CommandCopyFilter_help;
92
93
	public static String CommandCopyFilter_helpDesc;
94
95
	public static String CommandCopyFilter_intro;
96
97
	public static String CommandCopyFilter_introDesc;
98
99
	public static String CommandCopyFilter_noFilter;
100
101
	public static String CommandCopyFilter_noFilterDesc;
102
103
	public static String CommandDetails_clear;
104
105
	public static String CommandDetails_commandResult;
106
107
	public static String CommandDetails_copyToClipboard;
108
109
	public static String CommandDetails_copytooltip;
110
111
	public static String CommandDetails_execError;
112
113
	public static String CommandDetails_execute;
114
115
	public static String CommandDetails_executeText;
116
117
	public static String CommandDetails_groupName;
118
119
	public static String CommandDetails_id;
120
121
	public static String CommandDetails_includeMarkup;
122
123
	public static String CommandDetails_markupTooltip;
124
125
	public static String CommandDetails_noComSelected;
126
127
	public static String CommandDetails_noParameters;
128
129
	public static String CommandDetails_numParams;
130
131
	public static String CommandDetails_param;
132
133
	public static String CommandDetails_paramValueMessage;
134
135
	public static String CommandDetails_preview;
136
137
	public static String CommandList_clearTooltip;
138
139
	public static String CommandList_collapseAll0;
140
141
	public static String CommandList_groupName;
142
143
	public static String CommandSerializerPart_name;
144
	public static String CompilersConfigurationTab_incompatEnv;
145
146
	public static String ContainerRenameParticipant_renameFolders;
147
	public static String ContainerRenameParticipant_renameBundleId;
148
149
	public static String ControlValidationUtility_errorMsgFilterInvalidSyntax;
150
	public static String ControlValidationUtility_errorMsgKeyNotFound;
151
	public static String ControlValidationUtility_errorMsgNotOnClasspath;
152
	public static String ControlValidationUtility_errorMsgPluginUnresolved;
153
	public static String ControlValidationUtility_errorMsgValueMustBeSpecified;
154
	public static String ControlValidationUtility_errorMsgValueNotExternalized;
155
156
	public static String CalculateUsesAction_jobName;
157
158
	public static String ExportDestinationTab_InstallIntoCurrentPlatform;
159
160
	public static String ExportPackageSection_uses;
161
162
	public static String ExtensionElementBodyTextDetails_labelBodyText;
163
164
	public static String ExtensionElementBodyTextDetails_sectionDescElementGeneral;
165
166
	public static String ExtensionElementBodyTextDetails_sectionDescElementSpecific;
167
168
	public static String ExtensionPointsSection_sectionDescAllExtensionPoints;
169
170
	public static String ExtensionsSection_sectionDescExtensionsMaster;
171
172
	public static String JRESection_eeBoundJRE;
173
174
	public static String JRESection_eePreference;
175
176
	public static String JRESection_eeUnboundJRE;
177
178
	public static String JRESection_jrePreference;
179
180
	public static String LauncherUtils_workspaceLocked;
181
182
	public static String LauncherUtils_cannotLaunchApplication;
183
184
	public static String LauncherUtils_clearLogFile;
185
186
	public static String LauncherUtils_generateConfigIni;
187
188
	public static String OrganizeManifestsWizardPage_calculateUses;
189
190
	public static String OverviewPage_contentDescription;
191
192
	public static String OverviewPage_contentTitle;
193
194
	public static String OverviewPage_environmentDescription;
195
196
	public static String OverviewPage_environmentTitle;
197
198
	public static String PackageFinder_taskName;
199
200
	public static String PluginContentMergeViewer_title;
201
202
	public static String PluginExportJob_name;
203
204
	public static String PluginExportWizard_Ant_errors_during_export_logs_generated;
205
206
	public static String PluginExportWizard_InstallJobName;
207
208
	public static String PluginEditor_exportTooltip;
209
210
	public static String PluginListPage_initializeFromLaunch;
211
212
	public static String PluginListPage_initializeFromPlugins;
213
214
	public static String PluginSection_includeOptional;
215
216
	public static String PluginsTab_allPlugins;
217
218
	public static String PluginsTab_featureMode;
219
220
	public static String PluginsTab_launchWith;
221
222
	public static String PluginsTab_selectedPlugins;
223
224
	public static String PluginsTabToolBar_auto_validate;
225
226
	public static String PluginsTabToolBar_validate;
227
228
	public static String PluginStructureCreator_name;
229
230
	public static String PointSelectionPage_cannotFindTemplate;
231
232
	public static String ProductExportJob_name;
233
234
	public static String ProductEditor_exportTooltip;
235
236
	public static String RemoveSplashHandlerBindingAction_msgProgressRemoveProductBindings;
237
238
	public static String RenamePluginAction_label;
239
240
	public static String RenamePluginProcessor_changeTitle;
241
242
	public static String RenamePluginProcessor_externalBundleError;
243
244
	public static String RenamePluginProcessor_noManifestError;
245
246
	public static String RenamePluginProcessor_processorName;
247
248
	public static String RenamePluginProcessor_renameProjectDesc;
249
250
	public static String RenamePluginWizardPage_idNotSet;
251
252
	public static String RenamePluginWizardPage_invalidId;
253
254
	public static String RenamePluginWizardPage_newId;
255
256
	public static String RenameExtensionPointProcessor_changeTitle;
257
258
	public static String RenameExtensionPointProcessor_processorName;
259
260
	public static String RenameExtensionPointWizard_pageTitle;
261
262
	public static String RenamePluginWizardPage_renameProject;
263
264
	public static String RenamePluginWizardPage_updateReferences;
265
266
	public static String RenameProjectChange_destinationExists;
267
268
	public static String RenameProjectChange_name;
269
270
	public static String RenameProjectChange_projectDoesNotExist;
271
272
	public static String RenameProjectChange_taskTitle;
273
274
	public static String RenameProvidePackageResolution_desc;
275
276
	public static String RenameProvidePackageResolution_label;
277
278
	public static String RequiresSection_sortAlpha;
279
280
	public static String SchemaDtdDetailsSection_title;
281
282
	public static String SchemaEditor_ElementSection_newChoice;
283
284
	public static String SchemaEditor_ElementSection_newSequence;
285
286
	public static String SchemaEditor_ElementSection_remove;
287
288
	public static String SchemaPreviewLauncher_msgEditorHasUnsavedChanges;
289
290
	public static String SchemaPreviewLauncher_msgSaveChanges;
291
292
	public static String EditorSourcePage_name;
293
294
	public static String SplashConfigurationSection_none;
295
296
	public static String SplashConfigurationSection_msgDecorationTemplateSupport;
297
298
	public static String SplashConfigurationSection_msgTooltipOffsetRelative;
299
300
	public static String SplashConfigurationSection_sectionDescCustomization;
301
302
	public static String SplashPage_splashName;
303
304
	public static String SplashProgressSection_progressName;
305
306
	public static String SplashProgressSection_progressSectionDesc;
307
308
	public static String SplashTemplatesSection_typeName;
309
310
	public static String StateViewPage_importedPackages;
311
312
	public static String StateViewPage_openItem;
313
314
	public static String StateViewPage_requiredBundles;
315
316
	public static String StateViewPage_showLeaves;
317
318
	public static String StateViewPage_showOnlyUnresolved_label;
319
320
	public static String StateViewPage_suppliedBy;
321
322
	public static String StateViewPage_suppliedByJRE;
323
324
	public static String TargetCreationPage_0;
325
326
	public static String TargetCreationPage_1;
327
328
	public static String TargetCreationPage_2;
329
330
	public static String TargetCreationPage_3;
331
332
	public static String TargetCreationPage_4;
333
334
	public static String TargetCreationPage_6;
335
336
	public static String UpdateActivationResolution_bundleActivationPolicy_desc;
337
	public static String UpdateActivationResolution_bundleActivationPolicy_label;
338
339
	public static String ExportOptionsTab_antReservedMessage;
340
	public static String ExportOptionsTab_allowBinaryCycles;
341
342
	public static String ExportOptionsTab_use_workspace_classfiles;
343
344
	public static String ExtensionsPage_sortAlpha;
345
346
	public static String FileRenameParticipant_renameFiles;
347
348
	public static String FormatManifestAction_actionText;
349
350
	public static String FormatManifestOperation_subtask;
351
352
	public static String FormatManifestOperation_task;
353
354
	public static String ImportActionGroup_binaryWithLinkedContent;
355
356
	public static String ImportActionGroup_importContributingPlugin;
357
358
	public static String InformationSection_0;
359
360
	public static String InformationSection_1;
361
362
	public static String InputContext_errorMessageFileDoesNotExist;
363
364
	public static String InputContext_errorMessageLocationNotSet;
365
366
	public static String InputContextManager_errorMessageInputContextNotFound;
367
368
	public static String LibrarySection_addDialogButton;
369
370
	public static String MainPreferencePage_exportingGroup;
371
	public static String MainPreferencePage_sourceGroup;
372
	public static String MainPreferencePage_group2;
373
	public static String MainPreferencePage_promptBeforeOverwrite;
374
	public static String MainPreferencePage_promtBeforeRemove;
375
	public static String MainPreferencePage_showSourceBundles;
376
	public static String MainPreferencePage_updateStale;
377
	public static String MainPreferencePage_targetDefinitionsGroup;
378
379
	public static String ManifestStructureCreator_errorMessage;
380
381
	public static String MissingResourcePage_missingResource;
382
383
	public static String MissingResourcePage_unableToOpen;
384
385
	public static String MissingResourcePage_unableToOpenFull;
386
387
	public static String NewLibraryPluginCreationPage_pdependencies;
388
389
	public static String OpenSchemaAction_errorMsgSchemaNotFound;
390
391
	public static String OpenSchemaAction_msgUnknown;
392
393
	public static String OpenSchemaAction_titleExtensionPointSchema;
394
395
	public static String OSGiFrameworkPreferencePage_default;
396
397
	public static String OSGiFrameworkPreferencePage_installed;
398
399
	public static String PDEFormEditor_errorMessageSaveNotCompleted;
400
401
	public static String PDEFormEditor_errorTitleProblemSaveAs;
402
403
	public static String PDEFormPage_titleDetails;
404
405
	public static String PDEFormPage_titleMessage;
406
407
	public static String PDESourcePage_actionTextQuickOutline;
408
409
	public static String QuickOutlinePopupDialog_infoTextPressEscToExit;
410
411
	public static String RemoveUnknownExecEnvironments_label;
412
413
	public static String AddDefaultExecutionEnvironment_label;
414
415
	public static String RevertUnsupportSingletonResolution_desc;
416
417
	public static String AddLibraryDialog_emptyLibraries;
418
419
	public static String BaseWizardSelectionPage_noDesc;
420
421
	public static String ChooseClassXMLResolution_label;
422
423
	public static String ChooseManifestClassResolution_label;
424
425
	public static String CreateClassXMLResolution_label;
426
427
	public static String CreateManifestClassResolution_label;
428
429
	public static String ElementSection_missingRefElement;
430
431
	public static String ExternalizeResolution_attrib;
432
433
	public static String ExternalizeResolution_header;
434
435
	public static String ExternalizeResolution_text;
436
437
	public static String OpenManifestAction_noManifest;
438
439
	public static String ProjectNamesPage_duplicateNames;
440
441
	public static String RemoveNodeXMLResolution_attrLabel;
442
443
	public static String RemoveNodeXMLResolution_label;
444
445
	public static String RuntimeInfoSection_replace;
446
447
	public static String RuntimeInfoSection_replacedialog;
448
449
	public static String SchemaIncludesSection_missingWarningMessage;
450
451
	public static String SchemaIncludesSection_missingWarningTitle;
452
453
	public static String ShowDescriptionAction_schemaNotAvail;
454
455
	public static String TableSection_itemCount;
456
457
	public static String UpdateClasspathResolution_label;
458
459
	//
460
	// PDE resource strings
461
	// Part 2.    (TRANSLATE Part 2)
462
	// These are the translable properties.
463
	//
464
465
	public static String UpdateManager_noUndo;
466
	public static String UpdateManager_noRedo;
467
	public static String UpdateManager_undo;
468
	public static String UpdateManager_redo;
469
	public static String UpdateManager_op_add;
470
	public static String UpdateManager_op_remove;
471
	public static String UpdateManager_op_change;
472
473
	//
474
475
	public static String PluginModelManager_outOfSync;
476
477
	// Status text #####################################
478
	public static String Errors_CreationError;
479
	public static String Errors_CreationError_NoWizard;
480
481
	public static String UpdateSplashHandlerInModelAction_msgAddingExtension;
482
483
	public static String UpdateSplashHandlerInModelAction_msgAddingExtensionPoint;
484
485
	public static String UpdateSplashHandlerInModelAction_msgModifyingExtension;
486
487
	public static String UpdateSplashHandlerInModelAction_nameApplicationFramework;
488
489
	public static String UpdateSplashHandlerInModelAction_nameEmbedded;
490
491
	public static String UpdateSplashHandlerInModelAction_nameEnterprise;
492
493
	public static String UpdateSplashHandlerInModelAction_nameLanguages;
494
495
	public static String UpdateSplashHandlerInModelAction_nameRCP;
496
497
	public static String UpdateSplashHandlerInModelAction_splashExtensionPointName;
498
499
	public static String UpdateSplashHandlerInModelAction_templateTypeBrowser;
500
501
	public static String UpdateSplashHandlerInModelAction_templateTypeExtensible;
502
503
	public static String UpdateSplashHandlerInModelAction_templateTypeInteractive;
504
505
	public static String UpdateSplashProgressAction_msgErrorCustomFileSaveFailed;
506
507
	public static String UpdateSplashProgressAction_msgErrorTextFileBuffer;
508
509
	public static String UpdateSplashProgressAction_msgErrorTextFileBufferManager;
510
511
	public static String UpdateSplashProgressAction_msgProgressCustomizingSplash;
512
513
	// Reusable Parts ################################
514
	public static String WizardCheckboxTablePart_selectAll;
515
	public static String WizardCheckboxTablePart_deselectAll;
516
	public static String WizardCheckboxTablePart_counter;
517
518
	// Outline #################################
519
	public static String ToggleLinkWithEditorAction_label;
520
	public static String ToggleLinkWithEditorAction_toolTip;
521
	public static String ToggleLinkWithEditorAction_description;
522
	public static String PDEMultiPageContentOutline_SortingAction_label;
523
	public static String PDEMultiPageContentOutline_SortingAction_tooltip;
524
	public static String PDEMultiPageContentOutline_SortingAction_description;
525
526
	// build.properties editor #####################
527
	public static String BuildEditor_BuildPage_title;
528
	public static String BuildEditor_AddLibraryDialog_label;
529
530
	public static String BuildEditor_RuntimeInfoSection_title;
531
	public static String BuildEditor_RuntimeInfoSection_desc;
532
	public static String BuildEditor_RuntimeInfoSection_duplicateLibrary;
533
	public static String BuildEditor_RuntimeInfoSection_duplicateFolder;
534
	public static String BuildEditor_RuntimeInfoSection_addLibrary;
535
	public static String BuildEditor_RuntimeInfoSection_popupAdd;
536
	public static String BuildEditor_RuntimeInfoSection_addFolder;
537
	public static String BuildEditor_RuntimeInfoSection_popupFolder;
538
539
	public static String BuildEditor_SrcSection_title;
540
	public static String BuildEditor_SrcSection_desc;
541
	public static String BuildEditor_BinSection_title;
542
	public static String BuildEditor_BinSection_desc;
543
544
	public static String BuildEditor_ClasspathSection_add;
545
	public static String BuildEditor_SourceFolderSelectionDialog_button;
546
	public static String BuildEditor_ClasspathSection_remove;
547
	public static String BuildEditor_ClasspathSection_title;
548
	public static String BuildEditor_ClasspathSection_desc;
549
	public static String BuildEditor_ClasspathSection_jarsTitle;
550
	public static String BuildEditor_ClasspathSection_jarsDesc;
551
552
	// Feature Manifest Editor ####################
553
	public static String FeatureEditor_BuildAction_label;
554
	public static String FeatureEditor_FeaturePage_title;
555
	public static String FeatureEditor_InfoPage_title;
556
	public static String FeatureEditor_InfoPage_heading;
557
	public static String FeatureEditor_ReferencePage_title;
558
	public static String FeatureEditor_ReferencePage_heading;
559
	public static String FeatureEditor_IncludesPage_title;
560
	public static String FeatureEditor_IncludesPage_heading;
561
	public static String FeatureEditor_DependenciesPage_heading;
562
	public static String FeatureEditor_DependenciesPage_title;
563
	public static String FeatureEditor_AdvancedPage_title;
564
	public static String FeatureEditor_AdvancedPage_heading;
565
566
	public static String FeatureEditor_PortabilityChoicesDialog_title;
567
	public static String FeatureEditor_PortabilityChoicesDialog_choices;
568
569
	public static String FeatureEditor_SpecSection_title;
570
	public static String FeatureEditor_SpecSection_desc;
571
	public static String FeatureEditor_SpecSection_desc_patch;
572
	public static String FeatureEditor_SpecSection_id;
573
	public static String FeatureEditor_SpecSection_patchedId;
574
	public static String FeatureEditor_SpecSection_name;
575
	public static String FeatureEditor_SpecSection_version;
576
	public static String FeatureEditor_SpecSection_patchedVersion;
577
	public static String FeatureEditor_SpecSection_provider;
578
	public static String FeatureEditor_SpecSection_plugin;
579
	public static String FeatureEditor_SpecSection_updateUrlLabel;
580
	public static String FeatureEditor_SpecSection_updateUrl;
581
	public static String FeatureEditor_SpecSection_synchronize;
582
	public static String FeatureEditor_SpecSection_badVersionTitle;
583
	public static String FeatureEditor_SpecSection_badVersionMessage;
584
	public static String FeatureEditor_SpecSection_badUrlTitle;
585
	public static String FeatureEditor_SpecSection_badUrlMessage;
586
	public static String FeatureEditor_PortabilitySection_title;
587
	public static String FeatureEditor_PortabilitySection_desc;
588
	public static String FeatureEditor_PortabilitySection_os;
589
	public static String FeatureEditor_PortabilitySection_ws;
590
	public static String FeatureEditor_PortabilitySection_nl;
591
	public static String FeatureEditor_PortabilitySection_arch;
592
	public static String FeatureEditor_PortabilitySection_edit;
593
594
	public static String FeatureEditor_IncludedFeatures_title;
595
	public static String FeatureEditor_IncludedFeatures_desc;
596
	public static String FeatureEditor_IncludedFeatures_new;
597
	public static String FeatureEditor_IncludedFeatures_up;
598
	public static String FeatureEditor_IncludedFeatures_down;
599
	public static String FeatureEditor_IncludedFeatures_sortAlpha;
600
601
	public static String SiteEditor_IncludedFeaturesDetailsSection_title;
602
	public static String SiteEditor_IncludedFeaturesDetailsSection_desc;
603
	public static String SiteEditor_IncludedFeaturesDetailsSection_featureLabel;
604
	public static String SiteEditor_IncludedFeaturesDetailsSection_optional;
605
	public static String SiteEditor_IncludedFeaturesDetailsSection_searchLocation;
606
	public static String SiteEditor_IncludedFeaturesDetailsSection_root;
607
	public static String SiteEditor_IncludedFeaturesDetailsSection_self;
608
	public static String SiteEditor_IncludedFeaturesDetailsSection_both;
609
610
	public static String FeatureEditor_IncludedFeaturePortabilitySection_title;
611
	public static String FeatureEditor_IncludedFeaturePortabilitySection_desc;
612
613
	public static String FeatureEditor_HandlerSection_title;
614
	public static String FeatureEditor_HandlerSection_desc;
615
	public static String FeatureEditor_HandlerSection_library;
616
	public static String FeatureEditor_HandlerSection_handler;
617
618
	public static String FeatureEditor_InstallSection_title;
619
	public static String FeatureEditor_InstallSection_desc;
620
	public static String FeatureEditor_InstallSection_colocation_desc;
621
	public static String FeatureEditor_InstallSection_colocation;
622
	public static String FeatureEditor_InstallSection_exclusive;
623
624
	public static String FeatureEditor_InfoSection_desc;
625
626
	public static String FeatureEditor_InfoSection_url;
627
	public static String FeatureEditor_InfoSection_text;
628
	public static String FeatureEditor_info_description;
629
	public static String FeatureEditor_info_license;
630
	public static String FeatureEditor_info_copyright;
631
	public static String FeatureEditor_info_discoveryUrls;
632
633
	public static String FeatureEditor_PluginSection_pluginTitle;
634
	public static String FeatureEditor_PluginSection_pluginDesc;
635
	public static String FeatureEditor_PluginSection_new;
636
	public static String FeatureEditor_PluginSection_sortAlpha;
637
638
	public static String FeatureEditor_PluginPortabilitySection_title;
639
	public static String FeatureEditor_PluginPortabilitySection_desc;
640
641
	public static String SiteEditor_PluginDetailsSection_title;
642
	public static String SiteEditor_PluginDetailsSection_desc;
643
	public static String SiteEditor_PluginDetailsSection_pluginLabel;
644
	public static String SiteEditor_PluginDetailsSection_downloadSize;
645
	public static String SiteEditor_PluginDetailsSection_installSize;
646
	public static String SiteEditor_PluginDetailsSection_unpack;
647
648
	public static String FeatureEditor_DataSection_title;
649
	public static String FeatureEditor_DataSection_desc;
650
	public static String FeatureEditor_DataSection_new;
651
652
	public static String SiteEditor_DataDetailsSection_title;
653
	public static String SiteEditor_DataDetailsSection_desc;
654
	public static String SiteEditor_DataDetailsSection_downloadSize;
655
	public static String SiteEditor_DataDetailsSection_installSize;
656
657
	public static String FeatureEditor_DataDetailsSection_title;
658
	public static String FeatureEditor_DataDetailsSection_desc;
659
660
	public static String FeatureExportJob_name;
661
662
	public static String FeatureEditor_RequiresSection_title;
663
	public static String FeatureEditor_RequiresSection_desc;
664
	public static String FeatureEditor_RequiresSection_sync;
665
	public static String FeatureEditor_RequiresSection_compute;
666
	public static String FeatureEditor_RequiresSection_plugin;
667
	public static String FeatureEditor_RequiresSection_feature;
668
	public static String FeatureEditor_RequiresSection_sortAlpha;
669
670
	public static String FeatureEditor_URLSection_desc;
671
	public static String FeatureEditor_URLSection_new;
672
	public static String FeatureEditor_URLSection_newDiscoverySite;
673
	public static String FeatureEditor_URLSection_newURL;
674
	public static String FeatureEditor_URLDetailsSection_desc;
675
	public static String FeatureEditor_URLDetailsSection_updateUrlLabel;
676
	public static String FeatureEditor_URLDetailsSection_updateUrl;
677
	public static String FeatureEditor_URLDetailsSection_badUrlTitle;
678
	public static String FeatureEditor_URLDetailsSection_badUrlMessage;
679
680
	public static String FeatureEditor_InfoPage_ContentSection_title;
681
	public static String FeatureEditor_InfoPage_ContentSection_text;
682
683
	public static String FeatureEditor_InfoPage_PackagingSection_title;
684
	public static String FeatureEditor_InfoPage_PackagingSection_text;
685
686
	public static String FeatureEditor_InfoPage_PublishingSection_title;
687
	public static String FeatureEditor_InfoPage_PublishingSection_text;
688
689
	public static String FeatureOptionsTab_0;
690
691
	public static String FeatureOutlinePage_discoverUrls;
692
693
	// Plug-in Manifest Editor ########################
694
695
	public static String ManifestEditor_DetailExtensionPointSection_title;
696
	public static String ManifestEditor_DetailExtensionPointSection_new;
697
	public static String ManifestEditor_DetailExtensionPointSection_newExtensionPoint;
698
699
	public static String ManifestEditor_DetailExtension_title;
700
	public static String ManifestEditor_DetailExtension_new;
701
	public static String ManifestEditor_DetailExtension_remove;
702
	public static String ManifestEditor_DetailExtension_edit;
703
	public static String ManifestEditor_DetailExtension_up;
704
	public static String ManifestEditor_DetailExtension_down;
705
	public static String ManifestEditor_DetailExtension_missingExtPointSchema;
706
707
	public static String ManifestEditor_ExportSection_title;
708
	public static String ManifestEditor_ExportSection_desc;
709
	public static String ManifestEditor_ExportSection_fullExport;
710
	public static String ManifestEditor_ExportSection_selectedExport;
711
	public static String ManifestEditor_ExportSection_add;
712
	public static String ManifestEditor_ExportSection_remove;
713
	public static String PackageSelectionDialog_label;
714
	public static String PackageSelectionDialog_title;
715
716
	public static String ManifestEditor_ExtensionSection_title;
717
	public static String ManifestEditor_OverviewPage_title;
718
719
	public static String ManifestEditor_ExtensionPointDetails_validate_errorStatus;
720
	public static String ManifestEditor_ExtensionPointDetails_schemaLocation_title;
721
	public static String ManifestEditor_ExtensionPointDetails_schemaLocation_desc;
722
723
	public static String ManifestEditor_ContentSection_title;
724
	public static String ManifestEditor_ContentSection_ftitle;
725
726
	public static String ManifestEditor_DeployingSection_title;
727
728
	public static String ManifestSourcePage_dependencies;
729
	public static String ManifestEditor_JarsSection_dialogTitle;
730
	public static String ManifestEditor_JarsSection_dialogMessage;
731
732
	public static String ManifestEditor_LibrarySection_title;
733
	public static String ManifestEditor_LibrarySection_fdesc;
734
	public static String ManifestEditor_LibrarySection_desc;
735
	public static String ManifestEditor_LibrarySection_up;
736
	public static String ManifestEditor_LibrarySection_down;
737
	public static String ManifestEditor_LibrarySection_newLibrary;
738
	public static String ManifestEditor_LibrarySection_newLibraryEntry;
739
	public static String NewManifestEditor_LibrarySection_add;
740
	public static String NewManifestEditor_LibrarySection_new;
741
	public static String NewManifestEditor_LibrarySection_remove;
742
	public static String ManifestEditor_RuntimeLibraryDialog_label;
743
	public static String ManifestEditor_RuntimeLibraryDialog_default;
744
	public static String ManifestEditor_RuntimeLibraryDialog_validationError;
745
746
	public static String ManifestSourcePage_libraries;
747
	public static String ManifestSourcePage_extensions;
748
749
	public static String ManifestEditor_MatchSection_optional;
750
	public static String ManifestEditor_MatchSection_reexport;
751
	public static String ManifestEditor_MatchSection_version;
752
	public static String ManifestEditor_MatchSection_perfect;
753
	public static String ManifestEditor_MatchSection_equivalent;
754
	public static String ManifestEditor_MatchSection_compatible;
755
	public static String ManifestEditor_MatchSection_greater;
756
757
	public static String ManifestEditor_PluginSpecSection_title;
758
	public static String ManifestEditor_PluginSpecSection_desc;
759
	public static String ManifestEditor_PluginSpecSection_fdesc;
760
761
	public static String ManifestEditor_PluginSpecSection_versionMatch;
762
763
	public static String ResourceAttributeCellEditor_title;
764
	public static String ResourceAttributeCellEditor_message;
765
766
	public static String IdAttributeRow_title;
767
	public static String IdAttributeRow_message;
768
	public static String IdAttributeRow_emptyMessage;
769
770
	public static String ManifestEditor_RuntimeForm_title;
771
	public static String ManifestSourcePage_extensionPoints;
772
773
	public static String ManifestSourcePage_renameActionText;
774
775
	public static String ManifestEditor_TestingSection_title;
776
777
	// Schema Editor ##################################
778
	public static String SchemaEditorContributor_previewAction;
779
	public static String SchemaEditor_previewLink;
780
781
	public static String SchemaEditor_DocSection_desc;
782
	public static String SchemaEditor_topic_overview;
783
	public static String SchemaEditor_topic_since;
784
	public static String SchemaEditor_topic_examples;
785
	public static String SchemaEditor_topic_implementation;
786
	public static String SchemaEditor_topic_api;
787
	public static String SchemaEditor_topic_copyright;
788
789
	public static String SchemaEditor_SpecSection_title;
790
	public static String SchemaEditor_SpecSection_desc;
791
	public static String SchemaEditor_SpecSection_plugin;
792
	public static String SchemaEditor_SpecSection_point;
793
	public static String SchemaEditor_SpecSection_name;
794
795
	public static String SchemaEditor_ElementSection_title;
796
	public static String SchemaEditor_ElementSection_desc;
797
	public static String SchemaEditor_ElementSection_newElement;
798
	public static String SchemaEditor_ElementSection_newAttribute;
799
800
	public static String ReviewPage_noSampleFound;
801
802
	public static String SchemaEditor_NewAttribute_label;
803
	public static String SchemaEditor_NewAttribute_tooltip;
804
	public static String SchemaEditor_NewAttribute_initialName;
805
806
	public static String SchemaEditor_NewElement_label;
807
	public static String SchemaEditor_NewElement_tooltip;
808
	public static String SchemaEditor_NewElement_initialName;
809
810
	public static String SchemaEditor_NewCompositor_tooltip;
811
812
	public static String SchemaEditor_FormPage_title;
813
	public static String SchemaEditor_DocPage_title;
814
815
	// Launchers #######################################
816
	public static String MainTab_name;
817
	public static String WorkspaceDataBlock_workspace;
818
	public static String WorkspaceDataBlock_location;
819
	public static String WorkspaceDataBlock_clear;
820
	public static String WorkspaceDataBlock_askClear;
821
	public static String WorkspaceDataBlock_clearLog;
822
	public static String WorkspaceDataBlock_clearWorkspace;
823
	public static String BasicLauncherTab_javaExec;
824
825
	public static String BasicLauncherTab_unbound;
826
	public static String ProgramBlock_runProduct;
827
828
	public static String BasicLauncherTab_ee;
829
	public static String BasicLauncherTab_jre;
830
831
	public static String BasicLauncherTab_environments;
832
	public static String BasicLauncherTab_installedJREs;
833
	public static String ProgramBlock_productDecorationWarning0;
834
835
	public static String ProgramBlock_programToRun;
836
	public static String BasicLauncherTab_bootstrap;
837
	public static String BasicLauncherTab_javaExecDefault;
838
	public static String BasicLauncherTab_noJreForEeMessage;
839
	public static String ProgramBlock_runApplication;
840
	public static String JUnitProgramBlock_headless;
841
842
	public static String AdvancedLauncherTab_name;
843
	public static String AdvancedLauncherTab_workspacePlugins;
844
	public static String AdvancedLauncherTab_selectAll;
845
	public static String AdvancedLauncherTab_deselectAll;
846
	public static String AdvancedFeatureExportPage_noSite;
847
	public static String AdvancedPluginExportPage_signJar;
848
	public static String AdvancedPluginExportPage_noAlias;
849
	public static String AdvancedLauncherTab_subset;
850
	public static String AdvancedLauncherTab_addNew;
851
	public static String AdvancedLauncherTab_defaults;
852
	public static String AdvancedLauncherTab_workingSet;
853
	public static String AdvancedLauncherTab_selectedBundles;
854
	public static String AdvancedFeatureExportPage_jnlp;
855
	public static String AdvancedPluginExportPage_alias;
856
	public static String JARSigningTab_keypass;
857
	public static String AdvancedLauncherTab_includeOptional;
858
	public static String AdvancedFeatureExportPage_siteURL;
859
	public static String AdvancedPluginExportPage_keystore;
860
	public static String AdvancedPluginExportPage_password;
861
	public static String AdvancedFeatureExportPage_noVersion;
862
	public static String AdvancedPluginExportPage_signButton;
863
	public static String AdvancedPluginExportPage_noKeystore;
864
	public static String AdvancedPluginExportPage_noPassword;
865
	public static String AdvancedFeatureExportPage_createJNLP;
866
	public static String AdvancedFeatureExportPage_jreVersion;
867
	public static String AdvancedLauncherTab_error_featureSetup;
868
	public static String AdvancedPluginExportPage_qualifier;
869
870
	public static String TracingLauncherTab_name;
871
	public static String TracingLauncherTab_tracing;
872
	public static String TracingLauncherTab_selectAll;
873
	public static String TracinglauncherTab_deselectAll;
874
875
	public static String ConfigurationTab_name;
876
	public static String ConfigurationTab_clearArea;
877
	public static String ConfigurationTab_configAreaGroup;
878
	public static String ConfigurationTab_useDefaultLoc;
879
	public static String ConfigurationTab_configLog;
880
	public static String ConfigurationSection_title;
881
	public static String ConfigurationSection_desc;
882
	public static String ConfigurationSection_file;
883
	public static String ConfigurationSection_existing;
884
	public static String ConfigurationTab_configLocMessage;
885
	public static String ConfigurationTab_configFileGroup;
886
	public static String ConfigurationTab_defaultConfigIni;
887
	public static String ConfigurationTab_existingConfigIni;
888
	public static String ConfigurationTab_templateLoc;
889
	public static String ConfigurationSection_default;
890
	public static String ConfigurationSection_browse;
891
	public static String ConfigurationSection_message;
892
	public static String ConfigurationTab_fileSelection;
893
	public static String ConfigurationSection_selection;
894
	public static String ConfigurationTab_fileDialogMessage;
895
896
	public static String WorkbenchLauncherConfigurationDelegate_noJRE;
897
	public static String WorkbenchLauncherConfigurationDelegate_jrePathNotFound;
898
	public static String WorkbenchLauncherConfigurationDelegate_badFeatureSetup;
899
	public static String WorkbenchLauncherConfigurationDelegate_noStartup;
900
	public static String WorkbenchLauncherConfigurationDelegate_confirmDeleteWorkspace;
901
	public static String JUnitLaunchConfiguration_error_notaplugin;
902
	public static String JUnitLaunchConfiguration_error_missingPlugin;
903
904
	public static String Launcher_error_title;
905
	public static String LauncherSection_desc;
906
	public static String LauncherSection_ico;
907
	public static String LauncherSection_file;
908
	public static String LauncherSection_icon;
909
	public static String LauncherSection_tiny;
910
	public static String Launcher_error_code13;
911
	public static String Launcher_error_code15;
912
	public static String Launcher_error_displayInLogView;
913
	public static String Launcher_error_displayInSystemEditor;
914
	public static String LauncherSection_browse;
915
	public static String LauncherSection_title;
916
	public static String LauncherSection_label;
917
	public static String LauncherSection_bmpImages;
918
	public static String LauncherSection_Low16;
919
	public static String LauncherSection_High16;
920
	public static String LauncherSection_32Low;
921
	public static String LauncherSection_32High;
922
	public static String LauncherSection_48Low;
923
	public static String LauncherSection_48High;
924
	public static String LauncherSection_linuxLabel;
925
	public static String LauncherSection_large;
926
	public static String LauncherSection_medium;
927
	public static String LauncherSection_small;
928
	public static String LauncherSection_macLabel;
929
	public static String OpenLogDialog_title;
930
	public static String OpenLogDialog_message;
931
	public static String OpenLogDialog_cannotDisplay;
932
933
	public static String OSGiBundlesTab_frameworkLabel;
934
	public static String OSGiLaunchConfiguration_cannotFindLaunchConfiguration;
935
	public static String OSGiLaunchConfiguration_selected;
936
937
	// Preferences ####################################
938
	public static String Preferences_MainPage_Description;
939
940
	public static String Preferences_MainPage_showObjects;
941
	public static String Preferences_MainPage_useIds;
942
	public static String Preferences_MainPage_useFullNames;
943
944
	public static String Preferences_TargetEnvironmentPage_os;
945
	public static String Preferences_TargetEnvironmentPage_ws;
946
	public static String Preferences_TargetEnvironmentPage_nl;
947
	public static String Preferences_TargetEnvironmentPage_arch;
948
949
	public static String SourceBlock_add;
950
	public static String SourceBlock_remove;
951
952
	// Wizards #######################################
953
	public static String NewFragmentProjectWizard_title;
954
	public static String NewPluginProjectFromTemplateWizard_0;
955
956
	public static String NewPluginProjectFromTemplateWizard_1;
957
958
	public static String NewProjectWizard_MainPage_ftitle;
959
	public static String NewProductFileWizard_windowTitle;
960
	public static String NewProjectWizard_MainPage_fdesc;
961
962
	public static String NewProjectWizard_title;
963
	public static String NewProjectWizard_MainPage_title;
964
	public static String NewProjectWizard_MainPage_desc;
965
966
	public static String ProjectNamesPage_emptyName;
967
	public static String ProjectStructurePage_settings;
968
	public static String ProjectStructurePage_java;
969
	public static String ProjectStructurePage_source;
970
	public static String ProjectStructurePage_output;
971
972
	public static String ProjectNamesPage_projectName;
973
	public static String ProjectNamesPage_multiProjectName;
974
	public static String ProjectNamesPage_title;
975
	public static String ProjectNamesPage_desc;
976
	public static String ProjectNamesPage_noSampleFound;
977
978
	public static String ContentPage_0;
979
980
	public static String ContentPage_1;
981
982
	public static String ContentPage_title;
983
	public static String ContentPage_ftitle;
984
	public static String ContentPage_desc;
985
	public static String ContentPage_fdesc;
986
	public static String ContentPage_pGroup;
987
	public static String ContentPage_fGroup;
988
	public static String ContentPage_parentPluginGroup;
989
	public static String ContentPage_pClassGroup;
990
	public static String ContentPage_pid;
991
	public static String ContentPage_pversion;
992
	public static String ContentPage_pname;
993
	public static String ContentPage_pprovider;
994
	public static String ContentPage_fid;
995
	public static String ContentPage_fversion;
996
	public static String ContentPage_fname;
997
	public static String ContentPage_fprovider;
998
	public static String ContentPage_generate;
999
	public static String ContentPage_classname;
1000
	public static String ContentPage_uicontribution;
1001
	public static String FragmentContentPage_pid;
1002
	public static String FragmentContentPage_pversion;
1003
	public static String ContentPage_browse;
1004
	public static String ContentPage_matchRule;
1005
	public static String ContentPage_noid;
1006
	public static String ContentPage_invalidId;
1007
	public static String ContentPage_badversion;
1008
	public static String ContentPage_noname;
1009
	public static String ContentPage_nopid;
1010
	public static String ContentPage_pluginNotFound;
1011
	public static String ContentPage_illegalCharactersInID;
1012
	public static String WizardListSelectionPage_title;
1013
	public static String WizardListSelectionPage_desc;
1014
	public static String WizardListSelectionPage_label;
1015
	public static String WizardListSelectionPage_templates;
1016
	public static String OptionTemplateSection_mustBeSet;
1017
1018
	public static String NewLibraryPluginProjectWizard_title;
1019
	public static String NewLibraryPluginCreationPage_title;
1020
	public static String NewLibraryPluginCreationPage_desc;
1021
	public static String NewLibraryPluginCreationPage_jarred;
1022
	public static String NewLibraryPluginCreationPage_pGroup;
1023
	public static String NewLibraryPluginCreationPage_pid;
1024
	public static String NewLibraryPluginCreationPage_pversion;
1025
	public static String NewLibraryPluginCreationPage_pname;
1026
	public static String NewLibraryPluginCreationPage_pprovider;
1027
	public static String NewLibraryPluginCreationPage_noid;
1028
	public static String NewLibraryPluginCreationPage_invalidId;
1029
	public static String NewLibraryPluginCreationPage_noversion;
1030
	public static String NewLibraryPluginCreationPage_noname;
1031
	public static String NewLibraryPluginCreationPage_UpdateReferences_button;
1032
	public static String LibraryPluginJarsPage_title;
1033
	public static String LibraryPluginJarsPage_desc;
1034
	public static String LibraryPluginJarsPage_label;
1035
	public static String LibraryPluginJarsPage_add;
1036
	public static String LibraryPluginJarsPage_addExternal;
1037
	public static String LibraryPluginJarsPage_remove;
1038
	public static String LibraryPluginJarsPage_SelectionDialog_title;
1039
	public static String LibraryPluginJarsPage_SelectionDialog_message;
1040
1041
	public static String NewProjectCreationOperation_creating;
1042
	public static String NewProjectCreationOperation_project;
1043
	public static String NewProjectCreationOperation_setClasspath;
1044
	public static String NewProjectCreationOperation_manifestFile;
1045
	public static String NewProjectCreationOperation_buildPropertiesFile;
1046
	public static String NewProjectCreationOperation_copyingJar;
1047
	public static String NewProjectCreationOperation_errorImportingJar;
1048
1049
	public static String AbstractTemplateSection_generating;
1050
1051
	public static String BuildAction_Validate;
1052
	public static String BuildAction_Generate;
1053
	public static String BuildAction_Update;
1054
	public static String BuildPage_custom;
1055
	public static String BuildPage_name;
1056
	public static String BuildAction_ErrorDialog_Title;
1057
	public static String BuildAction_ErrorDialog_Message;
1058
	public static String BuildPluginAction_ErrorDialog_Title;
1059
	public static String BuildPluginAction_ErrorDialog_Message;
1060
1061
	public static String NewFeatureWizard_wtitle;
1062
	public static String NewFeatureWizard_MainPage_desc;
1063
	public static String NewFeatureWizard_SpecPage_title;
1064
	public static String NewFeatureWizard_SpecPage_desc;
1065
	public static String NewFeatureWizard_SpecPage_id;
1066
	public static String NewFeatureWizard_SpecPage_name;
1067
	public static String NewFeatureWizard_SpecPage_version;
1068
	public static String NewFeatureWizard_SpecPage_provider;
1069
	public static String NewFeatureWizard_SpecPage_versionFormat;
1070
	public static String NewFeatureWizard_sampleCopyrightDesc;
1071
	public static String NewFeatureWizard_sampleLicenseDesc;
1072
	public static String NewFeatureWizard_sampleDescriptionDesc;
1073
	public static String NewSiteProjectCreationPage_webTitle;
1074
	public static String NewFeatureWizard_SpecPage_missing;
1075
	public static String NewFeatureWizard_SpecPage_pmissing;
1076
	public static String NewFeatureWizard_SpecPage_invalidId;
1077
1078
	public static String NewFeatureWizard_PlugPage_title;
1079
	public static String NewFeatureWizard_PlugPage_desc;
1080
1081
	public static String NewFeatureWizard_creatingProject;
1082
	public static String NewFeatureWizard_creatingManifest;
1083
	public static String NewFeatureWizard_overwriteFeature;
1084
	public static String NewFeatureWizard_SpecPage_library;
1085
	public static String NewFeatureWizard_SpecPage_patchProperties;
1086
1087
	public static String FeatureDetailsSection_title;
1088
	public static String FeatureDetailsSection_desc;
1089
	public static String FeatureDetailsSection_url;
1090
	public static String FeatureDetailsSection_patch;
1091
	public static String FeatureDetailsSection_requiredURL;
1092
	public static String FeatureDetailsSection_requiredURL_title;
1093
1094
	public static String SiteEditor_PortabilitySection_title;
1095
	public static String SiteEditor_PortabilitySection_desc;
1096
	public static String SiteEditor_PortabilitySection_os;
1097
	public static String SiteEditor_PortabilitySection_ws;
1098
	public static String SiteEditor_PortabilitySection_nl;
1099
	public static String SiteEditor_PortabilitySection_arch;
1100
	public static String SiteEditor_PortabilitySection_edit;
1101
	public static String SiteEditor_PortabilityChoicesDialog_title;
1102
1103
	public static String FeaturePatch_wtitle;
1104
	public static String FeaturePatch_MainPage_desc;
1105
	public static String PatchSpec_title;
1106
	public static String NewFeaturePatch_SpecPage_id;
1107
	public static String NewFeaturePatch_SpecPage_name;
1108
	public static String NewFeaturePatch_SpecPage_provider;
1109
	public static String NewFeaturePatch_SpecPage_notFound;
1110
	public static String FeatureSelectionDialog_title;
1111
	public static String FeatureSelectionDialog_message;
1112
1113
	public static String VersionSyncWizard_wtitle;
1114
	public static String VersionSyncWizard_title;
1115
	public static String VersionSyncWizard_desc;
1116
	public static String VersionSyncWizard_group;
1117
	public static String VersionSyncWizard_useComponent;
1118
	public static String VersionSyncWizard_usePlugins;
1119
	public static String VersionSyncWizard_usePluginsAtBuild;
1120
	public static String VersionSyncWizard_synchronizing;
1121
1122
	public static String JavaAttributeWizard_wtitle;
1123
1124
	public static String ExtensionsPage_collapseAll;
1125
	public static String ExtensionPointDetails_title;
1126
	public static String ExtensionPointDetails_desc;
1127
	public static String ExtensionPointDetails_id;
1128
	public static String ExtensionPointDetails_name;
1129
	public static String ExtensionPointsPage_title;
1130
	public static String ExtensionPointsPage_tabName;
1131
	public static String ExtensionPointDetails_schema;
1132
	public static String ExtensionPointDetails_schemaLinks;
1133
	public static String ExtensionPointsSection_message1;
1134
1135
	public static String ExtensionPointsSection_rename_label;
1136
	public static String ExtensionPointDetails_browse;
1137
	public static String ExtensionPointsSection_title;
1138
	public static String ExtensionPointDetails_noSchemaLinks;
1139
	public static String ExtensionElementDetails_descNoAttributes;
1140
	public static String ExtensionDetails_noPoint_title;
1141
	public static String ExtensionDetails_extensionPointLinks;
1142
	public static String ExtensionElementDetails_setDesc;
1143
	public static String ExtensionEditorSelectionPage_title;
1144
	public static String ExtensionEditorSelectionPage_message;
1145
	public static String ExtensionEditorSelectionPage_desc;
1146
	public static String ShowDescriptionAction_noPoint_desc;
1147
	public static String ExtensionElementDetails_title;
1148
1149
	public static String BaseExtensionPoint_pluginId;
1150
	public static String BaseExtensionPoint_id;
1151
	public static String BaseExtensionPoint_name;
1152
1153
	public static String BaseExtensionPoint_schema;
1154
	public static String BaseExtensionPoint_schemaLocation;
1155
	public static String BaseExtensionPoint_edit;
1156
	public static String BaseExtensionPoint_shared;
1157
	public static String BaseExtensionPoint_sections_overview;
1158
	public static String BaseExtensionPoint_sections_since;
1159
	public static String BaseExtensionPoint_sections_usage;
1160
	public static String BaseExtensionPoint_sections_api;
1161
	public static String BaseExtensionPoint_sections_supplied;
1162
	public static String BaseExportWizard_confirmReplace_desc;
1163
	public static String BaseExportWizardPage_packageJARs;
1164
	public static String BaseExportWizard_wtitle;
1165
	public static String BaseExportWizardPage_fPackageJARs;
1166
	public static String BaseFeatureSpecPage_patchGroup_title;
1167
	public static String BaseFeatureSpecPage_featurePropertiesGroup_title;
1168
	public static String BaseFeatureSpecPage_browse;
1169
	public static String BaseExtensionPoint_sections_copyright;
1170
	public static String BaseExportWizard_confirmReplace_title;
1171
	public static String BaseExtensionPoint_generating;
1172
	public static String GeneralInfoSection_version;
1173
	public static String GeneralInfoSection_provider;
1174
	public static String GeneralInfoSection_pluginId;
1175
	public static String GeneralInfoSection_pluginVersion;
1176
	public static String GeneralInfoSection_hostMinVersionRange;
1177
	public static String GeneralInfoSection_hostMaxVersionRange;
1178
1179
	public static String NewWizard_wtitle;
1180
	public static String NewExtensionWizard_wtitle;
1181
	public static String NewElementAction_generic;
1182
	public static String NewExtensionWizard_PointSelectionPage_title;
1183
	public static String NewExtensionWizard_PointSelectionPage_desc;
1184
	public static String NewExtensionRegistryReader_missingProperty;
1185
	public static String NewExtensionTemplateWizard_generating;
1186
	public static String NewExtensionWizard_PointSelectionPage_filterCheck;
1187
	public static String NewExtensionWizard_PointSelectionPage_dependencyTitle;
1188
	public static String NewExtensionWizard_PointSelectionPage_dependencyMessage;
1189
	public static String NewExtensionWizard_PointSelectionPage_availExtPoints_label;
1190
	public static String NewExtensionWizard_PointSelectionPage_contributedTemplates_title;
1191
	public static String NewExtensionWizard_PointSelectionPage_contributedTemplates_label;
1192
	public static String NewExtensionWizard_PointSelectionPage_templateDescription;
1193
	public static String NewExtensionWizard_PointSelectionPage_pluginDescription;
1194
	public static String NewExtensionWizard_PointSelectionPage_extPointDescription;
1195
1196
	public static String ExtensionEditorWizard_wtitle;
1197
1198
	public static String NewExtensionPointWizard_wtitle;
1199
	public static String NewExtensionPointWizard_title;
1200
	public static String NewExtensionPointWizard_desc;
1201
1202
	public static String NewSchemaFileWizard_wtitle;
1203
	public static String NewSchemaFileWizard_title;
1204
	public static String NewSchemaFileWizard_desc;
1205
1206
	public static String BaseExtensionPointMainPage_missingExtensionPointID;
1207
	public static String BaseExtensionPointMainPage_invalidCompositeID;
1208
	public static String BaseExtensionPointMainPage_invalidSimpleID;
1209
	public static String BaseExtensionPointMainPage_missingExtensionPointName;
1210
	public static String BaseExtensionPointMainPage_missingExtensionPointSchema;
1211
1212
	public static String NewSchemaFileMainPage_missingPluginID;
1213
	public static String NewSchemaFileMainPage_nonExistingPluginID;
1214
	public static String NewSchemaFileMainPage_externalPluginID;
1215
	public static String NewSchemaFileMainPage_missingContainer;
1216
	public static String NewSchemaFileMainPage_invalidContainer;
1217
	public static String NewSchemaFileMainPage_nonExistingContainer;
1218
1219
	public static String ConvertedProjectWizard_title;
1220
	public static String ConvertedProjectWizard_desc;
1221
	public static String ConvertedProjectWizard_projectList;
1222
	public static String ConvertedProjectWizard_converting;
1223
	public static String ConvertProjectsAction_find;
1224
	public static String ConvertProjectsAction_none;
1225
1226
	public static String PluginCodeGeneratorWizard_title;
1227
1228
	public static String NewProductFileWizard_title;
1229
1230
	public static String PointSelectionPage_tab1;
1231
	public static String PointSelectionPage_tab2;
1232
	public static String PointSelectionPage_categories;
1233
	public static String ProductDefinitonWizardPage_productGroup;
1234
	public static String ProductDefinitonWizardPage_productExists;
1235
	public static String ProductDefinitonWizardPage_application;
1236
	public static String ProductDefinitonWizardPage_noProductID;
1237
	public static String ProductFileWizadPage_existingProduct;
1238
	public static String ProductFileWizadPage_existingLaunchConfig;
1239
	public static String ProductDefinitonWizardPage_productDefinition;
1240
	public static String ProductDefinitonWizardPage_applicationGroup;
1241
	public static String ProductDefinitonWizardPage_notInWorkspace;
1242
	public static String ProductDefinitionOperation_readOnly;
1243
1244
	public static String TemplateSelectionPage_title;
1245
	public static String TemplateSelectionPage_desc;
1246
	public static String TemplateSelectionPage_table;
1247
	public static String TemplateSelectionPage_column_name;
1248
	public static String TemplateSelectionPage_column_point;
1249
1250
	public static String PluginSelectionDialog_title;
1251
	public static String PluginSelectionDialog_message;
1252
	public static String PluginImportOperation_could_not_delete_project;
1253
1254
	public static String PluginContentPage_appQuestion;
1255
1256
	public static String PluginContentPage_enable_api_analysis;
1257
1258
	public static String ImportWizard_title;
1259
	public static String ImportWizard_messages_title;
1260
	public static String ImportWizard_messages_exists;
1261
	public static String ImportWizard_FirstPage_title;
1262
	public static String ImportWizard_FirstPage_desc;
1263
	public static String ImportWizard_FirstPage_importGroup;
1264
	public static String ImportWizard_FirstPage_importPrereqs;
1265
	public static String ImportWizard_FirstPage_scanAll;
1266
	public static String ImportWizard_FirstPage_importAs;
1267
	public static String ImportWizard_FirstPage_binary;
1268
	public static String ImportWizard_FirstPage_binaryLinks;
1269
	public static String ImportWizard_FirstPage_source;
1270
	public static String ImportWizard_FirstPage_importFrom;
1271
	public static String ImportWizard_FirstPage_target;
1272
	public static String ImportWizard_FirstPage_goToTarget;
1273
	public static String ImportWizard_FirstPage_otherFolder;
1274
	public static String ImportWizard_FirstPage_browse;
1275
	public static String ImportWizard_SecondPage_addFragments;
1276
1277
	public static String ImportWizard_messages_folder_title;
1278
	public static String ImportWizard_messages_folder_message;
1279
1280
	public static String ImportWizard_errors_locationMissing;
1281
	public static String ImportWizard_errors_buildFolderInvalid;
1282
	public static String ImportWizard_errors_buildFolderMissing;
1283
1284
	public static String ImportWizard_expressPage_title;
1285
	public static String ImportWizard_expressPage_desc;
1286
	public static String ImportWizard_expressPage_nonBinary;
1287
	public static String ImportWizard_expressPage_total;
1288
1289
	public static String ImportWizard_DetailedPage_title;
1290
	public static String ImportWizard_DetailedPage_desc;
1291
	public static String ImportWizard_DetailedPage_availableList;
1292
	public static String ImportWizard_DetailedPage_importList;
1293
	public static String ImportWizard_DetailedPage_add;
1294
	public static String ImportWizard_DetailedPage_addAll;
1295
	public static String ImportWizard_DetailedPage_remove;
1296
	public static String ImportWizard_DetailedPage_removeAll;
1297
	public static String ImportWizard_DetailedPage_swap;
1298
	public static String ImportWizard_DetailedPage_existing;
1299
	public static String ImportWizard_DetailedPage_existingUnshared;
1300
	public static String ImportWizard_DetailedPage_addRequired;
1301
	public static String ImportWizard_DetailedPage_count;
1302
	public static String ImportWizard_DetailedPage_filter;
1303
1304
	public static String ImportWizard_DetailedPage_filterDesc;
1305
	public static String ImportWizard_DetailedPage_search;
1306
1307
	public static String ImportWizard_operation_creating;
1308
	public static String ImportWizard_operation_multiProblem;
1309
	public static String ImportWizard_operation_importingSource;
1310
1311
	public static String FeatureImportWizard_FirstPage_title;
1312
	public static String FeatureImportWizard_FirstPage_desc;
1313
	public static String FeatureImportWizard_FirstPage_runtimeLocation;
1314
	public static String FeatureImportWizard_FirstPage_otherFolder;
1315
	public static String FeatureImportWizard_FirstPage_binaryImport;
1316
	public static String FeatureImportWizard_FirstPage_browse;
1317
	public static String FeatureImportWizard_messages_folder_title;
1318
	public static String FeatureImportWizard_messages_folder_message;
1319
	public static String FeatureImportWizard_errors_locationMissing;
1320
	public static String FeatureImportWizard_errors_buildFolderInvalid;
1321
	public static String FeatureImportWizard_errors_buildFolderMissing;
1322
1323
	public static String FeatureImportWizard_messages_updating;
1324
	public static String FeatureImportWizard_title;
1325
	public static String FeatureSection_removeAll;
1326
	public static String FeatureImportWizard_noToAll;
1327
	public static String FeatureImportWizard_messages_noFeatures;
1328
	public static String FeatureImportWizard_messages_title;
1329
	public static String FeatureImportWizard_messages_exists;
1330
1331
	public static String FeatureImportWizard_operation_creating;
1332
	public static String FeatureImportWizard_operation_multiProblem;
1333
	public static String FeatureImportWizard_operation_creating2;
1334
1335
	public static String ForbiddenAccessProposal_quickfixMessage;
1336
1337
	public static String UpdateBuildpathWizard_wtitle;
1338
	public static String UpdateBuildpathWizard_title;
1339
	public static String UpdateBuildpathWizard_desc;
1340
	public static String UpdateBuildpathWizard_availablePlugins;
1341
1342
	// Actions ########################################
1343
	public static String EditorActions_save;
1344
	public static String EditorActions_cut;
1345
	public static String EditorActions_copy;
1346
	public static String EditorActions_paste;
1347
	public static String EditorActions_revert;
1348
	public static String Actions_open_label;
1349
	public static String Actions_delete_label;
1350
	public static String Actions_synchronizeVersions_label;
1351
1352
	public static String Menus_new_label;
1353
1354
	public static String Actions_Feature_OpenProjectWizardAction;
1355
	public static String Actions_Site_OpenProjectWizardAction;
1356
1357
	public static String UnresolvedImportFixProcessor_0;
1358
	public static String UnresolvedImportFixProcessor_1;
1359
	public static String UnresolvedImportFixProcessor_2;
1360
	public static String UnresolvedImportFixProcessor_3;
1361
	public static String UnresolvedImportFixProcessor_4;
1362
	public static String UnresolvedImportFixProcessor_5;
1363
1364
	public static String UpdateClasspathJob_error_title;
1365
	public static String UpdateClasspathJob_error_message;
1366
	public static String UpdateClasspathJob_task;
1367
	public static String UpdateClasspathJob_title;
1368
1369
	public static String RuntimeWorkbenchShortcut_title;
1370
	public static String RuntimeWorkbenchShortcut_select_debug;
1371
	public static String RuntimeWorkbenchShortcut_select_run;
1372
	public static String RuntimeInfoSection_addEntry;
1373
	public static String RuntimeInfoSection_rename;
1374
	public static String RuntimeInstallJob_Creating_installable_unit;
1375
1376
	public static String RuntimeInstallJob_ErrorCouldNotFindUnitInRepo;
1377
1378
	public static String RuntimeInstallJob_ErrorCouldNotGetIdOrVersion;
1379
1380
	public static String RuntimeInstallJob_ErrorCouldntOpenProfile;
1381
1382
	public static String RuntimeInstallJob_installPatchDescription;
1383
	public static String RuntimeInstallJob_installPatchName;
1384
1385
	public static String RuntimeInstallJob_Job_name_installing;
1386
1387
	public static String BaseExtensionPointMainPage_pluginId_tooltip;
1388
	public static String BaseExtensionPointMainPage_schemaLocation_tooltip;
1389
	public static String BaseExtensionPointMainPage_pluginBrowse;
1390
	public static String BaseExtensionPointMainPage_findBrowse;
1391
	public static String BaseProductCreationOperation_taskName;
1392
	public static String BaseExtensionPointMainPage_since;
1393
	public static String BaseExtensionPointMainPage_schemaLocation_title;
1394
	public static String BaseExtensionPointMainPage_schemaLocation_desc;
1395
	public static String EditorPreferencePage_colorSettings;
1396
	public static String EditorPreferencePage_text;
1397
	public static String EditorPreferencePage_proc;
1398
	public static String EditorPreferencePage_string;
1399
	public static String EditorPreferencePage_tag;
1400
	public static String EditorPreferencePage_comment;
1401
	public static String PluginContentPage_yes;
1402
1403
	//Search Page###############################
1404
	public static String SearchPage_searchString;
1405
	public static String SearchPage_caseSensitive;
1406
	public static String SearchPage_searchFor;
1407
	public static String SearchResult_matches;
1408
	public static String SearchPage_limitTo;
1409
	public static String SearchPage_externalScope;
1410
	public static String SearchPage_plugin;
1411
	public static String SearchPage_fragment;
1412
	public static String SelectionPage_title;
1413
	public static String SearchPage_extPt;
1414
	public static String SearchPage_declarations;
1415
	public static String SearchPage_references;
1416
	public static String SearchPage_allOccurrences;
1417
	public static String SearchPage_all;
1418
	public static String SearchPage_enabledOnly;
1419
	public static String SearchPage_none;
1420
	public static String SearchResult_match;
1421
	public static String SelectionPage_desc;
1422
	public static String SearchAction_references;
1423
	public static String SearchAction_Declaration;
1424
	public static String ShowDescriptionAction_label;
1425
	public static String ShowDescriptionAction_title;
1426
	public static String ShowSampleAction_msgTitle;
1427
	public static String DependencyExtent_singular;
1428
	public static String DependencyExtent_plural;
1429
	public static String DetailsBlock_horizontal;
1430
	public static String DependencyExtent_found;
1431
	public static String DependencyExtentAction_label;
1432
	public static String DependencyExtentQuery_label;
1433
	public static String UnusedDependencies_title;
1434
	public static String UnusedDependencies_action;
1435
	public static String UnusedDependencies_notFound;
1436
	public static String UnusedDependenciesJob_viewResults;
1437
	public static String UnusedDependenciesAction_jobName;
1438
	public static String UnusedDependencies_remove;
1439
	public static String UnusedDependencies_analyze;
1440
	public static String UnusedDependencies_unused;
1441
	public static String RemoveExportPkgs_label;
1442
	public static String RemoveExportPkgs_description;
1443
1444
	public static String DependenciesView_open;
1445
	public static String DependenciesView_ShowCalleesAction_label;
1446
	public static String DependenciesView_ShowCalleesAction_description;
1447
	public static String DependenciesView_ShowCalleesAction_tooltip;
1448
	public static String DependenciesView_ShowCallersAction_label;
1449
	public static String DependenciesView_ShowCallersAction_description;
1450
	public static String DependenciesView_ShowCallersAction_tooltip;
1451
	public static String DependenciesView_ShowListAction_label;
1452
	public static String DependenciesView_ShowListAction_description;
1453
	public static String DependenciesView_ShowListAction_tooltip;
1454
	public static String DependenciesView_ShowTreeAction_label;
1455
	public static String DependenciesView_ShowTreeAction_description;
1456
	public static String DependenciesView_ShowTreeAction_tooltip;
1457
	public static String DependenciesView_ShowLoopsAction_label;
1458
	public static String DependenciesView_ShowLoopsAction_description;
1459
	public static String DependenciesView_ShowLoopsAction_tooltip;
1460
	public static String DependenciesView_callees_tree_title;
1461
	public static String DependenciesView_callees_list_title;
1462
	public static String DependenciesView_callers_tree_title;
1463
	public static String DependenciesView_callers_list_title;
1464
	public static String DependenciesView_cycles_title;
1465
	public static String DependenciesViewTreePage_CollapseAllAction_label;
1466
	public static String DependenciesViewTreePage_CollapseAllAction_description;
1467
	public static String DependenciesViewTreePage_CollapseAllAction_tooltip;
1468
	public static String DependenciesPage_title;
1469
	public static String DependenciesPage_tabName;
1470
	public static String DetailsBlock_vertical;
1471
	public static String DependenciesViewPage_focusOn;
1472
	public static String DependenciesViewPage_focusOnSelection;
1473
	public static String DependencyAnalysisSection_title;
1474
	public static String DependencyAnalysisSection_loops;
1475
	public static String DependencyAnalysisSection_noCycles;
1476
	public static String DependencyExtentOperation_searching;
1477
	public static String DependencyExtentOperation_inspecting;
1478
	public static String DependencyExtentSearchResult_dependency;
1479
	public static String DependencyExtentSearchResult_dependencies;
1480
	public static String DependencyAnalysisSection_fragment_editable;
1481
	public static String DependencyAnalysisSection_fragment_notEditable;
1482
	public static String DependencyAnalysisSection_plugin_editable;
1483
	public static String DependencyAnalysisSection_plugin_notEditable;
1484
1485
	public static String HistoryAction_description;
1486
	public static String HistoryAction_tooltip;
1487
	public static String HistoryDropDownAction_tooltip;
1488
	public static String HistoryListAction_label;
1489
	public static String HistoryListDialog_label;
1490
	public static String HistoryListDialog_title;
1491
	public static String HistoryListDialog_remove_button;
1492
1493
	public static String PluginsView_open;
1494
	public static String PluginsView_openDependencies;
1495
	public static String PluginsView_asBinaryProject;
1496
	public static String PluginsView_asSourceProject;
1497
	public static String PluginsView_showDisabled;
1498
	public static String PluginsView_showEnabled;
1499
	public static String PluginsView_showWorkspace;
1500
	public static String PluginsView_textEditor;
1501
	public static String PluginWorkingSet_title;
1502
	public static String PluginsView_systemEditor;
1503
	public static String PluginsView_manifestEditor;
1504
	public static String PluginContentPage_rcpGroup;
1505
	public static String PluginWorkingSet_emptyName;
1506
	public static String PluginWorkingSet_nameInUse;
1507
	public static String PluginsView_schemaEditor;
1508
	public static String PluginsView_copy;
1509
	public static String PluginsView_deferredLabel0;
1510
1511
	public static String PluginsView_dependentPlugins;
1512
	public static String PluginsView_pluginsInJavaSearch;
1513
	public static String PluginsView_addToJavaSearch;
1514
	public static String PluginsView_removeFromJavaSearch;
1515
	public static String PluginWorkingSet_setContent;
1516
	public static String PluginWorkingSet_selectAll_label;
1517
	public static String PluginWorkingSet_selectAll_toolTip;
1518
	public static String PluginWorkingSet_deselectAll_label;
1519
	public static String PluginWorkingSet_deselectAll_toolTip;
1520
	public static String PluginWorkingSet_noPluginsChecked;
1521
	public static String PluginStatusDialog_pluginValidation;
1522
	public static String PluginsView_openWith;
1523
	public static String PluginsView_import;
1524
	public static String PluginsView_select;
1525
	public static String PluginsView_showIn;
1526
	public static String PluginsView_CollapseAllAction_label;
1527
	public static String PluginsView_CollapseAllAction_description;
1528
	public static String PluginsView_CollapseAllAction_tooltip;
1529
	public static String PluginsView_SelectAllAction_label;
1530
	public static String PluginsView_TotalPlugins_unknown;
1531
1532
	public static String PluginSection_open;
1533
	public static String PluginsView_unableToOpen;
1534
	public static String PluginWorkingSet_setName;
1535
	public static String PluginStatusDialog_label;
1536
	public static String PluginSection_removeAll;
1537
	public static String PluginsView_disabled;
1538
	public static String PluginContentPage_no;
1539
	public static String PluginContentPage_noEE;
1540
	public static String PluginSection_remove;
1541
	public static String RequiredPluginsContainerPage_title;
1542
	public static String RequiredPluginsContainerPage_desc;
1543
	public static String RequiredPluginsContainerPage_label;
1544
1545
	public static String NewSiteWizard_wtitle;
1546
	public static String NewSiteWizard_MainPage_title;
1547
	public static String NewSiteWizard_creatingProject;
1548
	public static String NewSiteWizard_creatingManifest;
1549
	public static String NewSiteWizard_MainPage_desc;
1550
1551
	//
1552
	public static String SiteHTML_checkLabel;
1553
	public static String SiteHTML_webLabel;
1554
	public static String SiteHTML_webError;
1555
	public static String SiteHTML_loadError;
1556
1557
	//
1558
	public static String CompilersConfigurationBlock_plugins;
1559
	public static String CompilersConfigurationBlock_schemas;
1560
	public static String CompilersConfigurationBlock_features;
1561
	public static String CompilersConfigurationBlock_label;
1562
	public static String CompilersConfigurationBlock_altlabel;
1563
1564
	public static String CompilersPreferencePage_configure_project_specific_settings;
1565
1566
	public static String CompilersPreferencePage_title;
1567
1568
	public static String CompilersPropertyPage_useworkspacesettings_change;
1569
	public static String CompilersPropertyPage_useprojectsettings_label;
1570
1571
	public static String compilers_p_unresolved_import;
1572
	public static String compilers_p_unresolved_ex_points;
1573
	public static String compilers_p_unknown_element;
1574
	public static String compilers_p_unknown_attribute;
1575
	public static String compilers_p_unknown_class;
1576
	public static String compilers_p_discouraged_class;
1577
	public static String compilers_p_unknown_resource;
1578
	public static String compilers_p_unknown_identifier;
1579
	public static String compilers_p_no_required_att;
1580
	public static String compilers_p_not_externalized_att;
1581
	public static String compilers_p_deprecated;
1582
	public static String compilers_p_internal;
1583
	public static String compilers_p_missing_imp_pkg;
1584
	public static String compilers_p_missing_exp_pkg;
1585
	public static String compilers_p_missing_require_bundle;
1586
	public static String compilers_s_create_docs;
1587
	public static String compilers_s_doc_folder;
1588
	public static String compilers_s_open_tags;
1589
	public static String compilers_p_exported_pkgs;
1590
1591
	public static String compilers_f_unresolved_plugins;
1592
	public static String compilers_f_unresolved_features;
1593
1594
	public static String CompilersConfigurationBlock_building;
1595
1596
	public static String ExportWizard_Plugin_pageTitle;
1597
	public static String ExportWizard_Feature_pageTitle;
1598
	public static String ExportWizard_Plugin_pageBlock;
1599
	public static String ExportWizard_Feature_pageBlock;
1600
	public static String ExportWizard_Plugin_description;
1601
	public static String ExportWizard_archive;
1602
	public static String ExportWizard_includeSource;
1603
	public static String ExportWizard_includeSourceInBinaryBundles;
1604
	public static String ExportWizard_generateAssociatedSourceBundles;
1605
	public static String ExportWizard_includesMetadata;
1606
	public static String ExportWizard_generateCategories;
1607
	public static String ExportWizard_multi_platform;
1608
	public static String ExportWizard_destination;
1609
	public static String ExportWizard_options;
1610
	public static String ExportWizard_directory;
1611
	public static String ExportWizard_workingSet;
1612
	public static String ExportWizard_browse;
1613
	public static String ExportWizard_antCheck;
1614
	public static String ExportWizard_dialog_title;
1615
	public static String ExportWizard_dialog_message;
1616
	public static String ExportWizard_status_noselection;
1617
	public static String ExportWizard_status_nodirectory;
1618
	public static String ExportWizard_status_invaliddirectory;
1619
	public static String ExportWizard_status_nofile;
1620
	public static String ExportWizard_status_noantfile;
1621
	public static String ExtensionsPage_title;
1622
	public static String ExtensionsPage_tabName;
1623
	public static String ExtensionDetails_title;
1624
	public static String ExtensionDetails_desc;
1625
	public static String ExtensionDetails_id;
1626
	public static String ExtensionDetails_name;
1627
1628
	public static String FeatureImportWizard_DetailedPage_problemsLoading;
1629
	public static String NewArchiveDialog_alreadyExists;
1630
	public static String UpdateClasspathAction_find;
1631
	public static String UpdateClasspathAction_none;
1632
	public static String RenameDialog_label;
1633
	public static String RenameDialog_validationError;
1634
	public static String ReferenceAttributeRow_browse;
1635
	public static String EditableTablePart_renameAction;
1636
	public static String EditableTablePart_renameTitle;
1637
1638
	// Category Editor ######################################
1639
	public static String CategoryPage_header;
1640
	public static String CategoryDefinitionWizardPage_title;
1641
	public static String CategoryDefinitionWizardPage_description;
1642
	public static String NewCategoryDefinitionWizard_creatingManifest;
1643
	public static String NewCategoryDefinitionWizard_title;
1644
	public static String CategoryDefinitionCategorySection_title;
1645
	public static String CategoryDefinitionCategorySection_new;
1646
	public static String CategoryDefinitionCategorySection_desc;
1647
1648
	// Site Editor #########################################
1649
	public static String CategorySection_title;
1650
	public static String CategorySection_new;
1651
	public static String CategorySection_desc;
1652
	public static String CategorySection_add;
1653
	public static String CategorySection_remove;
1654
	public static String CategorySection_environment;
1655
	public static String CategorySection_buildAll;
1656
	public static String CategorySection_build;
1657
	public static String CategorySection_newCategoryName;
1658
	public static String CategorySection_newCategoryLabel;
1659
1660
	public static String CategoryDetails_title;
1661
	public static String CategoryDetails_sectionDescription;
1662
	public static String CategoryDetails_name;
1663
	public static String CategoryDetails_label;
1664
	public static String CategoryDetails_desc;
1665
	public static String CategoryDetails_alreadyExists;
1666
	public static String CategoryDetails_alreadyExists_title;
1667
1668
	public static String FeaturesPage_title;
1669
	public static String FeaturesPage_header;
1670
1671
	public static String SiteEditor_add;
1672
	public static String SiteEditor_edit;
1673
	public static String SiteEditor_remove;
1674
	public static String SiteEditor_NewArchiveDialog_path;
1675
	public static String SiteEditor_NewArchiveDialog_url;
1676
	public static String SiteEditor_NewArchiveDialog_title;
1677
	public static String SiteEditor_NewArchiveDialog_error;
1678
	public static String SiteEditor_ArchiveSection_header;
1679
	public static String SiteEditor_ArchiveSection_instruction;
1680
	public static String SiteEditor_ArchiveSection_col1;
1681
	public static String SiteEditor_ArchiveSection_col2;
1682
	public static String SiteEditor_DescriptionSection_header;
1683
	public static String SiteEditor_DescriptionSection_desc;
1684
	public static String SiteEditor_DescriptionSection_descLabel;
1685
	public static String SiteEditor_DescriptionSection_urlLabel;
1686
	public static String SiteEditor_MirrorsSection_header;
1687
	public static String SiteEditor_MirrorsSection_desc;
1688
	public static String SiteEditor_MirrorsSection_urlLabel;
1689
1690
	public static String SynchronizePropertiesAction_label;
1691
	public static String SynchronizePropertiesWizard_wtitle;
1692
	public static String SynchronizePropertiesWizardPage_title;
1693
	public static String SynchronizePropertiesWizardPage_desc;
1694
	public static String SynchronizePropertiesWizardPage_group;
1695
	public static String SynchronizationOperation_externalPlugin;
1696
	public static String SynchronizePropertiesWizardPage_selectedFeatures;
1697
	public static String SynchronizationOperation_noDefiningPlugin;
1698
	public static String SynchronizePropertiesWizardPage_allFeatures;
1699
	public static String SynchronizePropertiesWizardPage_synchronizing;
1700
1701
	public static String PDEFormPage_help;
1702
	public static String GeneralInfoSection_id;
1703
	public static String GeneralInfoSection_name;
1704
	public static String GeneralInfoSection_class;
1705
	public static String GeneralInfoSection_browse;
1706
	public static String GeneralInfoSection_platformFilter;
1707
	public static String GeneralInfoSection_selectionTitle;
1708
	public static String RequiresSection_title;
1709
	public static String RequiresSection_fDesc;
1710
	public static String RequiresSection_desc;
1711
	public static String RequiresSection_down;
1712
	public static String RequiresSection_add;
1713
	public static String RequiresSection_up;
1714
	public static String RequiresSection_open;
1715
	public static String RequiresSection_delete;
1716
	public static String LoopDialog_title;
1717
	public static String MatchSection_title;
1718
	public static String MatchSection_desc;
1719
	public static String ClasspathSection_jarsMessage;
1720
	public static String OverviewPage_exportingTitle;
1721
	public static String OverviewPage_content;
1722
	public static String OverviewPage_osgi;
1723
	public static String OverviewPage_testing;
1724
	public static String OverviewPage_OSGiTesting;
1725
	public static String OverviewPage_tabName;
1726
	public static String OverviewPage_title;
1727
	public static String OverviewPage_deploying;
1728
	public static String OverviewPage_fOsgi;
1729
	public static String OverviewPage_error;
1730
	public static String OverviewPage_fContent;
1731
	public static String OverviewPage_fTesting;
1732
	public static String OverviewPage_fDeploying;
1733
	public static String ClassAttributeRow_dialogTitle;
1734
	public static String ArchivePage_title;
1735
	public static String ArchivePage_name;
1736
1737
	public static String SampleWizard_title;
1738
	public static String SampleEditor_desc;
1739
	public static String SampleWizard_overwrite;
1740
	public static String SampleEditor_content;
1741
	public static String SampleOperation_creating;
1742
	public static String SampleStandbyContent_content;
1743
	public static String SampleStandbyContent_desc;
1744
	public static String ReviewPage_title;
1745
	public static String ReviewPage_desc;
1746
	public static String ReviewPage_descContent;
1747
	public static String ReviewPage_content;
1748
	public static String ShowSampleAction_title;
1749
	public static String ShowSampleAction_msgDesc;
1750
	public static String SelfHostingPropertyPage_label;
1751
	public static String SelfHostingPropertyPage_viewerLabel;
1752
	public static String RuntimePage_tabName;
1753
	public static String ApplicationSelectionDialog_debug;
1754
	public static String ApplicationSelectionDialog_run;
1755
	public static String ApplicationSelectionDialog_dtitle;
1756
	public static String ApplicationSelectionDialog_rtitle;
1757
1758
	public static String EnvironmentBlock_targetEnv;
1759
1760
	//Product Editor#####################
1761
	public static String Product_overview_configuration;
1762
	public static String Product_PluginSection_working;
1763
	public static String ProductInfoSection_version;
1764
	public static String Product_PluginSection_required;
1765
	public static String ProductExportWizardPage_title;
1766
	public static String ProductExportWizardPage_config;
1767
	public static String ProductExportWizardPage_browse;
1768
	public static String Product_PluginSection_removeAll;
1769
	public static String Product_PluginSection_newPlugin;
1770
	public static String Product_FeatureSection_properties;
1771
	public static String Product_DependenciesPage_title;
1772
	public static String ProductFileWizadPage_groupTitle;
1773
	public static String Product_PluginSection_newFragment;
1774
	public static String ProductValidateAction_validate;
1775
	public static String Product_overview_testing;
1776
	public static String ProductInfoSection_title;
1777
	public static String GeneralInfoSection_title;
1778
	public static String Product_PluginSection_add;
1779
	public static String Product_PluginSection_title;
1780
	public static String Product_FeatureSection_desc;
1781
	public static String ProductExportWizardPage_desc;
1782
	public static String ProductExportWizardPage_root;
1783
	public static String ProductExportWizardPage_sync;
1784
	public static String ProductExportWizard_error;
1785
	public static String ProductExportWizard_corrupt;
1786
	public static String ProductDefinitionWizard_title;
1787
	public static String ProductDefinitionWizard_error;
1788
	public static String ProductDefinitonWizardPage_title;
1789
	public static String ProductDefinitonWizardPage_desc;
1790
	public static String ProductDefinitonWizardPage_descNoName;
1791
	public static String ProductDefinitonWizardPage_plugin;
1792
	public static String ProductDefinitonWizardPage_browse;
1793
	public static String ProductDefinitonWizardPage_productId;
1794
	public static String ProductDefinitonWizardPage_productName;
1795
	public static String ProductDefinitonWizardPage_noPluginId;
1796
	public static String ProductDefinitonWizardPage_noPlugin;
1797
	public static String ProductDefinitonWizardPage_invalidId;
1798
	public static String Product_FeatureSection_title;
1799
	public static String Product_FeatureSection_newFeature;
1800
	public static String ProductExportWizardPage_productGroup;
1801
	public static String ProductExportWizardPage_productNotExists;
1802
	public static String ProductExportWizardPage_wrongExtension;
1803
	public static String ProductExportWizardPage_fileSelection;
1804
	public static String ProductExportWizardPage_productSelection;
1805
	public static String ProductExportWizardPage_syncText;
1806
	public static String ProductExportWizardPage_syncButton;
1807
	public static String ProductExportWizardPage_noProduct;
1808
	public static String Product_OverviewPage_testing;
1809
	public static String Product_PluginSection_desc;
1810
	public static String Product_FeatureSection_add;
1811
	public static String ProductFileWizadPage_title;
1812
	public static String ProductFileWizadPage_basic;
1813
	public static String Product_overview_exporting;
1814
	public static String GeneralInfoSection_desc;
1815
	public static String ProductInfoSection_desc;
1816
	public static String ProductInfoSection_id;
1817
	public static String ProductInfoSection_product;
1818
	public static String ProductInfoSection_productTooltip;
1819
	public static String ProductInfoSection_new;
1820
	public static String ProductInfoSection_app;
1821
	public static String ProductInfoSection_appTooltip;
1822
	public static String ProductInfoSection_launchers;
1823
	public static String SplashSection_title;
1824
	public static String SplashSection_desc;
1825
	public static String SplashSection_label;
1826
	public static String SplashSection_plugin;
1827
	public static String SplashSection_browse;
1828
	public static String SplashSection_selection;
1829
	public static String SplashSection_message;
1830
	public static String BrandingPage_title;
1831
	public static String WindowImagesSection_title;
1832
	public static String WindowImagesSection_desc;
1833
	public static String WindowImagesSection_browse;
1834
	public static String WindowImagesSection_open;
1835
	public static String WindowImagesSection_warning;
1836
	public static String WindowImagesSection_emptyPath;
1837
	public static String WindowImagesSection_dialogTitle;
1838
	public static String WindowImagesSection_dialogMessage;
1839
	public static String AboutSection_title;
1840
	public static String AboutSection_desc;
1841
	public static String AboutSection_image;
1842
	public static String AboutSection_browse;
1843
	public static String AboutSection_text;
1844
	public static String AboutSection_open;
1845
	public static String AboutSection_warning;
1846
	public static String AboutSection_imgTitle;
1847
	public static String AboutSection_imgMessage;
1848
	public static String LauncherSection_solarisLabel;
1849
	public static String LauncherSection_launcherName;
1850
	public static String LauncherSection_dialogTitle;
1851
	public static String LauncherSection_dialogMessage;
1852
	public static String ProductDefinitonWizardPage_applicationDefinition;
1853
	public static String ArgumentsSection_0;
1854
1855
	public static String ArgumentsSection_1;
1856
1857
	public static String ArgumentsSection_title;
1858
	public static String ArgumentsSection_desc;
1859
	public static String ArgumentsSection_program;
1860
	public static String ArgumentsSection_vm;
1861
1862
	public static String ProductJRESection_title;
1863
	public static String ProductJRESection_desc;
1864
	public static String ProductJRESection_eeName;
1865
	public static String ProductJRESection_browseEEs;
1866
1867
	public static String Product_FeatureSection_remove;
1868
	public static String Product_FeatureSection_open;
1869
	public static String Product_FeatureSection_up;
1870
	public static String Product_FeatureSection_down;
1871
	public static String Product_FeatureSection_sortAlpha;
1872
1873
	public static String ImportPackageSection_desc;
1874
	public static String ImportPackageSection_descFragment;
1875
	public static String ExportPackageSection_desc;
1876
	public static String ExportPackageSection_descFragment;
1877
1878
	static {
1879
		// load message values from bundle file
1880
		NLS.initializeMessages(BUNDLE_NAME, PDEMessages.class);
1881
	}
1882
1883
	public static String ExportPackageVisibilitySection_title;
1884
1885
	public static String ExportPackageVisibilitySection_default;
1886
1887
	public static String ExportPackageVisibilitySection_hideAll;
1888
1889
	public static String ExportPackageSection_add;
1890
1891
	public static String ExportPackageSection_remove;
1892
1893
	public static String ExportPackageSection_properties;
1894
1895
	public static String ExportPackageSection_title;
1896
1897
	public static String ExportPackageSection_propertyAction;
1898
1899
	public static String ExportPackageSection_dialogButtonLabel;
1900
1901
	public static String DependenciesPage_properties;
1902
1903
	public static String ImportPackageSection_add;
1904
1905
	public static String ImportPackageSection_remove;
1906
1907
	public static String ImportPackageSection_properties;
1908
1909
	public static String ImportPackageSection_required;
1910
1911
	public static String ImportPackageSection_exported;
1912
1913
	public static String ImportPackageSection_selection;
1914
1915
	public static String ImportPackageSection_propertyAction;
1916
1917
	public static String DependencyPropertiesDialog_properties;
1918
1919
	public static String DependencyPropertiesDialog_optional;
1920
1921
	public static String DependencyPropertiesDialog_reexport;
1922
1923
	public static String DependencyPropertiesDialog_version;
1924
1925
	public static String DependencyPropertiesDialog_invalidFormat;
1926
1927
	public static String RequiresSection_properties;
1928
1929
	public static String ClasspathSection_fragment;
1930
1931
	public static String ClasspathSection_plugin;
1932
1933
	public static String EnvironmentBlock_jreTitle;
1934
1935
	public static String DependencyExtentSearchResultPage_referencesInPlugin;
1936
1937
	public static String CrossPlatformExportPage_available;
1938
1939
	public static String CrossPlatformExportPage_title;
1940
1941
	public static String CrossPlatformExportPage_desc;
1942
1943
	public static String BaseImportWizardSecondPage_autobuild;
1944
1945
	public static String ExportPackageVisibilitySection_unconditional;
1946
1947
	public static String ExportPackageSection_props;
1948
1949
	public static String OverviewPage_buildTitle;
1950
1951
	public static String OverviewPage_buildQuestion;
1952
1953
	public static String PluginWorkingSet_message;
1954
1955
	public static String ProductDefinitonWizardPage_noProductName;
1956
1957
	public static String DependencyPropertiesDialog_groupText;
1958
1959
	public static String DependencyPropertiesDialog_comboInclusive;
1960
1961
	public static String DependencyPropertiesDialog_comboExclusive;
1962
1963
	public static String DependencyPropertiesDialog_minimumVersion;
1964
1965
	public static String DependencyPropertiesDialog_maximumVersion;
1966
1967
	public static String DependencyPropertiesDialog_versionRangeError;
1968
1969
	public static String NewProjectCreationPage_pDependsOnRuntime;
1970
1971
	public static String NewProjectCreationPage_pPureOSGi;
1972
1973
	public static String IntroSection_sectionText;
1974
1975
	public static String IntroSection_sectionDescription;
1976
1977
	public static String IntroSection_introLabel;
1978
1979
	public static String IntroSection_introInput;
1980
1981
	public static String IntroSection_new;
1982
1983
	public static String IntroSection_undefinedProductId;
1984
1985
	public static String IntroSection_undefinedProductIdMessage;
1986
1987
	public static String ProductIntroWizard_title;
1988
1989
	public static String ProductIntroWizardPage_title;
1990
1991
	public static String ProductIntroWizardPage_description;
1992
1993
	public static String ProductIntroWizardPage_groupText;
1994
1995
	public static String ProductIntroWizardPage_formText;
1996
1997
	public static String ProductIntroWizardPage_targetLabel;
1998
1999
	public static String ProductIntroWizardPage_browse;
2000
2001
	public static String ProductIntroWizardPage_introLabel;
2002
2003
	public static String ProductIntroWizardPage_targetNotSet;
2004
2005
	public static String ProductIntroWizardPage_introNotSet;
2006
2007
	public static String ProductIntroWizardPage_invalidIntroId;
2008
2009
	public static String ProductIntroWizardPage_introIdExists;
2010
2011
	public static String ManifestTypeRenameParticipant_composite;
2012
2013
	public static String LauncherPage_title;
2014
2015
	public static String WindowImagesSection_16;
2016
2017
	public static String WindowImagesSection_32;
2018
2019
	public static String WindowImagesSection_48;
2020
2021
	public static String WindowImagesSection_64;
2022
2023
	public static String WindowImagesSection_128;
2024
2025
	public static String ManifestPackageRenameParticipant_packageRename;
2026
2027
	public static String NewProjectCreationPage_standard;
2028
2029
	public static String PluginDevelopmentPage_presentation;
2030
2031
	public static String PluginDevelopmentPage_extensions;
2032
2033
	public static String PluginDevelopmentPage_equinox;
2034
2035
	public static String MainTab_jreSection;
2036
2037
	public static String PluginsTab_target;
2038
2039
	public static String BaseBlock_workspace;
2040
2041
	public static String BaseBlock_filesystem;
2042
2043
	public static String BaseBlock_variables;
2044
2045
	public static String BaseBlock_workspaceS;
2046
2047
	public static String BaseBlock_filesystemS;
2048
2049
	public static String BaseBlock_variablesS;
2050
2051
	public static String BaseBlock_relative;
2052
2053
	public static String OverviewPage_extensionContent;
2054
2055
	public static String OverviewPage_extensionPageMessageTitle;
2056
2057
	public static String OverviewPage_extensionPageMessageBody;
2058
2059
	public static String OverviewPage_fExtensionContent;
2060
2061
	public static String BaseBlock_dirSelection;
2062
2063
	public static String BaseBlock_dirChoose;
2064
2065
	public static String BaseBlock_errorMessage;
2066
2067
	public static String BaseBlock_fileTitle;
2068
2069
	public static String BaseBlock_fileNotFoundMessage;
2070
2071
	public static String BaseBlock_fileErrorMessage;
2072
2073
	public static String BaseBlock_directoryTitle;
2074
2075
	public static String BaseBlock_directoryNotFoundMessage;
2076
2077
	public static String BaseBlock_directoryErrorMessage;
2078
2079
	public static String ConfigurationTemplateBlock_name;
2080
2081
	public static String WorkspaceDataBlock_name;
2082
2083
	public static String ConfigurationAreaBlock_name;
2084
	public static String ConfigurationPageMock_pageTitle;
2085
	public static String ConfigurationPageMock_sectionTitle;
2086
	public static String ConfigurationPageMock_sectionDesc;
2087
	public static String PluginConfigurationSection_tablePluginTitle;
2088
2089
	public static String AbstractPluginBlock_counter;
2090
2091
	public static String EquinoxPluginBlock_levelColumn;
2092
2093
	public static String EquinoxPluginBlock_autoColumn;
2094
2095
	public static String EquinoxPluginsTab_defaultStart;
2096
2097
	public static String EquinoxPluginsTab_defaultAuto;
2098
2099
	public static String EquinoxSettingsTab_name;
2100
2101
	public static String EquinoxLaunchConfiguration_oldTarget;
2102
2103
	public static String ModelChangeLabelProvider_instance;
2104
2105
	public static String ModelChangeLabelProvider_instances;
2106
2107
	public static String MoveTargetDefinitionPage_0;
2108
2109
	public static String MoveTargetDefinitionPage_1;
2110
2111
	public static String MoveTargetDefinitionWizard_0;
2112
2113
	public static String GetNonExternalizedStringsOperation_taskMessage;
2114
2115
	public static String ExternalizeStringsWizard_title;
2116
2117
	public static String GetNonExternalizedStringsAction_allExternalizedTitle;
2118
2119
	public static String GetNonExternalizedStringsAction_allExternalizedMessage;
2120
2121
	public static String ExternalizeStringsWizardPage_pageTitle;
2122
2123
	public static String ExternalizeStringsWizardPage_pageDescription;
2124
2125
	public static String ExternalizeStringsWizardPage_badLocalizationError;
2126
2127
	public static String ExternalizeStringsWizardPage_resourcelabel;
2128
2129
	public static String ExternalizeStringsWizardPage_selectAllButton;
2130
2131
	public static String ExternalizeStringsWizardPage_deselectAllButton;
2132
2133
	public static String ExternalizeStringsWizardPage_projectLabel;
2134
2135
	public static String ExternalizeStringsWizardPage_noUnderlyingResource;
2136
2137
	public static String ExternalizeStringsWizardPage_localizationLabel;
2138
2139
	public static String ExternalizeStringsWizardPage_propertiesLabel;
2140
2141
	public static String ExternalizeStringsWizardPage_sourceLabel;
2142
2143
	public static String ExternalizeStringsWizardPage_keyEmptyError;
2144
2145
	public static String ExternalizeStringsWizardPage_keyCommentError;
2146
2147
	public static String ExternalizeStringsWizardPage_keyError;
2148
2149
	public static String ExternalizeStringsWizardPage_keyDuplicateError;
2150
2151
	public static String ExternalizeStringsWizardPage_keySuggested;
2152
2153
	public static String InternationalizeAction_internationalizeTitle;
2154
2155
	public static String InternationalizeAction_internationalizeMessage;
2156
2157
	public static String InternationalizeWizard_title;
2158
2159
	public static String InternationalizeWizard_PluginPage_internationalizeList;
2160
2161
	public static String InternationalizeWizard_PluginPage_availableList;
2162
2163
	public static String InternationalizeWizard_PluginPage_filter;
2164
2165
	public static String InternationalizeWizard_PluginPage_templateLabel;
2166
2167
	public static String InternationalizeWizard_PluginPage_pageTitle;
2168
2169
	public static String InternationalizeWizard_PluginPage_pageDescription;
2170
2171
	public static String InternationalizeWizard_PluginPage_overwriteWithoutAsking;
2172
	public static String InternationalizeWizard_PluginPage_templateError;
2173
	public static String InternationalizeWizard_PluginPage_selectionError;
2174
	public static String InternationalizeWizard_PluginPage_individualFragments;
2175
2176
	public static String InternationalizeWizard_LocalePage_pageTitle;
2177
2178
	public static String InternationalizeWizard_LocalePage_pageDescription;
2179
2180
	public static String InternationalizeWizard_LocalePage_internationalizeList;
2181
2182
	public static String InternationalizeWizard_LocalePage_availableList;
2183
	public static String InternationalizeWizard_LocalePage_selectionError;
2184
2185
	public static String InternationalizeWizard_LocalePage_filter;
2186
2187
	public static String InternationalizeWizard_NLSFragmentGenerator_overwriteTitle;
2188
2189
	public static String InternationalizeWizard_NLSFragmentGenerator_overwriteMessage;
2190
	public static String InternationalizeWizard_NLSFragmentGenerator_errorMessage;
2191
2192
	public static String NewProjectCreationPage_target;
2193
2194
	public static String NewProjectCreationPage_ftarget;
2195
2196
	public static String NewProjectCreationPage_ptarget;
2197
2198
	public static String NewProjectCreationPage_executionEnvironments_label;
2199
2200
	public static String NewProjectCreationPage_environmentsButton;
2201
2202
	public static String RequiredExecutionEnvironmentSection_title;
2203
2204
	public static String PluginGeneralInfoSection_lazyStart;
2205
2206
	public static String PluginGeneralInfoSection_singleton;
2207
2208
	public static String FragmentGeneralInfoSection_singleton;
2209
2210
	public static String ClassSearchParticipant_taskMessage;
2211
2212
	public static String CreateJREBundleHeaderResolution_desc;
2213
2214
	public static String CreateJREBundleHeaderResolution_label;
2215
2216
	public static String UpdateActivationResolution_lazyStart_desc;
2217
2218
	public static String UpdateActivationResolution_lazyStart_label;
2219
2220
	public static String AddSingleon_dir_label;
2221
2222
	public static String AddSingleon_att_label;
2223
2224
	public static String AddSingleon_dir_desc;
2225
2226
	public static String AddSingleon_att_desc;
2227
2228
	public static String RemoveBuildOrderEntries_desc;
2229
2230
	public static String RemoveBuildOrderEntries_label;
2231
2232
	public static String PointSelectionPage_extPointDesc;
2233
2234
	public static String PointSelectionPage_noDescAvailable;
2235
2236
	public static String RemoveRequireBundleResolution_description;
2237
	public static String RemoveRequireBundleResolution_label;
2238
	public static String RemoveUselessPluginFile_description;
2239
	public static String AddNewExtensionResolution_description;
2240
	public static String AddNewExtensionPointResolution_description;
2241
2242
	public static String OptionalRequireBundleResolution_description;
2243
2244
	public static String OptionalRequireBundleResolution_label;
2245
2246
	public static String OrganizeManifestJob_taskName;
2247
2248
	public static String RemoveImportPkgResolution_description;
2249
2250
	public static String RemoveImportPkgResolution_label;
2251
2252
	public static String OptionalImportPkgResolution_description;
2253
2254
	public static String OptionalImportPkgResolution_label;
2255
2256
	public static String OrganizeRequireBundleResolution_Description;
2257
2258
	public static String OrganizeRequireBundleResolution_Label;
2259
2260
	public static String OrganizeImportPackageResolution_Description;
2261
2262
	public static String OrganizeImportPackageResolution_Label;
2263
2264
	public static String OrganizeExportPackageResolution_Description;
2265
2266
	public static String OrganizeExportPackageResolution_Label;
2267
2268
	public static String PluginImportOperation_executionEnvironment;
2269
2270
	public static String PluginImportOperation_Importing_plugin;
2271
2272
	public static String PluginImportOperation_Set_up_classpaths;
2273
2274
	public static String PluginImportWizard_runningConfigDesc;
2275
2276
	public static String PluginImportWizard_runningConfigsDesc;
2277
2278
	public static String PluginImportWizard_runningConfigsTitle;
2279
2280
	public static String PluginImportWizardFirstPage_0;
2281
2282
	public static String PluginImportWizardFirstPage_1;
2283
2284
	public static String PluginImportWizardFirstPage_2;
2285
2286
	public static String LauncherUtils_title;
2287
2288
	public static String RemoveLazyLoadingDirectiveResolution_remove;
2289
2290
	public static String EditorPreferencePage_link;
2291
2292
	public static String ManifestSyntaxColorTab_keys;
2293
2294
	public static String ManifestSyntaxColorTab_assignment;
2295
2296
	public static String ManifestSyntaxColorTab_values;
2297
2298
	public static String SyntaxColorTab_elements;
2299
2300
	public static String SyntaxColorTab_color;
2301
2302
	public static String SyntaxColorTab_bold;
2303
2304
	public static String SyntaxColorTab_italic;
2305
2306
	public static String SyntaxColorTab_preview;
2307
2308
	public static String EditorPreferencePage_xml;
2309
2310
	public static String EditorPreferencePage_manifest;
2311
2312
	public static String ManifestSyntaxColorTab_reservedOSGi;
2313
2314
	public static String ManifestSyntaxColorTab_attributes;
2315
2316
	public static String AbstractSchemaDetails_minOccurLabel;
2317
2318
	public static String AbstractSchemaDetails_maxOccurLabel;
2319
2320
	public static String AbstractSchemaDetails_unboundedButton;
2321
2322
	public static String NewRestrictionDialog_title;
2323
2324
	public static String NewRestrictionDialog_message;
2325
2326
	public static String SchemaIncludesSection_addButton;
2327
2328
	public static String SchemaIncludesSection_removeButton;
2329
2330
	public static String SchemaIncludesSection_title;
2331
2332
	public static String SchemaIncludesSection_description;
2333
2334
	public static String SchemaIncludesSection_dialogMessage;
2335
2336
	public static String SchemaDetails_translatable;
2337
2338
	public static String SchemaElementDetails_title;
2339
2340
	public static String SchemaElementDetails_rootTitle;
2341
2342
	public static String SchemaElementDetails_description;
2343
2344
	public static String SchemaCompositorDetails_description;
2345
2346
	public static String SchemaElementReferenceDetails_description;
2347
2348
	public static String SchemaCompositorDetails_type;
2349
2350
	public static String SchemaCompositorDetails_title;
2351
2352
	public static String SchemaElementReferenceDetails_reference;
2353
2354
	public static String SchemaElementReferenceDetails_title;
2355
2356
	public static String DocSection_text;
2357
2358
	public static String SchemaDetails_deprecated;
2359
	public static String SchemaDetails_internal;
2360
2361
	public static String SchemaAttributeDetails_use;
2362
	public static String SchemaAttributeDetails_type;
2363
	public static String SchemaAttributeDetails_restrictions;
2364
	public static String SchemaAttributeDetails_addRestButton;
2365
	public static String SchemaAttributeDetails_removeRestButton;
2366
	public static String SchemaAttributeDetails_extends;
2367
	public static String SchemaAttributeDetails_browseButton;
2368
	public static String SchemaAttributeDetails_implements;
2369
	public static String SchemaAttributeDetails_title;
2370
	public static String SchemaAttributeDetails_description;
2371
	public static String SchemaAttributeDetails_defaultDefaultValue;
2372
2373
	public static String SchemaStringAttributeDetails_reference;
2374
	public static String SchemaIdentifierAttributeDetails_additionalRestrictions;
2375
2376
	public static String SchemaDetails_name;
2377
2378
	public static String SchemaRootElementDetails_replacement;
2379
2380
	public static String SecondaryBundlesSection_title;
2381
2382
	public static String SecondaryBundlesSection_desc;
2383
2384
	public static String SecondaryBundlesSection_resolve;
2385
2386
	public static String ArgumentsSection_allPlatforms;
2387
2388
	public static String JavaArgumentsTab_progamArgsGroup;
2389
2390
	public static String JavaArgumentsTab_programVariables;
2391
2392
	public static String JavaArgumentsTab_vmArgsGroup;
2393
2394
	public static String JavaArgumentsTab_vmVariables;
2395
2396
	public static String NewTargetDefnitionFileWizardPage_0;
2397
2398
	public static String NewTargetProfileWizard_title;
2399
2400
	public static String TargetProfileWizardPage_description;
2401
2402
	public static String JavaArgumentsTab_description;
2403
2404
	public static String TargetProfileWizardPage_title;
2405
2406
	public static String ProductInfoSection_productname;
2407
2408
	public static String ManifestStructureCreator_name;
2409
2410
	public static String ManifestContentMergeViewer_title;
2411
2412
	public static String EnvironmentPage_title;
2413
2414
	public static String JRESection_description;
2415
2416
	public static String JRESection_defaultJRE;
2417
2418
	public static String JRESection_JREName;
2419
2420
	public static String JRESection_ExecutionEnv;
2421
2422
	public static String EnvironmentSection_description;
2423
2424
	public static String EnvironmentSection_operationSystem;
2425
2426
	public static String EnvironmentSection_windowingSystem;
2427
2428
	public static String EnvironmentSection_architecture;
2429
2430
	public static String EnvironmentSection_locale;
2431
2432
	public static String ArgumentsSection_programTabLabel;
2433
2434
	public static String ArgumentsSection_vmTabLabel;
2435
2436
	public static String ArgumentsSection_editorTitle;
2437
2438
	public static String ArgumentsSection_description;
2439
2440
	public static String ArgumentsSection_variableButtonTitle;
2441
2442
	public static String ArgumentsSection_argumentsButtonTitle;
2443
2444
	public static String TargetDefinitionContentPage_0;
2445
2446
	public static String TargetDefinitionContentPage_1;
2447
2448
	public static String TargetDefinitionContentPage_2;
2449
2450
	public static String TargetDefinitionContentPage_4;
2451
2452
	public static String TargetDefinitionContentPage_6;
2453
2454
	public static String TargetDefinitionContentPage_7;
2455
2456
	public static String TargetDefinitionContentPage_8;
2457
2458
	public static String TargetDefinitionContentPage_LocationDescription;
2459
2460
	public static String TargetDefinitionEnvironmentPage_3;
2461
2462
	public static String TargetDefinitionEnvironmentPage_4;
2463
2464
	public static String TargetDefinitionEnvironmentPage_5;
2465
2466
	public static String EditorUtilities_noImageData;
2467
2468
	public static String EditorUtilities_pathNotValidImage;
2469
2470
	public static String EditorUtilities_invalidFilePath;
2471
2472
	public static String EditorUtilities_icoError;
2473
2474
	public static String EditorUtilities_incorrectSize;
2475
2476
	public static String EditorUtilities_imageTooLarge;
2477
2478
	public static String EditorUtilities_imageTooLargeInfo;
2479
2480
	public static String EditorUtilities_missingIcoNote;
2481
2482
	public static String RequiredExecutionEnvironmentSection_add;
2483
2484
	public static String RequiredExecutionEnvironmentSection_remove;
2485
2486
	public static String RequiredExecutionEnvironmentSection_up;
2487
2488
	public static String RequiredExecutionEnvironmentSection_down;
2489
2490
	public static String RequiredExecutionEnvironmentSection_fragmentDesc;
2491
2492
	public static String RequiredExecutionEnvironmentSection_pluginDesc;
2493
2494
	public static String RequiredExecutionEnvironmentSection_dialog_title;
2495
2496
	public static String RequiredExecutionEnvironmentSection_dialogMessage;
2497
2498
	public static String BuildExecutionEnvironmentSection_configure;
2499
2500
	public static String ExecutionEnvironmentSection_updateClasspath;
2501
2502
	public static String EditorUtilities_incorrectImageDepth;
2503
2504
	public static String ImplicitDependenciesSection_0;
2505
2506
	public static String ImplicitDependenicesSection_Add;
2507
2508
	public static String ImplicitDependenicesSection_Remove;
2509
2510
	public static String ImplicitDependenicesSection_RemoveAll;
2511
2512
	public static String ImplicitDependenicesSection_Title;
2513
2514
	public static String TargetImplicitPluginsTab_desc;
2515
2516
	public static String TargetImplicitPluginsTab_removeAll3;
2517
2518
	public static String ProductExportWizard_syncTitle;
2519
2520
	public static String ProductExportWizardPage_exportOptionsGroup;
2521
2522
	public static String CompilersConfigurationTab_buildPropertiesErrors;
2523
2524
	public static String PluginsView_description;
2525
2526
	public static String LocationSection_0;
2527
2528
	public static String PointSelectionPage_newDepFound;
2529
2530
	public static String PointSelectionPage_newDepMessage;
2531
2532
	public static String OrganizeManifestsWizard_title;
2533
2534
	public static String OrganizeManifestsOperation_export;
2535
2536
	public static String OrganizeManifestsOperation_filterInternal;
2537
2538
	public static String OrganizeManifestsOperation_removeUnresolved;
2539
2540
	public static String OrganizeManifestsOperation_markOptionalUnresolved;
2541
2542
	public static String OrganizeManifestsOperation_unusedDeps;
2543
2544
	public static String OrganizeManifestsOperation_lazyStart;
2545
2546
	public static String OrganizeManifestsOperation_uselessPluginFile;
2547
2548
	public static String OrganizeManifestsOperation_nlIconPath;
2549
2550
	public static String OrganizeManifestsOperation_unusedKeys;
2551
2552
	public static String OrganizeManifestsWizardPage_title;
2553
2554
	public static String OrganizeManifestsWizardPage_description;
2555
2556
	public static String OrganizeManifestsWizardPage_errorMsg;
2557
2558
	public static String OrganizeManifestsWizardPage_exportedGroup;
2559
2560
	public static String OrganizeManifestsWizardPage_addMissing;
2561
2562
	public static String OrganizeManifestsWizardPage_markInternal;
2563
2564
	public static String OrganizeManifestsWizardPage_packageFilter;
2565
2566
	public static String OrganizeManifestsWizardPage_removeUnresolved;
2567
2568
	public static String OrganizeManifestsWizardPage_dependenciesGroup;
2569
2570
	public static String OrganizeManifestsWizardPage_unresolvedDependencies;
2571
2572
	public static String OrganizeManifestsWizardPage_remove;
2573
2574
	public static String OrganizeManifestsWizardPage_markOptional;
2575
2576
	public static String OrganizeManifestsWizardPage_removeUnused;
2577
2578
	public static String OrganizeManifestsWizardPage_generalGroup;
2579
2580
	public static String OrganizeManifestsWizardPage_lazyStart;
2581
2582
	public static String OrganizeManifestsWizardPage_uselessPluginFile;
2583
2584
	public static String OrganizeManifestsWizardPage_internationalizationGroup;
2585
2586
	public static String OrganizeManifestsWizardPage_prefixNL;
2587
2588
	public static String OrganizeManifestsWizardPage_removeUnusedKeys;
2589
2590
	public static String TargetPlatformPreferencePage2_0;
2591
2592
	public static String TargetPlatformPreferencePage2_1;
2593
2594
	public static String TargetPlatformPreferencePage2_11;
2595
2596
	public static String TargetPlatformPreferencePage2_12;
2597
2598
	public static String TargetPlatformPreferencePage2_13;
2599
2600
	public static String TargetPlatformPreferencePage2_14;
2601
2602
	public static String TargetPlatformPreferencePage2_15;
2603
2604
	public static String TargetPlatformPreferencePage2_16;
2605
2606
	public static String TargetPlatformPreferencePage2_17;
2607
2608
	public static String TargetPlatformPreferencePage2_18;
2609
2610
	public static String TargetPlatformPreferencePage2_19;
2611
2612
	public static String TargetPlatformPreferencePage2_2;
2613
2614
	public static String TargetPlatformPreferencePage2_20;
2615
2616
	public static String TargetPlatformPreferencePage2_21;
2617
2618
	public static String TargetPlatformPreferencePage2_22;
2619
2620
	public static String TargetPlatformPreferencePage2_23;
2621
2622
	public static String TargetPlatformPreferencePage2_24;
2623
2624
	public static String TargetPlatformPreferencePage2_25;
2625
2626
	public static String TargetPlatformPreferencePage2_26;
2627
2628
	public static String TargetPlatformPreferencePage2_27;
2629
2630
	public static String TargetPlatformPreferencePage2_3;
2631
2632
	public static String TargetPlatformPreferencePage2_4;
2633
2634
	public static String TargetPlatformPreferencePage2_5;
2635
2636
	public static String TargetPlatformPreferencePage2_6;
2637
2638
	public static String TargetPlatformPreferencePage2_7;
2639
2640
	public static String TargetPlatformPreferencePage2_8;
2641
2642
	public static String TargetPlatformPreferencePage2_9;
2643
2644
	public static String ManifestEditorContributor_externStringsActionName;
2645
2646
	public static String SplashSection_progressBar;
2647
	public static String SplashSection_progressX;
2648
	public static String SplashSection_progressWidth;
2649
	public static String SplashSection_progressY;
2650
	public static String SplashSection_progressHeight;
2651
	public static String SplashSection_progressMessage;
2652
	public static String SplashSection_messageX;
2653
	public static String SplashSection_messageWidth;
2654
	public static String SplashSection_messageColor;
2655
	public static String SplashSection_messageY;
2656
	public static String SplashSection_messageHeight;
2657
2658
	public static String LicensingPage_title;
2659
2660
	public static String LicenseSection_title;
2661
	public static String LicenseSection_description;
2662
	public static String LicenseSection_url;
2663
	public static String LicenseSection_text;
2664
2665
	public static String FeatureImportWizardPage_reload;
2666
2667
	public static String TargetEditor_0;
2668
2669
	public static String TargetEditor_1;
2670
2671
	public static String TargetEditor_2;
2672
2673
	public static String FeatureImportWizardPage_reloadLocation;
2674
2675
	public static String FeatureImportWizardPage_importHasInvalid;
2676
2677
	public static String ProductInfoSection_plugins;
2678
2679
	public static String ProductInfoSection_features;
2680
2681
	public static String ImportPackageSection_goToPackage;
2682
2683
	public static String ExportPackageSection_findReferences;
2684
2685
	public static String RemoveBuildEntryResolution_removeEntry;
2686
2687
	public static String RemoveBuildEntryResolution_removeToken;
2688
2689
	public static String AddBuildEntryResolution_add;
2690
2691
	public static String AppendSeperatorBuildEntryResolution_label;
2692
2693
	public static String AddSourceBuildEntryResolution_label;
2694
2695
	public static String RemoveSeperatorBuildEntryResolution_label;
2696
2697
	public static String ExternalizeStringsResolution_desc;
2698
2699
	public static String ExternalizeStringsResolution_label;
2700
2701
	public static String DependencyManagementSection_jobName;
2702
2703
	public static String DescriptionSection_nameLabel;
2704
2705
	public static String OrganizeManifestsOperation_additionalDeps;
2706
2707
	public static String OrganizeManifestsWizardPage_addDependencies;
2708
2709
	public static String AddNewDependenciesAction_title;
2710
2711
	public static String AddNewDependenciesAction_notFound;
2712
2713
	public static String AddNewDependenciesOperation_mainTask;
2714
2715
	public static String AddNewDependenciesOperation_searchProject;
2716
2717
	public static String AddNewDependenciesOperation_searchForDependency;
2718
2719
	public static String OpenManifestsAction_cannotFind;
2720
2721
	public static String OpenManifestsAction_cannotOpen;
2722
2723
	public static String OpenManifestsAction_title;
2724
2725
	public static String NewProjectCreationPage_invalidProjectName;
2726
	public static String NewProjectCreationPage_invalidLocationPath;
2727
	public static String NewProjectCreationPage_invalidEE;
2728
2729
	public static String RemoveInternalDirective_label;
2730
2731
	public static String RemoveInternalDirective_desc;
2732
2733
	public static String ImportPackageSection_dialogButtonLabel;
2734
2735
	public static String EditorPreferencePage_folding;
2736
2737
	public static String EditTargetNode_0;
2738
2739
	public static String ExternalizeStringsWizardPage_subKey;
2740
2741
	public static String ExternalizeStringsWizardPage_value;
2742
2743
	public static String RemoveImportExportServices_label;
2744
	public static String RemoveImportExportServices_description;
2745
2746
	// HyperlinkAction.java
2747
	public static String HyperlinkActionOpenType;
2748
	public static String HyperlinkActionOpenDescription;
2749
	public static String HyperlinkActionOpenBundle;
2750
	public static String HyperlinkActionOpenPackage;
2751
2752
	public static String VMHelper_cannotFindExecEnv;
2753
2754
	public static String HyperlinkActionOpenResource;
2755
	public static String HyperlinkActionOpenSchema;
2756
	public static String HyperlinkActionOpenTranslation;
2757
	public static String HyperlinkActionNoLinksAvailable;
2758
2759
	// XMLCompletionProposal
2760
	public static String XMLCompletionProposal_ErrorCycle;
2761
	public static String XMLCompletionProposal_InfoElement;
2762
2763
	public static String XMLContentAssistProcessor_extensionPoints;
2764
2765
	public static String XMLContentAssistProcessor_extensions;
2766
2767
	public static String XMLContentAssistProcessor_extId;
2768
2769
	public static String XMLContentAssistProcessor_extName;
2770
2771
	public static String XMLContentAssistProcessor_extPoint;
2772
2773
	public static String XMLContentAssistProcessor_extPointId;
2774
2775
	public static String XMLContentAssistProcessor_extPointName;
2776
2777
	public static String XMLSyntaxColorTab_externalizedStrings;
2778
2779
	public static String XMLContentAssistProcessor_schemaLocation;
2780
2781
	public static String PDEJavaHelper_msgContentAssistAvailable;
2782
2783
	public static String AddExportPackageResolution_Label;
2784
	public static String AddBundleClassPathResolution_add;
2785
2786
	public static String AntGeneratingExportWizard_0;
2787
	public static String AntGeneratingExportWizard_1;
2788
	public static String AntGeneratingExportWizard_2;
2789
2790
	public static String PluginVersionPart_groupTitle;
2791
	public static String PluginVersionPart_buttonTitle;
2792
2793
	public static String FilteredPluginArtifactsSelectionDialog_title;
2794
	public static String FilteredPluginArtifactsSelectionDialog_message;
2795
	public static String FilteredPluginArtifactsSelectionDialog_searching;
2796
	public static String FilteredPluginArtifactsSelectionDialog_showExtensions;
2797
	public static String FilteredPluginArtifactsSelectionDialog_showExtensionPoints;
2798
	public static String FilteredPluginArtifactsSelectionDialog_showExportedPackages;
2799
	public static String FilteredPluginArtifactsSelectionDialog_showFeatures;
2800
2801
	public static String FilteredSchemaAttributeSelectionDialog_title;
2802
	public static String FilteredSchemaAttributeSelectionDialog_message;
2803
	public static String FilteredSchemaAttributeSelectionDialog_searching;
2804
	public static String FilteredSchemaAttributeSelectionDialog_showOptionalAttributes;
2805
2806
	public static String ProjectSelectionDialog_title;
2807
	public static String ProjectSelectionDialog_message;
2808
	public static String ProjectSelectionDialog_settingsTitle;
2809
2810
	public static String PDECompilersConfigurationBlock_error;
2811
	public static String PDECompilersConfigurationBlock_warning;
2812
	public static String PDECompilersConfigurationBlock_ignore;
2813
2814
	public static String PDEJUnitLaunchConfigurationTab_Run_Tests_In_UI_Thread;
2815
2816
	public static String VersionDialog_text;
2817
2818
}
0
  + text/plain
2819
  + text/plain
1
  + *
2820
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchConfigurationHelper.java (+454 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
15
16
import java.io.*;
17
import java.net.URL;
18
import java.util.*;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.core.variables.IStringVariableManager;
21
import org.eclipse.core.variables.VariablesPlugin;
22
import org.eclipse.debug.core.ILaunchConfiguration;
23
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
24
import org.eclipse.osgi.service.resolver.BundleDescription;
25
import org.eclipse.pde.core.plugin.IPluginModelBase;
26
import org.eclipse.pde.core.plugin.TargetPlatform;
27
import org.eclipse.pde.internal.build.IPDEBuildConstants;
28
import org.eclipse.pde.internal.core.*;
29
30
/**
31
 * Contains helper methods for launching an Eclipse Runtime Workbench
32
 */
33
public class LaunchConfigurationHelper {
34
35
	private static final String PROP_OSGI_FRAMEWORK = "osgi.framework"; //$NON-NLS-1$
36
	private static final String PROP_OSGI_BUNDLES = "osgi.bundles"; //$NON-NLS-1$
37
	private static final String PROP_P2_DATA_AREA = "eclipse.p2.data.area"; //$NON-NLS-1$
38
39
	public static void synchronizeManifests(ILaunchConfiguration config, File configDir) {
40
		try {
41
			String programArgs = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
42
			if (programArgs.indexOf("-clean") != -1) //$NON-NLS-1$
43
				return;
44
		} catch (CoreException e) {
45
		}
46
		File dir = new File(configDir, "org.eclipse.osgi/manifests"); //$NON-NLS-1$
47
		if (dir.exists() && dir.isDirectory()) {
48
			PDECore.getDefault().getJavaElementChangeListener().synchronizeManifests(dir);
49
		}
50
	}
51
52
	public static File getConfigurationArea(ILaunchConfiguration config) {
53
		File dir = getConfigurationLocation(config);
54
		if (!dir.exists())
55
			dir.mkdirs();
56
		return dir;
57
	}
58
59
	public static File getConfigurationLocation(ILaunchConfiguration config) {
60
		//bug 170213 change config location if config name contains #
61
		String configName = config.getName();
62
		configName = configName.replace('#', 'h');
63
		File dir = new File(PDECore.getDefault().getStateLocation().toOSString(), configName);
64
		try {
65
			if (!config.getAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, true)) {
66
				String userPath = config.getAttribute(IPDELauncherConstants.CONFIG_LOCATION, (String) null);
67
				if (userPath != null) {
68
					userPath = getSubstitutedString(userPath);
69
					dir = new File(userPath).getAbsoluteFile();
70
				}
71
			}
72
		} catch (CoreException e) {
73
		}
74
		return dir;
75
	}
76
77
	private static String getSubstitutedString(String text) throws CoreException {
78
		if (text == null)
79
			return ""; //$NON-NLS-1$
80
		IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
81
		return mgr.performStringSubstitution(text);
82
	}
83
84
	public static Properties createConfigIniFile(ILaunchConfiguration configuration, String productID, Map bundles, Map bundlesWithStartLevels, File directory) throws CoreException {
85
		Properties properties = null;
86
		// if we are to generate a config.ini, start with the values in the target platform's config.ini - bug 141918
87
		if (configuration.getAttribute(IPDELauncherConstants.CONFIG_GENERATE_DEFAULT, true)) {
88
			properties = TargetPlatformHelper.getConfigIniProperties();
89
			// if target's config.ini does not exist, lets try to fill in default values
90
			if (properties == null)
91
				properties = new Properties();
92
			// keep properties only if we are launching the default product (bug 175437)
93
			else if (productID == null || !productID.equals(properties.get("eclipse.product"))) //$NON-NLS-1$
94
				properties.clear();
95
			// if target's config.ini has the osgi.bundles header, then parse and compute the proper osgi.bundles value
96
			String bundleList = properties.getProperty(PROP_OSGI_BUNDLES);
97
			if (bundleList != null)
98
				properties.setProperty(PROP_OSGI_BUNDLES, computeOSGiBundles(TargetPlatformHelper.stripPathInformation(bundleList), bundles, bundlesWithStartLevels));
99
			String dataArea = properties.getProperty(PROP_P2_DATA_AREA);
100
			if (dataArea != null) {
101
				// Make the p2 data area in the configuration area itself, rather than a sibling of the configuration
102
				// area (which is a the root pde.core shared metadata area) @see bug 272810
103
				properties.setProperty(PROP_P2_DATA_AREA, "@config.dir/.p2"); //$NON-NLS-1$
104
			}
105
		} else {
106
			String templateLoc = configuration.getAttribute(IPDELauncherConstants.CONFIG_TEMPLATE_LOCATION, (String) null);
107
			if (templateLoc != null) {
108
				properties = loadFromTemplate(getSubstitutedString(templateLoc));
109
				// if template contains osgi.bundles, then only strip the path, do not compute the value
110
				String osgiBundles = properties.getProperty(PROP_OSGI_BUNDLES);
111
				if (osgiBundles != null)
112
					properties.setProperty(PROP_OSGI_BUNDLES, TargetPlatformHelper.stripPathInformation(osgiBundles));
113
			}
114
		}
115
		// whether we create a new config.ini or read from one as a template, we should add the required properties - bug 161265
116
		if (properties != null) {
117
			addRequiredProperties(properties, productID, bundles, bundlesWithStartLevels);
118
		} else {
119
			properties = new Properties();
120
		}
121
		if (!directory.exists()) {
122
			directory.mkdirs();
123
		}
124
		String osgiBundles = properties.getProperty(PROP_OSGI_BUNDLES);
125
		int start = configuration.getAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4);
126
		properties.put("osgi.bundles.defaultStartLevel", Integer.toString(start)); //$NON-NLS-1$
127
		boolean autostart = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, false);
128
129
		// if we are launching using P2, write out P2 files (bundles.txt) and add P2 property to config.ini
130
		if (osgiBundles != null && osgiBundles.indexOf(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR) != -1 && bundles.containsKey(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR)) {
131
			URL bundlesTxt = null;
132
			boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true);
133
			boolean useFeatures = configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false);
134
			if (usedefault || useFeatures) {
135
				bundlesTxt = P2Utils.writeBundlesTxt(bundlesWithStartLevels, 4, false, directory, osgiBundles);
136
			} else {
137
				bundlesTxt = P2Utils.writeBundlesTxt(bundlesWithStartLevels, start, autostart, directory, null);
138
			}
139
140
			if (bundlesTxt != null) {
141
				properties.setProperty("org.eclipse.equinox.simpleconfigurator.configUrl", bundlesTxt.toString()); //$NON-NLS-1$
142
				// if we have simple configurator and update configurator together, ensure update doesn't reconcile
143
				if (bundles.get(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR) != null) {
144
					properties.setProperty("org.eclipse.update.reconcile", "false"); //$NON-NLS-1$ //$NON-NLS-2$
145
				}
146
			}
147
		}
148
149
		setBundleLocations(bundles, properties, autostart);
150
151
		save(new File(directory, "config.ini"), properties); //$NON-NLS-1$
152
		return properties;
153
	}
154
155
	private static void addRequiredProperties(Properties properties, String productID, Map bundles, Map bundlesWithStartLevels) {
156
		if (!properties.containsKey("osgi.install.area")) //$NON-NLS-1$
157
			properties.setProperty("osgi.install.area", "file:" + TargetPlatform.getLocation()); //$NON-NLS-1$ //$NON-NLS-2$
158
		if (!properties.containsKey("osgi.configuration.cascaded")) //$NON-NLS-1$
159
			properties.setProperty("osgi.configuration.cascaded", "false"); //$NON-NLS-1$ //$NON-NLS-2$
160
		if (!properties.containsKey(PROP_OSGI_FRAMEWORK))
161
			properties.setProperty(PROP_OSGI_FRAMEWORK, IPDEBuildConstants.BUNDLE_OSGI);
162
		if (!properties.containsKey("osgi.splashPath") && productID != null) //$NON-NLS-1$
163
			addSplashLocation(properties, productID, bundles);
164
		// if osgi.splashPath is set, try to resolve relative paths to absolute paths
165
		if (properties.containsKey("osgi.splashPath")) //$NON-NLS-1$
166
			resolveLocationPath(properties.getProperty("osgi.splashPath"), properties, bundles); //$NON-NLS-1$
167
		if (!properties.containsKey(PROP_OSGI_BUNDLES))
168
			properties.setProperty(PROP_OSGI_BUNDLES, computeOSGiBundles(TargetPlatform.getBundleList(), bundles, bundlesWithStartLevels));
169
		if (!properties.containsKey("osgi.bundles.defaultStartLevel")) //$NON-NLS-1$
170
			properties.setProperty("osgi.bundles.defaultStartLevel", "4"); //$NON-NLS-1$ //$NON-NLS-2$
171
	}
172
173
	/**
174
	 * Computes a list of osgi bundles to be put into the osgi.bundles property based
175
	 * on the bundles from the target platform config.ini and a map of bundles we are
176
	 * launching with.  The list of bundles must have already had it's path information
177
	 * removed.
178
	 * @param bundleList list of bundles without path information
179
	 * @param bundles map of bundle id to bundle model, contains all bundles being launched with
180
	 * @param bundlesWithStartLevels map of bundles of start level
181
	 * @return string list of osgi bundles
182
	 */
183
	private static String computeOSGiBundles(String bundleList, Map bundles, Map bundlesWithStartLevels) {
184
185
		// if p2 and only simple configurator and 
186
		// if simple configurator isn't selected & isn't in bundle list... hack it
187
188
		// if using p2's simple configurator, a bundles.txt will be written, so we only need simple configurator in the config.ini
189
		if (bundles.get(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR) != null)
190
			return "org.eclipse.equinox.simpleconfigurator@1:start"; //$NON-NLS-1$
191
192
		StringBuffer buffer = new StringBuffer();
193
		Set initialBundleSet = new HashSet();
194
		StringTokenizer tokenizer = new StringTokenizer(bundleList, ","); //$NON-NLS-1$
195
		while (tokenizer.hasMoreTokens()) {
196
			String token = tokenizer.nextToken();
197
			int index = token.indexOf('@');
198
			String id = index != -1 ? token.substring(0, index) : token;
199
			if (bundles.containsKey(id)) {
200
				if (buffer.length() > 0)
201
					buffer.append(',');
202
				buffer.append(id);
203
				if (index != -1 && index < token.length() - 1)
204
					buffer.append(token.substring(index));
205
				initialBundleSet.add(id);
206
			}
207
		}
208
209
		// if org.eclipse.update.configurator is not included (LIKE IN BASIC RCP APPLICATION), then write out all bundles in osgi.bundles - bug 170772
210
		if (!initialBundleSet.contains(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR)) {
211
			initialBundleSet.add(IPDEBuildConstants.BUNDLE_OSGI);
212
			Iterator iter = bundlesWithStartLevels.keySet().iterator();
213
			while (iter.hasNext()) {
214
				IPluginModelBase model = (IPluginModelBase) iter.next();
215
				String id = model.getPluginBase().getId();
216
				if (!initialBundleSet.contains(id)) {
217
					if (buffer.length() > 0)
218
						buffer.append(',');
219
220
					String slinfo = (String) bundlesWithStartLevels.get(model);
221
					buffer.append(id);
222
					buffer.append('@');
223
					buffer.append(slinfo);
224
				}
225
			}
226
		}
227
		return buffer.toString();
228
	}
229
230
	private static Properties loadFromTemplate(String templateLoc) throws CoreException {
231
		Properties properties = new Properties();
232
		File templateFile = new File(templateLoc);
233
		if (templateFile.exists() && templateFile.isFile()) {
234
			FileInputStream stream = null;
235
			try {
236
				stream = new FileInputStream(templateFile);
237
				properties.load(stream);
238
			} catch (Exception e) {
239
				String message = e.getMessage();
240
				if (message != null)
241
					throw new CoreException(new Status(IStatus.ERROR, PDELaunchingPlugin.getPluginId(), IStatus.ERROR, message, e));
242
			} finally {
243
				if (stream != null) {
244
					try {
245
						stream.close();
246
					} catch (IOException e) {
247
					}
248
				}
249
			}
250
		}
251
		return properties;
252
	}
253
254
	private static void addSplashLocation(Properties properties, String productID, Map map) {
255
		Properties targetConfig = TargetPlatformHelper.getConfigIniProperties();
256
		String targetProduct = targetConfig == null ? null : targetConfig.getProperty("eclipse.product"); //$NON-NLS-1$
257
		String targetSplash = targetConfig == null ? null : targetConfig.getProperty("osgi.splashPath"); //$NON-NLS-1$
258
		if (!productID.equals(targetProduct) || targetSplash == null) {
259
			ArrayList locations = new ArrayList();
260
			String plugin = getContributingPlugin(productID);
261
			locations.add(plugin);
262
			IPluginModelBase model = (IPluginModelBase) map.get(plugin);
263
			if (model != null) {
264
				BundleDescription desc = model.getBundleDescription();
265
				if (desc != null) {
266
					BundleDescription[] fragments = desc.getFragments();
267
					for (int i = 0; i < fragments.length; i++)
268
						locations.add(fragments[i].getSymbolicName());
269
				}
270
			}
271
			resolveLocationPath(locations, properties, map);
272
		} else
273
			resolveLocationPath(targetSplash, properties, map);
274
	}
275
276
	private static void resolveLocationPath(String splashPath, Properties properties, Map map) {
277
		ArrayList locations = new ArrayList();
278
		StringTokenizer tok = new StringTokenizer(splashPath, ","); //$NON-NLS-1$
279
		while (tok.hasMoreTokens())
280
			locations.add(tok.nextToken());
281
		resolveLocationPath(locations, properties, map);
282
	}
283
284
	private static void resolveLocationPath(ArrayList locations, Properties properties, Map map) {
285
		StringBuffer buffer = new StringBuffer();
286
		for (int i = 0; i < locations.size(); i++) {
287
			String location = (String) locations.get(i);
288
			if (location.startsWith("platform:/base/plugins/")) { //$NON-NLS-1$
289
				location = location.replaceFirst("platform:/base/plugins/", ""); //$NON-NLS-1$ //$NON-NLS-2$
290
			}
291
			String url = getBundleURL(location, map, false);
292
			if (url == null)
293
				continue;
294
			if (buffer.length() > 0)
295
				buffer.append(","); //$NON-NLS-1$
296
			buffer.append(url);
297
		}
298
		if (buffer.length() > 0)
299
			properties.setProperty("osgi.splashPath", buffer.toString()); //$NON-NLS-1$
300
	}
301
302
	/**
303
	 * Returns a string url representing the install location of the bundle model with the
304
	 * specified id.  The model is obtained using the provided map.
305
	 * @param id the id of the bundle
306
	 * @param pluginMap mapping of bundle ids to bundle models
307
	 * @param includeReference whether to prefix the url with 'reference:'
308
	 * @return string url for the bundle location
309
	 */
310
	public static String getBundleURL(String id, Map pluginMap, boolean includeReference) {
311
		IPluginModelBase model = (IPluginModelBase) pluginMap.get(id.trim());
312
		return getBundleURL(model, includeReference);
313
	}
314
315
	/**
316
	 * Returns a string url representing the install location of the given bundle model
317
	 * @param model the model to create the url for
318
	 * @param includeReference whether to prefix the url with 'reference:'
319
	 * @return string url for bundle location
320
	 */
321
	public static String getBundleURL(IPluginModelBase model, boolean includeReference) {
322
		if (model == null || model.getInstallLocation() == null)
323
			return null;
324
		StringBuffer buf = new StringBuffer();
325
		if (includeReference) {
326
			buf.append(TargetPlatformHelper.REFERENCE_PREFIX);
327
		}
328
		buf.append(TargetPlatformHelper.FILE_URL_PREFIX);
329
		buf.append(new Path(model.getInstallLocation()).removeTrailingSeparator().toString());
330
		return buf.toString();
331
	}
332
333
	/**
334
	 * Use the map of bundles we are launching with to update the osgi.framework
335
	 * and osgi.bundles properties with the correct info.
336
	 * @param map map of bundles being launched (id mapped to model)
337
	 * @param properties properties for config.ini
338
	 */
339
	private static void setBundleLocations(Map map, Properties properties, boolean defaultAuto) {
340
		String framework = properties.getProperty(PROP_OSGI_FRAMEWORK);
341
		if (framework != null) {
342
			framework = TargetPlatformHelper.stripPathInformation(framework);
343
			String url = getBundleURL(framework, map, false);
344
			if (url != null)
345
				properties.setProperty(PROP_OSGI_FRAMEWORK, url);
346
		}
347
348
		String bundles = properties.getProperty(PROP_OSGI_BUNDLES);
349
		if (bundles != null) {
350
			StringBuffer buffer = new StringBuffer();
351
			StringTokenizer tokenizer = new StringTokenizer(bundles, ","); //$NON-NLS-1$
352
			while (tokenizer.hasMoreTokens()) {
353
				String token = tokenizer.nextToken().trim();
354
				String url = getBundleURL(token, map, false);
355
				int i = -1;
356
				if (url == null) {
357
					i = token.indexOf('@');
358
					if (i != -1) {
359
						url = getBundleURL(token.substring(0, i), map, false);
360
					}
361
					if (url == null) {
362
						i = token.indexOf(':');
363
						if (i != -1)
364
							url = getBundleURL(token.substring(0, i), map, false);
365
					}
366
				}
367
				if (url != null) {
368
					if (buffer.length() > 0) {
369
						buffer.append(","); //$NON-NLS-1$
370
					}
371
					buffer.append("reference:" + url); //$NON-NLS-1$
372
					if (i != -1) {
373
						String slinfo = token.substring(i + 1);
374
						buffer.append(getStartData(slinfo, defaultAuto));
375
					}
376
				}
377
			}
378
			properties.setProperty(PROP_OSGI_BUNDLES, buffer.toString());
379
		}
380
	}
381
382
	/**
383
	 * Convenience method to parses the startData ("startLevel:autoStart"), convert it to the
384
	 * format expected by the OSGi bundles property, and append to a StringBuffer.
385
	 * @param startData data to parse ("startLevel:autoStart")
386
	 * @param defaultAuto default auto start setting
387
	 */
388
	public static String getStartData(String startData, boolean defaultAuto) {
389
		StringBuffer buffer = new StringBuffer();
390
		int index = startData.indexOf(':');
391
		String level = index > 0 ? startData.substring(0, index) : "default"; //$NON-NLS-1$
392
		String auto = startData;
393
		if (!startData.equals("start")) //$NON-NLS-1$
394
			auto = index >= 0 && index < startData.length() - 1 ? startData.substring(index + 1) : "default"; //$NON-NLS-1$
395
		if ("default".equals(auto)) //$NON-NLS-1$
396
			auto = Boolean.toString(defaultAuto);
397
		if (!level.equals("default") || "true".equals(auto) || "start".equals(auto)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
398
			buffer.append("@"); //$NON-NLS-1$
399
400
		if (!level.equals("default")) { //$NON-NLS-1$
401
			buffer.append(level);
402
			if ("start".equals(auto) || "true".equals(auto)) //$NON-NLS-1$ //$NON-NLS-2$
403
				buffer.append(":"); //$NON-NLS-1$
404
		}
405
		if ("start".equals(auto) || "true".equals(auto)) { //$NON-NLS-1$ //$NON-NLS-2$
406
			buffer.append("start"); //$NON-NLS-1$
407
		}
408
		return buffer.toString();
409
	}
410
411
	public static void save(File file, Properties properties) {
412
		try {
413
			FileOutputStream stream = new FileOutputStream(file);
414
			properties.store(stream, "Configuration File"); //$NON-NLS-1$
415
			stream.flush();
416
			stream.close();
417
		} catch (IOException e) {
418
			PDECore.logException(e);
419
		}
420
	}
421
422
	public static String getContributingPlugin(String productID) {
423
		if (productID == null)
424
			return null;
425
		int index = productID.lastIndexOf('.');
426
		return index == -1 ? productID : productID.substring(0, index);
427
	}
428
429
	public static String getProductID(ILaunchConfiguration configuration) throws CoreException {
430
		if (configuration.getAttribute(IPDELauncherConstants.USE_PRODUCT, false)) {
431
			return configuration.getAttribute(IPDELauncherConstants.PRODUCT, (String) null);
432
		}
433
434
		// find the product associated with the application, and return its
435
		// contributing plug-in
436
		String appID = configuration.getAttribute(IPDELauncherConstants.APPLICATION, TargetPlatform.getDefaultApplication());
437
		IExtension[] extensions = PDECore.getDefault().getExtensionsRegistry().findExtensions("org.eclipse.core.runtime.products", true); //$NON-NLS-1$
438
		for (int i = 0; i < extensions.length; i++) {
439
			String id = extensions[i].getUniqueIdentifier();
440
			if (id == null)
441
				continue;
442
			IConfigurationElement[] children = extensions[i].getConfigurationElements();
443
			if (children.length != 1)
444
				continue;
445
			if (!"product".equals(children[0].getName())) //$NON-NLS-1$
446
				continue;
447
			if (appID.equals(children[0].getAttribute("application"))) //$NON-NLS-1$
448
				return id;
449
		}
450
		return null;
451
452
	}
453
454
}
0
  + text/plain
455
  + text/plain
1
  + *
456
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchValidationOperation.java (+161 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2007, 2009 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import java.io.*;
14
import java.util.*;
15
import java.util.zip.ZipEntry;
16
import java.util.zip.ZipFile;
17
import org.eclipse.core.resources.IWorkspaceRunnable;
18
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IProgressMonitor;
20
import org.eclipse.debug.core.ILaunchConfiguration;
21
import org.eclipse.jdt.launching.IVMInstall;
22
import org.eclipse.jdt.launching.JavaRuntime;
23
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
24
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
25
import org.eclipse.osgi.service.resolver.State;
26
import org.eclipse.pde.core.plugin.IPluginModelBase;
27
import org.eclipse.pde.core.plugin.PluginRegistry;
28
import org.eclipse.pde.internal.core.BundleValidationOperation;
29
import org.eclipse.pde.internal.core.TargetPlatformHelper;
30
import org.osgi.framework.Constants;
31
32
public abstract class LaunchValidationOperation implements IWorkspaceRunnable {
33
34
	private BundleValidationOperation fOperation;
35
	protected ILaunchConfiguration fLaunchConfiguration;
36
37
	public LaunchValidationOperation(ILaunchConfiguration configuration) {
38
		fLaunchConfiguration = configuration;
39
	}
40
41
	public void run(IProgressMonitor monitor) throws CoreException {
42
		fOperation = new BundleValidationOperation(getModels(), getPlatformProperties());
43
		fOperation.run(monitor);
44
	}
45
46
	protected abstract IPluginModelBase[] getModels() throws CoreException;
47
48
	protected Dictionary[] getPlatformProperties() throws CoreException {
49
		IExecutionEnvironment[] envs = getMatchingEnvironments();
50
		if (envs.length == 0)
51
			return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment()};
52
53
		// add java profiles for those EE's that have a .profile file in the current system bundle
54
		ArrayList result = new ArrayList(envs.length);
55
		for (int i = 0; i < envs.length; i++) {
56
			Properties profileProps = getJavaProfileProperties(envs[i].getId());
57
			if (profileProps != null) {
58
				Dictionary props = TargetPlatformHelper.getTargetEnvironment();
59
				String systemPackages = profileProps.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
60
				if (systemPackages != null)
61
					props.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackages);
62
				String ee = profileProps.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT);
63
				if (ee != null)
64
					props.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee);
65
				result.add(props);
66
			}
67
		}
68
		if (result.size() > 0)
69
			return (Dictionary[]) result.toArray(new Dictionary[result.size()]);
70
		return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment()};
71
72
	}
73
74
	protected IExecutionEnvironment[] getMatchingEnvironments() throws CoreException {
75
		IVMInstall install = VMHelper.getVMInstall(fLaunchConfiguration);
76
		if (install == null)
77
			return new IExecutionEnvironment[0];
78
79
		IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
80
		IExecutionEnvironment[] envs = manager.getExecutionEnvironments();
81
		List result = new ArrayList(envs.length);
82
		for (int i = 0; i < envs.length; i++) {
83
			IExecutionEnvironment env = envs[i];
84
			IVMInstall[] compatible = env.getCompatibleVMs();
85
			for (int j = 0; j < compatible.length; j++) {
86
				if (compatible[j].equals(install)) {
87
					result.add(env);
88
					break;
89
				}
90
			}
91
		}
92
		return (IExecutionEnvironment[]) result.toArray(new IExecutionEnvironment[result.size()]);
93
	}
94
95
	private Properties getJavaProfileProperties(String ee) {
96
		IPluginModelBase model = PluginRegistry.findModel("system.bundle"); //$NON-NLS-1$
97
		if (model == null)
98
			return null;
99
100
		File location = new File(model.getInstallLocation());
101
		String filename = ee.replace('/', '_') + ".profile"; //$NON-NLS-1$
102
		InputStream is = null;
103
		ZipFile zipFile = null;
104
		try {
105
			// find the input stream to the profile properties file
106
			if (location.isDirectory()) {
107
				File file = new File(location, filename);
108
				if (file.exists())
109
					is = new FileInputStream(file);
110
			} else {
111
				zipFile = null;
112
				try {
113
					zipFile = new ZipFile(location, ZipFile.OPEN_READ);
114
					ZipEntry entry = zipFile.getEntry(filename);
115
					if (entry != null)
116
						is = zipFile.getInputStream(entry);
117
				} catch (IOException e) {
118
					// nothing to do
119
				}
120
			}
121
			if (is != null) {
122
				Properties profile = new Properties();
123
				profile.load(is);
124
				return profile;
125
			}
126
		} catch (IOException e) {
127
			// nothing to do
128
		} finally {
129
			if (is != null)
130
				try {
131
					is.close();
132
				} catch (IOException e) {
133
					// nothing to do
134
				}
135
			if (zipFile != null)
136
				try {
137
					zipFile.close();
138
				} catch (IOException e) {
139
					// nothing to do
140
				}
141
		}
142
		return null;
143
	}
144
145
	public boolean hasErrors() {
146
		return fOperation.hasErrors();
147
	}
148
149
	public Map getInput() {
150
		return fOperation.getResolverErrors();
151
	}
152
153
	public boolean isEmpty() {
154
		return fOperation.getState().getHighestBundleId() == -1;
155
	}
156
157
	protected State getState() {
158
		return fOperation.getState();
159
	}
160
161
}
0
  + text/plain
162
  + text/plain
1
  + *
163
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/OSGiMigrationDelegate.java (+43 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2007, 2008 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import org.eclipse.pde.internal.launching.IPDEConstants;
14
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
18
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
19
20
public class OSGiMigrationDelegate extends PDEMigrationDelegate {
21
22
	public boolean isCandidate(ILaunchConfiguration candidate) throws CoreException {
23
		return super.isCandidate(candidate) || !candidate.getAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, "").equals("3.3"); //$NON-NLS-1$ //$NON-NLS-2$
24
	}
25
26
	public void migrate(ILaunchConfigurationWorkingCopy wc) throws CoreException {
27
		if (!wc.getAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, "").equals("3.3")) { //$NON-NLS-1$ //$NON-NLS-2$
28
			wc.setAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, "3.3"); //$NON-NLS-1$
29
			StringBuffer vmArgs = new StringBuffer(wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "")); //$NON-NLS-1$
30
			if (vmArgs.indexOf("-Declipse.ignoreApp") == -1) { //$NON-NLS-1$
31
				if (vmArgs.length() > 0)
32
					vmArgs.append(" "); //$NON-NLS-1$
33
				vmArgs.append("-Declipse.ignoreApp=true"); //$NON-NLS-1$
34
			}
35
			if (vmArgs.indexOf("-Dosgi.noShutdown") == -1) { //$NON-NLS-1$
36
				vmArgs.append(" -Dosgi.noShutdown=true"); //$NON-NLS-1$
37
			}
38
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs.toString());
39
		}
40
		super.migrate(wc);
41
	}
42
43
}
0
  + text/plain
44
  + text/plain
1
  + *
45
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/IEclipsePluginValidationOperationHelper.java (+9 lines)
Line 0 Link Here
1
package org.eclipse.pde.internal.launching.launcher;
2
3
public interface IEclipsePluginValidationOperationHelper {
4
5
	String getAttribute(String configType);
6
7
	Object createExtensionError(String bundleID);
8
9
}
0
  + text/plain
10
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchConfigurationListener.java (+51 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import java.io.File;
14
15
import org.eclipse.debug.core.DebugPlugin;
16
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.debug.core.ILaunchConfigurationListener;
18
import org.eclipse.pde.internal.core.util.CoreUtility;
19
20
public class LaunchConfigurationListener implements ILaunchConfigurationListener {
21
22
	/* (non-Javadoc)
23
	 * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
24
	 */
25
	public void launchConfigurationAdded(ILaunchConfiguration configuration) {
26
	}
27
28
	/* (non-Javadoc)
29
	 * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
30
	 */
31
	public void launchConfigurationChanged(ILaunchConfiguration configuration) {
32
	}
33
34
	/* (non-Javadoc)
35
	 * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
36
	 */
37
	public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
38
		File configDir = LaunchConfigurationHelper.getConfigurationLocation(configuration);
39
		if (configDir.exists()) {
40
			// rename the config area if it was auto-set by PDE when the launch configuration is renamed
41
			ILaunchConfiguration destination = DebugPlugin.getDefault().getLaunchManager().getMovedTo(configuration);
42
			boolean delete = true;
43
			if (destination != null) {
44
				delete = !configDir.renameTo(LaunchConfigurationHelper.getConfigurationLocation(destination));
45
			}
46
			if (delete)
47
				CoreUtility.deleteContent(configDir);
48
		}
49
	}
50
51
}
0
  + text/plain
52
  + text/plain
1
  + *
53
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/PDESourceLookupQuery.java (+258 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import java.io.File;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.ISafeRunnable;
16
import org.eclipse.debug.core.DebugException;
17
import org.eclipse.debug.core.model.IValue;
18
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
19
import org.eclipse.jdt.debug.core.*;
20
import org.eclipse.osgi.service.resolver.BundleDescription;
21
import org.eclipse.osgi.service.resolver.State;
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
23
import org.eclipse.pde.internal.core.PDECore;
24
import org.eclipse.pde.internal.core.TargetPlatformHelper;
25
26
public class PDESourceLookupQuery implements ISafeRunnable {
27
28
	protected static String OSGI_CLASSLOADER = "org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader"; //$NON-NLS-1$
29
	private static String LEGACY_ECLIPSE_CLASSLOADER = "org.eclipse.core.runtime.adaptor.EclipseClassLoader"; //$NON-NLS-1$
30
	private static String MAIN_CLASS = "org.eclipse.core.launcher.Main"; //$NON-NLS-1$
31
	private static String MAIN_PLUGIN = "org.eclipse.platform"; //$NON-NLS-1$
32
33
	private Object fElement;
34
	private Object fResult;
35
	private PDESourceLookupDirector fDirector;
36
37
	public PDESourceLookupQuery(PDESourceLookupDirector director, Object object) {
38
		fElement = object;
39
		fDirector = director;
40
	}
41
42
	public void handleException(Throwable exception) {
43
	}
44
45
	public void run() throws Exception {
46
		IJavaObject classLoaderObject = null;
47
		String declaringTypeName = null;
48
		String sourcePath = null;
49
		if (fElement instanceof IJavaStackFrame) {
50
			IJavaStackFrame stackFrame = (IJavaStackFrame) fElement;
51
			classLoaderObject = stackFrame.getReferenceType().getClassLoaderObject();
52
			declaringTypeName = stackFrame.getDeclaringTypeName();
53
			sourcePath = generateSourceName(declaringTypeName);
54
		} else if (fElement instanceof IJavaObject) {
55
			IJavaObject object = (IJavaObject) fElement;
56
			IJavaReferenceType type = (IJavaReferenceType) object.getJavaType();
57
			if (type != null) {
58
				classLoaderObject = type.getClassLoaderObject();
59
				if (object.getJavaType() != null) {
60
					declaringTypeName = object.getJavaType().getName();
61
				}
62
				if (declaringTypeName != null) {
63
					sourcePath = generateSourceName(declaringTypeName);
64
				}
65
			}
66
		} else if (fElement instanceof IJavaReferenceType) {
67
			IJavaReferenceType type = (IJavaReferenceType) fElement;
68
			classLoaderObject = type.getClassLoaderObject();
69
			declaringTypeName = type.getName();
70
			sourcePath = generateSourceName(declaringTypeName);
71
		}
72
73
		if (classLoaderObject != null) {
74
			IJavaClassType type = (IJavaClassType) classLoaderObject.getJavaType();
75
			if (OSGI_CLASSLOADER.equals(type.getName())) {
76
				if (fDirector.getOSGiRuntimeVersion() < 3.5) {
77
					fResult = findSourceElement34(classLoaderObject, sourcePath);
78
				} else {
79
					fResult = findSourceElement(classLoaderObject, sourcePath);
80
				}
81
			} else if (LEGACY_ECLIPSE_CLASSLOADER.equals(type.getName())) {
82
				fResult = findSourceElement_legacy(classLoaderObject, sourcePath);
83
			} else if (MAIN_CLASS.equals(declaringTypeName)) {
84
				IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(MAIN_PLUGIN);
85
				if (model != null)
86
					fResult = getSourceElement(model.getInstallLocation(), MAIN_PLUGIN, sourcePath);
87
			}
88
		}
89
	}
90
91
	protected Object getResult() {
92
		return fResult;
93
	}
94
95
	private String getValue(IJavaObject object, String variable) throws DebugException {
96
		IJavaFieldVariable var = object.getField(variable, false);
97
		return var == null ? null : var.getValue().getValueString();
98
	}
99
100
	/**
101
	 * Finds a source element in a 3.4 OSGi runtime.
102
	 * 
103
	 * @param object Bundle class loader object
104
	 * @param typeName fully qualified name of the source type being searched for
105
	 * @return source element
106
	 * @throws CoreException
107
	 */
108
	protected Object findSourceElement34(IJavaObject object, String typeName) throws CoreException {
109
		IJavaObject manager = getObject(object, "manager", false); //$NON-NLS-1$
110
		if (manager != null) {
111
			IJavaObject data = getObject(manager, "data", false); //$NON-NLS-1$
112
			if (data != null) {
113
				String location = getValue(data, "fileName"); //$NON-NLS-1$
114
				String id = getValue(data, "symbolicName"); //$NON-NLS-1$
115
				return getSourceElement(location, id, typeName);
116
			}
117
		}
118
		return null;
119
	}
120
121
	/**
122
	 * Finds source in a 3.5 runtime. In 3.5, the OSGi runtime provides hooks to properly
123
     * lookup source in fragments that replace/prepend jars in their host.
124
	 * 
125
	 * @param object Bundle class loader object
126
	 * @param typeName fully qualified name of the source type being searched for 
127
	 * @return source element
128
	 * @throws CoreException
129
	 */
130
	protected Object findSourceElement(IJavaObject object, String typeName) throws CoreException {
131
		IJavaObject manager = getObject(object, "manager", false); //$NON-NLS-1$
132
		if (manager != null) {
133
			IJavaObject data = getObject(manager, "data", false); //$NON-NLS-1$
134
			if (data != null) {
135
				String id = getValue(data, "symbolicName"); //$NON-NLS-1$
136
				// search manager's class path for location
137
				Object result = searchClasspathEntries(manager, id, typeName);
138
				if (result != null) {
139
					return result;
140
				}
141
				// then check its fragments
142
				IJavaObject frgArray = getObject(manager, "fragments", false); //$NON-NLS-1$
143
				if (frgArray instanceof IJavaArray) {
144
					IJavaArray fragments = (IJavaArray) frgArray;
145
					for (int i = 0; i < fragments.getLength(); i++) {
146
						IJavaObject fragment = (IJavaObject) fragments.getValue(i);
147
						if (!fragment.isNull()) {
148
							// search fragment class path
149
							result = searchClasspathEntries(fragment, id, typeName);
150
							if (result != null) {
151
								return result;
152
							}
153
						}
154
155
					}
156
				}
157
			}
158
		}
159
		return null;
160
	}
161
162
	private Object searchClasspathEntries(IJavaObject entriesOwner, String id, String typeName) throws CoreException {
163
		IJavaObject cpeArray = getObject(entriesOwner, "entries", false); //$NON-NLS-1$
164
		if (cpeArray instanceof IJavaArray) {
165
			IJavaArray entries = (IJavaArray) cpeArray;
166
			for (int i = 0; i < entries.getLength(); i++) {
167
				IJavaObject entry = (IJavaObject) entries.getValue(i);
168
				if (!entry.isNull()) {
169
					IJavaObject baseData = getObject(entry, "data", false); //$NON-NLS-1$
170
					if (baseData != null && !baseData.isNull()) {
171
						IJavaObject fileName = getObject(baseData, "fileName", false); //$NON-NLS-1$
172
						if (fileName != null && !fileName.isNull()) {
173
							String location = fileName.getValueString();
174
							Object el = getSourceElement(location, id, typeName);
175
							if (el != null) {
176
								return el;
177
							}
178
						}
179
					}
180
				}
181
			}
182
		}
183
		return null;
184
	}
185
186
	private IJavaObject getObject(IJavaObject object, String field, boolean superfield) throws DebugException {
187
		IJavaFieldVariable variable = object.getField(field, superfield);
188
		if (variable != null) {
189
			IValue value = variable.getValue();
190
			if (value instanceof IJavaObject)
191
				return (IJavaObject) value;
192
		}
193
		return null;
194
	}
195
196
	private Object findSourceElement_legacy(IJavaObject object, String typeName) throws CoreException {
197
		IJavaObject hostdata = getObject(object, "hostdata", true); //$NON-NLS-1$
198
		if (hostdata != null) {
199
			String location = getValue(hostdata, "fileName"); //$NON-NLS-1$
200
			String id = getValue(hostdata, "symbolicName"); //$NON-NLS-1$
201
			return getSourceElement(location, id, typeName);
202
		}
203
		return null;
204
	}
205
206
	private Object getSourceElement(String location, String id, String typeName) throws CoreException {
207
		if (location != null && id != null) {
208
			Object result = findSourceElement(getSourceContainers(location, id), typeName);
209
			if (result != null)
210
				return result;
211
212
			// don't give up yet, search fragments attached to this host
213
			State state = TargetPlatformHelper.getState();
214
			BundleDescription desc = state.getBundle(id, null);
215
			if (desc != null) {
216
				BundleDescription[] fragments = desc.getFragments();
217
				for (int i = 0; i < fragments.length; i++) {
218
					location = fragments[i].getLocation();
219
					id = fragments[i].getSymbolicName();
220
					result = findSourceElement(getSourceContainers(location, id), typeName);
221
					if (result != null)
222
						return result;
223
				}
224
			}
225
		}
226
		return null;
227
	}
228
229
	private Object findSourceElement(ISourceContainer[] containers, String typeName) throws CoreException {
230
		for (int i = 0; i < containers.length; i++) {
231
			Object[] result = containers[i].findSourceElements(typeName);
232
			if (result.length > 0)
233
				return result[0];
234
		}
235
		return null;
236
	}
237
238
	protected ISourceContainer[] getSourceContainers(String location, String id) throws CoreException {
239
		return fDirector.getSourceContainers(location, id);
240
	}
241
242
	/**
243
	 * Generates and returns a source file path based on a qualified type name.
244
	 * For example, when <code>java.lang.String</code> is provided,
245
	 * the returned source name is <code>java/lang/String.java</code>.
246
	 * 
247
	 * @param qualifiedTypeName fully qualified type name that may contain inner types
248
	 *  denoted with <code>$</code> character
249
	 * @return a source file path corresponding to the type name
250
	 */
251
	private static String generateSourceName(String qualifiedTypeName) {
252
		int index = qualifiedTypeName.indexOf('$');
253
		if (index >= 0)
254
			qualifiedTypeName = qualifiedTypeName.substring(0, index);
255
		return qualifiedTypeName.replace('.', File.separatorChar) + ".java"; //$NON-NLS-1$
256
	}
257
258
}
0
  + text/plain
259
  + text/plain
1
  + *
260
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/OSGiFrameworkManager.java (+143 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import org.eclipse.pde.launching.launcher.OSGiLaunchConfigurationInitializer;
14
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
15
16
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
17
18
import java.util.*;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
21
import org.eclipse.pde.internal.core.PDEPreferencesManager;
22
23
public class OSGiFrameworkManager implements IRegistryChangeListener {
24
25
	public static final String POINT_ID = "org.eclipse.pde.ui.osgiFrameworks"; //$NON-NLS-1$
26
	public static final String DEFAULT_FRAMEWORK = "org.eclipse.pde.ui.EquinoxFramework"; //$NON-NLS-1$
27
28
	public static final String ATT_ID = "id"; //$NON-NLS-1$
29
	public static final String ATT_NAME = "name"; //$NON-NLS-1$
30
	public static final String ATT_DELEGATE = "launcherDelegate"; //$NON-NLS-1$
31
	public static final String ATT_INITIALIZER = "initializer"; //$NON-NLS-1$
32
33
	public static final String ELEMENT_FRAMEWORK = "framework"; //$NON-NLS-1$
34
35
	private Map fFrameworks;
36
37
	public IConfigurationElement[] getFrameworks() {
38
		if (fFrameworks == null)
39
			loadElements();
40
		return (IConfigurationElement[]) fFrameworks.values().toArray(new IConfigurationElement[fFrameworks.size()]);
41
	}
42
43
	public IConfigurationElement[] getSortedFrameworks() {
44
		IConfigurationElement[] elements = getFrameworks();
45
		return orderElements(elements);
46
	}
47
48
	private void loadElements() {
49
		fFrameworks = new HashMap();
50
		IExtensionRegistry registry = Platform.getExtensionRegistry();
51
		IConfigurationElement[] elements = registry.getConfigurationElementsFor(POINT_ID);
52
		for (int i = 0; i < elements.length; i++) {
53
			String id = elements[i].getAttribute(ATT_ID);
54
			if (id == null || elements[i].getAttribute(ATT_NAME) == null || elements[i].getAttribute(ATT_DELEGATE) == null)
55
				continue;
56
			fFrameworks.put(id, elements[i]);
57
		}
58
	}
59
60
	private IConfigurationElement[] orderElements(IConfigurationElement[] elems) {
61
		Arrays.sort(elems, new Comparator() {
62
			public int compare(Object o1, Object o2) {
63
				String name1 = ((IConfigurationElement) o1).getAttribute(ATT_NAME);
64
				String name2 = ((IConfigurationElement) o2).getAttribute(ATT_NAME);
65
				if (name1 != null)
66
					return name1.compareToIgnoreCase(name2);
67
				return 1;
68
			}
69
		});
70
		return elems;
71
	}
72
73
	public void registryChanged(IRegistryChangeEvent event) {
74
		//TODO implement 
75
	}
76
77
	public String getDefaultFramework() {
78
		PDEPreferencesManager store = PDELaunchingPlugin.getDefault().getPreferenceManager();
79
		return store.getString(ILaunchingPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK);
80
	}
81
82
	public OSGiLaunchConfigurationInitializer getDefaultInitializer() {
83
		return getInitializer(getDefaultFramework());
84
	}
85
86
	public OSGiLaunchConfigurationInitializer getInitializer(String frameworkID) {
87
		if (fFrameworks == null)
88
			loadElements();
89
		if (fFrameworks.containsKey(frameworkID)) {
90
			try {
91
				IConfigurationElement element = (IConfigurationElement) fFrameworks.get(frameworkID);
92
				if (element.getAttribute(ATT_INITIALIZER) != null) {
93
					Object result = element.createExecutableExtension(ATT_INITIALIZER);
94
					if (result instanceof OSGiLaunchConfigurationInitializer)
95
						return (OSGiLaunchConfigurationInitializer) result;
96
				}
97
			} catch (CoreException e) {
98
			}
99
		}
100
		return new OSGiLaunchConfigurationInitializer();
101
	}
102
103
	public LaunchConfigurationDelegate getFrameworkLauncher(String frameworkID) {
104
		if (fFrameworks == null)
105
			loadElements();
106
		if (fFrameworks.containsKey(frameworkID)) {
107
			try {
108
				IConfigurationElement element = (IConfigurationElement) fFrameworks.get(frameworkID);
109
				Object result = element.createExecutableExtension(ATT_DELEGATE);
110
				if (result instanceof LaunchConfigurationDelegate)
111
					return (LaunchConfigurationDelegate) result;
112
			} catch (CoreException e) {
113
			}
114
		}
115
		return null;
116
	}
117
118
	public String getFrameworkName(String frameworkID) {
119
		if (fFrameworks == null)
120
			loadElements();
121
		if (fFrameworks.containsKey(frameworkID)) {
122
			IConfigurationElement element = (IConfigurationElement) fFrameworks.get(frameworkID);
123
			return element.getAttribute(ATT_NAME);
124
		}
125
		return null;
126
	}
127
128
	/**
129
	 * Returns the {@link IConfigurationElement} for the framework with the given ID
130
	 * or <code>null</code> if no element exists with that ID.
131
	 * @param frameworkId
132
	 * @return the {@link IConfigurationElement} for the framework with the given ID or <code>null</code>
133
	 * 
134
	 * @since 3.5
135
	 */
136
	public IConfigurationElement getFramework(String frameworkId) {
137
		if (fFrameworks == null) {
138
			loadElements();
139
		}
140
		return (IConfigurationElement) fFrameworks.get(frameworkId);
141
	}
142
143
}
0
  + text/plain
144
  + text/plain
1
  + *
145
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/PDELauncherUtils.java (+13 lines)
Line 0 Link Here
1
package org.eclipse.pde.internal.launching.launcher;
2
3
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
4
5
import org.eclipse.core.runtime.IStatus;
6
import org.eclipse.core.runtime.Status;
7
8
public class PDELauncherUtils {
9
10
	public static IStatus createErrorStatus(String message) {
11
		return new Status(IStatus.ERROR, PDELaunchingPlugin.getPluginId(), IStatus.OK, message, null);
12
	}
13
}
0
  + text/plain
14
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/ProductValidationOperation.java (+54 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 EclipseSource Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     EclipseSource Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import java.util.ArrayList;
14
import java.util.List;
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.jdt.launching.IVMInstall;
17
import org.eclipse.jdt.launching.JavaRuntime;
18
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
19
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
20
import org.eclipse.pde.core.plugin.IPluginModelBase;
21
22
public class ProductValidationOperation extends LaunchValidationOperation {
23
24
	private IPluginModelBase[] fModels;
25
26
	public ProductValidationOperation(IPluginModelBase[] models) {
27
		super(null);
28
		fModels = models;
29
	}
30
31
	protected IPluginModelBase[] getModels() throws CoreException {
32
		return fModels;
33
	}
34
35
	protected IExecutionEnvironment[] getMatchingEnvironments() throws CoreException {
36
		IVMInstall install = JavaRuntime.getDefaultVMInstall();
37
38
		IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
39
		IExecutionEnvironment[] envs = manager.getExecutionEnvironments();
40
		List result = new ArrayList(envs.length);
41
		for (int i = 0; i < envs.length; i++) {
42
			IExecutionEnvironment env = envs[i];
43
			IVMInstall[] compatible = env.getCompatibleVMs();
44
			for (int j = 0; j < compatible.length; j++) {
45
				if (compatible[j].equals(install)) {
46
					result.add(env);
47
					break;
48
				}
49
			}
50
		}
51
		return (IExecutionEnvironment[]) result.toArray(new IExecutionEnvironment[result.size()]);
52
	}
53
54
}
0
  + text/plain
55
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/PDEMigrationDelegate.java (+58 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2007, 2008 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
15
import org.eclipse.pde.internal.launching.IPDEConstants;
16
17
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.core.runtime.IPath;
19
import org.eclipse.debug.core.*;
20
import org.eclipse.jdt.launching.*;
21
22
public class PDEMigrationDelegate implements ILaunchConfigurationMigrationDelegate {
23
24
	public boolean isCandidate(ILaunchConfiguration candidate) throws CoreException {
25
		return !candidate.getAttribute(IPDEConstants.APPEND_ARGS_EXPLICITLY, false) || candidate.hasAttribute(IPDELauncherConstants.VMINSTALL);
26
	}
27
28
	public void migrate(ILaunchConfiguration candidate) throws CoreException {
29
		ILaunchConfigurationWorkingCopy wc = candidate.getWorkingCopy();
30
		migrate(wc);
31
		wc.doSave();
32
	}
33
34
	public void migrate(ILaunchConfigurationWorkingCopy candidate) throws CoreException {
35
		if (!candidate.getAttribute(IPDEConstants.APPEND_ARGS_EXPLICITLY, false)) {
36
			candidate.setAttribute(IPDEConstants.APPEND_ARGS_EXPLICITLY, true);
37
			String args = candidate.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
38
			StringBuffer buffer = new StringBuffer(LaunchArgumentsHelper.getInitialProgramArguments());
39
			if (args.length() > 0) {
40
				buffer.append(" "); //$NON-NLS-1$
41
				buffer.append(args);
42
			}
43
			candidate.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, buffer.toString());
44
		}
45
		if (candidate.hasAttribute(IPDELauncherConstants.VMINSTALL)) {
46
			String name = candidate.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null);
47
			if (name != null) {
48
				IVMInstall vm = VMHelper.getVMInstall(name);
49
				if (vm != null) {
50
					IPath path = JavaRuntime.newJREContainerPath(vm);
51
					candidate.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, path.toPortableString());
52
				}
53
			}
54
			candidate.removeAttribute(IPDELauncherConstants.VMINSTALL);
55
		}
56
	}
57
58
}
0
  + text/plain
59
  + text/plain
1
  + *
60
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/PDESourceLookupDirector.java (+242 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Code 9 Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching.launcher;
13
14
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
15
16
import java.io.File;
17
import java.util.*;
18
import org.eclipse.core.filesystem.URIUtil;
19
import org.eclipse.core.resources.*;
20
import org.eclipse.core.runtime.*;
21
import org.eclipse.debug.core.sourcelookup.*;
22
import org.eclipse.debug.core.sourcelookup.containers.*;
23
import org.eclipse.jdt.core.*;
24
import org.eclipse.jdt.debug.core.*;
25
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
26
import org.eclipse.jdt.launching.JavaRuntime;
27
import org.eclipse.jdt.launching.sourcelookup.containers.JavaSourceLookupParticipant;
28
import org.eclipse.pde.core.plugin.*;
29
import org.eclipse.pde.internal.core.PDEClasspathContainer;
30
import org.eclipse.pde.internal.core.TargetPlatformHelper;
31
32
public class PDESourceLookupDirector extends AbstractSourceLookupDirector {
33
34
	/**
35
	 * Cache of source containers by location and id (String & String)
36
	 */
37
	private Map fSourceContainerMap = new HashMap();
38
39
	private static Set fFilteredTypes;
40
41
	static {
42
		fFilteredTypes = new HashSet(3);
43
		fFilteredTypes.add(ProjectSourceContainer.TYPE_ID);
44
		fFilteredTypes.add(WorkspaceSourceContainer.TYPE_ID);
45
		fFilteredTypes.add("org.eclipse.debug.ui.containerType.workingSet"); //$NON-NLS-1$
46
	}
47
48
	/**
49
	 * Lazily initialized.
50
	 */
51
	private double fOSGiRuntimeVersion = Double.MIN_VALUE;
52
53
	/* (non-Javadoc)
54
	 * @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector#initializeParticipants()
55
	 */
56
	public void initializeParticipants() {
57
		addParticipants(new ISourceLookupParticipant[] {new JavaSourceLookupParticipant()});
58
	}
59
60
	/* (non-Javadoc)
61
	 * @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector#supportsSourceContainerType(org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType)
62
	 */
63
	public boolean supportsSourceContainerType(ISourceContainerType type) {
64
		return !fFilteredTypes.contains(type.getId());
65
	}
66
67
	/* (non-Javadoc)
68
	 * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#getSourceElement(java.lang.Object)
69
	 */
70
	public Object getSourceElement(Object element) {
71
		PDESourceLookupQuery query = new PDESourceLookupQuery(this, element);
72
		SafeRunner.run(query);
73
		Object result = query.getResult();
74
		return result != null ? result : super.getSourceElement(element);
75
	}
76
77
	/* (non-Javadoc)
78
	 * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#findSourceElements(java.lang.Object)
79
	 */
80
	public Object[] findSourceElements(Object object) throws CoreException {
81
		Object[] sourceElements = null;
82
		if (object instanceof IJavaStackFrame || object instanceof IJavaObject || object instanceof IJavaReferenceType) {
83
			sourceElements = new Object[] {getSourceElement(object)};
84
		}
85
		if (sourceElements == null) {
86
			sourceElements = super.findSourceElements(object);
87
		}
88
		return sourceElements;
89
	}
90
91
	ISourceContainer[] getSourceContainers(String location, String id) throws CoreException {
92
93
		ISourceContainer[] containers = (ISourceContainer[]) fSourceContainerMap.get(location);
94
		if (containers != null) {
95
			return containers;
96
		}
97
98
		ArrayList result = new ArrayList();
99
		ModelEntry entry = PluginRegistry.findEntry(id);
100
101
		boolean match = false;
102
103
		IPluginModelBase[] models = entry.getWorkspaceModels();
104
		for (int i = 0; i < models.length; i++) {
105
			if (isPerfectMatch(models[i], new Path(location))) {
106
				IResource resource = models[i].getUnderlyingResource();
107
				// if the plug-in matches a workspace model,
108
				// add the project and any libraries not coming via a container
109
				// to the list of source containers, in that order
110
				if (resource != null) {
111
					addProjectSourceContainers(resource.getProject(), result);
112
				}
113
				match = true;
114
				break;
115
			}
116
		}
117
118
		if (!match) {
119
			File file = new File(location);
120
			if (file.isFile()) {
121
				// in case of linked plug-in projects that map to an external JARd plug-in,
122
				// use source container that maps to the library in the linked project.
123
				ISourceContainer container = getArchiveSourceContainer(location);
124
				if (container != null) {
125
					containers = new ISourceContainer[] {container};
126
					fSourceContainerMap.put(location, containers);
127
					return containers;
128
				}
129
			}
130
131
			models = entry.getExternalModels();
132
			for (int i = 0; i < models.length; i++) {
133
				if (isPerfectMatch(models[i], new Path(location))) {
134
					// try all source zips found in the source code locations
135
					IClasspathEntry[] entries = PDEClasspathContainer.getExternalEntries(models[i]);
136
					for (int j = 0; j < entries.length; j++) {
137
						IRuntimeClasspathEntry rte = convertClasspathEntry(entries[j]);
138
						if (rte != null)
139
							result.add(rte);
140
					}
141
					break;
142
				}
143
			}
144
		}
145
146
		IRuntimeClasspathEntry[] entries = (IRuntimeClasspathEntry[]) result.toArray(new IRuntimeClasspathEntry[result.size()]);
147
		containers = JavaRuntime.getSourceContainers(entries);
148
		fSourceContainerMap.put(location, containers);
149
		return containers;
150
	}
151
152
	private boolean isPerfectMatch(IPluginModelBase model, IPath path) {
153
		return model == null ? false : path.equals(new Path(model.getInstallLocation()));
154
	}
155
156
	private IRuntimeClasspathEntry convertClasspathEntry(IClasspathEntry entry) {
157
		if (entry == null)
158
			return null;
159
160
		IPath srcPath = entry.getSourceAttachmentPath();
161
		if (srcPath != null && srcPath.segmentCount() > 0) {
162
			IRuntimeClasspathEntry rte = JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath());
163
			rte.setSourceAttachmentPath(srcPath);
164
			rte.setSourceAttachmentRootPath(entry.getSourceAttachmentRootPath());
165
			return rte;
166
		}
167
		return null;
168
	}
169
170
	private ISourceContainer getArchiveSourceContainer(String location) throws JavaModelException {
171
		IWorkspaceRoot root = PDELaunchingPlugin.getWorkspace().getRoot();
172
		IFile[] containers = root.findFilesForLocationURI(URIUtil.toURI(location));
173
		for (int i = 0; i < containers.length; i++) {
174
			IJavaElement element = JavaCore.create(containers[i]);
175
			if (element instanceof IPackageFragmentRoot) {
176
				IPackageFragmentRoot archive = (IPackageFragmentRoot) element;
177
				IPath path = archive.getSourceAttachmentPath();
178
				if (path == null || path.segmentCount() == 0)
179
					continue;
180
181
				IPath rootPath = archive.getSourceAttachmentRootPath();
182
				boolean detectRootPath = rootPath != null && rootPath.segmentCount() > 0;
183
184
				IFile archiveFile = root.getFile(path);
185
				if (archiveFile.exists())
186
					return new ArchiveSourceContainer(archiveFile, detectRootPath);
187
188
				File file = path.toFile();
189
				if (file.exists())
190
					return new ExternalArchiveSourceContainer(file.getAbsolutePath(), detectRootPath);
191
			}
192
		}
193
		return null;
194
	}
195
196
	private void addProjectSourceContainers(IProject project, ArrayList result) throws CoreException {
197
		if (project == null || !project.hasNature(JavaCore.NATURE_ID))
198
			return;
199
200
		IJavaProject jProject = JavaCore.create(project);
201
		result.add(JavaRuntime.newProjectRuntimeClasspathEntry(jProject));
202
203
		IClasspathEntry[] entries = jProject.getRawClasspath();
204
		for (int i = 0; i < entries.length; i++) {
205
			IClasspathEntry entry = entries[i];
206
			if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
207
				IRuntimeClasspathEntry rte = convertClasspathEntry(entry);
208
				if (rte != null)
209
					result.add(rte);
210
			}
211
		}
212
	}
213
214
	/* (non-Javadoc)
215
	 * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#dispose()
216
	 */
217
	public synchronized void dispose() {
218
		Iterator iterator = fSourceContainerMap.values().iterator();
219
		while (iterator.hasNext()) {
220
			ISourceContainer[] containers = (ISourceContainer[]) iterator.next();
221
			for (int i = 0; i < containers.length; i++) {
222
				containers[i].dispose();
223
			}
224
		}
225
		fSourceContainerMap.clear();
226
		super.dispose();
227
	}
228
229
	/**
230
	 * Returns the version of the OSGi runtime being debugged, based on the target platform.
231
	 * Cached per source lookup director.
232
	 * 
233
	 * @return OSGi runtime version
234
	 */
235
	double getOSGiRuntimeVersion() {
236
		if (fOSGiRuntimeVersion == Double.MIN_VALUE) {
237
			fOSGiRuntimeVersion = TargetPlatformHelper.getTargetVersion();
238
		}
239
		return fOSGiRuntimeVersion;
240
	}
241
242
}
0
  + text/plain
243
  + text/plain
1
  + *
244
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/VMHelper.java (+100 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Les Jones <lesojones@gmail.com> - Bug 195433
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching.launcher;
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
16
import org.eclipse.pde.internal.launching.PDEMessages;
17
18
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IPath;
20
import org.eclipse.core.runtime.Path;
21
import org.eclipse.debug.core.ILaunchConfiguration;
22
import org.eclipse.jdt.core.IJavaProject;
23
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
24
import org.eclipse.jdt.launching.IVMInstall;
25
import org.eclipse.jdt.launching.JavaRuntime;
26
import org.eclipse.osgi.util.NLS;
27
import org.eclipse.pde.internal.core.util.VMUtil;
28
29
public class VMHelper {
30
31
	/**
32
	 * Get the default VMInstall name using the available info in the config,
33
	 * using the JavaProject if available.
34
	 * 
35
	 * @param configuration
36
	 *            Launch configuration to check
37
	 * @return name of the VMInstall
38
	 * @throws CoreException
39
	 *             thrown if there's a problem getting the VM name
40
	 */
41
	public static String getDefaultVMInstallName(ILaunchConfiguration configuration) throws CoreException {
42
		IJavaProject javaProject = JavaRuntime.getJavaProject(configuration);
43
		IVMInstall vmInstall = null;
44
		if (javaProject != null) {
45
			vmInstall = JavaRuntime.getVMInstall(javaProject);
46
		}
47
48
		if (vmInstall != null) {
49
			return vmInstall.getName();
50
		}
51
52
		return VMUtil.getDefaultVMInstallName();
53
	}
54
55
	public static IVMInstall getVMInstall(ILaunchConfiguration configuration) throws CoreException {
56
		String jre = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String) null);
57
		IVMInstall vm = null;
58
		if (jre == null) {
59
			String name = configuration.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null);
60
			if (name == null) {
61
				name = getDefaultVMInstallName(configuration);
62
			}
63
			vm = getVMInstall(name);
64
			if (vm == null) {
65
				throw new CoreException(PDELauncherUtils.createErrorStatus(NLS.bind(PDEMessages.WorkbenchLauncherConfigurationDelegate_noJRE, name)));
66
			}
67
		} else {
68
			IPath jrePath = Path.fromPortableString(jre);
69
			vm = JavaRuntime.getVMInstall(jrePath);
70
			if (vm == null) {
71
				String id = JavaRuntime.getExecutionEnvironmentId(jrePath);
72
				if (id == null) {
73
					String name = JavaRuntime.getVMInstallName(jrePath);
74
					throw new CoreException(PDELauncherUtils.createErrorStatus(NLS.bind(PDEMessages.WorkbenchLauncherConfigurationDelegate_noJRE, name)));
75
				}
76
				throw new CoreException(PDELauncherUtils.createErrorStatus(NLS.bind(PDEMessages.VMHelper_cannotFindExecEnv, id)));
77
			}
78
		}
79
		return vm;
80
	}
81
82
	public static IVMInstall getVMInstall(String name) {
83
		if (name != null) {
84
			IVMInstall[] installs = VMUtil.getAllVMInstances();
85
			for (int i = 0; i < installs.length; i++) {
86
				if (installs[i].getName().equals(name))
87
					return installs[i];
88
			}
89
		}
90
		return JavaRuntime.getDefaultVMInstall();
91
	}
92
93
	public static IVMInstall createLauncher(ILaunchConfiguration configuration) throws CoreException {
94
		IVMInstall launcher = getVMInstall(configuration);
95
		if (!launcher.getInstallLocation().exists())
96
			throw new CoreException(PDELauncherUtils.createErrorStatus(PDEMessages.WorkbenchLauncherConfigurationDelegate_jrePathNotFound));
97
		return launcher;
98
	}
99
100
}
0
  + text/plain
101
  + text/plain
1
  + *
102
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java (+334 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching.launcher;
13
14
import org.eclipse.pde.launching.launcher.*;
15
16
import org.eclipse.pde.internal.launching.IPDEConstants;
17
18
import java.io.*;
19
import java.net.MalformedURLException;
20
import java.net.URL;
21
import java.util.*;
22
import org.eclipse.core.resources.*;
23
import org.eclipse.core.runtime.*;
24
import org.eclipse.debug.core.ILaunchConfiguration;
25
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
26
import org.eclipse.jdt.core.*;
27
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
28
import org.eclipse.osgi.service.datalocation.Location;
29
import org.eclipse.pde.core.plugin.IPluginModelBase;
30
import org.eclipse.pde.core.plugin.PluginRegistry;
31
import org.eclipse.pde.internal.core.*;
32
import org.eclipse.pde.internal.core.util.CoreUtility;
33
import org.osgi.framework.*;
34
35
public class LauncherUtils implements ILauncherUtils {
36
37
	private static final String TIMESTAMP = "timestamp"; //$NON-NLS-1$
38
	private static final String FILE_NAME = "dep-timestamp.properties"; //$NON-NLS-1$
39
	private static Properties fLastRun;
40
41
	protected final ILauncherUtilsHelper helper;
42
43
	public LauncherUtils(ILauncherUtilsHelper helper) {
44
		this.helper = helper;
45
	}
46
47
	public boolean clearWorkspace(ILaunchConfiguration configuration, String workspace, IProgressMonitor monitor) throws CoreException {
48
49
		// If the workspace is not defined, there is no workspace to clear
50
		// What will happen is that the workspace chooser dialog will be 
51
		// brought up because no -data parameter will be specified on the 
52
		// launch
53
		if (workspace.length() == 0) {
54
			monitor.done();
55
			return true;
56
		}
57
58
		// Check if the workspace is already in use, if so, open a message and stop the launch before clearing
59
		boolean isLocked = false;
60
		try {
61
			BundleContext context = PDECore.getDefault().getBundleContext();
62
			ServiceReference[] references = context.getServiceReferences(Location.class.getName(), "(type=osgi.configuration.area)"); //$NON-NLS-1$
63
			if (references.length > 0) {
64
				Object service = context.getService(references[0]);
65
				if (service instanceof Location) {
66
					URL workspaceURL = new Path(workspace).toFile().toURI().toURL();
67
					Location targetLocation = ((Location) service).createLocation(null, workspaceURL, false);
68
					targetLocation.set(targetLocation.getDefault(), false);
69
					isLocked = targetLocation.isLocked();
70
				}
71
			}
72
		} catch (InvalidSyntaxException e) {
73
			PDECore.log(e);
74
			isLocked = false;
75
		} catch (MalformedURLException e) {
76
			PDECore.log(e);
77
			isLocked = false;
78
		} catch (IOException e) {
79
			PDECore.log(e);
80
			isLocked = false;
81
		}
82
83
		if (isLocked) {
84
			helper.handleWorkspaceLocked(workspace);
85
			monitor.done();
86
			return false;
87
		}
88
89
		File workspaceFile = new Path(workspace).toFile().getAbsoluteFile();
90
		if (configuration.getAttribute(IPDELauncherConstants.DOCLEAR, false) && workspaceFile.exists()) {
91
			if (configuration.getAttribute(IPDELauncherConstants.ASKCLEAR, true)) {
92
				int result;
93
				if (configuration.getAttribute(IPDEConstants.DOCLEARLOG, false)) {
94
					result = helper.doClearLog();
95
				} else {
96
					result = helper.doDeleteWorkspace(workspaceFile.getPath());
97
				}
98
99
				if (result == 2 /*Cancel Button*/|| result == -1 /*Dialog close button*/) {
100
					monitor.done();
101
					return false;
102
				} else if (result == 0) {
103
					if (configuration.getAttribute(IPDEConstants.DOCLEARLOG, false)) {
104
						clearWorkspaceLog(workspace);
105
					} else {
106
						CoreUtility.deleteContent(workspaceFile);
107
					}
108
				}
109
			} else if (configuration.getAttribute(IPDEConstants.DOCLEARLOG, false)) {
110
				clearWorkspaceLog(workspace);
111
			} else {
112
				CoreUtility.deleteContent(workspaceFile);
113
			}
114
		}
115
116
		monitor.done();
117
		return true;
118
	}
119
120
	public void validateProjectDependencies(ILaunchConfiguration launch, final IProgressMonitor monitor) {
121
		PDEPreferencesManager store = PDELaunchingPlugin.getDefault().getPreferenceManager();
122
		if (!store.getBoolean(org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants.PROP_AUTO_MANAGE))
123
			return;
124
125
		String timeStamp;
126
		boolean useDefault, autoAdd;
127
		try {
128
			timeStamp = launch.getAttribute(TIMESTAMP, "0"); //$NON-NLS-1$
129
			autoAdd = launch.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true);
130
			useDefault = launch.getAttribute(IPDELauncherConstants.USE_DEFAULT, true);
131
			useDefault |= launch.getAttribute(IPDELauncherConstants.USEFEATURES, false);
132
			final ArrayList projects = new ArrayList();
133
			if (useDefault)
134
				handleUseDefault(timeStamp, projects);
135
			else if (autoAdd)
136
				handleDeselectedPlugins(launch, timeStamp, projects);
137
			else
138
				handleSelectedPlugins(launch, timeStamp, projects);
139
140
			if (!projects.isEmpty())
141
				helper.organizeManifests(projects, monitor, getLastRun());
142
143
			ILaunchConfigurationWorkingCopy wc = null;
144
			if (launch.isWorkingCopy())
145
				wc = (ILaunchConfigurationWorkingCopy) launch;
146
			else
147
				wc = launch.getWorkingCopy();
148
			wc.setAttribute(TIMESTAMP, Long.toString(System.currentTimeMillis()));
149
			wc.doSave();
150
		} catch (CoreException e) {
151
		}
152
	}
153
154
	private String getTimeStamp(IProject project) {
155
		IJavaProject jp = JavaCore.create(project);
156
		try {
157
			long timeStamp = 0;
158
			IClasspathEntry[] entries = jp.getResolvedClasspath(true);
159
			for (int i = 0; i < entries.length; i++) {
160
				if (entries[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
161
					File file;
162
					IPath location = entries[i].getOutputLocation();
163
					if (location == null)
164
						location = jp.getOutputLocation();
165
					IResource res = project.getWorkspace().getRoot().findMember(location);
166
					IPath path = res == null ? null : res.getLocation();
167
					if (path == null)
168
						continue;
169
					file = path.toFile();
170
					Stack files = new Stack();
171
					files.push(file);
172
					while (!files.isEmpty()) {
173
						file = (File) files.pop();
174
						if (file.isDirectory()) {
175
							File[] children = file.listFiles();
176
							if (children != null) {
177
								for (int j = 0; j < children.length; j++)
178
									files.push(children[j]);
179
							}
180
						} else if (file.getName().endsWith(".class") && timeStamp < file.lastModified()) //$NON-NLS-1$
181
							timeStamp = file.lastModified();
182
					}
183
				}
184
			}
185
			String[] otherFiles = {ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR, ICoreConstants.BUILD_FILENAME_DESCRIPTOR};
186
			for (int i = 0; i < otherFiles.length; i++) {
187
				IResource file = project.getFile(otherFiles[i]);
188
				if (file != null) {
189
					long fileTimeStamp = file.getRawLocation().toFile().lastModified();
190
					if (timeStamp < fileTimeStamp)
191
						timeStamp = fileTimeStamp;
192
				}
193
			}
194
			return Long.toString(timeStamp);
195
		} catch (JavaModelException e) {
196
		}
197
		return "0"; //$NON-NLS-1$
198
	}
199
200
	private void handleUseDefault(String launcherTimeStamp, ArrayList projects) {
201
		IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects();
202
		for (int i = 0; i < projs.length; i++) {
203
			if (!WorkspaceModelManager.isPluginProject(projs[i]))
204
				continue;
205
			String timestamp = getTimeStamp(projs[i]);
206
			if (timestamp.compareTo(launcherTimeStamp) > 0 && shouldAdd(projs[i], launcherTimeStamp, timestamp))
207
				projects.add(projs[i]);
208
		}
209
	}
210
211
	private void handleSelectedPlugins(ILaunchConfiguration config, String timeStamp, ArrayList projects) throws CoreException {
212
		Map selectedPlugins = BundleLauncherHelper.getWorkspaceBundleMap(config, null, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS);
213
		Iterator it = selectedPlugins.keySet().iterator();
214
		while (it.hasNext()) {
215
			IPluginModelBase model = (IPluginModelBase) it.next();
216
			IResource res = model.getUnderlyingResource();
217
			if (res != null) {
218
				IProject project = res.getProject();
219
				String projTimeStamp = getTimeStamp(project);
220
				if (projTimeStamp.compareTo(timeStamp) > 0 && shouldAdd(project, timeStamp, projTimeStamp))
221
					projects.add(project);
222
			}
223
		}
224
	}
225
226
	private void handleDeselectedPlugins(ILaunchConfiguration config, String launcherTimeStamp, ArrayList projects) throws CoreException {
227
		Map deSelectedPlugins = BundleLauncherHelper.getWorkspaceBundleMap(config, null, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS);
228
		IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects();
229
		for (int i = 0; i < projs.length; i++) {
230
			if (!WorkspaceModelManager.isPluginProject(projs[i]))
231
				continue;
232
			IPluginModelBase base = PluginRegistry.findModel(projs[i]);
233
			if (base == null || base != null && deSelectedPlugins.containsKey(base))
234
				continue;
235
			String timestamp = getTimeStamp(projs[i]);
236
			if (timestamp.compareTo(launcherTimeStamp) > 0 && shouldAdd(projs[i], launcherTimeStamp, timestamp))
237
				projects.add(projs[i]);
238
		}
239
	}
240
241
	public final void shutdown() {
242
		if (fLastRun == null)
243
			return;
244
		FileOutputStream stream = null;
245
		try {
246
			stream = new FileOutputStream(new File(getDirectory(), FILE_NAME));
247
			fLastRun.store(stream, "Cached timestamps"); //$NON-NLS-1$
248
			stream.flush();
249
			stream.close();
250
		} catch (IOException e) {
251
			PDECore.logException(e);
252
		} finally {
253
			try {
254
				if (stream != null)
255
					stream.close();
256
			} catch (IOException e1) {
257
			}
258
		}
259
	}
260
261
	private File getDirectory() {
262
		IPath path = PDECore.getDefault().getStateLocation().append(".cache"); //$NON-NLS-1$
263
		File directory = new File(path.toOSString());
264
		if (!directory.exists() || !directory.isDirectory())
265
			directory.mkdirs();
266
		return directory;
267
	}
268
269
	private Properties getLastRun() {
270
		if (fLastRun == null) {
271
			fLastRun = new Properties();
272
			FileInputStream fis = null;
273
			try {
274
				File file = new File(getDirectory(), FILE_NAME);
275
				if (file.exists()) {
276
					fis = new FileInputStream(file);
277
					fLastRun.load(fis);
278
					fis.close();
279
				}
280
			} catch (IOException e) {
281
				PDECore.logException(e);
282
			} finally {
283
				try {
284
					if (fis != null)
285
						fis.close();
286
				} catch (IOException e1) {
287
				}
288
			}
289
		}
290
		return fLastRun;
291
	}
292
293
	private boolean shouldAdd(IProject proj, String launcherTS, String fileSystemTS) {
294
		String projTS = (String) getLastRun().get(proj.getName());
295
		if (projTS == null)
296
			return true;
297
		return ((projTS.compareTo(launcherTS) < 0) || (projTS.compareTo(fileSystemTS) < 0));
298
	}
299
300
	public boolean requiresUI(ILaunchConfiguration configuration) {
301
		try {
302
			String projectID = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
303
			if (projectID.length() > 0) {
304
				IResource project = PDELaunchingPlugin.getWorkspace().getRoot().findMember(projectID);
305
				if (project instanceof IProject) {
306
					IPluginModelBase model = PluginRegistry.findModel((IProject) project);
307
					if (model != null) {
308
						Set plugins = DependencyManager.getSelfAndDependencies(model);
309
						return plugins.contains("org.eclipse.swt"); //$NON-NLS-1$
310
					}
311
				}
312
			}
313
		} catch (CoreException e) {
314
		}
315
		return true;
316
	}
317
318
	public boolean clearWorkspaceLog(String workspace) {
319
		File logFile = new File(workspace, ".metadata" + File.separator + ".log"); //$NON-NLS-1$ //$NON-NLS-2$
320
		if (logFile != null && logFile.exists()) {
321
			return logFile.delete();
322
		}
323
		return true;
324
	}
325
326
	public IStatus createErrorStatus(String message) {
327
		return new Status(IStatus.ERROR, PDELaunchingPlugin.getPluginId(), IStatus.OK, message, null);
328
	}
329
330
	public boolean generateConfigIni() {
331
		return helper.generateConfigIni();
332
	}
333
334
}
0
  + text/plain
335
  + text/plain
1
  + *
336
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/HeadlessPDELauncherSettings.java (+75 lines)
Line 0 Link Here
1
package org.eclipse.pde.internal.launching.launcher;
2
3
import org.eclipse.pde.launching.launcher.*;
4
5
import org.eclipse.pde.internal.launching.PDEMessages;
6
7
import java.util.ArrayList;
8
import java.util.Properties;
9
10
import org.eclipse.core.runtime.CoreException;
11
import org.eclipse.core.runtime.IProgressMonitor;
12
import org.eclipse.debug.core.ILaunch;
13
import org.eclipse.osgi.util.NLS;
14
15
public class HeadlessPDELauncherSettings implements IPDELauncherSettings, IEclipsePluginValidationOperationHelper, IPDELaunchListener, ILauncherUtilsHelper, IPDELaunchConfigurationHelper {
16
17
	private ILauncherUtils launcherUtils = new LauncherUtils(this);
18
19
	public IEclipsePluginValidationOperationHelper getEclipsePluginValidationOperationHelper() {
20
		return this;
21
	}
22
23
	public IPDELaunchListener getLaunchListener() {
24
		return this;
25
	}
26
27
	public ILauncherUtils getLauncherUtils() {
28
		return launcherUtils;
29
	}
30
31
	public IPDELaunchConfigurationHelper getPDELaunchConfigurationHelper() {
32
		return this;
33
	}
34
35
	public Object createExtensionError(String bundleID) {
36
		return bundleID;
37
	}
38
39
	public String getAttribute(String configType) {
40
		return configType.equals("org.eclipse.pde.ui.RuntimeWorkbench") ? IPDELauncherConstants.APPLICATION : IPDELauncherConstants.APP_TO_TEST;
41
	}
42
43
	public void manage(ILaunch launch) {
44
		// noop
45
	}
46
47
	public int doClearLog() {
48
		return 0;
49
	}
50
51
	public int doDeleteWorkspace(String path) {
52
		return 0;
53
	}
54
55
	public boolean generateConfigIni() {
56
		return true;
57
	}
58
59
	public void handleWorkspaceLocked(String workspace) {
60
		PDELaunchingPlugin.logErrorMessage(NLS.bind(PDEMessages.LauncherUtils_cannotLaunchApplication, workspace));
61
	}
62
63
	public void organizeManifests(ArrayList projects, IProgressMonitor monitor,
64
			Properties lastRun) {
65
		// noop
66
	}
67
68
	public void handleCoreException(CoreException e) {
69
		PDELaunchingPlugin.log(e);
70
	}
71
72
	public void shutdown() {
73
	}
74
75
}
0
  + text/plain
76
  + text/plain
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/BundleLauncherHelper.java (+324 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching.launcher;
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
16
import org.eclipse.pde.internal.launching.IPDEConstants;
17
18
import java.util.ArrayList;
19
import java.util.HashMap;
20
import java.util.HashSet;
21
import java.util.Map;
22
import java.util.Set;
23
import java.util.StringTokenizer;
24
25
import org.eclipse.core.runtime.CoreException;
26
import org.eclipse.debug.core.ILaunchConfiguration;
27
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
28
import org.eclipse.osgi.service.resolver.BundleDescription;
29
import org.eclipse.pde.core.plugin.IPluginBase;
30
import org.eclipse.pde.core.plugin.IPluginModelBase;
31
import org.eclipse.pde.core.plugin.ModelEntry;
32
import org.eclipse.pde.core.plugin.PluginRegistry;
33
import org.eclipse.pde.internal.build.IPDEBuildConstants;
34
import org.eclipse.pde.internal.core.TargetPlatformHelper;
35
36
public class BundleLauncherHelper {
37
38
	public static final char VERSION_SEPARATOR = '*';
39
40
	public static Map getWorkspaceBundleMap(ILaunchConfiguration configuration) throws CoreException {
41
		return getWorkspaceBundleMap(configuration, null, IPDELauncherConstants.WORKSPACE_BUNDLES);
42
	}
43
44
	public static Map getTargetBundleMap(ILaunchConfiguration configuration) throws CoreException {
45
		return getTargetBundleMap(configuration, null, IPDELauncherConstants.TARGET_BUNDLES);
46
	}
47
48
	public static Map getMergedBundleMap(ILaunchConfiguration configuration, boolean osgi) throws CoreException {
49
		Set set = new HashSet();
50
		Map map = new HashMap();
51
52
		// if we are using the eclipse-based launcher, we need special checks
53
		if (!osgi) {
54
55
			checkBackwardCompatibility(configuration, true);
56
57
			if (configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true)) {
58
				IPluginModelBase[] models = PluginRegistry.getActiveModels();
59
				for (int i = 0; i < models.length; i++) {
60
					addBundleToMap(map, models[i], "default:default"); //$NON-NLS-1$
61
				}
62
				return map;
63
			}
64
65
			if (configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false)) {
66
				IPluginModelBase[] models = PluginRegistry.getWorkspaceModels();
67
				for (int i = 0; i < models.length; i++) {
68
					addBundleToMap(map, models[i], "default:default"); //$NON-NLS-1$
69
				}
70
				return map;
71
			}
72
		}
73
74
		String workspace = osgi == false ? IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS : IPDELauncherConstants.WORKSPACE_BUNDLES;
75
		String target = osgi == false ? IPDELauncherConstants.SELECTED_TARGET_PLUGINS : IPDELauncherConstants.TARGET_BUNDLES;
76
		map = getWorkspaceBundleMap(configuration, set, workspace);
77
		map.putAll(getTargetBundleMap(configuration, set, target));
78
		return map;
79
	}
80
81
	public static IPluginModelBase[] getMergedBundles(ILaunchConfiguration configuration, boolean osgi) throws CoreException {
82
		Map map = getMergedBundleMap(configuration, osgi);
83
		return (IPluginModelBase[]) map.keySet().toArray(new IPluginModelBase[map.size()]);
84
	}
85
86
	public static Map getWorkspaceBundleMap(ILaunchConfiguration configuration, Set set, String attribute) throws CoreException {
87
		String selected = configuration.getAttribute(attribute, ""); //$NON-NLS-1$
88
		Map map = new HashMap();
89
		StringTokenizer tok = new StringTokenizer(selected, ","); //$NON-NLS-1$
90
		while (tok.hasMoreTokens()) {
91
			String token = tok.nextToken();
92
			int index = token.indexOf('@');
93
			if (index < 0) { // if no start levels, assume default
94
				token = token.concat("@default:default"); //$NON-NLS-1$
95
				index = token.indexOf('@');
96
			}
97
			String idVersion = token.substring(0, index);
98
			int versionIndex = idVersion.indexOf(VERSION_SEPARATOR);
99
			String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion;
100
			String version = (versionIndex > 0) ? idVersion.substring(versionIndex + 1) : null;
101
			if (set != null)
102
				set.add(id);
103
			ModelEntry entry = PluginRegistry.findEntry(id);
104
			if (entry != null) {
105
				IPluginModelBase[] models = entry.getWorkspaceModels();
106
				for (int i = 0; i < models.length; i++) {
107
					IPluginBase base = models[i].getPluginBase();
108
109
					// match only if...
110
					// a) if we have the same version
111
					// b) no version
112
					// c) all else fails, if there's just one bundle available, use it
113
					if (base.getVersion().equals(version) || version == null || models.length == 1)
114
						addBundleToMap(map, models[i], token.substring(index + 1));
115
				}
116
			}
117
		}
118
119
		if (configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true)) {
120
			Set deselectedPlugins = LaunchPluginValidator.parsePlugins(configuration, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS);
121
			IPluginModelBase[] models = PluginRegistry.getWorkspaceModels();
122
			for (int i = 0; i < models.length; i++) {
123
				String id = models[i].getPluginBase().getId();
124
				if (id == null)
125
					continue;
126
				if (!deselectedPlugins.contains(models[i])) {
127
					if (set != null)
128
						set.add(id);
129
					if (!map.containsKey(models[i]))
130
						addBundleToMap(map, models[i], "default:default"); //$NON-NLS-1$
131
				}
132
			}
133
		}
134
		return map;
135
	}
136
137
	/**
138
	 * Adds the given bundle and start information to the map.  This will override anything set
139
	 * for system bundles, and set their start level to the appropriate level
140
	 * @param map The map to add the bundles too
141
	 * @param bundle The bundle to add
142
	 * @param substring the start information in the form level:autostart
143
	 */
144
	private static void addBundleToMap(Map map, IPluginModelBase bundle, String sl) {
145
		BundleDescription desc = bundle.getBundleDescription();
146
		boolean defaultsl = (sl == null || sl.equals("default:default")); //$NON-NLS-1$
147
		if (desc != null && defaultsl) {
148
			String modelName = desc.getSymbolicName();
149
			if (IPDEBuildConstants.BUNDLE_DS.equals(modelName)) {
150
				map.put(bundle, "1:true"); //$NON-NLS-1$ 
151
			} else if (IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR.equals(modelName)) {
152
				map.put(bundle, "1:true"); //$NON-NLS-1$
153
			} else if (IPDEBuildConstants.BUNDLE_EQUINOX_COMMON.equals(modelName)) {
154
				map.put(bundle, "2:true"); //$NON-NLS-1$
155
			} else if (IPDEBuildConstants.BUNDLE_OSGI.equals(modelName)) {
156
				map.put(bundle, "-1:true"); //$NON-NLS-1$
157
			} else if (IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR.equals(modelName)) {
158
				map.put(bundle, "3:true"); //$NON-NLS-1$
159
			} else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(modelName)) {
160
				if (TargetPlatformHelper.getTargetVersion() > 3.1) {
161
					map.put(bundle, "default:true"); //$NON-NLS-1$
162
				} else {
163
					map.put(bundle, "2:true"); //$NON-NLS-1$
164
				}
165
			} else {
166
				map.put(bundle, sl);
167
			}
168
		} else {
169
			map.put(bundle, sl);
170
		}
171
172
	}
173
174
	public static Map getTargetBundleMap(ILaunchConfiguration configuration, Set set, String attribute) throws CoreException {
175
		String selected = configuration.getAttribute(attribute, ""); //$NON-NLS-1$
176
		Map map = new HashMap();
177
		StringTokenizer tok = new StringTokenizer(selected, ","); //$NON-NLS-1$
178
		while (tok.hasMoreTokens()) {
179
			String token = tok.nextToken();
180
			int index = token.indexOf('@');
181
			if (index < 0) { // if no start levels, assume default
182
				token = token.concat("@default:default"); //$NON-NLS-1$
183
				index = token.indexOf('@');
184
			}
185
			String idVersion = token.substring(0, index);
186
			int versionIndex = idVersion.indexOf(VERSION_SEPARATOR);
187
			String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion;
188
			String version = (versionIndex > 0) ? idVersion.substring(versionIndex + 1) : null;
189
			if (set != null && set.contains(id))
190
				continue;
191
			ModelEntry entry = PluginRegistry.findEntry(id);
192
			if (entry != null) {
193
				IPluginModelBase[] models = entry.getExternalModels();
194
				for (int i = 0; i < models.length; i++) {
195
					if (models[i].isEnabled()) {
196
						IPluginBase base = models[i].getPluginBase();
197
						// match only if...
198
						// a) if we have the same version
199
						// b) no version
200
						// c) all else fails, if there's just one bundle available, use it
201
						if (base.getVersion().equals(version) || version == null || models.length == 1)
202
							addBundleToMap(map, models[i], token.substring(index + 1));
203
					}
204
				}
205
			}
206
		}
207
		return map;
208
	}
209
210
	public static String writeBundleEntry(IPluginModelBase model, String startLevel, String autoStart) {
211
		IPluginBase base = model.getPluginBase();
212
		String id = base.getId();
213
		StringBuffer buffer = new StringBuffer(id);
214
215
		ModelEntry entry = PluginRegistry.findEntry(id);
216
		if (entry.getActiveModels().length > 1) {
217
			buffer.append(VERSION_SEPARATOR);
218
			buffer.append(model.getPluginBase().getVersion());
219
		}
220
221
		boolean hasStartLevel = (startLevel != null && startLevel.length() > 0);
222
		boolean hasAutoStart = (autoStart != null && autoStart.length() > 0);
223
224
		if (hasStartLevel || hasAutoStart)
225
			buffer.append('@');
226
		if (hasStartLevel)
227
			buffer.append(startLevel);
228
		if (hasStartLevel || hasAutoStart)
229
			buffer.append(':');
230
		if (hasAutoStart)
231
			buffer.append(autoStart);
232
		return buffer.toString();
233
	}
234
235
	public static void checkBackwardCompatibility(ILaunchConfiguration configuration, boolean save) throws CoreException {
236
		ILaunchConfigurationWorkingCopy wc = null;
237
		if (configuration.isWorkingCopy()) {
238
			wc = (ILaunchConfigurationWorkingCopy) configuration;
239
		} else {
240
			wc = configuration.getWorkingCopy();
241
		}
242
243
		String value = configuration.getAttribute("wsproject", (String) null); //$NON-NLS-1$
244
		if (value != null) {
245
			wc.setAttribute("wsproject", (String) null); //$NON-NLS-1$
246
			if (value.indexOf(';') != -1) {
247
				value = value.replace(';', ',');
248
			} else if (value.indexOf(':') != -1) {
249
				value = value.replace(':', ',');
250
			}
251
			value = (value.length() == 0 || value.equals(",")) //$NON-NLS-1$
252
			? null
253
					: value.substring(0, value.length() - 1);
254
255
			boolean automatic = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true);
256
			String attr = automatic ? IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS : IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS;
257
			wc.setAttribute(attr, value);
258
		}
259
260
		String value2 = configuration.getAttribute("extplugins", (String) null); //$NON-NLS-1$
261
		if (value2 != null) {
262
			wc.setAttribute("extplugins", (String) null); //$NON-NLS-1$
263
			if (value2.indexOf(';') != -1) {
264
				value2 = value2.replace(';', ',');
265
			} else if (value2.indexOf(':') != -1) {
266
				value2 = value2.replace(':', ',');
267
			}
268
			value2 = (value2.length() == 0 || value2.equals(",")) ? null : value2.substring(0, value2.length() - 1); //$NON-NLS-1$
269
			wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, value2);
270
		}
271
272
		String version = configuration.getAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, (String) null);
273
		boolean newApp = TargetPlatformHelper.usesNewApplicationModel();
274
		boolean upgrade = !"3.3".equals(version) && newApp; //$NON-NLS-1$
275
		if (!upgrade)
276
			upgrade = TargetPlatformHelper.getTargetVersion() >= 3.2 && version == null;
277
		if (upgrade) {
278
			wc.setAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, newApp ? "3.3" : "3.2a"); //$NON-NLS-1$ //$NON-NLS-2$
279
			boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true);
280
			boolean useFeatures = configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false);
281
			boolean automaticAdd = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true);
282
			if (!usedefault && !useFeatures) {
283
				ArrayList list = new ArrayList();
284
				if (version == null) {
285
					list.add("org.eclipse.core.contenttype"); //$NON-NLS-1$
286
					list.add("org.eclipse.core.jobs"); //$NON-NLS-1$
287
					list.add(IPDEBuildConstants.BUNDLE_EQUINOX_COMMON);
288
					list.add("org.eclipse.equinox.preferences"); //$NON-NLS-1$
289
					list.add("org.eclipse.equinox.registry"); //$NON-NLS-1$
290
					list.add("org.eclipse.core.runtime.compatibility.registry"); //$NON-NLS-1$
291
				}
292
				if (!"3.3".equals(version) && newApp) //$NON-NLS-1$
293
					list.add("org.eclipse.equinox.app"); //$NON-NLS-1$
294
				StringBuffer extensions = new StringBuffer(configuration.getAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, "")); //$NON-NLS-1$
295
				StringBuffer target = new StringBuffer(configuration.getAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, "")); //$NON-NLS-1$
296
				for (int i = 0; i < list.size(); i++) {
297
					String plugin = list.get(i).toString();
298
					IPluginModelBase model = PluginRegistry.findModel(plugin);
299
					if (model == null)
300
						continue;
301
					if (model.getUnderlyingResource() != null) {
302
						if (automaticAdd)
303
							continue;
304
						if (extensions.length() > 0)
305
							extensions.append(","); //$NON-NLS-1$
306
						extensions.append(plugin);
307
					} else {
308
						if (target.length() > 0)
309
							target.append(","); //$NON-NLS-1$
310
						target.append(plugin);
311
					}
312
				}
313
				if (extensions.length() > 0)
314
					wc.setAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, extensions.toString());
315
				if (target.length() > 0)
316
					wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, target.toString());
317
			}
318
		}
319
320
		if (save && (value != null || value2 != null || upgrade))
321
			wc.doSave();
322
	}
323
324
}
0
  + text/plain
325
  + text/plain
1
  + *
326
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/EquinoxInitializer.java (+136 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching.launcher;
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
import org.eclipse.pde.launching.launcher.OSGiLaunchConfigurationInitializer;
15
16
import org.eclipse.pde.internal.launching.IPDEConstants;
17
18
import java.util.*;
19
20
import org.eclipse.pde.internal.core.ICoreConstants;
21
import org.eclipse.pde.internal.core.PDECore;
22
import org.eclipse.pde.internal.core.PDEPreferencesManager;
23
import org.eclipse.pde.internal.core.TargetPlatformHelper;
24
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
25
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
26
27
public class EquinoxInitializer extends OSGiLaunchConfigurationInitializer {
28
29
	private Map fStartLevels;
30
31
	public void initialize(ILaunchConfigurationWorkingCopy configuration) {
32
		super.initialize(configuration);
33
		initializeProgramArguments(configuration);
34
		initializeVMArguments(configuration);
35
		initializeTracing(configuration);
36
	}
37
38
	private void initializeProgramArguments(ILaunchConfigurationWorkingCopy configuration) {
39
		StringBuffer buffer = new StringBuffer(LaunchArgumentsHelper.getInitialProgramArguments());
40
		if (buffer.length() > 0) {
41
			if (buffer.indexOf("-console") == -1) { //$NON-NLS-1$
42
				buffer.append(" -console"); //$NON-NLS-1$
43
			}
44
		} else {
45
			buffer.append("-console"); //$NON-NLS-1$
46
		}
47
		configuration.setAttribute(IPDEConstants.APPEND_ARGS_EXPLICITLY, true);
48
		configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, buffer.toString());
49
	}
50
51
	private void initializeVMArguments(ILaunchConfigurationWorkingCopy configuration) {
52
		configuration.setAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, "3.3"); //$NON-NLS-1$
53
		PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager();
54
		StringBuffer vmArgs = new StringBuffer(preferences.getString(ICoreConstants.VM_ARGS));
55
		if (vmArgs.indexOf("-Declipse.ignoreApp") == -1) { //$NON-NLS-1$
56
			if (vmArgs.length() > 0)
57
				vmArgs.append(" "); //$NON-NLS-1$
58
			vmArgs.append("-Declipse.ignoreApp=true"); //$NON-NLS-1$
59
		}
60
		if (vmArgs.indexOf("-Dosgi.noShutdown") == -1) { //$NON-NLS-1$
61
			vmArgs.append(" -Dosgi.noShutdown=true"); //$NON-NLS-1$
62
		}
63
		configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs.toString());
64
	}
65
66
	private void initializeTracing(ILaunchConfigurationWorkingCopy configuration) {
67
		configuration.setAttribute(IPDELauncherConstants.TRACING_CHECKED, IPDELauncherConstants.TRACING_NONE);
68
	}
69
70
	protected void initializeBundleState(ILaunchConfigurationWorkingCopy configuration) {
71
		initializeBundleState();
72
		super.initializeBundleState(configuration);
73
	}
74
75
	protected String getAutoStart(String bundleID) {
76
		if (fStartLevels.containsKey(bundleID)) {
77
			String value = fStartLevels.get(bundleID).toString();
78
			return value.substring(value.indexOf(":") + 1); //$NON-NLS-1$
79
		}
80
		return super.getAutoStart(bundleID);
81
	}
82
83
	protected String getStartLevel(String bundleID) {
84
		if (fStartLevels.containsKey(bundleID)) {
85
			String value = fStartLevels.get(bundleID).toString();
86
			return value.substring(0, value.indexOf(":")); //$NON-NLS-1$
87
		}
88
		return super.getStartLevel(bundleID);
89
	}
90
91
	private void initializeBundleState() {
92
		if (fStartLevels == null)
93
			fStartLevels = new HashMap();
94
		Properties props = TargetPlatformHelper.getConfigIniProperties();
95
		if (props != null) {
96
			String value = (String) props.get("osgi.bundles"); //$NON-NLS-1$
97
			if (value != null) {
98
				StringTokenizer tokenizer = new StringTokenizer(value, ","); //$NON-NLS-1$
99
				while (tokenizer.hasMoreTokens()) {
100
					String tokenValue = tokenizer.nextToken();
101
					int index = tokenValue.indexOf("@"); //$NON-NLS-1$
102
					if (index > 0) {
103
						String bundle = tokenValue.substring(0, index).trim();
104
						fStartLevels.put(bundle, getStartValue(tokenValue.substring(index)));
105
					}
106
				}
107
			}
108
		}
109
	}
110
111
	private String getStartValue(String value) {
112
		StringBuffer buffer = new StringBuffer(value);
113
		StringBuffer result = new StringBuffer(":"); //$NON-NLS-1$
114
115
		int index = value.indexOf("start"); //$NON-NLS-1$
116
		result.append(Boolean.toString(index != -1));
117
118
		if (index != -1)
119
			buffer.delete(index, index + 5);
120
121
		int colon = value.indexOf(':');
122
		if (colon != -1)
123
			buffer.deleteCharAt(colon);
124
125
		// delete the first char '@'
126
		buffer.deleteCharAt(0);
127
128
		try {
129
			result.insert(0, Integer.parseInt(buffer.toString().trim()));
130
		} catch (NumberFormatException e) {
131
			result.insert(0, DEFAULT);
132
		}
133
		return result.toString();
134
	}
135
136
}
0
  + text/plain
137
  + text/plain
1
  + *
138
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/OSGiValidationOperation.java (+28 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching.launcher;
13
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.pde.core.plugin.IPluginModelBase;
17
18
public class OSGiValidationOperation extends LaunchValidationOperation {
19
20
	public OSGiValidationOperation(ILaunchConfiguration configuration) {
21
		super(configuration);
22
	}
23
24
	protected IPluginModelBase[] getModels() throws CoreException {
25
		return BundleLauncherHelper.getMergedBundles(fLaunchConfiguration, true);
26
	}
27
28
}
0
  + text/plain
29
  + text/plain
1
  + *
30
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/PreferenceInitializer.java (+52 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 eXXcellent solutions gmbh and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Achim Demelt, eXXcellent solutions gmbh - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.launching;
12
13
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
14
15
import org.eclipse.pde.internal.launching.launcher.OSGiFrameworkManager;
16
17
import org.eclipse.core.runtime.preferences.*;
18
import org.osgi.service.prefs.BackingStoreException;
19
20
public class PreferenceInitializer extends AbstractPreferenceInitializer {
21
22
	/* (non-Javadoc)
23
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
24
	 */
25
	public void initializeDefaultPreferences() {
26
		IEclipsePreferences prefs = new DefaultScope().getNode(IPDEConstants.PLUGIN_ID);
27
		prefs.put(ILaunchingPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK, OSGiFrameworkManager.DEFAULT_FRAMEWORK);
28
29
		// copy over instance scope prefs from UI plugin
30
		IEclipsePreferences oldInstancePrefs = new InstanceScope().getNode(IPDEConstants.UI_PLUGIN_ID);
31
		IEclipsePreferences newInstancePrefs = new InstanceScope().getNode(IPDEConstants.PLUGIN_ID);
32
33
		String osgiFramework = oldInstancePrefs.get(ILaunchingPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK, null);
34
		if (osgiFramework != null) {
35
			newInstancePrefs.put(ILaunchingPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK, osgiFramework);
36
			oldInstancePrefs.remove(ILaunchingPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK);
37
		}
38
39
		String autoManage = oldInstancePrefs.get(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE, null);
40
		if (autoManage != null) {
41
			newInstancePrefs.put(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE, autoManage);
42
			oldInstancePrefs.remove(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE);
43
		}
44
45
		try {
46
			newInstancePrefs.flush();
47
			oldInstancePrefs.flush();
48
		} catch (BackingStoreException e) {
49
			PDELaunchingPlugin.log(e);
50
		}
51
	}
52
}
0
  + text/plain
53
  + text/plain
1
  + *
54
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/ILaunchingPreferenceConstants.java (+26 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching;
13
14
/**
15
 * Listing of constants used in PDE preferences for launching.
16
 * 
17
 * @noimplement This interface is not intended to be implemented by clients.
18
 */
19
public interface ILaunchingPreferenceConstants {
20
21
	// Main preference page	
22
	public static final String PROP_AUTO_MANAGE = "Preferences.MainPage.automanageDependencies"; //$NON-NLS-1$
23
24
	// OSGi Frameworks
25
	public static final String DEFAULT_OSGI_FRAMEOWRK = "Preference.default.osgi.framework"; //$NON-NLS-1$
26
}
0
  + text/plain
27
  + text/plain
1
  + *
28
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/IPDEConstants.java (+42 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.launching;
13
14
public interface IPDEConstants {
15
	String PLUGIN_ID = "org.eclipse.pde.launching"; //$NON-NLS-1$
16
	String UI_PLUGIN_ID = "org.eclipse.pde.ui"; //$NON-NLS-1$
17
18
	// JUnit application identifiers
19
	String LEGACY_UI_TEST_APPLICATION = "org.eclipse.pde.junit.runtime.legacytestapplication"; //$NON-NLS-1$
20
	String NON_UI_THREAD_APPLICATION = "org.eclipse.pde.junit.runtime.nonuithreadtestapplication"; //$NON-NLS-1$
21
	String UI_TEST_APPLICATION = "org.eclipse.pde.junit.runtime.uitestapplication"; //$NON-NLS-1$
22
	String CORE_TEST_APPLICATION = "org.eclipse.pde.junit.runtime.coretestapplication"; //$NON-NLS-1$
23
24
	/**
25
	 * Launch configuration attribute key.  The value is a boolean specifies
26
	 * whether the launch configuration is being restarted.  This does not need to 
27
	 * be promoted to IPDELauncherConstants since clients should not need to know 
28
	 * about restarts.  
29
	 */
30
	String RESTART = "restart"; //$NON-NLS-1$
31
	/**
32
	 * Launch configuration attribute key. The value is a boolean specifying
33
	 * whether the workspace log for an Eclipse application should be cleared
34
	 * prior to launching.
35
	 * 
36
	 * TODO, move to IPDELauncherConstants in 3.4
37
	 */
38
	String DOCLEARLOG = "clearwslog"; //$NON-NLS-1$
39
	String LAUNCHER_PDE_VERSION = "pde.version"; //$NON-NLS-1$
40
	String APPEND_ARGS_EXPLICITLY = "append.args"; //$NON-NLS-1$
41
42
}
0
  + text/plain
43
  + text/plain
1
  + *
44
  + *
(-)org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/pderesources.properties (+27 lines)
Line 0 Link Here
1
###############################################################################
2
# Copyright (c) 2000, 2009 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
10
#     Code 9 Corporation - on going enhancements and maintenance
11
###############################################################################
12
13
LauncherUtils_cannotLaunchApplication=Could not launch the application because the associated workspace is currently in use by another Eclipse application.\n\n{0}
14
15
WorkbenchLauncherConfigurationDelegate_noJRE = Cannot locate JRE definition: "{0}". Launch aborted.
16
WorkbenchLauncherConfigurationDelegate_jrePathNotFound = The installation path to the specified JRE could not be found.  Launch aborted.
17
WorkbenchLauncherConfigurationDelegate_badFeatureSetup = When in feature mode, plug-ins must be in the 'plugins' directory and features in 'features' directory in the workspace.
18
WorkbenchLauncherConfigurationDelegate_noStartup = Launching failed. Bootstrap code cannot be found.
19
JUnitLaunchConfiguration_error_notaplugin = Could not launch the JUnit plug-in tests because project ''{0}'' is not a plug-in project.
20
JUnitLaunchConfiguration_error_missingPlugin = Required plug-in ''{0}'' could not be found.
21
22
OSGiLaunchConfiguration_cannotFindLaunchConfiguration=Cannot find the {0} OSGi framework.
23
OSGiLaunchConfiguration_selected=selected
24
25
EquinoxLaunchConfiguration_oldTarget=The org.eclipse.osgi plug-in is missing from this configuration.
26
27
VMHelper_cannotFindExecEnv=Cannot locate Execution Environment definition: "{0}". Launch aborted.
0
  + text/plain
28
  + text/plain
1
  + *
29
  + *
(-)org.eclipse.pde.launching/plugin.properties (+32 lines)
Line 0 Link Here
1
###############################################################################
2
# Copyright (c) 2000, 2009 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
10
#	  Charlie Fats <charlie.fats@gmail.com> - bug 216303
11
###############################################################################
12
#
13
# PDE plugin.xml resources
14
#
15
name = PDE Launcher
16
provider-name = Eclipse.org
17
expoint.osgiLauncher.name = OSGi Launcher
18
19
PDELaunchDelegate.name=Eclipse Application Launcher
20
PDELaunchDelegate.description=The Eclipse Application launcher is used to run or debug a separate instance of an Eclipse application
21
OSGiLaunchDelegate.name=OSGi Framework Launcher
22
OSGiLaunchDelegate.description=The OSGi Framework launcher is used to launch an OSGi framework and run or debug OSGi bundles
23
JUnitPluginLaunchDelegate.name= JUnit Plugin Test Launcher
24
JUnitPluginLaunchDelegate.description=The JUnit Plugin Test launcher is used to run and debug test suites for plug-in projects
25
26
Equinox.shortcut.label = Equinox
27
launcher.junit.name = JUnit Plug-in Test
28
29
launchConfigurationType.name = Eclipse Application
30
launcher.framework.name = OSGi Framework
31
32
pde.sourcelocator = PDE Source Lookup Director
0
  + text/plain
33
  + text/plain
1
  + *
34
  + *
(-)org.eclipse.pde.launching/build.properties (+19 lines)
Line 0 Link Here
1
###############################################################################
2
# Copyright (c) 2003, 2006 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
10
###############################################################################
11
source.. = src/
12
output.. = bin/
13
bin.includes = META-INF/,\
14
               .,\
15
               plugin.xml,\
16
               plugin.properties,\
17
               about.html
18
src.includes = schema/,\
19
               about.html
0
  + text/plain
20
  + text/plain
(-)org.eclipse.pde.launching/plugin.xml (+68 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4
   <extension-point id="org.eclipse.pde.ui.osgiFrameworks" name="%expoint.osgiLauncher.name" schema="schema/osgiFrameworks.exsd"/>
5
6
    <extension point="org.eclipse.debug.core.sourceLocators">
7
   		<sourceLocator
8
   			id="org.eclipse.pde.ui.launcher.PDESourceLookupDirector"
9
   			class="org.eclipse.pde.internal.launching.launcher.PDESourceLookupDirector"
10
   			name="%pde.sourcelocator">
11
   		</sourceLocator>
12
   </extension>
13
   <extension
14
         point="org.eclipse.debug.core.launchConfigurationTypes">
15
      <launchConfigurationType
16
            delegate="org.eclipse.pde.launching.launcher.EclipseApplicationLaunchConfiguration"
17
            delegateDescription="%PDELaunchDelegate.description"
18
            delegateName="%PDELaunchDelegate.name"
19
            id="org.eclipse.pde.ui.RuntimeWorkbench"
20
            migrationDelegate="org.eclipse.pde.internal.launching.launcher.PDEMigrationDelegate"
21
            modes="run, debug"
22
            name="%launchConfigurationType.name"
23
            sourceLocatorId="org.eclipse.pde.ui.launcher.PDESourceLookupDirector"
24
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
25
      </launchConfigurationType>
26
      <launchConfigurationType
27
            delegate="org.eclipse.pde.launching.launcher.JUnitLaunchConfigurationDelegate"
28
            delegateDescription="%JUnitPluginLaunchDelegate.description"
29
            delegateName="%JUnitPluginLaunchDelegate.name"
30
            id="org.eclipse.pde.ui.JunitLaunchConfig"
31
            migrationDelegate="org.eclipse.pde.internal.launching.launcher.PDEMigrationDelegate"
32
            modes="run, debug"
33
            name="%launcher.junit.name"
34
            sourceLocatorId="org.eclipse.pde.ui.launcher.PDESourceLookupDirector"
35
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
36
      </launchConfigurationType>
37
      <launchConfigurationType
38
            delegate="org.eclipse.pde.launching.launcher.OSGiLaunchConfigurationDelegate"
39
            delegateDescription="%OSGiLaunchDelegate.description"
40
            delegateName="%OSGiLaunchDelegate.name"
41
            id="org.eclipse.pde.ui.EquinoxLauncher"
42
            migrationDelegate="org.eclipse.pde.internal.launching.launcher.OSGiMigrationDelegate"
43
            modes="run, debug"
44
            name="%launcher.framework.name"
45
            public="true"
46
            sourceLocatorId="org.eclipse.pde.ui.launcher.PDESourceLookupDirector"
47
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer"/>
48
   </extension>
49
	<extension
50
         point="org.eclipse.jdt.junit.junitLaunchConfigs">
51
      <launchConfigType
52
            configTypeID="org.eclipse.pde.ui.JunitLaunchConfig">
53
      </launchConfigType>
54
   </extension>
55
    <extension
56
         point="org.eclipse.pde.ui.osgiFrameworks">
57
      <framework
58
            launcherDelegate="org.eclipse.pde.launching.launcher.EquinoxLaunchConfiguration"
59
            id="org.eclipse.pde.ui.EquinoxFramework"
60
            name="%Equinox.shortcut.label" 
61
            initializer="org.eclipse.pde.internal.launching.launcher.EquinoxInitializer"/>
62
    </extension>
63
   <extension
64
         point="org.eclipse.core.runtime.preferences">
65
      <initializer class="org.eclipse.pde.internal.launching.PreferenceInitializer"/>
66
   </extension>
67
    
68
</plugin>
0
  + text/plain
69
  + text/plain
(-)org.eclipse.pde.launching/about.html (+28 lines)
Line 0 Link Here
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
6
<title>About</title>
7
</head>
8
<body lang="EN-US">
9
<h2>About This Content</h2>
10
 
11
<p>June 2, 2006</p>	
12
<h3>License</h3>
13
14
<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  Unless otherwise 
15
indicated below, the Content is provided to you under the terms and conditions of the
16
Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available 
17
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
18
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
19
20
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is 
21
being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
22
apply to your use of any object code in the Content.  Check the Redistributor's license that was 
23
provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
24
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
25
and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
26
27
</body>
28
</html>
0
  + text/plain
29
  + text/plain
1
  + *
30
  + *
(-)org.eclipse.pde.launching/.settings/org.eclipse.jdt.core.prefs (+344 lines)
Line 0 Link Here
1
#Wed Jan 09 12:08:04 CST 2008
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
4
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
5
org.eclipse.jdt.core.builder.invalidClasspath=abort
6
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
7
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
8
org.eclipse.jdt.core.circularClasspath=error
9
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
10
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
11
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
12
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
13
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
14
org.eclipse.jdt.core.compiler.compliance=1.4
15
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
16
org.eclipse.jdt.core.compiler.debug.localVariable=generate
17
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
18
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
19
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
20
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
21
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
22
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
23
org.eclipse.jdt.core.compiler.problem.deprecation=warning
24
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
25
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
26
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
27
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
28
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
29
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
30
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
31
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
32
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
33
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
34
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
35
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
36
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
37
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
38
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
39
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
40
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
41
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
42
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
43
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
44
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
45
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
46
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
47
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
48
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
49
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
50
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
51
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
52
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
53
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
54
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
55
org.eclipse.jdt.core.compiler.problem.nullReference=warning
56
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
57
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
58
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
59
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
60
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
61
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
62
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
63
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
64
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
65
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
66
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
67
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
68
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
69
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
70
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
71
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
72
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
73
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
74
org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
75
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
76
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
77
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
78
org.eclipse.jdt.core.compiler.problem.unusedImport=error
79
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
80
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
81
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
82
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
83
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
84
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
85
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
86
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
87
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
88
org.eclipse.jdt.core.compiler.source=1.3
89
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
90
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
91
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
92
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
93
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
94
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
95
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
96
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
97
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
98
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
99
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
100
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
101
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
102
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
103
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
104
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
105
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
106
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
107
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
108
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
109
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
110
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
111
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
112
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
113
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
114
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
115
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
116
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
117
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
118
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
119
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
120
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
121
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
122
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
123
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
124
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
125
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
126
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
127
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
128
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
129
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
130
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
131
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
132
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
133
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
134
org.eclipse.jdt.core.formatter.comment.format_block_comments=false
135
org.eclipse.jdt.core.formatter.comment.format_header=false
136
org.eclipse.jdt.core.formatter.comment.format_html=true
137
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
138
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
139
org.eclipse.jdt.core.formatter.comment.format_source_code=true
140
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
141
org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
142
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
143
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
144
org.eclipse.jdt.core.formatter.comment.line_length=80
145
org.eclipse.jdt.core.formatter.compact_else_if=true
146
org.eclipse.jdt.core.formatter.continuation_indentation=2
147
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
148
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
149
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
150
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
151
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
152
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
153
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
154
org.eclipse.jdt.core.formatter.indent_empty_lines=false
155
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
156
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
157
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
158
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
159
org.eclipse.jdt.core.formatter.indentation.size=4
160
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
161
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
162
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
163
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
164
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
165
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
166
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
167
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
168
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
169
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
170
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
171
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
172
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
173
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
174
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
175
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
176
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
177
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
178
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
179
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
180
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
181
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
182
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
183
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
184
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
185
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
186
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
187
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
188
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
189
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
190
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
191
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
192
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
193
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
194
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
195
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
196
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
197
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
198
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
199
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
200
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
201
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
202
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
203
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
204
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
205
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
206
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
207
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
208
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
209
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
210
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
211
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
212
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
213
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
214
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
215
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
216
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
217
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
218
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
219
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
220
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
221
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
222
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
223
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
224
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
225
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
226
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
227
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
228
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
229
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
230
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
231
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
232
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
233
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
234
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
235
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
236
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
237
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
238
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
239
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
240
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
241
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
242
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
243
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
244
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
245
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
246
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
247
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
248
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
249
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
250
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
251
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
252
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
253
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
254
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
255
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
256
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
257
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
258
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
259
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
260
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
261
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
262
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
263
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
264
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
265
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
266
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
267
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
268
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
269
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
270
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
271
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
272
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
273
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
274
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
275
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
276
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
277
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
278
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
279
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
280
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
281
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
282
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
283
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
284
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
285
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
286
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
287
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
288
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
289
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
290
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
291
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
292
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
293
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
294
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
295
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
296
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
297
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
298
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
299
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
300
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
301
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
302
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
303
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
304
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
305
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
306
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
307
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
308
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
309
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
310
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
311
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
312
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
313
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
314
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
315
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
316
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
317
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
318
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
319
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
320
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
321
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
322
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
323
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
324
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
325
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
326
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
327
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
328
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
329
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
330
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
331
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
332
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
333
org.eclipse.jdt.core.formatter.lineSplit=800
334
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
335
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
336
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
337
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
338
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
339
org.eclipse.jdt.core.formatter.tabulation.char=tab
340
org.eclipse.jdt.core.formatter.tabulation.size=4
341
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
342
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
343
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
344
org.eclipse.jdt.core.incompleteClasspath=error
0
  + text/plain
345
  + text/plain
1
  + *
346
  + *
(-)org.eclipse.pde.launching/.settings/org.eclipse.pde.prefs (+13 lines)
Line 0 Link Here
1
#Wed Mar 29 03:57:21 EST 2006
2
compilers.p.build=1
3
compilers.p.deprecated=1
4
compilers.p.no-required-att=0
5
compilers.p.not-externalized-att=1
6
compilers.p.unknown-attribute=1
7
compilers.p.unknown-class=1
8
compilers.p.unknown-element=1
9
compilers.p.unknown-resource=1
10
compilers.p.unresolved-ex-points=0
11
compilers.p.unresolved-import=0
12
compilers.use-project=true
13
eclipse.preferences.version=1
0
  + text/plain
14
  + text/plain
1
  + *
15
  + *
(-)org.eclipse.pde.launching/.settings/org.eclipse.jdt.ui.prefs (+59 lines)
Line 0 Link Here
1
#Sun Dec 23 21:49:35 CST 2007
2
eclipse.preferences.version=1
3
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
4
formatter_profile=_core
5
formatter_settings_version=11
6
org.eclipse.jdt.ui.ignorelowercasenames=true
7
org.eclipse.jdt.ui.importorder=;
8
org.eclipse.jdt.ui.ondemandthreshold=3
9
org.eclipse.jdt.ui.staticondemandthreshold=99
10
sp_cleanup.add_default_serial_version_id=true
11
sp_cleanup.add_generated_serial_version_id=false
12
sp_cleanup.add_missing_annotations=true
13
sp_cleanup.add_missing_deprecated_annotations=true
14
sp_cleanup.add_missing_methods=false
15
sp_cleanup.add_missing_nls_tags=false
16
sp_cleanup.add_missing_override_annotations=true
17
sp_cleanup.add_serial_version_id=false
18
sp_cleanup.always_use_blocks=true
19
sp_cleanup.always_use_parentheses_in_expressions=false
20
sp_cleanup.always_use_this_for_non_static_field_access=false
21
sp_cleanup.always_use_this_for_non_static_method_access=false
22
sp_cleanup.convert_to_enhanced_for_loop=false
23
sp_cleanup.correct_indentation=false
24
sp_cleanup.format_source_code=true
25
sp_cleanup.format_source_code_changes_only=false
26
sp_cleanup.make_local_variable_final=false
27
sp_cleanup.make_parameters_final=false
28
sp_cleanup.make_private_fields_final=true
29
sp_cleanup.make_variable_declarations_final=true
30
sp_cleanup.never_use_blocks=false
31
sp_cleanup.never_use_parentheses_in_expressions=true
32
sp_cleanup.on_save_use_additional_actions=false
33
sp_cleanup.organize_imports=true
34
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
35
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
36
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
37
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
38
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
39
sp_cleanup.remove_private_constructors=true
40
sp_cleanup.remove_trailing_whitespaces=false
41
sp_cleanup.remove_trailing_whitespaces_all=true
42
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
43
sp_cleanup.remove_unnecessary_casts=true
44
sp_cleanup.remove_unnecessary_nls_tags=false
45
sp_cleanup.remove_unused_imports=false
46
sp_cleanup.remove_unused_local_variables=false
47
sp_cleanup.remove_unused_private_fields=true
48
sp_cleanup.remove_unused_private_members=false
49
sp_cleanup.remove_unused_private_methods=true
50
sp_cleanup.remove_unused_private_types=true
51
sp_cleanup.sort_members=false
52
sp_cleanup.sort_members_all=false
53
sp_cleanup.use_blocks=false
54
sp_cleanup.use_blocks_only_for_return_and_throw=false
55
sp_cleanup.use_parentheses_in_expressions=false
56
sp_cleanup.use_this_for_non_static_field_access=false
57
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
58
sp_cleanup.use_this_for_non_static_method_access=false
59
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
0
  + text/plain
60
  + text/plain
1
  + *
61
  + *
(-)org.eclipse.pde.launching/.settings/org.eclipse.pde.core.prefs (+3 lines)
Line 0 Link Here
1
#Wed Mar 29 00:38:44 EST 2006
2
eclipse.preferences.version=1
3
selfhosting.binExcludes=/org.eclipse.pde.core/binary
0
  + text/plain
4
  + text/plain
1
  + *
5
  + *
(-)org.eclipse.pde.launching/.settings/org.eclipse.core.resources.prefs (+7 lines)
Line 0 Link Here
1
#Fri Oct 20 13:22:13 EDT 2006
2
eclipse.preferences.version=1
3
encoding//core/framework/org/eclipse/osgi/framework/internal/core/default.permissions=UTF-8
4
encoding//core/framework/org/eclipse/osgi/framework/internal/core/implied.permissions=UTF-8
5
encoding//core/framework/org/eclipse/osgi/framework/internal/core/osname.aliases=UTF-8
6
encoding//core/framework/org/eclipse/osgi/framework/internal/core/processor.aliases=UTF-8
7
encoding/<project>=ISO-8859-1
0
  + text/plain
8
  + text/plain
1
  + *
9
  + *
(-)org.eclipse.pde.ui/META-INF/MANIFEST.MF (-2 / +3 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %name
3
Bundle-Name: %name
4
Bundle-SymbolicName: org.eclipse.pde.ui; singleton:=true
4
Bundle-SymbolicName: org.eclipse.pde.ui; singleton:=true
5
Bundle-Version: 3.5.100.qualifier
5
Bundle-Version: 3.6.0.qualifier
6
Bundle-Activator: org.eclipse.pde.internal.ui.PDEPlugin
6
Bundle-Activator: org.eclipse.pde.internal.ui.PDEPlugin
7
Bundle-Vendor: %provider-name
7
Bundle-Vendor: %provider-name
8
Bundle-Localization: plugin
8
Bundle-Localization: plugin
Lines 103-109 Link Here
103
 org.eclipse.equinox.p2.metadata.repository;bundle-version="[1.0.100,2.0.0)",
103
 org.eclipse.equinox.p2.metadata.repository;bundle-version="[1.0.100,2.0.0)",
104
 org.eclipse.equinox.frameworkadmin;bundle-version="[1.0.100,2.0.0)",
104
 org.eclipse.equinox.frameworkadmin;bundle-version="[1.0.100,2.0.0)",
105
 org.eclipse.equinox.frameworkadmin.equinox;bundle-version="[1.0.100,2.0.0)",
105
 org.eclipse.equinox.frameworkadmin.equinox;bundle-version="[1.0.100,2.0.0)",
106
 org.eclipse.equinox.p2.repository;bundle-version="[1.0.0,2.0.0)"
106
 org.eclipse.equinox.p2.repository;bundle-version="[1.0.0,2.0.0)",
107
 org.eclipse.pde.launching;bundle-version="[3.5.0,4.0.0)";visibility:=reexport
107
Eclipse-LazyStart: true
108
Eclipse-LazyStart: true
108
Import-Package: com.ibm.icu.text,
109
Import-Package: com.ibm.icu.text,
109
 org.eclipse.jdt.debug.core
110
 org.eclipse.jdt.debug.core
(-)org.eclipse.pde.ui/schema/osgiFrameworks.exsd (-159 lines)
Lines 1-159 Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.pde.ui">
4
<annotation>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.pde.ui" id="osgiFrameworks" name="OSGi Frameworks"/>
7
      </appInfo>
8
      <documentation>
9
         &lt;p&gt;
10
This extension point is used to register new OSGi frameworks. Each framework is associated with a launcher delegate that is called when the OSGi framework is selected in the &lt;b&gt;OSGi Framework&lt;/b&gt; launch configuration.
11
&lt;/p&gt;
12
&lt;p&gt;Registered OSGi frameworks appear on the &lt;b&gt;Plug-in Development &gt; OSGi frameworks&lt;/b&gt; preference page, where a default framework can be set.
13
&lt;/p&gt;
14
      </documentation>
15
   </annotation>
16
17
   <element name="extension">
18
      <complexType>
19
         <sequence>
20
            <element ref="framework" minOccurs="1" maxOccurs="unbounded"/>
21
         </sequence>
22
         <attribute name="point" type="string" use="required">
23
            <annotation>
24
               <documentation>
25
                  
26
               </documentation>
27
            </annotation>
28
         </attribute>
29
         <attribute name="id" type="string">
30
            <annotation>
31
               <documentation>
32
                  
33
               </documentation>
34
            </annotation>
35
         </attribute>
36
         <attribute name="name" type="string">
37
            <annotation>
38
               <documentation>
39
                  
40
               </documentation>
41
               <appInfo>
42
                  <meta.attribute translatable="true"/>
43
               </appInfo>
44
            </annotation>
45
         </attribute>
46
      </complexType>
47
   </element>
48
49
   <element name="framework">
50
      <complexType>
51
         <attribute name="id" type="string" use="required">
52
            <annotation>
53
               <documentation>
54
                  a unique identifier of the framework
55
               </documentation>
56
            </annotation>
57
         </attribute>
58
         <attribute name="name" type="string" use="required">
59
            <annotation>
60
               <documentation>
61
                  human-readable name of the OSGi framework
62
               </documentation>
63
               <appInfo>
64
                  <meta.attribute translatable="true"/>
65
               </appInfo>
66
            </annotation>
67
         </attribute>
68
         <attribute name="launcherDelegate" type="string" use="required">
69
            <annotation>
70
               <documentation>
71
                  a launch configuration delegate to launch the OSGi framework. The value of this attribute is the fully qualified name of the Java class that extends &lt;code&gt;org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration&lt;/code&gt;.
72
               </documentation>
73
               <appInfo>
74
                  <meta.attribute kind="java" basedOn="org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration"/>
75
               </appInfo>
76
            </annotation>
77
         </attribute>
78
         <attribute name="initializer" type="string">
79
            <annotation>
80
               <documentation>
81
                  initializes new OSGi Framework launch configurations with suitable defaults.  The value of this attribute must be a fully-qualified name of a Java class that extends the default implementation &lt;code&gt;org.eclipse.pde.ui.launcher.OSGiLaunchConfigurationInitializer&lt;/code&gt;.  If not specified, the default initializer &lt;code&gt;org.eclipse.pde.ui.launcher.OSGiLaunchConfigurationInitializer&lt;/code&gt; is instantiated.
82
               </documentation>
83
               <appInfo>
84
                  <meta.attribute kind="java" basedOn="org.eclipse.pde.ui.launcher.OSGiLaunchConfigurationInitializer"/>
85
               </appInfo>
86
            </annotation>
87
         </attribute>
88
      </complexType>
89
   </element>
90
91
   <annotation>
92
      <appInfo>
93
         <meta.section type="since"/>
94
      </appInfo>
95
      <documentation>
96
         3.3
97
      </documentation>
98
   </annotation>
99
100
   <annotation>
101
      <appInfo>
102
         <meta.section type="examples"/>
103
      </appInfo>
104
      <documentation>
105
         &lt;p&gt;
106
The following is an example of the extension point:
107
&lt;pre&gt;
108
   &lt;extension
109
         point=&quot;org.eclipse.pde.ui.osgiFrameworks&quot;&gt;
110
      &lt;framework
111
            launcherDelegate=&quot;org.eclipse.pde.ui.launcher.EquinoxLaunchConfiguration&quot;
112
            id=&quot;org.eclipse.pde.ui.EquinoxFramework&quot;
113
            name=&quot;%Equinox.shortcut.label&quot; 
114
            initializer=&quot;org.eclipse.pde.internal.ui.launcher.EquinoxInitializer&quot;/&gt;
115
   &lt;/extension&gt;
116
&lt;/pre&gt;
117
      </documentation>
118
   </annotation>
119
120
   <annotation>
121
      <appInfo>
122
         <meta.section type="apiInfo"/>
123
      </appInfo>
124
      <documentation>
125
         &lt;p&gt;
126
The value of the attribute &lt;code&gt;launcherDelegate&lt;/code&gt; must be a fully qualified name of a Java class that extends &lt;code&gt;org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration&lt;/code&gt;.  If the launcher is to provide its own source lookup order, then the method &lt;code&gt;setDefaultSourceLocator&lt;/code&gt; should be overridden.
127
&lt;/p&gt;
128
&lt;p&gt;
129
The value of the attribute &lt;code&gt;initializer&lt;/code&gt; must be a fully qualified name of a Java class that extends &lt;code&gt;org.eclipse.ui.launcher.OSGiLaunchConfigurationInitializer&lt;/code&gt;.
130
&lt;/p&gt;
131
      </documentation>
132
   </annotation>
133
134
   <annotation>
135
      <appInfo>
136
         <meta.section type="implementation"/>
137
      </appInfo>
138
      <documentation>
139
         &lt;p&gt;
140
PDE supplies the Equinox OSGi Framework extension to launch Equinox frameworks.
141
&lt;/p&gt;
142
      </documentation>
143
   </annotation>
144
145
   <annotation>
146
      <appInfo>
147
         <meta.section type="copyright"/>
148
      </appInfo>
149
      <documentation>
150
         Copyright (c) 2006 IBM Corporation and others.
151
&lt;br&gt;
152
All rights reserved. This program and the accompanying materials are made 
153
available under the terms of the Eclipse Public License v1.0 which 
154
accompanies this distribution, and is available at 
155
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;.
156
      </documentation>
157
   </annotation>
158
159
</schema>
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/ProductFromConfigOperation.java (-2 / +4 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.wizards.product;
12
package org.eclipse.pde.internal.ui.wizards.product;
13
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
16
import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper;
17
14
import java.util.*;
18
import java.util.*;
15
import org.eclipse.core.resources.IContainer;
19
import org.eclipse.core.resources.IContainer;
16
import org.eclipse.core.resources.IFile;
20
import org.eclipse.core.resources.IFile;
Lines 21-28 Link Here
21
import org.eclipse.pde.internal.core.iproduct.*;
25
import org.eclipse.pde.internal.core.iproduct.*;
22
import org.eclipse.pde.internal.core.iproduct.IProduct;
26
import org.eclipse.pde.internal.core.iproduct.IProduct;
23
import org.eclipse.pde.internal.ui.PDEPlugin;
27
import org.eclipse.pde.internal.ui.PDEPlugin;
24
import org.eclipse.pde.internal.ui.launcher.BundleLauncherHelper;
25
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
26
28
27
/**
29
/**
28
 * This operation generates a product configuration filling in fields based on information
30
 * This operation generates a product configuration filling in fields based on information
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/ProductFileWizardPage.java (-1 / +2 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.wizards.product;
12
package org.eclipse.pde.internal.ui.wizards.product;
13
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
14
import java.util.ArrayList;
16
import java.util.ArrayList;
15
import org.eclipse.core.resources.IProject;
17
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IResource;
18
import org.eclipse.core.resources.IResource;
Lines 24-30 Link Here
24
import org.eclipse.pde.internal.ui.*;
26
import org.eclipse.pde.internal.ui.*;
25
import org.eclipse.pde.internal.ui.wizards.PDEWizardNewFileCreationPage;
27
import org.eclipse.pde.internal.ui.wizards.PDEWizardNewFileCreationPage;
26
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
28
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
27
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
28
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.events.SelectionAdapter;
30
import org.eclipse.swt.events.SelectionAdapter;
30
import org.eclipse.swt.events.SelectionEvent;
31
import org.eclipse.swt.events.SelectionEvent;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/feature/CreateFeatureProjectFromLaunchOperation.java (-2 / +4 lines)
Lines 12-17 Link Here
12
12
13
package org.eclipse.pde.internal.ui.wizards.feature;
13
package org.eclipse.pde.internal.ui.wizards.feature;
14
14
15
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
16
17
import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper;
18
15
import org.eclipse.core.resources.IProject;
19
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.IPath;
21
import org.eclipse.core.runtime.IPath;
Lines 21-29 Link Here
21
import org.eclipse.pde.core.plugin.IPluginModelBase;
25
import org.eclipse.pde.core.plugin.IPluginModelBase;
22
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
26
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
23
import org.eclipse.pde.internal.core.ifeature.IFeature;
27
import org.eclipse.pde.internal.core.ifeature.IFeature;
24
import org.eclipse.pde.internal.ui.launcher.BundleLauncherHelper;
25
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
28
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
26
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
27
import org.eclipse.swt.widgets.Shell;
29
import org.eclipse.swt.widgets.Shell;
28
30
29
public class CreateFeatureProjectFromLaunchOperation extends CreateFeatureProjectOperation {
31
public class CreateFeatureProjectFromLaunchOperation extends CreateFeatureProjectOperation {
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/feature/PluginListPage.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.feature;
11
package org.eclipse.pde.internal.ui.wizards.feature;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import com.ibm.icu.text.Collator;
15
import com.ibm.icu.text.Collator;
14
import java.util.TreeSet;
16
import java.util.TreeSet;
15
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
Lines 25-31 Link Here
25
import org.eclipse.pde.internal.ui.elements.DefaultContentProvider;
27
import org.eclipse.pde.internal.ui.elements.DefaultContentProvider;
26
import org.eclipse.pde.internal.ui.wizards.ListUtil;
28
import org.eclipse.pde.internal.ui.wizards.ListUtil;
27
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
29
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
28
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
29
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.events.SelectionAdapter;
31
import org.eclipse.swt.events.SelectionAdapter;
31
import org.eclipse.swt.events.SelectionEvent;
32
import org.eclipse.swt.events.SelectionEvent;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizard.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.imports;
11
package org.eclipse.pde.internal.ui.wizards.imports;
12
12
13
import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper;
14
13
import java.util.*;
15
import java.util.*;
14
import org.eclipse.core.resources.ResourcesPlugin;
16
import org.eclipse.core.resources.ResourcesPlugin;
15
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
Lines 22-28 Link Here
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
24
import org.eclipse.pde.core.plugin.IPluginModelBase;
23
import org.eclipse.pde.internal.core.SourceLocationManager;
25
import org.eclipse.pde.internal.core.SourceLocationManager;
24
import org.eclipse.pde.internal.ui.*;
26
import org.eclipse.pde.internal.ui.*;
25
import org.eclipse.pde.internal.ui.launcher.BundleLauncherHelper;
26
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.ui.IImportWizard;
28
import org.eclipse.ui.IImportWizard;
28
import org.eclipse.ui.IWorkbench;
29
import org.eclipse.ui.IWorkbench;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/tools/OrganizeManifestsWizardPage.java (-2 / +5 lines)
Lines 11-20 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.wizards.tools;
12
package org.eclipse.pde.internal.ui.wizards.tools;
13
13
14
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
15
14
import org.eclipse.jface.dialogs.Dialog;
16
import org.eclipse.jface.dialogs.Dialog;
15
import org.eclipse.jface.dialogs.IDialogSettings;
17
import org.eclipse.jface.dialogs.IDialogSettings;
16
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
18
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
17
import org.eclipse.pde.internal.ui.*;
19
import org.eclipse.pde.internal.ui.IHelpContextIds;
20
import org.eclipse.pde.internal.ui.PDEUIMessages;
18
import org.eclipse.pde.internal.ui.refactoring.PDERefactor;
21
import org.eclipse.pde.internal.ui.refactoring.PDERefactor;
19
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.events.*;
23
import org.eclipse.swt.events.*;
Lines 23-29 Link Here
23
import org.eclipse.swt.widgets.*;
26
import org.eclipse.swt.widgets.*;
24
import org.eclipse.ui.PlatformUI;
27
import org.eclipse.ui.PlatformUI;
25
28
26
public class OrganizeManifestsWizardPage extends UserInputWizardPage implements IPreferenceConstants, IOrganizeManifestsSettings {
29
public class OrganizeManifestsWizardPage extends UserInputWizardPage implements ILaunchingPreferenceConstants, IOrganizeManifestsSettings {
27
30
28
	private Button fRemoveUnresolved;
31
	private Button fRemoveUnresolved;
29
	private Button fCalculateUses;
32
	private Button fCalculateUses;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/BaseExportWizard.java (-2 / +5 lines)
Lines 10-23 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.exports;
11
package org.eclipse.pde.internal.ui.wizards.exports;
12
12
13
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
14
13
import org.eclipse.jface.dialogs.IDialogSettings;
15
import org.eclipse.jface.dialogs.IDialogSettings;
14
import org.eclipse.jface.viewers.IStructuredSelection;
16
import org.eclipse.jface.viewers.IStructuredSelection;
15
import org.eclipse.jface.wizard.IWizardPage;
17
import org.eclipse.jface.wizard.IWizardPage;
16
import org.eclipse.jface.wizard.Wizard;
18
import org.eclipse.jface.wizard.Wizard;
17
import org.eclipse.pde.internal.ui.*;
19
import org.eclipse.pde.internal.ui.PDEPlugin;
20
import org.eclipse.pde.internal.ui.PDEUIMessages;
18
import org.eclipse.ui.*;
21
import org.eclipse.ui.*;
19
22
20
public abstract class BaseExportWizard extends Wizard implements IExportWizard, IPreferenceConstants {
23
public abstract class BaseExportWizard extends Wizard implements IExportWizard, ILaunchingPreferenceConstants {
21
24
22
	protected IStructuredSelection fSelection;
25
	protected IStructuredSelection fSelection;
23
26
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEMultiPageContentOutline.java (-1 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.editor;
11
package org.eclipse.pde.internal.ui.editor;
12
12
13
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
14
13
import java.util.ArrayList;
15
import java.util.ArrayList;
14
import org.eclipse.jface.action.*;
16
import org.eclipse.jface.action.*;
15
import org.eclipse.jface.viewers.*;
17
import org.eclipse.jface.viewers.*;
Lines 24-30 Link Here
24
import org.eclipse.ui.part.PageBook;
26
import org.eclipse.ui.part.PageBook;
25
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
27
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
26
28
27
public class PDEMultiPageContentOutline extends Page implements IContentOutlinePage, ISelectionProvider, ISelectionChangedListener, IPreferenceConstants {
29
public class PDEMultiPageContentOutline extends Page implements IContentOutlinePage, ISelectionProvider, ISelectionChangedListener, ILaunchingPreferenceConstants {
28
	private PageBook pagebook;
30
	private PageBook pagebook;
29
	private ISelection selection;
31
	private ISelection selection;
30
	private ArrayList listeners;
32
	private ArrayList listeners;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/DependencyManagementSection.java (-3 / +6 lines)
Lines 12-17 Link Here
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.pde.internal.ui.editor.plugin;
13
package org.eclipse.pde.internal.ui.editor.plugin;
14
14
15
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
16
17
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
18
15
import java.io.ByteArrayInputStream;
19
import java.io.ByteArrayInputStream;
16
import java.util.*;
20
import java.util.*;
17
import org.eclipse.core.resources.*;
21
import org.eclipse.core.resources.*;
Lines 19-25 Link Here
19
import org.eclipse.core.runtime.NullProgressMonitor;
23
import org.eclipse.core.runtime.NullProgressMonitor;
20
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
24
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
21
import org.eclipse.jface.action.*;
25
import org.eclipse.jface.action.*;
22
import org.eclipse.jface.preference.IPreferenceStore;
23
import org.eclipse.jface.util.IPropertyChangeListener;
26
import org.eclipse.jface.util.IPropertyChangeListener;
24
import org.eclipse.jface.util.PropertyChangeEvent;
27
import org.eclipse.jface.util.PropertyChangeEvent;
25
import org.eclipse.jface.viewers.*;
28
import org.eclipse.jface.viewers.*;
Lines 393-400 Link Here
393
					entry.addToken(pmodel.getPlugin().getId());
396
					entry.addToken(pmodel.getPlugin().getId());
394
				}
397
				}
395
				markDirty();
398
				markDirty();
396
				IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore();
399
				PDEPreferencesManager store = PDELaunchingPlugin.getDefault().getPreferenceManager();
397
				store.setDefault(IPreferenceConstants.PROP_AUTO_MANAGE, true);
400
				store.setDefault(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE, true);
398
			} catch (CoreException e) {
401
			} catch (CoreException e) {
399
				PDEPlugin.logException(e);
402
				PDEPlugin.logException(e);
400
			}
403
			}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/ProductValidateAction.java (-1 / +4 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.editor.product;
11
package org.eclipse.pde.internal.ui.editor.product;
12
12
13
import org.eclipse.pde.internal.launching.launcher.LaunchValidationOperation;
14
import org.eclipse.pde.internal.launching.launcher.ProductValidationOperation;
15
13
import java.util.*;
16
import java.util.*;
14
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.NullProgressMonitor;
18
import org.eclipse.core.runtime.NullProgressMonitor;
Lines 22-28 Link Here
22
import org.eclipse.pde.internal.core.ifeature.*;
25
import org.eclipse.pde.internal.core.ifeature.*;
23
import org.eclipse.pde.internal.core.iproduct.*;
26
import org.eclipse.pde.internal.core.iproduct.*;
24
import org.eclipse.pde.internal.ui.*;
27
import org.eclipse.pde.internal.ui.*;
25
import org.eclipse.pde.internal.ui.launcher.*;
28
import org.eclipse.pde.internal.ui.launcher.LaunchPluginValidator;
26
29
27
public class ProductValidateAction extends Action {
30
public class ProductValidateAction extends Action {
28
31
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties (-12 lines)
Lines 548-566 Link Here
548
ConfigurationTab_fileDialogMessage=Select a config.ini file:
548
ConfigurationTab_fileDialogMessage=Select a config.ini file:
549
549
550
550
551
WorkbenchLauncherConfigurationDelegate_noJRE = Cannot locate JRE definition: "{0}". Launch aborted.
552
WorkbenchLauncherConfigurationDelegate_jrePathNotFound = The installation path to the specified JRE could not be found.  Launch aborted.
553
WorkbenchLauncherConfigurationDelegate_badFeatureSetup = When in feature mode, plug-ins must be in the 'plugins' directory and features in 'features' directory in the workspace.
554
WorkbenchLauncherConfigurationDelegate_noStartup = Launching failed. Bootstrap code cannot be found.
555
WorkbenchLauncherConfigurationDelegate_confirmDeleteWorkspace = Do you really want to clear the run-time workspace data in {0}?
551
WorkbenchLauncherConfigurationDelegate_confirmDeleteWorkspace = Do you really want to clear the run-time workspace data in {0}?
556
JUnitLaunchConfiguration_error_notaplugin = Could not launch the JUnit plug-in tests because project ''{0}'' is not a plug-in project.
557
JUnitLaunchConfiguration_error_missingPlugin = Required plug-in ''{0}'' could not be found.
558
552
559
Launcher_error_title=Launch Error
553
Launcher_error_title=Launch Error
560
LauncherSection_desc=Customize the executable that is used to launch the product.
554
LauncherSection_desc=Customize the executable that is used to launch the product.
561
LauncherSection_ico=Use a single ICO file containing the 6 images:
555
LauncherSection_ico=Use a single ICO file containing the 6 images:
562
LauncherUtils_workspaceLocked=Workspace Cannot Be Locked
556
LauncherUtils_workspaceLocked=Workspace Cannot Be Locked
563
LauncherUtils_cannotLaunchApplication=Could not launch the application because the associated workspace is currently in use by another Eclipse application.\n\n{0}
564
LauncherUtils_clearLogFile=Do you really want to clear the log file?
557
LauncherUtils_clearLogFile=Do you really want to clear the log file?
565
LauncherUtils_title=Launcher
558
LauncherUtils_title=Launcher
566
LauncherPage_title=Launching
559
LauncherPage_title=Launching
Lines 2007-2013 Link Here
2007
InternationalizeWizard_NLSFragmentGenerator_errorMessage = An error occured while generating an NL Fragment.
2000
InternationalizeWizard_NLSFragmentGenerator_errorMessage = An error occured while generating an NL Fragment.
2008
2001
2009
MainTab_jreSection = Java Runtime Environment
2002
MainTab_jreSection = Java Runtime Environment
2010
EquinoxLaunchConfiguration_oldTarget=The org.eclipse.osgi plug-in is missing from this configuration.
2011
EquinoxPluginBlock_levelColumn=Start Level
2003
EquinoxPluginBlock_levelColumn=Start Level
2012
EquinoxPluginsTab_defaultStart=Default S&tart level:
2004
EquinoxPluginsTab_defaultStart=Default S&tart level:
2013
EquinoxPluginBlock_autoColumn=Auto-Start
2005
EquinoxPluginBlock_autoColumn=Auto-Start
Lines 2184-2191 Link Here
2184
EditorSourcePage_name=Source
2176
EditorSourcePage_name=Source
2185
EditTargetNode_0=New Target Definition
2177
EditTargetNode_0=New Target Definition
2186
OSGiBundlesTab_frameworkLabel=&Framework:
2178
OSGiBundlesTab_frameworkLabel=&Framework:
2187
OSGiLaunchConfiguration_cannotFindLaunchConfiguration=Cannot find the {0} OSGi framework.
2188
OSGiLaunchConfiguration_selected=selected
2189
OSGiFrameworkPreferencePage_default=(default)
2179
OSGiFrameworkPreferencePage_default=(default)
2190
OSGiFrameworkPreferencePage_installed=Installed <a>OSGi frameworks</a>:
2180
OSGiFrameworkPreferencePage_installed=Installed <a>OSGi frameworks</a>:
2191
OSGiFrameworkPreferencePage_installed_nolink=Installed OSGi frameworks:
2181
OSGiFrameworkPreferencePage_installed_nolink=Installed OSGi frameworks:
Lines 2273-2280 Link Here
2273
PDECompilersConfigurationBlock_warning = Warning
2263
PDECompilersConfigurationBlock_warning = Warning
2274
PDECompilersConfigurationBlock_ignore = Ignore
2264
PDECompilersConfigurationBlock_ignore = Ignore
2275
2265
2276
VMHelper_cannotFindExecEnv=Cannot locate Execution Environment definition: "{0}". Launch aborted.
2277
2278
LicensingPage_title=Licensing
2266
LicensingPage_title=Licensing
2279
LicenseSection_title=License
2267
LicenseSection_title=License
2280
LicenseSection_description=Specify the license text and URL for the product.
2268
LicenseSection_description=Specify the license text and URL for the product.
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/EclipsePluginValidationOperation.java (-122 lines)
Lines 1-122 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
13
14
import java.util.HashMap;
15
import java.util.Map;
16
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.debug.core.ILaunchConfiguration;
19
import org.eclipse.osgi.service.resolver.BundleDescription;
20
import org.eclipse.osgi.util.NLS;
21
import org.eclipse.pde.core.plugin.*;
22
import org.eclipse.pde.internal.core.util.IdUtil;
23
import org.eclipse.pde.internal.ui.*;
24
import org.eclipse.pde.internal.ui.elements.NamedElement;
25
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
26
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
27
import org.eclipse.swt.graphics.Image;
28
29
public class EclipsePluginValidationOperation extends LaunchValidationOperation {
30
31
	private Map fExtensionErrors = new HashMap(2);
32
	private static Object[] EMPTY = new Object[0];
33
34
	public EclipsePluginValidationOperation(ILaunchConfiguration configuration) {
35
		super(configuration);
36
	}
37
38
	protected IPluginModelBase[] getModels() throws CoreException {
39
		return BundleLauncherHelper.getMergedBundles(fLaunchConfiguration, false);
40
	}
41
42
	public void run(IProgressMonitor monitor) throws CoreException {
43
		super.run(monitor);
44
		if (fExtensionErrors.size() > 0)
45
			fExtensionErrors.clear();
46
		validateExtensions();
47
	}
48
49
	private void validateExtensions() {
50
		try {
51
			if (fLaunchConfiguration.getAttribute(IPDELauncherConstants.USE_PRODUCT, false)) {
52
				String product = fLaunchConfiguration.getAttribute(IPDELauncherConstants.PRODUCT, (String) null);
53
				if (product != null) {
54
					validateExtension(product);
55
					String application = getApplication(product);
56
					if (application != null)
57
						validateExtension(application);
58
				}
59
			} else {
60
				String configType = fLaunchConfiguration.getType().getIdentifier();
61
				String attribute = configType.equals(EclipseLaunchShortcut.CONFIGURATION_TYPE) ? IPDELauncherConstants.APPLICATION : IPDELauncherConstants.APP_TO_TEST;
62
				String application = fLaunchConfiguration.getAttribute(attribute, TargetPlatform.getDefaultApplication());
63
				if (!IPDEUIConstants.CORE_TEST_APPLICATION.equals(application)) {
64
					validateExtension(application);
65
				}
66
			}
67
		} catch (CoreException e) {
68
			PDEPlugin.log(e);
69
		}
70
	}
71
72
	private String getApplication(String product) {
73
		String bundleID = product.substring(0, product.lastIndexOf('.'));
74
		BundleDescription bundle = getState().getBundle(bundleID, null);
75
		if (bundle != null) {
76
			IPluginModelBase model = PluginRegistry.findModel(bundle);
77
			if (model != null) {
78
				IPluginExtension[] extensions = model.getPluginBase().getExtensions();
79
				for (int i = 0; i < extensions.length; i++) {
80
					IPluginExtension ext = extensions[i];
81
					String point = ext.getPoint();
82
					if ("org.eclipse.core.runtime.products".equals(point) //$NON-NLS-1$
83
							&& product.equals(IdUtil.getFullId(ext))) {
84
						if (ext.getChildCount() == 1) {
85
							IPluginElement prod = (IPluginElement) ext.getChildren()[0];
86
							if (prod.getName().equals("product")) { //$NON-NLS-1$
87
								IPluginAttribute attr = prod.getAttribute("application"); //$NON-NLS-1$
88
								return attr != null ? attr.getValue() : null;
89
							}
90
						}
91
					}
92
				}
93
			}
94
		}
95
		return null;
96
	}
97
98
	private void validateExtension(String id) {
99
		int index = id.lastIndexOf('.');
100
		if (index == -1)
101
			return;
102
		String bundleID = id.substring(0, index);
103
		BundleDescription bundle = getState().getBundle(bundleID, null);
104
		if (bundle == null) {
105
			String name = NLS.bind(PDEUIMessages.EclipsePluginValidationOperation_pluginMissing, bundleID);
106
			PDELabelProvider provider = PDEPlugin.getDefault().getLabelProvider();
107
			Image image = provider.get(PDEPluginImages.DESC_PLUGIN_OBJ);
108
			fExtensionErrors.put(new NamedElement(name, image), EMPTY);
109
		}
110
	}
111
112
	public boolean hasErrors() {
113
		return super.hasErrors() || fExtensionErrors.size() >= 1;
114
	}
115
116
	public Map getInput() {
117
		Map map = super.getInput();
118
		map.putAll(fExtensionErrors);
119
		return map;
120
	}
121
122
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchValidationOperation.java (-161 lines)
Lines 1-161 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2007, 2009 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import java.io.*;
14
import java.util.*;
15
import java.util.zip.ZipEntry;
16
import java.util.zip.ZipFile;
17
import org.eclipse.core.resources.IWorkspaceRunnable;
18
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IProgressMonitor;
20
import org.eclipse.debug.core.ILaunchConfiguration;
21
import org.eclipse.jdt.launching.IVMInstall;
22
import org.eclipse.jdt.launching.JavaRuntime;
23
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
24
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
25
import org.eclipse.osgi.service.resolver.State;
26
import org.eclipse.pde.core.plugin.IPluginModelBase;
27
import org.eclipse.pde.core.plugin.PluginRegistry;
28
import org.eclipse.pde.internal.core.BundleValidationOperation;
29
import org.eclipse.pde.internal.core.TargetPlatformHelper;
30
import org.osgi.framework.Constants;
31
32
public abstract class LaunchValidationOperation implements IWorkspaceRunnable {
33
34
	private BundleValidationOperation fOperation;
35
	protected ILaunchConfiguration fLaunchConfiguration;
36
37
	public LaunchValidationOperation(ILaunchConfiguration configuration) {
38
		fLaunchConfiguration = configuration;
39
	}
40
41
	public void run(IProgressMonitor monitor) throws CoreException {
42
		fOperation = new BundleValidationOperation(getModels(), getPlatformProperties());
43
		fOperation.run(monitor);
44
	}
45
46
	protected abstract IPluginModelBase[] getModels() throws CoreException;
47
48
	protected Dictionary[] getPlatformProperties() throws CoreException {
49
		IExecutionEnvironment[] envs = getMatchingEnvironments();
50
		if (envs.length == 0)
51
			return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment()};
52
53
		// add java profiles for those EE's that have a .profile file in the current system bundle
54
		ArrayList result = new ArrayList(envs.length);
55
		for (int i = 0; i < envs.length; i++) {
56
			Properties profileProps = getJavaProfileProperties(envs[i].getId());
57
			if (profileProps != null) {
58
				Dictionary props = TargetPlatformHelper.getTargetEnvironment();
59
				String systemPackages = profileProps.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
60
				if (systemPackages != null)
61
					props.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackages);
62
				String ee = profileProps.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT);
63
				if (ee != null)
64
					props.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee);
65
				result.add(props);
66
			}
67
		}
68
		if (result.size() > 0)
69
			return (Dictionary[]) result.toArray(new Dictionary[result.size()]);
70
		return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment()};
71
72
	}
73
74
	protected IExecutionEnvironment[] getMatchingEnvironments() throws CoreException {
75
		IVMInstall install = VMHelper.getVMInstall(fLaunchConfiguration);
76
		if (install == null)
77
			return new IExecutionEnvironment[0];
78
79
		IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
80
		IExecutionEnvironment[] envs = manager.getExecutionEnvironments();
81
		List result = new ArrayList(envs.length);
82
		for (int i = 0; i < envs.length; i++) {
83
			IExecutionEnvironment env = envs[i];
84
			IVMInstall[] compatible = env.getCompatibleVMs();
85
			for (int j = 0; j < compatible.length; j++) {
86
				if (compatible[j].equals(install)) {
87
					result.add(env);
88
					break;
89
				}
90
			}
91
		}
92
		return (IExecutionEnvironment[]) result.toArray(new IExecutionEnvironment[result.size()]);
93
	}
94
95
	private Properties getJavaProfileProperties(String ee) {
96
		IPluginModelBase model = PluginRegistry.findModel("system.bundle"); //$NON-NLS-1$
97
		if (model == null)
98
			return null;
99
100
		File location = new File(model.getInstallLocation());
101
		String filename = ee.replace('/', '_') + ".profile"; //$NON-NLS-1$
102
		InputStream is = null;
103
		ZipFile zipFile = null;
104
		try {
105
			// find the input stream to the profile properties file
106
			if (location.isDirectory()) {
107
				File file = new File(location, filename);
108
				if (file.exists())
109
					is = new FileInputStream(file);
110
			} else {
111
				zipFile = null;
112
				try {
113
					zipFile = new ZipFile(location, ZipFile.OPEN_READ);
114
					ZipEntry entry = zipFile.getEntry(filename);
115
					if (entry != null)
116
						is = zipFile.getInputStream(entry);
117
				} catch (IOException e) {
118
					// nothing to do
119
				}
120
			}
121
			if (is != null) {
122
				Properties profile = new Properties();
123
				profile.load(is);
124
				return profile;
125
			}
126
		} catch (IOException e) {
127
			// nothing to do
128
		} finally {
129
			if (is != null)
130
				try {
131
					is.close();
132
				} catch (IOException e) {
133
					// nothing to do
134
				}
135
			if (zipFile != null)
136
				try {
137
					zipFile.close();
138
				} catch (IOException e) {
139
					// nothing to do
140
				}
141
		}
142
		return null;
143
	}
144
145
	public boolean hasErrors() {
146
		return fOperation.hasErrors();
147
	}
148
149
	public Map getInput() {
150
		return fOperation.getResolverErrors();
151
	}
152
153
	public boolean isEmpty() {
154
		return fOperation.getState().getHighestBundleId() == -1;
155
	}
156
157
	protected State getState() {
158
		return fOperation.getState();
159
	}
160
161
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchConfigurationListener.java (-48 lines)
Lines 1-48 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import java.io.File;
14
import org.eclipse.debug.core.*;
15
import org.eclipse.pde.internal.core.util.CoreUtility;
16
17
public class LaunchConfigurationListener implements ILaunchConfigurationListener {
18
19
	/* (non-Javadoc)
20
	 * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
21
	 */
22
	public void launchConfigurationAdded(ILaunchConfiguration configuration) {
23
	}
24
25
	/* (non-Javadoc)
26
	 * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
27
	 */
28
	public void launchConfigurationChanged(ILaunchConfiguration configuration) {
29
	}
30
31
	/* (non-Javadoc)
32
	 * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
33
	 */
34
	public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
35
		File configDir = LaunchConfigurationHelper.getConfigurationLocation(configuration);
36
		if (configDir.exists()) {
37
			// rename the config area if it was auto-set by PDE when the launch configuration is renamed
38
			ILaunchConfiguration destination = DebugPlugin.getDefault().getLaunchManager().getMovedTo(configuration);
39
			boolean delete = true;
40
			if (destination != null) {
41
				delete = !configDir.renameTo(LaunchConfigurationHelper.getConfigurationLocation(destination));
42
			}
43
			if (delete)
44
				CoreUtility.deleteContent(configDir);
45
		}
46
	}
47
48
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/OSGiFrameworkManager.java (-141 lines)
Lines 1-141 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import java.util.*;
14
import org.eclipse.core.runtime.*;
15
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
16
import org.eclipse.jface.preference.IPreferenceStore;
17
import org.eclipse.pde.internal.ui.IPreferenceConstants;
18
import org.eclipse.pde.internal.ui.PDEPlugin;
19
import org.eclipse.pde.ui.launcher.OSGiLaunchConfigurationInitializer;
20
21
public class OSGiFrameworkManager implements IRegistryChangeListener {
22
23
	public static final String POINT_ID = "org.eclipse.pde.ui.osgiFrameworks"; //$NON-NLS-1$
24
	public static final String DEFAULT_FRAMEWORK = "org.eclipse.pde.ui.EquinoxFramework"; //$NON-NLS-1$
25
26
	public static final String ATT_ID = "id"; //$NON-NLS-1$
27
	public static final String ATT_NAME = "name"; //$NON-NLS-1$
28
	public static final String ATT_DELEGATE = "launcherDelegate"; //$NON-NLS-1$
29
	public static final String ATT_INITIALIZER = "initializer"; //$NON-NLS-1$
30
31
	public static final String ELEMENT_FRAMEWORK = "framework"; //$NON-NLS-1$
32
33
	private Map fFrameworks;
34
35
	public IConfigurationElement[] getFrameworks() {
36
		if (fFrameworks == null)
37
			loadElements();
38
		return (IConfigurationElement[]) fFrameworks.values().toArray(new IConfigurationElement[fFrameworks.size()]);
39
	}
40
41
	public IConfigurationElement[] getSortedFrameworks() {
42
		IConfigurationElement[] elements = getFrameworks();
43
		return orderElements(elements);
44
	}
45
46
	private void loadElements() {
47
		fFrameworks = new HashMap();
48
		IExtensionRegistry registry = Platform.getExtensionRegistry();
49
		IConfigurationElement[] elements = registry.getConfigurationElementsFor(POINT_ID);
50
		for (int i = 0; i < elements.length; i++) {
51
			String id = elements[i].getAttribute(ATT_ID);
52
			if (id == null || elements[i].getAttribute(ATT_NAME) == null || elements[i].getAttribute(ATT_DELEGATE) == null)
53
				continue;
54
			fFrameworks.put(id, elements[i]);
55
		}
56
	}
57
58
	private IConfigurationElement[] orderElements(IConfigurationElement[] elems) {
59
		Arrays.sort(elems, new Comparator() {
60
			public int compare(Object o1, Object o2) {
61
				String name1 = ((IConfigurationElement) o1).getAttribute(ATT_NAME);
62
				String name2 = ((IConfigurationElement) o2).getAttribute(ATT_NAME);
63
				if (name1 != null)
64
					return name1.compareToIgnoreCase(name2);
65
				return 1;
66
			}
67
		});
68
		return elems;
69
	}
70
71
	public void registryChanged(IRegistryChangeEvent event) {
72
		//TODO implement 
73
	}
74
75
	public String getDefaultFramework() {
76
		IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore();
77
		return store.getString(IPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK);
78
	}
79
80
	public OSGiLaunchConfigurationInitializer getDefaultInitializer() {
81
		return getInitializer(getDefaultFramework());
82
	}
83
84
	public OSGiLaunchConfigurationInitializer getInitializer(String frameworkID) {
85
		if (fFrameworks == null)
86
			loadElements();
87
		if (fFrameworks.containsKey(frameworkID)) {
88
			try {
89
				IConfigurationElement element = (IConfigurationElement) fFrameworks.get(frameworkID);
90
				if (element.getAttribute(ATT_INITIALIZER) != null) {
91
					Object result = element.createExecutableExtension(ATT_INITIALIZER);
92
					if (result instanceof OSGiLaunchConfigurationInitializer)
93
						return (OSGiLaunchConfigurationInitializer) result;
94
				}
95
			} catch (CoreException e) {
96
			}
97
		}
98
		return new OSGiLaunchConfigurationInitializer();
99
	}
100
101
	public LaunchConfigurationDelegate getFrameworkLauncher(String frameworkID) {
102
		if (fFrameworks == null)
103
			loadElements();
104
		if (fFrameworks.containsKey(frameworkID)) {
105
			try {
106
				IConfigurationElement element = (IConfigurationElement) fFrameworks.get(frameworkID);
107
				Object result = element.createExecutableExtension(ATT_DELEGATE);
108
				if (result instanceof LaunchConfigurationDelegate)
109
					return (LaunchConfigurationDelegate) result;
110
			} catch (CoreException e) {
111
			}
112
		}
113
		return null;
114
	}
115
116
	public String getFrameworkName(String frameworkID) {
117
		if (fFrameworks == null)
118
			loadElements();
119
		if (fFrameworks.containsKey(frameworkID)) {
120
			IConfigurationElement element = (IConfigurationElement) fFrameworks.get(frameworkID);
121
			return element.getAttribute(ATT_NAME);
122
		}
123
		return null;
124
	}
125
126
	/**
127
	 * Returns the {@link IConfigurationElement} for the framework with the given ID
128
	 * or <code>null</code> if no element exists with that ID.
129
	 * @param frameworkId
130
	 * @return the {@link IConfigurationElement} for the framework with the given ID or <code>null</code>
131
	 * 
132
	 * @since 3.5
133
	 */
134
	public IConfigurationElement getFramework(String frameworkId) {
135
		if (fFrameworks == null) {
136
			loadElements();
137
		}
138
		return (IConfigurationElement) fFrameworks.get(frameworkId);
139
	}
140
141
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LauncherUtils.java (-413 lines)
Lines 1-413 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
13
14
import java.io.*;
15
import java.net.MalformedURLException;
16
import java.net.URL;
17
import java.util.*;
18
import org.eclipse.core.resources.*;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.debug.core.ILaunchConfiguration;
21
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
22
import org.eclipse.jdt.core.*;
23
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
24
import org.eclipse.jface.dialogs.IDialogConstants;
25
import org.eclipse.jface.dialogs.MessageDialog;
26
import org.eclipse.jface.preference.IPreferenceStore;
27
import org.eclipse.ltk.core.refactoring.Change;
28
import org.eclipse.osgi.service.datalocation.Location;
29
import org.eclipse.osgi.util.NLS;
30
import org.eclipse.pde.core.plugin.IPluginModelBase;
31
import org.eclipse.pde.core.plugin.PluginRegistry;
32
import org.eclipse.pde.internal.core.*;
33
import org.eclipse.pde.internal.core.util.CoreUtility;
34
import org.eclipse.pde.internal.ui.*;
35
import org.eclipse.pde.internal.ui.wizards.tools.OrganizeManifestsProcessor;
36
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
37
import org.eclipse.swt.widgets.Display;
38
import org.eclipse.swt.widgets.Shell;
39
import org.eclipse.ui.IWorkbenchWindow;
40
import org.osgi.framework.*;
41
42
public class LauncherUtils {
43
44
	private static final String TIMESTAMP = "timestamp"; //$NON-NLS-1$
45
	private static final String FILE_NAME = "dep-timestamp.properties"; //$NON-NLS-1$
46
	private static Properties fLastRun;
47
48
	public static Display getDisplay() {
49
		Display display = Display.getCurrent();
50
		if (display == null) {
51
			display = Display.getDefault();
52
		}
53
		return display;
54
	}
55
56
	public final static Shell getActiveShell() {
57
		IWorkbenchWindow window = PDEPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
58
		if (window == null) {
59
			IWorkbenchWindow[] windows = PDEPlugin.getDefault().getWorkbench().getWorkbenchWindows();
60
			if (windows.length > 0)
61
				return windows[0].getShell();
62
		} else
63
			return window.getShell();
64
		return getDisplay().getActiveShell();
65
	}
66
67
	public static boolean clearWorkspace(ILaunchConfiguration configuration, String workspace, IProgressMonitor monitor) throws CoreException {
68
69
		// If the workspace is not defined, there is no workspace to clear
70
		// What will happen is that the workspace chooser dialog will be 
71
		// brought up because no -data parameter will be specified on the 
72
		// launch
73
		if (workspace.length() == 0) {
74
			monitor.done();
75
			return true;
76
		}
77
78
		// Check if the workspace is already in use, if so, open a message and stop the launch before clearing
79
		boolean isLocked = false;
80
		try {
81
			BundleContext context = PDECore.getDefault().getBundleContext();
82
			ServiceReference[] references = context.getServiceReferences(Location.class.getName(), "(type=osgi.configuration.area)"); //$NON-NLS-1$
83
			if (references.length > 0) {
84
				Object service = context.getService(references[0]);
85
				if (service instanceof Location) {
86
					URL workspaceURL = new Path(workspace).toFile().toURI().toURL();
87
					Location targetLocation = ((Location) service).createLocation(null, workspaceURL, false);
88
					targetLocation.set(targetLocation.getDefault(), false);
89
					isLocked = targetLocation.isLocked();
90
				}
91
			}
92
		} catch (InvalidSyntaxException e) {
93
			PDECore.log(e);
94
			isLocked = false;
95
		} catch (MalformedURLException e) {
96
			PDECore.log(e);
97
			isLocked = false;
98
		} catch (IOException e) {
99
			PDECore.log(e);
100
			isLocked = false;
101
		}
102
103
		if (isLocked) {
104
			generateErrorDialog(PDEUIMessages.LauncherUtils_workspaceLocked, NLS.bind(PDEUIMessages.LauncherUtils_cannotLaunchApplication, workspace));
105
			monitor.done();
106
			return false;
107
		}
108
109
		File workspaceFile = new Path(workspace).toFile().getAbsoluteFile();
110
		if (configuration.getAttribute(IPDELauncherConstants.DOCLEAR, false) && workspaceFile.exists()) {
111
			if (configuration.getAttribute(IPDELauncherConstants.ASKCLEAR, true)) {
112
				int result;
113
				if (configuration.getAttribute(IPDEUIConstants.DOCLEARLOG, false)) {
114
					result = generateDialog(PDEUIMessages.LauncherUtils_clearLogFile);
115
				} else {
116
					result = generateDialog(NLS.bind(PDEUIMessages.WorkbenchLauncherConfigurationDelegate_confirmDeleteWorkspace, workspaceFile.getPath()));
117
				}
118
119
				if (result == 2 /*Cancel Button*/|| result == -1 /*Dialog close button*/) {
120
					monitor.done();
121
					return false;
122
				} else if (result == 0) {
123
					if (configuration.getAttribute(IPDEUIConstants.DOCLEARLOG, false)) {
124
						LauncherUtils.clearWorkspaceLog(workspace);
125
					} else {
126
						CoreUtility.deleteContent(workspaceFile);
127
					}
128
				}
129
			} else if (configuration.getAttribute(IPDEUIConstants.DOCLEARLOG, false)) {
130
				LauncherUtils.clearWorkspaceLog(workspace);
131
			} else {
132
				CoreUtility.deleteContent(workspaceFile);
133
			}
134
		}
135
136
		monitor.done();
137
		return true;
138
	}
139
140
	public static boolean generateConfigIni() {
141
		String message = PDEUIMessages.LauncherUtils_generateConfigIni;
142
		return generateDialog(message) == 0;
143
	}
144
145
	/**
146
	 * Creates a message dialog using a syncExec in case we are launching in the background.
147
	 * Dialog will be a question dialog with Yes, No and Cancel buttons.
148
	 * @param message Message to use in the dialog
149
	 * @return int representing the button clicked (-1 or 2 for cancel, 0 for yes, 1 for no).
150
	 */
151
	private static int generateDialog(final String message) {
152
		final int[] result = new int[1];
153
		getDisplay().syncExec(new Runnable() {
154
			public void run() {
155
				String title = PDEUIMessages.LauncherUtils_title;
156
				MessageDialog dialog = new MessageDialog(getActiveShell(), title, null, message, MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
157
				result[0] = dialog.open();
158
			}
159
		});
160
		return result[0];
161
	}
162
163
	private static void generateErrorDialog(final String title, final String message) {
164
		getDisplay().syncExec(new Runnable() {
165
			public void run() {
166
				MessageDialog dialog = new MessageDialog(getActiveShell(), title, null, message, MessageDialog.ERROR, new String[] {IDialogConstants.OK_LABEL}, 0);
167
				dialog.open();
168
			}
169
		});
170
	}
171
172
	public static void validateProjectDependencies(ILaunchConfiguration launch, final IProgressMonitor monitor) {
173
		IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore();
174
		if (!store.getBoolean(IPreferenceConstants.PROP_AUTO_MANAGE))
175
			return;
176
177
		String timeStamp;
178
		boolean useDefault, autoAdd;
179
		try {
180
			timeStamp = launch.getAttribute(TIMESTAMP, "0"); //$NON-NLS-1$
181
			autoAdd = launch.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true);
182
			useDefault = launch.getAttribute(IPDELauncherConstants.USE_DEFAULT, true);
183
			useDefault |= launch.getAttribute(IPDELauncherConstants.USEFEATURES, false);
184
			final ArrayList projects = new ArrayList();
185
			if (useDefault)
186
				handleUseDefault(timeStamp, projects);
187
			else if (autoAdd)
188
				handleDeselectedPlugins(launch, timeStamp, projects);
189
			else
190
				handleSelectedPlugins(launch, timeStamp, projects);
191
192
			if (!projects.isEmpty())
193
				Display.getDefault().syncExec(new Runnable() {
194
					public void run() {
195
						OrganizeManifestsProcessor processor = new OrganizeManifestsProcessor(projects);
196
						initializeProcessor(processor);
197
						try {
198
							Change change = processor.createChange(monitor);
199
							change.perform(monitor);
200
							// update table for each project with current time stamp
201
							Properties table = getLastRun();
202
							String ts = Long.toString(System.currentTimeMillis());
203
							Iterator it = projects.iterator();
204
							while (it.hasNext())
205
								table.put(((IProject) it.next()).getName(), ts);
206
						} catch (OperationCanceledException e) {
207
						} catch (CoreException e) {
208
						}
209
					}
210
				});
211
212
			ILaunchConfigurationWorkingCopy wc = null;
213
			if (launch.isWorkingCopy())
214
				wc = (ILaunchConfigurationWorkingCopy) launch;
215
			else
216
				wc = launch.getWorkingCopy();
217
			wc.setAttribute(TIMESTAMP, Long.toString(System.currentTimeMillis()));
218
			wc.doSave();
219
		} catch (CoreException e) {
220
		}
221
	}
222
223
	private static void initializeProcessor(OrganizeManifestsProcessor processor) {
224
		processor.setAddMissing(false);
225
		processor.setRemoveUnresolved(false);
226
		processor.setModifyDep(false);
227
		processor.setRemoveLazy(false);
228
		processor.setRemoveUselessFiles(false);
229
		processor.setAddDependencies(true);
230
		processor.setCalculateUses(false);
231
		processor.setMarkInternal(false);
232
		processor.setPrefixIconNL(false);
233
		processor.setUnusedDependencies(false);
234
		processor.setUnusedKeys(false);
235
	}
236
237
	private static String getTimeStamp(IProject project) {
238
		IJavaProject jp = JavaCore.create(project);
239
		try {
240
			long timeStamp = 0;
241
			IClasspathEntry[] entries = jp.getResolvedClasspath(true);
242
			for (int i = 0; i < entries.length; i++) {
243
				if (entries[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
244
					File file;
245
					IPath location = entries[i].getOutputLocation();
246
					if (location == null)
247
						location = jp.getOutputLocation();
248
					IResource res = project.getWorkspace().getRoot().findMember(location);
249
					IPath path = res == null ? null : res.getLocation();
250
					if (path == null)
251
						continue;
252
					file = path.toFile();
253
					Stack files = new Stack();
254
					files.push(file);
255
					while (!files.isEmpty()) {
256
						file = (File) files.pop();
257
						if (file.isDirectory()) {
258
							File[] children = file.listFiles();
259
							if (children != null) {
260
								for (int j = 0; j < children.length; j++)
261
									files.push(children[j]);
262
							}
263
						} else if (file.getName().endsWith(".class") && timeStamp < file.lastModified()) //$NON-NLS-1$
264
							timeStamp = file.lastModified();
265
					}
266
				}
267
			}
268
			String[] otherFiles = {ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR, ICoreConstants.BUILD_FILENAME_DESCRIPTOR};
269
			for (int i = 0; i < otherFiles.length; i++) {
270
				IResource file = project.getFile(otherFiles[i]);
271
				if (file != null) {
272
					long fileTimeStamp = file.getRawLocation().toFile().lastModified();
273
					if (timeStamp < fileTimeStamp)
274
						timeStamp = fileTimeStamp;
275
				}
276
			}
277
			return Long.toString(timeStamp);
278
		} catch (JavaModelException e) {
279
		}
280
		return "0"; //$NON-NLS-1$
281
	}
282
283
	private static void handleUseDefault(String launcherTimeStamp, ArrayList projects) {
284
		IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects();
285
		for (int i = 0; i < projs.length; i++) {
286
			if (!WorkspaceModelManager.isPluginProject(projs[i]))
287
				continue;
288
			String timestamp = getTimeStamp(projs[i]);
289
			if (timestamp.compareTo(launcherTimeStamp) > 0 && shouldAdd(projs[i], launcherTimeStamp, timestamp))
290
				projects.add(projs[i]);
291
		}
292
	}
293
294
	private static void handleSelectedPlugins(ILaunchConfiguration config, String timeStamp, ArrayList projects) throws CoreException {
295
		Map selectedPlugins = BundleLauncherHelper.getWorkspaceBundleMap(config, null, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS);
296
		Iterator it = selectedPlugins.keySet().iterator();
297
		while (it.hasNext()) {
298
			IPluginModelBase model = (IPluginModelBase) it.next();
299
			IResource res = model.getUnderlyingResource();
300
			if (res != null) {
301
				IProject project = res.getProject();
302
				String projTimeStamp = getTimeStamp(project);
303
				if (projTimeStamp.compareTo(timeStamp) > 0 && shouldAdd(project, timeStamp, projTimeStamp))
304
					projects.add(project);
305
			}
306
		}
307
	}
308
309
	private static void handleDeselectedPlugins(ILaunchConfiguration config, String launcherTimeStamp, ArrayList projects) throws CoreException {
310
		Map deSelectedPlugins = BundleLauncherHelper.getWorkspaceBundleMap(config, null, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS);
311
		IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects();
312
		for (int i = 0; i < projs.length; i++) {
313
			if (!WorkspaceModelManager.isPluginProject(projs[i]))
314
				continue;
315
			IPluginModelBase base = PluginRegistry.findModel(projs[i]);
316
			if (base == null || base != null && deSelectedPlugins.containsKey(base))
317
				continue;
318
			String timestamp = getTimeStamp(projs[i]);
319
			if (timestamp.compareTo(launcherTimeStamp) > 0 && shouldAdd(projs[i], launcherTimeStamp, timestamp))
320
				projects.add(projs[i]);
321
		}
322
	}
323
324
	public static final void shutdown() {
325
		if (fLastRun == null)
326
			return;
327
		FileOutputStream stream = null;
328
		try {
329
			stream = new FileOutputStream(new File(getDirectory(), FILE_NAME));
330
			fLastRun.store(stream, "Cached timestamps"); //$NON-NLS-1$
331
			stream.flush();
332
			stream.close();
333
		} catch (IOException e) {
334
			PDECore.logException(e);
335
		} finally {
336
			try {
337
				if (stream != null)
338
					stream.close();
339
			} catch (IOException e1) {
340
			}
341
		}
342
	}
343
344
	private static File getDirectory() {
345
		IPath path = PDECore.getDefault().getStateLocation().append(".cache"); //$NON-NLS-1$
346
		File directory = new File(path.toOSString());
347
		if (!directory.exists() || !directory.isDirectory())
348
			directory.mkdirs();
349
		return directory;
350
	}
351
352
	private static Properties getLastRun() {
353
		if (fLastRun == null) {
354
			fLastRun = new Properties();
355
			FileInputStream fis = null;
356
			try {
357
				File file = new File(getDirectory(), FILE_NAME);
358
				if (file.exists()) {
359
					fis = new FileInputStream(file);
360
					fLastRun.load(fis);
361
					fis.close();
362
				}
363
			} catch (IOException e) {
364
				PDECore.logException(e);
365
			} finally {
366
				try {
367
					if (fis != null)
368
						fis.close();
369
				} catch (IOException e1) {
370
				}
371
			}
372
		}
373
		return fLastRun;
374
	}
375
376
	private static boolean shouldAdd(IProject proj, String launcherTS, String fileSystemTS) {
377
		String projTS = (String) getLastRun().get(proj.getName());
378
		if (projTS == null)
379
			return true;
380
		return ((projTS.compareTo(launcherTS) < 0) || (projTS.compareTo(fileSystemTS) < 0));
381
	}
382
383
	public static boolean requiresUI(ILaunchConfiguration configuration) {
384
		try {
385
			String projectID = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
386
			if (projectID.length() > 0) {
387
				IResource project = PDEPlugin.getWorkspace().getRoot().findMember(projectID);
388
				if (project instanceof IProject) {
389
					IPluginModelBase model = PluginRegistry.findModel((IProject) project);
390
					if (model != null) {
391
						Set plugins = DependencyManager.getSelfAndDependencies(model);
392
						return plugins.contains("org.eclipse.swt"); //$NON-NLS-1$
393
					}
394
				}
395
			}
396
		} catch (CoreException e) {
397
		}
398
		return true;
399
	}
400
401
	public static boolean clearWorkspaceLog(String workspace) {
402
		File logFile = new File(workspace, ".metadata" + File.separator + ".log"); //$NON-NLS-1$ //$NON-NLS-2$
403
		if (logFile != null && logFile.exists()) {
404
			return logFile.delete();
405
		}
406
		return true;
407
	}
408
409
	public static IStatus createErrorStatus(String message) {
410
		return new Status(IStatus.ERROR, PDEPlugin.getPluginId(), IStatus.OK, message, null);
411
	}
412
413
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/VMHelper.java (-94 lines)
Lines 1-94 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Les Jones <lesojones@gmail.com> - Bug 195433
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
13
14
import org.eclipse.core.runtime.*;
15
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.jdt.core.IJavaProject;
17
import org.eclipse.jdt.launching.*;
18
import org.eclipse.osgi.util.NLS;
19
import org.eclipse.pde.internal.core.util.VMUtil;
20
import org.eclipse.pde.internal.ui.PDEUIMessages;
21
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
22
23
public class VMHelper {
24
25
	/**
26
	 * Get the default VMInstall name using the available info in the config,
27
	 * using the JavaProject if available.
28
	 * 
29
	 * @param configuration
30
	 *            Launch configuration to check
31
	 * @return name of the VMInstall
32
	 * @throws CoreException
33
	 *             thrown if there's a problem getting the VM name
34
	 */
35
	public static String getDefaultVMInstallName(ILaunchConfiguration configuration) throws CoreException {
36
		IJavaProject javaProject = JavaRuntime.getJavaProject(configuration);
37
		IVMInstall vmInstall = null;
38
		if (javaProject != null) {
39
			vmInstall = JavaRuntime.getVMInstall(javaProject);
40
		}
41
42
		if (vmInstall != null) {
43
			return vmInstall.getName();
44
		}
45
46
		return VMUtil.getDefaultVMInstallName();
47
	}
48
49
	public static IVMInstall getVMInstall(ILaunchConfiguration configuration) throws CoreException {
50
		String jre = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String) null);
51
		IVMInstall vm = null;
52
		if (jre == null) {
53
			String name = configuration.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null);
54
			if (name == null) {
55
				name = getDefaultVMInstallName(configuration);
56
			}
57
			vm = getVMInstall(name);
58
			if (vm == null) {
59
				throw new CoreException(LauncherUtils.createErrorStatus(NLS.bind(PDEUIMessages.WorkbenchLauncherConfigurationDelegate_noJRE, name)));
60
			}
61
		} else {
62
			IPath jrePath = Path.fromPortableString(jre);
63
			vm = JavaRuntime.getVMInstall(jrePath);
64
			if (vm == null) {
65
				String id = JavaRuntime.getExecutionEnvironmentId(jrePath);
66
				if (id == null) {
67
					String name = JavaRuntime.getVMInstallName(jrePath);
68
					throw new CoreException(LauncherUtils.createErrorStatus(NLS.bind(PDEUIMessages.WorkbenchLauncherConfigurationDelegate_noJRE, name)));
69
				}
70
				throw new CoreException(LauncherUtils.createErrorStatus(NLS.bind(PDEUIMessages.VMHelper_cannotFindExecEnv, id)));
71
			}
72
		}
73
		return vm;
74
	}
75
76
	public static IVMInstall getVMInstall(String name) {
77
		if (name != null) {
78
			IVMInstall[] installs = VMUtil.getAllVMInstances();
79
			for (int i = 0; i < installs.length; i++) {
80
				if (installs[i].getName().equals(name))
81
					return installs[i];
82
			}
83
		}
84
		return JavaRuntime.getDefaultVMInstall();
85
	}
86
87
	public static IVMInstall createLauncher(ILaunchConfiguration configuration) throws CoreException {
88
		IVMInstall launcher = getVMInstall(configuration);
89
		if (!launcher.getInstallLocation().exists())
90
			throw new CoreException(LauncherUtils.createErrorStatus(PDEUIMessages.WorkbenchLauncherConfigurationDelegate_jrePathNotFound));
91
		return launcher;
92
	}
93
94
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchArgumentsHelper.java (-332 lines)
Lines 1-332 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import java.io.File;
14
import java.io.IOException;
15
import java.net.URL;
16
import java.util.*;
17
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.core.variables.IStringVariableManager;
21
import org.eclipse.core.variables.VariablesPlugin;
22
import org.eclipse.debug.core.ILaunchConfiguration;
23
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
24
import org.eclipse.jdt.core.*;
25
import org.eclipse.jdt.launching.ExecutionArguments;
26
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
27
import org.eclipse.pde.core.plugin.*;
28
import org.eclipse.pde.internal.build.IPDEBuildConstants;
29
import org.eclipse.pde.internal.core.*;
30
import org.eclipse.pde.internal.core.target.provisional.ITargetHandle;
31
import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
32
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
33
import org.osgi.framework.Bundle;
34
35
public class LaunchArgumentsHelper {
36
37
	/**
38
	 * Returns the location that will be used as the workspace when launching.  Will
39
	 * replace variables, so this method should only be called
40
	 * when variable substitution (may prompt the user) is appropriate.
41
	 * @param configuration the launch configuration to get the workspace value for
42
	 * @return workspace location path as a string
43
	 * @throws CoreException if there is a problem with the configuration
44
	 */
45
	public static String getWorkspaceLocation(ILaunchConfiguration configuration) throws CoreException {
46
		String location = configuration.getAttribute(IPDELauncherConstants.LOCATION, (String) null);
47
		if (location == null) {
48
			// backward compatibility
49
			location = configuration.getAttribute(IPDELauncherConstants.LOCATION + "0", (String) null); //$NON-NLS-1$
50
			if (location != null) {
51
				ILaunchConfigurationWorkingCopy wc = null;
52
				if (configuration.isWorkingCopy()) {
53
					wc = (ILaunchConfigurationWorkingCopy) configuration;
54
				} else {
55
					wc = configuration.getWorkingCopy();
56
				}
57
				wc.setAttribute(IPDELauncherConstants.LOCATION + "0", (String) null); //$NON-NLS-1$
58
				wc.setAttribute(IPDELauncherConstants.LOCATION, location);
59
				wc.doSave();
60
			}
61
		}
62
		return getSubstitutedString(location);
63
	}
64
65
	public static String[] getUserProgramArgumentArray(ILaunchConfiguration configuration) throws CoreException {
66
		String args = getUserProgramArguments(configuration);
67
		return new ExecutionArguments("", args).getProgramArgumentsArray(); //$NON-NLS-1$
68
	}
69
70
	public static String getUserProgramArguments(ILaunchConfiguration configuration) throws CoreException {
71
		String args = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String) null);
72
		if (args == null) {
73
			// backward compatibility
74
			args = configuration.getAttribute("progargs", (String) null); //$NON-NLS-1$
75
			if (args != null) {
76
				ILaunchConfigurationWorkingCopy wc = null;
77
				if (configuration.isWorkingCopy()) {
78
					wc = (ILaunchConfigurationWorkingCopy) configuration;
79
				} else {
80
					wc = configuration.getWorkingCopy();
81
				}
82
				wc.setAttribute("progargs", (String) null); //$NON-NLS-1$
83
				wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args);
84
				wc.doSave();
85
			}
86
		}
87
		return args == null ? "" : getSubstitutedString(args); //$NON-NLS-1$
88
	}
89
90
	public static String getUserVMArguments(ILaunchConfiguration configuration) throws CoreException {
91
		String args = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, (String) null);
92
		if (args == null) {
93
			// backward compatibility
94
			args = configuration.getAttribute("vmargs", (String) null); //$NON-NLS-1$
95
			if (args != null) {
96
				ILaunchConfigurationWorkingCopy wc = null;
97
				if (configuration.isWorkingCopy()) {
98
					wc = (ILaunchConfigurationWorkingCopy) configuration;
99
				} else {
100
					wc = configuration.getWorkingCopy();
101
				}
102
				wc.setAttribute("vmargs", (String) null); //$NON-NLS-1$
103
				wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, args);
104
				wc.doSave();
105
			}
106
		}
107
		return args == null ? "" : getSubstitutedString(args); //$NON-NLS-1$
108
	}
109
110
	/**
111
	 * Fetches the VM Arguments from the current Target Platform
112
	 *  
113
	 * @return	VM Arguments from the current Target Platform or empty string if none found
114
	 */
115
	public static String getInitialVMArguments() {
116
117
		try {
118
			ITargetPlatformService service = (ITargetPlatformService) PDECore.getDefault().acquireService(ITargetPlatformService.class.getName());
119
			if (service != null) {
120
				ITargetHandle target = service.getWorkspaceTargetHandle();
121
				if (target != null) {
122
					String result = target.getTargetDefinition().getVMArguments();
123
					result = result != null ? result : ""; //$NON-NLS-1$
124
					return result;
125
				}
126
			}
127
		} catch (CoreException e) {
128
		}
129
130
		// TODO: Generally, once the new preference target platform preference page is in use,
131
		// this code path will not be used. Once we decide to remove support for old targets/preferences
132
		// this code can be removed.
133
		PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager();
134
		StringBuffer result = new StringBuffer(preferences.getString(ICoreConstants.VM_ARGS));
135
136
		if (preferences.getBoolean(ICoreConstants.VM_LAUNCHER_INI)) {
137
			// hack on the arguments from eclipse.ini
138
			result.append(TargetPlatformHelper.getIniVMArgs());
139
		}
140
		return result.toString();
141
	}
142
143
	public static String getInitialProgramArguments() {
144
		StringBuffer buffer = new StringBuffer("-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"); //$NON-NLS-1$
145
146
		PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager();
147
		String programArgs = preferences.getString(ICoreConstants.PROGRAM_ARGS);
148
		if (programArgs.length() > 0) {
149
			buffer.append(" "); //$NON-NLS-1$
150
			buffer.append(programArgs);
151
		}
152
		return buffer.toString();
153
	}
154
155
	public static File getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
156
		String working;
157
		try {
158
			working = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, new File(".").getCanonicalPath()); //$NON-NLS-1$
159
		} catch (IOException e) {
160
			working = "${workspace_loc}/../"; //$NON-NLS-1$
161
		}
162
		File dir = new File(getSubstitutedString(working));
163
		if (!dir.exists())
164
			dir.mkdirs();
165
		return dir;
166
	}
167
168
	public static Map getVMSpecificAttributesMap(ILaunchConfiguration config) throws CoreException {
169
		Map map = new HashMap(2);
170
		String javaCommand = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_JAVA_COMMAND, (String) null);
171
		map.put(IJavaLaunchConfigurationConstants.ATTR_JAVA_COMMAND, javaCommand);
172
		if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$
173
			ModelEntry entry = PluginRegistry.findEntry("org.eclipse.jdt.debug"); //$NON-NLS-1$
174
			if (entry != null) {
175
				IPluginModelBase[] models = entry.getExternalModels();
176
				for (int i = 0; i < models.length; i++) {
177
					File file = new File(models[i].getInstallLocation());
178
					if (!file.isFile())
179
						file = new File(file, "jdi.jar"); //$NON-NLS-1$
180
					if (file.exists()) {
181
						map.put(IJavaLaunchConfigurationConstants.ATTR_BOOTPATH_PREPEND, new String[] {file.getAbsolutePath()});
182
						break;
183
					}
184
				}
185
			}
186
		}
187
		return map;
188
	}
189
190
	public static String getTracingFileArgument(ILaunchConfiguration config, String optionsFileName) throws CoreException {
191
		try {
192
			TracingOptionsManager mng = PDECore.getDefault().getTracingOptionsManager();
193
			Map options = config.getAttribute(IPDELauncherConstants.TRACING_OPTIONS, (Map) null);
194
			String selected = config.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null);
195
			if (selected == null) {
196
				mng.save(optionsFileName, options);
197
			} else if (!selected.equals(IPDELauncherConstants.TRACING_NONE)) {
198
				HashSet result = new HashSet();
199
				StringTokenizer tokenizer = new StringTokenizer(selected, ","); //$NON-NLS-1$
200
				while (tokenizer.hasMoreTokens()) {
201
					result.add(tokenizer.nextToken());
202
				}
203
				mng.save(optionsFileName, options, result);
204
			}
205
		} catch (CoreException e) {
206
			return ""; //$NON-NLS-1$
207
		}
208
		return optionsFileName;
209
	}
210
211
	public static String[] constructClasspath(ILaunchConfiguration configuration) throws CoreException {
212
		double targetVersion = TargetPlatformHelper.getTargetVersion();
213
		String jarPath = targetVersion >= 3.3 ? getEquinoxStartupPath(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER) : getStartupJarPath();
214
		if (jarPath == null && targetVersion < 3.3)
215
			jarPath = getEquinoxStartupPath("org.eclipse.core.launcher"); //$NON-NLS-1$
216
217
		if (jarPath == null)
218
			return null;
219
220
		ArrayList entries = new ArrayList();
221
		entries.add(jarPath);
222
223
		String bootstrap = configuration.getAttribute(IPDELauncherConstants.BOOTSTRAP_ENTRIES, ""); //$NON-NLS-1$
224
		StringTokenizer tok = new StringTokenizer(getSubstitutedString(bootstrap), ","); //$NON-NLS-1$
225
		while (tok.hasMoreTokens())
226
			entries.add(tok.nextToken().trim());
227
		return (String[]) entries.toArray(new String[entries.size()]);
228
	}
229
230
	private static String getEquinoxStartupPath(String packageName) throws CoreException {
231
		IPluginModelBase model = PluginRegistry.findModel(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER);
232
		if (model != null) {
233
			IResource resource = model.getUnderlyingResource();
234
			// found in the target
235
			if (resource == null)
236
				return model.getInstallLocation();
237
238
			// find it in the workspace
239
			IProject project = resource.getProject();
240
			if (project.hasNature(JavaCore.NATURE_ID)) {
241
				IJavaProject jProject = JavaCore.create(project);
242
				IClasspathEntry[] entries = jProject.getRawClasspath();
243
				for (int i = 0; i < entries.length; i++) {
244
					int kind = entries[i].getEntryKind();
245
					if (kind == IClasspathEntry.CPE_SOURCE || kind == IClasspathEntry.CPE_LIBRARY) {
246
						IPackageFragmentRoot[] roots = jProject.findPackageFragmentRoots(entries[i]);
247
						for (int j = 0; j < roots.length; j++) {
248
							if (roots[j].getPackageFragment(packageName).exists()) {
249
								// if source folder, find the output folder
250
								if (kind == IClasspathEntry.CPE_SOURCE) {
251
									IPath path = entries[i].getOutputLocation();
252
									if (path == null)
253
										path = jProject.getOutputLocation();
254
									path = path.removeFirstSegments(1);
255
									return project.getLocation().append(path).toOSString();
256
								}
257
								// else if is a library jar, then get the location of the jar itself
258
								IResource jar = roots[j].getResource();
259
								if (jar != null) {
260
									return jar.getLocation().toOSString();
261
								}
262
							}
263
						}
264
					}
265
				}
266
			}
267
		}
268
		Bundle bundle = Platform.getBundle(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER);
269
		if (bundle != null) {
270
			try {
271
				URL url = FileLocator.resolve(bundle.getEntry("/")); //$NON-NLS-1$
272
				url = FileLocator.toFileURL(url);
273
				String path = url.getFile();
274
				if (path.startsWith("file:")) //$NON-NLS-1$
275
					path = path.substring(5);
276
				path = new File(path).getAbsolutePath();
277
				if (path.endsWith("!")) //$NON-NLS-1$
278
					path = path.substring(0, path.length() - 1);
279
				return path;
280
			} catch (IOException e) {
281
			}
282
		}
283
		return null;
284
	}
285
286
	private static String getStartupJarPath() throws CoreException {
287
		IPluginModelBase model = PluginRegistry.findModel("org.eclipse.platform"); //$NON-NLS-1$
288
		if (model != null && model.getUnderlyingResource() != null) {
289
			IProject project = model.getUnderlyingResource().getProject();
290
			if (project.hasNature(JavaCore.NATURE_ID)) {
291
				IJavaProject jProject = JavaCore.create(project);
292
				IPackageFragmentRoot[] roots = jProject.getPackageFragmentRoots();
293
				for (int i = 0; i < roots.length; i++) {
294
					if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE && roots[i].getPackageFragment("org.eclipse.core.launcher").exists()) { //$NON-NLS-1$
295
						IPath path = jProject.getOutputLocation().removeFirstSegments(1);
296
						return project.getLocation().append(path).toOSString();
297
					}
298
				}
299
			}
300
			if (project.getFile("startup.jar").exists()) //$NON-NLS-1$
301
				return project.getFile("startup.jar").getLocation().toOSString(); //$NON-NLS-1$
302
		}
303
		File startupJar = new Path(TargetPlatform.getLocation()).append("startup.jar").toFile(); //$NON-NLS-1$
304
305
		// if something goes wrong with the preferences, fall back on the startup.jar 
306
		// in the running eclipse.  
307
		if (!startupJar.exists())
308
			startupJar = new Path(TargetPlatform.getDefaultLocation()).append("startup.jar").toFile(); //$NON-NLS-1$
309
310
		return startupJar.exists() ? startupJar.getAbsolutePath() : null;
311
	}
312
313
	private static String getSubstitutedString(String text) throws CoreException {
314
		if (text == null)
315
			return ""; //$NON-NLS-1$
316
		IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
317
		return mgr.performStringSubstitution(text);
318
	}
319
320
	public static String getDefaultWorkspaceLocation(String uniqueName) {
321
		return "${workspace_loc}/../runtime-" + uniqueName.replaceAll("\\s", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
322
	}
323
324
	public static String getDefaultJUnitWorkspaceLocation() {
325
		return "${workspace_loc}/../junit-workspace"; //$NON-NLS-1$
326
	}
327
328
	public static String getDefaultJUnitConfigurationLocation() {
329
		return "${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"; //$NON-NLS-1$
330
	}
331
332
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchConfigurationHelper.java (-453 lines)
Lines 1-453 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import java.io.*;
14
import java.net.URL;
15
import java.util.*;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.variables.IStringVariableManager;
18
import org.eclipse.core.variables.VariablesPlugin;
19
import org.eclipse.debug.core.ILaunchConfiguration;
20
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
21
import org.eclipse.osgi.service.resolver.BundleDescription;
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
23
import org.eclipse.pde.core.plugin.TargetPlatform;
24
import org.eclipse.pde.internal.build.IPDEBuildConstants;
25
import org.eclipse.pde.internal.core.*;
26
import org.eclipse.pde.internal.ui.PDEPlugin;
27
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
28
29
/**
30
 * Contains helper methods for launching an Eclipse Runtime Workbench
31
 */
32
public class LaunchConfigurationHelper {
33
34
	private static final String PROP_OSGI_FRAMEWORK = "osgi.framework"; //$NON-NLS-1$
35
	private static final String PROP_OSGI_BUNDLES = "osgi.bundles"; //$NON-NLS-1$
36
	private static final String PROP_P2_DATA_AREA = "eclipse.p2.data.area"; //$NON-NLS-1$
37
38
	public static void synchronizeManifests(ILaunchConfiguration config, File configDir) {
39
		try {
40
			String programArgs = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
41
			if (programArgs.indexOf("-clean") != -1) //$NON-NLS-1$
42
				return;
43
		} catch (CoreException e) {
44
		}
45
		File dir = new File(configDir, "org.eclipse.osgi/manifests"); //$NON-NLS-1$
46
		if (dir.exists() && dir.isDirectory()) {
47
			PDECore.getDefault().getJavaElementChangeListener().synchronizeManifests(dir);
48
		}
49
	}
50
51
	public static File getConfigurationArea(ILaunchConfiguration config) {
52
		File dir = getConfigurationLocation(config);
53
		if (!dir.exists())
54
			dir.mkdirs();
55
		return dir;
56
	}
57
58
	public static File getConfigurationLocation(ILaunchConfiguration config) {
59
		//bug 170213 change config location if config name contains #
60
		String configName = config.getName();
61
		configName = configName.replace('#', 'h');
62
		File dir = new File(PDECore.getDefault().getStateLocation().toOSString(), configName);
63
		try {
64
			if (!config.getAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, true)) {
65
				String userPath = config.getAttribute(IPDELauncherConstants.CONFIG_LOCATION, (String) null);
66
				if (userPath != null) {
67
					userPath = getSubstitutedString(userPath);
68
					dir = new File(userPath).getAbsoluteFile();
69
				}
70
			}
71
		} catch (CoreException e) {
72
		}
73
		return dir;
74
	}
75
76
	private static String getSubstitutedString(String text) throws CoreException {
77
		if (text == null)
78
			return ""; //$NON-NLS-1$
79
		IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
80
		return mgr.performStringSubstitution(text);
81
	}
82
83
	public static Properties createConfigIniFile(ILaunchConfiguration configuration, String productID, Map bundles, Map bundlesWithStartLevels, File directory) throws CoreException {
84
		Properties properties = null;
85
		// if we are to generate a config.ini, start with the values in the target platform's config.ini - bug 141918
86
		if (configuration.getAttribute(IPDELauncherConstants.CONFIG_GENERATE_DEFAULT, true)) {
87
			properties = TargetPlatformHelper.getConfigIniProperties();
88
			// if target's config.ini does not exist, lets try to fill in default values
89
			if (properties == null)
90
				properties = new Properties();
91
			// keep properties only if we are launching the default product (bug 175437)
92
			else if (productID == null || !productID.equals(properties.get("eclipse.product"))) //$NON-NLS-1$
93
				properties.clear();
94
			// if target's config.ini has the osgi.bundles header, then parse and compute the proper osgi.bundles value
95
			String bundleList = properties.getProperty(PROP_OSGI_BUNDLES);
96
			if (bundleList != null)
97
				properties.setProperty(PROP_OSGI_BUNDLES, computeOSGiBundles(TargetPlatformHelper.stripPathInformation(bundleList), bundles, bundlesWithStartLevels));
98
			String dataArea = properties.getProperty(PROP_P2_DATA_AREA);
99
			if (dataArea != null) {
100
				// Make the p2 data area in the configuration area itself, rather than a sibling of the configuration
101
				// area (which is a the root pde.core shared metadata area) @see bug 272810
102
				properties.setProperty(PROP_P2_DATA_AREA, "@config.dir/.p2"); //$NON-NLS-1$
103
			}
104
		} else {
105
			String templateLoc = configuration.getAttribute(IPDELauncherConstants.CONFIG_TEMPLATE_LOCATION, (String) null);
106
			if (templateLoc != null) {
107
				properties = loadFromTemplate(getSubstitutedString(templateLoc));
108
				// if template contains osgi.bundles, then only strip the path, do not compute the value
109
				String osgiBundles = properties.getProperty(PROP_OSGI_BUNDLES);
110
				if (osgiBundles != null)
111
					properties.setProperty(PROP_OSGI_BUNDLES, TargetPlatformHelper.stripPathInformation(osgiBundles));
112
			}
113
		}
114
		// whether we create a new config.ini or read from one as a template, we should add the required properties - bug 161265
115
		if (properties != null) {
116
			addRequiredProperties(properties, productID, bundles, bundlesWithStartLevels);
117
		} else {
118
			properties = new Properties();
119
		}
120
		if (!directory.exists()) {
121
			directory.mkdirs();
122
		}
123
		String osgiBundles = properties.getProperty(PROP_OSGI_BUNDLES);
124
		int start = configuration.getAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4);
125
		properties.put("osgi.bundles.defaultStartLevel", Integer.toString(start)); //$NON-NLS-1$
126
		boolean autostart = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, false);
127
128
		// if we are launching using P2, write out P2 files (bundles.txt) and add P2 property to config.ini
129
		if (osgiBundles != null && osgiBundles.indexOf(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR) != -1 && bundles.containsKey(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR)) {
130
			URL bundlesTxt = null;
131
			boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true);
132
			boolean useFeatures = configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false);
133
			if (usedefault || useFeatures) {
134
				bundlesTxt = P2Utils.writeBundlesTxt(bundlesWithStartLevels, 4, false, directory, osgiBundles);
135
			} else {
136
				bundlesTxt = P2Utils.writeBundlesTxt(bundlesWithStartLevels, start, autostart, directory, null);
137
			}
138
139
			if (bundlesTxt != null) {
140
				properties.setProperty("org.eclipse.equinox.simpleconfigurator.configUrl", bundlesTxt.toString()); //$NON-NLS-1$
141
				// if we have simple configurator and update configurator together, ensure update doesn't reconcile
142
				if (bundles.get(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR) != null) {
143
					properties.setProperty("org.eclipse.update.reconcile", "false"); //$NON-NLS-1$ //$NON-NLS-2$
144
				}
145
			}
146
		}
147
148
		setBundleLocations(bundles, properties, autostart);
149
150
		save(new File(directory, "config.ini"), properties); //$NON-NLS-1$
151
		return properties;
152
	}
153
154
	private static void addRequiredProperties(Properties properties, String productID, Map bundles, Map bundlesWithStartLevels) {
155
		if (!properties.containsKey("osgi.install.area")) //$NON-NLS-1$
156
			properties.setProperty("osgi.install.area", "file:" + TargetPlatform.getLocation()); //$NON-NLS-1$ //$NON-NLS-2$
157
		if (!properties.containsKey("osgi.configuration.cascaded")) //$NON-NLS-1$
158
			properties.setProperty("osgi.configuration.cascaded", "false"); //$NON-NLS-1$ //$NON-NLS-2$
159
		if (!properties.containsKey(PROP_OSGI_FRAMEWORK))
160
			properties.setProperty(PROP_OSGI_FRAMEWORK, IPDEBuildConstants.BUNDLE_OSGI);
161
		if (!properties.containsKey("osgi.splashPath") && productID != null) //$NON-NLS-1$
162
			addSplashLocation(properties, productID, bundles);
163
		// if osgi.splashPath is set, try to resolve relative paths to absolute paths
164
		if (properties.containsKey("osgi.splashPath")) //$NON-NLS-1$
165
			resolveLocationPath(properties.getProperty("osgi.splashPath"), properties, bundles); //$NON-NLS-1$
166
		if (!properties.containsKey(PROP_OSGI_BUNDLES))
167
			properties.setProperty(PROP_OSGI_BUNDLES, computeOSGiBundles(TargetPlatform.getBundleList(), bundles, bundlesWithStartLevels));
168
		if (!properties.containsKey("osgi.bundles.defaultStartLevel")) //$NON-NLS-1$
169
			properties.setProperty("osgi.bundles.defaultStartLevel", "4"); //$NON-NLS-1$ //$NON-NLS-2$
170
	}
171
172
	/**
173
	 * Computes a list of osgi bundles to be put into the osgi.bundles property based
174
	 * on the bundles from the target platform config.ini and a map of bundles we are
175
	 * launching with.  The list of bundles must have already had it's path information
176
	 * removed.
177
	 * @param bundleList list of bundles without path information
178
	 * @param bundles map of bundle id to bundle model, contains all bundles being launched with
179
	 * @param bundlesWithStartLevels map of bundles of start level
180
	 * @return string list of osgi bundles
181
	 */
182
	private static String computeOSGiBundles(String bundleList, Map bundles, Map bundlesWithStartLevels) {
183
184
		// if p2 and only simple configurator and 
185
		// if simple configurator isn't selected & isn't in bundle list... hack it
186
187
		// if using p2's simple configurator, a bundles.txt will be written, so we only need simple configurator in the config.ini
188
		if (bundles.get(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR) != null)
189
			return "org.eclipse.equinox.simpleconfigurator@1:start"; //$NON-NLS-1$
190
191
		StringBuffer buffer = new StringBuffer();
192
		Set initialBundleSet = new HashSet();
193
		StringTokenizer tokenizer = new StringTokenizer(bundleList, ","); //$NON-NLS-1$
194
		while (tokenizer.hasMoreTokens()) {
195
			String token = tokenizer.nextToken();
196
			int index = token.indexOf('@');
197
			String id = index != -1 ? token.substring(0, index) : token;
198
			if (bundles.containsKey(id)) {
199
				if (buffer.length() > 0)
200
					buffer.append(',');
201
				buffer.append(id);
202
				if (index != -1 && index < token.length() - 1)
203
					buffer.append(token.substring(index));
204
				initialBundleSet.add(id);
205
			}
206
		}
207
208
		// if org.eclipse.update.configurator is not included (LIKE IN BASIC RCP APPLICATION), then write out all bundles in osgi.bundles - bug 170772
209
		if (!initialBundleSet.contains(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR)) {
210
			initialBundleSet.add(IPDEBuildConstants.BUNDLE_OSGI);
211
			Iterator iter = bundlesWithStartLevels.keySet().iterator();
212
			while (iter.hasNext()) {
213
				IPluginModelBase model = (IPluginModelBase) iter.next();
214
				String id = model.getPluginBase().getId();
215
				if (!initialBundleSet.contains(id)) {
216
					if (buffer.length() > 0)
217
						buffer.append(',');
218
219
					String slinfo = (String) bundlesWithStartLevels.get(model);
220
					buffer.append(id);
221
					buffer.append('@');
222
					buffer.append(slinfo);
223
				}
224
			}
225
		}
226
		return buffer.toString();
227
	}
228
229
	private static Properties loadFromTemplate(String templateLoc) throws CoreException {
230
		Properties properties = new Properties();
231
		File templateFile = new File(templateLoc);
232
		if (templateFile.exists() && templateFile.isFile()) {
233
			FileInputStream stream = null;
234
			try {
235
				stream = new FileInputStream(templateFile);
236
				properties.load(stream);
237
			} catch (Exception e) {
238
				String message = e.getMessage();
239
				if (message != null)
240
					throw new CoreException(new Status(IStatus.ERROR, PDEPlugin.getPluginId(), IStatus.ERROR, message, e));
241
			} finally {
242
				if (stream != null) {
243
					try {
244
						stream.close();
245
					} catch (IOException e) {
246
					}
247
				}
248
			}
249
		}
250
		return properties;
251
	}
252
253
	private static void addSplashLocation(Properties properties, String productID, Map map) {
254
		Properties targetConfig = TargetPlatformHelper.getConfigIniProperties();
255
		String targetProduct = targetConfig == null ? null : targetConfig.getProperty("eclipse.product"); //$NON-NLS-1$
256
		String targetSplash = targetConfig == null ? null : targetConfig.getProperty("osgi.splashPath"); //$NON-NLS-1$
257
		if (!productID.equals(targetProduct) || targetSplash == null) {
258
			ArrayList locations = new ArrayList();
259
			String plugin = getContributingPlugin(productID);
260
			locations.add(plugin);
261
			IPluginModelBase model = (IPluginModelBase) map.get(plugin);
262
			if (model != null) {
263
				BundleDescription desc = model.getBundleDescription();
264
				if (desc != null) {
265
					BundleDescription[] fragments = desc.getFragments();
266
					for (int i = 0; i < fragments.length; i++)
267
						locations.add(fragments[i].getSymbolicName());
268
				}
269
			}
270
			resolveLocationPath(locations, properties, map);
271
		} else
272
			resolveLocationPath(targetSplash, properties, map);
273
	}
274
275
	private static void resolveLocationPath(String splashPath, Properties properties, Map map) {
276
		ArrayList locations = new ArrayList();
277
		StringTokenizer tok = new StringTokenizer(splashPath, ","); //$NON-NLS-1$
278
		while (tok.hasMoreTokens())
279
			locations.add(tok.nextToken());
280
		resolveLocationPath(locations, properties, map);
281
	}
282
283
	private static void resolveLocationPath(ArrayList locations, Properties properties, Map map) {
284
		StringBuffer buffer = new StringBuffer();
285
		for (int i = 0; i < locations.size(); i++) {
286
			String location = (String) locations.get(i);
287
			if (location.startsWith("platform:/base/plugins/")) { //$NON-NLS-1$
288
				location = location.replaceFirst("platform:/base/plugins/", ""); //$NON-NLS-1$ //$NON-NLS-2$
289
			}
290
			String url = getBundleURL(location, map, false);
291
			if (url == null)
292
				continue;
293
			if (buffer.length() > 0)
294
				buffer.append(","); //$NON-NLS-1$
295
			buffer.append(url);
296
		}
297
		if (buffer.length() > 0)
298
			properties.setProperty("osgi.splashPath", buffer.toString()); //$NON-NLS-1$
299
	}
300
301
	/**
302
	 * Returns a string url representing the install location of the bundle model with the
303
	 * specified id.  The model is obtained using the provided map.
304
	 * @param id the id of the bundle
305
	 * @param pluginMap mapping of bundle ids to bundle models
306
	 * @param includeReference whether to prefix the url with 'reference:'
307
	 * @return string url for the bundle location
308
	 */
309
	public static String getBundleURL(String id, Map pluginMap, boolean includeReference) {
310
		IPluginModelBase model = (IPluginModelBase) pluginMap.get(id.trim());
311
		return getBundleURL(model, includeReference);
312
	}
313
314
	/**
315
	 * Returns a string url representing the install location of the given bundle model
316
	 * @param model the model to create the url for
317
	 * @param includeReference whether to prefix the url with 'reference:'
318
	 * @return string url for bundle location
319
	 */
320
	public static String getBundleURL(IPluginModelBase model, boolean includeReference) {
321
		if (model == null || model.getInstallLocation() == null)
322
			return null;
323
		StringBuffer buf = new StringBuffer();
324
		if (includeReference) {
325
			buf.append(TargetPlatformHelper.REFERENCE_PREFIX);
326
		}
327
		buf.append(TargetPlatformHelper.FILE_URL_PREFIX);
328
		buf.append(new Path(model.getInstallLocation()).removeTrailingSeparator().toString());
329
		return buf.toString();
330
	}
331
332
	/**
333
	 * Use the map of bundles we are launching with to update the osgi.framework
334
	 * and osgi.bundles properties with the correct info.
335
	 * @param map map of bundles being launched (id mapped to model)
336
	 * @param properties properties for config.ini
337
	 */
338
	private static void setBundleLocations(Map map, Properties properties, boolean defaultAuto) {
339
		String framework = properties.getProperty(PROP_OSGI_FRAMEWORK);
340
		if (framework != null) {
341
			framework = TargetPlatformHelper.stripPathInformation(framework);
342
			String url = getBundleURL(framework, map, false);
343
			if (url != null)
344
				properties.setProperty(PROP_OSGI_FRAMEWORK, url);
345
		}
346
347
		String bundles = properties.getProperty(PROP_OSGI_BUNDLES);
348
		if (bundles != null) {
349
			StringBuffer buffer = new StringBuffer();
350
			StringTokenizer tokenizer = new StringTokenizer(bundles, ","); //$NON-NLS-1$
351
			while (tokenizer.hasMoreTokens()) {
352
				String token = tokenizer.nextToken().trim();
353
				String url = getBundleURL(token, map, false);
354
				int i = -1;
355
				if (url == null) {
356
					i = token.indexOf('@');
357
					if (i != -1) {
358
						url = getBundleURL(token.substring(0, i), map, false);
359
					}
360
					if (url == null) {
361
						i = token.indexOf(':');
362
						if (i != -1)
363
							url = getBundleURL(token.substring(0, i), map, false);
364
					}
365
				}
366
				if (url != null) {
367
					if (buffer.length() > 0) {
368
						buffer.append(","); //$NON-NLS-1$
369
					}
370
					buffer.append("reference:" + url); //$NON-NLS-1$
371
					if (i != -1) {
372
						String slinfo = token.substring(i + 1);
373
						buffer.append(getStartData(slinfo, defaultAuto));
374
					}
375
				}
376
			}
377
			properties.setProperty(PROP_OSGI_BUNDLES, buffer.toString());
378
		}
379
	}
380
381
	/**
382
	 * Convenience method to parses the startData ("startLevel:autoStart"), convert it to the
383
	 * format expected by the OSGi bundles property, and append to a StringBuffer.
384
	 * @param startData data to parse ("startLevel:autoStart")
385
	 * @param defaultAuto default auto start setting
386
	 */
387
	public static String getStartData(String startData, boolean defaultAuto) {
388
		StringBuffer buffer = new StringBuffer();
389
		int index = startData.indexOf(':');
390
		String level = index > 0 ? startData.substring(0, index) : "default"; //$NON-NLS-1$
391
		String auto = startData;
392
		if (!startData.equals("start")) //$NON-NLS-1$
393
			auto = index >= 0 && index < startData.length() - 1 ? startData.substring(index + 1) : "default"; //$NON-NLS-1$
394
		if ("default".equals(auto)) //$NON-NLS-1$
395
			auto = Boolean.toString(defaultAuto);
396
		if (!level.equals("default") || "true".equals(auto) || "start".equals(auto)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
397
			buffer.append("@"); //$NON-NLS-1$
398
399
		if (!level.equals("default")) { //$NON-NLS-1$
400
			buffer.append(level);
401
			if ("start".equals(auto) || "true".equals(auto)) //$NON-NLS-1$ //$NON-NLS-2$
402
				buffer.append(":"); //$NON-NLS-1$
403
		}
404
		if ("start".equals(auto) || "true".equals(auto)) { //$NON-NLS-1$ //$NON-NLS-2$
405
			buffer.append("start"); //$NON-NLS-1$
406
		}
407
		return buffer.toString();
408
	}
409
410
	public static void save(File file, Properties properties) {
411
		try {
412
			FileOutputStream stream = new FileOutputStream(file);
413
			properties.store(stream, "Configuration File"); //$NON-NLS-1$
414
			stream.flush();
415
			stream.close();
416
		} catch (IOException e) {
417
			PDECore.logException(e);
418
		}
419
	}
420
421
	public static String getContributingPlugin(String productID) {
422
		if (productID == null)
423
			return null;
424
		int index = productID.lastIndexOf('.');
425
		return index == -1 ? productID : productID.substring(0, index);
426
	}
427
428
	public static String getProductID(ILaunchConfiguration configuration) throws CoreException {
429
		if (configuration.getAttribute(IPDELauncherConstants.USE_PRODUCT, false)) {
430
			return configuration.getAttribute(IPDELauncherConstants.PRODUCT, (String) null);
431
		}
432
433
		// find the product associated with the application, and return its
434
		// contributing plug-in
435
		String appID = configuration.getAttribute(IPDELauncherConstants.APPLICATION, TargetPlatform.getDefaultApplication());
436
		IExtension[] extensions = PDECore.getDefault().getExtensionsRegistry().findExtensions("org.eclipse.core.runtime.products", true); //$NON-NLS-1$
437
		for (int i = 0; i < extensions.length; i++) {
438
			String id = extensions[i].getUniqueIdentifier();
439
			if (id == null)
440
				continue;
441
			IConfigurationElement[] children = extensions[i].getConfigurationElements();
442
			if (children.length != 1)
443
				continue;
444
			if (!"product".equals(children[0].getName())) //$NON-NLS-1$
445
				continue;
446
			if (appID.equals(children[0].getAttribute("application"))) //$NON-NLS-1$
447
				return id;
448
		}
449
		return null;
450
451
	}
452
453
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/OSGiMigrationDelegate.java (-42 lines)
Lines 1-42 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2007, 2008 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
16
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
17
import org.eclipse.pde.internal.ui.IPDEUIConstants;
18
19
public class OSGiMigrationDelegate extends PDEMigrationDelegate {
20
21
	public boolean isCandidate(ILaunchConfiguration candidate) throws CoreException {
22
		return super.isCandidate(candidate) || !candidate.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, "").equals("3.3"); //$NON-NLS-1$ //$NON-NLS-2$
23
	}
24
25
	public void migrate(ILaunchConfigurationWorkingCopy wc) throws CoreException {
26
		if (!wc.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, "").equals("3.3")) { //$NON-NLS-1$ //$NON-NLS-2$
27
			wc.setAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, "3.3"); //$NON-NLS-1$
28
			StringBuffer vmArgs = new StringBuffer(wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "")); //$NON-NLS-1$
29
			if (vmArgs.indexOf("-Declipse.ignoreApp") == -1) { //$NON-NLS-1$
30
				if (vmArgs.length() > 0)
31
					vmArgs.append(" "); //$NON-NLS-1$
32
				vmArgs.append("-Declipse.ignoreApp=true"); //$NON-NLS-1$
33
			}
34
			if (vmArgs.indexOf("-Dosgi.noShutdown") == -1) { //$NON-NLS-1$
35
				vmArgs.append(" -Dosgi.noShutdown=true"); //$NON-NLS-1$
36
			}
37
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs.toString());
38
		}
39
		super.migrate(wc);
40
	}
41
42
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PDESourceLookupQuery.java (-258 lines)
Lines 1-258 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import java.io.File;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.ISafeRunnable;
16
import org.eclipse.debug.core.DebugException;
17
import org.eclipse.debug.core.model.IValue;
18
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
19
import org.eclipse.jdt.debug.core.*;
20
import org.eclipse.osgi.service.resolver.BundleDescription;
21
import org.eclipse.osgi.service.resolver.State;
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
23
import org.eclipse.pde.internal.core.PDECore;
24
import org.eclipse.pde.internal.core.TargetPlatformHelper;
25
26
public class PDESourceLookupQuery implements ISafeRunnable {
27
28
	protected static String OSGI_CLASSLOADER = "org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader"; //$NON-NLS-1$
29
	private static String LEGACY_ECLIPSE_CLASSLOADER = "org.eclipse.core.runtime.adaptor.EclipseClassLoader"; //$NON-NLS-1$
30
	private static String MAIN_CLASS = "org.eclipse.core.launcher.Main"; //$NON-NLS-1$
31
	private static String MAIN_PLUGIN = "org.eclipse.platform"; //$NON-NLS-1$
32
33
	private Object fElement;
34
	private Object fResult;
35
	private PDESourceLookupDirector fDirector;
36
37
	public PDESourceLookupQuery(PDESourceLookupDirector director, Object object) {
38
		fElement = object;
39
		fDirector = director;
40
	}
41
42
	public void handleException(Throwable exception) {
43
	}
44
45
	public void run() throws Exception {
46
		IJavaObject classLoaderObject = null;
47
		String declaringTypeName = null;
48
		String sourcePath = null;
49
		if (fElement instanceof IJavaStackFrame) {
50
			IJavaStackFrame stackFrame = (IJavaStackFrame) fElement;
51
			classLoaderObject = stackFrame.getReferenceType().getClassLoaderObject();
52
			declaringTypeName = stackFrame.getDeclaringTypeName();
53
			sourcePath = generateSourceName(declaringTypeName);
54
		} else if (fElement instanceof IJavaObject) {
55
			IJavaObject object = (IJavaObject) fElement;
56
			IJavaReferenceType type = (IJavaReferenceType) object.getJavaType();
57
			if (type != null) {
58
				classLoaderObject = type.getClassLoaderObject();
59
				if (object.getJavaType() != null) {
60
					declaringTypeName = object.getJavaType().getName();
61
				}
62
				if (declaringTypeName != null) {
63
					sourcePath = generateSourceName(declaringTypeName);
64
				}
65
			}
66
		} else if (fElement instanceof IJavaReferenceType) {
67
			IJavaReferenceType type = (IJavaReferenceType) fElement;
68
			classLoaderObject = type.getClassLoaderObject();
69
			declaringTypeName = type.getName();
70
			sourcePath = generateSourceName(declaringTypeName);
71
		}
72
73
		if (classLoaderObject != null) {
74
			IJavaClassType type = (IJavaClassType) classLoaderObject.getJavaType();
75
			if (OSGI_CLASSLOADER.equals(type.getName())) {
76
				if (fDirector.getOSGiRuntimeVersion() < 3.5) {
77
					fResult = findSourceElement34(classLoaderObject, sourcePath);
78
				} else {
79
					fResult = findSourceElement(classLoaderObject, sourcePath);
80
				}
81
			} else if (LEGACY_ECLIPSE_CLASSLOADER.equals(type.getName())) {
82
				fResult = findSourceElement_legacy(classLoaderObject, sourcePath);
83
			} else if (MAIN_CLASS.equals(declaringTypeName)) {
84
				IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(MAIN_PLUGIN);
85
				if (model != null)
86
					fResult = getSourceElement(model.getInstallLocation(), MAIN_PLUGIN, sourcePath);
87
			}
88
		}
89
	}
90
91
	protected Object getResult() {
92
		return fResult;
93
	}
94
95
	private String getValue(IJavaObject object, String variable) throws DebugException {
96
		IJavaFieldVariable var = object.getField(variable, false);
97
		return var == null ? null : var.getValue().getValueString();
98
	}
99
100
	/**
101
	 * Finds a source element in a 3.4 OSGi runtime.
102
	 * 
103
	 * @param object Bundle class loader object
104
	 * @param typeName fully qualified name of the source type being searched for
105
	 * @return source element
106
	 * @throws CoreException
107
	 */
108
	protected Object findSourceElement34(IJavaObject object, String typeName) throws CoreException {
109
		IJavaObject manager = getObject(object, "manager", false); //$NON-NLS-1$
110
		if (manager != null) {
111
			IJavaObject data = getObject(manager, "data", false); //$NON-NLS-1$
112
			if (data != null) {
113
				String location = getValue(data, "fileName"); //$NON-NLS-1$
114
				String id = getValue(data, "symbolicName"); //$NON-NLS-1$
115
				return getSourceElement(location, id, typeName);
116
			}
117
		}
118
		return null;
119
	}
120
121
	/**
122
	 * Finds source in a 3.5 runtime. In 3.5, the OSGi runtime provides hooks to properly
123
     * lookup source in fragments that replace/prepend jars in their host.
124
	 * 
125
	 * @param object Bundle class loader object
126
	 * @param typeName fully qualified name of the source type being searched for 
127
	 * @return source element
128
	 * @throws CoreException
129
	 */
130
	protected Object findSourceElement(IJavaObject object, String typeName) throws CoreException {
131
		IJavaObject manager = getObject(object, "manager", false); //$NON-NLS-1$
132
		if (manager != null) {
133
			IJavaObject data = getObject(manager, "data", false); //$NON-NLS-1$
134
			if (data != null) {
135
				String id = getValue(data, "symbolicName"); //$NON-NLS-1$
136
				// search manager's class path for location
137
				Object result = searchClasspathEntries(manager, id, typeName);
138
				if (result != null) {
139
					return result;
140
				}
141
				// then check its fragments
142
				IJavaObject frgArray = getObject(manager, "fragments", false); //$NON-NLS-1$
143
				if (frgArray instanceof IJavaArray) {
144
					IJavaArray fragments = (IJavaArray) frgArray;
145
					for (int i = 0; i < fragments.getLength(); i++) {
146
						IJavaObject fragment = (IJavaObject) fragments.getValue(i);
147
						if (!fragment.isNull()) {
148
							// search fragment class path
149
							result = searchClasspathEntries(fragment, id, typeName);
150
							if (result != null) {
151
								return result;
152
							}
153
						}
154
155
					}
156
				}
157
			}
158
		}
159
		return null;
160
	}
161
162
	private Object searchClasspathEntries(IJavaObject entriesOwner, String id, String typeName) throws CoreException {
163
		IJavaObject cpeArray = getObject(entriesOwner, "entries", false); //$NON-NLS-1$
164
		if (cpeArray instanceof IJavaArray) {
165
			IJavaArray entries = (IJavaArray) cpeArray;
166
			for (int i = 0; i < entries.getLength(); i++) {
167
				IJavaObject entry = (IJavaObject) entries.getValue(i);
168
				if (!entry.isNull()) {
169
					IJavaObject baseData = getObject(entry, "data", false); //$NON-NLS-1$
170
					if (baseData != null && !baseData.isNull()) {
171
						IJavaObject fileName = getObject(baseData, "fileName", false); //$NON-NLS-1$
172
						if (fileName != null && !fileName.isNull()) {
173
							String location = fileName.getValueString();
174
							Object el = getSourceElement(location, id, typeName);
175
							if (el != null) {
176
								return el;
177
							}
178
						}
179
					}
180
				}
181
			}
182
		}
183
		return null;
184
	}
185
186
	private IJavaObject getObject(IJavaObject object, String field, boolean superfield) throws DebugException {
187
		IJavaFieldVariable variable = object.getField(field, superfield);
188
		if (variable != null) {
189
			IValue value = variable.getValue();
190
			if (value instanceof IJavaObject)
191
				return (IJavaObject) value;
192
		}
193
		return null;
194
	}
195
196
	private Object findSourceElement_legacy(IJavaObject object, String typeName) throws CoreException {
197
		IJavaObject hostdata = getObject(object, "hostdata", true); //$NON-NLS-1$
198
		if (hostdata != null) {
199
			String location = getValue(hostdata, "fileName"); //$NON-NLS-1$
200
			String id = getValue(hostdata, "symbolicName"); //$NON-NLS-1$
201
			return getSourceElement(location, id, typeName);
202
		}
203
		return null;
204
	}
205
206
	private Object getSourceElement(String location, String id, String typeName) throws CoreException {
207
		if (location != null && id != null) {
208
			Object result = findSourceElement(getSourceContainers(location, id), typeName);
209
			if (result != null)
210
				return result;
211
212
			// don't give up yet, search fragments attached to this host
213
			State state = TargetPlatformHelper.getState();
214
			BundleDescription desc = state.getBundle(id, null);
215
			if (desc != null) {
216
				BundleDescription[] fragments = desc.getFragments();
217
				for (int i = 0; i < fragments.length; i++) {
218
					location = fragments[i].getLocation();
219
					id = fragments[i].getSymbolicName();
220
					result = findSourceElement(getSourceContainers(location, id), typeName);
221
					if (result != null)
222
						return result;
223
				}
224
			}
225
		}
226
		return null;
227
	}
228
229
	private Object findSourceElement(ISourceContainer[] containers, String typeName) throws CoreException {
230
		for (int i = 0; i < containers.length; i++) {
231
			Object[] result = containers[i].findSourceElements(typeName);
232
			if (result.length > 0)
233
				return result[0];
234
		}
235
		return null;
236
	}
237
238
	protected ISourceContainer[] getSourceContainers(String location, String id) throws CoreException {
239
		return fDirector.getSourceContainers(location, id);
240
	}
241
242
	/**
243
	 * Generates and returns a source file path based on a qualified type name.
244
	 * For example, when <code>java.lang.String</code> is provided,
245
	 * the returned source name is <code>java/lang/String.java</code>.
246
	 * 
247
	 * @param qualifiedTypeName fully qualified type name that may contain inner types
248
	 *  denoted with <code>$</code> character
249
	 * @return a source file path corresponding to the type name
250
	 */
251
	private static String generateSourceName(String qualifiedTypeName) {
252
		int index = qualifiedTypeName.indexOf('$');
253
		if (index >= 0)
254
			qualifiedTypeName = qualifiedTypeName.substring(0, index);
255
		return qualifiedTypeName.replace('.', File.separatorChar) + ".java"; //$NON-NLS-1$
256
	}
257
258
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/ProductValidationOperation.java (-54 lines)
Lines 1-54 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 EclipseSource Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     EclipseSource Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import java.util.ArrayList;
14
import java.util.List;
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.jdt.launching.IVMInstall;
17
import org.eclipse.jdt.launching.JavaRuntime;
18
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
19
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
20
import org.eclipse.pde.core.plugin.IPluginModelBase;
21
22
public class ProductValidationOperation extends LaunchValidationOperation {
23
24
	private IPluginModelBase[] fModels;
25
26
	public ProductValidationOperation(IPluginModelBase[] models) {
27
		super(null);
28
		fModels = models;
29
	}
30
31
	protected IPluginModelBase[] getModels() throws CoreException {
32
		return fModels;
33
	}
34
35
	protected IExecutionEnvironment[] getMatchingEnvironments() throws CoreException {
36
		IVMInstall install = JavaRuntime.getDefaultVMInstall();
37
38
		IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
39
		IExecutionEnvironment[] envs = manager.getExecutionEnvironments();
40
		List result = new ArrayList(envs.length);
41
		for (int i = 0; i < envs.length; i++) {
42
			IExecutionEnvironment env = envs[i];
43
			IVMInstall[] compatible = env.getCompatibleVMs();
44
			for (int j = 0; j < compatible.length; j++) {
45
				if (compatible[j].equals(install)) {
46
					result.add(env);
47
					break;
48
				}
49
			}
50
		}
51
		return (IExecutionEnvironment[]) result.toArray(new IExecutionEnvironment[result.size()]);
52
	}
53
54
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PDEMigrationDelegate.java (-56 lines)
Lines 1-56 Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2007, 2008 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IPath;
15
import org.eclipse.debug.core.*;
16
import org.eclipse.jdt.launching.*;
17
import org.eclipse.pde.internal.ui.IPDEUIConstants;
18
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
19
20
public class PDEMigrationDelegate implements ILaunchConfigurationMigrationDelegate {
21
22
	public boolean isCandidate(ILaunchConfiguration candidate) throws CoreException {
23
		return !candidate.getAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, false) || candidate.hasAttribute(IPDELauncherConstants.VMINSTALL);
24
	}
25
26
	public void migrate(ILaunchConfiguration candidate) throws CoreException {
27
		ILaunchConfigurationWorkingCopy wc = candidate.getWorkingCopy();
28
		migrate(wc);
29
		wc.doSave();
30
	}
31
32
	public void migrate(ILaunchConfigurationWorkingCopy candidate) throws CoreException {
33
		if (!candidate.getAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, false)) {
34
			candidate.setAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, true);
35
			String args = candidate.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
36
			StringBuffer buffer = new StringBuffer(LaunchArgumentsHelper.getInitialProgramArguments());
37
			if (args.length() > 0) {
38
				buffer.append(" "); //$NON-NLS-1$
39
				buffer.append(args);
40
			}
41
			candidate.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, buffer.toString());
42
		}
43
		if (candidate.hasAttribute(IPDELauncherConstants.VMINSTALL)) {
44
			String name = candidate.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null);
45
			if (name != null) {
46
				IVMInstall vm = VMHelper.getVMInstall(name);
47
				if (vm != null) {
48
					IPath path = JavaRuntime.newJREContainerPath(vm);
49
					candidate.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, path.toPortableString());
50
				}
51
			}
52
			candidate.removeAttribute(IPDELauncherConstants.VMINSTALL);
53
		}
54
	}
55
56
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PDESourceLookupDirector.java (-242 lines)
Lines 1-242 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Code 9 Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
13
14
import java.io.File;
15
import java.util.*;
16
import org.eclipse.core.filesystem.URIUtil;
17
import org.eclipse.core.resources.*;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.debug.core.sourcelookup.*;
20
import org.eclipse.debug.core.sourcelookup.containers.*;
21
import org.eclipse.debug.ui.sourcelookup.WorkingSetSourceContainer;
22
import org.eclipse.jdt.core.*;
23
import org.eclipse.jdt.debug.core.*;
24
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
25
import org.eclipse.jdt.launching.JavaRuntime;
26
import org.eclipse.jdt.launching.sourcelookup.containers.JavaSourceLookupParticipant;
27
import org.eclipse.pde.core.plugin.*;
28
import org.eclipse.pde.internal.core.PDEClasspathContainer;
29
import org.eclipse.pde.internal.core.TargetPlatformHelper;
30
import org.eclipse.pde.internal.ui.PDEPlugin;
31
32
public class PDESourceLookupDirector extends AbstractSourceLookupDirector {
33
34
	/**
35
	 * Cache of source containers by location and id (String & String)
36
	 */
37
	private Map fSourceContainerMap = new HashMap();
38
39
	private static Set fFilteredTypes;
40
41
	static {
42
		fFilteredTypes = new HashSet(3);
43
		fFilteredTypes.add(ProjectSourceContainer.TYPE_ID);
44
		fFilteredTypes.add(WorkspaceSourceContainer.TYPE_ID);
45
		fFilteredTypes.add(WorkingSetSourceContainer.TYPE_ID);
46
	}
47
48
	/**
49
	 * Lazily initialized.
50
	 */
51
	private double fOSGiRuntimeVersion = Double.MIN_VALUE;
52
53
	/* (non-Javadoc)
54
	 * @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector#initializeParticipants()
55
	 */
56
	public void initializeParticipants() {
57
		addParticipants(new ISourceLookupParticipant[] {new JavaSourceLookupParticipant()});
58
	}
59
60
	/* (non-Javadoc)
61
	 * @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector#supportsSourceContainerType(org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType)
62
	 */
63
	public boolean supportsSourceContainerType(ISourceContainerType type) {
64
		return !fFilteredTypes.contains(type.getId());
65
	}
66
67
	/* (non-Javadoc)
68
	 * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#getSourceElement(java.lang.Object)
69
	 */
70
	public Object getSourceElement(Object element) {
71
		PDESourceLookupQuery query = new PDESourceLookupQuery(this, element);
72
		SafeRunner.run(query);
73
		Object result = query.getResult();
74
		return result != null ? result : super.getSourceElement(element);
75
	}
76
77
	/* (non-Javadoc)
78
	 * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#findSourceElements(java.lang.Object)
79
	 */
80
	public Object[] findSourceElements(Object object) throws CoreException {
81
		Object[] sourceElements = null;
82
		if (object instanceof IJavaStackFrame || object instanceof IJavaObject || object instanceof IJavaReferenceType) {
83
			sourceElements = new Object[] {getSourceElement(object)};
84
		}
85
		if (sourceElements == null) {
86
			sourceElements = super.findSourceElements(object);
87
		}
88
		return sourceElements;
89
	}
90
91
	ISourceContainer[] getSourceContainers(String location, String id) throws CoreException {
92
93
		ISourceContainer[] containers = (ISourceContainer[]) fSourceContainerMap.get(location);
94
		if (containers != null) {
95
			return containers;
96
		}
97
98
		ArrayList result = new ArrayList();
99
		ModelEntry entry = PluginRegistry.findEntry(id);
100
101
		boolean match = false;
102
103
		IPluginModelBase[] models = entry.getWorkspaceModels();
104
		for (int i = 0; i < models.length; i++) {
105
			if (isPerfectMatch(models[i], new Path(location))) {
106
				IResource resource = models[i].getUnderlyingResource();
107
				// if the plug-in matches a workspace model,
108
				// add the project and any libraries not coming via a container
109
				// to the list of source containers, in that order
110
				if (resource != null) {
111
					addProjectSourceContainers(resource.getProject(), result);
112
				}
113
				match = true;
114
				break;
115
			}
116
		}
117
118
		if (!match) {
119
			File file = new File(location);
120
			if (file.isFile()) {
121
				// in case of linked plug-in projects that map to an external JARd plug-in,
122
				// use source container that maps to the library in the linked project.
123
				ISourceContainer container = getArchiveSourceContainer(location);
124
				if (container != null) {
125
					containers = new ISourceContainer[] {container};
126
					fSourceContainerMap.put(location, containers);
127
					return containers;
128
				}
129
			}
130
131
			models = entry.getExternalModels();
132
			for (int i = 0; i < models.length; i++) {
133
				if (isPerfectMatch(models[i], new Path(location))) {
134
					// try all source zips found in the source code locations
135
					IClasspathEntry[] entries = PDEClasspathContainer.getExternalEntries(models[i]);
136
					for (int j = 0; j < entries.length; j++) {
137
						IRuntimeClasspathEntry rte = convertClasspathEntry(entries[j]);
138
						if (rte != null)
139
							result.add(rte);
140
					}
141
					break;
142
				}
143
			}
144
		}
145
146
		IRuntimeClasspathEntry[] entries = (IRuntimeClasspathEntry[]) result.toArray(new IRuntimeClasspathEntry[result.size()]);
147
		containers = JavaRuntime.getSourceContainers(entries);
148
		fSourceContainerMap.put(location, containers);
149
		return containers;
150
	}
151
152
	private boolean isPerfectMatch(IPluginModelBase model, IPath path) {
153
		return model == null ? false : path.equals(new Path(model.getInstallLocation()));
154
	}
155
156
	private IRuntimeClasspathEntry convertClasspathEntry(IClasspathEntry entry) {
157
		if (entry == null)
158
			return null;
159
160
		IPath srcPath = entry.getSourceAttachmentPath();
161
		if (srcPath != null && srcPath.segmentCount() > 0) {
162
			IRuntimeClasspathEntry rte = JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath());
163
			rte.setSourceAttachmentPath(srcPath);
164
			rte.setSourceAttachmentRootPath(entry.getSourceAttachmentRootPath());
165
			return rte;
166
		}
167
		return null;
168
	}
169
170
	private ISourceContainer getArchiveSourceContainer(String location) throws JavaModelException {
171
		IWorkspaceRoot root = PDEPlugin.getWorkspace().getRoot();
172
		IFile[] containers = root.findFilesForLocationURI(URIUtil.toURI(location));
173
		for (int i = 0; i < containers.length; i++) {
174
			IJavaElement element = JavaCore.create(containers[i]);
175
			if (element instanceof IPackageFragmentRoot) {
176
				IPackageFragmentRoot archive = (IPackageFragmentRoot) element;
177
				IPath path = archive.getSourceAttachmentPath();
178
				if (path == null || path.segmentCount() == 0)
179
					continue;
180
181
				IPath rootPath = archive.getSourceAttachmentRootPath();
182
				boolean detectRootPath = rootPath != null && rootPath.segmentCount() > 0;
183
184
				IFile archiveFile = root.getFile(path);
185
				if (archiveFile.exists())
186
					return new ArchiveSourceContainer(archiveFile, detectRootPath);
187
188
				File file = path.toFile();
189
				if (file.exists())
190
					return new ExternalArchiveSourceContainer(file.getAbsolutePath(), detectRootPath);
191
			}
192
		}
193
		return null;
194
	}
195
196
	private void addProjectSourceContainers(IProject project, ArrayList result) throws CoreException {
197
		if (project == null || !project.hasNature(JavaCore.NATURE_ID))
198
			return;
199
200
		IJavaProject jProject = JavaCore.create(project);
201
		result.add(JavaRuntime.newProjectRuntimeClasspathEntry(jProject));
202
203
		IClasspathEntry[] entries = jProject.getRawClasspath();
204
		for (int i = 0; i < entries.length; i++) {
205
			IClasspathEntry entry = entries[i];
206
			if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
207
				IRuntimeClasspathEntry rte = convertClasspathEntry(entry);
208
				if (rte != null)
209
					result.add(rte);
210
			}
211
		}
212
	}
213
214
	/* (non-Javadoc)
215
	 * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#dispose()
216
	 */
217
	public synchronized void dispose() {
218
		Iterator iterator = fSourceContainerMap.values().iterator();
219
		while (iterator.hasNext()) {
220
			ISourceContainer[] containers = (ISourceContainer[]) iterator.next();
221
			for (int i = 0; i < containers.length; i++) {
222
				containers[i].dispose();
223
			}
224
		}
225
		fSourceContainerMap.clear();
226
		super.dispose();
227
	}
228
229
	/**
230
	 * Returns the version of the OSGi runtime being debugged, based on the target platform.
231
	 * Cached per source lookup director.
232
	 * 
233
	 * @return OSGi runtime version
234
	 */
235
	double getOSGiRuntimeVersion() {
236
		if (fOSGiRuntimeVersion == Double.MIN_VALUE) {
237
			fOSGiRuntimeVersion = TargetPlatformHelper.getTargetVersion();
238
		}
239
		return fOSGiRuntimeVersion;
240
	}
241
242
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/BundleLauncherHelper.java (-313 lines)
Lines 1-313 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
13
14
import java.util.*;
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
18
import org.eclipse.osgi.service.resolver.BundleDescription;
19
import org.eclipse.pde.core.plugin.*;
20
import org.eclipse.pde.internal.build.IPDEBuildConstants;
21
import org.eclipse.pde.internal.core.TargetPlatformHelper;
22
import org.eclipse.pde.internal.ui.IPDEUIConstants;
23
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
24
25
public class BundleLauncherHelper {
26
27
	public static final char VERSION_SEPARATOR = '*';
28
29
	public static Map getWorkspaceBundleMap(ILaunchConfiguration configuration) throws CoreException {
30
		return getWorkspaceBundleMap(configuration, null, IPDELauncherConstants.WORKSPACE_BUNDLES);
31
	}
32
33
	public static Map getTargetBundleMap(ILaunchConfiguration configuration) throws CoreException {
34
		return getTargetBundleMap(configuration, null, IPDELauncherConstants.TARGET_BUNDLES);
35
	}
36
37
	public static Map getMergedBundleMap(ILaunchConfiguration configuration, boolean osgi) throws CoreException {
38
		Set set = new HashSet();
39
		Map map = new HashMap();
40
41
		// if we are using the eclipse-based launcher, we need special checks
42
		if (!osgi) {
43
44
			checkBackwardCompatibility(configuration, true);
45
46
			if (configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true)) {
47
				IPluginModelBase[] models = PluginRegistry.getActiveModels();
48
				for (int i = 0; i < models.length; i++) {
49
					addBundleToMap(map, models[i], "default:default"); //$NON-NLS-1$
50
				}
51
				return map;
52
			}
53
54
			if (configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false)) {
55
				IPluginModelBase[] models = PluginRegistry.getWorkspaceModels();
56
				for (int i = 0; i < models.length; i++) {
57
					addBundleToMap(map, models[i], "default:default"); //$NON-NLS-1$
58
				}
59
				return map;
60
			}
61
		}
62
63
		String workspace = osgi == false ? IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS : IPDELauncherConstants.WORKSPACE_BUNDLES;
64
		String target = osgi == false ? IPDELauncherConstants.SELECTED_TARGET_PLUGINS : IPDELauncherConstants.TARGET_BUNDLES;
65
		map = getWorkspaceBundleMap(configuration, set, workspace);
66
		map.putAll(getTargetBundleMap(configuration, set, target));
67
		return map;
68
	}
69
70
	public static IPluginModelBase[] getMergedBundles(ILaunchConfiguration configuration, boolean osgi) throws CoreException {
71
		Map map = getMergedBundleMap(configuration, osgi);
72
		return (IPluginModelBase[]) map.keySet().toArray(new IPluginModelBase[map.size()]);
73
	}
74
75
	public static Map getWorkspaceBundleMap(ILaunchConfiguration configuration, Set set, String attribute) throws CoreException {
76
		String selected = configuration.getAttribute(attribute, ""); //$NON-NLS-1$
77
		Map map = new HashMap();
78
		StringTokenizer tok = new StringTokenizer(selected, ","); //$NON-NLS-1$
79
		while (tok.hasMoreTokens()) {
80
			String token = tok.nextToken();
81
			int index = token.indexOf('@');
82
			if (index < 0) { // if no start levels, assume default
83
				token = token.concat("@default:default"); //$NON-NLS-1$
84
				index = token.indexOf('@');
85
			}
86
			String idVersion = token.substring(0, index);
87
			int versionIndex = idVersion.indexOf(VERSION_SEPARATOR);
88
			String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion;
89
			String version = (versionIndex > 0) ? idVersion.substring(versionIndex + 1) : null;
90
			if (set != null)
91
				set.add(id);
92
			ModelEntry entry = PluginRegistry.findEntry(id);
93
			if (entry != null) {
94
				IPluginModelBase[] models = entry.getWorkspaceModels();
95
				for (int i = 0; i < models.length; i++) {
96
					IPluginBase base = models[i].getPluginBase();
97
98
					// match only if...
99
					// a) if we have the same version
100
					// b) no version
101
					// c) all else fails, if there's just one bundle available, use it
102
					if (base.getVersion().equals(version) || version == null || models.length == 1)
103
						addBundleToMap(map, models[i], token.substring(index + 1));
104
				}
105
			}
106
		}
107
108
		if (configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true)) {
109
			Set deselectedPlugins = LaunchPluginValidator.parsePlugins(configuration, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS);
110
			IPluginModelBase[] models = PluginRegistry.getWorkspaceModels();
111
			for (int i = 0; i < models.length; i++) {
112
				String id = models[i].getPluginBase().getId();
113
				if (id == null)
114
					continue;
115
				if (!deselectedPlugins.contains(models[i])) {
116
					if (set != null)
117
						set.add(id);
118
					if (!map.containsKey(models[i]))
119
						addBundleToMap(map, models[i], "default:default"); //$NON-NLS-1$
120
				}
121
			}
122
		}
123
		return map;
124
	}
125
126
	/**
127
	 * Adds the given bundle and start information to the map.  This will override anything set
128
	 * for system bundles, and set their start level to the appropriate level
129
	 * @param map The map to add the bundles too
130
	 * @param bundle The bundle to add
131
	 * @param substring the start information in the form level:autostart
132
	 */
133
	private static void addBundleToMap(Map map, IPluginModelBase bundle, String sl) {
134
		BundleDescription desc = bundle.getBundleDescription();
135
		boolean defaultsl = (sl == null || sl.equals("default:default")); //$NON-NLS-1$
136
		if (desc != null && defaultsl) {
137
			String modelName = desc.getSymbolicName();
138
			if (IPDEBuildConstants.BUNDLE_DS.equals(modelName)) {
139
				map.put(bundle, "1:true"); //$NON-NLS-1$ 
140
			} else if (IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR.equals(modelName)) {
141
				map.put(bundle, "1:true"); //$NON-NLS-1$
142
			} else if (IPDEBuildConstants.BUNDLE_EQUINOX_COMMON.equals(modelName)) {
143
				map.put(bundle, "2:true"); //$NON-NLS-1$
144
			} else if (IPDEBuildConstants.BUNDLE_OSGI.equals(modelName)) {
145
				map.put(bundle, "-1:true"); //$NON-NLS-1$
146
			} else if (IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR.equals(modelName)) {
147
				map.put(bundle, "3:true"); //$NON-NLS-1$
148
			} else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(modelName)) {
149
				if (TargetPlatformHelper.getTargetVersion() > 3.1) {
150
					map.put(bundle, "default:true"); //$NON-NLS-1$
151
				} else {
152
					map.put(bundle, "2:true"); //$NON-NLS-1$
153
				}
154
			} else {
155
				map.put(bundle, sl);
156
			}
157
		} else {
158
			map.put(bundle, sl);
159
		}
160
161
	}
162
163
	public static Map getTargetBundleMap(ILaunchConfiguration configuration, Set set, String attribute) throws CoreException {
164
		String selected = configuration.getAttribute(attribute, ""); //$NON-NLS-1$
165
		Map map = new HashMap();
166
		StringTokenizer tok = new StringTokenizer(selected, ","); //$NON-NLS-1$
167
		while (tok.hasMoreTokens()) {
168
			String token = tok.nextToken();
169
			int index = token.indexOf('@');
170
			if (index < 0) { // if no start levels, assume default
171
				token = token.concat("@default:default"); //$NON-NLS-1$
172
				index = token.indexOf('@');
173
			}
174
			String idVersion = token.substring(0, index);
175
			int versionIndex = idVersion.indexOf(VERSION_SEPARATOR);
176
			String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion;
177
			String version = (versionIndex > 0) ? idVersion.substring(versionIndex + 1) : null;
178
			if (set != null && set.contains(id))
179
				continue;
180
			ModelEntry entry = PluginRegistry.findEntry(id);
181
			if (entry != null) {
182
				IPluginModelBase[] models = entry.getExternalModels();
183
				for (int i = 0; i < models.length; i++) {
184
					if (models[i].isEnabled()) {
185
						IPluginBase base = models[i].getPluginBase();
186
						// match only if...
187
						// a) if we have the same version
188
						// b) no version
189
						// c) all else fails, if there's just one bundle available, use it
190
						if (base.getVersion().equals(version) || version == null || models.length == 1)
191
							addBundleToMap(map, models[i], token.substring(index + 1));
192
					}
193
				}
194
			}
195
		}
196
		return map;
197
	}
198
199
	public static String writeBundleEntry(IPluginModelBase model, String startLevel, String autoStart) {
200
		IPluginBase base = model.getPluginBase();
201
		String id = base.getId();
202
		StringBuffer buffer = new StringBuffer(id);
203
204
		ModelEntry entry = PluginRegistry.findEntry(id);
205
		if (entry.getActiveModels().length > 1) {
206
			buffer.append(VERSION_SEPARATOR);
207
			buffer.append(model.getPluginBase().getVersion());
208
		}
209
210
		boolean hasStartLevel = (startLevel != null && startLevel.length() > 0);
211
		boolean hasAutoStart = (autoStart != null && autoStart.length() > 0);
212
213
		if (hasStartLevel || hasAutoStart)
214
			buffer.append('@');
215
		if (hasStartLevel)
216
			buffer.append(startLevel);
217
		if (hasStartLevel || hasAutoStart)
218
			buffer.append(':');
219
		if (hasAutoStart)
220
			buffer.append(autoStart);
221
		return buffer.toString();
222
	}
223
224
	public static void checkBackwardCompatibility(ILaunchConfiguration configuration, boolean save) throws CoreException {
225
		ILaunchConfigurationWorkingCopy wc = null;
226
		if (configuration.isWorkingCopy()) {
227
			wc = (ILaunchConfigurationWorkingCopy) configuration;
228
		} else {
229
			wc = configuration.getWorkingCopy();
230
		}
231
232
		String value = configuration.getAttribute("wsproject", (String) null); //$NON-NLS-1$
233
		if (value != null) {
234
			wc.setAttribute("wsproject", (String) null); //$NON-NLS-1$
235
			if (value.indexOf(';') != -1) {
236
				value = value.replace(';', ',');
237
			} else if (value.indexOf(':') != -1) {
238
				value = value.replace(':', ',');
239
			}
240
			value = (value.length() == 0 || value.equals(",")) //$NON-NLS-1$
241
			? null
242
					: value.substring(0, value.length() - 1);
243
244
			boolean automatic = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true);
245
			String attr = automatic ? IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS : IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS;
246
			wc.setAttribute(attr, value);
247
		}
248
249
		String value2 = configuration.getAttribute("extplugins", (String) null); //$NON-NLS-1$
250
		if (value2 != null) {
251
			wc.setAttribute("extplugins", (String) null); //$NON-NLS-1$
252
			if (value2.indexOf(';') != -1) {
253
				value2 = value2.replace(';', ',');
254
			} else if (value2.indexOf(':') != -1) {
255
				value2 = value2.replace(':', ',');
256
			}
257
			value2 = (value2.length() == 0 || value2.equals(",")) ? null : value2.substring(0, value2.length() - 1); //$NON-NLS-1$
258
			wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, value2);
259
		}
260
261
		String version = configuration.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, (String) null);
262
		boolean newApp = TargetPlatformHelper.usesNewApplicationModel();
263
		boolean upgrade = !"3.3".equals(version) && newApp; //$NON-NLS-1$
264
		if (!upgrade)
265
			upgrade = TargetPlatformHelper.getTargetVersion() >= 3.2 && version == null;
266
		if (upgrade) {
267
			wc.setAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, newApp ? "3.3" : "3.2a"); //$NON-NLS-1$ //$NON-NLS-2$
268
			boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true);
269
			boolean useFeatures = configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false);
270
			boolean automaticAdd = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true);
271
			if (!usedefault && !useFeatures) {
272
				ArrayList list = new ArrayList();
273
				if (version == null) {
274
					list.add("org.eclipse.core.contenttype"); //$NON-NLS-1$
275
					list.add("org.eclipse.core.jobs"); //$NON-NLS-1$
276
					list.add(IPDEBuildConstants.BUNDLE_EQUINOX_COMMON);
277
					list.add("org.eclipse.equinox.preferences"); //$NON-NLS-1$
278
					list.add("org.eclipse.equinox.registry"); //$NON-NLS-1$
279
					list.add("org.eclipse.core.runtime.compatibility.registry"); //$NON-NLS-1$
280
				}
281
				if (!"3.3".equals(version) && newApp) //$NON-NLS-1$
282
					list.add("org.eclipse.equinox.app"); //$NON-NLS-1$
283
				StringBuffer extensions = new StringBuffer(configuration.getAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, "")); //$NON-NLS-1$
284
				StringBuffer target = new StringBuffer(configuration.getAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, "")); //$NON-NLS-1$
285
				for (int i = 0; i < list.size(); i++) {
286
					String plugin = list.get(i).toString();
287
					IPluginModelBase model = PluginRegistry.findModel(plugin);
288
					if (model == null)
289
						continue;
290
					if (model.getUnderlyingResource() != null) {
291
						if (automaticAdd)
292
							continue;
293
						if (extensions.length() > 0)
294
							extensions.append(","); //$NON-NLS-1$
295
						extensions.append(plugin);
296
					} else {
297
						if (target.length() > 0)
298
							target.append(","); //$NON-NLS-1$
299
						target.append(plugin);
300
					}
301
				}
302
				if (extensions.length() > 0)
303
					wc.setAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, extensions.toString());
304
				if (target.length() > 0)
305
					wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, target.toString());
306
			}
307
		}
308
309
		if (save && (value != null || value2 != null || upgrade))
310
			wc.doSave();
311
	}
312
313
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/EquinoxInitializer.java (-130 lines)
Lines 1-130 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
13
import java.util.*;
14
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
16
import org.eclipse.pde.internal.core.*;
17
import org.eclipse.pde.internal.ui.IPDEUIConstants;
18
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
19
import org.eclipse.pde.ui.launcher.OSGiLaunchConfigurationInitializer;
20
21
public class EquinoxInitializer extends OSGiLaunchConfigurationInitializer {
22
23
	private Map fStartLevels;
24
25
	public void initialize(ILaunchConfigurationWorkingCopy configuration) {
26
		super.initialize(configuration);
27
		initializeProgramArguments(configuration);
28
		initializeVMArguments(configuration);
29
		initializeTracing(configuration);
30
	}
31
32
	private void initializeProgramArguments(ILaunchConfigurationWorkingCopy configuration) {
33
		StringBuffer buffer = new StringBuffer(LaunchArgumentsHelper.getInitialProgramArguments());
34
		if (buffer.length() > 0) {
35
			if (buffer.indexOf("-console") == -1) { //$NON-NLS-1$
36
				buffer.append(" -console"); //$NON-NLS-1$
37
			}
38
		} else {
39
			buffer.append("-console"); //$NON-NLS-1$
40
		}
41
		configuration.setAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, true);
42
		configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, buffer.toString());
43
	}
44
45
	private void initializeVMArguments(ILaunchConfigurationWorkingCopy configuration) {
46
		configuration.setAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, "3.3"); //$NON-NLS-1$
47
		PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager();
48
		StringBuffer vmArgs = new StringBuffer(preferences.getString(ICoreConstants.VM_ARGS));
49
		if (vmArgs.indexOf("-Declipse.ignoreApp") == -1) { //$NON-NLS-1$
50
			if (vmArgs.length() > 0)
51
				vmArgs.append(" "); //$NON-NLS-1$
52
			vmArgs.append("-Declipse.ignoreApp=true"); //$NON-NLS-1$
53
		}
54
		if (vmArgs.indexOf("-Dosgi.noShutdown") == -1) { //$NON-NLS-1$
55
			vmArgs.append(" -Dosgi.noShutdown=true"); //$NON-NLS-1$
56
		}
57
		configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs.toString());
58
	}
59
60
	private void initializeTracing(ILaunchConfigurationWorkingCopy configuration) {
61
		configuration.setAttribute(IPDELauncherConstants.TRACING_CHECKED, IPDELauncherConstants.TRACING_NONE);
62
	}
63
64
	protected void initializeBundleState(ILaunchConfigurationWorkingCopy configuration) {
65
		initializeBundleState();
66
		super.initializeBundleState(configuration);
67
	}
68
69
	protected String getAutoStart(String bundleID) {
70
		if (fStartLevels.containsKey(bundleID)) {
71
			String value = fStartLevels.get(bundleID).toString();
72
			return value.substring(value.indexOf(":") + 1); //$NON-NLS-1$
73
		}
74
		return super.getAutoStart(bundleID);
75
	}
76
77
	protected String getStartLevel(String bundleID) {
78
		if (fStartLevels.containsKey(bundleID)) {
79
			String value = fStartLevels.get(bundleID).toString();
80
			return value.substring(0, value.indexOf(":")); //$NON-NLS-1$
81
		}
82
		return super.getStartLevel(bundleID);
83
	}
84
85
	private void initializeBundleState() {
86
		if (fStartLevels == null)
87
			fStartLevels = new HashMap();
88
		Properties props = TargetPlatformHelper.getConfigIniProperties();
89
		if (props != null) {
90
			String value = (String) props.get("osgi.bundles"); //$NON-NLS-1$
91
			if (value != null) {
92
				StringTokenizer tokenizer = new StringTokenizer(value, ","); //$NON-NLS-1$
93
				while (tokenizer.hasMoreTokens()) {
94
					String tokenValue = tokenizer.nextToken();
95
					int index = tokenValue.indexOf("@"); //$NON-NLS-1$
96
					if (index > 0) {
97
						String bundle = tokenValue.substring(0, index).trim();
98
						fStartLevels.put(bundle, getStartValue(tokenValue.substring(index)));
99
					}
100
				}
101
			}
102
		}
103
	}
104
105
	private String getStartValue(String value) {
106
		StringBuffer buffer = new StringBuffer(value);
107
		StringBuffer result = new StringBuffer(":"); //$NON-NLS-1$
108
109
		int index = value.indexOf("start"); //$NON-NLS-1$
110
		result.append(Boolean.toString(index != -1));
111
112
		if (index != -1)
113
			buffer.delete(index, index + 5);
114
115
		int colon = value.indexOf(':');
116
		if (colon != -1)
117
			buffer.deleteCharAt(colon);
118
119
		// delete the first char '@'
120
		buffer.deleteCharAt(0);
121
122
		try {
123
			result.insert(0, Integer.parseInt(buffer.toString().trim()));
124
		} catch (NumberFormatException e) {
125
			result.insert(0, DEFAULT);
126
		}
127
		return result.toString();
128
	}
129
130
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/OSGiValidationOperation.java (-28 lines)
Lines 1-28 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     EclipseSource Corporation - ongoing enhancements
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
13
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.pde.core.plugin.IPluginModelBase;
17
18
public class OSGiValidationOperation extends LaunchValidationOperation {
19
20
	public OSGiValidationOperation(ILaunchConfiguration configuration) {
21
		super(configuration);
22
	}
23
24
	protected IPluginModelBase[] getModels() throws CoreException {
25
		return BundleLauncherHelper.getMergedBundles(fLaunchConfiguration, true);
26
	}
27
28
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchPluginValidator.java (-100 / +11 lines)
Lines 10-133 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
11
package org.eclipse.pde.internal.ui.launcher;
12
12
13
import java.util.*;
13
import org.eclipse.pde.internal.launching.launcher.LaunchValidationOperation;
14
import org.eclipse.core.resources.IProject;
14
15
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.jdt.core.IJavaProject;
18
import org.eclipse.jdt.core.JavaCore;
19
import org.eclipse.jface.dialogs.IDialogConstants;
16
import org.eclipse.jface.dialogs.IDialogConstants;
20
import org.eclipse.pde.core.plugin.*;
21
import org.eclipse.pde.internal.core.PDECore;
22
import org.eclipse.pde.internal.core.SearchablePluginsManager;
23
import org.eclipse.pde.internal.ui.IPDEUIConstants;
24
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
25
import org.eclipse.swt.widgets.Display;
17
import org.eclipse.swt.widgets.Display;
26
18
27
public class LaunchPluginValidator {
19
public class LaunchPluginValidator {
28
20
29
	private static IPluginModelBase[] getSelectedWorkspacePlugins(ILaunchConfiguration configuration) throws CoreException {
21
	public static class InteractiveValidationErrorHandler implements org.eclipse.pde.internal.launching.launcher.LaunchPluginValidator.IValidationErrorHandler {
30
31
		boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true);
32
		boolean useFeatures = configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false);
33
34
		IPluginModelBase[] models = PluginRegistry.getWorkspaceModels();
35
36
		if (usedefault || useFeatures || models.length == 0)
37
			return models;
38
22
39
		Collection result = null;
23
		public void handleError(final LaunchValidationOperation operation) throws CoreException {
40
		Map bundles = BundleLauncherHelper.getWorkspaceBundleMap(configuration, null, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS);
41
		result = bundles.keySet();
42
		return (IPluginModelBase[]) result.toArray(new IPluginModelBase[result.size()]);
43
	}
44
45
	/**
46
	 * 
47
	 * @param configuration launchConfiguration to get the attribute value
48
	 * @param attribute launch configuration attribute to containing plug-in information
49
	 * @return a TreeSet containing IPluginModelBase objects which are represented by the value of the attribute
50
	 * @throws CoreException
51
	 */
52
	public static Set parsePlugins(ILaunchConfiguration configuration, String attribute) throws CoreException {
53
		HashSet set = new HashSet();
54
		String ids = configuration.getAttribute(attribute, (String) null);
55
		if (ids != null) {
56
			String[] entries = ids.split(","); //$NON-NLS-1$
57
			Map unmatchedEntries = new HashMap();
58
			for (int i = 0; i < entries.length; i++) {
59
				int index = entries[i].indexOf('@');
60
				if (index < 0) { // if no start levels, assume default
61
					entries[i] = entries[i].concat("@default:default"); //$NON-NLS-1$
62
					index = entries[i].indexOf('@');
63
				}
64
				String idVersion = entries[i].substring(0, index);
65
				int versionIndex = entries[i].indexOf(BundleLauncherHelper.VERSION_SEPARATOR);
66
				String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion;
67
				String version = (versionIndex > 0) ? idVersion.substring(versionIndex + 1) : null;
68
				ModelEntry entry = PluginRegistry.findEntry(id);
69
				if (entry != null) {
70
					IPluginModelBase matchingModels[] = attribute.equals(IPDELauncherConstants.SELECTED_TARGET_PLUGINS) ? entry.getExternalModels() : entry.getWorkspaceModels();
71
					for (int j = 0; j < matchingModels.length; j++) {
72
						if (matchingModels[j].isEnabled()) {
73
							// TODO Very similar logic to BundleLauncherHelper
74
							// the logic here is this (see bug 225644)
75
							// a) if we come across a bundle that has the right version, immediately add it
76
							// b) if there's no version, add it
77
							// c) if there's only one instance of that bundle in the list of ids... add it
78
							if (version == null || matchingModels[j].getPluginBase().getVersion().equals(version)) {
79
								set.add(matchingModels[j]);
80
							} else if (matchingModels.length == 1) {
81
								if (unmatchedEntries.remove(id) == null) {
82
									unmatchedEntries.put(id, matchingModels[j]);
83
								}
84
							}
85
						}
86
					}
87
				}
88
			}
89
			set.addAll(unmatchedEntries.values());
90
		}
91
		return set;
92
	}
93
94
	public static IProject[] getAffectedProjects(ILaunchConfiguration config) throws CoreException {
95
		// if restarting, no need to check projects for errors
96
		if (config.getAttribute(IPDEUIConstants.RESTART, false))
97
			return new IProject[0];
98
		ArrayList projects = new ArrayList();
99
		IPluginModelBase[] models = getSelectedWorkspacePlugins(config);
100
		for (int i = 0; i < models.length; i++) {
101
			IProject project = models[i].getUnderlyingResource().getProject();
102
			if (project.hasNature(JavaCore.NATURE_ID))
103
				projects.add(project);
104
		}
105
106
		// add fake "Java Search" project
107
		SearchablePluginsManager manager = PDECore.getDefault().getSearchablePluginsManager();
108
		IJavaProject proxy = manager.getProxyProject();
109
		if (proxy != null) {
110
			projects.add(proxy.getProject());
111
		}
112
		return (IProject[]) projects.toArray(new IProject[projects.size()]);
113
	}
114
115
	public static void runValidationOperation(final LaunchValidationOperation op, IProgressMonitor monitor) throws CoreException {
116
		op.run(monitor);
117
		if (op.hasErrors()) {
118
			final int[] result = new int[1];
24
			final int[] result = new int[1];
119
			final Display display = LauncherUtils.getDisplay();
25
			final Display display = LauncherUtilsHelper.getDisplay();
120
			display.syncExec(new Runnable() {
26
			display.syncExec(new Runnable() {
121
				public void run() {
27
				public void run() {
122
					PluginStatusDialog dialog = new PluginStatusDialog(display.getActiveShell());
28
					PluginStatusDialog dialog = new PluginStatusDialog(display.getActiveShell());
123
					dialog.showCancelButton(true);
29
					dialog.showCancelButton(true);
124
					dialog.setInput(op.getInput());
30
					dialog.setInput(operation.getInput());
125
					result[0] = dialog.open();
31
					result[0] = dialog.open();
126
				}
32
				}
127
			});
33
			});
128
			if (result[0] == IDialogConstants.CANCEL_ID)
34
			if (result[0] == IDialogConstants.CANCEL_ID)
129
				throw new CoreException(Status.CANCEL_STATUS);
35
				throw new CoreException(Status.CANCEL_STATUS);
130
		}
36
		}
37
38
	}
39
40
	public static void runValidationOperation(final LaunchValidationOperation op, IProgressMonitor monitor) throws CoreException {
41
		org.eclipse.pde.internal.launching.launcher.LaunchPluginValidator.runValidationOperation(op, monitor, new InteractiveValidationErrorHandler());
131
	}
42
	}
132
43
133
}
44
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/EclipsePluginValidationOperationHelper.java (+31 lines)
Line 0 Link Here
1
package org.eclipse.pde.internal.ui.launcher;
2
3
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
4
5
import org.eclipse.pde.internal.launching.launcher.IEclipsePluginValidationOperationHelper;
6
7
import org.eclipse.osgi.util.NLS;
8
import org.eclipse.pde.internal.ui.*;
9
import org.eclipse.pde.internal.ui.elements.NamedElement;
10
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
11
import org.eclipse.swt.graphics.Image;
12
13
public class EclipsePluginValidationOperationHelper implements IEclipsePluginValidationOperationHelper {
14
15
	/* (non-Javadoc)
16
	 * @see org.eclipse.pde.internal.launcher.IEclipsePluginValidationOperationHelper#getAttribute(java.lang.String)
17
	 */
18
	public String getAttribute(String configType) {
19
		return configType.equals(EclipseLaunchShortcut.CONFIGURATION_TYPE) ? IPDELauncherConstants.APPLICATION : IPDELauncherConstants.APP_TO_TEST;
20
	}
21
22
	/* (non-Javadoc)
23
	 * @see org.eclipse.pde.internal.launcher.IEclipsePluginValidationOperationHelper#createExtensionError(java.lang.String)
24
	 */
25
	public Object createExtensionError(String bundleID) {
26
		String name = NLS.bind(PDEUIMessages.EclipsePluginValidationOperation_pluginMissing, bundleID);
27
		PDELabelProvider provider = PDEPlugin.getDefault().getLabelProvider();
28
		Image image = provider.get(PDEPluginImages.DESC_PLUGIN_OBJ);
29
		return new NamedElement(name, image);
30
	}
31
}
0
  + text/plain
32
  + text/plain
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/TracingBlock.java (-1 / +4 lines)
Lines 12-17 Link Here
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.pde.internal.ui.launcher;
13
package org.eclipse.pde.internal.ui.launcher;
14
14
15
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
16
15
import java.util.*;
17
import java.util.*;
16
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.debug.core.ILaunchConfiguration;
19
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 25-31 Link Here
25
import org.eclipse.pde.internal.ui.PDEUIMessages;
27
import org.eclipse.pde.internal.ui.PDEUIMessages;
26
import org.eclipse.pde.internal.ui.util.SWTUtil;
28
import org.eclipse.pde.internal.ui.util.SWTUtil;
27
import org.eclipse.pde.internal.ui.wizards.ListUtil;
29
import org.eclipse.pde.internal.ui.wizards.ListUtil;
28
import org.eclipse.pde.ui.launcher.*;
30
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
31
import org.eclipse.pde.ui.launcher.TracingTab;
29
import org.eclipse.swt.SWT;
32
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.custom.SashForm;
33
import org.eclipse.swt.custom.SashForm;
31
import org.eclipse.swt.events.SelectionAdapter;
34
import org.eclipse.swt.events.SelectionAdapter;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/WorkspaceDataBlock.java (-1 / +4 lines)
Lines 10-22 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
11
package org.eclipse.pde.internal.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
15
import org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper;
16
13
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.debug.core.ILaunchConfiguration;
18
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
19
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
16
import org.eclipse.pde.internal.ui.IPDEUIConstants;
20
import org.eclipse.pde.internal.ui.IPDEUIConstants;
17
import org.eclipse.pde.internal.ui.PDEUIMessages;
21
import org.eclipse.pde.internal.ui.PDEUIMessages;
18
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
22
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
19
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
20
import org.eclipse.swt.SWT;
23
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.events.SelectionAdapter;
24
import org.eclipse.swt.events.SelectionAdapter;
22
import org.eclipse.swt.events.SelectionEvent;
25
import org.eclipse.swt.events.SelectionEvent;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/OSGiBundleBlock.java (-1 / +4 lines)
Lines 11-23 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
12
package org.eclipse.pde.internal.ui.launcher;
13
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
16
import org.eclipse.pde.internal.launching.launcher.*;
17
14
import java.util.*;
18
import java.util.*;
15
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.ILaunchConfiguration;
20
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
21
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
18
import org.eclipse.pde.core.plugin.IPluginModelBase;
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
19
import org.eclipse.pde.ui.launcher.BundlesTab;
23
import org.eclipse.pde.ui.launcher.BundlesTab;
20
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
21
24
22
public class OSGiBundleBlock extends AbstractPluginBlock {
25
public class OSGiBundleBlock extends AbstractPluginBlock {
23
26
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchAction.java (-1 / +7 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
12
package org.eclipse.pde.internal.ui.launcher;
13
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
import org.eclipse.pde.launching.launcher.PDESourcePathProvider;
16
17
import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper;
18
import org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper;
19
14
import java.io.File;
20
import java.io.File;
15
import java.util.*;
21
import java.util.*;
16
import org.eclipse.core.resources.IResource;
22
import org.eclipse.core.resources.IResource;
Lines 29-35 Link Here
29
import org.eclipse.pde.internal.core.iproduct.IProduct;
35
import org.eclipse.pde.internal.core.iproduct.IProduct;
30
import org.eclipse.pde.internal.core.util.CoreUtility;
36
import org.eclipse.pde.internal.core.util.CoreUtility;
31
import org.eclipse.pde.internal.ui.*;
37
import org.eclipse.pde.internal.ui.*;
32
import org.eclipse.pde.ui.launcher.*;
38
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
33
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
39
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
34
40
35
public class LaunchAction extends Action {
41
public class LaunchAction extends Action {
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginBlock.java (-2 / +8 lines)
Lines 12-17 Link Here
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.pde.internal.ui.launcher;
13
package org.eclipse.pde.internal.ui.launcher;
14
14
15
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
16
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
17
18
import org.eclipse.pde.internal.launching.launcher.*;
19
15
import java.util.*;
20
import java.util.*;
16
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.debug.core.ILaunchConfiguration;
22
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 19-25 Link Here
19
import org.eclipse.pde.core.plugin.*;
24
import org.eclipse.pde.core.plugin.*;
20
import org.eclipse.pde.internal.core.util.IdUtil;
25
import org.eclipse.pde.internal.core.util.IdUtil;
21
import org.eclipse.pde.internal.ui.IPDEUIConstants;
26
import org.eclipse.pde.internal.ui.IPDEUIConstants;
22
import org.eclipse.pde.ui.launcher.*;
27
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
28
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
23
29
24
public class PluginBlock extends AbstractPluginBlock {
30
public class PluginBlock extends AbstractPluginBlock {
25
31
Lines 265-271 Link Here
265
	}
271
	}
266
272
267
	protected LaunchValidationOperation createValidationOperation() {
273
	protected LaunchValidationOperation createValidationOperation() {
268
		return new EclipsePluginValidationOperation(fLaunchConfig);
274
		return new EclipsePluginValidationOperation(fLaunchConfig, PDELaunchingPlugin.getDefault().getLauncherSettings().getEclipsePluginValidationOperationHelper());
269
	}
275
	}
270
276
271
}
277
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/ConfigurationAreaBlock.java (-1 / +2 lines)
Lines 10-21 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
11
package org.eclipse.pde.internal.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
16
import org.eclipse.pde.internal.ui.PDEUIMessages;
18
import org.eclipse.pde.internal.ui.PDEUIMessages;
17
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
19
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
18
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
19
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.events.SelectionAdapter;
21
import org.eclipse.swt.events.SelectionAdapter;
21
import org.eclipse.swt.events.SelectionEvent;
22
import org.eclipse.swt.events.SelectionEvent;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/ConfigurationTemplateBlock.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
11
package org.eclipse.pde.internal.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import java.io.File;
15
import java.io.File;
14
import org.eclipse.core.filesystem.URIUtil;
16
import org.eclipse.core.filesystem.URIUtil;
15
import org.eclipse.core.resources.*;
17
import org.eclipse.core.resources.*;
Lines 23-29 Link Here
23
import org.eclipse.pde.internal.ui.PDEUIMessages;
25
import org.eclipse.pde.internal.ui.PDEUIMessages;
24
import org.eclipse.pde.internal.ui.util.FileNameFilter;
26
import org.eclipse.pde.internal.ui.util.FileNameFilter;
25
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
27
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
26
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
27
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.events.SelectionAdapter;
29
import org.eclipse.swt.events.SelectionAdapter;
29
import org.eclipse.swt.events.SelectionEvent;
30
import org.eclipse.swt.events.SelectionEvent;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchListener.java (-2 / +7 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
11
package org.eclipse.pde.internal.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELaunchListener;
14
15
import org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper;
16
import org.eclipse.pde.internal.launching.launcher.LaunchConfigurationHelper;
17
13
import java.io.File;
18
import java.io.File;
14
import java.util.ArrayList;
19
import java.util.ArrayList;
15
import org.eclipse.core.filesystem.EFS;
20
import org.eclipse.core.filesystem.EFS;
Lines 25-31 Link Here
25
import org.eclipse.ui.ide.IDE;
30
import org.eclipse.ui.ide.IDE;
26
import org.eclipse.ui.internal.views.log.LogView;
31
import org.eclipse.ui.internal.views.log.LogView;
27
32
28
public class LaunchListener implements ILaunchListener, IDebugEventSetListener {
33
public class LaunchListener implements ILaunchListener, IDebugEventSetListener, IPDELaunchListener {
29
	private ArrayList managedLaunches;
34
	private ArrayList managedLaunches;
30
	// maximum log file size
35
	// maximum log file size
31
	public static final long MAX_FILE_LENGTH = 1024 * 1024;
36
	public static final long MAX_FILE_LENGTH = 1024 * 1024;
Lines 74-80 Link Here
74
		}
79
		}
75
	}
80
	}
76
81
77
	private void hookListener(boolean add) {
82
	public void hookListener(boolean add) {
78
		DebugPlugin debugPlugin = DebugPlugin.getDefault();
83
		DebugPlugin debugPlugin = DebugPlugin.getDefault();
79
		ILaunchManager launchManager = debugPlugin.getLaunchManager();
84
		ILaunchManager launchManager = debugPlugin.getLaunchManager();
80
		if (add) {
85
		if (add) {
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/ProgramBlock.java (-1 / +2 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
12
package org.eclipse.pde.internal.ui.launcher;
13
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
14
import java.util.StringTokenizer;
16
import java.util.StringTokenizer;
15
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.ILaunchConfiguration;
18
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 21-27 Link Here
21
import org.eclipse.pde.internal.ui.PDEUIMessages;
23
import org.eclipse.pde.internal.ui.PDEUIMessages;
22
import org.eclipse.pde.internal.ui.SWTFactory;
24
import org.eclipse.pde.internal.ui.SWTFactory;
23
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
25
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
24
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
25
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.events.*;
27
import org.eclipse.swt.events.*;
27
import org.eclipse.swt.layout.GridData;
28
import org.eclipse.swt.layout.GridData;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LauncherUtilsHelper.java (+132 lines)
Line 0 Link Here
1
package org.eclipse.pde.internal.ui.launcher;
2
3
import org.eclipse.pde.launching.launcher.ILauncherUtilsHelper;
4
5
import org.eclipse.pde.internal.launching.launcher.PDEMessages;
6
7
import java.util.*;
8
import org.eclipse.core.resources.IProject;
9
import org.eclipse.core.runtime.*;
10
import org.eclipse.jface.dialogs.IDialogConstants;
11
import org.eclipse.jface.dialogs.MessageDialog;
12
import org.eclipse.ltk.core.refactoring.Change;
13
import org.eclipse.osgi.util.NLS;
14
import org.eclipse.pde.internal.ui.PDEPlugin;
15
import org.eclipse.pde.internal.ui.PDEUIMessages;
16
import org.eclipse.pde.internal.ui.wizards.tools.OrganizeManifestsProcessor;
17
import org.eclipse.swt.widgets.Display;
18
import org.eclipse.swt.widgets.Shell;
19
import org.eclipse.ui.IWorkbenchWindow;
20
21
public class LauncherUtilsHelper implements ILauncherUtilsHelper {
22
23
	/* (non-Javadoc)
24
	 * @see org.eclipse.pde.internal.ui.launcher.ILauncherUtilsHelper#handleWorkspaceLocked(java.lang.String)
25
	 */
26
	public void handleWorkspaceLocked(String workspace) {
27
		generateErrorDialog(PDEUIMessages.LauncherUtils_workspaceLocked, NLS.bind(PDEMessages.LauncherUtils_cannotLaunchApplication, workspace));
28
	}
29
30
	private static void generateErrorDialog(final String title, final String message) {
31
		getDisplay().syncExec(new Runnable() {
32
			public void run() {
33
				MessageDialog dialog = new MessageDialog(getActiveShell(), title, null, message, MessageDialog.ERROR, new String[] {IDialogConstants.OK_LABEL}, 0);
34
				dialog.open();
35
			}
36
		});
37
	}
38
39
	public static Display getDisplay() {
40
		Display display = Display.getCurrent();
41
		if (display == null) {
42
			display = Display.getDefault();
43
		}
44
		return display;
45
	}
46
47
	/* (non-Javadoc)
48
	 * @see org.eclipse.pde.internal.ui.launcher.ILauncherUtilsHelper#doClearLog()
49
	 */
50
	public int doClearLog() {
51
		return generateDialog(PDEUIMessages.LauncherUtils_clearLogFile);
52
	}
53
54
	/**
55
	 * Creates a message dialog using a syncExec in case we are launching in the background.
56
	 * Dialog will be a question dialog with Yes, No and Cancel buttons.
57
	 * @param message Message to use in the dialog
58
	 * @return int representing the button clicked (-1 or 2 for cancel, 0 for yes, 1 for no).
59
	 */
60
	private static int generateDialog(final String message) {
61
		final int[] result = new int[1];
62
		getDisplay().syncExec(new Runnable() {
63
			public void run() {
64
				String title = PDEUIMessages.LauncherUtils_title;
65
				MessageDialog dialog = new MessageDialog(getActiveShell(), title, null, message, MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
66
				result[0] = dialog.open();
67
			}
68
		});
69
		return result[0];
70
	}
71
72
	/* (non-Javadoc)
73
	 * @see org.eclipse.pde.internal.ui.launcher.ILauncherUtilsHelper#doDeleteWorkspace(java.lang.String)
74
	 */
75
	public int doDeleteWorkspace(String path) {
76
		return generateDialog(NLS.bind(PDEUIMessages.WorkbenchLauncherConfigurationDelegate_confirmDeleteWorkspace, path));
77
	}
78
79
	/* (non-Javadoc)
80
	 * @see org.eclipse.pde.internal.ui.launcher.ILauncherUtilsHelper#organizeManifests(java.util.ArrayList, org.eclipse.core.runtime.IProgressMonitor, java.util.Properties)
81
	 */
82
	public void organizeManifests(final ArrayList projects, final IProgressMonitor monitor, final Properties lastRun) {
83
		Display.getDefault().syncExec(new Runnable() {
84
			public void run() {
85
				OrganizeManifestsProcessor processor = new OrganizeManifestsProcessor(projects);
86
				initializeProcessor(processor);
87
				try {
88
					Change change = processor.createChange(monitor);
89
					change.perform(monitor);
90
					// update table for each project with current time stamp
91
					Properties table = lastRun;
92
					String ts = Long.toString(System.currentTimeMillis());
93
					Iterator it = projects.iterator();
94
					while (it.hasNext())
95
						table.put(((IProject) it.next()).getName(), ts);
96
				} catch (OperationCanceledException e) {
97
				} catch (CoreException e) {
98
				}
99
			}
100
		});
101
	}
102
103
	private static void initializeProcessor(OrganizeManifestsProcessor processor) {
104
		processor.setAddMissing(false);
105
		processor.setRemoveUnresolved(false);
106
		processor.setModifyDep(false);
107
		processor.setRemoveLazy(false);
108
		processor.setRemoveUselessFiles(false);
109
		processor.setAddDependencies(true);
110
		processor.setCalculateUses(false);
111
		processor.setMarkInternal(false);
112
		processor.setPrefixIconNL(false);
113
		processor.setUnusedDependencies(false);
114
		processor.setUnusedKeys(false);
115
	}
116
117
	public final static Shell getActiveShell() {
118
		IWorkbenchWindow window = PDEPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
119
		if (window == null) {
120
			IWorkbenchWindow[] windows = PDEPlugin.getDefault().getWorkbench().getWorkbenchWindows();
121
			if (windows.length > 0)
122
				return windows[0].getShell();
123
		} else
124
			return window.getShell();
125
		return getDisplay().getActiveShell();
126
	}
127
128
	public boolean generateConfigIni() {
129
		String message = PDEUIMessages.LauncherUtils_generateConfigIni;
130
		return generateDialog(message) == 0;
131
	}
132
}
0
  + text/plain
133
  + text/plain
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/OSGiFrameworkBlock.java (-5 / +8 lines)
Lines 10-23 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
11
package org.eclipse.pde.internal.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
15
16
import org.eclipse.pde.internal.launching.launcher.OSGiFrameworkManager;
17
13
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IConfigurationElement;
19
import org.eclipse.core.runtime.IConfigurationElement;
15
import org.eclipse.debug.core.ILaunchConfiguration;
20
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
21
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
17
import org.eclipse.pde.internal.ui.PDEPlugin;
18
import org.eclipse.pde.internal.ui.PDEUIMessages;
22
import org.eclipse.pde.internal.ui.PDEUIMessages;
19
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
23
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
20
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
21
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.events.*;
25
import org.eclipse.swt.events.*;
23
import org.eclipse.swt.layout.GridData;
26
import org.eclipse.swt.layout.GridData;
Lines 46-52 Link Here
46
49
47
	public OSGiFrameworkBlock(AbstractLauncherTab tab) {
50
	public OSGiFrameworkBlock(AbstractLauncherTab tab) {
48
		fTab = tab;
51
		fTab = tab;
49
		fConfigElements = PDEPlugin.getDefault().getOSGiFrameworkManager().getSortedFrameworks();
52
		fConfigElements = PDELaunchingPlugin.getDefault().getOSGiFrameworkManager().getSortedFrameworks();
50
		fListener = new Listener();
53
		fListener = new Listener();
51
	}
54
	}
52
55
Lines 106-112 Link Here
106
	}
109
	}
107
110
108
	private void initializeFramework(ILaunchConfiguration config) throws CoreException {
111
	private void initializeFramework(ILaunchConfiguration config) throws CoreException {
109
		OSGiFrameworkManager manager = PDEPlugin.getDefault().getOSGiFrameworkManager();
112
		OSGiFrameworkManager manager = PDELaunchingPlugin.getDefault().getOSGiFrameworkManager();
110
		String id = config.getAttribute(IPDELauncherConstants.OSGI_FRAMEWORK_ID, manager.getDefaultFramework());
113
		String id = config.getAttribute(IPDELauncherConstants.OSGI_FRAMEWORK_ID, manager.getDefaultFramework());
111
114
112
		for (int i = 0; i < fConfigElements.length; i++) {
115
		for (int i = 0; i < fConfigElements.length; i++) {
Lines 125-131 Link Here
125
128
126
		int index = fLauncherCombo.getSelectionIndex();
129
		int index = fLauncherCombo.getSelectionIndex();
127
		String id = index > -1 ? fConfigElements[index].getAttribute(OSGiFrameworkManager.ATT_ID) : null;
130
		String id = index > -1 ? fConfigElements[index].getAttribute(OSGiFrameworkManager.ATT_ID) : null;
128
		OSGiFrameworkManager manager = PDEPlugin.getDefault().getOSGiFrameworkManager();
131
		OSGiFrameworkManager manager = PDELaunchingPlugin.getDefault().getOSGiFrameworkManager();
129
132
130
		// no need to persist the default OSGi framework
133
		// no need to persist the default OSGi framework
131
		if (manager.getDefaultFramework().equals(id))
134
		if (manager.getDefaultFramework().equals(id))
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/JREBlock.java (-1 / +4 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.launcher;
12
package org.eclipse.pde.internal.ui.launcher;
13
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
16
import org.eclipse.pde.internal.launching.launcher.VMHelper;
17
14
import java.util.Arrays;
18
import java.util.Arrays;
15
import java.util.Comparator;
19
import java.util.Comparator;
16
import org.eclipse.core.runtime.*;
20
import org.eclipse.core.runtime.*;
Lines 25-31 Link Here
25
import org.eclipse.pde.internal.ui.SWTFactory;
29
import org.eclipse.pde.internal.ui.SWTFactory;
26
import org.eclipse.pde.internal.ui.util.SWTUtil;
30
import org.eclipse.pde.internal.ui.util.SWTUtil;
27
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
31
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
28
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
29
import org.eclipse.swt.SWT;
32
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.events.*;
33
import org.eclipse.swt.events.*;
31
import org.eclipse.swt.layout.GridData;
34
import org.eclipse.swt.layout.GridData;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PDELaunchConfigurationHelper.java (+22 lines)
Line 0 Link Here
1
package org.eclipse.pde.internal.ui.launcher;
2
3
import org.eclipse.pde.launching.launcher.IPDELaunchConfigurationHelper;
4
5
import org.eclipse.core.runtime.CoreException;
6
import org.eclipse.jface.dialogs.MessageDialog;
7
import org.eclipse.pde.internal.ui.PDEUIMessages;
8
9
public class PDELaunchConfigurationHelper implements IPDELaunchConfigurationHelper {
10
11
	/* (non-Javadoc)
12
	 * @see org.eclipse.pde.launcher.IPDELanchConfigurationHelper#handleCoreException(org.eclipse.core.runtime.CoreException)
13
	 */
14
	public void handleCoreException(final CoreException e) {
15
		LauncherUtilsHelper.getDisplay().syncExec(new Runnable() {
16
			public void run() {
17
				MessageDialog.openError(LauncherUtilsHelper.getActiveShell(), PDEUIMessages.Launcher_error_title, e.getMessage());
18
			}
19
		});
20
	}
21
22
}
0
  + text/plain
23
  + text/plain
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/JUnitProgramBlock.java (-2 / +4 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
11
package org.eclipse.pde.internal.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
15
13
import java.util.TreeSet;
16
import java.util.TreeSet;
14
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.debug.core.ILaunchConfiguration;
18
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 17-23 Link Here
17
import org.eclipse.pde.internal.ui.IPDEUIConstants;
20
import org.eclipse.pde.internal.ui.IPDEUIConstants;
18
import org.eclipse.pde.internal.ui.PDEUIMessages;
21
import org.eclipse.pde.internal.ui.PDEUIMessages;
19
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
22
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
20
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
21
23
22
public class JUnitProgramBlock extends ProgramBlock {
24
public class JUnitProgramBlock extends ProgramBlock {
23
25
Lines 30-36 Link Here
30
	}
32
	}
31
33
32
	public void setDefaults(ILaunchConfigurationWorkingCopy config) {
34
	public void setDefaults(ILaunchConfigurationWorkingCopy config) {
33
		if (!LauncherUtils.requiresUI(config))
35
		if (!PDELaunchingPlugin.getDefault().getLauncherUtils().requiresUI(config))
34
			config.setAttribute(IPDELauncherConstants.APPLICATION, IPDEUIConstants.CORE_TEST_APPLICATION);
36
			config.setAttribute(IPDELauncherConstants.APPLICATION, IPDEUIConstants.CORE_TEST_APPLICATION);
35
		else
37
		else
36
			super.setDefaults(config);
38
			super.setDefaults(config);
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java (-1 / +5 lines)
Lines 12-17 Link Here
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.pde.internal.ui.launcher;
13
package org.eclipse.pde.internal.ui.launcher;
14
14
15
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
16
17
import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper;
18
import org.eclipse.pde.internal.launching.launcher.LaunchValidationOperation;
19
15
import java.util.*;
20
import java.util.*;
16
import org.eclipse.core.resources.IProject;
21
import org.eclipse.core.resources.IProject;
17
import org.eclipse.core.resources.IResource;
22
import org.eclipse.core.resources.IResource;
Lines 35-41 Link Here
35
import org.eclipse.pde.internal.ui.util.*;
40
import org.eclipse.pde.internal.ui.util.*;
36
import org.eclipse.pde.internal.ui.wizards.ListUtil;
41
import org.eclipse.pde.internal.ui.wizards.ListUtil;
37
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
42
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
38
import org.eclipse.pde.ui.launcher.IPDELauncherConstants;
39
import org.eclipse.swt.SWT;
43
import org.eclipse.swt.SWT;
40
import org.eclipse.swt.SWTException;
44
import org.eclipse.swt.SWTException;
41
import org.eclipse.swt.custom.CCombo;
45
import org.eclipse.swt.custom.CCombo;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/MainPreferencePage.java (-2 / +25 lines)
Lines 11-20 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.preferences;
12
package org.eclipse.pde.internal.ui.preferences;
13
13
14
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
15
16
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
17
import org.eclipse.pde.internal.launching.IPDEConstants;
18
19
import org.eclipse.core.runtime.preferences.*;
14
import org.eclipse.jface.dialogs.Dialog;
20
import org.eclipse.jface.dialogs.Dialog;
15
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
21
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
16
import org.eclipse.jface.preference.IPreferenceStore;
22
import org.eclipse.jface.preference.IPreferenceStore;
17
import org.eclipse.jface.preference.PreferencePage;
23
import org.eclipse.jface.preference.PreferencePage;
24
import org.eclipse.pde.internal.core.PDEPreferencesManager;
18
import org.eclipse.pde.internal.ui.*;
25
import org.eclipse.pde.internal.ui.*;
19
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.events.SelectionAdapter;
27
import org.eclipse.swt.events.SelectionAdapter;
Lines 23-28 Link Here
23
import org.eclipse.swt.layout.GridLayout;
30
import org.eclipse.swt.layout.GridLayout;
24
import org.eclipse.swt.widgets.*;
31
import org.eclipse.swt.widgets.*;
25
import org.eclipse.ui.*;
32
import org.eclipse.ui.*;
33
import org.osgi.service.prefs.BackingStoreException;
26
34
27
public class MainPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
35
public class MainPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
28
	private Button fUseID;
36
	private Button fUseID;
Lines 39-44 Link Here
39
47
40
	protected Control createContents(Composite parent) {
48
	protected Control createContents(Composite parent) {
41
		IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore();
49
		IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore();
50
		PDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager();
42
51
43
		Composite composite = new Composite(parent, SWT.NONE);
52
		Composite composite = new Composite(parent, SWT.NONE);
44
		GridLayout layout = new GridLayout();
53
		GridLayout layout = new GridLayout();
Lines 63-69 Link Here
63
72
64
		fAutoManage = new Button(group, SWT.CHECK);
73
		fAutoManage = new Button(group, SWT.CHECK);
65
		fAutoManage.setText(PDEUIMessages.MainPreferencePage_updateStale);
74
		fAutoManage.setText(PDEUIMessages.MainPreferencePage_updateStale);
66
		fAutoManage.setSelection(store.getBoolean(IPreferenceConstants.PROP_AUTO_MANAGE));
75
		fAutoManage.setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE));
67
76
68
		group = SWTFactory.createGroup(composite, PDEUIMessages.MainPreferencePage_exportingGroup, 1, 1, GridData.FILL_HORIZONTAL);
77
		group = SWTFactory.createGroup(composite, PDEUIMessages.MainPreferencePage_exportingGroup, 1, 1, GridData.FILL_HORIZONTAL);
69
78
Lines 107-116 Link Here
107
		} else {
116
		} else {
108
			store.setValue(IPreferenceConstants.PROP_SHOW_OBJECTS, IPreferenceConstants.VALUE_USE_NAMES);
117
			store.setValue(IPreferenceConstants.PROP_SHOW_OBJECTS, IPreferenceConstants.VALUE_USE_NAMES);
109
		}
118
		}
110
		store.setValue(IPreferenceConstants.PROP_AUTO_MANAGE, fAutoManage.getSelection());
111
		store.setValue(IPreferenceConstants.OVERWRITE_BUILD_FILES_ON_EXPORT, fOverwriteBuildFiles.getSelection() ? MessageDialogWithToggle.PROMPT : MessageDialogWithToggle.ALWAYS);
119
		store.setValue(IPreferenceConstants.OVERWRITE_BUILD_FILES_ON_EXPORT, fOverwriteBuildFiles.getSelection() ? MessageDialogWithToggle.PROMPT : MessageDialogWithToggle.ALWAYS);
112
		store.setValue(IPreferenceConstants.PROP_SHOW_SOURCE_BUNDLES, fShowSourceBundles.getSelection());
120
		store.setValue(IPreferenceConstants.PROP_SHOW_SOURCE_BUNDLES, fShowSourceBundles.getSelection());
113
		PDEPlugin.getDefault().getPreferenceManager().savePluginPreferences();
121
		PDEPlugin.getDefault().getPreferenceManager().savePluginPreferences();
122
123
		// write AUTO_MANAGE setting to pde.launching instance scope 
124
		IEclipsePreferences instancePrefs = new InstanceScope().getNode(IPDEConstants.PLUGIN_ID);
125
		IEclipsePreferences defaultPrefs = new DefaultScope().getNode(IPDEConstants.PLUGIN_ID);
126
		if (defaultPrefs.getBoolean(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE, false) == fAutoManage.getSelection()) {
127
			instancePrefs.remove(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE);
128
		} else {
129
			instancePrefs.putBoolean(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE, fAutoManage.getSelection());
130
		}
131
		try {
132
			instancePrefs.flush();
133
		} catch (BackingStoreException e) {
134
			PDEPlugin.log(e);
135
		}
136
114
		return super.performOk();
137
		return super.performOk();
115
	}
138
	}
116
139
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PreferenceInitializer.java (-2 lines)
Lines 15-21 Link Here
15
import org.eclipse.pde.internal.ui.IPreferenceConstants;
15
import org.eclipse.pde.internal.ui.IPreferenceConstants;
16
import org.eclipse.pde.internal.ui.PDEPlugin;
16
import org.eclipse.pde.internal.ui.PDEPlugin;
17
import org.eclipse.pde.internal.ui.editor.text.ColorManager;
17
import org.eclipse.pde.internal.ui.editor.text.ColorManager;
18
import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkManager;
19
18
20
public class PreferenceInitializer extends AbstractPreferenceInitializer {
19
public class PreferenceInitializer extends AbstractPreferenceInitializer {
21
20
Lines 27-33 Link Here
27
		ColorManager.initializeDefaults(store);
26
		ColorManager.initializeDefaults(store);
28
		store.setDefault(IPreferenceConstants.PROP_SHOW_OBJECTS, IPreferenceConstants.VALUE_USE_IDS);
27
		store.setDefault(IPreferenceConstants.PROP_SHOW_OBJECTS, IPreferenceConstants.VALUE_USE_IDS);
29
		store.setDefault(IPreferenceConstants.EDITOR_FOLDING_ENABLED, false);
28
		store.setDefault(IPreferenceConstants.EDITOR_FOLDING_ENABLED, false);
30
		store.setDefault(IPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK, OSGiFrameworkManager.DEFAULT_FRAMEWORK);
31
	}
29
	}
32
30
33
}
31
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/OSGiFrameworkPreferencePage.java (-9 / +26 lines)
Lines 12-28 Link Here
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.pde.internal.ui.preferences;
13
package org.eclipse.pde.internal.ui.preferences;
14
14
15
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
16
17
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
18
import org.eclipse.pde.internal.launching.IPDEConstants;
19
import org.eclipse.pde.internal.launching.launcher.OSGiFrameworkManager;
20
15
import org.eclipse.core.runtime.IConfigurationElement;
21
import org.eclipse.core.runtime.IConfigurationElement;
22
import org.eclipse.core.runtime.preferences.*;
16
import org.eclipse.jface.dialogs.Dialog;
23
import org.eclipse.jface.dialogs.Dialog;
17
import org.eclipse.jface.preference.IPreferenceStore;
18
import org.eclipse.jface.preference.PreferencePage;
24
import org.eclipse.jface.preference.PreferencePage;
19
import org.eclipse.jface.resource.JFaceResources;
25
import org.eclipse.jface.resource.JFaceResources;
20
import org.eclipse.jface.viewers.*;
26
import org.eclipse.jface.viewers.*;
21
import org.eclipse.pde.core.plugin.IPluginExtensionPoint;
27
import org.eclipse.pde.core.plugin.IPluginExtensionPoint;
22
import org.eclipse.pde.internal.core.PDECore;
28
import org.eclipse.pde.internal.core.PDECore;
29
import org.eclipse.pde.internal.core.PDEPreferencesManager;
23
import org.eclipse.pde.internal.core.schema.SchemaRegistry;
30
import org.eclipse.pde.internal.core.schema.SchemaRegistry;
24
import org.eclipse.pde.internal.ui.*;
31
import org.eclipse.pde.internal.ui.*;
25
import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkManager;
26
import org.eclipse.pde.internal.ui.search.ShowDescriptionAction;
32
import org.eclipse.pde.internal.ui.search.ShowDescriptionAction;
27
import org.eclipse.swt.SWT;
33
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.events.SelectionAdapter;
34
import org.eclipse.swt.events.SelectionAdapter;
Lines 31-36 Link Here
31
import org.eclipse.swt.layout.GridData;
37
import org.eclipse.swt.layout.GridData;
32
import org.eclipse.swt.widgets.*;
38
import org.eclipse.swt.widgets.*;
33
import org.eclipse.ui.*;
39
import org.eclipse.ui.*;
40
import org.osgi.service.prefs.BackingStoreException;
34
41
35
/**
42
/**
36
 * Provides the preference page for managing the default OSGi framework to use.
43
 * Provides the preference page for managing the default OSGi framework to use.
Lines 106-113 Link Here
106
	 * Restores the default framework setting from the PDE preferences
113
	 * Restores the default framework setting from the PDE preferences
107
	 */
114
	 */
108
	private void setDefaultFramework() {
115
	private void setDefaultFramework() {
109
		IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore();
116
		PDEPreferencesManager preferenceManager = PDELaunchingPlugin.getDefault().getPreferenceManager();
110
		fDefaultFramework = store.getString(IPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK);
117
		fDefaultFramework = preferenceManager.getString(ILaunchingPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK);
111
	}
118
	}
112
119
113
	/* (non-Javadoc)
120
	/* (non-Javadoc)
Lines 132-138 Link Here
132
		fTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
139
		fTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
133
		fTableViewer.setContentProvider(ArrayContentProvider.getInstance());
140
		fTableViewer.setContentProvider(ArrayContentProvider.getInstance());
134
		fTableViewer.setLabelProvider(new FrameworkLabelProvider());
141
		fTableViewer.setLabelProvider(new FrameworkLabelProvider());
135
		fTableViewer.setInput(PDEPlugin.getDefault().getOSGiFrameworkManager().getSortedFrameworks());
142
		fTableViewer.setInput(PDELaunchingPlugin.getDefault().getOSGiFrameworkManager().getSortedFrameworks());
136
		fTableViewer.addCheckStateListener(new ICheckStateListener() {
143
		fTableViewer.addCheckStateListener(new ICheckStateListener() {
137
			public void checkStateChanged(CheckStateChangedEvent event) {
144
			public void checkStateChanged(CheckStateChangedEvent event) {
138
				IConfigurationElement element = (IConfigurationElement) event.getElement();
145
				IConfigurationElement element = (IConfigurationElement) event.getElement();
Lines 142-148 Link Here
142
			}
149
			}
143
		});
150
		});
144
		if (fDefaultFramework != null) {
151
		if (fDefaultFramework != null) {
145
			IConfigurationElement element = PDEPlugin.getDefault().getOSGiFrameworkManager().getFramework(fDefaultFramework);
152
			IConfigurationElement element = PDELaunchingPlugin.getDefault().getOSGiFrameworkManager().getFramework(fDefaultFramework);
146
			if (element != null) {
153
			if (element != null) {
147
				fTableViewer.setCheckedElements(new Object[] {element});
154
				fTableViewer.setCheckedElements(new Object[] {element});
148
			}
155
			}
Lines 156-164 Link Here
156
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
163
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
157
	 */
164
	 */
158
	public boolean performOk() {
165
	public boolean performOk() {
159
		IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore();
166
		IEclipsePreferences instancePrefs = new InstanceScope().getNode(IPDEConstants.PLUGIN_ID);
160
		store.setValue(IPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK, fDefaultFramework);
167
		IEclipsePreferences defaultPrefs = new DefaultScope().getNode(IPDEConstants.PLUGIN_ID);
161
		PDEPlugin.getDefault().getPreferenceManager().savePluginPreferences();
168
		if (defaultPrefs.get(ILaunchingPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK, "").equals(fDefaultFramework)) { //$NON-NLS-1$
169
			instancePrefs.remove(ILaunchingPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK);
170
		} else {
171
			instancePrefs.put(ILaunchingPreferenceConstants.DEFAULT_OSGI_FRAMEOWRK, fDefaultFramework);
172
		}
173
		try {
174
			instancePrefs.flush();
175
		} catch (BackingStoreException e) {
176
			PDEPlugin.log(e);
177
		}
178
162
		return super.performOk();
179
		return super.performOk();
163
	}
180
	}
164
181
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/IPreferenceConstants.java (-5 / +3 lines)
Lines 11-28 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui;
12
package org.eclipse.pde.internal.ui;
13
13
14
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
15
14
/**
16
/**
15
 * Listing of constants used in PDE preferences
17
 * Listing of constants used in PDE preferences
16
 * 
18
 * 
17
 * @noimplement This interface is not intended to be implemented by clients.
19
 * @noimplement This interface is not intended to be implemented by clients.
18
 */
20
 */
19
public interface IPreferenceConstants {
21
public interface IPreferenceConstants extends ILaunchingPreferenceConstants {
20
22
21
	// Main preference page	
23
	// Main preference page	
22
	public static final String PROP_SHOW_OBJECTS = "Preferences.MainPage.showObjects"; //$NON-NLS-1$
24
	public static final String PROP_SHOW_OBJECTS = "Preferences.MainPage.showObjects"; //$NON-NLS-1$
23
	public static final String VALUE_USE_IDS = "useIds"; //$NON-NLS-1$
25
	public static final String VALUE_USE_IDS = "useIds"; //$NON-NLS-1$
24
	public static final String VALUE_USE_NAMES = "useNames"; //$NON-NLS-1$
26
	public static final String VALUE_USE_NAMES = "useNames"; //$NON-NLS-1$
25
	public static final String PROP_AUTO_MANAGE = "Preferences.MainPage.automanageDependencies"; //$NON-NLS-1$
26
	public static final String PROP_SHOW_SOURCE_BUNDLES = "Preferences.MainPage.showSourceBundles"; //$NON-NLS-1$
27
	public static final String PROP_SHOW_SOURCE_BUNDLES = "Preferences.MainPage.showSourceBundles"; //$NON-NLS-1$
27
	public static final String OVERWRITE_BUILD_FILES_ON_EXPORT = "Preferences.MainPage.overwriteBuildFilesOnExport"; //$NON-NLS-1$
28
	public static final String OVERWRITE_BUILD_FILES_ON_EXPORT = "Preferences.MainPage.overwriteBuildFilesOnExport"; //$NON-NLS-1$
28
	public static final String PROP_PROMPT_REMOVE_TARGET = "Preferences.MainPage.promptRemoveTarget"; //$NON-NLS-1$
29
	public static final String PROP_PROMPT_REMOVE_TARGET = "Preferences.MainPage.promptRemoveTarget"; //$NON-NLS-1$
Lines 37-43 Link Here
37
	public static final String DEPS_VIEW_SHOW_CALLERS = "DependenciesView.show.callers"; //$NON-NLS-1$
38
	public static final String DEPS_VIEW_SHOW_CALLERS = "DependenciesView.show.callers"; //$NON-NLS-1$
38
	public static final String DEPS_VIEW_SHOW_LIST = "DependenciesView.show.list"; //$NON-NLS-1$
39
	public static final String DEPS_VIEW_SHOW_LIST = "DependenciesView.show.list"; //$NON-NLS-1$
39
	public static final String DEPS_VIEW_SHOW_STATE = "DependenciesView.show.state"; //$NON-NLS-1$
40
	public static final String DEPS_VIEW_SHOW_STATE = "DependenciesView.show.state"; //$NON-NLS-1$
40
41
	// OSGi Frameworks
42
	public static final String DEFAULT_OSGI_FRAMEOWRK = "Preference.default.osgi.framework"; //$NON-NLS-1$
43
}
41
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEPlugin.java (-90 / +8 lines)
Lines 10-28 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui;
11
package org.eclipse.pde.internal.ui;
12
12
13
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
14
13
import java.lang.reflect.InvocationTargetException;
15
import java.lang.reflect.InvocationTargetException;
14
import java.net.URL;
16
import java.net.URL;
15
import java.util.Hashtable;
17
import java.util.Hashtable;
16
import org.eclipse.core.resources.IWorkspace;
18
import org.eclipse.core.resources.IWorkspace;
17
import org.eclipse.core.resources.ResourcesPlugin;
19
import org.eclipse.core.resources.ResourcesPlugin;
18
import org.eclipse.core.runtime.*;
20
import org.eclipse.core.runtime.*;
19
import org.eclipse.debug.core.DebugPlugin;
20
import org.eclipse.debug.core.ILaunchConfigurationListener;
21
import org.eclipse.jface.dialogs.ErrorDialog;
21
import org.eclipse.jface.dialogs.ErrorDialog;
22
import org.eclipse.jface.preference.IPreferenceStore;
22
import org.eclipse.jface.preference.IPreferenceStore;
23
import org.eclipse.pde.internal.core.PDEPreferencesManager;
23
import org.eclipse.pde.internal.core.PDEPreferencesManager;
24
import org.eclipse.pde.internal.ui.launcher.*;
24
import org.eclipse.pde.internal.ui.launcher.PDELogFileProvider;
25
import org.eclipse.pde.internal.ui.util.SWTUtil;
25
import org.eclipse.pde.internal.ui.util.SWTUtil;
26
import org.eclipse.pde.ui.launcher.UILauncherSettings;
26
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.ui.IWorkbenchPage;
29
import org.eclipse.ui.IWorkbenchPage;
Lines 33-50 Link Here
33
import org.eclipse.ui.internal.views.log.LogFilesManager;
34
import org.eclipse.ui.internal.views.log.LogFilesManager;
34
import org.eclipse.ui.plugin.AbstractUIPlugin;
35
import org.eclipse.ui.plugin.AbstractUIPlugin;
35
import org.eclipse.ui.texteditor.IDocumentProvider;
36
import org.eclipse.ui.texteditor.IDocumentProvider;
36
import org.osgi.framework.*;
37
import org.osgi.framework.BundleContext;
37
38
38
public class PDEPlugin extends AbstractUIPlugin implements IPDEUIConstants {
39
public class PDEPlugin extends AbstractUIPlugin implements IPDEUIConstants {
39
40
40
	// Shared instance
41
	// Shared instance
41
	private static PDEPlugin fInstance;
42
	private static PDEPlugin fInstance;
42
43
43
	// Launches listener
44
	private LaunchListener fLaunchListener;
45
46
	private BundleContext fBundleContext;
47
48
	private Hashtable fCounters;
44
	private Hashtable fCounters;
49
45
50
	// Provides Launch Configurations log files to Log View
46
	// Provides Launch Configurations log files to Log View
Lines 55-73 Link Here
55
	private PDELabelProvider fLabelProvider;
51
	private PDELabelProvider fLabelProvider;
56
52
57
	/**
53
	/**
58
	 * Utility class to help setup the launch configuration listener
59
	 * without loading the debug plugin
60
	 */
61
	private DebugPluginUtil fDebugPluginUtil;
62
63
	/**
64
	 * The shared text file document provider.
54
	 * The shared text file document provider.
65
	 * @since 3.2
55
	 * @since 3.2
66
	 */
56
	 */
67
	private IDocumentProvider fTextFileDocumentProvider;
57
	private IDocumentProvider fTextFileDocumentProvider;
68
58
69
	private OSGiFrameworkManager fOSGiFrameworkManager;
70
71
	private PDEPreferencesManager fPreferenceManager;
59
	private PDEPreferencesManager fPreferenceManager;
72
60
73
	public PDEPlugin() {
61
	public PDEPlugin() {
Lines 183-231 Link Here
183
	 */
171
	 */
184
	public void start(BundleContext context) throws Exception {
172
	public void start(BundleContext context) throws Exception {
185
		super.start(context);
173
		super.start(context);
186
		fBundleContext = context;
187
		setupLaunchConfigurationListener();
188
		fLogFileProvider = new PDELogFileProvider();
174
		fLogFileProvider = new PDELogFileProvider();
175
		PDELaunchingPlugin.getDefault().setLauncherSettings(new UILauncherSettings());
189
		LogFilesManager.addLogFileProvider(fLogFileProvider);
176
		LogFilesManager.addLogFileProvider(fLogFileProvider);
190
	}
177
	}
191
178
192
	/**
193
	 * Add the launch configuration listener if the debug plugin
194
	 * is started.  Otherwise, setup a bundle listener to install
195
	 * the listener when the debug plugin loads.
196
	 * @param context bundle context needed to get current bundles
197
	 */
198
	private void setupLaunchConfigurationListener() {
199
		boolean listenerStarted = false;
200
		Bundle bundle = Platform.getBundle("org.eclipse.debug.core"); //$NON-NLS-1$
201
		if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
202
			fDebugPluginUtil = new DebugPluginUtil();
203
			fDebugPluginUtil.addListener();
204
			listenerStarted = true;
205
		}
206
		if (!listenerStarted) {
207
			fBundleContext.addBundleListener(new BundleListener() {
208
				public void bundleChanged(BundleEvent event) {
209
					if (event.getType() == BundleEvent.STARTED && "org.eclipse.debug.core".equals(event.getBundle().getSymbolicName())) { //$NON-NLS-1$
210
						fDebugPluginUtil = new DebugPluginUtil();
211
						fDebugPluginUtil.addListener();
212
						fBundleContext.removeBundleListener(this);
213
					}
214
				}
215
			});
216
		}
217
	}
218
219
	public BundleContext getBundleContext() {
220
		return fBundleContext;
221
	}
222
223
	/* (non-Javadoc)
179
	/* (non-Javadoc)
224
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
180
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
225
	 */
181
	 */
226
	public void stop(BundleContext context) throws Exception {
182
	public void stop(BundleContext context) throws Exception {
227
		if (fLaunchListener != null)
228
			fLaunchListener.shutdown();
229
		if (fFormColors != null) {
183
		if (fFormColors != null) {
230
			fFormColors.dispose();
184
			fFormColors.dispose();
231
			fFormColors = null;
185
			fFormColors = null;
Lines 234-247 Link Here
234
			fLabelProvider.dispose();
188
			fLabelProvider.dispose();
235
			fLabelProvider = null;
189
			fLabelProvider = null;
236
		}
190
		}
237
		if (fDebugPluginUtil != null) {
238
			fDebugPluginUtil.removeListener();
239
		}
240
		if (fLogFileProvider != null) {
191
		if (fLogFileProvider != null) {
241
			LogFilesManager.removeLogFileProvider(fLogFileProvider);
192
			LogFilesManager.removeLogFileProvider(fLogFileProvider);
242
			fLogFileProvider = null;
193
			fLogFileProvider = null;
243
		}
194
		}
244
		LauncherUtils.shutdown();
195
		if (PDELaunchingPlugin.getDefault() != null)
196
			PDELaunchingPlugin.getDefault().setLauncherSettings(null);
245
		super.stop(context);
197
		super.stop(context);
246
	}
198
	}
247
199
Lines 251-268 Link Here
251
		return fLabelProvider;
203
		return fLabelProvider;
252
	}
204
	}
253
205
254
	public LaunchListener getLaunchListener() {
255
		if (fLaunchListener == null)
256
			fLaunchListener = new LaunchListener();
257
		return fLaunchListener;
258
	}
259
260
	public OSGiFrameworkManager getOSGiFrameworkManager() {
261
		if (fOSGiFrameworkManager == null)
262
			fOSGiFrameworkManager = new OSGiFrameworkManager();
263
		return fOSGiFrameworkManager;
264
	}
265
266
	public static boolean isFullNameModeEnabled() {
206
	public static boolean isFullNameModeEnabled() {
267
		IPreferenceStore store = getDefault().getPreferenceStore();
207
		IPreferenceStore store = getDefault().getPreferenceStore();
268
		return store.getString(IPreferenceConstants.PROP_SHOW_OBJECTS).equals(IPreferenceConstants.VALUE_USE_NAMES);
208
		return store.getString(IPreferenceConstants.PROP_SHOW_OBJECTS).equals(IPreferenceConstants.VALUE_USE_NAMES);
Lines 280-305 Link Here
280
		return fTextFileDocumentProvider;
220
		return fTextFileDocumentProvider;
281
	}
221
	}
282
222
283
	/**
284
	 * Utility class that creates and controls a the PDE launch configuration listener.
285
	 * This is done in a separate class to avoid loading the debug plugin.
286
	 * @since 3.4
287
	 */
288
	private class DebugPluginUtil {
289
		private ILaunchConfigurationListener fLaunchConfigurationListener;
290
291
		public void addListener() {
292
			if (fLaunchConfigurationListener == null) {
293
				fLaunchConfigurationListener = new LaunchConfigurationListener();
294
			}
295
			DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(fLaunchConfigurationListener);
296
		}
297
298
		public void removeListener() {
299
			if (fLaunchConfigurationListener != null) {
300
				DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(fLaunchConfigurationListener);
301
				fLaunchConfigurationListener = null;
302
			}
303
		}
304
	}
305
}
223
}
(-)org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java (-14 lines)
Lines 179-186 Link Here
179
179
180
	public static String LauncherUtils_workspaceLocked;
180
	public static String LauncherUtils_workspaceLocked;
181
181
182
	public static String LauncherUtils_cannotLaunchApplication;
183
184
	public static String LauncherUtils_clearLogFile;
182
	public static String LauncherUtils_clearLogFile;
185
183
186
	public static String LauncherUtils_generateConfigIni;
184
	public static String LauncherUtils_generateConfigIni;
Lines 895-907 Link Here
895
	public static String ConfigurationSection_selection;
893
	public static String ConfigurationSection_selection;
896
	public static String ConfigurationTab_fileDialogMessage;
894
	public static String ConfigurationTab_fileDialogMessage;
897
895
898
	public static String WorkbenchLauncherConfigurationDelegate_noJRE;
899
	public static String WorkbenchLauncherConfigurationDelegate_jrePathNotFound;
900
	public static String WorkbenchLauncherConfigurationDelegate_badFeatureSetup;
901
	public static String WorkbenchLauncherConfigurationDelegate_noStartup;
902
	public static String WorkbenchLauncherConfigurationDelegate_confirmDeleteWorkspace;
896
	public static String WorkbenchLauncherConfigurationDelegate_confirmDeleteWorkspace;
903
	public static String JUnitLaunchConfiguration_error_notaplugin;
904
	public static String JUnitLaunchConfiguration_error_missingPlugin;
905
897
906
	public static String Launcher_error_title;
898
	public static String Launcher_error_title;
907
	public static String LauncherSection_desc;
899
	public static String LauncherSection_desc;
Lines 933-940 Link Here
933
	public static String OpenLogDialog_cannotDisplay;
925
	public static String OpenLogDialog_cannotDisplay;
934
926
935
	public static String OSGiBundlesTab_frameworkLabel;
927
	public static String OSGiBundlesTab_frameworkLabel;
936
	public static String OSGiLaunchConfiguration_cannotFindLaunchConfiguration;
937
	public static String OSGiLaunchConfiguration_selected;
938
928
939
	// Preferences ####################################
929
	// Preferences ####################################
940
	public static String Preferences_MainPage_Description;
930
	public static String Preferences_MainPage_Description;
Lines 2102-2109 Link Here
2102
2092
2103
	public static String EquinoxSettingsTab_name;
2093
	public static String EquinoxSettingsTab_name;
2104
2094
2105
	public static String EquinoxLaunchConfiguration_oldTarget;
2106
2107
	public static String ModelChangeLabelProvider_instance;
2095
	public static String ModelChangeLabelProvider_instance;
2108
2096
2109
	public static String ModelChangeLabelProvider_instances;
2097
	public static String ModelChangeLabelProvider_instances;
Lines 2757-2764 Link Here
2757
	public static String HyperlinkActionOpenBundle;
2745
	public static String HyperlinkActionOpenBundle;
2758
	public static String HyperlinkActionOpenPackage;
2746
	public static String HyperlinkActionOpenPackage;
2759
2747
2760
	public static String VMHelper_cannotFindExecEnv;
2761
2762
	public static String HyperlinkActionOpenResource;
2748
	public static String HyperlinkActionOpenResource;
2763
	public static String HyperlinkActionOpenSchema;
2749
	public static String HyperlinkActionOpenSchema;
2764
	public static String HyperlinkActionOpenTranslation;
2750
	public static String HyperlinkActionOpenTranslation;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/IPDELauncherConstants.java (-374 / +2 lines)
Lines 19-398 Link Here
19
 * 
19
 * 
20
 * @noimplement This interface is not intended to be implemented by clients.
20
 * @noimplement This interface is not intended to be implemented by clients.
21
 * @noextend This interface is not intended to be extended by clients.
21
 * @noextend This interface is not intended to be extended by clients.
22
 * @deprecated Use {@link org.eclipse.pde.launching.launcher.IPDELauncherConstants} instead.
22
 */
23
 */
23
public interface IPDELauncherConstants {
24
public interface IPDELauncherConstants extends org.eclipse.pde.launching.launcher.IPDELauncherConstants {
24
25
	/**
26
	 * Launch configuration attribute key. The value is a string specifying
27
	 * workspace data location for an Eclipse application.
28
	 */
29
	String LOCATION = "location"; //$NON-NLS-1$
30
31
	/**
32
	 * Launch configuration attribute key. The value is a boolean specifying
33
	 * workspace data location for an Eclipse application should be cleared
34
	 * prior to launching.
35
	 */
36
	String DOCLEAR = "clearws"; //$NON-NLS-1$
37
38
	/**
39
	 * Launch configuration attribute key. The value is a boolean specifying
40
	 * whether the user should be prompted prior to clearing the workspace.
41
	 * 
42
	 * @see IPDELauncherConstants#DOCLEAR
43
	 */
44
	String ASKCLEAR = "askclear"; //$NON-NLS-1$
45
46
	/**
47
	 * Launch configuration attribute key. The value is a string specifying
48
	 * the application to run.  If the value is <code>null</code>, the default 
49
	 * application as specified in the target platform will be used.
50
	 */
51
	String APPLICATION = "application"; //$NON-NLS-1$
52
53
	/**
54
	 * Launch configuration attribute key. The value is a string specifying
55
	 * the product to run.
56
	 * 
57
	 * @see IPDELauncherConstants#APPLICATION
58
	 */
59
	String PRODUCT = "product"; //$NON-NLS-1$
60
61
	/**
62
	 * Launch configuration attribute key. The value is a boolean specifying
63
	 * if the launch should appear in product-mode.  If the value is <code>false</code>,
64
	 * the launch takes place in application-mode.
65
	 * 
66
	 * @see IPDELauncherConstants#PRODUCT
67
	 * @see IPDELauncherConstants#APPLICATION
68
	 */
69
	String USE_PRODUCT = "useProduct"; //$NON-NLS-1$
70
71
	/**
72
	 * Launch configuration attribute key used in Plug-in JUnit launch configurations only. 
73
	 * The value is a string specifying the application to be tested.  
74
	 * If the value is <code>null</code>, the default UI workbench application is tested.
75
	 */
76
	String APP_TO_TEST = "testApplication"; //$NON-NLS-1$
77
78
	/**
79
	 * Launch configuration attribute key. The value is a string specifying
80
	 * the name of the VM to launch with.  If the value is <code>null</code>,
81
	 * the default workspace VM is used.
82
	 * 
83
	 * @deprecated use IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH
84
	 */
85
	String VMINSTALL = "vminstall"; //$NON-NLS-1$
86
87
	/**
88
	 * Launch configuration attribute key. The value is a string specifying
89
	 * the user-entered bootstrap classpath entries. 
90
	 */
91
	String BOOTSTRAP_ENTRIES = "bootstrap"; //$NON-NLS-1$
92
93
	/**
94
	 * Launch configuration attribute key. The value is a boolean specifying
95
	 * if the default self-hosting mode should be used when launching.
96
	 * The default being to launch with all workspace plug-ins and all the 
97
	 * plug-ins that are explicitly checked on the Target Platform preference page.
98
	 */
99
	String USE_DEFAULT = "default"; //$NON-NLS-1$
100
101
	/**
102
	 * Launch configuration attribute key. The value is a boolean specifying
103
	 * if the feature-based self-hosting mode should be used.
104
	 * The workspace must be set up properly for the feature-based self-hosting
105
	 * to succeed.
106
	 * Check the PDE Tips and Tricks section for how to set up feature-based self-hosting.
107
	 */
108
	String USEFEATURES = "usefeatures"; //$NON-NLS-1$
109
110
	/**
111
	 * Launch configuration attribute key. The value is a string specifying
112
	 * a comma-separated list of IDs of workspace plug-ins to launch with.
113
	 * This value is only used when the Automatic Add option is off.
114
	 * 
115
	 * @see IPDELauncherConstants#AUTOMATIC_ADD
116
	 */
117
	String SELECTED_WORKSPACE_PLUGINS = "selected_workspace_plugins"; //$NON-NLS-1$
118
119
	/**
120
	 * Launch configuration attribute key. The value is a string specifying
121
	 * a comma-separated list of IDs of workspace plug-ins that are to be excluded from
122
	 * the launch.
123
	 * This value is only used when the Automatic Add option is on.
124
	 * 
125
	 * @see IPDELauncherConstants#AUTOMATIC_ADD
126
	 */
127
	String DESELECTED_WORKSPACE_PLUGINS = "deselected_workspace_plugins"; //$NON-NLS-1$
128
129
	/**
130
	 * Launch configuration attribute key. The value is a boolean specifying
131
	 * whether workspace plug-in created after the creation of a launch configuration
132
	 * should be added to the list of plug-ins to launch with.
133
	 * 
134
	 * If the value is <code>true</code>, then DESELECTED_WORKSPACE_PLUGINS should be used.
135
	 * Otherwise, SELECTED_WORKSPACE_PLUGINS should be used.
136
	 * 
137
	 * @see IPDELauncherConstants#DESELECTED_WORKSPACE_PLUGINS
138
	 * @see IPDELauncherConstants#SELECTED_WORKSPACE_PLUGINS
139
	 */
140
	String AUTOMATIC_ADD = "automaticAdd"; //$NON-NLS-1$
141
142
	/**
143
	 * Launch configuration attribute key. The value is a boolean specifying
144
	 * whether the list of plug-ins to run should be validate prior to launching.
145
	 * If problems are found, they will be reported and the user will be able to cancel or
146
	 * continue.
147
	 * If no problems are found, the launch continues as normal.
148
	 */
149
	String AUTOMATIC_VALIDATE = "automaticValidate"; //$NON-NLS-1$
150
151
	/**
152
	 * Launch configuration attribute key. The value is a string specifying
153
	 * a comma-separated list of IDs of target platform plug-ins to launch with.
154
	 * This value is only used when the Automatic Add option is off.
155
	 */
156
	String SELECTED_TARGET_PLUGINS = "selected_target_plugins"; //$NON-NLS-1$
157
158
	/**
159
	 * Launch configuration attribute key. The value is a boolean indicating
160
	 * whether the computation of required plug-ins on the Plug-ins tab should include
161
	 * the traversal of optional dependencies.
162
	 */
163
	String INCLUDE_OPTIONAL = "includeOptional"; //$NON-NLS-1$
164
165
	/**
166
	 * Launch configuration attribute key. The value is a boolean indicating
167
	 * whether tracing is enabled or disabled.
168
	 */
169
	String TRACING = "tracing"; //$NON-NLS-1$
170
171
	/**
172
	 * Launch configuration attribute key. The value is a map containing the list
173
	 * of options to debug with.
174
	 */
175
	String TRACING_OPTIONS = "tracingOptions"; //$NON-NLS-1$
176
177
	/**
178
	 * Launch configuration attribute key. The value is the id of the last plug-in 
179
	 * that was selected on the Tracing tab.
180
	 */
181
	String TRACING_SELECTED_PLUGIN = "selectedPlugin"; //$NON-NLS-1$
182
183
	/**
184
	 * Launch configuration attribute key. The value is the IDs of all plug-ins
185
	 * checked on the Tracing tab.  The value may also be "[NONE]"
186
	 * 
187
	 * @see IPDELauncherConstants#TRACING_NONE
188
	 */
189
	String TRACING_CHECKED = "checked"; //$NON-NLS-1$
190
191
	/**
192
	 * Launch configuration attribute value indicating that, although tracing is enabled,
193
	 * no plug-ins have been selected to be traced.
194
	 */
195
	String TRACING_NONE = "[NONE]"; //$NON-NLS-1$
196
197
	/**
198
	 * Launch configuration attribute key. The value is a boolean specifying 
199
	 * if PDE should generate a default configuration area for the launch.
200
	 * 
201
	 * If <code>true</code>, a configuration location in the PDE metadata area 
202
	 * is created.  Otherwise, the user is expected to specify a location.
203
	 * 
204
	 * @see IPDELauncherConstants#CONFIG_LOCATION
205
	 */
206
	String CONFIG_USE_DEFAULT_AREA = "useDefaultConfigArea"; //$NON-NLS-1$
207
208
	/**
209
	 * Launch configuration attribute key. The value is a string specifying 
210
	 * the configuration area location for an Eclipse application launch.
211
	 * 
212
	 * This key is only used when CONFIG_USE_DEFAULT_AREA is <code>false</code>.
213
	 * 
214
	 * @see IPDELauncherConstants#CONFIG_USE_DEFAULT_AREA
215
	 */
216
	String CONFIG_LOCATION = "configLocation"; //$NON-NLS-1$
217
218
	/**
219
	 * Launch configuration attribute key. The value is a boolean specifying 
220
	 * if the configuration area location should be cleared prior to launching
221
	*/
222
	String CONFIG_CLEAR_AREA = "clearConfig"; //$NON-NLS-1$
223
224
	/**
225
	 * Launch configuration atribute key.  The value is a boolean specifying
226
	 * if PDE should generate a default config.ini file for the launch.
227
	 * 
228
	 * If <code>true</code>, a configuration file is created.  
229
	 * Otherwise, the user is expected to specify a config.ini to be used as a template.
230
	 * 
231
	 * @see IPDELauncherConstants#CONFIG_TEMPLATE_LOCATION
232
	 */
233
	String CONFIG_GENERATE_DEFAULT = "useDefaultConfig"; //$NON-NLS-1$
234
235
	/**
236
	 * Launch configuration attribute key. The value is a string specifying 
237
	 * the location of the config.ini file to be used as a template for an 
238
	 * Eclipse application launch.
239
	 * 
240
	 * This key is only used when CONFIG_GENERATE_DEFAULT is <code>false</code>.
241
	 * 
242
	 * @see IPDELauncherConstants#CONFIG_GENERATE_DEFAULT
243
	 */
244
	String CONFIG_TEMPLATE_LOCATION = "templateConfig"; //$NON-NLS-1$
245
246
	/**
247
	 * Launch configuration attribute key. The value is a string specifying 
248
	 * the location of the .product file with which this launch configuration 
249
	 * is associated.
250
	 */
251
	String PRODUCT_FILE = "productFile"; //$NON-NLS-1$
252
253
	/**
254
	 * Launch configuration attribute key.  The value is the ID of an OSGi framework
255
	 * declared in an <code>org.eclipse.pde.ui.osgiLaunchers</code> extension point.
256
	 * 
257
	 * @since 3.3
258
	 */
259
	String OSGI_FRAMEWORK_ID = "osgi_framework_id"; //$NON-NLS-1$
260
261
	/**
262
	 * Launch configuration attribute key.  The value is a boolean specifying
263
	 * if the default Auto-Start for an OSGi Framework launch configuration 
264
	 * is <code>true</code> or <code>false</code>
265
	 * 
266
	 * @see IPDELauncherConstants#DEFAULT_START_LEVEL
267
	 */
268
	String DEFAULT_AUTO_START = "default_auto_start"; //$NON-NLS-1$
269
270
	/**
271
	 * Launch configuration attribute key.  The value is an integer specifying
272
	 * the default start level for bundles in an OSGi Framework launch configuration.
273
	 * 
274
	 * @see IPDELauncherConstants#DEFAULT_AUTO_START
275
	 */
276
	String DEFAULT_START_LEVEL = "default_start_level"; //$NON-NLS-1$
277
278
	/**
279
	 * Launch configuration attribute key.  The value is a comma-separated list
280
	 * of workspace bundles to launch with the OSGi framework.
281
	 * 
282
	 * Each token in the list is of the format:
283
	 * <plugin-id>@<start-level>:<auto-start>
284
	 * 
285
	 * @see IPDELauncherConstants#DEFAULT_AUTO_START
286
	 * @see IPDELauncherConstants#DEFAULT_START_LEVEL
287
	 */
288
	String WORKSPACE_BUNDLES = "workspace_bundles"; //$NON-NLS-1$
289
290
	/**
291
	 * Launch configuration attribute key.  The value is a comma-separated list
292
	 * of non-workspace bundles to launch with the OSGi framework.
293
	 * 
294
	 * Each token in the list is of the format:
295
	 * <plugin-id>@<start-level>:<auto-start>
296
	 * 
297
	 * @see IPDELauncherConstants#DEFAULT_AUTO_START
298
	 * @see IPDELauncherConstants#DEFAULT_START_LEVEL
299
	 */
300
	String TARGET_BUNDLES = "target_bundles"; //$NON-NLS-1$
301
302
	/**
303
	 * Launch configuration attribute key.  The value can be either the full path
304
	 * to the workspace location of a Target Definition (ie. .target file), or
305
	 * the ID of a target defined in an org.eclipse.pde.core.targets extension.
306
	 */
307
	String DEFINED_TARGET = "defined_target"; //$NON-NLS-1$
308
309
	/**
310
	 * Launch configuration attribute key. The value is a boolean indicating
311
	 * whether or not to display only selected plug-ins. 
312
	 * 
313
	 * @since 3.4
314
	 */
315
	String SHOW_SELECTED_ONLY = "show_selected_only"; //$NON-NLS-1$
316
317
	/**
318
	 * The unique tab identifier for the bundles tab
319
	 * 
320
	 * @since 3.5
321
	 * @see BundlesTab
322
	 */
323
	String TAB_BUNDLES_ID = "org.eclipse.pde.ui.launch.tab.osgi.bundles"; //$NON-NLS-1$
324
325
	/**
326
	 * The unique tab identifier for the configuration tab
327
	 * 
328
	 * @since 3.5
329
	 * @see ConfigurationTab
330
	 */
331
	String TAB_CONFIGURATION_ID = "org.eclipse.pde.ui.launch.tab.configuration"; //$NON-NLS-1$
332
25
333
	/**
334
	 * The unique tab identifier for the main tab
335
	 * 
336
	 * @since 3.5
337
	 * @see MainTab
338
	 */
339
	String TAB_MAIN_ID = "org.eclipse.pde.ui.launch.tab.main"; //$NON-NLS-1$
340
341
	/**
342
	 * The unique tab identifier for the osgi settings tab
343
	 * 
344
	 * @since 3.5
345
	 * @see OSGiSettingsTab
346
	 */
347
	String TAB_OSGI_SETTINGS_ID = "org.eclipse.pde.ui.launch.tab.osgi.settings"; //$NON-NLS-1$
348
349
	/**
350
	 * The unique tab identifier for the plug-in junit tab
351
	 * 
352
	 * @since 3.5
353
	 * @see PluginJUnitMainTab
354
	 */
355
	String TAB_PLUGIN_JUNIT_MAIN_ID = "org.eclipse.pde.ui.launch.tab.junit.main"; //$NON-NLS-1$
356
357
	/**
358
	 * The unique tab identifier for the plug-ins tab
359
	 * 
360
	 * @since 3.5
361
	 * @see PluginsTab
362
	 */
363
	String TAB_PLUGINS_ID = "org.eclipse.pde.ui.launch.tab.plugins"; //$NON-NLS-1$
364
365
	/**
366
	 * The unique tab identifier for the tracing tab
367
	 * 
368
	 * @since 3.5
369
	 * @see TracingTab
370
	 */
371
	String TAB_TRACING_ID = "org.eclipse.pde.ui.launch.tab.tracing"; //$NON-NLS-1$
372
373
	/**
374
	 * The unique tab identifier for the tracing tab
375
	 * 
376
	 * @since 3.5
377
	 * @see TestTab
378
	 */
379
	String TAB_TEST_ID = "org.eclipse.pde.ui.launch.tab.test"; //$NON-NLS-1$
380
381
	/**
382
	 * The launch configuration type id for OSGi launches.
383
	 * 
384
	 * @since 3.5
385
	 * @see OSGiLaunchShortcut
386
	 */
387
	String OSGI_CONFIGURATION_TYPE = "org.eclipse.pde.ui.EquinoxLauncher"; //$NON-NLS-1$
388
389
	/**
390
	 * Launch configuration attribute key. The value is a boolean specifying 
391
	 * whether the tests should run on the UI thread.
392
	 * 
393
	 * The default value is <code>true</code>
394
	 * 
395
	 * @since 3.5
396
	 */
397
	String RUN_IN_UI_THREAD = "run_in_ui_thread"; //$NON-NLS-1$
398
}
26
}
399
  - *
27
  - *
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/PluginJUnitMainTab.java (+2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
14
import org.eclipse.pde.internal.ui.launcher.JUnitProgramBlock;
16
import org.eclipse.pde.internal.ui.launcher.JUnitProgramBlock;
15
17
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TestTab.java (+2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitLaunchConfigurationDelegate.java (-469 / +2 lines)
Lines 13-492 Link Here
13
 *******************************************************************************/
13
 *******************************************************************************/
14
package org.eclipse.pde.ui.launcher;
14
package org.eclipse.pde.ui.launcher;
15
15
16
import java.io.File;
17
import java.util.*;
18
import org.eclipse.core.resources.IProject;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.debug.core.*;
21
import org.eclipse.jdt.core.IJavaProject;
22
import org.eclipse.jdt.internal.junit.launcher.*;
23
import org.eclipse.jdt.launching.*;
24
import org.eclipse.osgi.service.resolver.BundleDescription;
25
import org.eclipse.osgi.util.NLS;
26
import org.eclipse.pde.core.plugin.*;
27
import org.eclipse.pde.internal.core.*;
28
import org.eclipse.pde.internal.core.util.CoreUtility;
29
import org.eclipse.pde.internal.core.util.VersionUtil;
30
import org.eclipse.pde.internal.ui.*;
31
import org.eclipse.pde.internal.ui.launcher.*;
32
import org.osgi.framework.Version;
33
16
34
/**
17
/**
35
 * A launch delegate for launching JUnit Plug-in tests.
18
 * A launch delegate for launching JUnit Plug-in tests.
36
 *
19
 *
37
 * @since 3.3
20
 * @since 3.3
21
 * @deprecated Use {@link JUnitLaunchConfigurationDelegate} instead.
38
 */
22
 */
39
public class JUnitLaunchConfigurationDelegate extends org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate {
23
public class JUnitLaunchConfigurationDelegate extends org.eclipse.pde.launching.launcher.JUnitLaunchConfigurationDelegate {
40
41
	/**
42
	 * To avoid duplicating variable substitution (and duplicate prompts)
43
	 * this variable will store the substituted workspace location.
44
	 */
45
	private String fWorkspaceLocation;
46
47
	protected File fConfigDir = null;
48
49
	// used to generate the dev classpath entries
50
	// key is bundle ID, value is a model
51
	private Map fAllBundles;
52
53
	// key is a model, value is startLevel:autoStart
54
	private Map fModels;
55
56
	/*
57
	 * (non-Javadoc)
58
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getVMRunner(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
59
	 */
60
	public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException {
61
		IVMInstall launcher = VMHelper.createLauncher(configuration);
62
		return launcher.getVMRunner(mode);
63
	}
64
65
	/* (non-Javadoc)
66
	 * @see org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate#verifyMainTypeName(org.eclipse.debug.core.ILaunchConfiguration)
67
	 */
68
	public String verifyMainTypeName(ILaunchConfiguration configuration) throws CoreException {
69
		if (TargetPlatformHelper.getTargetVersion() >= 3.3)
70
			return "org.eclipse.equinox.launcher.Main"; //$NON-NLS-1$
71
		return "org.eclipse.core.launcher.Main"; //$NON-NLS-1$
72
	}
73
74
	private String getTestPluginId(ILaunchConfiguration configuration) throws CoreException {
75
		IJavaProject javaProject = getJavaProject(configuration);
76
		IPluginModelBase model = PluginRegistry.findModel(javaProject.getProject());
77
		if (model == null)
78
			abort(NLS.bind(PDEUIMessages.JUnitLaunchConfiguration_error_notaplugin, javaProject.getProject().getName()), null, IStatus.OK);
79
		if (model instanceof IFragmentModel)
80
			return ((IFragmentModel) model).getFragment().getPluginId();
81
82
		return model.getPluginBase().getId();
83
	}
84
85
	/*
86
	 * (non-Javadoc)
87
	 * @see org.eclipse.jdt.internal.junit.launcher.JUnitBaseLaunchConfiguration#abort(java.lang.String, java.lang.Throwable, int)
88
	 */
89
	protected void abort(String message, Throwable exception, int code) throws CoreException {
90
		throw new CoreException(new Status(IStatus.ERROR, IPDEUIConstants.PLUGIN_ID, code, message, exception));
91
	}
92
93
	/* (non-Javadoc)
94
	 * @see org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate#collectExecutionArguments(org.eclipse.debug.core.ILaunchConfiguration, java.util.List, java.util.List)
95
	 */
96
	protected void collectExecutionArguments(ILaunchConfiguration configuration, List/*String*/vmArguments, List/*String*/programArgs) throws CoreException {
97
		super.collectExecutionArguments(configuration, vmArguments, programArgs);
98
99
		// Specify the JUnit Plug-in test application to launch
100
		programArgs.add("-application"); //$NON-NLS-1$
101
		String application = getApplication(configuration);
102
103
		programArgs.add(application);
104
105
		// If a product is specified, then add it to the program args
106
		if (configuration.getAttribute(IPDELauncherConstants.USE_PRODUCT, false)) {
107
			programArgs.add("-product"); //$NON-NLS-1$
108
			programArgs.add(configuration.getAttribute(IPDELauncherConstants.PRODUCT, "")); //$NON-NLS-1$
109
		} else {
110
			// Specify the application to test
111
			String defaultApplication = IPDEUIConstants.CORE_TEST_APPLICATION.equals(application) ? null : TargetPlatform.getDefaultApplication();
112
			String testApplication = configuration.getAttribute(IPDELauncherConstants.APP_TO_TEST, defaultApplication);
113
			if (testApplication != null) {
114
				programArgs.add("-testApplication"); //$NON-NLS-1$
115
				programArgs.add(testApplication);
116
			}
117
		}
118
119
		// Specify the location of the runtime workbench
120
		if (fWorkspaceLocation == null) {
121
			fWorkspaceLocation = LaunchArgumentsHelper.getWorkspaceLocation(configuration);
122
		}
123
		if (fWorkspaceLocation.length() > 0) {
124
			programArgs.add("-data"); //$NON-NLS-1$
125
			programArgs.add(fWorkspaceLocation);
126
		}
127
128
		// Create the platform configuration for the runtime workbench
129
		String productID = LaunchConfigurationHelper.getProductID(configuration);
130
		LaunchConfigurationHelper.createConfigIniFile(configuration, productID, fAllBundles, fModels, getConfigurationDirectory(configuration));
131
		String brandingId = LaunchConfigurationHelper.getContributingPlugin(productID);
132
		TargetPlatform.createPlatformConfiguration(getConfigurationDirectory(configuration), (IPluginModelBase[]) fAllBundles.values().toArray(new IPluginModelBase[fAllBundles.size()]), brandingId != null ? (IPluginModelBase) fAllBundles.get(brandingId) : null);
133
		TargetPlatformHelper.checkPluginPropertiesConsistency(fAllBundles, getConfigurationDirectory(configuration));
134
135
		programArgs.add("-configuration"); //$NON-NLS-1$
136
		programArgs.add("file:" + new Path(getConfigurationDirectory(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$
137
24
138
		// Specify the output folder names
139
		programArgs.add("-dev"); //$NON-NLS-1$
140
		programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigurationDirectory(configuration).toString() + "/dev.properties", fAllBundles)); //$NON-NLS-1$
141
142
		// necessary for PDE to know how to load plugins when target platform = host platform
143
		// see PluginPathFinder.getPluginPaths()
144
		IPluginModelBase base = findPlugin(PDECore.PLUGIN_ID);
145
		if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) < 0) //$NON-NLS-1$
146
			programArgs.add("-pdelaunch"); //$NON-NLS-1$				
147
148
		// Create the .options file if tracing is turned on
149
		if (configuration.getAttribute(IPDELauncherConstants.TRACING, false) && !IPDELauncherConstants.TRACING_NONE.equals(configuration.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null))) {
150
			programArgs.add("-debug"); //$NON-NLS-1$
151
			String path = getConfigurationDirectory(configuration).getPath() + IPath.SEPARATOR + ".options"; //$NON-NLS-1$
152
			programArgs.add(LaunchArgumentsHelper.getTracingFileArgument(configuration, path));
153
		}
154
155
		// add the program args specified by the user
156
		String[] userArgs = LaunchArgumentsHelper.getUserProgramArgumentArray(configuration);
157
		for (int i = 0; i < userArgs.length; i++) {
158
			// be forgiving if people have tracing turned on and forgot
159
			// to remove the -debug from the program args field.
160
			if (userArgs[i].equals("-debug") && programArgs.contains("-debug")) //$NON-NLS-1$ //$NON-NLS-2$
161
				continue;
162
			programArgs.add(userArgs[i]);
163
		}
164
165
		if (!configuration.getAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, false)) {
166
			if (!programArgs.contains("-os")) { //$NON-NLS-1$
167
				programArgs.add("-os"); //$NON-NLS-1$
168
				programArgs.add(TargetPlatform.getOS());
169
			}
170
			if (!programArgs.contains("-ws")) { //$NON-NLS-1$
171
				programArgs.add("-ws"); //$NON-NLS-1$
172
				programArgs.add(TargetPlatform.getWS());
173
			}
174
			if (!programArgs.contains("-arch")) { //$NON-NLS-1$
175
				programArgs.add("-arch"); //$NON-NLS-1$
176
				programArgs.add(TargetPlatform.getOSArch());
177
			}
178
		}
179
180
		programArgs.add("-testpluginname"); //$NON-NLS-1$
181
		programArgs.add(getTestPluginId(configuration));
182
	}
183
184
	/**
185
	 * Returns the application to launch plug-in tests with
186
	 * 
187
	 * @since 3.5
188
	 * 
189
	 * @param configuration
190
	 * @return the application
191
	 */
192
	protected String getApplication(ILaunchConfiguration configuration) {
193
		String application = null;
194
195
		boolean shouldRunInUIThread = true;
196
		try {
197
			shouldRunInUIThread = configuration.getAttribute(IPDELauncherConstants.RUN_IN_UI_THREAD, true);
198
		} catch (CoreException e) {
199
		}
200
201
		if (!shouldRunInUIThread) {
202
			return IPDEUIConstants.NON_UI_THREAD_APPLICATION;
203
		}
204
205
		try {
206
			// if application is set, it must be a headless app.
207
			application = configuration.getAttribute(IPDELauncherConstants.APPLICATION, (String) null);
208
		} catch (CoreException e) {
209
		}
210
211
		// if application is not set, we should launch the default UI test app
212
		// Check to see if we should launch the legacy UI app
213
		if (application == null) {
214
			IPluginModelBase model = (IPluginModelBase) fAllBundles.get("org.eclipse.pde.junit.runtime"); //$NON-NLS-1$
215
			BundleDescription desc = model != null ? model.getBundleDescription() : null;
216
			if (desc != null) {
217
				Version version = desc.getVersion();
218
				int major = version.getMajor();
219
				// launch legacy UI app only if we are launching a target that does 
220
				// not use the new application model and we are launching with a 
221
				// org.eclipse.pde.junit.runtime whose version is >= 3.3
222
				if (major >= 3 && version.getMinor() >= 3 && !TargetPlatformHelper.usesNewApplicationModel()) {
223
					application = IPDEUIConstants.LEGACY_UI_TEST_APPLICATION;
224
				}
225
			}
226
		}
227
228
		// launch the UI test application
229
		if (application == null)
230
			application = IPDEUIConstants.UI_TEST_APPLICATION;
231
		return application;
232
	}
233
234
	private IPluginModelBase findPlugin(String id) throws CoreException {
235
		IPluginModelBase model = PluginRegistry.findModel(id);
236
		if (model == null)
237
			model = PDECore.getDefault().findPluginInHost(id);
238
		if (model == null)
239
			abort(NLS.bind(PDEUIMessages.JUnitLaunchConfiguration_error_missingPlugin, id), null, IStatus.OK);
240
		return model;
241
	}
242
243
	/*
244
	 * (non-Javadoc)
245
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration)
246
	 */
247
	public String getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
248
		return LaunchArgumentsHelper.getUserProgramArguments(configuration);
249
	}
250
251
	/*
252
	 * (non-Javadoc)
253
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getVMArguments(org.eclipse.debug.core.ILaunchConfiguration)
254
	 */
255
	public String getVMArguments(ILaunchConfiguration configuration) throws CoreException {
256
		String vmArgs = LaunchArgumentsHelper.getUserVMArguments(configuration);
257
258
		// necessary for PDE to know how to load plugins when target platform = host platform
259
		IPluginModelBase base = (IPluginModelBase) fAllBundles.get(PDECore.PLUGIN_ID);
260
		if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) >= 0) { //$NON-NLS-1$
261
			vmArgs = concatArg(vmArgs, "-Declipse.pde.launch=true"); //$NON-NLS-1$
262
		}
263
		// For p2 target, add "-Declipse.p2.data.area=@config.dir/p2" unless already specified by user
264
		if (fAllBundles.containsKey("org.eclipse.equinox.p2.core")) { //$NON-NLS-1$
265
			if (vmArgs.indexOf("-Declipse.p2.data.area=") < 0) { //$NON-NLS-1$
266
				vmArgs = concatArg(vmArgs, "-Declipse.p2.data.area=@config.dir" + File.separator + "p2"); //$NON-NLS-1$ //$NON-NLS-2$
267
			}
268
		}
269
		return vmArgs;
270
	}
271
272
	/**
273
	 * Returns the result of concatenating the given argument to the
274
	 * specified vmArgs.
275
	 * 
276
	 * @param vmArgs existing VM arguments
277
	 * @param arg argument to concatenate
278
	 * @return result of concatenation
279
	 */
280
	private String concatArg(String vmArgs, String arg) {
281
		if (vmArgs.length() > 0 && !vmArgs.endsWith(" ")) //$NON-NLS-1$
282
			vmArgs = vmArgs.concat(" "); //$NON-NLS-1$
283
		return vmArgs.concat(arg);
284
	}
285
286
	/*
287
	 * (non-Javadoc)
288
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getEnvironment(org.eclipse.debug.core.ILaunchConfiguration)
289
	 */
290
	public String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException {
291
		return DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);
292
	}
293
294
	/*
295
	 * (non-Javadoc)
296
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getClasspath(org.eclipse.debug.core.ILaunchConfiguration)
297
	 */
298
	public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException {
299
		String[] classpath = LaunchArgumentsHelper.constructClasspath(configuration);
300
		if (classpath == null) {
301
			abort(PDEUIMessages.WorkbenchLauncherConfigurationDelegate_noStartup, null, IStatus.OK);
302
		}
303
		return classpath;
304
	}
305
306
	/*
307
	 * (non-Javadoc)
308
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getWorkingDirectory(org.eclipse.debug.core.ILaunchConfiguration)
309
	 */
310
	public File getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
311
		return LaunchArgumentsHelper.getWorkingDirectory(configuration);
312
	}
313
314
	/*
315
	 * (non-Javadoc)
316
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getVMSpecificAttributesMap(org.eclipse.debug.core.ILaunchConfiguration)
317
	 */
318
	public Map getVMSpecificAttributesMap(ILaunchConfiguration configuration) throws CoreException {
319
		return LaunchArgumentsHelper.getVMSpecificAttributesMap(configuration);
320
	}
321
322
	/*
323
	 * (non-Javadoc)
324
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#setDefaultSourceLocator(org.eclipse.debug.core.ILaunch, org.eclipse.debug.core.ILaunchConfiguration)
325
	 */
326
	protected void setDefaultSourceLocator(ILaunch launch, ILaunchConfiguration configuration) throws CoreException {
327
		ILaunchConfigurationWorkingCopy wc = null;
328
		if (configuration.isWorkingCopy()) {
329
			wc = (ILaunchConfigurationWorkingCopy) configuration;
330
		} else {
331
			wc = configuration.getWorkingCopy();
332
		}
333
		String id = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, (String) null);
334
		if (!PDESourcePathProvider.ID.equals(id)) {
335
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, PDESourcePathProvider.ID);
336
			wc.doSave();
337
		}
338
339
		manageLaunch(launch);
340
	}
341
342
	/**
343
	 * Returns the location of the configuration area
344
	 * 
345
	 * @param configuration
346
	 * 				the launch configuration
347
	 * @return a directory where the configuration area is located
348
	 */
349
	protected File getConfigurationDirectory(ILaunchConfiguration configuration) {
350
		if (fConfigDir == null)
351
			fConfigDir = LaunchConfigurationHelper.getConfigurationArea(configuration);
352
		return fConfigDir;
353
	}
354
355
	/*
356
	 * (non-Javadoc)
357
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
358
	 */
359
	protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
360
		return computeBuildOrder(LaunchPluginValidator.getAffectedProjects(configuration));
361
	}
362
363
	/*
364
	 * (non-Javadoc)
365
	 * @see org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate#getProjectsForProblemSearch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
366
	 */
367
	protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) throws CoreException {
368
		return LaunchPluginValidator.getAffectedProjects(configuration);
369
	}
370
371
	/**
372
	 * Adds a listener to the launch to be notified at interesting launch lifecycle
373
	 * events such as when the launch terminates.
374
	 * 
375
	 * @param launch
376
	 * 			the launch 			
377
	 */
378
	protected void manageLaunch(ILaunch launch) {
379
		PDEPlugin.getDefault().getLaunchListener().manage(launch);
380
	}
381
382
	/* (non-Javadoc)
383
	 * @see org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
384
	 */
385
	protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
386
		fWorkspaceLocation = null;
387
		fModels = BundleLauncherHelper.getMergedBundleMap(configuration, false);
388
		fAllBundles = new HashMap(fModels.size());
389
		Iterator iter = fModels.keySet().iterator();
390
		while (iter.hasNext()) {
391
			IPluginModelBase model = (IPluginModelBase) iter.next();
392
			fAllBundles.put(model.getPluginBase().getId(), model);
393
		}
394
395
		// implicitly add the plug-ins required for JUnit testing if necessary
396
		String[] requiredPlugins = getRequiredPlugins(configuration);
397
		for (int i = 0; i < requiredPlugins.length; i++) {
398
			String id = requiredPlugins[i];
399
			if (!fAllBundles.containsKey(id)) {
400
				IPluginModelBase model = findPlugin(id);
401
				fAllBundles.put(id, model);
402
				fModels.put(model, "default:default"); //$NON-NLS-1$
403
			}
404
		}
405
406
		boolean autoValidate = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, false);
407
		monitor.beginTask("", autoValidate ? 3 : 4); //$NON-NLS-1$
408
		if (autoValidate)
409
			validatePluginDependencies(configuration, new SubProgressMonitor(monitor, 1));
410
		validateProjectDependencies(configuration, new SubProgressMonitor(monitor, 1));
411
		clear(configuration, new SubProgressMonitor(monitor, 1));
412
		launch.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, getConfigurationDirectory(configuration).toString());
413
		synchronizeManifests(configuration, new SubProgressMonitor(monitor, 1));
414
	}
415
416
	private String[] getRequiredPlugins(ILaunchConfiguration configuration) {
417
		// if we are using JUnit4, we need to include the junit4 specific bundles
418
		ITestKind testKind = JUnitLaunchConfigurationConstants.getTestRunnerKind(configuration);
419
		if (TestKindRegistry.JUNIT4_TEST_KIND_ID.equals(testKind.getId()))
420
			return new String[] {"org.junit", "org.eclipse.jdt.junit.runtime", "org.eclipse.pde.junit.runtime", "org.junit4", "org.eclipse.jdt.junit4.runtime"}; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
421
		return new String[] {"org.junit", "org.eclipse.jdt.junit.runtime", "org.eclipse.pde.junit.runtime"}; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
422
	}
423
424
	/**
425
	 * Checks for old-style plugin.xml files that have become stale since the last launch.
426
	 * For any stale plugin.xml files found, the corresponding MANIFEST.MF is deleted 
427
	 * from the runtime configuration area so that it gets regenerated upon startup.
428
	 * 
429
	 * @param configuration
430
	 * 			the launch configuration
431
	 * @param monitor
432
	 * 			the progress monitor
433
	 */
434
	protected void synchronizeManifests(ILaunchConfiguration configuration, IProgressMonitor monitor) {
435
		LaunchConfigurationHelper.synchronizeManifests(configuration, getConfigurationDirectory(configuration));
436
		monitor.done();
437
	}
438
439
	/**
440
	 * Clears the workspace prior to launching if the workspace exists and the option to 
441
	 * clear it is turned on.  Also clears the configuration area if that option is chosen.
442
	 * 
443
	 * @param configuration
444
	 * 			the launch configuration
445
	 * @param monitor
446
	 * 			the progress monitor
447
	 * @throws CoreException
448
	 * 			if unable to retrieve launch attribute values
449
	 * @since 3.3
450
	 */
451
	protected void clear(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
452
		if (fWorkspaceLocation == null) {
453
			fWorkspaceLocation = LaunchArgumentsHelper.getWorkspaceLocation(configuration);
454
		}
455
		// Clear workspace and prompt, if necessary
456
		if (!LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, new SubProgressMonitor(monitor, 1))) {
457
			monitor.setCanceled(true);
458
			return;
459
		}
460
461
		// clear config area, if necessary
462
		if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false))
463
			CoreUtility.deleteContent(getConfigurationDirectory(configuration));
464
	}
465
466
	/**
467
	 * Checks if the Automated Management of Dependencies option is turned on.
468
	 * If so, it makes aure all manifests are updated with the correct dependencies.
469
	 * 
470
	 * @param configuration
471
	 * 			the launch configuration
472
	 * @param monitor
473
	 * 			a progress monitor
474
	 */
475
	protected void validateProjectDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) {
476
		LauncherUtils.validateProjectDependencies(configuration, monitor);
477
	}
478
479
	/**
480
	 * Validates inter-bundle dependencies automatically prior to launching
481
	 * if that option is turned on.
482
	 * 
483
	 * @param configuration
484
	 * 			the launch configuration
485
	 * @param monitor
486
	 * 			a progress monitor
487
	 */
488
	protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
489
		EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration);
490
		LaunchPluginValidator.runValidationOperation(op, monitor);
491
	}
492
}
25
}
493
  - *
26
  - *
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/PluginsTab.java (+2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.core.runtime.IPath;
15
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.debug.core.ILaunchConfiguration;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/OSGiSettingsTab.java (+2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EquinoxLaunchConfiguration.java (-183 / +2 lines)
Lines 11-205 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.ui.launcher;
12
package org.eclipse.pde.ui.launcher;
13
13
14
import java.io.File;
15
import java.net.URL;
16
import java.util.*;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.debug.core.ILaunch;
19
import org.eclipse.debug.core.ILaunchConfiguration;
20
import org.eclipse.pde.core.plugin.*;
21
import org.eclipse.pde.internal.build.IPDEBuildConstants;
22
import org.eclipse.pde.internal.core.ClasspathHelper;
23
import org.eclipse.pde.internal.core.P2Utils;
24
import org.eclipse.pde.internal.core.util.CoreUtility;
25
import org.eclipse.pde.internal.ui.IPDEUIConstants;
26
import org.eclipse.pde.internal.ui.PDEUIMessages;
27
import org.eclipse.pde.internal.ui.launcher.*;
28
29
/**
14
/**
30
 * A launch delegate for launching the Equinox framework
15
 * A launch delegate for launching the Equinox framework
31
 * <p>
16
 * <p>
32
 * Clients may subclass and instantiate this class.
17
 * Clients may subclass and instantiate this class.
33
 * </p>
18
 * </p>
34
 * @since 3.2
19
 * @since 3.2
20
 * @deprecated Use {@link org.eclipse.pde.launching.launcher.EquinoxLaunchConfiguration} instead.
35
 */
21
 */
36
public class EquinoxLaunchConfiguration extends AbstractPDELaunchConfiguration {
22
public class EquinoxLaunchConfiguration extends org.eclipse.pde.launching.launcher.EquinoxLaunchConfiguration {
37
38
	// used to generate the dev classpath entries
39
	// key is bundle ID, value is a model
40
	protected Map fAllBundles;
41
42
	// key is a model, value is startLevel:autoStart
43
	private Map fModels;
44
45
	/*
46
	 * (non-Javadoc)
47
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration)
48
	 */
49
	public String[] getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
50
		ArrayList programArgs = new ArrayList();
51
52
		programArgs.add("-dev"); //$NON-NLS-1$
53
		programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigDir(configuration).toString() + "/dev.properties", fAllBundles)); //$NON-NLS-1$
54
55
		saveConfigurationFile(configuration);
56
		programArgs.add("-configuration"); //$NON-NLS-1$
57
		programArgs.add("file:" + new Path(getConfigDir(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$
58
59
		String[] args = super.getProgramArguments(configuration);
60
		for (int i = 0; i < args.length; i++) {
61
			programArgs.add(args[i]);
62
		}
63
		return (String[]) programArgs.toArray(new String[programArgs.size()]);
64
	}
65
66
	private void saveConfigurationFile(ILaunchConfiguration configuration) throws CoreException {
67
		Properties properties = new Properties();
68
		properties.setProperty("osgi.install.area", "file:" + TargetPlatform.getLocation()); //$NON-NLS-1$ //$NON-NLS-2$
69
		properties.setProperty("osgi.configuration.cascaded", "false"); //$NON-NLS-1$ //$NON-NLS-2$
70
		properties.put("osgi.framework", LaunchConfigurationHelper.getBundleURL(IPDEBuildConstants.BUNDLE_OSGI, fAllBundles, false)); //$NON-NLS-1$
71
		int start = configuration.getAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4);
72
		properties.put("osgi.bundles.defaultStartLevel", Integer.toString(start)); //$NON-NLS-1$
73
		boolean autostart = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, true);
74
75
		String bundles = null;
76
		if (fAllBundles.containsKey(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR)) {
77
			// If simple configurator is being used, we need to write out the bundles.txt instead of writing out the list in the config.ini
78
			URL bundlesTxt = P2Utils.writeBundlesTxt(fModels, start, autostart, getConfigDir(configuration), null);
79
			if (bundlesTxt != null) {
80
				properties.setProperty("org.eclipse.equinox.simpleconfigurator.configUrl", bundlesTxt.toString()); //$NON-NLS-1$
81
				if (fAllBundles.get(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR) != null) {
82
					properties.setProperty("org.eclipse.update.reconcile", "false"); //$NON-NLS-1$ //$NON-NLS-2$
83
				}
84
			}
85
			StringBuffer buffer = new StringBuffer();
86
			IPluginModelBase model = (IPluginModelBase) fAllBundles.get(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR);
87
			buffer.append(LaunchConfigurationHelper.getBundleURL(model, true));
88
			appendStartData(buffer, (String) fModels.get(model), autostart);
89
			bundles = buffer.toString();
90
		} else {
91
			bundles = getBundles(autostart);
92
		}
93
		if (bundles.length() > 0)
94
			properties.put("osgi.bundles", bundles); //$NON-NLS-1$
95
96
		if (!"3.3".equals(configuration.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, ""))) { //$NON-NLS-1$ //$NON-NLS-2$
97
			properties.put("eclipse.ignoreApp", "true"); //$NON-NLS-1$ //$NON-NLS-2$
98
			properties.put("osgi.noShutdown", "true"); //$NON-NLS-1$ //$NON-NLS-2$
99
		}
100
101
		LaunchConfigurationHelper.save(new File(getConfigDir(configuration), "config.ini"), properties); //$NON-NLS-1$
102
	}
103
104
	private String getBundles(boolean defaultAuto) {
105
		StringBuffer buffer = new StringBuffer();
106
		Iterator iter = fModels.keySet().iterator();
107
		while (iter.hasNext()) {
108
			IPluginModelBase model = (IPluginModelBase) iter.next();
109
			String id = model.getPluginBase().getId();
110
			if (!IPDEBuildConstants.BUNDLE_OSGI.equals(id)) {
111
				if (buffer.length() > 0)
112
					buffer.append(","); //$NON-NLS-1$
113
				buffer.append(LaunchConfigurationHelper.getBundleURL(model, true));
114
115
				// fragments must not be started or have a start level
116
				if (model instanceof IFragmentModel)
117
					continue;
118
119
				String data = fModels.get(model).toString();
120
				appendStartData(buffer, data, defaultAuto);
121
			}
122
		}
123
		return buffer.toString();
124
	}
125
126
	/**
127
	 * Convenience method to parses the startData ("startLevel:autoStart"), convert it to the
128
	 * format expected by the OSGi bundles property, and append to a StringBuffer.
129
	 * @param buffer buffer to append the data to
130
	 * @param startData data to parse ("startLevel:autoStart")
131
	 * @param defaultAuto default auto start setting
132
	 */
133
	private void appendStartData(StringBuffer buffer, String startData, boolean defaultAuto) {
134
		int index = startData.indexOf(':');
135
		String level = index > 0 ? startData.substring(0, index) : "default"; //$NON-NLS-1$
136
		String auto = index > 0 && index < startData.length() - 1 ? startData.substring(index + 1) : "default"; //$NON-NLS-1$
137
		if ("default".equals(auto)) //$NON-NLS-1$
138
			auto = Boolean.toString(defaultAuto);
139
		if (!level.equals("default") || "true".equals(auto)) //$NON-NLS-1$ //$NON-NLS-2$
140
			buffer.append("@"); //$NON-NLS-1$
141
142
		if (!level.equals("default")) { //$NON-NLS-1$
143
			buffer.append(level);
144
			if ("true".equals(auto)) //$NON-NLS-1$
145
				buffer.append(":"); //$NON-NLS-1$
146
		}
147
		if ("true".equals(auto)) { //$NON-NLS-1$
148
			buffer.append("start"); //$NON-NLS-1$
149
		}
150
	}
151
152
	/*
153
	 * (non-Javadoc)
154
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
155
	 */
156
	protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
157
		fModels = BundleLauncherHelper.getMergedBundleMap(configuration, true);
158
		fAllBundles = new HashMap(fModels.size());
159
		Iterator iter = fModels.keySet().iterator();
160
		while (iter.hasNext()) {
161
			IPluginModelBase model = (IPluginModelBase) iter.next();
162
			fAllBundles.put(model.getPluginBase().getId(), model);
163
		}
164
165
		if (!fAllBundles.containsKey(IPDEBuildConstants.BUNDLE_OSGI)) {
166
			// implicitly add it
167
			IPluginModelBase model = PluginRegistry.findModel(IPDEBuildConstants.BUNDLE_OSGI);
168
			if (model != null) {
169
				fModels.put(model, "default:default"); //$NON-NLS-1$
170
				fAllBundles.put(IPDEBuildConstants.BUNDLE_OSGI, model);
171
			} else {
172
				String message = PDEUIMessages.EquinoxLaunchConfiguration_oldTarget;
173
				throw new CoreException(LauncherUtils.createErrorStatus(message));
174
			}
175
		}
176
		super.preLaunchCheck(configuration, launch, monitor);
177
	}
178
179
	/*
180
	 * (non-Javadoc)
181
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#validatePluginDependencies(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor)
182
	 */
183
	protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
184
		OSGiValidationOperation op = new OSGiValidationOperation(configuration);
185
		LaunchPluginValidator.runValidationOperation(op, monitor);
186
	}
187
188
	/**
189
	 * Clears the configuration area if the area exists and that option is selected.
190
	 * 
191
	 * @param configuration
192
	 * 			the launch configuration
193
	 * @param monitor
194
	 * 			the progress monitor
195
	 * @throws CoreException
196
	 * 			if unable to retrieve launch attribute values
197
	 * @since 3.3
198
	 */
199
	protected void clear(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
200
		// clear config area, if necessary
201
		if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false))
202
			CoreUtility.deleteContent(getConfigDir(configuration));
203
	}
204
23
205
}
24
}
206
  - *
25
  - *
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/MainTab.java (+2 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.ui.launcher;
12
package org.eclipse.pde.ui.launcher;
13
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
14
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
18
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EclipseLaunchShortcut.java (-1 / +8 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
import org.eclipse.pde.launching.launcher.PDESourcePathProvider;
15
16
import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper;
17
import org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper;
18
13
import java.util.*;
19
import java.util.*;
14
import org.eclipse.core.resources.IFile;
20
import org.eclipse.core.resources.IFile;
15
import org.eclipse.core.resources.IProject;
21
import org.eclipse.core.resources.IProject;
Lines 27-33 Link Here
27
import org.eclipse.pde.internal.core.util.IdUtil;
33
import org.eclipse.pde.internal.core.util.IdUtil;
28
import org.eclipse.pde.internal.ui.IPDEUIConstants;
34
import org.eclipse.pde.internal.ui.IPDEUIConstants;
29
import org.eclipse.pde.internal.ui.PDEPlugin;
35
import org.eclipse.pde.internal.ui.PDEPlugin;
30
import org.eclipse.pde.internal.ui.launcher.*;
36
import org.eclipse.pde.internal.ui.launcher.ApplicationSelectionDialog;
37
import org.eclipse.pde.internal.ui.launcher.LaunchAction;
31
import org.eclipse.ui.IEditorPart;
38
import org.eclipse.ui.IEditorPart;
32
39
33
/**
40
/**
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TracingTab.java (+2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.core.ILaunchConfiguration;
14
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
16
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15
import org.eclipse.jface.dialogs.Dialog;
17
import org.eclipse.jface.dialogs.Dialog;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfiguration.java (-403 / +2 lines)
Lines 10-423 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import java.io.File;
14
import java.util.ArrayList;
15
import java.util.Map;
16
import org.eclipse.core.resources.IMarker;
17
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.debug.core.*;
20
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
21
import org.eclipse.jdt.core.IJavaModelMarker;
22
import org.eclipse.jdt.launching.*;
23
import org.eclipse.jface.dialogs.MessageDialog;
24
import org.eclipse.pde.core.plugin.TargetPlatform;
25
import org.eclipse.pde.internal.core.TargetPlatformHelper;
26
import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
27
import org.eclipse.pde.internal.ui.*;
28
import org.eclipse.pde.internal.ui.launcher.*;
29
30
/**
13
/**
31
 * An abstract launch delegate for PDE-based launch configurations
14
 * An abstract launch delegate for PDE-based launch configurations
32
 * <p>
15
 * <p>
33
 * Clients may subclass this class.
16
 * Clients may subclass this class.
34
 * </p>
17
 * </p>
35
 * @since 3.2
18
 * @since 3.2
19
 * @deprecated Use {@link org.eclipse.pde.launching.launcher.AbstractPDELaunchConfiguration} instead.
36
 */
20
 */
37
public abstract class AbstractPDELaunchConfiguration extends LaunchConfigurationDelegate {
21
public abstract class AbstractPDELaunchConfiguration extends org.eclipse.pde.launching.launcher.AbstractPDELaunchConfiguration {
38
39
	protected File fConfigDir = null;
40
41
	/* (non-Javadoc)
42
	 * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#isLaunchProblem(org.eclipse.core.resources.IMarker)
43
	 */
44
	protected boolean isLaunchProblem(IMarker problemMarker) throws CoreException {
45
		return super.isLaunchProblem(problemMarker) && (problemMarker.getType().equals(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER) || problemMarker.getType().equals(PDEMarkerFactory.MARKER_ID));
46
	}
47
48
	/*
49
	 * (non-Javadoc)
50
	 * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
51
	 */
52
	public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
53
		try {
54
			fConfigDir = null;
55
			monitor.beginTask("", 4); //$NON-NLS-1$
56
			try {
57
				preLaunchCheck(configuration, launch, new SubProgressMonitor(monitor, 2));
58
			} catch (CoreException e) {
59
				if (e.getStatus().getSeverity() == IStatus.CANCEL) {
60
					monitor.setCanceled(true);
61
					return;
62
				}
63
				throw e;
64
			}
65
			// if restarting, remove the restart flag from the launch config
66
			if (configuration.getAttribute(IPDEUIConstants.RESTART, false) && configuration instanceof ILaunchConfigurationWorkingCopy) {
67
				((ILaunchConfigurationWorkingCopy) configuration).setAttribute(IPDEUIConstants.RESTART, false);
68
				((ILaunchConfigurationWorkingCopy) configuration).doSave();
69
			}
70
			VMRunnerConfiguration runnerConfig = new VMRunnerConfiguration(getMainClass(), getClasspath(configuration));
71
			runnerConfig.setVMArguments(getVMArguments(configuration));
72
			runnerConfig.setProgramArguments(getProgramArguments(configuration));
73
			runnerConfig.setWorkingDirectory(getWorkingDirectory(configuration).getAbsolutePath());
74
			runnerConfig.setEnvironment(getEnvironment(configuration));
75
			runnerConfig.setVMSpecificAttributesMap(getVMSpecificAttributesMap(configuration));
76
77
			monitor.worked(1);
78
79
			setDefaultSourceLocator(configuration);
80
			manageLaunch(launch);
81
			IVMRunner runner = getVMRunner(configuration, mode);
82
			if (runner != null)
83
				runner.run(runnerConfig, launch, monitor);
84
			else
85
				monitor.setCanceled(true);
86
			monitor.done();
87
		} catch (final CoreException e) {
88
			monitor.setCanceled(true);
89
			LauncherUtils.getDisplay().syncExec(new Runnable() {
90
				public void run() {
91
					MessageDialog.openError(LauncherUtils.getActiveShell(), PDEUIMessages.Launcher_error_title, e.getMessage());
92
				}
93
			});
94
		}
95
	}
96
97
	/**
98
	 * Returns the VM runner for the given launch mode to use when launching the
99
	 * given configuration.
100
	 *  
101
	 * @param configuration launch configuration
102
	 * @param mode launch node
103
	 * @return VM runner to use when launching the given configuration in the given mode
104
	 * @throws CoreException if a VM runner cannot be determined
105
	 */
106
	public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException {
107
		IVMInstall launcher = VMHelper.createLauncher(configuration);
108
		return launcher.getVMRunner(mode);
109
	}
110
111
	/**
112
	 * Assigns a default source locator to the given launch if a source locator
113
	 * has not yet been assigned to it, and the associated launch configuration
114
	 * does not specify a source locator.
115
	 * 
116
	 * @param configuration
117
	 *            configuration being launched
118
	 * @exception CoreException
119
	 *                if unable to set the source locator
120
	 */
121
	protected void setDefaultSourceLocator(ILaunchConfiguration configuration) throws CoreException {
122
		ILaunchConfigurationWorkingCopy wc = null;
123
		if (configuration.isWorkingCopy()) {
124
			wc = (ILaunchConfigurationWorkingCopy) configuration;
125
		} else {
126
			wc = configuration.getWorkingCopy();
127
		}
128
		String id = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, (String) null);
129
		if (!PDESourcePathProvider.ID.equals(id)) {
130
			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, PDESourcePathProvider.ID);
131
			wc.doSave();
132
		}
133
	}
134
135
	/**
136
	 * Returns the entries that should appear on boot classpath.
137
	 * 
138
	 * @param configuration
139
	 *            launch configuration
140
	 * @return the location of startup.jar and 
141
	 * 		the bootstrap classpath specified by the given launch configuration
142
	 *        
143
	 * @exception CoreException
144
	 *                if unable to find startup.jar
145
	 */
146
	public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException {
147
		String[] classpath = LaunchArgumentsHelper.constructClasspath(configuration);
148
		if (classpath == null) {
149
			String message = PDEUIMessages.WorkbenchLauncherConfigurationDelegate_noStartup;
150
			throw new CoreException(LauncherUtils.createErrorStatus(message));
151
		}
152
		return classpath;
153
	}
154
155
	/** 
156
	 * Returns an array of environment variables to be used when
157
	 * launching the given configuration or <code>null</code> if unspecified.
158
	 * 
159
	 * @param configuration launch configuration
160
	 * @throws CoreException if unable to access associated attribute or if
161
	 * unable to resolve a variable in an environment variable's value
162
	 */
163
	public String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException {
164
		return DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);
165
	}
166
167
	/**
168
	 * Returns the working directory path specified by the given launch
169
	 * configuration, or <code>null</code> if none.
170
	 * 
171
	 * @param configuration
172
	 *            launch configuration
173
	 * @return the working directory path specified by the given launch
174
	 *         configuration, or <code>null</code> if none
175
	 * @exception CoreException
176
	 *                if unable to retrieve the attribute
177
	 */
178
	public File getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
179
		return LaunchArgumentsHelper.getWorkingDirectory(configuration);
180
	}
181
182
	/**
183
	 * Returns the Map of VM-specific attributes specified by the given launch
184
	 * configuration, or <code>null</code> if none.
185
	 * 
186
	 * @param configuration
187
	 *            launch configuration
188
	 * @return the <code>Map</code> of VM-specific attributes
189
	 * @exception CoreException
190
	 *                if unable to retrieve the attribute
191
	 */
192
	public Map getVMSpecificAttributesMap(ILaunchConfiguration configuration) throws CoreException {
193
		return LaunchArgumentsHelper.getVMSpecificAttributesMap(configuration);
194
	}
195
196
	/**
197
	 * Returns the VM arguments specified by the given launch configuration, as
198
	 * an array of strings. 
199
	 * 
200
	 * @param configuration
201
	 *            launch configuration
202
	 * @return the VM arguments specified by the given launch configuration,
203
	 *         possibly an empty array
204
	 * @exception CoreException
205
	 *                if unable to retrieve the attribute
206
	 */
207
	public String[] getVMArguments(ILaunchConfiguration configuration) throws CoreException {
208
		String[] vmArgs = new ExecutionArguments(LaunchArgumentsHelper.getUserVMArguments(configuration), "").getVMArgumentsArray(); //$NON-NLS-1$
209
		// For p2 target, add "-Declipse.p2.data.area=@config.dir/p2" unless already specified by user
210
		Map bundleMap = BundleLauncherHelper.getMergedBundleMap(configuration, false);
211
		if (bundleMap.containsKey("org.eclipse.equinox.p2.core")) { //$NON-NLS-1$
212
			for (int i = 0; i < vmArgs.length; i++) {
213
				String arg = vmArgs[i];
214
				if (arg.startsWith("-Declipse.p2.data.area=")) { //$NON-NLS-1$
215
					return vmArgs;
216
				}
217
			}
218
			String[] temp = new String[vmArgs.length + 1];
219
			System.arraycopy(vmArgs, 0, temp, 0, vmArgs.length);
220
			temp[vmArgs.length] = "-Declipse.p2.data.area=@config.dir" + File.separator + "p2"; //$NON-NLS-1$ //$NON-NLS-2$
221
			return temp;
222
		}
223
		return vmArgs;
224
	}
225
226
	/**
227
	 * Returns the program arguments to launch with.
228
	 * This list is a combination of arguments computed by PDE based on attributes
229
	 * specified in the given launch configuration, followed by the program arguments
230
	 * that the entered directly into the launch configuration.
231
	 * 
232
	 * @param configuration
233
	 *            launch configuration
234
	 * @return the program arguments necessary for launching
235
	 * 
236
	 * @exception CoreException
237
	 *                if unable to retrieve the attribute or create the
238
	 *                necessary configuration files      
239
	 */
240
	public String[] getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
241
		ArrayList programArgs = new ArrayList();
242
243
		// add tracing, if turned on	
244
		if (configuration.getAttribute(IPDELauncherConstants.TRACING, false) && !IPDELauncherConstants.TRACING_NONE.equals(configuration.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null))) {
245
			programArgs.add("-debug"); //$NON-NLS-1$
246
			programArgs.add(LaunchArgumentsHelper.getTracingFileArgument(configuration, getConfigDir(configuration).toString() + IPath.SEPARATOR + ".options")); //$NON-NLS-1$
247
		}
248
249
		// add the program args specified by the user
250
		String[] userArgs = LaunchArgumentsHelper.getUserProgramArgumentArray(configuration);
251
		ArrayList userDefined = new ArrayList();
252
		for (int i = 0; i < userArgs.length; i++) {
253
			// be forgiving if people have tracing turned on and forgot
254
			// to remove the -debug from the program args field.
255
			if (userArgs[i].equals("-debug") && programArgs.contains("-debug")) //$NON-NLS-1$ //$NON-NLS-2$
256
				continue;
257
			userDefined.add(userArgs[i]);
258
		}
259
260
		if (!configuration.getAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, false)) {
261
262
			if (!userDefined.contains("-os")) { //$NON-NLS-1$
263
				programArgs.add("-os"); //$NON-NLS-1$
264
				programArgs.add(TargetPlatform.getOS());
265
			}
266
			if (!userDefined.contains("-ws")) { //$NON-NLS-1$
267
				programArgs.add("-ws"); //$NON-NLS-1$
268
				programArgs.add(TargetPlatform.getWS());
269
			}
270
			if (!userDefined.contains("-arch")) { //$NON-NLS-1$
271
				programArgs.add("-arch"); //$NON-NLS-1$
272
				programArgs.add(TargetPlatform.getOSArch());
273
			}
274
		}
275
276
		if (userDefined.size() > 0) {
277
			programArgs.addAll(userDefined);
278
		}
279
280
		return (String[]) programArgs.toArray(new String[programArgs.size()]);
281
	}
282
283
	/**
284
	 * Does sanity checking before launching.  The criteria whether the launch should 
285
	 * proceed or not is specific to the launch configuration type.
286
	 * 
287
	 * @param configuration launch configuration
288
	 * @param launch the launch object to contribute processes and debug targets to
289
	 * @param monitor a progress monitor
290
	 * 
291
	 * @throws CoreException exception thrown if launch fails or canceled or if unable to retrieve attributes
292
	 * from the launch configuration
293
	 * 				
294
	 */
295
	protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
296
		boolean autoValidate = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, false);
297
		monitor.beginTask("", autoValidate ? 3 : 4); //$NON-NLS-1$
298
		if (autoValidate)
299
			validatePluginDependencies(configuration, new SubProgressMonitor(monitor, 1));
300
		validateProjectDependencies(configuration, new SubProgressMonitor(monitor, 1));
301
		clear(configuration, new SubProgressMonitor(monitor, 1));
302
		launch.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, getConfigDir(configuration).toString());
303
		synchronizeManifests(configuration, new SubProgressMonitor(monitor, 1));
304
	}
305
306
	/**
307
	 * Returns the configuration area specified by the given launch
308
	 * configuration.
309
	 * 
310
	 * @param configuration
311
	 *            launch configuration
312
	 * @return the directory path specified by the given launch
313
	 *         configuration
314
	 */
315
	protected File getConfigDir(ILaunchConfiguration configuration) {
316
		if (fConfigDir == null)
317
			fConfigDir = LaunchConfigurationHelper.getConfigurationArea(configuration);
318
		return fConfigDir;
319
	}
320
321
	/*
322
	/* (non-Javadoc)
323
	 * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
324
	 */
325
	protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
326
		return computeBuildOrder(LaunchPluginValidator.getAffectedProjects(configuration));
327
	}
328
329
	/*
330
	 * (non-Javadoc)
331
	 * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getProjectsForProblemSearch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
332
	 */
333
	protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) throws CoreException {
334
		return LaunchPluginValidator.getAffectedProjects(configuration);
335
	}
336
337
	/**
338
	 * Returns the fully-qualified name of the class to launch. 
339
	 * 
340
	 * @return the fully-qualified name of the class to launch.  Must not return <code>null</code>. 
341
	 * @since 3.3
342
	 */
343
	public String getMainClass() {
344
		if (TargetPlatformHelper.getTargetVersion() >= 3.3)
345
			return "org.eclipse.equinox.launcher.Main"; //$NON-NLS-1$
346
		return "org.eclipse.core.launcher.Main"; //$NON-NLS-1$
347
	}
348
349
	/**
350
	 * Adds a listener to the launch to be notified at interesting launch lifecycle
351
	 * events such as when the launch terminates.
352
	 * 
353
	 * @param launch
354
	 * 			the launch 		
355
	 * 
356
	 * @since 3.3	
357
	 */
358
	protected void manageLaunch(ILaunch launch) {
359
		PDEPlugin.getDefault().getLaunchListener().manage(launch);
360
	}
361
362
	/**
363
	 * Checks for old-style plugin.xml files that have become stale since the last launch.
364
	 * For any stale plugin.xml files found, the corresponding MANIFEST.MF is deleted 
365
	 * from the runtime configuration area so that it gets regenerated upon startup.
366
	 * 
367
	 * @param configuration
368
	 * 			the launch configuration
369
	 * @param monitor
370
	 * 			a progress monitor
371
	 * 
372
	 * @since 3.3
373
	 */
374
	protected void synchronizeManifests(ILaunchConfiguration configuration, IProgressMonitor monitor) {
375
		LaunchConfigurationHelper.synchronizeManifests(configuration, getConfigDir(configuration));
376
		monitor.done();
377
	}
378
379
	/**
380
	 * Checks if the Automated Management of Dependencies option is turned on.
381
	 * If so, it makes aure all manifests are updated with the correct dependencies.
382
	 * 
383
	 * @param configuration
384
	 * 			the launch configuration
385
	 * @param monitor
386
	 * 			a progress monitor
387
	 * 
388
	 * @since 3.3
389
	 */
390
	protected void validateProjectDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) {
391
		LauncherUtils.validateProjectDependencies(configuration, monitor);
392
	}
393
394
	/**
395
	 * By default, this method does nothing.  Clients should override, if appropriate.
396
	 * 
397
	 * @param configuration
398
	 * 			the launch configuration
399
	 * @param monitor
400
	 * 			the progress monitor
401
	 * @throws CoreException
402
	 * 			if unable to retrieve launch attribute values
403
	 * @since 3.3
404
	 */
405
	protected void clear(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
406
	}
407
408
	/**
409
	 * Validates inter-bundle dependencies automatically prior to launching
410
	 * if that option is turned on.
411
	 * 
412
	 * @param configuration
413
	 * 			the launch configuration
414
	 * @param monitor
415
	 * 			a progress monitor
416
	 * @since 3.3
417
	 */
418
	protected void validatePluginDependencies(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
419
		EclipsePluginValidationOperation op = new EclipsePluginValidationOperation(configuration);
420
		LaunchPluginValidator.runValidationOperation(op, monitor);
421
	}
422
423
}
22
}
424
  - *
23
  - *
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/OSGiLaunchConfigurationDelegate.java (-40 / +2 lines)
Lines 10-61 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.runtime.*;
15
import org.eclipse.debug.core.ILaunch;
16
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
18
import org.eclipse.osgi.util.NLS;
19
import org.eclipse.pde.internal.ui.*;
20
import org.eclipse.pde.internal.ui.launcher.LaunchPluginValidator;
21
import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkManager;
22
23
/**
13
/**
24
 * A launch delegate for launching OSGi frameworks
14
 * A launch delegate for launching OSGi frameworks
25
 * <p>
15
 * <p>
26
 * Clients may subclass and instantiate this class.
16
 * Clients may subclass and instantiate this class.
27
 * </p>
17
 * </p>
28
 * @since 3.3
18
 * @since 3.3
19
 * @deprecated Use {@link org.eclipse.pde.launching.launcher.OSGiLaunchConfigurationDelegate} instead.
29
 */
20
 */
30
public class OSGiLaunchConfigurationDelegate extends LaunchConfigurationDelegate {
21
public class OSGiLaunchConfigurationDelegate extends org.eclipse.pde.launching.launcher.OSGiLaunchConfigurationDelegate {
31
32
	/**
33
	 * Delegates to the launcher delegate associated with the OSGi framework
34
	 * selected in the launch configuration.
35
	 * 
36
	 * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
37
	 */
38
	public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
39
		OSGiFrameworkManager manager = PDEPlugin.getDefault().getOSGiFrameworkManager();
40
		String id = configuration.getAttribute(IPDELauncherConstants.OSGI_FRAMEWORK_ID, manager.getDefaultFramework());
41
		LaunchConfigurationDelegate launcher = manager.getFrameworkLauncher(id);
42
		if (launcher != null) {
43
			launcher.launch(configuration, mode, launch, monitor);
44
		} else {
45
			String name = manager.getFrameworkName(id);
46
			if (name == null)
47
				name = PDEUIMessages.OSGiLaunchConfiguration_selected;
48
			String message = NLS.bind(PDEUIMessages.OSGiLaunchConfiguration_cannotFindLaunchConfiguration, name);
49
			IStatus status = new Status(IStatus.ERROR, IPDEUIConstants.PLUGIN_ID, IStatus.OK, message, null);
50
			throw new CoreException(status);
51
		}
52
	}
53
54
	/* (non-Javadoc)
55
	 * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
56
	 */
57
	protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
58
		return computeBuildOrder(LaunchPluginValidator.getAffectedProjects(configuration));
59
	}
60
22
61
}
23
}
62
  - *
24
  - *
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/UILauncherSettings.java (+36 lines)
Line 0 Link Here
1
package org.eclipse.pde.ui.launcher;
2
3
import org.eclipse.pde.launching.launcher.*;
4
5
import org.eclipse.pde.internal.launching.launcher.IEclipsePluginValidationOperationHelper;
6
import org.eclipse.pde.internal.launching.launcher.LauncherUtils;
7
8
import org.eclipse.pde.internal.ui.launcher.*;
9
10
/**
11
 * @since 3.6
12
 */
13
public class UILauncherSettings implements IPDELauncherSettings {
14
15
	private IPDELaunchConfigurationHelper pdeLaunchConfigurationHelper = new PDELaunchConfigurationHelper();
16
	private IEclipsePluginValidationOperationHelper eclipsePluginValidationOperationHelper = new EclipsePluginValidationOperationHelper();
17
	private IPDELaunchListener launchListener = new LaunchListener();
18
	private ILauncherUtils launcherUtils = new LauncherUtils(new LauncherUtilsHelper());
19
20
	public IEclipsePluginValidationOperationHelper getEclipsePluginValidationOperationHelper() {
21
		return eclipsePluginValidationOperationHelper;
22
	}
23
24
	public IPDELaunchListener getLaunchListener() {
25
		return launchListener;
26
	}
27
28
	public ILauncherUtils getLauncherUtils() {
29
		return launcherUtils;
30
	}
31
32
	public IPDELaunchConfigurationHelper getPDELaunchConfigurationHelper() {
33
		return pdeLaunchConfigurationHelper;
34
	}
35
36
}
0
  + text/plain
37
  + text/plain
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/PDESourcePathProvider.java (-119 / +3 lines)
Lines 10-139 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import java.util.ArrayList;
14
import java.util.List;
15
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IResource;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.debug.core.ILaunchConfiguration;
19
import org.eclipse.jdt.core.*;
20
import org.eclipse.jdt.launching.*;
21
import org.eclipse.pde.internal.core.util.PDEJavaHelper;
22
import org.eclipse.pde.internal.ui.PDEPlugin;
23
import org.eclipse.pde.internal.ui.launcher.LaunchPluginValidator;
24
import org.eclipse.pde.internal.ui.launcher.VMHelper;
25
26
/**
13
/**
27
 * Generates a source lookup path for all PDE-based launch configurations
14
 * Generates a source lookup path for all PDE-based launch configurations
28
 * <p>
15
 * <p>
29
 * Clients may subclass this class.
16
 * Clients may subclass this class.
30
 * </p>
17
 * </p>
31
 * @since 3.3
18
 * @since 3.3
19
 * @deprecated Use {@link org.eclipse.pde.launching.launcher.PDESourcePathProvider} instead
32
 */
20
 */
33
public class PDESourcePathProvider extends StandardSourcePathProvider {
21
public class PDESourcePathProvider extends org.eclipse.pde.launching.launcher.PDESourcePathProvider {
34
35
	public static final String ID = "org.eclipse.pde.ui.workbenchClasspathProvider"; //$NON-NLS-1$
36
37
	/*
38
	 * (non-Javadoc)
39
	 * @see org.eclipse.jdt.launching.StandardSourcePathProvider#computeUnresolvedClasspath(org.eclipse.debug.core.ILaunchConfiguration)
40
	 */
41
	public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration configuration) throws CoreException {
42
		List sourcePath = new ArrayList();
43
		sourcePath.add(getJREEntry(configuration));
44
		IProject[] projects = getJavaProjects(configuration);
45
		for (int i = 0; i < projects.length; i++) {
46
			sourcePath.add(JavaRuntime.newProjectRuntimeClasspathEntry(JavaCore.create(projects[i])));
47
		}
48
		return (IRuntimeClasspathEntry[]) sourcePath.toArray(new IRuntimeClasspathEntry[sourcePath.size()]);
49
	}
50
22
51
	/**
23
}
52
	 * Returns a JRE runtime classpath entry
53
	 * 
54
	 * @param configuration
55
	 * 			the launch configuration
56
	 * @return a JRE runtime classpath entry
57
	 * @throws CoreException
58
	 * 			if the JRE associated with the launch configuration cannot be found
59
	 * 			or if unable to retrieve the launch configuration attributes
60
	 */
61
	private IRuntimeClasspathEntry getJREEntry(ILaunchConfiguration configuration) throws CoreException {
62
		IVMInstall jre = VMHelper.createLauncher(configuration);
63
		IPath containerPath = new Path(JavaRuntime.JRE_CONTAINER);
64
		containerPath = containerPath.append(jre.getVMInstallType().getId());
65
		containerPath = containerPath.append(jre.getName());
66
		return JavaRuntime.newRuntimeContainerClasspathEntry(containerPath, IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
67
	}
68
69
	/**
70
	 * Returns an array of sorted plug-in projects that represent plug-ins participating
71
	 * in the launch
72
	 * 
73
	 * @param configuration
74
	 * 			the launch configuration
75
	 * @return an array of ordered projects
76
	 * @throws CoreException
77
	 * 			if unable to retrieve attributes from the launch configuration or if 
78
	 * 			an error occurs when checking the nature of the project
79
	 * 			
80
	 */
81
	private IProject[] getJavaProjects(ILaunchConfiguration configuration) throws CoreException {
82
		IProject[] projects = LaunchPluginValidator.getAffectedProjects(configuration);
83
		return PDEPlugin.getWorkspace().computeProjectOrder(projects).projects;
84
	}
85
86
	/*
87
	 * (non-Javadoc)
88
	 * @see org.eclipse.jdt.launching.StandardSourcePathProvider#resolveClasspath(org.eclipse.jdt.launching.IRuntimeClasspathEntry[], org.eclipse.debug.core.ILaunchConfiguration)
89
	 */
90
	public IRuntimeClasspathEntry[] resolveClasspath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) throws CoreException {
91
		List all = new ArrayList(entries.length);
92
		for (int i = 0; i < entries.length; i++) {
93
			if (entries[i].getType() == IRuntimeClasspathEntry.PROJECT) {
94
				// a project resolves to itself for source lookup (rather than
95
				// the class file output locations)
96
				all.add(entries[i]);
97
				// also add non-JRE libraries
98
				IResource resource = entries[i].getResource();
99
				if (resource instanceof IProject) {
100
					addBinaryPackageFragmentRoots(JavaCore.create((IProject) resource), all);
101
				}
102
			} else {
103
				IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveRuntimeClasspathEntry(entries[i], configuration);
104
				for (int j = 0; j < resolved.length; j++) {
105
					all.add(resolved[j]);
106
				}
107
			}
108
		}
109
		return (IRuntimeClasspathEntry[]) all.toArray(new IRuntimeClasspathEntry[all.size()]);
110
	}
111
112
	/**
113
	 * Adds runtime classpath entries for binary package fragment roots contained within
114
	 * the project
115
	 * 
116
	 * @param jProject
117
	 * 			the Java project whose roots are to be enumerated
118
	 * @param all
119
	 * 			a list of accumulated runtime classpath entries
120
	 * @throws CoreException
121
	 * 			if unable to evaluate the package fragment roots
122
	 */
123
	private void addBinaryPackageFragmentRoots(IJavaProject jProject, List all) throws CoreException {
124
		IPackageFragmentRoot[] roots = jProject.getPackageFragmentRoots();
125
		for (int j = 0; j < roots.length; j++) {
126
			if (roots[j].getKind() == IPackageFragmentRoot.K_BINARY && !PDEJavaHelper.isJRELibrary(roots[j])) {
127
				IRuntimeClasspathEntry rte = JavaRuntime.newArchiveRuntimeClasspathEntry(roots[j].getPath());
128
				IPath path = roots[j].getSourceAttachmentPath();
129
				if (path != null) {
130
					rte.setSourceAttachmentPath(path);
131
					rte.setSourceAttachmentRootPath(roots[j].getSourceAttachmentRootPath());
132
				}
133
				if (!all.contains(rte))
134
					all.add(rte);
135
			}
136
		}
137
138
	}
139
}
140
  - *
24
  - *
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/BundlesTab.java (+2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfigurationTabGroup.java (-2 / +6 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.ui.launcher;
12
package org.eclipse.pde.ui.launcher;
13
13
14
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
15
import org.eclipse.pde.launching.launcher.PDESourcePathProvider;
16
17
import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper;
18
import org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper;
19
14
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.debug.core.ILaunchConfiguration;
21
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
22
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
Lines 19-26 Link Here
19
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
25
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
20
import org.eclipse.pde.internal.core.TargetPlatformHelper;
26
import org.eclipse.pde.internal.core.TargetPlatformHelper;
21
import org.eclipse.pde.internal.ui.IPDEUIConstants;
27
import org.eclipse.pde.internal.ui.IPDEUIConstants;
22
import org.eclipse.pde.internal.ui.launcher.BundleLauncherHelper;
23
import org.eclipse.pde.internal.ui.launcher.LaunchArgumentsHelper;
24
import org.eclipse.swt.custom.BusyIndicator;
28
import org.eclipse.swt.custom.BusyIndicator;
25
import org.eclipse.swt.widgets.Display;
29
import org.eclipse.swt.widgets.Display;
26
30
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitWorkbenchLaunchShortcut.java (-3 / +5 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.*;
14
15
import org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper;
16
13
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
18
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15
import org.eclipse.jdt.core.IJavaElement;
19
import org.eclipse.jdt.core.IJavaElement;
Lines 18-25 Link Here
18
import org.eclipse.pde.core.plugin.TargetPlatform;
22
import org.eclipse.pde.core.plugin.TargetPlatform;
19
import org.eclipse.pde.internal.core.TargetPlatformHelper;
23
import org.eclipse.pde.internal.core.TargetPlatformHelper;
20
import org.eclipse.pde.internal.ui.IPDEUIConstants;
24
import org.eclipse.pde.internal.ui.IPDEUIConstants;
21
import org.eclipse.pde.internal.ui.launcher.LaunchArgumentsHelper;
22
import org.eclipse.pde.internal.ui.launcher.LauncherUtils;
23
25
24
/**
26
/**
25
 * A launch shortcut capable of launching a Plug-in JUnit test.
27
 * A launch shortcut capable of launching a Plug-in JUnit test.
Lines 52-58 Link Here
52
		configuration.setAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, true);
54
		configuration.setAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, true);
53
55
54
		// Program to launch
56
		// Program to launch
55
		if (LauncherUtils.requiresUI(configuration)) {
57
		if (PDELaunchingPlugin.getDefault().getLauncherUtils().requiresUI(configuration)) {
56
			String product = TargetPlatform.getDefaultProduct();
58
			String product = TargetPlatform.getDefaultProduct();
57
			if (product != null) {
59
			if (product != null) {
58
				configuration.setAttribute(IPDELauncherConstants.USE_PRODUCT, true);
60
				configuration.setAttribute(IPDELauncherConstants.USE_PRODUCT, true);
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/OSGiLauncherTabGroup.java (-3 / +5 lines)
Lines 10-20 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
14
15
import org.eclipse.pde.internal.launching.launcher.OSGiFrameworkManager;
16
13
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
14
import org.eclipse.debug.ui.*;
18
import org.eclipse.debug.ui.*;
15
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
19
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
16
import org.eclipse.pde.internal.ui.PDEPlugin;
17
import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkManager;
18
20
19
/**
21
/**
20
 * Creates and initializes the tabs on the OSGi Framework launch configuration.
22
 * Creates and initializes the tabs on the OSGi Framework launch configuration.
Lines 49-55 Link Here
49
	 */
51
	 */
50
	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
52
	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
51
		super.setDefaults(configuration);
53
		super.setDefaults(configuration);
52
		OSGiFrameworkManager manager = PDEPlugin.getDefault().getOSGiFrameworkManager();
54
		OSGiFrameworkManager manager = PDELaunchingPlugin.getDefault().getOSGiFrameworkManager();
53
		manager.getDefaultInitializer().initialize(configuration);
55
		manager.getDefaultInitializer().initialize(configuration);
54
	}
56
	}
55
57
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/OSGiLaunchShortcut.java (-3 / +6 lines)
Lines 10-20 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
import org.eclipse.pde.launching.launcher.PDELaunchingPlugin;
15
16
import org.eclipse.pde.internal.launching.launcher.OSGiFrameworkManager;
17
13
import org.eclipse.debug.core.ILaunchConfiguration;
18
import org.eclipse.debug.core.ILaunchConfiguration;
14
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
19
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15
import org.eclipse.jface.viewers.ISelection;
20
import org.eclipse.jface.viewers.ISelection;
16
import org.eclipse.pde.internal.ui.PDEPlugin;
17
import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkManager;
18
import org.eclipse.ui.IEditorPart;
21
import org.eclipse.ui.IEditorPart;
19
22
20
/**
23
/**
Lines 59-65 Link Here
59
	 * @see org.eclipse.pde.ui.launcher.AbstractLaunchShortcut#initializeConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
62
	 * @see org.eclipse.pde.ui.launcher.AbstractLaunchShortcut#initializeConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
60
	 */
63
	 */
61
	protected void initializeConfiguration(ILaunchConfigurationWorkingCopy configuration) {
64
	protected void initializeConfiguration(ILaunchConfigurationWorkingCopy configuration) {
62
		OSGiFrameworkManager manager = PDEPlugin.getDefault().getOSGiFrameworkManager();
65
		OSGiFrameworkManager manager = PDELaunchingPlugin.getDefault().getOSGiFrameworkManager();
63
		manager.getDefaultInitializer().initialize(configuration);
66
		manager.getDefaultInitializer().initialize(configuration);
64
	}
67
	}
65
68
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/OSGiLaunchConfigurationInitializer.java (-89 / +2 lines)
Lines 10-20 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
14
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
15
import org.eclipse.pde.core.plugin.IPluginModelBase;
16
import org.eclipse.pde.core.plugin.PluginRegistry;
17
import org.eclipse.pde.internal.ui.launcher.BundleLauncherHelper;
18
13
19
/**
14
/**
20
 * Initializes launch configuration attributes for newly-created OSGi Framework 
15
 * Initializes launch configuration attributes for newly-created OSGi Framework 
Lines 25-114 Link Here
25
 * </p>
20
 * </p>
26
 * 
21
 * 
27
 * @since 3.3
22
 * @since 3.3
23
 * @deprecated Use {@link OSGiLaunchConfigurationInitializer} instead.
28
 */
24
 */
29
public class OSGiLaunchConfigurationInitializer {
25
public class OSGiLaunchConfigurationInitializer extends org.eclipse.pde.launching.launcher.OSGiLaunchConfigurationInitializer {
30
31
	protected static final String DEFAULT = "default"; //$NON-NLS-1$
32
33
	/**
34
	 * Initializes some attributes on a newly-created launch configuration
35
	 * 
36
	 * @param configuration
37
	 * 			the launch configuration
38
	 */
39
	public void initialize(ILaunchConfigurationWorkingCopy configuration) {
40
		initializeFrameworkDefaults(configuration);
41
		initializeBundleState(configuration);
42
		initializeSourcePathProvider(configuration);
43
	}
44
45
	/**
46
	 * Sets the source provider ID
47
	 * 
48
	 * @param configuration
49
	 * 			the launch configuration
50
	 */
51
	protected void initializeSourcePathProvider(ILaunchConfigurationWorkingCopy configuration) {
52
		configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, PDESourcePathProvider.ID);
53
	}
54
55
	/**
56
	 * Initializes the start level and auto-start attributes
57
	 * 
58
	 * @param configuration
59
	 * 			the launch configuration
60
	 */
61
	protected void initializeFrameworkDefaults(ILaunchConfigurationWorkingCopy configuration) {
62
		configuration.setAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, true);
63
		configuration.setAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4);
64
	}
65
66
	/**
67
	 * Initializes the checked/unchecked state of bundles
68
	 * 
69
	 * @param configuration
70
	 * 			the launch configuration
71
	 */
72
	protected void initializeBundleState(ILaunchConfigurationWorkingCopy configuration) {
73
		StringBuffer explugins = new StringBuffer();
74
		StringBuffer wsplugins = new StringBuffer();
75
		IPluginModelBase[] models = PluginRegistry.getActiveModels();
76
		for (int i = 0; i < models.length; i++) {
77
			boolean inWorkspace = models[i].getUnderlyingResource() != null;
78
			appendBundle(inWorkspace ? wsplugins : explugins, models[i]);
79
		}
80
		configuration.setAttribute(IPDELauncherConstants.WORKSPACE_BUNDLES, wsplugins.toString());
81
		configuration.setAttribute(IPDELauncherConstants.TARGET_BUNDLES, explugins.toString());
82
		configuration.setAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true);
83
	}
84
85
	private void appendBundle(StringBuffer buffer, IPluginModelBase model) {
86
		if (buffer.length() > 0)
87
			buffer.append(","); //$NON-NLS-1$
88
		String id = model.getPluginBase().getId();
89
		String value = BundleLauncherHelper.writeBundleEntry(model, getStartLevel(id), getAutoStart(id));
90
		buffer.append(value);
91
	}
92
93
	/**
94
	 * Returns the bundle's start level
95
	 * 
96
	 * @param bundleID
97
	 * 			the bundle ID
98
	 * @return the start level for the given bundle or the string <code>default</code>
99
	 */
100
	protected String getStartLevel(String bundleID) {
101
		return DEFAULT;
102
	}
103
104
	/**
105
	 * Returns whether the bundle should be started automatically
106
	 * @param bundleID
107
	 * 			the bundle ID
108
	 * @return <code>true</code>, <code>false</code>, or <code>default</code>
109
	 */
110
	protected String getAutoStart(String bundleID) {
111
		return DEFAULT;
112
	}
113
26
114
}
27
}
115
  - *
28
  - *
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/AbstractLaunchShortcut.java (+2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import java.util.ArrayList;
15
import java.util.ArrayList;
14
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.debug.core.*;
17
import org.eclipse.debug.core.*;
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java (-268 / +2 lines)
Lines 11-290 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.ui.launcher;
12
package org.eclipse.pde.ui.launcher;
13
13
14
import java.io.File;
15
import java.util.*;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.variables.IStringVariableManager;
18
import org.eclipse.core.variables.VariablesPlugin;
19
import org.eclipse.debug.core.ILaunch;
20
import org.eclipse.debug.core.ILaunchConfiguration;
21
import org.eclipse.pde.core.plugin.IPluginModelBase;
22
import org.eclipse.pde.core.plugin.TargetPlatform;
23
import org.eclipse.pde.internal.core.*;
24
import org.eclipse.pde.internal.core.util.CoreUtility;
25
import org.eclipse.pde.internal.core.util.VersionUtil;
26
import org.eclipse.pde.internal.ui.PDEPlugin;
27
import org.eclipse.pde.internal.ui.PDEUIMessages;
28
import org.eclipse.pde.internal.ui.launcher.*;
29
import org.osgi.framework.Version;
30
31
/**
14
/**
32
 * A launch delegate for launching Eclipse applications
15
 * A launch delegate for launching Eclipse applications
33
 * <p>
16
 * <p>
34
 * Clients may subclass and instantiate this class.
17
 * Clients may subclass and instantiate this class.
35
 * </p>
18
 * </p>
36
 * @since 3.2
19
 * @since 3.2
20
 * @deprecated Use {@link org.eclipse.pde.launching.launcher.EclipseApplicationLaunchConfiguration} instead
37
 */
21
 */
38
public class EclipseApplicationLaunchConfiguration extends AbstractPDELaunchConfiguration {
22
public class EclipseApplicationLaunchConfiguration extends org.eclipse.pde.launching.launcher.EclipseApplicationLaunchConfiguration {
39
40
	// used to generate the dev classpath entries
41
	// key is bundle ID, value is a model
42
	private Map fAllBundles;
43
44
	// key is a model, value is startLevel:autoStart
45
	private Map fModels;
46
47
	/**
48
	 * To avoid duplicating variable substitution (and duplicate prompts)
49
	 * this variable will store the substituted workspace location.
50
	 */
51
	private String fWorkspaceLocation;
52
53
	/*
54
	 * (non-Javadoc)
55
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration)
56
	 */
57
	public String[] getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
58
		ArrayList programArgs = new ArrayList();
59
60
		// If a product is specified, then add it to the program args
61
		if (configuration.getAttribute(IPDELauncherConstants.USE_PRODUCT, false)) {
62
			String product = configuration.getAttribute(IPDELauncherConstants.PRODUCT, ""); //$NON-NLS-1$
63
			if (product.length() > 0) {
64
				programArgs.add("-product"); //$NON-NLS-1$
65
				programArgs.add(product);
66
			} else { // TODO product w/o an application and product... how to handle gracefully?
67
				programArgs.add("-application"); //$NON-NLS-1$
68
				programArgs.add(configuration.getAttribute(IPDELauncherConstants.APPLICATION, "")); //$NON-NLS-1$
69
			}
70
		} else {
71
			// specify the application to launch
72
			programArgs.add("-application"); //$NON-NLS-1$
73
			programArgs.add(configuration.getAttribute(IPDELauncherConstants.APPLICATION, TargetPlatform.getDefaultApplication()));
74
		}
75
76
		// specify the workspace location for the runtime workbench
77
		if (fWorkspaceLocation == null) {
78
			fWorkspaceLocation = LaunchArgumentsHelper.getWorkspaceLocation(configuration);
79
		}
80
		if (fWorkspaceLocation.length() > 0) {
81
			programArgs.add("-data"); //$NON-NLS-1$
82
			programArgs.add(fWorkspaceLocation);
83
		}
84
85
		boolean showSplash = true;
86
		if (configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false)) {
87
			validateFeatures();
88
			IPath installPath = PDEPlugin.getWorkspace().getRoot().getLocation();
89
			programArgs.add("-install"); //$NON-NLS-1$
90
			programArgs.add("file:" + installPath.removeLastSegments(1).addTrailingSeparator().toString()); //$NON-NLS-1$
91
			if (!configuration.getAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, true)) {
92
				programArgs.add("-configuration"); //$NON-NLS-1$
93
				programArgs.add("file:" + new Path(getConfigDir(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$
94
			}
95
			programArgs.add("-update"); //$NON-NLS-1$
96
			// add the output folder names
97
			programArgs.add("-dev"); //$NON-NLS-1$
98
			programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigDir(configuration).toString() + "/dev.properties", true)); //$NON-NLS-1$
99
		} else {
100
			String productID = LaunchConfigurationHelper.getProductID(configuration);
101
			Properties prop = LaunchConfigurationHelper.createConfigIniFile(configuration, productID, fAllBundles, fModels, getConfigDir(configuration));
102
			showSplash = prop.containsKey("osgi.splashPath") || prop.containsKey("splashLocation"); //$NON-NLS-1$ //$NON-NLS-2$
103
			String brandingId = LaunchConfigurationHelper.getContributingPlugin(productID);
104
			TargetPlatform.createPlatformConfiguration(getConfigDir(configuration), (IPluginModelBase[]) fAllBundles.values().toArray(new IPluginModelBase[fAllBundles.size()]), brandingId != null ? (IPluginModelBase) fAllBundles.get(brandingId) : null);
105
			TargetPlatformHelper.checkPluginPropertiesConsistency(fAllBundles, getConfigDir(configuration));
106
			programArgs.add("-configuration"); //$NON-NLS-1$
107
			programArgs.add("file:" + new Path(getConfigDir(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$
108
109
			// add the output folder names
110
			programArgs.add("-dev"); //$NON-NLS-1$
111
			programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigDir(configuration).toString() + "/dev.properties", fAllBundles)); //$NON-NLS-1$
112
		}
113
		// necessary for PDE to know how to load plugins when target platform = host platform
114
		// see PluginPathFinder.getPluginPaths() and PluginPathFinder.isDevLaunchMode()
115
		IPluginModelBase base = (IPluginModelBase) fAllBundles.get(PDECore.PLUGIN_ID);
116
		if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) < 0) //$NON-NLS-1$
117
			programArgs.add("-pdelaunch"); //$NON-NLS-1$
118
119
		String[] args = super.getProgramArguments(configuration);
120
		for (int i = 0; i < args.length; i++) {
121
			programArgs.add(args[i]);
122
		}
123
124
		if (!programArgs.contains("-nosplash") && showSplash) { //$NON-NLS-1$
125
			if (TargetPlatformHelper.getTargetVersion() >= 3.1) {
126
				programArgs.add(0, "-launcher"); //$NON-NLS-1$
127
128
				IPath path = null;
129
				if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$
130
					path = new Path(TargetPlatform.getLocation()).append("Eclipse.app/Contents/MacOS/eclipse"); //$NON-NLS-1$
131
				} else {
132
					path = new Path(TargetPlatform.getLocation()).append("eclipse"); //$NON-NLS-1$
133
					if (TargetPlatform.getOS().equals("win32")) { //$NON-NLS-1$
134
						path = path.addFileExtension("exe"); //$NON-NLS-1$
135
					}
136
				}
137
138
				programArgs.add(1, path.toOSString()); //This could be the branded launcher if we want (also this does not bring much)
139
				programArgs.add(2, "-name"); //$NON-NLS-1$
140
				programArgs.add(3, "Eclipse"); //This should be the name of the product //$NON-NLS-1$
141
				programArgs.add(4, "-showsplash"); //$NON-NLS-1$
142
				programArgs.add(5, "600"); //$NON-NLS-1$
143
			} else {
144
				programArgs.add(0, "-showsplash"); //$NON-NLS-1$
145
				programArgs.add(1, computeShowsplashArgument());
146
			}
147
		}
148
		return (String[]) programArgs.toArray(new String[programArgs.size()]);
149
	}
150
151
	private void validateFeatures() throws CoreException {
152
		IPath installPath = PDEPlugin.getWorkspace().getRoot().getLocation();
153
		String lastSegment = installPath.lastSegment();
154
		boolean badStructure = lastSegment == null;
155
		if (!badStructure) {
156
			IPath featuresPath = installPath.removeLastSegments(1).append("features"); //$NON-NLS-1$
157
			badStructure = !lastSegment.equalsIgnoreCase("plugins") //$NON-NLS-1$
158
					|| !featuresPath.toFile().exists();
159
		}
160
		if (badStructure) {
161
			throw new CoreException(LauncherUtils.createErrorStatus(PDEUIMessages.WorkbenchLauncherConfigurationDelegate_badFeatureSetup));
162
		}
163
		// Ensure important files are present
164
		ensureProductFilesExist(getProductPath());
165
	}
166
167
	private IPath getProductPath() {
168
		return PDEPlugin.getWorkspace().getRoot().getLocation().removeLastSegments(1);
169
	}
170
171
	private String computeShowsplashArgument() {
172
		IPath eclipseHome = new Path(TargetPlatform.getLocation());
173
		IPath fullPath = eclipseHome.append("eclipse"); //$NON-NLS-1$
174
		return fullPath.toOSString() + " -showsplash 600"; //$NON-NLS-1$
175
	}
176
177
	private void ensureProductFilesExist(IPath productArea) {
178
		File productDir = productArea.toFile();
179
		File marker = new File(productDir, ".eclipseproduct"); //$NON-NLS-1$
180
		IPath eclipsePath = new Path(TargetPlatform.getLocation());
181
		if (!marker.exists())
182
			CoreUtility.copyFile(eclipsePath, ".eclipseproduct", marker); //$NON-NLS-1$
183
184
		File configDir = new File(productDir, "configuration"); //$NON-NLS-1$
185
		if (!configDir.exists())
186
			configDir.mkdirs();
187
		File ini = new File(configDir, "config.ini"); //$NON-NLS-1$
188
		if (!ini.exists())
189
			CoreUtility.copyFile(eclipsePath.append("configuration"), "config.ini", ini); //$NON-NLS-1$ //$NON-NLS-2$
190
	}
191
192
	/*
193
	 * (non-Javadoc)
194
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#getConfigDir(org.eclipse.debug.core.ILaunchConfiguration)
195
	 */
196
	protected File getConfigDir(ILaunchConfiguration config) {
197
		if (fConfigDir == null) {
198
			try {
199
				if (config.getAttribute(IPDELauncherConstants.USEFEATURES, false) && config.getAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, true)) {
200
					String root = getProductPath().toString();
201
					root += "/configuration"; //$NON-NLS-1$
202
					fConfigDir = new File(root);
203
					if (!fConfigDir.exists())
204
						fConfigDir.mkdirs();
205
				} else {
206
					fConfigDir = LaunchConfigurationHelper.getConfigurationArea(config);
207
				}
208
			} catch (CoreException e) {
209
				fConfigDir = LaunchConfigurationHelper.getConfigurationArea(config);
210
			}
211
		}
212
		return fConfigDir;
213
	}
214
215
	/**
216
	 * Clears the workspace prior to launching if the workspace exists and the option to 
217
	 * clear it is turned on.  Also clears the configuration area if that option is chosen.
218
	 * 
219
	 * @param configuration
220
	 * 			the launch configuration
221
	 * @param monitor
222
	 * 			the progress monitor
223
	 * @throws CoreException
224
	 * 			if unable to retrieve launch attribute values
225
	 * @since 3.3
226
	 */
227
	protected void clear(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
228
		if (fWorkspaceLocation == null) {
229
			fWorkspaceLocation = LaunchArgumentsHelper.getWorkspaceLocation(configuration);
230
		}
231
		// Clear workspace and prompt, if necessary
232
		if (!LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, monitor))
233
			throw new CoreException(Status.CANCEL_STATUS);
234
235
		// clear config area, if necessary
236
		if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false))
237
			CoreUtility.deleteContent(getConfigDir(configuration));
238
	}
239
240
	/* (non-Javadoc)
241
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
242
	 */
243
	protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
244
		fWorkspaceLocation = null;
245
246
		fModels = BundleLauncherHelper.getMergedBundleMap(configuration, false);
247
		fAllBundles = new HashMap(fModels.size());
248
		Iterator iter = fModels.keySet().iterator();
249
		while (iter.hasNext()) {
250
			IPluginModelBase model = (IPluginModelBase) iter.next();
251
			fAllBundles.put(model.getPluginBase().getId(), model);
252
		}
253
		validateConfigIni(configuration);
254
		super.preLaunchCheck(configuration, launch, monitor);
255
	}
256
257
	private void validateConfigIni(ILaunchConfiguration configuration) throws CoreException {
258
		if (!configuration.getAttribute(IPDELauncherConstants.CONFIG_GENERATE_DEFAULT, true)) {
259
			String templateLoc = configuration.getAttribute(IPDELauncherConstants.CONFIG_TEMPLATE_LOCATION, ""); //$NON-NLS-1$
260
			IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
261
			templateLoc = mgr.performStringSubstitution(templateLoc);
262
263
			File templateFile = new File(templateLoc);
264
			if (!templateFile.exists()) {
265
				if (!LauncherUtils.generateConfigIni())
266
					throw new CoreException(Status.CANCEL_STATUS);
267
				// with the way the launcher works, if a config.ini file is not found one will be generated automatically.
268
				// This check was to warn the user a config.ini needs to be generated. - bug 161265, comment #7
269
			}
270
		}
271
	}
272
273
	/* (non-Javadoc)
274
	 * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#getVMArguments(org.eclipse.debug.core.ILaunchConfiguration)
275
	 */
276
	public String[] getVMArguments(ILaunchConfiguration configuration) throws CoreException {
277
		String[] vmArgs = super.getVMArguments(configuration);
278
		IPluginModelBase base = (IPluginModelBase) fAllBundles.get(PDECore.PLUGIN_ID);
279
		if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) >= 0) { //$NON-NLS-1$
280
			// necessary for PDE to know how to load plugins when target platform = host platform
281
			// see PluginPathFinder.getPluginPaths() and PluginPathFinder.isDevLaunchMode()
282
			String[] result = new String[vmArgs.length + 1];
283
			System.arraycopy(vmArgs, 0, result, 0, vmArgs.length);
284
			result[vmArgs.length] = "-Declipse.pde.launch=true"; //$NON-NLS-1$
285
			return result;
286
		}
287
		return vmArgs;
288
	}
289
23
290
}
24
}
291
  - *
25
  - *
(-)org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/ConfigurationTab.java (+2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.launcher;
11
package org.eclipse.pde.ui.launcher;
12
12
13
import org.eclipse.pde.launching.launcher.IPDELauncherConstants;
14
13
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
(-)org.eclipse.pde.ui/plugin.properties (-12 lines)
Lines 20-32 Link Here
20
expoint.samples.name = Code Samples
20
expoint.samples.name = Code Samples
21
expoint.osgiLauncher.name = OSGi Launcher
21
expoint.osgiLauncher.name = OSGi Launcher
22
22
23
PDELaunchDelegate.name=Eclipse Application Launcher
24
PDELaunchDelegate.description=The Eclipse Application launcher is used to run or debug a separate instance of an Eclipse application
25
OSGiLaunchDelegate.name=OSGi Framework Launcher
26
OSGiLaunchDelegate.description=The OSGi Framework launcher is used to launch an OSGi framework and run or debug OSGi bundles
27
JUnitPluginLaunchDelegate.name= JUnit Plugin Test Launcher
28
JUnitPluginLaunchDelegate.description=The JUnit Plugin Test launcher is used to run and debug test suites for plug-in projects
29
30
RunPDELaunchShortcut.description=Runs a separate Eclipse application
23
RunPDELaunchShortcut.description=Runs a separate Eclipse application
31
DebugPDELaunchShortcut.description=Debugs a separate Eclipse application
24
DebugPDELaunchShortcut.description=Debugs a separate Eclipse application
32
RunOSGiLaunchShortcut.description=Runs an OSGi framework
25
RunOSGiLaunchShortcut.description=Runs an OSGi framework
Lines 132-147 Link Here
132
launcher.shortcut.label= Eclipse Application
125
launcher.shortcut.label= Eclipse Application
133
EclipseApplicationShortcut.description.debug = Debug Eclipse Application
126
EclipseApplicationShortcut.description.debug = Debug Eclipse Application
134
EclipseApplicationShortcut.description.run = Run Eclipse Application
127
EclipseApplicationShortcut.description.run = Run Eclipse Application
135
Equinox.shortcut.label = Equinox
136
OSGiShortcut.description.debug = Debug OSGi Framework
128
OSGiShortcut.description.debug = Debug OSGi Framework
137
OSGiShortcut.description.run = Run OSGi Framework
129
OSGiShortcut.description.run = Run OSGi Framework
138
launcher.junit.name = JUnit Plug-in Test
130
launcher.junit.name = JUnit Plug-in Test
139
JUnitApplicationShortcut.description.debug = Debug JUnit Plug-in Test
131
JUnitApplicationShortcut.description.debug = Debug JUnit Plug-in Test
140
JUnitApplicationShortcut.description.run = Run JUnit Plug-in Test
132
JUnitApplicationShortcut.description.run = Run JUnit Plug-in Test
141
133
142
launchConfigurationType.name = Eclipse Application
143
launcher.framework.name = OSGi Framework
144
145
osgiLauncherTabGroup.description.debug=Create a configuration to launch the OSGi framework in debug mode.
134
osgiLauncherTabGroup.description.debug=Create a configuration to launch the OSGi framework in debug mode.
146
osgiLauncherTabGroup.description.run=Create a configuration to launch the OSGi framework.
135
osgiLauncherTabGroup.description.run=Create a configuration to launch the OSGi framework.
147
workbenchLauncherTabGroup.description.debug=Create a configuration to launch an Eclipse application in debug mode.
136
workbenchLauncherTabGroup.description.debug=Create a configuration to launch an Eclipse application in debug mode.
Lines 182-188 Link Here
182
editor.target.name = Target Editor
171
editor.target.name = Target Editor
183
fontDefinition.label.0 = Manifest compare text font
172
fontDefinition.label.0 = Manifest compare text font
184
fontDefinition.description.0 = The MANIFEST.MF compare text font is used by Bundle manifest compare/merge tools.
173
fontDefinition.description.0 = The MANIFEST.MF compare text font is used by Bundle manifest compare/merge tools.
185
pde.sourcelocator = PDE Source Lookup Director
186
174
187
category.source.name = Manifest Editor Source
175
category.source.name = Manifest Editor Source
188
category.source.description = PDE Source Page actions
176
category.source.description = PDE Source Page actions
(-)org.eclipse.pde.ui/plugin.xml (-59 / +1 lines)
Lines 18-24 Link Here
18
   <extension-point id="newExtension" name="%expoint.newExtension.name" schema="schema/newExtension.exsd"/>
18
   <extension-point id="newExtension" name="%expoint.newExtension.name" schema="schema/newExtension.exsd"/>
19
   <extension-point id="templates" name="%expoint.templates.name" schema="schema/templates.exsd"/>
19
   <extension-point id="templates" name="%expoint.templates.name" schema="schema/templates.exsd"/>
20
   <extension-point id="samples" name="%expoint.samples.name" schema="schema/samples.exsd"/>
20
   <extension-point id="samples" name="%expoint.samples.name" schema="schema/samples.exsd"/>
21
   <extension-point id="osgiFrameworks" name="%expoint.osgiLauncher.name" schema="schema/osgiFrameworks.exsd"/>
22
   <extension-point id="targetProvisioners" name="%extension-point.name.0" schema="schema/targetProvisioners.exsd"/>
21
   <extension-point id="targetProvisioners" name="%extension-point.name.0" schema="schema/targetProvisioners.exsd"/>
23
   <extension-point id="launchShortcuts" name="%extension-point.name.1" schema="schema/launchShortcuts.exsd"/>
22
   <extension-point id="launchShortcuts" name="%extension-point.name.1" schema="schema/launchShortcuts.exsd"/>
24
23
Lines 895-936 Link Here
895
      </objectContribution>
894
      </objectContribution>
896
   </extension>
895
   </extension>
897
   <extension
896
   <extension
898
         point="org.eclipse.debug.core.launchConfigurationTypes">
899
      <launchConfigurationType
900
            delegate="org.eclipse.pde.ui.launcher.EclipseApplicationLaunchConfiguration"
901
            delegateDescription="%PDELaunchDelegate.description"
902
            delegateName="%PDELaunchDelegate.name"
903
            id="org.eclipse.pde.ui.RuntimeWorkbench"
904
            migrationDelegate="org.eclipse.pde.internal.ui.launcher.PDEMigrationDelegate"
905
            modes="run, debug"
906
            name="%launchConfigurationType.name"
907
            sourceLocatorId="org.eclipse.pde.ui.launcher.PDESourceLookupDirector"
908
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
909
      </launchConfigurationType>
910
      <launchConfigurationType
911
            delegate="org.eclipse.pde.ui.launcher.JUnitLaunchConfigurationDelegate"
912
            delegateDescription="%JUnitPluginLaunchDelegate.description"
913
            delegateName="%JUnitPluginLaunchDelegate.name"
914
            id="org.eclipse.pde.ui.JunitLaunchConfig"
915
            migrationDelegate="org.eclipse.pde.internal.ui.launcher.PDEMigrationDelegate"
916
            modes="run, debug"
917
            name="%launcher.junit.name"
918
            sourceLocatorId="org.eclipse.pde.ui.launcher.PDESourceLookupDirector"
919
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
920
      </launchConfigurationType>
921
      <launchConfigurationType
922
            delegate="org.eclipse.pde.ui.launcher.OSGiLaunchConfigurationDelegate"
923
            delegateDescription="%OSGiLaunchDelegate.description"
924
            delegateName="%OSGiLaunchDelegate.name"
925
            id="org.eclipse.pde.ui.EquinoxLauncher"
926
            migrationDelegate="org.eclipse.pde.internal.ui.launcher.OSGiMigrationDelegate"
927
            modes="run, debug"
928
            name="%launcher.framework.name"
929
            public="true"
930
            sourceLocatorId="org.eclipse.pde.ui.launcher.PDESourceLookupDirector"
931
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer"/>
932
   </extension>
933
   <extension
934
         point="org.eclipse.debug.ui.launchConfigurationTypeImages">
897
         point="org.eclipse.debug.ui.launchConfigurationTypeImages">
935
      <launchConfigurationTypeImage
898
      <launchConfigurationTypeImage
936
            icon="$nl$/icons/etool16/eclipse_launcher.gif"
899
            icon="$nl$/icons/etool16/eclipse_launcher.gif"
Lines 994-1005 Link Here
994
      </launchConfigurationTabGroup>
957
      </launchConfigurationTabGroup>
995
   </extension>
958
   </extension>
996
   <extension
959
   <extension
997
         point="org.eclipse.jdt.junit.junitLaunchConfigs">
998
      <launchConfigType
999
            configTypeID="org.eclipse.pde.ui.JunitLaunchConfig">
1000
      </launchConfigType>
1001
   </extension>
1002
   <extension
1003
         point="org.eclipse.debug.ui.launchShortcuts">
960
         point="org.eclipse.debug.ui.launchShortcuts">
1004
      <shortcut
961
      <shortcut
1005
            class="org.eclipse.pde.ui.launcher.JUnitWorkbenchLaunchShortcut"
962
            class="org.eclipse.pde.ui.launcher.JUnitWorkbenchLaunchShortcut"
Lines 1223-1229 Link Here
1223
   <extension
1180
   <extension
1224
         point="org.eclipse.jdt.launching.classpathProviders">
1181
         point="org.eclipse.jdt.launching.classpathProviders">
1225
      <classpathProvider
1182
      <classpathProvider
1226
            class="org.eclipse.pde.ui.launcher.PDESourcePathProvider"
1183
            class="org.eclipse.pde.launcher.PDESourcePathProvider"
1227
            id="org.eclipse.pde.ui.workbenchClasspathProvider">
1184
            id="org.eclipse.pde.ui.workbenchClasspathProvider">
1228
      </classpathProvider>
1185
      </classpathProvider>
1229
   </extension>
1186
   </extension>
Lines 1637-1649 Link Here
1637
         </description>
1594
         </description>
1638
       </fontDefinition>
1595
       </fontDefinition>
1639
    </extension>
1596
    </extension>
1640
    <extension point="org.eclipse.debug.core.sourceLocators">
1641
   		<sourceLocator
1642
   			id="org.eclipse.pde.ui.launcher.PDESourceLookupDirector"
1643
   			class="org.eclipse.pde.internal.ui.launcher.PDESourceLookupDirector"
1644
   			name="%pde.sourcelocator">
1645
   		</sourceLocator>
1646
   </extension>
1647
   <extension
1597
   <extension
1648
          point="org.eclipse.ui.perspectiveExtensions">
1598
          point="org.eclipse.ui.perspectiveExtensions">
1649
       <perspectiveExtension
1599
       <perspectiveExtension
Lines 1720-1733 Link Here
1720
      </perspectiveExtension>
1670
      </perspectiveExtension>
1721
    </extension>
1671
    </extension>
1722
    <extension
1672
    <extension
1723
         point="org.eclipse.pde.ui.osgiFrameworks">
1724
      <framework
1725
            launcherDelegate="org.eclipse.pde.ui.launcher.EquinoxLaunchConfiguration"
1726
            id="org.eclipse.pde.ui.EquinoxFramework"
1727
            name="%Equinox.shortcut.label" 
1728
            initializer="org.eclipse.pde.internal.ui.launcher.EquinoxInitializer"/>
1729
    </extension>
1730
    <extension
1731
          point="org.eclipse.ui.ide.markerSupport">
1673
          point="org.eclipse.ui.ide.markerSupport">
1732
       <markerTypeCategory
1674
       <markerTypeCategory
1733
             name="%marker.category">
1675
             name="%marker.category">

Return to bug 278845