View | Details | Raw Unified | Return to bug 297895
Collapse All | Expand All

(-)src/org/eclipse/pde/api/tools/tests/util/ProjectUtils.java (-7 / +14 lines)
Lines 32-41 Link Here
32
import org.eclipse.jdt.core.JavaCore;
32
import org.eclipse.jdt.core.JavaCore;
33
import org.eclipse.jdt.core.JavaModelException;
33
import org.eclipse.jdt.core.JavaModelException;
34
import org.eclipse.jdt.launching.JavaRuntime;
34
import org.eclipse.jdt.launching.JavaRuntime;
35
import org.eclipse.pde.core.project.Factory;
36
import org.eclipse.pde.core.project.IBundleClasspathEntry;
35
import org.eclipse.pde.core.project.IBundleClasspathEntry;
37
import org.eclipse.pde.core.project.IBundleProjectDescription;
36
import org.eclipse.pde.core.project.IBundleProjectDescription;
37
import org.eclipse.pde.core.project.IBundleProjectService;
38
import org.eclipse.pde.core.project.IPackageExportDescription;
38
import org.eclipse.pde.core.project.IPackageExportDescription;
39
import org.eclipse.pde.internal.core.PDECore;
39
import org.eclipse.pde.internal.core.natures.PDE;
40
import org.eclipse.pde.internal.core.natures.PDE;
40
import org.osgi.framework.Version;
41
import org.osgi.framework.Version;
41
42
Lines 58-63 Link Here
58
	 */
59
	 */
59
	public static final String SRC_FOLDER = "src";
60
	public static final String SRC_FOLDER = "src";
60
	
61
	
62
	public static IBundleProjectService getBundleProjectService() {
63
		return (IBundleProjectService) PDECore.getDefault().acquireService(IBundleProjectService.class.getName());
64
	}
65
	
61
	/**
66
	/**
62
	 * Crate a plug-in project with the given name
67
	 * Crate a plug-in project with the given name
63
	 * @param projectName
68
	 * @param projectName
Lines 80-87 Link Here
80
		}
85
		}
81
		
86
		
82
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
87
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
83
		IBundleProjectDescription description = Factory.getDescription(project);
88
		IBundleProjectService service = getBundleProjectService();
84
		IBundleClasspathEntry entry = Factory.newBundleClasspathEntry(new Path(SRC_FOLDER), new Path(BIN_FOLDER), null);
89
		IBundleProjectDescription description = service.getDescription(project);
90
		IBundleClasspathEntry entry = service.newBundleClasspathEntry(new Path(SRC_FOLDER), new Path(BIN_FOLDER), null);
85
		description.setSymbolicName(projectName);
91
		description.setSymbolicName(projectName);
86
		description.setBundleClassath(new IBundleClasspathEntry[]{entry});
92
		description.setBundleClassath(new IBundleClasspathEntry[]{entry});
87
		description.setNatureIds(resolvednatures);
93
		description.setNatureIds(resolvednatures);
Lines 282-288 Link Here
282
	 * @param packagename the name of the package to remove from the export package header
288
	 * @param packagename the name of the package to remove from the export package header
283
	 */
289
	 */
284
	public static void removeExportedPackage(IProject project, String packagename) throws CoreException {
290
	public static void removeExportedPackage(IProject project, String packagename) throws CoreException {
285
		IBundleProjectDescription description = Factory.getDescription(project);
291
		IBundleProjectDescription description = getBundleProjectService().getDescription(project);
286
		IPackageExportDescription[] exports = description.getPackageExports();
292
		IPackageExportDescription[] exports = description.getPackageExports();
287
		if (exports != null) {
293
		if (exports != null) {
288
			List list = new ArrayList();
294
			List list = new ArrayList();
Lines 314-320 Link Here
314
			//do no work
320
			//do no work
315
			return;
321
			return;
316
		}
322
		}
317
		IBundleProjectDescription description = Factory.getDescription(project);
323
		IBundleProjectService service = getBundleProjectService();
324
		IBundleProjectDescription description = service.getDescription(project);
318
		IPackageExportDescription[] exports = description.getPackageExports();
325
		IPackageExportDescription[] exports = description.getPackageExports();
319
		List list = new ArrayList();
326
		List list = new ArrayList();
320
		if (exports != null) {
327
		if (exports != null) {
Lines 322-328 Link Here
322
				list.add(exports[i]);
329
				list.add(exports[i]);
323
			}
330
			}
324
		}
331
		}
325
		list.add(Factory.newPackageExport(packagename, null, !internal, friends));
332
		list.add(service.newPackageExport(packagename, null, !internal, friends));
326
		description.setPackageExports((IPackageExportDescription[]) list.toArray(new IPackageExportDescription[list.size()]));
333
		description.setPackageExports((IPackageExportDescription[]) list.toArray(new IPackageExportDescription[list.size()]));
327
		description.apply(null);
334
		description.apply(null);
328
	}
335
	}
Lines 335-341 Link Here
335
	 * @return the {@link IPackageExportDescription}s for the given project or <code>null</code>
342
	 * @return the {@link IPackageExportDescription}s for the given project or <code>null</code>
336
	 */
343
	 */
337
	public static IPackageExportDescription[] getExportedPackages(IProject project) throws CoreException {
344
	public static IPackageExportDescription[] getExportedPackages(IProject project) throws CoreException {
338
		IBundleProjectDescription description = Factory.getDescription(project);
345
		IBundleProjectDescription description = getBundleProjectService().getDescription(project);
339
		return description.getPackageExports();
346
		return description.getPackageExports();
340
	}
347
	}
341
}
348
}
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 27-33 Link Here
27
 org.eclipse.pde.internal.core.natures;x-friends:="org.eclipse.pde.ui",
27
 org.eclipse.pde.internal.core.natures;x-friends:="org.eclipse.pde.ui",
28
 org.eclipse.pde.internal.core.plugin;x-friends:="org.eclipse.pde.ui",
28
 org.eclipse.pde.internal.core.plugin;x-friends:="org.eclipse.pde.ui",
29
 org.eclipse.pde.internal.core.product;x-friends:="org.eclipse.pde.ui",
29
 org.eclipse.pde.internal.core.product;x-friends:="org.eclipse.pde.ui",
30
 org.eclipse.pde.internal.core.project;x-friends:="org.eclipse.pde.ui",
30
 org.eclipse.pde.internal.core.project;x-friends:="org.eclipse.pde.ui,org.eclipse.pde.launching",
31
 org.eclipse.pde.internal.core.schema;x-friends:="org.eclipse.pde.ui",
31
 org.eclipse.pde.internal.core.schema;x-friends:="org.eclipse.pde.ui",
32
 org.eclipse.pde.internal.core.search;x-friends:="org.eclipse.pde.ui",
32
 org.eclipse.pde.internal.core.search;x-friends:="org.eclipse.pde.ui",
33
 org.eclipse.pde.internal.core.site;x-friends:="org.eclipse.pde.ui",
33
 org.eclipse.pde.internal.core.site;x-friends:="org.eclipse.pde.ui",
(-)src/org/eclipse/pde/core/build/IBuild.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 15-21 Link Here
15
15
16
/**
16
/**
17
 * The top-level model object of the model that is created from
17
 * The top-level model object of the model that is created from
18
 * "build.properties" file.
18
 * <code>build.properties</code> file.
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.
(-)src/org/eclipse/pde/core/build/IBuildModel.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2009 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 14-20 Link Here
14
import org.eclipse.pde.core.IModelChangeProvider;
14
import org.eclipse.pde.core.IModelChangeProvider;
15
15
16
/**
16
/**
17
 * This model is created from the "build.properties" file
17
 * This model is created from the <code>build.properties</code> file
18
 * that defines what source folders in the plug-in are
18
 * that defines what source folders in the plug-in are
19
 * to be used to build require plug-in Jars.
19
 * to be used to build require plug-in Jars.
20
 * <p>
20
 * <p>
(-)src/org/eclipse/pde/core/project/Factory.java (-110 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 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.core.project;
12
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.osgi.service.resolver.VersionRange;
17
import org.eclipse.pde.internal.core.project.*;
18
import org.osgi.framework.Version;
19
20
/**
21
 * Factory class for creating bundle project descriptions and associated artifacts.
22
 * 
23
 * @noinstantiate This class is not intended to be instantiated by clients.
24
 * @since 3.6
25
 */
26
public final class Factory {
27
28
	/**
29
	 * Returns a bundle description for the given project.
30
	 * If the project does not exist, the description can be used to create
31
	 * a new bundle project. If the project does exist, the description can be used to
32
	 * modify a project.
33
	 *  
34
	 * @param project project
35
	 * @return bundle description for the associated project
36
	 * @exception CoreException if unable to create a description on an existing project
37
	 */
38
	public static IBundleProjectDescription getDescription(IProject project) throws CoreException {
39
		return new BundleProjectDescription(project);
40
	}
41
42
	/**
43
	 * Creates and returns a new host description.
44
	 * 
45
	 * @param name symbolic name of the host
46
	 * @param range version constraint or <code>null</code>
47
	 * @return host description
48
	 */
49
	public static IHostDescription newHost(String name, VersionRange range) {
50
		return new HostDescriptoin(name, range);
51
	}
52
53
	/**
54
	 * Creates and returns a new package import description.
55
	 * 
56
	 * @param name fully qualified name of imported package
57
	 * @param range version constraint or <code>null</code>
58
	 * @param optional whether the import is optional
59
	 * @return package import description
60
	 */
61
	public static IPackageImportDescription newPackageImport(String name, VersionRange range, boolean optional) {
62
		return new PackageImportDescription(name, range, optional);
63
	}
64
65
	/**
66
	 * Constructs a new package export description.
67
	 * 
68
	 * @param name fully qualified package name
69
	 * @param version version or <code>null</code>
70
	 * @param api whether the package is considered API
71
	 * @param friends symbolic names of bundles that are friends, or <code>null</code>; when 
72
	 *  friends are specified the package will not be API
73
	 * @return package export description
74
	 */
75
	public static IPackageExportDescription newPackageExport(String name, Version version, boolean api, String[] friends) {
76
		return new PackageExportDescription(name, version, friends, api);
77
	}
78
79
	/**
80
	 * Creates and returns a new required bundle description.
81
	 * 
82
	 * @param name symbolic name of required bundle
83
	 * @param range version constraint or <code>null</code>
84
	 * @param optional whether the required bundle is optional
85
	 * @param export whether the required bundle is re-exported
86
	 * @return required bundle description
87
	 */
88
	public static IRequiredBundleDescription newRequiredBundle(String name, VersionRange range, boolean optional, boolean export) {
89
		return new RequiredBundleDescription(name, range, export, optional);
90
	}
91
92
	/**
93
	 * Creates and returns a new bundle classpath entry defining the relationship
94
	 * between a source, binaries, and library on the Bundle-Classpath header.
95
	 * <p>
96
	 * When a source folder is specified, the binary folder defines its output
97
	 * folder, or may be <code>null</code> to indicate that the project's default output
98
	 * folder is used by the source folder. When only a binary folder is specified, there
99
	 * is no source associated with the folder. When no source or binary are specified,
100
	 * it indicates the library is included in the project as an archive.
101
	 * </p>
102
	 * @param sourceFolder source folder or <code>null</code>
103
	 * @param binaryFolder binary folder or <code>null</code>
104
	 * @param library associated entry on the Bundle-Classpath header or <code>null</code>
105
	 * 	to indicate default entry "."
106
	 */
107
	public static IBundleClasspathEntry newBundleClasspathEntry(IPath sourceFolder, IPath binaryFolder, IPath library) {
108
		return new BundleClasspathSpecification(sourceFolder, binaryFolder, library);
109
	}
110
}
(-)src/org/eclipse/pde/core/project/IBundleClasspathEntry.java (-1 / +2 lines)
Lines 44-50 Link Here
44
	 * Java project's default build path output folder. When a {@link #getSourcePath()} is
44
	 * Java project's default build path output folder. When a {@link #getSourcePath()} is
45
	 * not specified, the binary path specifies a folder of class files.
45
	 * not specified, the binary path specifies a folder of class files.
46
	 * </p>
46
	 * </p>
47
	 * @return class file folder, archive or <code>null</code> to indicate default build path output folder
47
	 * @return project relative class file folder, archive or <code>null</code> to indicate
48
	 *  default build path output folder
48
	 */
49
	 */
49
	public IPath getBinaryPath();
50
	public IPath getBinaryPath();
50
51
(-)src/org/eclipse/pde/core/project/IBundleProjectDescription.java (-3 / +32 lines)
Lines 181-187 Link Here
181
	/**
181
	/**
182
	 * Sets the value of the Bundle-Localization header for the described bundle.
182
	 * Sets the value of the Bundle-Localization header for the described bundle.
183
	 * 
183
	 * 
184
	 * @param path bundle relative path or <code>null</code>
184
	 * @param path bundle root relative path or <code>null</code>
185
	 */
185
	 */
186
	public void setLocalization(IPath path);
186
	public void setLocalization(IPath path);
187
187
Lines 405-411 Link Here
405
	 * Bundle-Classpath will be included. This sets any additional entries that 
405
	 * Bundle-Classpath will be included. This sets any additional entries that 
406
	 * are to be included.
406
	 * are to be included.
407
	 * </p>
407
	 * </p>
408
	 * @param paths project relative paths of files and folders to include
408
	 * @param paths bundle root relative paths of files and folders to include
409
	 *  or <code>null</code> if none
409
	 *  or <code>null</code> if none
410
	 */
410
	 */
411
	public void setBinIncludes(IPath[] paths);
411
	public void setBinIncludes(IPath[] paths);
Lines 418-425 Link Here
418
	 * Bundle-Classpath will be included. This returns any additional entries that 
418
	 * Bundle-Classpath will be included. This returns any additional entries that 
419
	 * are to be included.
419
	 * are to be included.
420
	 * </p>
420
	 * </p>
421
	 * @return files and folders on the <code>bin.includes</code> entry or <code>null</code>
421
	 * @return bundle root relative paths of files and folders on the <code>bin.includes</code>
422
	 * 	entry or <code>null</code>
422
	 */
423
	 */
423
	public IPath[] getBinIncludes();
424
	public IPath[] getBinIncludes();
424
425
426
	/**
427
	 * Sets the location within the project where the root of the bundle and its associated
428
	 * artifacts will reside, or <code>null</code> to indicate the default bundle root location
429
	 * should be used (project folder).
430
	 * <p>
431
	 * This has no effect on existing projects.  This method is intended for use on descriptions
432
	 * for new projects. To modify the bundle root of an existing project use
433
	 * {@link Factory#setBundleRoot(IProject, IPath)}.
434
	 * </p>
435
	 * <p>
436
	 * The bundle root is the folder containing the <code>META-INF/</code> folder. When a project
437
	 * does not yet exist, bundle files will be created relative to the bundle root. When a project
438
	 * already exists and the bundle root location is modified, existing bundle artifacts at the old
439
	 * root are not moved or modified. Instead, the modify operation will update any existing bundle
440
	 * files at the new root location, or create them if not yet present.
441
	 * </p>
442
	 * @param path project relative path to bundle root artifacts in the project or <code>null</code>
443
	 */
444
	public void setBundleRoot(IPath path);
445
446
	/**
447
	 * Returns the location within the project that is the root of the bundle related
448
	 * artifacts, or <code>null</code> to indicate the default location (project folder).
449
	 * 
450
	 * @return project relative bundle root path or <code>null</code>
451
	 */
452
	public IPath getBundleRoot();
453
425
}
454
}
(-)src/org/eclipse/pde/core/project/IBundleProjectService.java (+125 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 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.core.project;
12
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.osgi.service.resolver.VersionRange;
17
import org.osgi.framework.BundleContext;
18
import org.osgi.framework.Version;
19
20
/**
21
 * Service used to create and configure bundle project descriptions.
22
 * <p>
23
 * An instance of this service can be obtained from a {@link BundleContext} as
24
 * follows
25
 * <pre>
26
 * BundleContext context = ...
27
 * ServiceReference ref = context.getServiceReference(IBundleContextService.class.getName());
28
 * IBundleContextService service = (IBundleContextService)context.getService(ref);
29
 * ...
30
 * context.ungetService(ref); 
31
 * </pre>
32
 * </p>
33
 * @since 3.6
34
 */
35
public interface IBundleProjectService {
36
37
	/**
38
	 * Returns a bundle description for the given project.
39
	 * If the project does not exist, the description can be used to create
40
	 * a new bundle project. If the project does exist, the description can be used to
41
	 * modify a project.
42
	 *  
43
	 * @param project project
44
	 * @return bundle description for the associated project
45
	 * @exception CoreException if unable to create a description on an existing project
46
	 */
47
	public IBundleProjectDescription getDescription(IProject project) throws CoreException;
48
49
	/**
50
	 * Creates and returns a new host description.
51
	 * 
52
	 * @param name symbolic name of the host
53
	 * @param range version constraint or <code>null</code>
54
	 * @return host description
55
	 */
56
	public IHostDescription newHost(String name, VersionRange range);
57
58
	/**
59
	 * Creates and returns a new package import description.
60
	 * 
61
	 * @param name fully qualified name of imported package
62
	 * @param range version constraint or <code>null</code>
63
	 * @param optional whether the import is optional
64
	 * @return package import description
65
	 */
66
	public IPackageImportDescription newPackageImport(String name, VersionRange range, boolean optional);
67
68
	/**
69
	 * Constructs a new package export description.
70
	 * 
71
	 * @param name fully qualified package name
72
	 * @param version version or <code>null</code>
73
	 * @param api whether the package is considered API
74
	 * @param friends symbolic names of bundles that are friends, or <code>null</code>; when 
75
	 *  friends are specified the package will not be API
76
	 * @return package export description
77
	 */
78
	public IPackageExportDescription newPackageExport(String name, Version version, boolean api, String[] friends);
79
80
	/**
81
	 * Creates and returns a new required bundle description.
82
	 * 
83
	 * @param name symbolic name of required bundle
84
	 * @param range version constraint or <code>null</code>
85
	 * @param optional whether the required bundle is optional
86
	 * @param export whether the required bundle is re-exported
87
	 * @return required bundle description
88
	 */
89
	public IRequiredBundleDescription newRequiredBundle(String name, VersionRange range, boolean optional, boolean export);
90
91
	/**
92
	 * Creates and returns a new bundle classpath entry defining the relationship
93
	 * between a source, binaries, and library on the Bundle-Classpath header.
94
	 * <p>
95
	 * When a source folder is specified, the binary folder defines its output
96
	 * folder, or may be <code>null</code> to indicate that the project's default output
97
	 * folder is used by the source folder. When only a binary folder is specified, there
98
	 * is no source associated with the folder. When no source or binary are specified,
99
	 * it indicates the library is included in the project as an archive.
100
	 * </p>
101
	 * @param sourceFolder source folder or <code>null</code>
102
	 * @param binaryFolder binary folder or <code>null</code>
103
	 * @param library associated entry on the Bundle-Classpath header or <code>null</code>
104
	 * 	to indicate default entry "."
105
	 */
106
	public IBundleClasspathEntry newBundleClasspathEntry(IPath sourceFolder, IPath binaryFolder, IPath library);
107
108
	/**
109
	 * Sets the location within the project where the root of the bundle and its associated
110
	 * artifacts will reside, or <code>null</code> to indicate the default bundle root location
111
	 * should be used (project folder).
112
	 * <p>
113
	 * The bundle root is the folder containing the <code>META-INF/</code> folder. When the bundle
114
	 * root location is modified, existing bundle artifacts at the old root are not moved or modified.
115
	 * When creating a new bundle project {@link IBundleProjectDescription#setBundleRoot(IPath)} can 
116
	 * be used to specify an initial bundle root location. To modify the bundle root location of an
117
	 * existing project, this method must be used.
118
	 * </p>
119
	 * @param project project that must exist and be open
120
	 * @param bundleRoot project relative path to bundle root artifacts in the project or <code>null</code>
121
	 * @throws CoreException if setting the root fails
122
	 */
123
	public void setBundleRoot(IProject project, IPath bundleRoot) throws CoreException;
124
125
}
(-)src/org/eclipse/pde/internal/core/ClasspathComputer.java (-1 / +2 lines)
Lines 24-29 Link Here
24
import org.eclipse.pde.core.plugin.IPluginLibrary;
24
import org.eclipse.pde.core.plugin.IPluginLibrary;
25
import org.eclipse.pde.core.plugin.IPluginModelBase;
25
import org.eclipse.pde.core.plugin.IPluginModelBase;
26
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
26
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
27
import org.eclipse.pde.internal.core.project.PDEProject;
27
import org.eclipse.pde.internal.core.util.CoreUtility;
28
import org.eclipse.pde.internal.core.util.CoreUtility;
28
import org.eclipse.team.core.RepositoryProvider;
29
import org.eclipse.team.core.RepositoryProvider;
29
30
Lines 140-146 Link Here
140
	}
141
	}
141
142
142
	protected static IBuild getBuild(IProject project) throws CoreException {
143
	protected static IBuild getBuild(IProject project) throws CoreException {
143
		IFile buildFile = project.getFile("build.properties"); //$NON-NLS-1$
144
		IFile buildFile = PDEProject.getBuildProperties(project);
144
		IBuildModel buildModel = null;
145
		IBuildModel buildModel = null;
145
		if (buildFile.exists()) {
146
		if (buildFile.exists()) {
146
			buildModel = new WorkspaceBuildModel(buildFile);
147
			buildModel = new WorkspaceBuildModel(buildFile);
(-)src/org/eclipse/pde/internal/core/ClasspathHelper.java (-3 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2008 IBM Corporation and others.
2
 * Copyright (c) 2003, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 21-26 Link Here
21
import org.eclipse.pde.core.build.IBuildEntry;
21
import org.eclipse.pde.core.build.IBuildEntry;
22
import org.eclipse.pde.core.plugin.*;
22
import org.eclipse.pde.core.plugin.*;
23
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
23
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
24
import org.eclipse.pde.internal.core.project.PDEProject;
24
25
25
public class ClasspathHelper {
26
public class ClasspathHelper {
26
27
Lines 249-255 Link Here
249
		try {
250
		try {
250
			if (project.hasNature(JavaCore.NATURE_ID)) {
251
			if (project.hasNature(JavaCore.NATURE_ID)) {
251
				Map classpathMap = getClasspathMap(project, checkExcluded, !base.getId().equals(PDECore.getDefault().getModelManager().getSystemBundleId()), false);
252
				Map classpathMap = getClasspathMap(project, checkExcluded, !base.getId().equals(PDECore.getDefault().getModelManager().getSystemBundleId()), false);
252
				IFile file = project.getFile("build.properties"); //$NON-NLS-1$
253
				IFile file = PDEProject.getBuildProperties(project);
253
				boolean searchBuild = file.exists();
254
				boolean searchBuild = file.exists();
254
				if (searchBuild) {
255
				if (searchBuild) {
255
					WorkspaceBuildModel bModel = new WorkspaceBuildModel(file);
256
					WorkspaceBuildModel bModel = new WorkspaceBuildModel(file);
Lines 304-310 Link Here
304
				try {
305
				try {
305
					IProject project = frags[i].getUnderlyingResource().getProject();
306
					IProject project = frags[i].getUnderlyingResource().getProject();
306
					Map classpathMap = getClasspathMap(project, checkExcluded, false, true);
307
					Map classpathMap = getClasspathMap(project, checkExcluded, false, true);
307
					IFile file = project.getFile("build.properties"); //$NON-NLS-1$
308
					IFile file = PDEProject.getBuildProperties(project);
308
					IBuild build = null;
309
					IBuild build = null;
309
					if (file.exists()) {
310
					if (file.exists()) {
310
						WorkspaceBuildModel bModel = new WorkspaceBuildModel(file);
311
						WorkspaceBuildModel bModel = new WorkspaceBuildModel(file);
(-)src/org/eclipse/pde/internal/core/ClasspathUtilCore.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 26-31 Link Here
26
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
26
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
27
import org.eclipse.pde.internal.core.plugin.*;
27
import org.eclipse.pde.internal.core.plugin.*;
28
import org.eclipse.pde.internal.core.plugin.Plugin;
28
import org.eclipse.pde.internal.core.plugin.Plugin;
29
import org.eclipse.pde.internal.core.project.PDEProject;
29
30
30
public class ClasspathUtilCore {
31
public class ClasspathUtilCore {
31
32
Lines 195-201 Link Here
195
		IBuildModel buildModel = model.getBuildModel();
196
		IBuildModel buildModel = model.getBuildModel();
196
		if (buildModel == null) {
197
		if (buildModel == null) {
197
			IProject project = model.getUnderlyingResource().getProject();
198
			IProject project = model.getUnderlyingResource().getProject();
198
			IFile buildFile = project.getFile("build.properties"); //$NON-NLS-1$
199
			IFile buildFile = PDEProject.getBuildProperties(project);
199
			if (buildFile.exists()) {
200
			if (buildFile.exists()) {
200
				buildModel = new WorkspaceBuildModel(buildFile);
201
				buildModel = new WorkspaceBuildModel(buildFile);
201
				buildModel.load();
202
				buildModel.load();
(-)src/org/eclipse/pde/internal/core/ExternalFeatureModelManager.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 57-63 Link Here
57
		monitor.beginTask("", featurePaths.length); //$NON-NLS-1$
57
		monitor.beginTask("", featurePaths.length); //$NON-NLS-1$
58
		Map uniqueFeatures = new HashMap();
58
		Map uniqueFeatures = new HashMap();
59
		for (int i = 0; i < featurePaths.length; i++) {
59
		for (int i = 0; i < featurePaths.length; i++) {
60
			File manifest = new File(featurePaths[i].getFile(), "feature.xml"); //$NON-NLS-1$
60
			File manifest = new File(featurePaths[i].getFile(), ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
61
			if (!manifest.exists() || !manifest.isFile()) {
61
			if (!manifest.exists() || !manifest.isFile()) {
62
				monitor.worked(1);
62
				monitor.worked(1);
63
				continue;
63
				continue;
(-)src/org/eclipse/pde/internal/core/FileAdapter.java (-3 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 12-18 Link Here
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.util.Locale;
14
import java.util.Locale;
15
16
import org.eclipse.core.runtime.PlatformObject;
15
import org.eclipse.core.runtime.PlatformObject;
17
16
18
public class FileAdapter extends PlatformObject {
17
public class FileAdapter extends PlatformObject {
Lines 33-39 Link Here
33
32
34
	public boolean isManifest() {
33
	public boolean isManifest() {
35
		String fileName = fFile.getName();
34
		String fileName = fFile.getName();
36
		return (fileName.equals("plugin.xml") || fileName.equals("fragment.xml") || fileName.equalsIgnoreCase("manifest.mf")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
35
		return (fileName.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || fileName.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR) || fileName.equalsIgnoreCase(ICoreConstants.MANIFEST_FILENAME));
37
	}
36
	}
38
37
39
	public boolean isSchema() {
38
	public boolean isSchema() {
(-)src/org/eclipse/pde/internal/core/ICoreConstants.java (+10 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.core;
12
package org.eclipse.pde.internal.core;
13
13
14
import java.util.Locale;
14
import org.eclipse.core.runtime.IPath;
15
import org.eclipse.core.runtime.IPath;
15
import org.eclipse.core.runtime.Path;
16
import org.eclipse.core.runtime.Path;
16
import org.osgi.framework.Constants;
17
import org.osgi.framework.Constants;
Lines 71-76 Link Here
71
	/** Constant for the string <code>META-INF/MANIFEST.MF</code> */
72
	/** Constant for the string <code>META-INF/MANIFEST.MF</code> */
72
	public final static String BUNDLE_FILENAME_DESCRIPTOR = "META-INF/MANIFEST.MF"; //$NON-NLS-1$
73
	public final static String BUNDLE_FILENAME_DESCRIPTOR = "META-INF/MANIFEST.MF"; //$NON-NLS-1$
73
74
75
	/** Constant for the string <code>MANIFEST.MF</code> */
76
	public final static String MANIFEST_FILENAME = "MANIFEST.MF"; //$NON-NLS-1$
77
78
	/** Constant for the string <code>.options</code> */
79
	public final static String OPTIONS_FILENAME = ".options"; //$NON-NLS-1$
80
81
	/** Constant for the string <code>manifest.mf</code> */
82
	public final static String MANIFEST_FILENAME_LOWER_CASE = MANIFEST_FILENAME.toLowerCase(Locale.ENGLISH);
83
74
	/** Constant for the string <code>build.properties</code> */
84
	/** Constant for the string <code>build.properties</code> */
75
	public final static String BUILD_FILENAME_DESCRIPTOR = "build.properties"; //$NON-NLS-1$
85
	public final static String BUILD_FILENAME_DESCRIPTOR = "build.properties"; //$NON-NLS-1$
76
86
(-)src/org/eclipse/pde/internal/core/JavaElementChangeListener.java (-18 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 10-37 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.core;
11
package org.eclipse.pde.internal.core;
12
12
13
import java.io.File;
13
import java.io.*;
14
import java.io.FileInputStream;
15
import java.io.FileOutputStream;
16
import java.io.IOException;
17
import java.util.Enumeration;
14
import java.util.Enumeration;
18
import java.util.Properties;
15
import java.util.Properties;
19
20
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IProject;
21
import org.eclipse.core.runtime.IPath;
17
import org.eclipse.core.runtime.IPath;
22
import org.eclipse.jdt.core.ElementChangedEvent;
18
import org.eclipse.jdt.core.*;
23
import org.eclipse.jdt.core.IClasspathEntry;
24
import org.eclipse.jdt.core.IElementChangedListener;
25
import org.eclipse.jdt.core.IJavaElement;
26
import org.eclipse.jdt.core.IJavaElementDelta;
27
import org.eclipse.jdt.core.IJavaModel;
28
import org.eclipse.jdt.core.IJavaProject;
29
import org.eclipse.jdt.core.IPackageFragment;
30
import org.eclipse.jdt.core.IPackageFragmentRoot;
31
import org.eclipse.jdt.core.JavaCore;
32
import org.eclipse.jdt.core.JavaModelException;
33
import org.eclipse.pde.core.plugin.IPluginModelBase;
19
import org.eclipse.pde.core.plugin.IPluginModelBase;
34
import org.eclipse.pde.core.plugin.PluginRegistry;
20
import org.eclipse.pde.core.plugin.PluginRegistry;
21
import org.eclipse.pde.internal.core.project.PDEProject;
35
22
36
public class JavaElementChangeListener implements IElementChangedListener {
23
public class JavaElementChangeListener implements IElementChangedListener {
37
24
Lines 120-126 Link Here
120
107
121
	private boolean isInterestingProject(IJavaProject jProject) {
108
	private boolean isInterestingProject(IJavaProject jProject) {
122
		IProject project = jProject.getProject();
109
		IProject project = jProject.getProject();
123
		return WorkspaceModelManager.isPluginProject(project) && !WorkspaceModelManager.isBinaryProject(project) && !project.exists(ICoreConstants.MANIFEST_PATH);
110
		return WorkspaceModelManager.isPluginProject(project) && !WorkspaceModelManager.isBinaryProject(project) && !PDEProject.getManifest(project).exists();
124
	}
111
	}
125
112
126
	private void updateTable(IJavaElement element) {
113
	private void updateTable(IJavaElement element) {
(-)src/org/eclipse/pde/internal/core/PDECore.java (+12 lines)
Lines 19-26 Link Here
19
import org.eclipse.core.runtime.*;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.jdt.launching.JavaRuntime;
20
import org.eclipse.jdt.launching.JavaRuntime;
21
import org.eclipse.pde.core.plugin.IPluginModelBase;
21
import org.eclipse.pde.core.plugin.IPluginModelBase;
22
import org.eclipse.pde.core.project.IBundleProjectService;
22
import org.eclipse.pde.internal.core.builders.FeatureRebuilder;
23
import org.eclipse.pde.internal.core.builders.FeatureRebuilder;
23
import org.eclipse.pde.internal.core.builders.PluginRebuilder;
24
import org.eclipse.pde.internal.core.builders.PluginRebuilder;
25
import org.eclipse.pde.internal.core.project.BundleProjectService;
24
import org.eclipse.pde.internal.core.schema.SchemaRegistry;
26
import org.eclipse.pde.internal.core.schema.SchemaRegistry;
25
import org.eclipse.pde.internal.core.target.TargetPlatformService;
27
import org.eclipse.pde.internal.core.target.TargetPlatformService;
26
import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
28
import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
Lines 149-154 Link Here
149
	 */
151
	 */
150
	private ServiceRegistration fTargetPlatformService;
152
	private ServiceRegistration fTargetPlatformService;
151
153
154
	/**
155
	 * Bundle project service.
156
	 */
157
	private ServiceRegistration fBundleProjectService;
158
152
	public PDECore() {
159
	public PDECore() {
153
		inst = this;
160
		inst = this;
154
	}
161
	}
Lines 287-292 Link Here
287
		fFeatureRebuilder.start();
294
		fFeatureRebuilder.start();
288
295
289
		fTargetPlatformService = context.registerService(ITargetPlatformService.class.getName(), TargetPlatformService.getDefault(), new Hashtable());
296
		fTargetPlatformService = context.registerService(ITargetPlatformService.class.getName(), TargetPlatformService.getDefault(), new Hashtable());
297
		fBundleProjectService = context.registerService(IBundleProjectService.class.getName(), BundleProjectService.getDefault(), new Hashtable());
290
298
291
		// for now we need to start this bundle to ensure required services
299
		// for now we need to start this bundle to ensure required services
292
		// are present when we need them (like IProfileRegistry)
300
		// are present when we need them (like IProfileRegistry)
Lines 342-347 Link Here
342
			fTargetPlatformService.unregister();
350
			fTargetPlatformService.unregister();
343
			fTargetPlatformService = null;
351
			fTargetPlatformService = null;
344
		}
352
		}
353
		if (fBundleProjectService != null) {
354
			fBundleProjectService.unregister();
355
			fBundleProjectService = null;
356
		}
345
357
346
		fServiceTracker.close();
358
		fServiceTracker.close();
347
		fPackageAdmin = null;
359
		fPackageAdmin = null;
(-)src/org/eclipse/pde/internal/core/PDEState.java (-7 / +10 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 25-30 Link Here
25
import org.eclipse.pde.core.plugin.PluginRegistry;
25
import org.eclipse.pde.core.plugin.PluginRegistry;
26
import org.eclipse.pde.internal.core.bundle.*;
26
import org.eclipse.pde.internal.core.bundle.*;
27
import org.eclipse.pde.internal.core.plugin.*;
27
import org.eclipse.pde.internal.core.plugin.*;
28
import org.eclipse.pde.internal.core.project.PDEProject;
28
import org.eclipse.pde.internal.core.util.CoreUtility;
29
import org.eclipse.pde.internal.core.util.CoreUtility;
29
30
30
public class PDEState extends MinimalState {
31
public class PDEState extends MinimalState {
Lines 261-281 Link Here
261
		IProject project = PDECore.getWorkspace().getRoot().getProject(projectName);
262
		IProject project = PDECore.getWorkspace().getRoot().getProject(projectName);
262
		if (!project.exists())
263
		if (!project.exists())
263
			return null;
264
			return null;
264
		if (project.exists(ICoreConstants.MANIFEST_PATH)) {
265
		IFile manifest = PDEProject.getManifest(project);
266
		IFile pluginXml = PDEProject.getPluginXml(project);
267
		IFile fragmentXml = PDEProject.getFragmentXml(project);
268
		if (manifest.exists()) {
265
			BundlePluginModelBase model = null;
269
			BundlePluginModelBase model = null;
266
			if (desc.getHost() == null)
270
			if (desc.getHost() == null)
267
				model = new BundlePluginModel();
271
				model = new BundlePluginModel();
268
			else
272
			else
269
				model = new BundleFragmentModel();
273
				model = new BundleFragmentModel();
270
			model.setEnabled(true);
274
			model.setEnabled(true);
271
			WorkspaceBundleModel bundle = new WorkspaceBundleModel(project.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR));
275
			WorkspaceBundleModel bundle = new WorkspaceBundleModel(manifest);
272
			bundle.load(desc, this);
276
			bundle.load(desc, this);
273
			model.setBundleDescription(desc);
277
			model.setBundleDescription(desc);
274
			model.setBundleModel(bundle);
278
			model.setBundleModel(bundle);
275
			bundle.setEditable(false);
279
			bundle.setEditable(false);
276
280
277
			String filename = (desc.getHost() == null) ? ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR : ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR;
281
			IFile file = (desc.getHost() == null) ? pluginXml : fragmentXml;
278
			IFile file = project.getFile(filename);
279
			if (file.exists()) {
282
			if (file.exists()) {
280
				WorkspaceExtensionsModel extensions = new WorkspaceExtensionsModel(file);
283
				WorkspaceExtensionsModel extensions = new WorkspaceExtensionsModel(file);
281
				extensions.setEditable(false);
284
				extensions.setEditable(false);
Lines 288-296 Link Here
288
291
289
		WorkspacePluginModelBase model = null;
292
		WorkspacePluginModelBase model = null;
290
		if (desc.getHost() == null)
293
		if (desc.getHost() == null)
291
			model = new WorkspacePluginModel(project.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR), true);
294
			model = new WorkspacePluginModel(pluginXml, true);
292
		else
295
		else
293
			model = new WorkspaceFragmentModel(project.getFile(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR), true);
296
			model = new WorkspaceFragmentModel(fragmentXml, true);
294
		model.load(desc, this);
297
		model.load(desc, this);
295
		model.setBundleDescription(desc);
298
		model.setBundleDescription(desc);
296
		return model;
299
		return model;
(-)src/org/eclipse/pde/internal/core/PluginModelManager.java (+15 lines)
Lines 975-978 Link Here
975
		fWorkspaceManager.removeExtensionDeltaListener(listener);
975
		fWorkspaceManager.removeExtensionDeltaListener(listener);
976
	}
976
	}
977
977
978
	/**
979
	 * Called when the bundle root for a project is changed.
980
	 * 
981
	 * @param project
982
	 */
983
	public void bundleRootChanged(IProject project) {
984
		fWorkspaceManager.removeModel(project);
985
		if (fWorkspaceManager.isInterestingProject(project)) {
986
			fWorkspaceManager.createModel(project, false);
987
			Object model = fWorkspaceManager.getModel(project);
988
			fWorkspaceManager.addChange(model, IModelProviderEvent.MODELS_CHANGED);
989
		}
990
		fWorkspaceManager.processModelChanges();
991
	}
992
978
}
993
}
(-)src/org/eclipse/pde/internal/core/TargetPlatformHelper.java (-1 / +1 lines)
Lines 482-488 Link Here
482
		for (int i = 0; i < models.length; i++) {
482
		for (int i = 0; i < models.length; i++) {
483
			String location = models[i].getInstallLocation();
483
			String location = models[i].getInstallLocation();
484
			if (location != null)
484
			if (location != null)
485
				list.add(location + IPath.SEPARATOR + "feature.xml"); //$NON-NLS-1$
485
				list.add(location + IPath.SEPARATOR + ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
486
		}
486
		}
487
		return (String[]) list.toArray(new String[list.size()]);
487
		return (String[]) list.toArray(new String[list.size()]);
488
	}
488
	}
(-)src/org/eclipse/pde/internal/core/TracingOptionsManager.java (-5 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2009 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 97-106 Link Here
97
		ZipFile jarFile = null;
97
		ZipFile jarFile = null;
98
		try {
98
		try {
99
			if (pluginLocation.isDirectory())
99
			if (pluginLocation.isDirectory())
100
				return new File(pluginLocation, ".options").exists(); //$NON-NLS-1$
100
				return new File(pluginLocation, ICoreConstants.OPTIONS_FILENAME).exists();
101
101
102
			jarFile = new ZipFile(pluginLocation, ZipFile.OPEN_READ);
102
			jarFile = new ZipFile(pluginLocation, ZipFile.OPEN_READ);
103
			ZipEntry manifestEntry = jarFile.getEntry(".options"); //$NON-NLS-1$
103
			ZipEntry manifestEntry = jarFile.getEntry(ICoreConstants.OPTIONS_FILENAME);
104
			if (manifestEntry != null) {
104
			if (manifestEntry != null) {
105
				stream = jarFile.getInputStream(manifestEntry);
105
				stream = jarFile.getInputStream(manifestEntry);
106
			}
106
			}
Lines 166-177 Link Here
166
		ZipFile jarFile = null;
166
		ZipFile jarFile = null;
167
		try {
167
		try {
168
			if (pluginLocation.isDirectory()) {
168
			if (pluginLocation.isDirectory()) {
169
				File file = new File(pluginLocation, ".options"); //$NON-NLS-1$
169
				File file = new File(pluginLocation, ICoreConstants.OPTIONS_FILENAME);
170
				if (file.exists())
170
				if (file.exists())
171
					stream = new FileInputStream(file);
171
					stream = new FileInputStream(file);
172
			} else {
172
			} else {
173
				jarFile = new ZipFile(pluginLocation, ZipFile.OPEN_READ);
173
				jarFile = new ZipFile(pluginLocation, ZipFile.OPEN_READ);
174
				ZipEntry manifestEntry = jarFile.getEntry(".options"); //$NON-NLS-1$
174
				ZipEntry manifestEntry = jarFile.getEntry(ICoreConstants.OPTIONS_FILENAME);
175
				if (manifestEntry != null) {
175
				if (manifestEntry != null) {
176
					stream = jarFile.getInputStream(manifestEntry);
176
					stream = jarFile.getInputStream(manifestEntry);
177
				}
177
				}
(-)src/org/eclipse/pde/internal/core/WorkspaceFeatureModelManager.java (-10 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2006, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2006, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 11-24 Link Here
11
package org.eclipse.pde.internal.core;
11
package org.eclipse.pde.internal.core;
12
12
13
import java.util.HashMap;
13
import java.util.HashMap;
14
14
import org.eclipse.core.resources.*;
15
import org.eclipse.core.resources.IFile;
16
import org.eclipse.core.resources.IProject;
17
import org.eclipse.core.resources.IResourceChangeEvent;
18
import org.eclipse.core.resources.IResourceDelta;
19
import org.eclipse.pde.core.IModelProviderEvent;
15
import org.eclipse.pde.core.IModelProviderEvent;
20
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
16
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
21
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
17
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
18
import org.eclipse.pde.internal.core.project.PDEProject;
22
19
23
public class WorkspaceFeatureModelManager extends WorkspaceModelManager {
20
public class WorkspaceFeatureModelManager extends WorkspaceModelManager {
24
21
Lines 27-34 Link Here
27
	}
24
	}
28
25
29
	protected void createModel(IProject project, boolean notify) {
26
	protected void createModel(IProject project, boolean notify) {
30
		if (project.exists(ICoreConstants.FEATURE_PATH)) {
27
		IFile featureXml = PDEProject.getFeatureXml(project);
31
			WorkspaceFeatureModel model = new WorkspaceFeatureModel(project.getFile(ICoreConstants.FEATURE_PATH));
28
		if (featureXml.exists()) {
29
			WorkspaceFeatureModel model = new WorkspaceFeatureModel(featureXml);
32
			loadModel(model, false);
30
			loadModel(model, false);
33
			if (fModels == null)
31
			if (fModels == null)
34
				fModels = new HashMap();
32
				fModels = new HashMap();
Lines 40-47 Link Here
40
38
41
	protected void handleFileDelta(IResourceDelta delta) {
39
	protected void handleFileDelta(IResourceDelta delta) {
42
		IFile file = (IFile) delta.getResource();
40
		IFile file = (IFile) delta.getResource();
43
		if (file.getProjectRelativePath().equals(ICoreConstants.FEATURE_PATH)) {
41
		IProject project = file.getProject();
44
			IProject project = file.getProject();
42
		IFile featureXml = PDEProject.getFeatureXml(project);
43
		if (file.equals(featureXml)) {
45
			Object model = getModel(project);
44
			Object model = getModel(project);
46
			int kind = delta.getKind();
45
			int kind = delta.getKind();
47
			if (kind == IResourceDelta.REMOVED && model != null) {
46
			if (kind == IResourceDelta.REMOVED && model != null) {
(-)src/org/eclipse/pde/internal/core/WorkspaceModelManager.java (-21 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2003, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2003, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 10-48 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.core;
11
package org.eclipse.pde.internal.core;
12
12
13
import java.io.BufferedInputStream;
13
import java.io.*;
14
import java.io.IOException;
14
import java.util.*;
15
import java.io.InputStream;
15
import org.eclipse.core.resources.*;
16
import java.util.ArrayList;
17
import java.util.Collection;
18
import java.util.Collections;
19
import java.util.HashMap;
20
import java.util.ListIterator;
21
import java.util.Map;
22
23
import org.eclipse.core.resources.IFile;
24
import org.eclipse.core.resources.IFolder;
25
import org.eclipse.core.resources.IProject;
26
import org.eclipse.core.resources.IResource;
27
import org.eclipse.core.resources.IResourceChangeEvent;
28
import org.eclipse.core.resources.IResourceChangeListener;
29
import org.eclipse.core.resources.IResourceDelta;
30
import org.eclipse.core.resources.IResourceDeltaVisitor;
31
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.CoreException;
32
import org.eclipse.pde.core.IModel;
17
import org.eclipse.pde.core.IModel;
33
import org.eclipse.pde.core.IModelProviderEvent;
18
import org.eclipse.pde.core.IModelProviderEvent;
19
import org.eclipse.pde.internal.core.project.PDEProject;
34
import org.eclipse.team.core.RepositoryProvider;
20
import org.eclipse.team.core.RepositoryProvider;
35
21
36
public abstract class WorkspaceModelManager extends AbstractModelManager implements IResourceChangeListener, IResourceDeltaVisitor {
22
public abstract class WorkspaceModelManager extends AbstractModelManager implements IResourceChangeListener, IResourceDeltaVisitor {
37
23
38
	public static boolean isPluginProject(IProject project) {
24
	public static boolean isPluginProject(IProject project) {
39
		if (project.isOpen())
25
		if (project.isOpen())
40
			return project.exists(ICoreConstants.MANIFEST_PATH) || project.exists(ICoreConstants.PLUGIN_PATH) || project.exists(ICoreConstants.FRAGMENT_PATH);
26
			return PDEProject.getManifest(project).exists() || PDEProject.getPluginXml(project).exists() || PDEProject.getFragmentXml(project).exists();
41
		return false;
27
		return false;
42
	}
28
	}
43
29
44
	public static boolean isFeatureProject(IProject project) {
30
	public static boolean isFeatureProject(IProject project) {
45
		return project.isOpen() && project.exists(ICoreConstants.FEATURE_PATH);
31
		return project.isOpen() && PDEProject.getFeatureXml(project).exists();
46
	}
32
	}
47
33
48
	public static boolean isBinaryProject(IProject project) {
34
	public static boolean isBinaryProject(IProject project) {
(-)src/org/eclipse/pde/internal/core/WorkspacePluginModelManager.java (-17 / +26 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 15-21 Link Here
15
import java.net.URL;
15
import java.net.URL;
16
import java.util.*;
16
import java.util.*;
17
import org.eclipse.core.resources.*;
17
import org.eclipse.core.resources.*;
18
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IPath;
19
import org.eclipse.jdt.core.JavaCore;
20
import org.eclipse.jdt.core.JavaCore;
20
import org.eclipse.pde.core.IModelProviderEvent;
21
import org.eclipse.pde.core.IModelProviderEvent;
21
import org.eclipse.pde.core.plugin.IPluginModelBase;
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
Lines 27-32 Link Here
27
import org.eclipse.pde.internal.core.ischema.ISchema;
28
import org.eclipse.pde.internal.core.ischema.ISchema;
28
import org.eclipse.pde.internal.core.ischema.ISchemaDescriptor;
29
import org.eclipse.pde.internal.core.ischema.ISchemaDescriptor;
29
import org.eclipse.pde.internal.core.plugin.*;
30
import org.eclipse.pde.internal.core.plugin.*;
31
import org.eclipse.pde.internal.core.project.PDEProject;
30
import org.eclipse.pde.internal.core.schema.SchemaDescriptor;
32
import org.eclipse.pde.internal.core.schema.SchemaDescriptor;
31
33
32
public class WorkspacePluginModelManager extends WorkspaceModelManager {
34
public class WorkspacePluginModelManager extends WorkspaceModelManager {
Lines 55-62 Link Here
55
	 */
57
	 */
56
	protected void createModel(IProject project, boolean notify) {
58
	protected void createModel(IProject project, boolean notify) {
57
		IPluginModelBase model = null;
59
		IPluginModelBase model = null;
58
		if (project.exists(ICoreConstants.MANIFEST_PATH)) {
60
		IFile manifest = PDEProject.getManifest(project);
59
			WorkspaceBundleModel bmodel = new WorkspaceBundleModel(project.getFile(ICoreConstants.MANIFEST_PATH));
61
		IFile pluginXml = PDEProject.getPluginXml(project);
62
		IFile fragmentXml = PDEProject.getFragmentXml(project);
63
		if (manifest.exists()) {
64
			WorkspaceBundleModel bmodel = new WorkspaceBundleModel(manifest);
60
			loadModel(bmodel, false);
65
			loadModel(bmodel, false);
61
			if (bmodel.isFragmentModel())
66
			if (bmodel.isFragmentModel())
62
				model = new BundleFragmentModel();
67
				model = new BundleFragmentModel();
Lines 66-72 Link Here
66
			bmodel.setEditable(false);
71
			bmodel.setEditable(false);
67
			((IBundlePluginModelBase) model).setBundleModel(bmodel);
72
			((IBundlePluginModelBase) model).setBundleModel(bmodel);
68
73
69
			IFile efile = project.getFile(bmodel.isFragmentModel() ? ICoreConstants.FRAGMENT_PATH : ICoreConstants.PLUGIN_PATH);
74
			IFile efile = bmodel.isFragmentModel() ? fragmentXml : pluginXml;
70
			if (efile.exists()) {
75
			if (efile.exists()) {
71
				WorkspaceExtensionsModel extModel = new WorkspaceExtensionsModel(efile);
76
				WorkspaceExtensionsModel extModel = new WorkspaceExtensionsModel(efile);
72
				extModel.setEditable(false);
77
				extModel.setEditable(false);
Lines 75-89 Link Here
75
				extModel.setBundleModel((IBundlePluginModelBase) model);
80
				extModel.setBundleModel((IBundlePluginModelBase) model);
76
			}
81
			}
77
82
78
		} else if (project.exists(ICoreConstants.PLUGIN_PATH)) {
83
		} else if (pluginXml.exists()) {
79
			model = new WorkspacePluginModel(project.getFile(ICoreConstants.PLUGIN_PATH), true);
84
			model = new WorkspacePluginModel(pluginXml, true);
80
			loadModel(model, false);
85
			loadModel(model, false);
81
		} else if (project.exists(ICoreConstants.FRAGMENT_PATH)) {
86
		} else if (fragmentXml.exists()) {
82
			model = new WorkspaceFragmentModel(project.getFile(ICoreConstants.FRAGMENT_PATH), true);
87
			model = new WorkspaceFragmentModel(fragmentXml, true);
83
			loadModel(model, false);
88
			loadModel(model, false);
84
		}
89
		}
85
90
86
		if (project.getFile(".options").exists()) //$NON-NLS-1$
91
		if (PDEProject.getOptionsFile(project).exists())
87
			PDECore.getDefault().getTracingOptionsManager().reset();
92
			PDECore.getDefault().getTracingOptionsManager().reset();
88
93
89
		if (model != null) {
94
		if (model != null) {
Lines 100-113 Link Here
100
	 */
105
	 */
101
	protected void handleFileDelta(IResourceDelta delta) {
106
	protected void handleFileDelta(IResourceDelta delta) {
102
		IFile file = (IFile) delta.getResource();
107
		IFile file = (IFile) delta.getResource();
108
		IProject project = file.getProject();
103
		String filename = file.getName();
109
		String filename = file.getName();
104
		if (filename.equals(".options")) { //$NON-NLS-1$
110
		if (file.equals(PDEProject.getOptionsFile(project))) {
105
			PDECore.getDefault().getTracingOptionsManager().reset();
111
			PDECore.getDefault().getTracingOptionsManager().reset();
106
		} else if (filename.endsWith(".properties")) { //$NON-NLS-1$
112
		} else if (filename.endsWith(".properties")) { //$NON-NLS-1$
107
			// change in build.properties should trigger a Classpath Update
113
			// change in build.properties should trigger a Classpath Update
108
			// we therefore fire a notification
114
			// we therefore fire a notification
109
			//TODO this is inefficient.  we could do better.
115
			//TODO this is inefficient.  we could do better.
110
			if (filename.equals("build.properties")) { //$NON-NLS-1$
116
			if (file.equals(PDEProject.getBuildProperties(project))) {
111
				Object model = getModel(file.getProject());
117
				Object model = getModel(file.getProject());
112
				if (model != null)
118
				if (model != null)
113
					addChange(model, IModelProviderEvent.MODELS_CHANGED);
119
					addChange(model, IModelProviderEvent.MODELS_CHANGED);
Lines 127-136 Link Here
127
		} else if (filename.endsWith(".exsd")) { //$NON-NLS-1$
133
		} else if (filename.endsWith(".exsd")) { //$NON-NLS-1$
128
			handleEclipseSchemaDelta(file, delta);
134
			handleEclipseSchemaDelta(file, delta);
129
		} else {
135
		} else {
130
			IPath path = file.getProjectRelativePath();
136
			if (file.equals(PDEProject.getPluginXml(project)) || file.equals(PDEProject.getFragmentXml(project))) {
131
			if (path.equals(ICoreConstants.PLUGIN_PATH) || path.equals(ICoreConstants.FRAGMENT_PATH)) {
132
				handleExtensionFileDelta(file, delta);
137
				handleExtensionFileDelta(file, delta);
133
			} else if (path.equals(ICoreConstants.MANIFEST_PATH)) {
138
			} else if (file.equals(PDEProject.getManifest(project))) {
134
				handleBundleManifestDelta(file, delta);
139
				handleBundleManifestDelta(file, delta);
135
			}
140
			}
136
		}
141
		}
Lines 313-319 Link Here
313
	 */
318
	 */
314
	protected Object removeModel(IProject project) {
319
	protected Object removeModel(IProject project) {
315
		Object model = super.removeModel(project);
320
		Object model = super.removeModel(project);
316
		if (model != null && project.exists(new Path(".options"))) //$NON-NLS-1$
321
		if (model != null && PDEProject.getOptionsFile(project).exists())
317
			PDECore.getDefault().getTracingOptionsManager().reset();
322
			PDECore.getDefault().getTracingOptionsManager().reset();
318
		if (model instanceof IPluginModelBase) {
323
		if (model instanceof IPluginModelBase) {
319
			// PluginModelManager will remove IPluginModelBase form ModelEntry before triggering IModelChangedEvent
324
			// PluginModelManager will remove IPluginModelBase form ModelEntry before triggering IModelChangedEvent
Lines 384-391 Link Here
384
	 * 
389
	 * 
385
	 */
390
	 */
386
	protected boolean isInterestingFolder(IFolder folder) {
391
	protected boolean isInterestingFolder(IFolder folder) {
392
		IContainer root = PDEProject.getBundleRoot(folder.getProject());
393
		if (folder.getProjectRelativePath().isPrefixOf(root.getProjectRelativePath())) {
394
			return true;
395
		}
387
		String folderName = folder.getName();
396
		String folderName = folder.getName();
388
		if (("META-INF".equals(folderName) || "OSGI-INF".equals(folderName) || "schema".equals(folderName)) && folder.getParent() instanceof IProject) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
397
		if (("META-INF".equals(folderName) || "OSGI-INF".equals(folderName) || "schema".equals(folderName)) && folder.getParent().equals(root)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
389
			return true;
398
			return true;
390
		}
399
		}
391
		if ("OSGI-INF/l10n".equals(folder.getProjectRelativePath().toString())) { //$NON-NLS-1$
400
		if ("OSGI-INF/l10n".equals(folder.getProjectRelativePath().toString())) { //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/core/build/BuildEntry.java (-4 / +68 lines)
Lines 11-22 Link Here
11
package org.eclipse.pde.internal.core.build;
11
package org.eclipse.pde.internal.core.build;
12
12
13
import java.io.PrintWriter;
13
import java.io.PrintWriter;
14
import java.util.StringTokenizer;
14
import java.util.*;
15
import java.util.Vector;
15
import org.eclipse.core.resources.*;
16
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.pde.core.IModelChangedEvent;
17
import org.eclipse.pde.core.IModelChangedEvent;
18
import org.eclipse.pde.core.ModelChangedEvent;
18
import org.eclipse.pde.core.ModelChangedEvent;
19
import org.eclipse.pde.core.build.IBuildEntry;
19
import org.eclipse.pde.core.build.IBuildEntry;
20
import org.eclipse.pde.internal.core.project.PDEProject;
20
import org.eclipse.pde.internal.core.util.PropertiesUtil;
21
import org.eclipse.pde.internal.core.util.PropertiesUtil;
21
22
22
public class BuildEntry extends BuildObject implements IBuildEntry {
23
public class BuildEntry extends BuildObject implements IBuildEntry {
Lines 48-57 Link Here
48
	}
49
	}
49
50
50
	void processEntry(String value) {
51
	void processEntry(String value) {
52
		IPath rootPath = getRootPath();
51
		StringTokenizer stok = new StringTokenizer(value, ","); //$NON-NLS-1$
53
		StringTokenizer stok = new StringTokenizer(value, ","); //$NON-NLS-1$
52
		while (stok.hasMoreTokens()) {
54
		while (stok.hasMoreTokens()) {
53
			String token = stok.nextToken();
55
			String token = stok.nextToken();
54
			token = token.trim();
56
			token = token.trim();
57
			token = fromRelative(token, rootPath);
55
			tokens.add(token);
58
			tokens.add(token);
56
		}
59
		}
57
	}
60
	}
Lines 85-91 Link Here
85
	}
88
	}
86
89
87
	public void write(String indent, PrintWriter writer) {
90
	public void write(String indent, PrintWriter writer) {
88
		PropertiesUtil.writeKeyValuePair(indent, name, tokens.elements(), writer);
91
		Enumeration elements = tokens.elements();
92
		IPath rootPath = getRootPath();
93
		if (rootPath != null) {
94
			// translation required for source. and output. entries
95
			Vector vector = new Vector();
96
			while (elements.hasMoreElements()) {
97
				String e = (String) elements.nextElement();
98
				vector.add(toRelative(e, rootPath));
99
			}
100
			elements = vector.elements();
101
		}
102
		PropertiesUtil.writeKeyValuePair(indent, name, elements, writer);
89
	}
103
	}
90
104
91
	public void restoreProperty(String name, Object oldValue, Object newValue) throws CoreException {
105
	public void restoreProperty(String name, Object oldValue, Object newValue) throws CoreException {
Lines 93-96 Link Here
93
			setName(newValue != null ? newValue.toString() : null);
107
			setName(newValue != null ? newValue.toString() : null);
94
		}
108
		}
95
	}
109
	}
110
111
	/**
112
	 * Returns the path that this entries tokens are relative to, or <code>null</code> if none.
113
	 * 
114
	 * @return relative root path, or <code>null</code>
115
	 */
116
	IPath getRootPath() {
117
		if (name.startsWith(IBuildEntry.JAR_PREFIX) || name.startsWith(IBuildEntry.OUTPUT_PREFIX)) {
118
			IResource resource = getModel().getUnderlyingResource();
119
			if (resource != null) {
120
				IProject project = resource.getProject();
121
				if (project != null) {
122
					IContainer root = PDEProject.getBundleRoot(project);
123
					if (root != null && !root.equals(project)) {
124
						// translation required for source. and output. entries
125
						return root.getProjectRelativePath();
126
					}
127
				}
128
			}
129
		}
130
		return null;
131
	}
132
133
	/**
134
	 * Makes the token a bundle root relative path
135
	 * 
136
	 * @param token token
137
	 * @param root bundle root path or <code>null</code>
138
	 * @return bundle relative token
139
	 */
140
	String toRelative(String token, IPath root) {
141
		if (root == null) {
142
			return token;
143
		}
144
		return (new Path(token)).makeRelativeTo(root).toPortableString();
145
	}
146
147
	/**
148
	 * Makes the token a project relative path
149
	 * 
150
	 * @param token token
151
	 * @param root bundle root path or <code>null</code>
152
	 * @return project relative token
153
	 */
154
	String fromRelative(String token, IPath root) {
155
		if (root == null) {
156
			return token;
157
		}
158
		return root.append(new Path(token)).toPortableString();
159
	}
96
}
160
}
(-)src/org/eclipse/pde/internal/core/build/ExternalBuildModel.java (-3 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 14-19 Link Here
14
import java.io.*;
14
import java.io.*;
15
import java.net.URL;
15
import java.net.URL;
16
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.core.runtime.IPath;
17
import org.eclipse.pde.internal.core.ICoreConstants;
17
import org.eclipse.pde.internal.core.PDECore;
18
import org.eclipse.pde.internal.core.PDECore;
18
19
19
public class ExternalBuildModel extends BuildModel {
20
public class ExternalBuildModel extends BuildModel {
Lines 41-47 Link Here
41
			if (file.isFile() && file.getName().endsWith(".jar")) { //$NON-NLS-1$
42
			if (file.isFile() && file.getName().endsWith(".jar")) { //$NON-NLS-1$
42
				url = new URL("jar:file:" + file.getAbsolutePath() + "!/build.properties"); //$NON-NLS-1$ //$NON-NLS-2$
43
				url = new URL("jar:file:" + file.getAbsolutePath() + "!/build.properties"); //$NON-NLS-1$ //$NON-NLS-2$
43
			} else {
44
			} else {
44
				url = new URL("file:" + file.getAbsolutePath() + IPath.SEPARATOR + "build.properties"); //$NON-NLS-1$ //$NON-NLS-2$
45
				url = new URL("file:" + file.getAbsolutePath() + IPath.SEPARATOR + ICoreConstants.BUILD_FILENAME_DESCRIPTOR); //$NON-NLS-1$
45
			}
46
			}
46
			stream = url.openStream();
47
			stream = url.openStream();
47
			load(stream, false);
48
			load(stream, false);
Lines 65-71 Link Here
65
66
66
	private File getLocalFile() {
67
	private File getLocalFile() {
67
		File file = new File(getInstallLocation());
68
		File file = new File(getInstallLocation());
68
		return (file.isFile()) ? file : new File(file, "build.properties"); //$NON-NLS-1$
69
		return (file.isFile()) ? file : new File(file, ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
69
	}
70
	}
70
71
71
	public boolean isInSync() {
72
	public boolean isInSync() {
(-)src/org/eclipse/pde/internal/core/builders/BuildErrorReporter.java (-10 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 33-38 Link Here
33
import org.eclipse.pde.internal.core.*;
33
import org.eclipse.pde.internal.core.*;
34
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
34
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
35
import org.eclipse.pde.internal.core.ibundle.*;
35
import org.eclipse.pde.internal.core.ibundle.*;
36
import org.eclipse.pde.internal.core.project.PDEProject;
36
import org.eclipse.pde.internal.core.text.build.BuildEntry;
37
import org.eclipse.pde.internal.core.text.build.BuildEntry;
37
import org.eclipse.pde.internal.core.text.build.BuildModel;
38
import org.eclipse.pde.internal.core.text.build.BuildModel;
38
import org.eclipse.pde.internal.core.util.CoreUtility;
39
import org.eclipse.pde.internal.core.util.CoreUtility;
Lines 42-48 Link Here
42
public class BuildErrorReporter extends ErrorReporter implements IBuildPropertiesConstants {
43
public class BuildErrorReporter extends ErrorReporter implements IBuildPropertiesConstants {
43
44
44
	private static final String DEF_SOURCE_ENTRY = PROPERTY_SOURCE_PREFIX + '.';
45
	private static final String DEF_SOURCE_ENTRY = PROPERTY_SOURCE_PREFIX + '.';
45
	private static final String[] RESERVED_NAMES = new String[] {"meta-inf", "osgi-inf", "build.properties", "plugin.xml", "plugin.properties"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
46
	private static final String[] RESERVED_NAMES = new String[] {"meta-inf", "osgi-inf", ICoreConstants.BUILD_FILENAME_DESCRIPTOR, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR, "plugin.properties"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
46
	private static final String JAVAC_WARNINGS_ENTRY = PROPERTY_JAVAC_WARNINGS_PREFIX + '.';
47
	private static final String JAVAC_WARNINGS_ENTRY = PROPERTY_JAVAC_WARNINGS_PREFIX + '.';
47
	private static final String ASSERT_IDENTIFIER = "assertIdentifier"; //$NON-NLS-1$
48
	private static final String ASSERT_IDENTIFIER = "assertIdentifier"; //$NON-NLS-1$
48
	private static final String ENUM_IDENTIFIER = "enumIdentifier"; //$NON-NLS-1$
49
	private static final String ENUM_IDENTIFIER = "enumIdentifier"; //$NON-NLS-1$
Lines 405-419 Link Here
405
406
406
	private void validateBinIncludes(IBuildEntry binIncludes) {
407
	private void validateBinIncludes(IBuildEntry binIncludes) {
407
		// make sure we have a manifest entry
408
		// make sure we have a manifest entry
408
		if (fProject.exists(ICoreConstants.MANIFEST_PATH)) {
409
		if (PDEProject.getManifest(fProject).exists()) {
409
			validateBinIncludes(binIncludes, ICoreConstants.MANIFEST_FOLDER_NAME);
410
			validateBinIncludes(binIncludes, ICoreConstants.MANIFEST_FOLDER_NAME);
410
		}
411
		}
411
412
412
		// if we have an OSGI_INF/ directory, let's do some validation
413
		// if we have an OSGI_INF/ directory, let's do some validation
413
		if (fProject.exists(ICoreConstants.OSGI_INF_PATH)) {
414
		IFolder OSGinf = PDEProject.getOSGiInf(fProject);
415
		if (OSGinf.exists()) {
414
			try {
416
			try {
415
				IFolder folder = fProject.getFolder(ICoreConstants.OSGI_INF_PATH);
417
				if (OSGinf.members().length > 0) { // only validate if we have something in it
416
				if (folder.members().length > 0) { // only validate if we have something in it
417
					validateBinIncludes(binIncludes, ICoreConstants.OSGI_INF_FOLDER_NAME);
418
					validateBinIncludes(binIncludes, ICoreConstants.OSGI_INF_FOLDER_NAME);
418
				}
419
				}
419
			} catch (CoreException e) { // do nothing
420
			} catch (CoreException e) { // do nothing
Lines 421-432 Link Here
421
		}
422
		}
422
423
423
		// make sure if we're a fragment, we have a fragment.xml entry
424
		// make sure if we're a fragment, we have a fragment.xml entry
424
		if (fProject.exists(ICoreConstants.FRAGMENT_PATH)) {
425
		if (PDEProject.getFragmentXml(fProject).exists()) {
425
			validateBinIncludes(binIncludes, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR);
426
			validateBinIncludes(binIncludes, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR);
426
		}
427
		}
427
428
428
		// make sure if we're a plugin, we have a plugin.xml entry
429
		// make sure if we're a plug-in, we have a plugin.xml entry
429
		if (fProject.exists(ICoreConstants.PLUGIN_PATH)) {
430
		if (PDEProject.getPluginXml(fProject).exists()) {
430
			validateBinIncludes(binIncludes, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
431
			validateBinIncludes(binIncludes, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
431
		}
432
		}
432
433
Lines 710-716 Link Here
710
			if (startsWithAntVariable(token))
711
			if (startsWithAntVariable(token))
711
				// skip '${x}' variables
712
				// skip '${x}' variables
712
				continue;
713
				continue;
713
			IResource member = fProject.findMember(token);
714
			IResource member = PDEProject.getBundleRoot(fProject).findMember(token);
714
			String message = null;
715
			String message = null;
715
			int fixId = PDEMarkerFactory.NO_RESOLUTION;
716
			int fixId = PDEMarkerFactory.NO_RESOLUTION;
716
			if (member == null) {
717
			if (member == null) {
(-)src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java (-4 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 27-32 Link Here
27
import org.eclipse.pde.core.plugin.*;
27
import org.eclipse.pde.core.plugin.*;
28
import org.eclipse.pde.internal.core.*;
28
import org.eclipse.pde.internal.core.*;
29
import org.eclipse.pde.internal.core.ibundle.*;
29
import org.eclipse.pde.internal.core.ibundle.*;
30
import org.eclipse.pde.internal.core.project.PDEProject;
30
import org.eclipse.pde.internal.core.search.PluginJavaSearchUtil;
31
import org.eclipse.pde.internal.core.search.PluginJavaSearchUtil;
31
import org.eclipse.pde.internal.core.util.*;
32
import org.eclipse.pde.internal.core.util.*;
32
import org.osgi.framework.*;
33
import org.osgi.framework.*;
Lines 170-176 Link Here
170
		IPluginBase base = fModel.getPluginBase();
171
		IPluginBase base = fModel.getPluginBase();
171
		// must check the existence of plugin.xml file instead of using IPluginBase because if the bundle is not a singleton,
172
		// must check the existence of plugin.xml file instead of using IPluginBase because if the bundle is not a singleton,
172
		// it won't be registered with the extension registry and will always return 0 when querying extensions/extension points
173
		// it won't be registered with the extension registry and will always return 0 when querying extensions/extension points
173
		boolean hasExtensions = base != null && fProject.findMember(ICoreConstants.PLUGIN_PATH) != null;
174
		boolean hasExtensions = base != null && PDEProject.getPluginXml(fProject).exists();
174
175
175
		if (hasExtensions) {
176
		if (hasExtensions) {
176
			if (TargetPlatformHelper.getTargetVersion() >= 3.1) {
177
			if (TargetPlatformHelper.getTargetVersion() >= 3.1) {
Lines 218-224 Link Here
218
	private void validateFragmentHost() {
219
	private void validateFragmentHost() {
219
		IHeader header = getHeader(Constants.FRAGMENT_HOST);
220
		IHeader header = getHeader(Constants.FRAGMENT_HOST);
220
		if (header == null) {
221
		if (header == null) {
221
			if (isCheckNoRequiredAttr() && fProject.getFile("fragment.xml").exists()) { //$NON-NLS-1$
222
			if (isCheckNoRequiredAttr() && PDEProject.getFragmentXml(fProject).exists()) {
222
				report(PDECoreMessages.BundleErrorReporter_HostNeeded, 1, CompilerFlags.P_NO_REQUIRED_ATT, PDEMarkerFactory.CAT_FATAL);
223
				report(PDECoreMessages.BundleErrorReporter_HostNeeded, 1, CompilerFlags.P_NO_REQUIRED_ATT, PDEMarkerFactory.CAT_FATAL);
223
			}
224
			}
224
			return;
225
			return;
Lines 1085-1091 Link Here
1085
			location = new String();
1086
			location = new String();
1086
		}
1087
		}
1087
1088
1088
		IResource res = fProject.findMember(location);
1089
		IResource res = PDEProject.getBundleRoot(fProject).findMember(location);
1089
		if (res == null || !(res instanceof IContainer)) {
1090
		if (res == null || !(res instanceof IContainer)) {
1090
			report(PDECoreMessages.BundleErrorReporter_localization_folder_not_exist, header.getLineNumber() + 1, CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_RESOURCE), PDEMarkerFactory.CAT_OTHER);
1091
			report(PDECoreMessages.BundleErrorReporter_localization_folder_not_exist, header.getLineNumber() + 1, CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_RESOURCE), PDEMarkerFactory.CAT_OTHER);
1091
			return;
1092
			return;
(-)src/org/eclipse/pde/internal/core/builders/FeatureConsistencyChecker.java (-5 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-23 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.core.builders;
12
package org.eclipse.pde.internal.core.builders;
13
13
14
import java.util.Locale;
15
import java.util.Map;
14
import java.util.Map;
16
import org.eclipse.core.resources.*;
15
import org.eclipse.core.resources.*;
17
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
18
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.osgi.util.NLS;
19
import org.eclipse.pde.internal.core.*;
18
import org.eclipse.pde.internal.core.*;
20
import org.eclipse.pde.internal.core.natures.PDE;
19
import org.eclipse.pde.internal.core.natures.PDE;
20
import org.eclipse.pde.internal.core.project.PDEProject;
21
import org.osgi.framework.Bundle;
21
import org.osgi.framework.Bundle;
22
22
23
public class FeatureConsistencyChecker extends IncrementalProjectBuilder {
23
public class FeatureConsistencyChecker extends IncrementalProjectBuilder {
Lines 78-84 Link Here
78
	}
78
	}
79
79
80
	private void checkProject(IProgressMonitor monitor) {
80
	private void checkProject(IProgressMonitor monitor) {
81
		IFile file = getProject().getFile("feature.xml"); //$NON-NLS-1$
81
		IFile file = PDEProject.getFeatureXml(getProject());
82
		if (file.exists()) {
82
		if (file.exists()) {
83
			checkFile(file, monitor);
83
			checkFile(file, monitor);
84
		}
84
		}
Lines 97-110 Link Here
97
	}
97
	}
98
98
99
	private boolean isManifestFile(IFile file) {
99
	private boolean isManifestFile(IFile file) {
100
		return file.getParent().equals(file.getProject()) && file.getName().toLowerCase(Locale.ENGLISH).equals("feature.xml"); //$NON-NLS-1$
100
		return file.equals(PDEProject.getFeatureXml(file.getProject()));
101
	}
101
	}
102
102
103
	/* (non-Javadoc)
103
	/* (non-Javadoc)
104
	 * @see org.eclipse.core.resources.IncrementalProjectBuilder#clean(org.eclipse.core.runtime.IProgressMonitor)
104
	 * @see org.eclipse.core.resources.IncrementalProjectBuilder#clean(org.eclipse.core.runtime.IProgressMonitor)
105
	 */
105
	 */
106
	protected void clean(IProgressMonitor monitor) throws CoreException {
106
	protected void clean(IProgressMonitor monitor) throws CoreException {
107
		IFile file = getProject().getFile("feature.xml"); //$NON-NLS-1$
107
		IFile file = PDEProject.getFeatureXml(getProject());
108
		if (file.exists()) {
108
		if (file.exists()) {
109
			SubMonitor localmonitor = SubMonitor.convert(monitor, NLS.bind(PDECoreMessages.FeatureConsistencyChecker_0, file.getName()), 1);
109
			SubMonitor localmonitor = SubMonitor.convert(monitor, NLS.bind(PDECoreMessages.FeatureConsistencyChecker_0, file.getName()), 1);
110
			try {
110
			try {
(-)src/org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker.java (-20 / +22 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 21-26 Link Here
21
import org.eclipse.pde.core.plugin.PluginRegistry;
21
import org.eclipse.pde.core.plugin.PluginRegistry;
22
import org.eclipse.pde.internal.core.*;
22
import org.eclipse.pde.internal.core.*;
23
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
23
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
24
import org.eclipse.pde.internal.core.project.PDEProject;
24
import org.osgi.framework.Bundle;
25
import org.osgi.framework.Bundle;
25
26
26
public class ManifestConsistencyChecker extends IncrementalProjectBuilder {
27
public class ManifestConsistencyChecker extends IncrementalProjectBuilder {
Lines 98-105 Link Here
98
				if (resource.isDerived())
99
				if (resource.isDerived())
99
					return false;
100
					return false;
100
				if (resource.getType() == IResource.FILE) {
101
				if (resource.getType() == IResource.FILE) {
102
					IFile file = (IFile) resource;
103
					IProject project = file.getProject();
101
					String name = resource.getName();
104
					String name = resource.getName();
102
					IPath path = resource.getProjectRelativePath();
103
					if (isLocalizationFile(resource)) {
105
					if (isLocalizationFile(resource)) {
104
						type |= MANIFEST | EXTENSIONS;
106
						type |= MANIFEST | EXTENSIONS;
105
						if (DEBUG) {
107
						if (DEBUG) {
Lines 107-127 Link Here
107
							System.out.print(delta.getResource().getProjectRelativePath().toString());
109
							System.out.print(delta.getResource().getProjectRelativePath().toString());
108
							System.out.println(" - changed"); //$NON-NLS-1$
110
							System.out.println(" - changed"); //$NON-NLS-1$
109
						}
111
						}
110
					} else if (path.equals(ICoreConstants.MANIFEST_PATH)) {
112
					} else if (file.equals(PDEProject.getManifest(project))) {
111
						type |= MANIFEST | EXTENSIONS | BUILD;
113
						type |= MANIFEST | EXTENSIONS | BUILD;
112
						if (DEBUG) {
114
						if (DEBUG) {
113
							System.out.print("Needs to rebuild project [" + getProject().getName() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
115
							System.out.print("Needs to rebuild project [" + getProject().getName() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
114
							System.out.print(delta.getResource().getProjectRelativePath().toString());
116
							System.out.print(delta.getResource().getProjectRelativePath().toString());
115
							System.out.println(" - changed"); //$NON-NLS-1$
117
							System.out.println(" - changed"); //$NON-NLS-1$
116
						}
118
						}
117
					} else if (name.endsWith(".exsd") || path.equals(ICoreConstants.PLUGIN_PATH) || path.equals(ICoreConstants.FRAGMENT_PATH)) { //$NON-NLS-1$
119
					} else if (name.endsWith(".exsd") || file.equals(PDEProject.getPluginXml(project)) || file.equals(PDEProject.getFragmentXml(project))) { //$NON-NLS-1$
118
						type |= EXTENSIONS;
120
						type |= EXTENSIONS;
119
						if (DEBUG) {
121
						if (DEBUG) {
120
							System.out.print("Needs to rebuild extensions in project [" + getProject().getName() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
122
							System.out.print("Needs to rebuild extensions in project [" + getProject().getName() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
121
							System.out.print(delta.getResource().getProjectRelativePath().toString());
123
							System.out.print(delta.getResource().getProjectRelativePath().toString());
122
							System.out.println(" - changed"); //$NON-NLS-1$
124
							System.out.println(" - changed"); //$NON-NLS-1$
123
						}
125
						}
124
					} else if (path.equals(ICoreConstants.BUILD_PROPERTIES_PATH)) {
126
					} else if (file.equals(PDEProject.getBuildProperties(project))) {
125
						type |= BUILD;
127
						type |= BUILD;
126
						if (DEBUG) {
128
						if (DEBUG) {
127
							System.out.print("Needs to rebuild build.properties in project [" + getProject().getName() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
129
							System.out.print("Needs to rebuild build.properties in project [" + getProject().getName() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
Lines 225-238 Link Here
225
227
226
		if ((type & MANIFEST | EXTENSIONS) != 0) {
228
		if ((type & MANIFEST | EXTENSIONS) != 0) {
227
			IProject project = getProject();
229
			IProject project = getProject();
228
			IFile file = project.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
230
			IFile file = PDEProject.getPluginXml(project);
229
			if (!file.exists())
231
			if (!file.exists())
230
				file = project.getFile(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR);
232
				file = PDEProject.getFragmentXml(project);
231
233
232
			if (file.exists()) {
234
			if (file.exists()) {
233
				validateFiles(file, type, monitor);
235
				validateFiles(file, type, monitor);
234
			} else if ((type & MANIFEST) != 0) {
236
			} else if ((type & MANIFEST) != 0) {
235
				IFile manifestFile = project.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
237
				IFile manifestFile = PDEProject.getManifest(project);
236
				if (manifestFile.exists())
238
				if (manifestFile.exists())
237
					validateManifestFile(manifestFile, new SubProgressMonitor(monitor, 1));
239
					validateManifestFile(manifestFile, new SubProgressMonitor(monitor, 1));
238
			}
240
			}
Lines 288-294 Link Here
288
		String message = NLS.bind(PDECoreMessages.Builders_verifying, file.getFullPath().toString());
290
		String message = NLS.bind(PDECoreMessages.Builders_verifying, file.getFullPath().toString());
289
		monitor.subTask(message);
291
		monitor.subTask(message);
290
292
291
		IFile bundleManifest = file.getProject().getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
293
		IFile bundleManifest = PDEProject.getManifest(getProject());
292
		XMLErrorReporter reporter = null;
294
		XMLErrorReporter reporter = null;
293
		BundleErrorReporter bundleReporter = null;
295
		BundleErrorReporter bundleReporter = null;
294
		if (bundleManifest.exists()) {
296
		if (bundleManifest.exists()) {
Lines 297-305 Link Here
297
			if ((type & MANIFEST) != 0)
299
			if ((type & MANIFEST) != 0)
298
				bundleReporter = new BundleErrorReporter(bundleManifest);
300
				bundleReporter = new BundleErrorReporter(bundleManifest);
299
		} else if ((type & MANIFEST) != 0 || (type & EXTENSIONS) != 0) {
301
		} else if ((type & MANIFEST) != 0 || (type & EXTENSIONS) != 0) {
300
			if (file.getName().equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)) {
302
			if (file.equals(PDEProject.getPluginXml(getProject()))) {
301
				reporter = new PluginErrorReporter(file);
303
				reporter = new PluginErrorReporter(file);
302
			} else if (file.getName().equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)) {
304
			} else if (file.equals(PDEProject.getFragmentXml(getProject()))) {
303
				reporter = new FragmentErrorReporter(file);
305
				reporter = new FragmentErrorReporter(file);
304
			}
306
			}
305
		}
307
		}
Lines 319-325 Link Here
319
		if (monitor.isCanceled())
321
		if (monitor.isCanceled())
320
			return;
322
			return;
321
		IProject project = getProject();
323
		IProject project = getProject();
322
		IFile file = project.getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
324
		IFile file = PDEProject.getBuildProperties(project);
323
		if (file.exists()) {
325
		if (file.exists()) {
324
			monitor.subTask(PDECoreMessages.ManifestConsistencyChecker_buildPropertiesSubtask);
326
			monitor.subTask(PDECoreMessages.ManifestConsistencyChecker_buildPropertiesSubtask);
325
			BuildErrorReporter ber = new BuildErrorReporter(file);
327
			BuildErrorReporter ber = new BuildErrorReporter(file);
Lines 329-335 Link Here
329
331
330
	// Will place a marker on the project if the build.properties does not exist
332
	// Will place a marker on the project if the build.properties does not exist
331
	private void validateBuildPropertiesExists(IProject project) {
333
	private void validateBuildPropertiesExists(IProject project) {
332
		IFile file = project.getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
334
		IFile file = PDEProject.getBuildProperties(project);
333
		if (!file.exists()) {
335
		if (!file.exists()) {
334
			int severity = CompilerFlags.getFlag(project, CompilerFlags.P_BUILD);
336
			int severity = CompilerFlags.getFlag(project, CompilerFlags.P_BUILD);
335
			if (severity == CompilerFlags.IGNORE)
337
			if (severity == CompilerFlags.IGNORE)
Lines 346-359 Link Here
346
348
347
	// Will place a marker on either the project (if META-INF exist but not a MANIFEST.MF) or on the MANIFEST.MF file with incorrect casing.
349
	// Will place a marker on either the project (if META-INF exist but not a MANIFEST.MF) or on the MANIFEST.MF file with incorrect casing.
348
	private void validateManifestCasing(IProject project) {
350
	private void validateManifestCasing(IProject project) {
349
		IFolder manifestFolder = project.getFolder("META-INF"); //$NON-NLS-1$
351
		IFolder manifestFolder = PDEProject.getMetaInf(project);
350
		if (manifestFolder.exists()) {
352
		if (manifestFolder.exists()) {
351
			try {
353
			try {
352
				manifestFolder.deleteMarkers(PDEMarkerFactory.MARKER_ID, false, IResource.DEPTH_ONE);
354
				manifestFolder.deleteMarkers(PDEMarkerFactory.MARKER_ID, false, IResource.DEPTH_ONE);
353
			} catch (CoreException e1) {
355
			} catch (CoreException e1) {
354
			}
356
			}
355
			// exit if the proper casing exists (should be majority of the time)
357
			// exit if the proper casing exists (should be majority of the time)
356
			if (manifestFolder.getFile("MANIFEST.MF").exists()) //$NON-NLS-1$
358
			if (PDEProject.getManifest(project).exists())
357
				return;
359
				return;
358
360
359
			IPath location = manifestFolder.getLocation();
361
			IPath location = manifestFolder.getLocation();
Lines 389-395 Link Here
389
	class ManifestFilter implements FilenameFilter {
391
	class ManifestFilter implements FilenameFilter {
390
392
391
		public boolean accept(File dir, String name) {
393
		public boolean accept(File dir, String name) {
392
			return (name.equalsIgnoreCase("MANIFEST.MF")); //$NON-NLS-1$
394
			return (name.equalsIgnoreCase(ICoreConstants.MANIFEST_FILENAME));
393
		}
395
		}
394
	}
396
	}
395
397
Lines 402-415 Link Here
402
			// clean problem markers on the project
404
			// clean problem markers on the project
403
			cleanProblems(getProject(), IResource.DEPTH_ZERO);
405
			cleanProblems(getProject(), IResource.DEPTH_ZERO);
404
			// clean the manifest directory (since errors can be created on manifest files with incorrect casing)
406
			// clean the manifest directory (since errors can be created on manifest files with incorrect casing)
405
			IFile manifestFile = getProject().getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
407
			IFile manifestFile = PDEProject.getManifest(getProject());
406
			cleanProblems(manifestFile.getParent(), IResource.DEPTH_ONE);
408
			cleanProblems(manifestFile.getParent(), IResource.DEPTH_ONE);
407
			// clean plug-in XML file
409
			// clean plug-in XML file
408
			cleanProblems(getProject().getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR), IResource.DEPTH_ZERO);
410
			cleanProblems(PDEProject.getPluginXml(getProject()), IResource.DEPTH_ZERO);
409
			// clean fragment XML file
411
			// clean fragment XML file
410
			cleanProblems(getProject().getFile(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR), IResource.DEPTH_ZERO);
412
			cleanProblems(PDEProject.getFragmentXml(getProject()), IResource.DEPTH_ZERO);
411
			// clean build properties
413
			// clean build properties
412
			cleanProblems(getProject().getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR), IResource.DEPTH_ZERO);
414
			cleanProblems(PDEProject.getBuildProperties(getProject()), IResource.DEPTH_ZERO);
413
			localmonitor.worked(1);
415
			localmonitor.worked(1);
414
		} finally {
416
		} finally {
415
			localmonitor.done();
417
			localmonitor.done();
(-)src/org/eclipse/pde/internal/core/bundle/WorkspaceBundlePluginModelBase.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 77-83 Link Here
77
	public IBundleModel getBundleModel() {
77
	public IBundleModel getBundleModel() {
78
		if (fBundleModel == null) {
78
		if (fBundleModel == null) {
79
			IFile file = (IFile) getUnderlyingResource();
79
			IFile file = (IFile) getUnderlyingResource();
80
			fBundleModel = new WorkspaceBundleModel((IFile) getUnderlyingResource());
80
			fBundleModel = new WorkspaceBundleModel(file);
81
			if (file.exists()) {
81
			if (file.exists()) {
82
				try {
82
				try {
83
					fBundleModel.load();
83
					fBundleModel.load();
(-)src/org/eclipse/pde/internal/core/converter/PDEPluginConverter.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2003, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2003, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 18-24 Link Here
18
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IProgressMonitor;
19
import org.eclipse.osgi.service.pluginconversion.PluginConversionException;
19
import org.eclipse.osgi.service.pluginconversion.PluginConversionException;
20
import org.eclipse.osgi.util.ManifestElement;
20
import org.eclipse.osgi.util.ManifestElement;
21
import org.eclipse.pde.internal.core.ICoreConstants;
21
import org.eclipse.pde.internal.core.project.PDEProject;
22
import org.osgi.framework.BundleException;
22
import org.osgi.framework.BundleException;
23
23
24
public class PDEPluginConverter {
24
public class PDEPluginConverter {
Lines 29-35 Link Here
29
29
30
	public static void convertToOSGIFormat(IProject project, String target, Dictionary dictionary, HashMap newProps, IProgressMonitor monitor) throws CoreException {
30
	public static void convertToOSGIFormat(IProject project, String target, Dictionary dictionary, HashMap newProps, IProgressMonitor monitor) throws CoreException {
31
		try {
31
		try {
32
			File outputFile = new File(project.getLocation().append(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR).toOSString());
32
			File outputFile = new File(PDEProject.getManifest(project).getLocation().toOSString());
33
			File inputFile = new File(project.getLocation().toOSString());
33
			File inputFile = new File(project.getLocation().toOSString());
34
			PluginConverter converter = PluginConverter.getDefault();
34
			PluginConverter converter = PluginConverter.getDefault();
35
			converter.convertManifest(inputFile, outputFile, false, target, true, dictionary);
35
			converter.convertManifest(inputFile, outputFile, false, target, true, dictionary);
(-)src/org/eclipse/pde/internal/core/converter/PluginConverter.java (-11 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2003, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2003, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 26-31 Link Here
26
import org.eclipse.pde.internal.core.build.Build;
26
import org.eclipse.pde.internal.core.build.Build;
27
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
27
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
28
import org.eclipse.pde.internal.core.converter.PluginConverterParser.PluginInfo;
28
import org.eclipse.pde.internal.core.converter.PluginConverterParser.PluginInfo;
29
import org.eclipse.pde.internal.core.project.PDEProject;
29
import org.osgi.framework.*;
30
import org.osgi.framework.*;
30
31
31
public class PluginConverter {
32
public class PluginConverter {
Lines 41-48 Link Here
41
	/** bundle manifest type jared bundle */
42
	/** bundle manifest type jared bundle */
42
	static public final byte MANIFEST_TYPE_JAR = 0x08;
43
	static public final byte MANIFEST_TYPE_JAR = 0x08;
43
44
44
	public static final String OSGI_BUNDLE_MANIFEST = "META-INF/MANIFEST.MF"; //$NON-NLS-1$
45
46
	private static final String SEMICOLON = "; "; //$NON-NLS-1$
45
	private static final String SEMICOLON = "; "; //$NON-NLS-1$
47
	private static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
46
	private static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
48
	public static final String LIST_SEPARATOR = ",\n "; //$NON-NLS-1$
47
	public static final String LIST_SEPARATOR = ",\n "; //$NON-NLS-1$
Lines 60-71 Link Here
60
	private static final String MANIFEST_VERSION = "Manifest-Version"; //$NON-NLS-1$
59
	private static final String MANIFEST_VERSION = "Manifest-Version"; //$NON-NLS-1$
61
	private static final String PLUGIN_PROPERTIES_FILENAME = "plugin"; //$NON-NLS-1$
60
	private static final String PLUGIN_PROPERTIES_FILENAME = "plugin"; //$NON-NLS-1$
62
	private static PluginConverter instance;
61
	private static PluginConverter instance;
63
	static public final String FRAGMENT_MANIFEST = "fragment.xml"; //$NON-NLS-1$
64
	static public final String GENERATED_FROM = "Generated-from"; //$NON-NLS-1$
62
	static public final String GENERATED_FROM = "Generated-from"; //$NON-NLS-1$
65
	static public final String MANIFEST_TYPE_ATTRIBUTE = "type"; //$NON-NLS-1$
63
	static public final String MANIFEST_TYPE_ATTRIBUTE = "type"; //$NON-NLS-1$
66
	protected static final String PI_BOOT = "org.eclipse.core.boot"; //$NON-NLS-1$
64
	protected static final String PI_BOOT = "org.eclipse.core.boot"; //$NON-NLS-1$
67
	protected static final String PI_RUNTIME_COMPATIBILITY = "org.eclipse.core.runtime.compatibility"; //$NON-NLS-1$
65
	protected static final String PI_RUNTIME_COMPATIBILITY = "org.eclipse.core.runtime.compatibility"; //$NON-NLS-1$
68
	static public final String PLUGIN_MANIFEST = "plugin.xml"; //$NON-NLS-1$
69
	private static final String COMPATIBILITY_ACTIVATOR = "org.eclipse.core.internal.compatibility.PluginActivator"; //$NON-NLS-1$
66
	private static final String COMPATIBILITY_ACTIVATOR = "org.eclipse.core.internal.compatibility.PluginActivator"; //$NON-NLS-1$
70
	private static final String SOURCE_PREFIX = "source."; //$NON-NLS-1$
67
	private static final String SOURCE_PREFIX = "source."; //$NON-NLS-1$
71
68
Lines 119-125 Link Here
119
			//this can't happen since we are building the urls ourselves from a file
116
			//this can't happen since we are building the urls ourselves from a file
120
		}
117
		}
121
		try {
118
		try {
122
			xmlFileLocation = new URL(baseURL, PLUGIN_MANIFEST);
119
			xmlFileLocation = new URL(baseURL, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
123
			stream = xmlFileLocation.openStream();
120
			stream = xmlFileLocation.openStream();
124
			manifestType |= MANIFEST_TYPE_PLUGIN;
121
			manifestType |= MANIFEST_TYPE_PLUGIN;
125
			return xmlFileLocation;
122
			return xmlFileLocation;
Lines 136-142 Link Here
136
			}
133
			}
137
		}
134
		}
138
		try {
135
		try {
139
			xmlFileLocation = new URL(baseURL, FRAGMENT_MANIFEST);
136
			xmlFileLocation = new URL(baseURL, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR);
140
			stream = xmlFileLocation.openStream();
137
			stream = xmlFileLocation.openStream();
141
			manifestType |= MANIFEST_TYPE_FRAGMENT;
138
			manifestType |= MANIFEST_TYPE_FRAGMENT;
142
			return xmlFileLocation;
139
			return xmlFileLocation;
Lines 376-382 Link Here
376
	}
373
	}
377
374
378
	public Set getExports(IProject proj, Map libs) {
375
	public Set getExports(IProject proj, Map libs) {
379
		IFile buildProperties = proj.getFile("build.properties"); //$NON-NLS-1$
376
		IFile buildProperties = PDEProject.getBuildProperties(proj);
380
		IBuild build = null;
377
		IBuild build = null;
381
		if (buildProperties != null) {
378
		if (buildProperties != null) {
382
			WorkspaceBuildModel buildModel = new WorkspaceBuildModel(buildProperties);
379
			WorkspaceBuildModel buildModel = new WorkspaceBuildModel(buildProperties);
Lines 511-521 Link Here
511
		if ((manifestType & MANIFEST_TYPE_JAR) != 0)
508
		if ((manifestType & MANIFEST_TYPE_JAR) != 0)
512
			return pluginLocation.lastModified();
509
			return pluginLocation.lastModified();
513
		else if ((manifestType & MANIFEST_TYPE_PLUGIN) != 0)
510
		else if ((manifestType & MANIFEST_TYPE_PLUGIN) != 0)
514
			return new File(pluginLocation, PLUGIN_MANIFEST).lastModified();
511
			return new File(pluginLocation, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR).lastModified();
515
		else if ((manifestType & MANIFEST_TYPE_FRAGMENT) != 0)
512
		else if ((manifestType & MANIFEST_TYPE_FRAGMENT) != 0)
516
			return new File(pluginLocation, FRAGMENT_MANIFEST).lastModified();
513
			return new File(pluginLocation, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR).lastModified();
517
		else if ((manifestType & MANIFEST_TYPE_BUNDLE) != 0)
514
		else if ((manifestType & MANIFEST_TYPE_BUNDLE) != 0)
518
			return new File(pluginLocation, OSGI_BUNDLE_MANIFEST).lastModified();
515
			return new File(pluginLocation, ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR).lastModified();
519
		return -1;
516
		return -1;
520
	}
517
	}
521
518
(-)src/org/eclipse/pde/internal/core/exports/FeatureBasedExportOperation.java (-124 / +123 lines)
Lines 1-124 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.core.exports;
11
package org.eclipse.pde.internal.core.exports;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.lang.reflect.InvocationTargetException;
15
import java.lang.reflect.InvocationTargetException;
16
import java.util.*;
16
import java.util.*;
17
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.osgi.service.resolver.BundleDescription;
18
import org.eclipse.osgi.service.resolver.BundleDescription;
19
import org.eclipse.pde.core.IModel;
19
import org.eclipse.pde.core.IModel;
20
import org.eclipse.pde.core.plugin.IPluginModelBase;
20
import org.eclipse.pde.core.plugin.IPluginModelBase;
21
import org.eclipse.pde.core.plugin.TargetPlatform;
21
import org.eclipse.pde.core.plugin.TargetPlatform;
22
import org.eclipse.pde.internal.core.PDECore;
22
import org.eclipse.pde.internal.core.*;
23
import org.eclipse.pde.internal.core.PDECoreMessages;
23
import org.eclipse.pde.internal.core.ifeature.IFeature;
24
import org.eclipse.pde.internal.core.ifeature.IFeature;
24
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
25
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
25
26
26
public abstract class FeatureBasedExportOperation extends FeatureExportOperation {
27
public abstract class FeatureBasedExportOperation extends FeatureExportOperation {
27
28
28
	protected String fFeatureLocation;
29
	protected String fFeatureLocation;
29
30
30
	public FeatureBasedExportOperation(FeatureExportInfo info, String name) {
31
	public FeatureBasedExportOperation(FeatureExportInfo info, String name) {
31
		super(info, name);
32
		super(info, name);
32
	}
33
	}
33
34
34
	/* (non-Javadoc)
35
	/* (non-Javadoc)
35
	 * @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#run(org.eclipse.core.runtime.IProgressMonitor)
36
	 * @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#run(org.eclipse.core.runtime.IProgressMonitor)
36
	 */
37
	 */
37
	protected IStatus run(IProgressMonitor monitor) {
38
	protected IStatus run(IProgressMonitor monitor) {
38
		try {
39
		try {
39
			createDestination();
40
			createDestination();
40
			monitor.beginTask("Exporting...", 33); //$NON-NLS-1$
41
			monitor.beginTask("Exporting...", 33); //$NON-NLS-1$
41
			// create a feature to contain all plug-ins
42
			// create a feature to contain all plug-ins
42
			String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$
43
			String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$
43
			fFeatureLocation = fBuildTempLocation + File.separator + featureID;
44
			fFeatureLocation = fBuildTempLocation + File.separator + featureID;
44
			String[][] config = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}};
45
			String[][] config = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}};
45
			createFeature(featureID, fFeatureLocation, config, false);
46
			createFeature(featureID, fFeatureLocation, config, false);
46
			createBuildPropertiesFile(fFeatureLocation);
47
			createBuildPropertiesFile(fFeatureLocation);
47
			if (fInfo.useJarFormat)
48
			if (fInfo.useJarFormat)
48
				createPostProcessingFiles();
49
				createPostProcessingFiles();
49
			IStatus status = testBuildWorkspaceBeforeExport(new SubProgressMonitor(monitor, 10));
50
			IStatus status = testBuildWorkspaceBeforeExport(new SubProgressMonitor(monitor, 10));
50
			doExport(featureID, null, fFeatureLocation, config, new SubProgressMonitor(monitor, 20));
51
			doExport(featureID, null, fFeatureLocation, config, new SubProgressMonitor(monitor, 20));
51
			if (monitor.isCanceled()) {
52
			if (monitor.isCanceled()) {
52
				return Status.CANCEL_STATUS;
53
				return Status.CANCEL_STATUS;
53
			}
54
			}
54
			return status;
55
			return status;
55
		} catch (IOException e) {
56
		} catch (IOException e) {
56
			return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e);
57
			return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e);
57
		} catch (CoreException e) {
58
		} catch (CoreException e) {
58
			return e.getStatus();
59
			return e.getStatus();
59
		} catch (InvocationTargetException e) {
60
		} catch (InvocationTargetException e) {
60
			return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException());
61
			return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException());
61
		} finally {
62
		} finally {
62
			for (int i = 0; i < fInfo.items.length; i++) {
63
			for (int i = 0; i < fInfo.items.length; i++) {
63
				if (fInfo.items[i] instanceof IModel)
64
				if (fInfo.items[i] instanceof IModel)
64
					try {
65
					try {
65
						deleteBuildFiles(fInfo.items[i]);
66
						deleteBuildFiles(fInfo.items[i]);
66
					} catch (CoreException e) {
67
					} catch (CoreException e) {
67
						PDECore.log(e);
68
						PDECore.log(e);
68
					}
69
					}
69
			}
70
			}
70
			cleanup(null, new SubProgressMonitor(monitor, 3));
71
			cleanup(null, new SubProgressMonitor(monitor, 3));
71
			monitor.done();
72
			monitor.done();
72
		}
73
		}
73
	}
74
	}
74
75
75
	protected abstract void createPostProcessingFiles();
76
	protected abstract void createPostProcessingFiles();
76
77
77
	protected String[] getPaths() {
78
	protected String[] getPaths() {
78
		String[] paths = super.getPaths();
79
		String[] paths = super.getPaths();
79
		String[] all = new String[paths.length + 1];
80
		String[] all = new String[paths.length + 1];
80
		all[0] = fFeatureLocation + File.separator + ICoreConstants.FEATURE_FILENAME_DESCRIPTOR;
81
		all[0] = fFeatureLocation + File.separator + "feature.xml"; //$NON-NLS-1$
81
		System.arraycopy(paths, 0, all, 1, paths.length);
82
		System.arraycopy(paths, 0, all, 1, paths.length);
82
		return all;
83
		return all;
83
	}
84
	}
84
85
85
	private void createBuildPropertiesFile(String featureLocation) {
86
	private void createBuildPropertiesFile(String featureLocation) {
86
		File file = new File(featureLocation);
87
		File file = new File(featureLocation);
87
		if (!file.exists() || !file.isDirectory())
88
		if (!file.exists() || !file.isDirectory())
88
			file.mkdirs();
89
			file.mkdirs();
89
		Properties prop = new Properties();
90
		Properties prop = new Properties();
90
		prop.put("pde", "marker"); //$NON-NLS-1$ //$NON-NLS-2$
91
		prop.put("pde", "marker"); //$NON-NLS-1$ //$NON-NLS-2$
91
92
92
		if (fInfo.exportSource && fInfo.exportSourceBundle) {
93
		if (fInfo.exportSource && fInfo.exportSourceBundle) {
93
			prop.put("individualSourceBundles", "true"); //$NON-NLS-1$ //$NON-NLS-2$
94
			prop.put("individualSourceBundles", "true"); //$NON-NLS-1$ //$NON-NLS-2$
94
			Dictionary environment = new Hashtable(4);
95
			Dictionary environment = new Hashtable(4);
95
			environment.put("osgi.os", TargetPlatform.getOS()); //$NON-NLS-1$
96
			environment.put("osgi.os", TargetPlatform.getOS()); //$NON-NLS-1$
96
			environment.put("osgi.ws", TargetPlatform.getWS()); //$NON-NLS-1$
97
			environment.put("osgi.ws", TargetPlatform.getWS()); //$NON-NLS-1$
97
			environment.put("osgi.arch", TargetPlatform.getOSArch()); //$NON-NLS-1$
98
			environment.put("osgi.arch", TargetPlatform.getOSArch()); //$NON-NLS-1$
98
			environment.put("osgi.nl", TargetPlatform.getNL()); //$NON-NLS-1$
99
			environment.put("osgi.nl", TargetPlatform.getNL()); //$NON-NLS-1$
99
100
100
			for (int i = 0; i < fInfo.items.length; i++) {
101
			for (int i = 0; i < fInfo.items.length; i++) {
101
				if (fInfo.items[i] instanceof IFeatureModel) {
102
				if (fInfo.items[i] instanceof IFeatureModel) {
102
					IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature();
103
					IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature();
103
					prop.put("generate.feature@" + feature.getId() + ".source", feature.getId()); //$NON-NLS-1$ //$NON-NLS-2$
104
					prop.put("generate.feature@" + feature.getId() + ".source", feature.getId()); //$NON-NLS-1$ //$NON-NLS-2$
104
				} else {
105
				} else {
105
					BundleDescription bundle = null;
106
					BundleDescription bundle = null;
106
					if (fInfo.items[i] instanceof IPluginModelBase) {
107
					if (fInfo.items[i] instanceof IPluginModelBase) {
107
						bundle = ((IPluginModelBase) fInfo.items[i]).getBundleDescription();
108
						bundle = ((IPluginModelBase) fInfo.items[i]).getBundleDescription();
108
					}
109
					}
109
					if (bundle == null) {
110
					if (bundle == null) {
110
						if (fInfo.items[i] instanceof BundleDescription)
111
						if (fInfo.items[i] instanceof BundleDescription)
111
							bundle = (BundleDescription) fInfo.items[i];
112
							bundle = (BundleDescription) fInfo.items[i];
112
					}
113
					}
113
					if (bundle == null)
114
					if (bundle == null)
114
						continue;
115
						continue;
115
					if (shouldAddPlugin(bundle, environment)) {
116
					if (shouldAddPlugin(bundle, environment)) {
116
						prop.put("generate.plugin@" + bundle.getSymbolicName() + ".source", bundle.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$
117
						prop.put("generate.plugin@" + bundle.getSymbolicName() + ".source", bundle.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$
117
					}
118
					}
118
				}
119
				}
119
			}
120
			}
120
		}
121
		}
121
		save(new File(file, ICoreConstants.BUILD_FILENAME_DESCRIPTOR), prop, "Marker File"); //$NON-NLS-1$
122
		save(new File(file, "build.properties"), prop, "Marker File"); //$NON-NLS-1$ //$NON-NLS-2$
122
	}
123
	}
123
}
124
}
(-)src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java (-6 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 38-43 Link Here
38
import org.eclipse.pde.internal.core.feature.ExternalFeatureModel;
38
import org.eclipse.pde.internal.core.feature.ExternalFeatureModel;
39
import org.eclipse.pde.internal.core.feature.FeatureChild;
39
import org.eclipse.pde.internal.core.feature.FeatureChild;
40
import org.eclipse.pde.internal.core.ifeature.*;
40
import org.eclipse.pde.internal.core.ifeature.*;
41
import org.eclipse.pde.internal.core.project.PDEProject;
41
import org.eclipse.pde.internal.core.util.CoreUtility;
42
import org.eclipse.pde.internal.core.util.CoreUtility;
42
import org.osgi.framework.InvalidSyntaxException;
43
import org.osgi.framework.InvalidSyntaxException;
43
import org.w3c.dom.*;
44
import org.w3c.dom.*;
Lines 93-99 Link Here
93
				model.setInstallLocation(fFeatureLocation);
94
				model.setInstallLocation(fFeatureLocation);
94
				InputStream stream = null;
95
				InputStream stream = null;
95
96
96
				stream = new BufferedInputStream(new FileInputStream(new File(fFeatureLocation + File.separator + "feature.xml"))); //$NON-NLS-1$
97
				stream = new BufferedInputStream(new FileInputStream(new File(fFeatureLocation + File.separator + ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)));
97
				model.load(stream, true);
98
				model.load(stream, true);
98
				if (stream != null) {
99
				if (stream != null) {
99
					stream.close();
100
					stream.close();
Lines 736-742 Link Here
736
737
737
	protected boolean isCustomBuild(IModel model) throws CoreException {
738
	protected boolean isCustomBuild(IModel model) throws CoreException {
738
		IBuildModel buildModel = null;
739
		IBuildModel buildModel = null;
739
		IFile buildFile = model.getUnderlyingResource().getProject().getFile("build.properties"); //$NON-NLS-1$
740
		IFile buildFile = PDEProject.getBuildProperties(model.getUnderlyingResource().getProject());
740
		if (buildFile.exists()) {
741
		if (buildFile.exists()) {
741
			buildModel = new WorkspaceBuildModel(buildFile);
742
			buildModel = new WorkspaceBuildModel(buildFile);
742
			buildModel.load();
743
			buildModel.load();
Lines 900-907 Link Here
900
			if (!file.exists() || !file.isDirectory())
901
			if (!file.exists() || !file.isDirectory())
901
				file.mkdirs();
902
				file.mkdirs();
902
903
903
			save(new File(file, "build.properties"), prop, "Marker File"); //$NON-NLS-1$ //$NON-NLS-2$
904
			save(new File(file, ICoreConstants.BUILD_FILENAME_DESCRIPTOR), prop, "Marker File"); //$NON-NLS-1$ 
904
			XMLPrintHandler.writeFile(doc, new File(file, "feature.xml")); //$NON-NLS-1$
905
			XMLPrintHandler.writeFile(doc, new File(file, ICoreConstants.FEATURE_FILENAME_DESCRIPTOR));
905
		} catch (DOMException e1) {
906
		} catch (DOMException e1) {
906
		} catch (FactoryConfigurationError e1) {
907
		} catch (FactoryConfigurationError e1) {
907
		} catch (ParserConfigurationException e1) {
908
		} catch (ParserConfigurationException e1) {
Lines 1066-1072 Link Here
1066
					}
1067
					}
1067
				}
1068
				}
1068
			}
1069
			}
1069
			XMLPrintHandler.writeFile(doc, new File(file, "feature.xml")); //$NON-NLS-1$
1070
			XMLPrintHandler.writeFile(doc, new File(file, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR));
1070
		} catch (DOMException e1) {
1071
		} catch (DOMException e1) {
1071
		} catch (FactoryConfigurationError e1) {
1072
		} catch (FactoryConfigurationError e1) {
1072
		} catch (ParserConfigurationException e1) {
1073
		} catch (ParserConfigurationException e1) {
(-)src/org/eclipse/pde/internal/core/exports/ProductExportOperation.java (-470 / +470 lines)
Lines 1-470 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.core.exports;
11
package org.eclipse.pde.internal.core.exports;
12
12
13
import java.io.*;
13
import java.io.*;
14
import java.lang.reflect.InvocationTargetException;
14
import java.lang.reflect.InvocationTargetException;
15
import java.net.MalformedURLException;
15
import java.net.MalformedURLException;
16
import java.net.URL;
16
import java.net.URL;
17
import java.util.*;
17
import java.util.*;
18
import org.eclipse.core.resources.IResource;
18
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.runtime.*;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.osgi.service.resolver.BundleDescription;
20
import org.eclipse.osgi.service.resolver.BundleDescription;
21
import org.eclipse.osgi.util.NLS;
21
import org.eclipse.osgi.util.NLS;
22
import org.eclipse.pde.core.plugin.*;
22
import org.eclipse.pde.core.plugin.*;
23
import org.eclipse.pde.internal.build.*;
23
import org.eclipse.pde.internal.build.*;
24
import org.eclipse.pde.internal.core.*;
24
import org.eclipse.pde.internal.core.*;
25
import org.eclipse.pde.internal.core.ifeature.IFeature;
25
import org.eclipse.pde.internal.core.ifeature.IFeature;
26
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
26
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
27
import org.eclipse.pde.internal.core.iproduct.*;
27
import org.eclipse.pde.internal.core.iproduct.*;
28
import org.eclipse.pde.internal.core.iproduct.IProduct;
28
import org.eclipse.pde.internal.core.iproduct.IProduct;
29
import org.eclipse.pde.internal.core.util.CoreUtility;
29
import org.eclipse.pde.internal.core.util.CoreUtility;
30
import org.w3c.dom.Element;
30
import org.w3c.dom.Element;
31
31
32
public class ProductExportOperation extends FeatureExportOperation {
32
public class ProductExportOperation extends FeatureExportOperation {
33
	private static final String STATUS_MESSAGE = "!MESSAGE"; //$NON-NLS-1$
33
	private static final String STATUS_MESSAGE = "!MESSAGE"; //$NON-NLS-1$
34
	private static final String STATUS_ENTRY = "!ENTRY"; //$NON-NLS-1$
34
	private static final String STATUS_ENTRY = "!ENTRY"; //$NON-NLS-1$
35
	private static final String STATUS_SUBENTRY = "!SUBENTRY"; //$NON-NLS-1$
35
	private static final String STATUS_SUBENTRY = "!SUBENTRY"; //$NON-NLS-1$
36
	private static final String ECLIPSE_APP_MACOS = "Eclipse.app/Contents/MacOS"; //$NON-NLS-1$
36
	private static final String ECLIPSE_APP_MACOS = "Eclipse.app/Contents/MacOS"; //$NON-NLS-1$
37
	private static final String ECLIPSE_APP_CONTENTS = "Eclipse.app/Contents"; //$NON-NLS-1$
37
	private static final String ECLIPSE_APP_CONTENTS = "Eclipse.app/Contents"; //$NON-NLS-1$
38
	private String fFeatureLocation;
38
	private String fFeatureLocation;
39
	private String fRoot;
39
	private String fRoot;
40
	private IProduct fProduct;
40
	private IProduct fProduct;
41
41
42
	protected static String errorMessage;
42
	protected static String errorMessage;
43
43
44
	public static void setErrorMessage(String message) {
44
	public static void setErrorMessage(String message) {
45
		errorMessage = message;
45
		errorMessage = message;
46
	}
46
	}
47
47
48
	public static String getErrorMessage() {
48
	public static String getErrorMessage() {
49
		return errorMessage;
49
		return errorMessage;
50
	}
50
	}
51
51
52
	public static IStatus parseErrorMessage(CoreException e) {
52
	public static IStatus parseErrorMessage(CoreException e) {
53
		if (errorMessage == null)
53
		if (errorMessage == null)
54
			return null;
54
			return null;
55
55
56
		MultiStatus status = null;
56
		MultiStatus status = null;
57
		StringTokenizer tokenizer = new StringTokenizer(errorMessage, "\n"); //$NON-NLS-1$
57
		StringTokenizer tokenizer = new StringTokenizer(errorMessage, "\n"); //$NON-NLS-1$
58
		for (; tokenizer.hasMoreTokens();) {
58
		for (; tokenizer.hasMoreTokens();) {
59
			String line = tokenizer.nextToken().trim();
59
			String line = tokenizer.nextToken().trim();
60
			if (line.startsWith(STATUS_ENTRY) && tokenizer.hasMoreElements()) {
60
			if (line.startsWith(STATUS_ENTRY) && tokenizer.hasMoreElements()) {
61
				String next = tokenizer.nextToken();
61
				String next = tokenizer.nextToken();
62
				if (next.startsWith(STATUS_MESSAGE)) {
62
				if (next.startsWith(STATUS_MESSAGE)) {
63
					status = new MultiStatus(PDECore.PLUGIN_ID, 0, next.substring(8), null);
63
					status = new MultiStatus(PDECore.PLUGIN_ID, 0, next.substring(8), null);
64
				}
64
				}
65
			} else if (line.startsWith(STATUS_SUBENTRY) && tokenizer.hasMoreElements() && status != null) {
65
			} else if (line.startsWith(STATUS_SUBENTRY) && tokenizer.hasMoreElements() && status != null) {
66
				String next = tokenizer.nextToken();
66
				String next = tokenizer.nextToken();
67
				if (next.startsWith(STATUS_MESSAGE)) {
67
				if (next.startsWith(STATUS_MESSAGE)) {
68
					status.add(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, next.substring(8)));
68
					status.add(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, next.substring(8)));
69
				}
69
				}
70
			}
70
			}
71
		}
71
		}
72
		if (status != null)
72
		if (status != null)
73
			return status;
73
			return status;
74
74
75
		//parsing didn't work, just set the message
75
		//parsing didn't work, just set the message
76
		return new MultiStatus(PDECore.PLUGIN_ID, 0, new IStatus[] {e.getStatus()}, errorMessage, null);
76
		return new MultiStatus(PDECore.PLUGIN_ID, 0, new IStatus[] {e.getStatus()}, errorMessage, null);
77
	}
77
	}
78
78
79
	public ProductExportOperation(FeatureExportInfo info, String name, IProduct product, String root) {
79
	public ProductExportOperation(FeatureExportInfo info, String name, IProduct product, String root) {
80
		super(info, name);
80
		super(info, name);
81
		fProduct = product;
81
		fProduct = product;
82
		fRoot = root;
82
		fRoot = root;
83
	}
83
	}
84
84
85
	/* (non-Javadoc)
85
	/* (non-Javadoc)
86
	 * @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#run(org.eclipse.core.runtime.IProgressMonitor)
86
	 * @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#run(org.eclipse.core.runtime.IProgressMonitor)
87
	 */
87
	 */
88
	protected IStatus run(IProgressMonitor monitor) {
88
	protected IStatus run(IProgressMonitor monitor) {
89
		String[][] configurations = fInfo.targets;
89
		String[][] configurations = fInfo.targets;
90
		if (configurations == null)
90
		if (configurations == null)
91
			configurations = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}};
91
			configurations = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}};
92
92
93
		cleanupBuildRepo();
93
		cleanupBuildRepo();
94
		errorMessage = null;
94
		errorMessage = null;
95
95
96
		try {
96
		try {
97
			monitor.beginTask("", 10); //$NON-NLS-1$
97
			monitor.beginTask("", 10); //$NON-NLS-1$
98
			try {
98
			try {
99
				// create a feature to wrap all plug-ins and features
99
				// create a feature to wrap all plug-ins and features
100
				String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$
100
				String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$
101
				fFeatureLocation = fBuildTempLocation + File.separator + featureID;
101
				fFeatureLocation = fBuildTempLocation + File.separator + featureID;
102
102
103
				createFeature(featureID, fFeatureLocation, configurations, true);
103
				createFeature(featureID, fFeatureLocation, configurations, true);
104
				createBuildPropertiesFile(fFeatureLocation, configurations);
104
				createBuildPropertiesFile(fFeatureLocation, configurations);
105
				doExport(featureID, null, fFeatureLocation, configurations, new SubProgressMonitor(monitor, 8));
105
				doExport(featureID, null, fFeatureLocation, configurations, new SubProgressMonitor(monitor, 8));
106
			} catch (IOException e) {
106
			} catch (IOException e) {
107
				PDECore.log(e);
107
				PDECore.log(e);
108
			} catch (InvocationTargetException e) {
108
			} catch (InvocationTargetException e) {
109
				return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException());
109
				return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException());
110
			} catch (CoreException e) {
110
			} catch (CoreException e) {
111
				if (errorMessage != null)
111
				if (errorMessage != null)
112
					return parseErrorMessage(e);
112
					return parseErrorMessage(e);
113
				return e.getStatus();
113
				return e.getStatus();
114
			} finally {
114
			} finally {
115
				// Clean up generated files
115
				// Clean up generated files
116
				for (int j = 0; j < fInfo.items.length; j++) {
116
				for (int j = 0; j < fInfo.items.length; j++) {
117
					try {
117
					try {
118
						deleteBuildFiles(fInfo.items[j]);
118
						deleteBuildFiles(fInfo.items[j]);
119
					} catch (CoreException e) {
119
					} catch (CoreException e) {
120
						PDECore.log(e);
120
						PDECore.log(e);
121
					}
121
					}
122
				}
122
				}
123
				cleanup(null, new SubProgressMonitor(monitor, 1));
123
				cleanup(null, new SubProgressMonitor(monitor, 1));
124
			}
124
			}
125
125
126
			if (hasAntErrors()) {
126
			if (hasAntErrors()) {
127
				return new Status(IStatus.WARNING, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_CompilationErrors, fInfo.destinationDirectory));
127
				return new Status(IStatus.WARNING, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_CompilationErrors, fInfo.destinationDirectory));
128
			}
128
			}
129
129
130
		} finally {
130
		} finally {
131
			monitor.done();
131
			monitor.done();
132
			errorMessage = null;
132
			errorMessage = null;
133
		}
133
		}
134
		return Status.OK_STATUS;
134
		return Status.OK_STATUS;
135
	}
135
	}
136
136
137
	protected boolean groupedConfigurations() {
137
	protected boolean groupedConfigurations() {
138
		// we never group product exports
138
		// we never group product exports
139
		return false;
139
		return false;
140
	}
140
	}
141
141
142
	private void cleanupBuildRepo() {
142
	private void cleanupBuildRepo() {
143
		File metadataTemp = new File(fBuildTempMetadataLocation);
143
		File metadataTemp = new File(fBuildTempMetadataLocation);
144
		if (metadataTemp.exists()) {
144
		if (metadataTemp.exists()) {
145
			//make sure our build metadata repo is clean
145
			//make sure our build metadata repo is clean
146
			deleteDir(metadataTemp);
146
			deleteDir(metadataTemp);
147
		}
147
		}
148
	}
148
	}
149
149
150
	/*
150
	/*
151
	 * (non-Javadoc)
151
	 * (non-Javadoc)
152
	 * 
152
	 * 
153
	 * @see org.eclipse.pde.internal.ui.wizards.exports.FeatureExportJob#getPaths()
153
	 * @see org.eclipse.pde.internal.ui.wizards.exports.FeatureExportJob#getPaths()
154
	 */
154
	 */
155
	protected String[] getPaths() {
155
	protected String[] getPaths() {
156
		String[] paths = super.getPaths();
156
		String[] paths = super.getPaths();
157
		String[] all = new String[paths.length + 1];
157
		String[] all = new String[paths.length + 1];
158
		all[0] = fFeatureLocation + File.separator + "feature.xml"; //$NON-NLS-1$
158
		all[0] = fFeatureLocation + File.separator + ICoreConstants.FEATURE_FILENAME_DESCRIPTOR;
159
		System.arraycopy(paths, 0, all, 1, paths.length);
159
		System.arraycopy(paths, 0, all, 1, paths.length);
160
		return all;
160
		return all;
161
	}
161
	}
162
162
163
	private void createBuildPropertiesFile(String featureLocation, String[][] configurations) {
163
	private void createBuildPropertiesFile(String featureLocation, String[][] configurations) {
164
		File file = new File(featureLocation);
164
		File file = new File(featureLocation);
165
		if (!file.exists() || !file.isDirectory())
165
		if (!file.exists() || !file.isDirectory())
166
			file.mkdirs();
166
			file.mkdirs();
167
167
168
		boolean hasLaunchers = PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature() != null;
168
		boolean hasLaunchers = PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature() != null;
169
		Properties properties = new Properties();
169
		Properties properties = new Properties();
170
		if (!hasLaunchers && configurations.length > 0) {
170
		if (!hasLaunchers && configurations.length > 0) {
171
			String rootPrefix = IBuildPropertiesConstants.ROOT_PREFIX + configurations[0][0] + "." + configurations[0][1] + "." + configurations[0][2]; //$NON-NLS-1$ //$NON-NLS-2$
171
			String rootPrefix = IBuildPropertiesConstants.ROOT_PREFIX + configurations[0][0] + "." + configurations[0][1] + "." + configurations[0][2]; //$NON-NLS-1$ //$NON-NLS-2$
172
			properties.put(rootPrefix, getRootFileLocations(hasLaunchers));
172
			properties.put(rootPrefix, getRootFileLocations(hasLaunchers));
173
			if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$
173
			if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$
174
				String plist = createMacInfoPList();
174
				String plist = createMacInfoPList();
175
				if (plist != null)
175
				if (plist != null)
176
					properties.put(rootPrefix + ".folder." + ECLIPSE_APP_CONTENTS, "absolute:file:" + plist); //$NON-NLS-1$ //$NON-NLS-2$
176
					properties.put(rootPrefix + ".folder." + ECLIPSE_APP_CONTENTS, "absolute:file:" + plist); //$NON-NLS-1$ //$NON-NLS-2$
177
				properties.put(rootPrefix + ".folder." + ECLIPSE_APP_MACOS, getLauncherLocations(hasLaunchers)); //$NON-NLS-1$
177
				properties.put(rootPrefix + ".folder." + ECLIPSE_APP_MACOS, getLauncherLocations(hasLaunchers)); //$NON-NLS-1$
178
				properties.put(rootPrefix + ".permissions.755", ECLIPSE_APP_MACOS + "/" + getLauncherName()); //$NON-NLS-1$ //$NON-NLS-2$
178
				properties.put(rootPrefix + ".permissions.755", ECLIPSE_APP_MACOS + "/" + getLauncherName()); //$NON-NLS-1$ //$NON-NLS-2$
179
			} else {
179
			} else {
180
				properties.put(rootPrefix, getLauncherLocations(hasLaunchers)); //To copy a folder
180
				properties.put(rootPrefix, getLauncherLocations(hasLaunchers)); //To copy a folder
181
				properties.put(rootPrefix + ".permissions.755", getLauncherName()); //$NON-NLS-1$
181
				properties.put(rootPrefix + ".permissions.755", getLauncherName()); //$NON-NLS-1$
182
				if (TargetPlatform.getWS().equals("motif") && TargetPlatform.getOS().equals("linux")) { //$NON-NLS-1$ //$NON-NLS-2$
182
				if (TargetPlatform.getWS().equals("motif") && TargetPlatform.getOS().equals("linux")) { //$NON-NLS-1$ //$NON-NLS-2$
183
					properties.put(rootPrefix + ".permissions.755", "libXm.so.2"); //$NON-NLS-1$ //$NON-NLS-2$
183
					properties.put(rootPrefix + ".permissions.755", "libXm.so.2"); //$NON-NLS-1$ //$NON-NLS-2$
184
				}
184
				}
185
			}
185
			}
186
		}
186
		}
187
187
188
		IJREInfo jreInfo = fProduct.getJREInfo();
188
		IJREInfo jreInfo = fProduct.getJREInfo();
189
		for (int i = 0; i < configurations.length; i++) {
189
		for (int i = 0; i < configurations.length; i++) {
190
			String[] config = configurations[i];
190
			String[] config = configurations[i];
191
			File vm = jreInfo != null ? jreInfo.getJVMLocation(config[0]) : null;
191
			File vm = jreInfo != null ? jreInfo.getJVMLocation(config[0]) : null;
192
192
193
			if (vm != null) {
193
			if (vm != null) {
194
				String rootPrefix = IBuildPropertiesConstants.ROOT_PREFIX + config[0] + "." + config[1] + //$NON-NLS-1$
194
				String rootPrefix = IBuildPropertiesConstants.ROOT_PREFIX + config[0] + "." + config[1] + //$NON-NLS-1$
195
						"." + config[2]; //$NON-NLS-1$
195
						"." + config[2]; //$NON-NLS-1$
196
				properties.put(rootPrefix + ".folder.jre", "absolute:" + vm.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
196
				properties.put(rootPrefix + ".folder.jre", "absolute:" + vm.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
197
				String perms = (String) properties.get(rootPrefix + ".permissions.755"); //$NON-NLS-1$
197
				String perms = (String) properties.get(rootPrefix + ".permissions.755"); //$NON-NLS-1$
198
				if (perms != null) {
198
				if (perms != null) {
199
					StringBuffer buffer = new StringBuffer(perms);
199
					StringBuffer buffer = new StringBuffer(perms);
200
					buffer.append(","); //$NON-NLS-1$
200
					buffer.append(","); //$NON-NLS-1$
201
					buffer.append("jre/bin/java"); //$NON-NLS-1$
201
					buffer.append("jre/bin/java"); //$NON-NLS-1$
202
					properties.put(rootPrefix + ".permissions.755", buffer.toString()); //$NON-NLS-1$
202
					properties.put(rootPrefix + ".permissions.755", buffer.toString()); //$NON-NLS-1$
203
				}
203
				}
204
			}
204
			}
205
		}
205
		}
206
206
207
		if (fInfo.exportSource && fInfo.exportSourceBundle) {
207
		if (fInfo.exportSource && fInfo.exportSourceBundle) {
208
			properties.put(IBuildPropertiesConstants.PROPERTY_INDIVIDUAL_SOURCE, "true"); //$NON-NLS-1$
208
			properties.put(IBuildPropertiesConstants.PROPERTY_INDIVIDUAL_SOURCE, "true"); //$NON-NLS-1$
209
			List workspacePlugins = Arrays.asList(PluginRegistry.getWorkspaceModels());
209
			List workspacePlugins = Arrays.asList(PluginRegistry.getWorkspaceModels());
210
			for (int i = 0; i < fInfo.items.length; i++) {
210
			for (int i = 0; i < fInfo.items.length; i++) {
211
				if (fInfo.items[i] instanceof IFeatureModel) {
211
				if (fInfo.items[i] instanceof IFeatureModel) {
212
					IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature();
212
					IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature();
213
					properties.put("generate.feature@" + feature.getId().trim() + ".source", feature.getId()); //$NON-NLS-1$ //$NON-NLS-2$
213
					properties.put("generate.feature@" + feature.getId().trim() + ".source", feature.getId()); //$NON-NLS-1$ //$NON-NLS-2$
214
				} else {
214
				} else {
215
					BundleDescription bundle = null;
215
					BundleDescription bundle = null;
216
					if (fInfo.items[i] instanceof IPluginModelBase) {
216
					if (fInfo.items[i] instanceof IPluginModelBase) {
217
						bundle = ((IPluginModelBase) fInfo.items[i]).getBundleDescription();
217
						bundle = ((IPluginModelBase) fInfo.items[i]).getBundleDescription();
218
					}
218
					}
219
					if (bundle == null) {
219
					if (bundle == null) {
220
						if (fInfo.items[i] instanceof BundleDescription)
220
						if (fInfo.items[i] instanceof BundleDescription)
221
							bundle = (BundleDescription) fInfo.items[i];
221
							bundle = (BundleDescription) fInfo.items[i];
222
					}
222
					}
223
					if (bundle == null)
223
					if (bundle == null)
224
						continue;
224
						continue;
225
225
226
					//it doesn't matter if we generate extra properties for platforms we aren't exporting for
226
					//it doesn't matter if we generate extra properties for platforms we aren't exporting for
227
					if (workspacePlugins.contains(PluginRegistry.findModel(bundle))) {
227
					if (workspacePlugins.contains(PluginRegistry.findModel(bundle))) {
228
						properties.put("generate.plugin@" + bundle.getSymbolicName().trim() + ".source", bundle.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$
228
						properties.put("generate.plugin@" + bundle.getSymbolicName().trim() + ".source", bundle.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$
229
					}
229
					}
230
				}
230
				}
231
			}
231
			}
232
		}
232
		}
233
		save(new File(file, "build.properties"), properties, "Build Configuration"); //$NON-NLS-1$ //$NON-NLS-2$
233
		save(new File(file, ICoreConstants.BUILD_FILENAME_DESCRIPTOR), properties, "Build Configuration"); //$NON-NLS-1$
234
	}
234
	}
235
235
236
	/* (non-Javadoc)
236
	/* (non-Javadoc)
237
	 * @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#publishingP2Metadata()
237
	 * @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#publishingP2Metadata()
238
	 */
238
	 */
239
	protected boolean publishingP2Metadata() {
239
	protected boolean publishingP2Metadata() {
240
		return fInfo.exportMetadata;
240
		return fInfo.exportMetadata;
241
	}
241
	}
242
242
243
	private String getLauncherLocations(boolean hasLaunchers) {
243
	private String getLauncherLocations(boolean hasLaunchers) {
244
		//get the launchers for the eclipse install
244
		//get the launchers for the eclipse install
245
		StringBuffer buffer = new StringBuffer();
245
		StringBuffer buffer = new StringBuffer();
246
		if (!hasLaunchers) {
246
		if (!hasLaunchers) {
247
			File homeDir = new File(TargetPlatform.getLocation());
247
			File homeDir = new File(TargetPlatform.getLocation());
248
			if (homeDir.exists() && homeDir.isDirectory()) {
248
			if (homeDir.exists() && homeDir.isDirectory()) {
249
				// try to retrieve the exact eclipse launcher path
249
				// try to retrieve the exact eclipse launcher path
250
				// see bug 205833
250
				// see bug 205833
251
				File file = null;
251
				File file = null;
252
				if (System.getProperties().get("eclipse.launcher") != null) { //$NON-NLS-1$
252
				if (System.getProperties().get("eclipse.launcher") != null) { //$NON-NLS-1$
253
					String launcherPath = System.getProperties().get("eclipse.launcher").toString(); //$NON-NLS-1$
253
					String launcherPath = System.getProperties().get("eclipse.launcher").toString(); //$NON-NLS-1$
254
					file = new File(launcherPath);
254
					file = new File(launcherPath);
255
				}
255
				}
256
256
257
				if (file != null && file.exists() && !file.isDirectory()) {
257
				if (file != null && file.exists() && !file.isDirectory()) {
258
					appendAbsolutePath(buffer, file);
258
					appendAbsolutePath(buffer, file);
259
				} else if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$)
259
				} else if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$)
260
					appendEclipsePath(buffer, new File(homeDir, ECLIPSE_APP_MACOS));
260
					appendEclipsePath(buffer, new File(homeDir, ECLIPSE_APP_MACOS));
261
				} else {
261
				} else {
262
					appendEclipsePath(buffer, homeDir);
262
					appendEclipsePath(buffer, homeDir);
263
				}
263
				}
264
			}
264
			}
265
		}
265
		}
266
		return buffer.toString();
266
		return buffer.toString();
267
	}
267
	}
268
268
269
	private String getRootFileLocations(boolean hasLaunchers) {
269
	private String getRootFileLocations(boolean hasLaunchers) {
270
		//Get the files that go in the root of the eclipse install, excluding the launcher
270
		//Get the files that go in the root of the eclipse install, excluding the launcher
271
		StringBuffer buffer = new StringBuffer();
271
		StringBuffer buffer = new StringBuffer();
272
		if (!hasLaunchers) {
272
		if (!hasLaunchers) {
273
			File homeDir = new File(TargetPlatform.getLocation());
273
			File homeDir = new File(TargetPlatform.getLocation());
274
			if (homeDir.exists() && homeDir.isDirectory()) {
274
			if (homeDir.exists() && homeDir.isDirectory()) {
275
				File file = new File(homeDir, "startup.jar"); //$NON-NLS-1$
275
				File file = new File(homeDir, "startup.jar"); //$NON-NLS-1$
276
				if (file.exists())
276
				if (file.exists())
277
					appendAbsolutePath(buffer, file);
277
					appendAbsolutePath(buffer, file);
278
278
279
				file = new File(homeDir, "libXm.so.2"); //$NON-NLS-1$
279
				file = new File(homeDir, "libXm.so.2"); //$NON-NLS-1$
280
				if (file.exists()) {
280
				if (file.exists()) {
281
					appendAbsolutePath(buffer, file);
281
					appendAbsolutePath(buffer, file);
282
				}
282
				}
283
			}
283
			}
284
		}
284
		}
285
285
286
		return buffer.toString();
286
		return buffer.toString();
287
	}
287
	}
288
288
289
	private void appendEclipsePath(StringBuffer buffer, File homeDir) {
289
	private void appendEclipsePath(StringBuffer buffer, File homeDir) {
290
		File file = null;
290
		File file = null;
291
		file = new File(homeDir, "eclipse"); //$NON-NLS-1$
291
		file = new File(homeDir, "eclipse"); //$NON-NLS-1$
292
		if (file.exists()) {
292
		if (file.exists()) {
293
			appendAbsolutePath(buffer, file);
293
			appendAbsolutePath(buffer, file);
294
		}
294
		}
295
		file = new File(homeDir, "eclipse.exe"); //$NON-NLS-1$
295
		file = new File(homeDir, "eclipse.exe"); //$NON-NLS-1$
296
		if (file.exists()) {
296
		if (file.exists()) {
297
			appendAbsolutePath(buffer, file);
297
			appendAbsolutePath(buffer, file);
298
		}
298
		}
299
	}
299
	}
300
300
301
	private void appendAbsolutePath(StringBuffer buffer, File file) {
301
	private void appendAbsolutePath(StringBuffer buffer, File file) {
302
		if (buffer.length() > 0)
302
		if (buffer.length() > 0)
303
			buffer.append(","); //$NON-NLS-1$
303
			buffer.append(","); //$NON-NLS-1$
304
304
305
		buffer.append("absolute:file:"); //$NON-NLS-1$
305
		buffer.append("absolute:file:"); //$NON-NLS-1$
306
		buffer.append(file.getAbsolutePath());
306
		buffer.append(file.getAbsolutePath());
307
	}
307
	}
308
308
309
	protected HashMap createAntBuildProperties(String[][] configs) {
309
	protected HashMap createAntBuildProperties(String[][] configs) {
310
		HashMap properties = super.createAntBuildProperties(configs);
310
		HashMap properties = super.createAntBuildProperties(configs);
311
		properties.put(IXMLConstants.PROPERTY_LAUNCHER_NAME, getLauncherName());
311
		properties.put(IXMLConstants.PROPERTY_LAUNCHER_NAME, getLauncherName());
312
312
313
		if (fProduct.includeLaunchers()) {
313
		if (fProduct.includeLaunchers()) {
314
			properties.put("excludeLaunchers", IBuildPropertiesConstants.TRUE); //$NON-NLS-1$
314
			properties.put("excludeLaunchers", IBuildPropertiesConstants.TRUE); //$NON-NLS-1$
315
		}
315
		}
316
316
317
		ILauncherInfo info = fProduct.getLauncherInfo();
317
		ILauncherInfo info = fProduct.getLauncherInfo();
318
		if (info != null) {
318
		if (info != null) {
319
			String icons = ""; //$NON-NLS-1$
319
			String icons = ""; //$NON-NLS-1$
320
			for (int i = 0; i < configs.length; i++) {
320
			for (int i = 0; i < configs.length; i++) {
321
				String images = null;
321
				String images = null;
322
				if (configs[i][0].equals("win32")) { //$NON-NLS-1$
322
				if (configs[i][0].equals("win32")) { //$NON-NLS-1$
323
					images = getWin32Images(info);
323
					images = getWin32Images(info);
324
				} else if (configs[i][0].equals("solaris")) { //$NON-NLS-1$
324
				} else if (configs[i][0].equals("solaris")) { //$NON-NLS-1$
325
					images = getSolarisImages(info);
325
					images = getSolarisImages(info);
326
				} else if (configs[i][0].equals("linux")) { //$NON-NLS-1$
326
				} else if (configs[i][0].equals("linux")) { //$NON-NLS-1$
327
					images = getExpandedPath(info.getIconPath(ILauncherInfo.LINUX_ICON));
327
					images = getExpandedPath(info.getIconPath(ILauncherInfo.LINUX_ICON));
328
				} else if (configs[i][0].equals("macosx")) { //$NON-NLS-1$
328
				} else if (configs[i][0].equals("macosx")) { //$NON-NLS-1$
329
					images = getExpandedPath(info.getIconPath(ILauncherInfo.MACOSX_ICON));
329
					images = getExpandedPath(info.getIconPath(ILauncherInfo.MACOSX_ICON));
330
				}
330
				}
331
				if (images != null) {
331
				if (images != null) {
332
					if (icons.length() > 0)
332
					if (icons.length() > 0)
333
						icons += ","; //$NON-NLS-1$
333
						icons += ","; //$NON-NLS-1$
334
					icons += images;
334
					icons += images;
335
				}
335
				}
336
336
337
			}
337
			}
338
			if (icons != null && icons.length() > 0)
338
			if (icons != null && icons.length() > 0)
339
				properties.put(IXMLConstants.PROPERTY_LAUNCHER_ICONS, icons);
339
				properties.put(IXMLConstants.PROPERTY_LAUNCHER_ICONS, icons);
340
		}
340
		}
341
341
342
		fAntBuildProperties.put(IXMLConstants.PROPERTY_COLLECTING_FOLDER, fRoot);
342
		fAntBuildProperties.put(IXMLConstants.PROPERTY_COLLECTING_FOLDER, fRoot);
343
		fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_PREFIX, fRoot);
343
		fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_PREFIX, fRoot);
344
344
345
		return properties;
345
		return properties;
346
	}
346
	}
347
347
348
	/* (non-Javadoc)
348
	/* (non-Javadoc)
349
	 * @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#setP2MetaDataProperties(java.util.Map)
349
	 * @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#setP2MetaDataProperties(java.util.Map)
350
	 */
350
	 */
351
	protected void setP2MetaDataProperties(Map map) {
351
	protected void setP2MetaDataProperties(Map map) {
352
		if (fInfo.exportMetadata) {
352
		if (fInfo.exportMetadata) {
353
			if (PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature() == null)
353
			if (PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature() == null)
354
				map.put(IXMLConstants.PROPERTY_LAUNCHER_PROVIDER, "org.eclipse.pde.container.feature"); //$NON-NLS-1$
354
				map.put(IXMLConstants.PROPERTY_LAUNCHER_PROVIDER, "org.eclipse.pde.container.feature"); //$NON-NLS-1$
355
			map.put(IXMLConstants.TARGET_P2_METADATA, IBuildPropertiesConstants.TRUE);
355
			map.put(IXMLConstants.TARGET_P2_METADATA, IBuildPropertiesConstants.TRUE);
356
			map.put(IBuildPropertiesConstants.PROPERTY_P2_FLAVOR, P2Utils.P2_FLAVOR_DEFAULT);
356
			map.put(IBuildPropertiesConstants.PROPERTY_P2_FLAVOR, P2Utils.P2_FLAVOR_DEFAULT);
357
			map.put(IBuildPropertiesConstants.PROPERTY_P2_PUBLISH_ARTIFACTS, IBuildPropertiesConstants.TRUE);
357
			map.put(IBuildPropertiesConstants.PROPERTY_P2_PUBLISH_ARTIFACTS, IBuildPropertiesConstants.TRUE);
358
			map.put(IBuildPropertiesConstants.PROPERTY_P2_COMPRESS, IBuildPropertiesConstants.TRUE);
358
			map.put(IBuildPropertiesConstants.PROPERTY_P2_COMPRESS, IBuildPropertiesConstants.TRUE);
359
			map.put(IBuildPropertiesConstants.PROPERTY_P2_GATHERING, Boolean.toString(publishingP2Metadata()));
359
			map.put(IBuildPropertiesConstants.PROPERTY_P2_GATHERING, Boolean.toString(publishingP2Metadata()));
360
			try {
360
			try {
361
				map.put(IBuildPropertiesConstants.PROPERTY_P2_BUILD_REPO, new File(fBuildTempMetadataLocation).toURL().toString());
361
				map.put(IBuildPropertiesConstants.PROPERTY_P2_BUILD_REPO, new File(fBuildTempMetadataLocation).toURL().toString());
362
				map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$
362
				map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$
363
				map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$
363
				map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$
364
				map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId()));
364
				map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId()));
365
				map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId()));
365
				map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId()));
366
			} catch (MalformedURLException e) {
366
			} catch (MalformedURLException e) {
367
				PDECore.log(e);
367
				PDECore.log(e);
368
			}
368
			}
369
		}
369
		}
370
	}
370
	}
371
371
372
	private String getLauncherName() {
372
	private String getLauncherName() {
373
		ILauncherInfo info = fProduct.getLauncherInfo();
373
		ILauncherInfo info = fProduct.getLauncherInfo();
374
		if (info != null) {
374
		if (info != null) {
375
			String name = info.getLauncherName();
375
			String name = info.getLauncherName();
376
			if (name != null && name.length() > 0) {
376
			if (name != null && name.length() > 0) {
377
				name = name.trim();
377
				name = name.trim();
378
				if (name.endsWith(".exe")) //$NON-NLS-1$
378
				if (name.endsWith(".exe")) //$NON-NLS-1$
379
					name = name.substring(0, name.length() - 4);
379
					name = name.substring(0, name.length() - 4);
380
				return name;
380
				return name;
381
			}
381
			}
382
		}
382
		}
383
		return "eclipse"; //$NON-NLS-1$
383
		return "eclipse"; //$NON-NLS-1$
384
	}
384
	}
385
385
386
	private String getWin32Images(ILauncherInfo info) {
386
	private String getWin32Images(ILauncherInfo info) {
387
		StringBuffer buffer = new StringBuffer();
387
		StringBuffer buffer = new StringBuffer();
388
		if (info.usesWinIcoFile()) {
388
		if (info.usesWinIcoFile()) {
389
			append(buffer, info.getIconPath(ILauncherInfo.P_ICO_PATH));
389
			append(buffer, info.getIconPath(ILauncherInfo.P_ICO_PATH));
390
		} else {
390
		} else {
391
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_16_LOW));
391
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_16_LOW));
392
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_16_HIGH));
392
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_16_HIGH));
393
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_32_HIGH));
393
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_32_HIGH));
394
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_32_LOW));
394
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_32_LOW));
395
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_48_HIGH));
395
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_48_HIGH));
396
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_48_LOW));
396
			append(buffer, info.getIconPath(ILauncherInfo.WIN32_48_LOW));
397
		}
397
		}
398
		return buffer.length() > 0 ? buffer.toString() : null;
398
		return buffer.length() > 0 ? buffer.toString() : null;
399
	}
399
	}
400
400
401
	private String getSolarisImages(ILauncherInfo info) {
401
	private String getSolarisImages(ILauncherInfo info) {
402
		StringBuffer buffer = new StringBuffer();
402
		StringBuffer buffer = new StringBuffer();
403
		append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_LARGE));
403
		append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_LARGE));
404
		append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_MEDIUM));
404
		append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_MEDIUM));
405
		append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_SMALL));
405
		append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_SMALL));
406
		append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_TINY));
406
		append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_TINY));
407
		return buffer.length() > 0 ? buffer.toString() : null;
407
		return buffer.length() > 0 ? buffer.toString() : null;
408
	}
408
	}
409
409
410
	private void append(StringBuffer buffer, String path) {
410
	private void append(StringBuffer buffer, String path) {
411
		path = getExpandedPath(path);
411
		path = getExpandedPath(path);
412
		if (path != null) {
412
		if (path != null) {
413
			if (buffer.length() > 0)
413
			if (buffer.length() > 0)
414
				buffer.append(","); //$NON-NLS-1$
414
				buffer.append(","); //$NON-NLS-1$
415
			buffer.append(path);
415
			buffer.append(path);
416
		}
416
		}
417
	}
417
	}
418
418
419
	private String getExpandedPath(String path) {
419
	private String getExpandedPath(String path) {
420
		if (path == null || path.length() == 0)
420
		if (path == null || path.length() == 0)
421
			return null;
421
			return null;
422
		IResource resource = PDECore.getWorkspace().getRoot().findMember(new Path(path));
422
		IResource resource = PDECore.getWorkspace().getRoot().findMember(new Path(path));
423
		if (resource != null) {
423
		if (resource != null) {
424
			IPath fullPath = resource.getLocation();
424
			IPath fullPath = resource.getLocation();
425
			return fullPath == null ? null : fullPath.toOSString();
425
			return fullPath == null ? null : fullPath.toOSString();
426
		}
426
		}
427
		return null;
427
		return null;
428
	}
428
	}
429
429
430
	protected void setupGenerator(BuildScriptGenerator generator, String featureID, String versionId, String[][] configs, String featureLocation) throws CoreException {
430
	protected void setupGenerator(BuildScriptGenerator generator, String featureID, String versionId, String[][] configs, String featureLocation) throws CoreException {
431
		super.setupGenerator(generator, featureID, versionId, configs, featureLocation);
431
		super.setupGenerator(generator, featureID, versionId, configs, featureLocation);
432
		generator.setGenerateVersionsList(true);
432
		generator.setGenerateVersionsList(true);
433
		if (fProduct != null)
433
		if (fProduct != null)
434
			generator.setProduct(fProduct.getModel().getInstallLocation());
434
			generator.setProduct(fProduct.getModel().getInstallLocation());
435
	}
435
	}
436
436
437
	private String createMacInfoPList() {
437
	private String createMacInfoPList() {
438
		String entryName = TargetPlatformHelper.getTargetVersion() >= 3.3 ? "macosx/Info.plist" //$NON-NLS-1$
438
		String entryName = TargetPlatformHelper.getTargetVersion() >= 3.3 ? "macosx/Info.plist" //$NON-NLS-1$
439
				: "macosx/Info.plist.32"; //$NON-NLS-1$
439
				: "macosx/Info.plist.32"; //$NON-NLS-1$
440
		URL url = PDECore.getDefault().getBundle().getEntry(entryName);
440
		URL url = PDECore.getDefault().getBundle().getEntry(entryName);
441
		if (url == null)
441
		if (url == null)
442
			return null;
442
			return null;
443
443
444
		File plist = null;
444
		File plist = null;
445
		InputStream in = null;
445
		InputStream in = null;
446
		String location = fFeatureLocation;
446
		String location = fFeatureLocation;
447
447
448
		try {
448
		try {
449
			in = url.openStream();
449
			in = url.openStream();
450
			File dir = new File(location, ECLIPSE_APP_CONTENTS);
450
			File dir = new File(location, ECLIPSE_APP_CONTENTS);
451
			dir.mkdirs();
451
			dir.mkdirs();
452
			plist = new File(dir, "Info.plist"); //$NON-NLS-1$
452
			plist = new File(dir, "Info.plist"); //$NON-NLS-1$
453
			CoreUtility.readFile(in, plist);
453
			CoreUtility.readFile(in, plist);
454
			return plist.getAbsolutePath();
454
			return plist.getAbsolutePath();
455
		} catch (IOException e) {
455
		} catch (IOException e) {
456
			// nothing to do
456
			// nothing to do
457
		} finally {
457
		} finally {
458
			try {
458
			try {
459
				if (in != null)
459
				if (in != null)
460
					in.close();
460
					in.close();
461
			} catch (IOException e) {
461
			} catch (IOException e) {
462
			}
462
			}
463
		}
463
		}
464
		return null;
464
		return null;
465
	}
465
	}
466
466
467
	protected void setAdditionalAttributes(Element plugin, BundleDescription bundle) {
467
	protected void setAdditionalAttributes(Element plugin, BundleDescription bundle) {
468
		plugin.setAttribute("unpack", Boolean.toString(CoreUtility.guessUnpack(bundle))); //$NON-NLS-1$
468
		plugin.setAttribute("unpack", Boolean.toString(CoreUtility.guessUnpack(bundle))); //$NON-NLS-1$
469
	}
469
	}
470
}
470
}
(-)src/org/eclipse/pde/internal/core/exports/WorkspaceExportHelper.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
2
 * Copyright (c) 2008, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 26-31 Link Here
26
import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
26
import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
27
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
27
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
28
import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin;
28
import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin;
29
import org.eclipse.pde.internal.core.project.PDEProject;
29
30
30
/**
31
/**
31
 * Helper class for the various export operation classes, making it easier to export using workspace
32
 * Helper class for the various export operation classes, making it easier to export using workspace
Lines 106-112 Link Here
106
		IProject[] projects = getExportedWorkspaceProjects(exportedItems);
107
		IProject[] projects = getExportedWorkspaceProjects(exportedItems);
107
		Map result = new HashMap(projects.length);
108
		Map result = new HashMap(projects.length);
108
		for (int i = 0; i < projects.length; i++) {
109
		for (int i = 0; i < projects.length; i++) {
109
			IFile buildFile = projects[i].getFile("build.properties"); //$NON-NLS-1$
110
			IFile buildFile = PDEProject.getBuildProperties(projects[i]);
110
			if (buildFile.exists()) {
111
			if (buildFile.exists()) {
111
				IBuildModel buildModel = new WorkspaceBuildModel(buildFile);
112
				IBuildModel buildModel = new WorkspaceBuildModel(buildFile);
112
				buildModel.load();
113
				buildModel.load();
(-)src/org/eclipse/pde/internal/core/ibundle/IBundleModel.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 14-20 Link Here
14
import org.eclipse.pde.core.IModelChangeProvider;
14
import org.eclipse.pde.core.IModelChangeProvider;
15
15
16
/**
16
/**
17
 * This model is created from the "META-INF/MANIFEST.MF" file that represents
17
 * This model is created from the <code>META-INF/MANIFEST.MF</code> file that represents
18
 * the plug-in manifest in Eclipse 3.0 OSGi format.
18
 * the plug-in manifest in Eclipse 3.0 OSGi format.
19
 * <p>
19
 * <p>
20
 * If this model is editable, isEditable() will return true and the model
20
 * If this model is editable, isEditable() will return true and the model
(-)src/org/eclipse/pde/internal/core/ifeature/IFeatureModel.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 15-21 Link Here
15
15
16
/**
16
/**
17
 * This model type is designed to hold data loaded from
17
 * This model type is designed to hold data loaded from
18
 * "feature.xml" file of an Eclipse feature.
18
 * feature.xml file of an Eclipse feature.
19
 */
19
 */
20
public interface IFeatureModel extends IModel, IModelChangeProvider {
20
public interface IFeatureModel extends IModel, IModelChangeProvider {
21
	/**
21
	/**
(-)src/org/eclipse/pde/internal/core/plugin/WorkspaceExtensionsModel.java (-4 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 20-27 Link Here
20
import org.eclipse.core.runtime.IPath;
20
import org.eclipse.core.runtime.IPath;
21
import org.eclipse.pde.core.IEditableModel;
21
import org.eclipse.pde.core.IEditableModel;
22
import org.eclipse.pde.core.IModelChangedEvent;
22
import org.eclipse.pde.core.IModelChangedEvent;
23
import org.eclipse.pde.internal.core.NLResourceHelper;
23
import org.eclipse.pde.internal.core.*;
24
import org.eclipse.pde.internal.core.PDECore;
25
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
24
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
26
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelProvider;
25
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelProvider;
27
import org.osgi.framework.Constants;
26
import org.osgi.framework.Constants;
Lines 148-154 Link Here
148
	 */
147
	 */
149
	protected Extensions createExtensions() {
148
	protected Extensions createExtensions() {
150
		Extensions extensions = super.createExtensions();
149
		Extensions extensions = super.createExtensions();
151
		extensions.setIsFragment(fUnderlyingResource.getName().equals("fragment.xml")); //$NON-NLS-1$
150
		extensions.setIsFragment(fUnderlyingResource.getName().equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR));
152
		return extensions;
151
		return extensions;
153
	}
152
	}
154
153
(-)src/org/eclipse/pde/internal/core/project/BundleProjectDescription.java (-19 / +57 lines)
Lines 12-17 Link Here
12
12
13
import java.net.URI;
13
import java.net.URI;
14
import java.util.*;
14
import java.util.*;
15
import org.eclipse.core.resources.IContainer;
15
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
17
import org.eclipse.jdt.core.*;
18
import org.eclipse.jdt.core.*;
Lines 41-46 Link Here
41
public class BundleProjectDescription implements IBundleProjectDescription {
42
public class BundleProjectDescription implements IBundleProjectDescription {
42
43
43
	private IProject fProject;
44
	private IProject fProject;
45
	private IPath fRoot;
44
	private String fSymbolicName;
46
	private String fSymbolicName;
45
	private String fBundleName;
47
	private String fBundleName;
46
	private String fBundleVendor;
48
	private String fBundleVendor;
Lines 61-66 Link Here
61
	private IPackageExportDescription[] fExports;
63
	private IPackageExportDescription[] fExports;
62
	private IPath[] fBinIncludes;
64
	private IPath[] fBinIncludes;
63
	private WorkspacePluginModelBase fModel;
65
	private WorkspacePluginModelBase fModel;
66
	private IBundleProjectService fService;
64
67
65
	private static final String[] EQUINOX_HEADERS = new String[] {ICoreConstants.ECLIPSE_AUTOSTART, Constants.BUNDLE_ACTIVATIONPOLICY, ICoreConstants.ECLIPSE_LAZYSTART};
68
	private static final String[] EQUINOX_HEADERS = new String[] {ICoreConstants.ECLIPSE_AUTOSTART, Constants.BUNDLE_ACTIVATIONPOLICY, ICoreConstants.ECLIPSE_LAZYSTART};
66
69
Lines 78-89 Link Here
78
	}
81
	}
79
82
80
	/**
83
	/**
84
	 * Returns the bundle project service.
85
	 * 
86
	 * @return bundle project service
87
	 */
88
	IBundleProjectService getBundleProjectService() {
89
		if (fService == null) {
90
			fService = (IBundleProjectService) PDECore.getDefault().acquireService(IBundleProjectService.class.getName());
91
		}
92
		return fService;
93
	}
94
95
	/**
81
	 * Initialize settings from the given project.
96
	 * Initialize settings from the given project.
82
	 * 
97
	 * 
83
	 * @param project project
98
	 * @param project project
84
	 * @exception CoreException if unable to initialize
99
	 * @exception CoreException if unable to initialize
85
	 */
100
	 */
86
	private void initiaize(IProject project) throws CoreException {
101
	private void initiaize(IProject project) throws CoreException {
102
		IContainer root = PDEProject.getBundleRoot(project);
103
		if (root != project) {
104
			setBundleRoot(root.getProjectRelativePath());
105
		}
87
		IPluginModelBase model = PluginRegistry.findModel(project);
106
		IPluginModelBase model = PluginRegistry.findModel(project);
88
		if (model != null) {
107
		if (model != null) {
89
			IPluginBase base = model.getPluginBase();
108
			IPluginBase base = model.getPluginBase();
Lines 115-123 Link Here
115
					} catch (BundleException e) {
134
					} catch (BundleException e) {
116
						throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, e.getMessage(), e));
135
						throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, e.getMessage(), e));
117
					}
136
					}
118
					setHost(Factory.newHost(frag.getPluginId(), getRange(elements[0].getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE))));
137
					setHost(getBundleProjectService().newHost(frag.getPluginId(), getRange(elements[0].getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE))));
119
				} else {
138
				} else {
120
					setHost(Factory.newHost(frag.getPluginId(), getRange(frag.getPluginVersion())));
139
					setHost(getBundleProjectService().newHost(frag.getPluginId(), getRange(frag.getPluginVersion())));
121
				}
140
				}
122
			}
141
			}
123
			if (base instanceof BundlePluginBase) {
142
			if (base instanceof BundlePluginBase) {
Lines 147-154 Link Here
147
						while (iterator.hasNext()) {
166
						while (iterator.hasNext()) {
148
							String libName = (String) iterator.next();
167
							String libName = (String) iterator.next();
149
							IBundleClasspathEntry[] entries = getClasspathEntries(project, build, libName);
168
							IBundleClasspathEntry[] entries = getClasspathEntries(project, build, libName);
150
							for (int i = 0; i < entries.length; i++) {
169
							if (entries != null) {
151
								collect.add(entries[i]);
170
								for (int i = 0; i < entries.length; i++) {
171
									collect.add(entries[i]);
172
								}
152
							}
173
							}
153
						}
174
						}
154
						classpath = (IBundleClasspathEntry[]) collect.toArray(new IBundleClasspathEntry[collect.size()]);
175
						classpath = (IBundleClasspathEntry[]) collect.toArray(new IBundleClasspathEntry[collect.size()]);
Lines 175-181 Link Here
175
						IPackageImportDescription[] imports = new IPackageImportDescription[packages.length];
196
						IPackageImportDescription[] imports = new IPackageImportDescription[packages.length];
176
						for (int i = 0; i < packages.length; i++) {
197
						for (int i = 0; i < packages.length; i++) {
177
							ImportPackageObject pkg = packages[i];
198
							ImportPackageObject pkg = packages[i];
178
							imports[i] = Factory.newPackageImport(pkg.getName(), getRange(pkg.getVersion()), pkg.isOptional());
199
							imports[i] = getBundleProjectService().newPackageImport(pkg.getName(), getRange(pkg.getVersion()), pkg.isOptional());
179
						}
200
						}
180
						setPackageImports(imports);
201
						setPackageImports(imports);
181
					}
202
					}
Lines 195-201 Link Here
195
									friends[j] = pfs[j].getName();
216
									friends[j] = pfs[j].getName();
196
								}
217
								}
197
							}
218
							}
198
							exports[i] = Factory.newPackageExport(exp.getName(), getVersion(exp.getVersion()), !exp.isInternal(), friends);
219
							exports[i] = getBundleProjectService().newPackageExport(exp.getName(), getVersion(exp.getVersion()), !exp.isInternal(), friends);
199
						}
220
						}
200
						setPackageExports(exports);
221
						setPackageExports(exports);
201
					}
222
					}
Lines 207-213 Link Here
207
						IRequiredBundleDescription[] req = new IRequiredBundleDescription[bundles.length];
228
						IRequiredBundleDescription[] req = new IRequiredBundleDescription[bundles.length];
208
						for (int i = 0; i < bundles.length; i++) {
229
						for (int i = 0; i < bundles.length; i++) {
209
							RequireBundleObject rb = bundles[i];
230
							RequireBundleObject rb = bundles[i];
210
							req[i] = Factory.newRequiredBundle(rb.getId(), getRange(rb.getVersion()), rb.isOptional(), rb.isReexported());
231
							req[i] = getBundleProjectService().newRequiredBundle(rb.getId(), getRange(rb.getVersion()), rb.isOptional(), rb.isReexported());
211
						}
232
						}
212
						setRequiredBundles(req);
233
						setRequiredBundles(req);
213
					}
234
					}
Lines 268-274 Link Here
268
				entry = build.getEntry(IBuildEntry.OUTPUT_PREFIX + libraryName);
289
				entry = build.getEntry(IBuildEntry.OUTPUT_PREFIX + libraryName);
269
				if (entry == null) {
290
				if (entry == null) {
270
					// no source or class file folder
291
					// no source or class file folder
271
					return new IBundleClasspathEntry[] {Factory.newBundleClasspathEntry(null, null, new Path(libraryName))};
292
					return new IBundleClasspathEntry[] {getBundleProjectService().newBundleClasspathEntry(null, null, new Path(libraryName))};
272
				}
293
				}
273
				// base the entries on class file folders
294
				// base the entries on class file folders
274
				return getClasspathEntries(project, entry, true);
295
				return getClasspathEntries(project, entry, true);
Lines 303-326 Link Here
303
				IPath path = new Path(tokens[i]);
324
				IPath path = new Path(tokens[i]);
304
				IBundleClasspathEntry spec = null;
325
				IBundleClasspathEntry spec = null;
305
				if (binary) {
326
				if (binary) {
306
					spec = Factory.newBundleClasspathEntry(null, path, lib);
327
					spec = getBundleProjectService().newBundleClasspathEntry(null, path, lib);
307
				} else {
328
				} else {
308
					IJavaProject jp = JavaCore.create(project);
329
					IJavaProject jp = JavaCore.create(project);
309
					IClasspathEntry[] rawClasspath = jp.getRawClasspath();
310
					IPath output = null;
330
					IPath output = null;
311
					for (int j = 0; j < rawClasspath.length; j++) {
331
					if (jp.exists()) {
312
						IClasspathEntry cpe = rawClasspath[j];
332
						IClasspathEntry[] rawClasspath = jp.getRawClasspath();
313
						if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
333
						for (int j = 0; j < rawClasspath.length; j++) {
314
							if (cpe.getPath().removeFirstSegments(1).equals(path)) {
334
							IClasspathEntry cpe = rawClasspath[j];
315
								output = cpe.getOutputLocation();
335
							if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
316
								if (output != null) {
336
								if (cpe.getPath().removeFirstSegments(1).equals(path)) {
317
									output = output.removeFirstSegments(1);
337
									output = cpe.getOutputLocation();
338
									if (output != null) {
339
										output = output.removeFirstSegments(1);
340
									}
341
									break;
318
								}
342
								}
319
								break;
320
							}
343
							}
321
						}
344
						}
322
					}
345
					}
323
					spec = Factory.newBundleClasspathEntry(path, output, lib);
346
					spec = getBundleProjectService().newBundleClasspathEntry(path, output, lib);
324
				}
347
				}
325
				bces[i] = spec;
348
				bces[i] = spec;
326
			}
349
			}
Lines 378-383 Link Here
378
		ProjectModifyOperation operation = new ProjectModifyOperation();
401
		ProjectModifyOperation operation = new ProjectModifyOperation();
379
		operation.execute(monitor, this);
402
		operation.execute(monitor, this);
380
		fModel = operation.getModel();
403
		fModel = operation.getModel();
404
		fService = null;
381
	}
405
	}
382
406
383
	/**
407
	/**
Lines 662-665 Link Here
662
		return fBinIncludes;
686
		return fBinIncludes;
663
	}
687
	}
664
688
689
	/* (non-Javadoc)
690
	 * @see org.eclipse.pde.core.project.IBundleProjectDescription#setBundleRoot(org.eclipse.core.runtime.IPath)
691
	 */
692
	public void setBundleRoot(IPath path) {
693
		fRoot = path;
694
	}
695
696
	/* (non-Javadoc)
697
	 * @see org.eclipse.pde.core.project.IBundleProjectDescription#getBundleRoot()
698
	 */
699
	public IPath getBundleRoot() {
700
		return fRoot;
701
	}
702
665
}
703
}
(-)src/org/eclipse/pde/internal/core/project/BundleProjectService.java (+149 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 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.core.project;
12
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.osgi.service.resolver.VersionRange;
17
import org.eclipse.pde.core.project.*;
18
import org.osgi.framework.Version;
19
20
/**
21
 * Factory class for creating bundle project descriptions and associated artifacts.
22
 * 
23
 * @noinstantiate This class is not intended to be instantiated by clients.
24
 * @since 3.6
25
 */
26
public final class BundleProjectService implements IBundleProjectService {
27
28
	private static IBundleProjectService fgDefault;
29
30
	/**
31
	 * Returns the bundle project service.
32
	 * 
33
	 * @return bundle project service
34
	 */
35
	public static synchronized IBundleProjectService getDefault() {
36
		if (fgDefault == null) {
37
			fgDefault = new BundleProjectService();
38
		}
39
		return fgDefault;
40
	}
41
42
	/**
43
	 * Constructs a new service.
44
	 */
45
	private BundleProjectService() {
46
	}
47
48
	/**
49
	 * Returns a bundle description for the given project.
50
	 * If the project does not exist, the description can be used to create
51
	 * a new bundle project. If the project does exist, the description can be used to
52
	 * modify a project.
53
	 *  
54
	 * @param project project
55
	 * @return bundle description for the associated project
56
	 * @exception CoreException if unable to create a description on an existing project
57
	 */
58
	public IBundleProjectDescription getDescription(IProject project) throws CoreException {
59
		return new BundleProjectDescription(project);
60
	}
61
62
	/**
63
	 * Creates and returns a new host description.
64
	 * 
65
	 * @param name symbolic name of the host
66
	 * @param range version constraint or <code>null</code>
67
	 * @return host description
68
	 */
69
	public IHostDescription newHost(String name, VersionRange range) {
70
		return new HostDescriptoin(name, range);
71
	}
72
73
	/**
74
	 * Creates and returns a new package import description.
75
	 * 
76
	 * @param name fully qualified name of imported package
77
	 * @param range version constraint or <code>null</code>
78
	 * @param optional whether the import is optional
79
	 * @return package import description
80
	 */
81
	public IPackageImportDescription newPackageImport(String name, VersionRange range, boolean optional) {
82
		return new PackageImportDescription(name, range, optional);
83
	}
84
85
	/**
86
	 * Constructs a new package export description.
87
	 * 
88
	 * @param name fully qualified package name
89
	 * @param version version or <code>null</code>
90
	 * @param api whether the package is considered API
91
	 * @param friends symbolic names of bundles that are friends, or <code>null</code>; when 
92
	 *  friends are specified the package will not be API
93
	 * @return package export description
94
	 */
95
	public IPackageExportDescription newPackageExport(String name, Version version, boolean api, String[] friends) {
96
		return new PackageExportDescription(name, version, friends, api);
97
	}
98
99
	/**
100
	 * Creates and returns a new required bundle description.
101
	 * 
102
	 * @param name symbolic name of required bundle
103
	 * @param range version constraint or <code>null</code>
104
	 * @param optional whether the required bundle is optional
105
	 * @param export whether the required bundle is re-exported
106
	 * @return required bundle description
107
	 */
108
	public IRequiredBundleDescription newRequiredBundle(String name, VersionRange range, boolean optional, boolean export) {
109
		return new RequiredBundleDescription(name, range, export, optional);
110
	}
111
112
	/**
113
	 * Creates and returns a new bundle classpath entry defining the relationship
114
	 * between a source, binaries, and library on the Bundle-Classpath header.
115
	 * <p>
116
	 * When a source folder is specified, the binary folder defines its output
117
	 * folder, or may be <code>null</code> to indicate that the project's default output
118
	 * folder is used by the source folder. When only a binary folder is specified, there
119
	 * is no source associated with the folder. When no source or binary are specified,
120
	 * it indicates the library is included in the project as an archive.
121
	 * </p>
122
	 * @param sourceFolder source folder or <code>null</code>
123
	 * @param binaryFolder binary folder or <code>null</code>
124
	 * @param library associated entry on the Bundle-Classpath header or <code>null</code>
125
	 * 	to indicate default entry "."
126
	 */
127
	public IBundleClasspathEntry newBundleClasspathEntry(IPath sourceFolder, IPath binaryFolder, IPath library) {
128
		return new BundleClasspathSpecification(sourceFolder, binaryFolder, library);
129
	}
130
131
	/**
132
	 * Sets the location within the project where the root of the bundle and its associated
133
	 * artifacts will reside, or <code>null</code> to indicate the default bundle root location
134
	 * should be used (project folder).
135
	 * <p>
136
	 * The bundle root is the folder containing the <code>META-INF/</code> folder. When the bundle
137
	 * root location is modified, existing bundle artifacts at the old root are not moved or modified.
138
	 * When creating a new bundle project {@link IBundleProjectDescription#setBundleRoot(IPath)} can 
139
	 * be used to specify an initial bundle root location. To modify the bundle root location of an
140
	 * existing project, this method must be used.
141
	 * </p>
142
	 * @param project project that must exist and be open
143
	 * @param bundleRoot project relative path to bundle root artifacts in the project or <code>null</code>
144
	 * @throws CoreException if setting the root fails
145
	 */
146
	public void setBundleRoot(IProject project, IPath bundleRoot) throws CoreException {
147
		PDEProject.setBundleRoot(project, project.getFolder(bundleRoot));
148
	}
149
}
(-)src/org/eclipse/pde/internal/core/project/PDEProject.java (+216 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 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.core.project;
12
13
import org.eclipse.core.resources.*;
14
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
16
import org.eclipse.pde.internal.core.ICoreConstants;
17
import org.eclipse.pde.internal.core.PDECore;
18
import org.osgi.service.prefs.BackingStoreException;
19
20
/**
21
 * Utility class to resolve plug-in and bundle files relative to a project 
22
 * specific bundle root location.
23
 * 
24
 * @since 3.6
25
 */
26
public class PDEProject {
27
28
	/**
29
	 * Preference key for the project relative bundle root path
30
	 */
31
	public static final String BUNDLE_ROOT_PATH = "BUNDLE_ROOT_PATH"; //$NON-NLS-1$
32
33
	/**
34
	 * Returns the container in the specified project that corresponds to the
35
	 * root of bundle related artifacts. May return the project itself
36
	 * or a folder within the project.
37
	 * 
38
	 * @param project project
39
	 * @return container corresponding to the bundle root
40
	 */
41
	public static IContainer getBundleRoot(IProject project) {
42
		ProjectScope scope = new ProjectScope(project);
43
		IEclipsePreferences node = scope.getNode(PDECore.PLUGIN_ID);
44
		if (node != null) {
45
			String string = node.get(BUNDLE_ROOT_PATH, null);
46
			if (string != null) {
47
				IPath path = Path.fromPortableString(string);
48
				return project.getFolder(path);
49
			}
50
		}
51
		return project;
52
	}
53
54
	/**
55
	 * Sets the root of the bundle related artifacts in the specified project
56
	 * to the specified container. When <code>null</code> is specified, the 
57
	 * bundle root will be the project itself. The container must be within
58
	 * the specified project.
59
	 * 
60
	 * @param project project
61
	 * @param root project relative bundle root path, or <code>null</code> (or an empty path)
62
	 *  to indicate the root of the bundle is the root of the project
63
	 * @exception CoreException if unable to set the bundle root to the specified container
64
	 */
65
	public static void setBundleRoot(IProject project, IContainer root) throws CoreException {
66
		if (root != null && !root.getProject().equals(project)) {
67
			throw new IllegalArgumentException("root must be contained in the given project"); //$NON-NLS-1$
68
		}
69
		ProjectScope scope = new ProjectScope(project);
70
		IEclipsePreferences node = scope.getNode(PDECore.PLUGIN_ID);
71
		if (node != null) {
72
			IPath path = null;
73
			if (root != null) {
74
				path = root.getProjectRelativePath();
75
			}
76
			if (path != null && path.isEmpty()) {
77
				path = null;
78
			}
79
			String value = null;
80
			if (path != null) {
81
				value = path.toPortableString();
82
			}
83
			if (value == null) {
84
				node.remove(BUNDLE_ROOT_PATH);
85
			} else {
86
				node.put(BUNDLE_ROOT_PATH, value);
87
			}
88
			try {
89
				node.flush();
90
				// update model manager
91
				PDECore.getDefault().getModelManager().bundleRootChanged(project);
92
			} catch (BackingStoreException e) {
93
				throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, e.getMessage(), e));
94
			}
95
		} else {
96
			throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, "Failed to retrieve project scope preference settings")); //$NON-NLS-1$
97
		}
98
	}
99
100
	/**
101
	 * Returns the resource in the specified project corresponding to its
102
	 * <code>MANIFEST.MF</code> file.
103
	 * 
104
	 * @param project project
105
	 * @return <code>MANIFEST.MF</code> file that may or may not exist
106
	 */
107
	public static IFile getManifest(IProject project) {
108
		return getBundleRelativeFile(project, ICoreConstants.MANIFEST_PATH);
109
	}
110
111
	/**
112
	 * Returns the resource in the specified project corresponding to its
113
	 * <code>build.properties</code>file.
114
	 * 
115
	 * @param project project
116
	 * @return <code>build.properties</code> file that may or may not exist
117
	 */
118
	public static IFile getBuildProperties(IProject project) {
119
		return getBundleRelativeFile(project, ICoreConstants.BUILD_PROPERTIES_PATH);
120
	}
121
122
	/**
123
	 * Returns the resource in the specified project corresponding to its
124
	 * <code>plugin.xml</code>file.
125
	 * 
126
	 * @param project project
127
	 * @return <code>plugin.xml</code> file that may or may not exist
128
	 */
129
	public static IFile getPluginXml(IProject project) {
130
		return getBundleRelativeFile(project, ICoreConstants.PLUGIN_PATH);
131
	}
132
133
	/**
134
	 * Returns the resource in the specified project corresponding to its
135
	 * <code>fragment.xml</code>file.
136
	 * 
137
	 * @param project project
138
	 * @return <code>fragment.xml</code> file that may or may not exist
139
	 */
140
	public static IFile getFragmentXml(IProject project) {
141
		return getBundleRelativeFile(project, ICoreConstants.FRAGMENT_PATH);
142
	}
143
144
	/**
145
	 * Returns the resource in the specified project corresponding to its
146
	 * <code>feature.xml</code>file.
147
	 * 
148
	 * @param project project
149
	 * @return <code>feature.xml</code> file that may or may not exist
150
	 */
151
	public static IFile getFeatureXml(IProject project) {
152
		return getBundleRelativeFile(project, ICoreConstants.FEATURE_PATH);
153
	}
154
155
	/**
156
	 * Returns the resource in the specified project corresponding to its
157
	 * <code>.options</code>file.
158
	 * 
159
	 * @param project project
160
	 * @return <code>.options</code> file that may or may not exist
161
	 */
162
	public static IFile getOptionsFile(IProject project) {
163
		return getBundleRelativeFile(project, new Path(ICoreConstants.OPTIONS_FILENAME));
164
	}
165
166
	/**
167
	 * Returns the resource in the specified project corresponding to its
168
	 * <code>OSGI-INF/</code>folder.
169
	 * 
170
	 * @param project project
171
	 * @return <code>OSGI-INF/</code> folder that may or may not exist
172
	 */
173
	public static IFolder getOSGiInf(IProject project) {
174
		return getBundleRelativeFolder(project, ICoreConstants.OSGI_INF_PATH);
175
	}
176
177
	/**
178
	 * Returns the resource in the specified project corresponding to its
179
	 * <code>META-INF/</code>folder.
180
	 * 
181
	 * @param project project
182
	 * @return <code>META-INF/</code> folder that may or may not exist
183
	 */
184
	public static IFolder getMetaInf(IProject project) {
185
		return getBundleRelativeFolder(project, new Path(ICoreConstants.MANIFEST_FOLDER_NAME));
186
	}
187
188
	/**
189
	 * Returns a file relative to the bundle root of the specified project.
190
	 * 
191
	 * @param project project
192
	 * @param path bundle root relative path
193
	 * @return file that may or may not exist
194
	 */
195
	public static IFile getBundleRelativeFile(IProject project, IPath path) {
196
		return getBundleRoot(project).getFile(path);
197
	}
198
199
	/**
200
	 * Returns a folder relative to the bundle root of the specified project.
201
	 * 
202
	 * @param project project
203
	 * @param path bundle root relative path
204
	 * @return folder that may or may not exist
205
	 */
206
	public static IFolder getBundleRelativeFolder(IProject project, IPath path) {
207
		return getBundleRoot(project).getFolder(path);
208
	}
209
210
	// TODO: schema folder?
211
212
	// TODO: localization file
213
214
	// TODO: plugin_customization.ini ?
215
216
}
(-)src/org/eclipse/pde/internal/core/project/ProjectModifyOperation.java (-5 / +18 lines)
Lines 50-56 Link Here
50
	public void execute(IProgressMonitor monitor, IBundleProjectDescription description) throws CoreException {
50
	public void execute(IProgressMonitor monitor, IBundleProjectDescription description) throws CoreException {
51
		// retrieve current description of the project to detect differences
51
		// retrieve current description of the project to detect differences
52
		IProject project = description.getProject();
52
		IProject project = description.getProject();
53
		IBundleProjectDescription before = Factory.getDescription(project);
53
		IBundleProjectService service = (IBundleProjectService) PDECore.getDefault().acquireService(IBundleProjectService.class.getName());
54
		IBundleProjectDescription before = service.getDescription(project);
55
		boolean considerRoot = !project.exists();
54
		String taskName = null;
56
		String taskName = null;
55
		if (project.exists()) {
57
		if (project.exists()) {
56
			taskName = Messages.ProjectModifyOperation_0;
58
			taskName = Messages.ProjectModifyOperation_0;
Lines 65-71 Link Here
65
			}
67
			}
66
		}
68
		}
67
		SubMonitor sub = SubMonitor.convert(monitor, taskName, 6);
69
		SubMonitor sub = SubMonitor.convert(monitor, taskName, 6);
70
		// create and open project
68
		createProject(description);
71
		createProject(description);
72
		// set bundle root for new projects
73
		if (considerRoot) {
74
			IFolder folder = null;
75
			IPath root = description.getBundleRoot();
76
			if (root != null && !root.isEmpty()) {
77
				folder = project.getFolder(root);
78
				CoreUtility.createFolder(folder);
79
			}
80
			PDEProject.setBundleRoot(project, folder);
81
		}
69
		sub.worked(1);
82
		sub.worked(1);
70
		configureNatures(description);
83
		configureNatures(description);
71
		sub.worked(1);
84
		sub.worked(1);
Lines 286-296 Link Here
286
	 */
299
	 */
287
	private void configureManifest(IBundleProjectDescription description, IBundleProjectDescription before) throws CoreException {
300
	private void configureManifest(IBundleProjectDescription description, IBundleProjectDescription before) throws CoreException {
288
		IProject project = description.getProject();
301
		IProject project = description.getProject();
289
		IFile manifest = project.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
302
		IFile manifest = PDEProject.getManifest(project);
290
		if (description.getHost() == null) {
303
		if (description.getHost() == null) {
291
			fModel = new WorkspaceBundlePluginModel(manifest, project.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR));
304
			fModel = new WorkspaceBundlePluginModel(manifest, PDEProject.getPluginXml(project));
292
		} else {
305
		} else {
293
			fModel = new WorkspaceBundleFragmentModel(manifest, project.getFile(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR));
306
			fModel = new WorkspaceBundleFragmentModel(manifest, PDEProject.getFragmentXml(project));
294
		}
307
		}
295
308
296
		IPluginBase pluginBase = fModel.getPluginBase();
309
		IPluginBase pluginBase = fModel.getPluginBase();
Lines 585-591 Link Here
585
598
586
	private void configureBuildPropertiesFile(IBundleProjectDescription description, IBundleProjectDescription before) throws CoreException {
599
	private void configureBuildPropertiesFile(IBundleProjectDescription description, IBundleProjectDescription before) throws CoreException {
587
		IProject project = description.getProject();
600
		IProject project = description.getProject();
588
		IFile file = project.getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
601
		IFile file = PDEProject.getBuildProperties(project);
589
		WorkspaceBuildModel model = new WorkspaceBuildModel(file);
602
		WorkspaceBuildModel model = new WorkspaceBuildModel(file);
590
		IBuildModelFactory factory = model.getFactory();
603
		IBuildModelFactory factory = model.getFactory();
591
604
(-)src/org/eclipse/pde/internal/core/target/FeatureBundleContainer.java (-273 / +272 lines)
Lines 1-273 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
2
 * Copyright (c) 2009, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.core.target;
11
package org.eclipse.pde.internal.core.target;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.util.*;
14
import java.util.*;
15
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
16
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
17
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.osgi.util.NLS;
18
import org.eclipse.pde.internal.build.site.PluginPathFinder;
18
import org.eclipse.pde.internal.build.site.PluginPathFinder;
19
import org.eclipse.pde.internal.core.ExternalFeatureModelManager;
19
import org.eclipse.pde.internal.core.*;
20
import org.eclipse.pde.internal.core.PDECore;
20
import org.eclipse.pde.internal.core.ifeature.*;
21
import org.eclipse.pde.internal.core.ifeature.*;
21
import org.eclipse.pde.internal.core.target.provisional.*;
22
import org.eclipse.pde.internal.core.target.provisional.*;
22
23
23
/**
24
/**
24
 * A container of the bundles contained in a feature.
25
 * A container of the bundles contained in a feature.
25
 * 
26
 * 
26
 * @since 3.5
27
 * @since 3.5
27
 */
28
 */
28
public class FeatureBundleContainer extends AbstractBundleContainer {
29
public class FeatureBundleContainer extends AbstractBundleContainer {
29
30
30
	/**
31
	/**
31
	 * Constant describing the type of bundle container 
32
	 * Constant describing the type of bundle container 
32
	 */
33
	 */
33
	public static final String TYPE = "Feature"; //$NON-NLS-1$
34
	public static final String TYPE = "Feature"; //$NON-NLS-1$
34
35
35
	/**
36
	/**
36
	 * Feature symbolic name 
37
	 * Feature symbolic name 
37
	 */
38
	 */
38
	private String fId;
39
	private String fId;
39
40
40
	/**
41
	/**
41
	 * Feature version or <code>null</code>
42
	 * Feature version or <code>null</code>
42
	 */
43
	 */
43
	private String fVersion;
44
	private String fVersion;
44
45
45
	/**
46
	/**
46
	 * Install location which may contain string substitution variables
47
	 * Install location which may contain string substitution variables
47
	 */
48
	 */
48
	private String fHome;
49
	private String fHome;
49
50
50
	/**
51
	/**
51
	 * Constructs a new feature bundle container for the feature at the specified
52
	 * Constructs a new feature bundle container for the feature at the specified
52
	 * location. Plug-ins are resolved in the plug-ins directory of the given home
53
	 * location. Plug-ins are resolved in the plug-ins directory of the given home
53
	 * directory. When version is unspecified, the most recent version is used.
54
	 * directory. When version is unspecified, the most recent version is used.
54
	 * 
55
	 * 
55
	 * @param home root directory containing the features directory which
56
	 * @param home root directory containing the features directory which
56
	 *  may contain string substitution variables
57
	 *  may contain string substitution variables
57
	 * @param name feature symbolic name
58
	 * @param name feature symbolic name
58
	 * @param version feature version, or <code>null</code> if unspecified
59
	 * @param version feature version, or <code>null</code> if unspecified
59
	 */
60
	 */
60
	FeatureBundleContainer(String home, String name, String version) {
61
	FeatureBundleContainer(String home, String name, String version) {
61
		fId = name;
62
		fId = name;
62
		fVersion = version;
63
		fVersion = version;
63
		fHome = home;
64
		fHome = home;
64
	}
65
	}
65
66
66
	/* (non-Javadoc)
67
	/* (non-Javadoc)
67
	 * @see org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer#getLocation(boolean)
68
	 * @see org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer#getLocation(boolean)
68
	 */
69
	 */
69
	public String getLocation(boolean resolve) throws CoreException {
70
	public String getLocation(boolean resolve) throws CoreException {
70
		if (resolve) {
71
		if (resolve) {
71
			return resolveHomeLocation().toOSString();
72
			return resolveHomeLocation().toOSString();
72
		}
73
		}
73
		return fHome;
74
		return fHome;
74
	}
75
	}
75
76
76
	/* (non-Javadoc)
77
	/* (non-Javadoc)
77
	 * @see org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer#getType()
78
	 * @see org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer#getType()
78
	 */
79
	 */
79
	public String getType() {
80
	public String getType() {
80
		return TYPE;
81
		return TYPE;
81
	}
82
	}
82
83
83
	/**
84
	/**
84
	 * Returns the symbolic name of the feature this bundle container resolves from
85
	 * Returns the symbolic name of the feature this bundle container resolves from
85
	 * 
86
	 * 
86
	 * @return string feature id (symbolic name)
87
	 * @return string feature id (symbolic name)
87
	 */
88
	 */
88
	public String getFeatureId() {
89
	public String getFeatureId() {
89
		return fId;
90
		return fId;
90
	}
91
	}
91
92
92
	/**
93
	/**
93
	 * Returns the version of the feature this bundle container resolves from if
94
	 * Returns the version of the feature this bundle container resolves from if
94
	 * a version was specified.
95
	 * a version was specified.
95
	 * 
96
	 * 
96
	 * @return string feature version or <code>null</code>
97
	 * @return string feature version or <code>null</code>
97
	 */
98
	 */
98
	public String getFeatureVersion() {
99
	public String getFeatureVersion() {
99
		return fVersion;
100
		return fVersion;
100
	}
101
	}
101
102
102
	/**
103
	/**
103
	 * Returns the home location with all variables resolved as a path.
104
	 * Returns the home location with all variables resolved as a path.
104
	 * 
105
	 * 
105
	 * @return resolved home location
106
	 * @return resolved home location
106
	 * @throws CoreException
107
	 * @throws CoreException
107
	 */
108
	 */
108
	private IPath resolveHomeLocation() throws CoreException {
109
	private IPath resolveHomeLocation() throws CoreException {
109
		return new Path(resolveVariables(fHome));
110
		return new Path(resolveVariables(fHome));
110
	}
111
	}
111
112
112
	/**
113
	/**
113
	 * Resolves and returns the directory containing the feature.
114
	 * Resolves and returns the directory containing the feature.
114
	 * 
115
	 * 
115
	 * @return feature directory
116
	 * @return feature directory
116
	 * @throws CoreException if unable to resolve
117
	 * @throws CoreException if unable to resolve
117
	 */
118
	 */
118
	private File resolveFeatureLocation() throws CoreException {
119
	private File resolveFeatureLocation() throws CoreException {
119
		IPath home = resolveHomeLocation();
120
		IPath home = resolveHomeLocation();
120
		File[] featurePaths = PluginPathFinder.getFeaturePaths(home.toOSString());
121
		File[] featurePaths = PluginPathFinder.getFeaturePaths(home.toOSString());
121
		if (featurePaths.length == 0) {
122
		if (featurePaths.length == 0) {
122
			// no features are included with the install/home location
123
			// no features are included with the install/home location
123
			IPath path = home.append("features"); //$NON-NLS-1$
124
			IPath path = home.append("features"); //$NON-NLS-1$
124
			throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_0, path.toOSString())));
125
			throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_0, path.toOSString())));
125
		}
126
		}
126
		// if a specific version is specified, find it
127
		// if a specific version is specified, find it
127
		if (fVersion != null) {
128
		if (fVersion != null) {
128
			StringBuffer buf = new StringBuffer();
129
			StringBuffer buf = new StringBuffer();
129
			String name = buf.append(fId).append("_").append(fVersion).toString(); //$NON-NLS-1$
130
			String name = buf.append(fId).append("_").append(fVersion).toString(); //$NON-NLS-1$
130
			for (int i = 0; i < featurePaths.length; i++) {
131
			for (int i = 0; i < featurePaths.length; i++) {
131
				File feature = featurePaths[i];
132
				File feature = featurePaths[i];
132
				if (feature.getName().equals(name)) {
133
				if (feature.getName().equals(name)) {
133
					return feature;
134
					return feature;
134
				}
135
				}
135
			}
136
			}
136
			throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_1, fId)));
137
			throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_1, fId)));
137
		}
138
		}
138
		// use most recent version
139
		// use most recent version
139
		List versions = new ArrayList();
140
		List versions = new ArrayList();
140
		StringBuffer buf = new StringBuffer();
141
		StringBuffer buf = new StringBuffer();
141
		String prefix = buf.append(fId).append("_").toString(); //$NON-NLS-1$
142
		String prefix = buf.append(fId).append("_").toString(); //$NON-NLS-1$
142
		for (int i = 0; i < featurePaths.length; i++) {
143
		for (int i = 0; i < featurePaths.length; i++) {
143
			String name = featurePaths[i].getName();
144
			String name = featurePaths[i].getName();
144
			if (name.startsWith(prefix)) {
145
			if (name.startsWith(prefix)) {
145
				versions.add(featurePaths[i]);
146
				versions.add(featurePaths[i]);
146
			}
147
			}
147
		}
148
		}
148
		if (versions.isEmpty()) {
149
		if (versions.isEmpty()) {
149
			throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_1, fId)));
150
			throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_1, fId)));
150
		}
151
		}
151
		Collections.sort(versions, new Comparator() {
152
		Collections.sort(versions, new Comparator() {
152
			public int compare(Object o1, Object o2) {
153
			public int compare(Object o1, Object o2) {
153
				return ((File) o1).getName().compareTo(((File) o2).getName());
154
				return ((File) o1).getName().compareTo(((File) o2).getName());
154
			}
155
			}
155
		});
156
		});
156
		return (File) versions.get(versions.size() - 1);
157
		return (File) versions.get(versions.size() - 1);
157
	}
158
	}
158
159
159
	/* (non-Javadoc)
160
	/* (non-Javadoc)
160
	 * @see org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer#resolveBundles(org.eclipse.pde.internal.core.target.provisional.ITargetDefinition, org.eclipse.core.runtime.IProgressMonitor)
161
	 * @see org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer#resolveBundles(org.eclipse.pde.internal.core.target.provisional.ITargetDefinition, org.eclipse.core.runtime.IProgressMonitor)
161
	 */
162
	 */
162
	protected IResolvedBundle[] resolveBundles(ITargetDefinition definition, IProgressMonitor monitor) throws CoreException {
163
	protected IResolvedBundle[] resolveBundles(ITargetDefinition definition, IProgressMonitor monitor) throws CoreException {
163
		IFeatureModel model = null;
164
		IFeatureModel model = null;
164
		try {
165
		try {
165
			if (monitor.isCanceled()) {
166
			if (monitor.isCanceled()) {
166
				return new IResolvedBundle[0];
167
				return new IResolvedBundle[0];
167
			}
168
			}
168
			File location = resolveFeatureLocation();
169
			File location = resolveFeatureLocation();
169
			File manifest = new File(location, ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
170
			File manifest = new File(location, "feature.xml"); //$NON-NLS-1$
170
			if (!manifest.exists() || !manifest.isFile()) {
171
			if (!manifest.exists() || !manifest.isFile()) {
171
				throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_2, fId)));
172
				throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_2, fId)));
172
			}
173
			}
173
			model = ExternalFeatureModelManager.createModel(manifest);
174
			model = ExternalFeatureModelManager.createModel(manifest);
174
			if (model == null || !model.isLoaded()) {
175
			if (model == null || !model.isLoaded()) {
175
				throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_2, fId)));
176
				throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_2, fId)));
176
			}
177
			}
177
			// search bundles in plug-ins directory
178
			// search bundles in plug-ins directory
178
			ITargetPlatformService service = (ITargetPlatformService) PDECore.getDefault().acquireService(ITargetPlatformService.class.getName());
179
			ITargetPlatformService service = (ITargetPlatformService) PDECore.getDefault().acquireService(ITargetPlatformService.class.getName());
179
			if (service == null) {
180
			if (service == null) {
180
				throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.FeatureBundleContainer_4));
181
				throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.FeatureBundleContainer_4));
181
			}
182
			}
182
			File dir = new File(manifest.getParentFile().getParentFile().getParentFile(), "plugins"); //$NON-NLS-1$
183
			File dir = new File(manifest.getParentFile().getParentFile().getParentFile(), "plugins"); //$NON-NLS-1$
183
			if (!dir.exists() || !dir.isDirectory()) {
184
			if (!dir.exists() || !dir.isDirectory()) {
184
				throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_5, fId)));
185
				throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.FeatureBundleContainer_5, fId)));
185
			}
186
			}
186
			if (monitor.isCanceled()) {
187
			if (monitor.isCanceled()) {
187
				return new IResolvedBundle[0];
188
				return new IResolvedBundle[0];
188
			}
189
			}
189
190
190
			IBundleContainer container = service.newDirectoryContainer(dir.getAbsolutePath());
191
			IBundleContainer container = service.newDirectoryContainer(dir.getAbsolutePath());
191
			container.resolve(definition, monitor);
192
			container.resolve(definition, monitor);
192
			IResolvedBundle[] bundles = container.getBundles();
193
			IResolvedBundle[] bundles = container.getBundles();
193
			IFeature feature = model.getFeature();
194
			IFeature feature = model.getFeature();
194
			IFeaturePlugin[] plugins = feature.getPlugins();
195
			IFeaturePlugin[] plugins = feature.getPlugins();
195
			List matchInfos = new ArrayList(plugins.length);
196
			List matchInfos = new ArrayList(plugins.length);
196
			for (int i = 0; i < plugins.length; i++) {
197
			for (int i = 0; i < plugins.length; i++) {
197
				if (monitor.isCanceled()) {
198
				if (monitor.isCanceled()) {
198
					return new IResolvedBundle[0];
199
					return new IResolvedBundle[0];
199
				}
200
				}
200
				IFeaturePlugin plugin = plugins[i];
201
				IFeaturePlugin plugin = plugins[i];
201
				// only include if plug-in matches environment
202
				// only include if plug-in matches environment
202
				if (isMatch(definition.getArch(), plugin.getArch(), Platform.getOSArch()) && isMatch(definition.getNL(), plugin.getNL(), Platform.getNL()) && isMatch(definition.getOS(), plugin.getOS(), Platform.getOS()) && isMatch(definition.getWS(), plugin.getWS(), Platform.getWS())) {
203
				if (isMatch(definition.getArch(), plugin.getArch(), Platform.getOSArch()) && isMatch(definition.getNL(), plugin.getNL(), Platform.getNL()) && isMatch(definition.getOS(), plugin.getOS(), Platform.getOS()) && isMatch(definition.getWS(), plugin.getWS(), Platform.getWS())) {
203
					matchInfos.add(new BundleInfo(plugin.getId(), plugin.getVersion(), null, BundleInfo.NO_LEVEL, false));
204
					matchInfos.add(new BundleInfo(plugin.getId(), plugin.getVersion(), null, BundleInfo.NO_LEVEL, false));
204
				}
205
				}
205
			}
206
			}
206
207
207
			// Because we used the directory container to get our bundles, we need to replace their parent
208
			// Because we used the directory container to get our bundles, we need to replace their parent
208
			for (int i = 0; i < bundles.length; i++) {
209
			for (int i = 0; i < bundles.length; i++) {
209
				bundles[i].setParentContainer(this);
210
				bundles[i].setParentContainer(this);
210
			}
211
			}
211
			return AbstractBundleContainer.getMatchingBundles(bundles, (BundleInfo[]) matchInfos.toArray(new BundleInfo[matchInfos.size()]), null, this);
212
			return AbstractBundleContainer.getMatchingBundles(bundles, (BundleInfo[]) matchInfos.toArray(new BundleInfo[matchInfos.size()]), null, this);
212
		} finally {
213
		} finally {
213
			if (model != null) {
214
			if (model != null) {
214
				model.dispose();
215
				model.dispose();
215
			}
216
			}
216
		}
217
		}
217
	}
218
	}
218
219
219
	/**
220
	/**
220
	 * Returns whether the given target environment setting matches that of a fragments.
221
	 * Returns whether the given target environment setting matches that of a fragments.
221
	 * 
222
	 * 
222
	 * @param targetValue value in target definition
223
	 * @param targetValue value in target definition
223
	 * @param fragmentValue value in fragment
224
	 * @param fragmentValue value in fragment
224
	 * @param runningValue value of current running platform
225
	 * @param runningValue value of current running platform
225
	 * @return whether the fragment should be considered
226
	 * @return whether the fragment should be considered
226
	 */
227
	 */
227
	private boolean isMatch(String targetValue, String fragmentValue, String runningValue) {
228
	private boolean isMatch(String targetValue, String fragmentValue, String runningValue) {
228
		if (fragmentValue == null) {
229
		if (fragmentValue == null) {
229
			// unspecified, so it is a match
230
			// unspecified, so it is a match
230
			return true;
231
			return true;
231
		}
232
		}
232
		if (targetValue == null) {
233
		if (targetValue == null) {
233
			return runningValue.equals(fragmentValue);
234
			return runningValue.equals(fragmentValue);
234
		}
235
		}
235
		return targetValue.equals(fragmentValue);
236
		return targetValue.equals(fragmentValue);
236
	}
237
	}
237
238
238
	/* (non-Javadoc)
239
	/* (non-Javadoc)
239
	 * @see org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer#isContentEqual(org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer)
240
	 * @see org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer#isContentEqual(org.eclipse.pde.internal.core.target.impl.AbstractBundleContainer)
240
	 */
241
	 */
241
	public boolean isContentEqual(AbstractBundleContainer container) {
242
	public boolean isContentEqual(AbstractBundleContainer container) {
242
		if (container instanceof FeatureBundleContainer) {
243
		if (container instanceof FeatureBundleContainer) {
243
			FeatureBundleContainer fbc = (FeatureBundleContainer) container;
244
			FeatureBundleContainer fbc = (FeatureBundleContainer) container;
244
			return fHome.equals(fbc.fHome) && fId.equals(fbc.fId) && isNullOrEqual(fVersion, fVersion) && super.isContentEqual(container);
245
			return fHome.equals(fbc.fHome) && fId.equals(fbc.fId) && isNullOrEqual(fVersion, fVersion) && super.isContentEqual(container);
245
		}
246
		}
246
		return false;
247
		return false;
247
	}
248
	}
248
249
249
	private boolean isNullOrEqual(Object o1, Object o2) {
250
	private boolean isNullOrEqual(Object o1, Object o2) {
250
		if (o1 == null) {
251
		if (o1 == null) {
251
			return o2 == null;
252
			return o2 == null;
252
		}
253
		}
253
		if (o2 == null) {
254
		if (o2 == null) {
254
			return false;
255
			return false;
255
		}
256
		}
256
		return o1.equals(o2);
257
		return o1.equals(o2);
257
	}
258
	}
258
259
259
	/* (non-Javadoc)
260
	/* (non-Javadoc)
260
	 * @see java.lang.Object#toString()
261
	 * @see java.lang.Object#toString()
261
	 */
262
	 */
262
	public String toString() {
263
	public String toString() {
263
		return new StringBuffer().append("Feature ").append(fId).append(' ').append(fVersion).append(' ').append(fHome).append(' ').append(getIncludedBundles() == null ? "All" : Integer.toString(getIncludedBundles().length)).append(" included").toString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
264
		return new StringBuffer().append("Feature ").append(fId).append(' ').append(fVersion).append(' ').append(fHome).append(' ').append(getIncludedBundles() == null ? "All" : Integer.toString(getIncludedBundles().length)).append(" included").toString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
264
	}
265
	}
265
266
266
	/* (non-Javadoc)
267
	/* (non-Javadoc)
267
	 * @see org.eclipse.pde.internal.core.target.provisional.IBundleContainer#getVMArguments()
268
	 * @see org.eclipse.pde.internal.core.target.provisional.IBundleContainer#getVMArguments()
268
	 */
269
	 */
269
	public String[] getVMArguments() {
270
	public String[] getVMArguments() {
270
		return null;
271
		return null;
271
	}
272
	}
272
}
273
}
(-)src/org/eclipse/pde/internal/core/util/ManifestUtils.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2008 IBM Corporation and others.
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 18-23 Link Here
18
import org.eclipse.pde.core.build.IBuildEntry;
18
import org.eclipse.pde.core.build.IBuildEntry;
19
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
19
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
20
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
20
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
21
import org.eclipse.pde.internal.core.project.PDEProject;
21
22
22
public class ManifestUtils {
23
public class ManifestUtils {
23
24
Lines 74-80 Link Here
74
	}
75
	}
75
76
76
	public final static IBuild getBuild(IProject project) {
77
	public final static IBuild getBuild(IProject project) {
77
		IFile buildProps = project.getFile("build.properties"); //$NON-NLS-1$
78
		IFile buildProps = PDEProject.getBuildProperties(project);
78
		if (buildProps.exists()) {
79
		if (buildProps.exists()) {
79
			WorkspaceBuildModel model = new WorkspaceBuildModel(buildProps);
80
			WorkspaceBuildModel model = new WorkspaceBuildModel(buildProps);
80
			if (model != null)
81
			if (model != null)
(-)src_ant/org/eclipse/pde/internal/core/ant/ConvertSchemaToHTML.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 157-165 Link Here
157
157
158
		ExternalPluginModelBase model = null;
158
		ExternalPluginModelBase model = null;
159
		try {
159
		try {
160
			if (file.getName().toLowerCase(Locale.ENGLISH).equals("fragment.xml")) //$NON-NLS-1$
160
			if (file.getName().toLowerCase(Locale.ENGLISH).equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR))
161
				model = new ExternalFragmentModel();
161
				model = new ExternalFragmentModel();
162
			else if (file.getName().toLowerCase(Locale.ENGLISH).equals("plugin.xml")) //$NON-NLS-1$
162
			else if (file.getName().toLowerCase(Locale.ENGLISH).equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR))
163
				model = new ExternalPluginModel();
163
				model = new ExternalPluginModel();
164
			else {
164
			else {
165
				System.out.println(NLS.bind(PDECoreMessages.Builders_Convert_illegalValue, "manifest")); //$NON-NLS-1$ 
165
				System.out.println(NLS.bind(PDECoreMessages.Builders_Convert_illegalValue, "manifest")); //$NON-NLS-1$ 
(-)text/org/eclipse/pde/internal/core/text/build/BuildEntry.java (-3 / +61 lines)
Lines 13-23 Link Here
13
import java.io.PrintWriter;
13
import java.io.PrintWriter;
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.StringTokenizer;
15
import java.util.StringTokenizer;
16
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.resources.*;
17
import org.eclipse.core.runtime.*;
17
import org.eclipse.jface.text.IDocument;
18
import org.eclipse.jface.text.IDocument;
18
import org.eclipse.jface.text.TextUtilities;
19
import org.eclipse.jface.text.TextUtilities;
19
import org.eclipse.pde.core.build.*;
20
import org.eclipse.pde.core.build.*;
20
import org.eclipse.pde.internal.core.PDECore;
21
import org.eclipse.pde.internal.core.PDECore;
22
import org.eclipse.pde.internal.core.project.PDEProject;
21
import org.eclipse.pde.internal.core.text.IDocumentKey;
23
import org.eclipse.pde.internal.core.text.IDocumentKey;
22
import org.eclipse.pde.internal.core.text.IEditingModel;
24
import org.eclipse.pde.internal.core.text.IEditingModel;
23
import org.eclipse.pde.internal.core.util.PropertiesUtil;
25
import org.eclipse.pde.internal.core.util.PropertiesUtil;
Lines 155-162 Link Here
155
157
156
	public void processEntry(String value) {
158
	public void processEntry(String value) {
157
		StringTokenizer stok = new StringTokenizer(value, ","); //$NON-NLS-1$
159
		StringTokenizer stok = new StringTokenizer(value, ","); //$NON-NLS-1$
160
		IPath root = getRootPath();
158
		while (stok.hasMoreTokens()) {
161
		while (stok.hasMoreTokens()) {
159
			fTokens.add(stok.nextToken().trim());
162
			String token = stok.nextToken().trim();
163
			token = fromRelative(token, root);
164
			fTokens.add(token);
160
		}
165
		}
161
	}
166
	}
162
167
Lines 168-175 Link Here
168
		buffer.append(PropertiesUtil.createWritableName(fName));
173
		buffer.append(PropertiesUtil.createWritableName(fName));
169
		buffer.append(" = "); //$NON-NLS-1$
174
		buffer.append(" = "); //$NON-NLS-1$
170
		int indentLength = fName.length() + 3;
175
		int indentLength = fName.length() + 3;
176
		IPath rootPath = getRootPath();
171
		for (int i = 0; i < fTokens.size(); i++) {
177
		for (int i = 0; i < fTokens.size(); i++) {
172
			buffer.append(PropertiesUtil.createEscapedValue(fTokens.get(i).toString()));
178
			String token = fTokens.get(i).toString();
179
			token = toRelative(token, rootPath);
180
			buffer.append(PropertiesUtil.createEscapedValue(token));
173
			if (i < fTokens.size() - 1) {
181
			if (i < fTokens.size() - 1) {
174
				buffer.append(",\\"); //$NON-NLS-1$
182
				buffer.append(",\\"); //$NON-NLS-1$
175
				buffer.append(fLineDelimiter);
183
				buffer.append(fLineDelimiter);
Lines 272-275 Link Here
272
		getModel().fireModelObjectChanged(this, getName(), null, token);
280
		getModel().fireModelObjectChanged(this, getName(), null, token);
273
	}
281
	}
274
282
283
	/**
284
	 * Returns the path that this entries tokens are relative to, or <code>null</code> if none.
285
	 * 
286
	 * @return relative root path, or <code>null</code>
287
	 */
288
	IPath getRootPath() {
289
		if (fName.startsWith(IBuildEntry.JAR_PREFIX) || fName.startsWith(IBuildEntry.OUTPUT_PREFIX)) {
290
			IResource resource = getModel().getUnderlyingResource();
291
			if (resource != null) {
292
				IProject project = resource.getProject();
293
				if (project != null) {
294
					IContainer root = PDEProject.getBundleRoot(project);
295
					if (root != null && !root.equals(project)) {
296
						// translation required for source. and output. entries
297
						return root.getProjectRelativePath();
298
					}
299
				}
300
			}
301
		}
302
		return null;
303
	}
304
305
	/**
306
	 * Makes the token a bundle root relative path
307
	 * 
308
	 * @param token token
309
	 * @param root bundle root path
310
	 * @return bundle relative token
311
	 */
312
	String toRelative(String token, IPath root) {
313
		if (root == null) {
314
			return token;
315
		}
316
		return (new Path(token)).makeRelativeTo(root).toPortableString();
317
	}
318
319
	/**
320
	 * Makes the token a project relative path
321
	 * 
322
	 * @param token token
323
	 * @param root bundle root path
324
	 * @return project relative token
325
	 */
326
	String fromRelative(String token, IPath root) {
327
		if (root == null) {
328
			return token;
329
		}
330
		return root.append(new Path(token)).toPortableString();
331
	}
332
275
}
333
}
(-)src/org/eclipse/pde/internal/ds/ui/wizards/DSCreationOperation.java (-5 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 Code 9 Corporation and others.
2
 * Copyright (c) 2008, 2010 Code 9 Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 *     Code 9 Corporation - initial API and implementation
9
 *     Code 9 Corporation - initial API and implementation
10
 *     Chris Aniszczyk <caniszczyk@gmail.com>
10
 *     Chris Aniszczyk <caniszczyk@gmail.com>
11
 *     Rafael Oliveira Nobrega <rafael.oliveira@gmail.com> - bug 242028
11
 *     Rafael Oliveira Nobrega <rafael.oliveira@gmail.com> - bug 242028
12
 *     IBM - ongoing maintenance
12
 *******************************************************************************/
13
 *******************************************************************************/
13
package org.eclipse.pde.internal.ds.ui.wizards;
14
package org.eclipse.pde.internal.ds.ui.wizards;
14
15
Lines 28-38 Link Here
28
import org.eclipse.pde.core.build.IBuildEntry;
29
import org.eclipse.pde.core.build.IBuildEntry;
29
import org.eclipse.pde.core.build.IBuildModel;
30
import org.eclipse.pde.core.build.IBuildModel;
30
import org.eclipse.pde.core.build.IBuildModelFactory;
31
import org.eclipse.pde.core.build.IBuildModelFactory;
31
import org.eclipse.pde.internal.core.ICoreConstants;
32
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
32
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
33
import org.eclipse.pde.internal.core.ibundle.IBundleModel;
33
import org.eclipse.pde.internal.core.ibundle.IBundleModel;
34
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
34
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
35
import org.eclipse.pde.internal.core.natures.PDE;
35
import org.eclipse.pde.internal.core.natures.PDE;
36
import org.eclipse.pde.internal.core.project.PDEProject;
36
import org.eclipse.pde.internal.core.util.CoreUtility;
37
import org.eclipse.pde.internal.core.util.CoreUtility;
37
import org.eclipse.pde.internal.ds.core.IDSComponent;
38
import org.eclipse.pde.internal.ds.core.IDSComponent;
38
import org.eclipse.pde.internal.ds.core.IDSDocumentFactory;
39
import org.eclipse.pde.internal.ds.core.IDSDocumentFactory;
Lines 110-122 Link Here
110
	private void writeBuildProperties(final IProject project,
111
	private void writeBuildProperties(final IProject project,
111
			SubProgressMonitor monitor) {
112
			SubProgressMonitor monitor) {
112
113
113
		PDEModelUtility.modifyModel(new ModelModification(project
114
		PDEModelUtility.modifyModel(new ModelModification(PDEProject
114
				.getFile(PDEModelUtility.F_BUILD)) {
115
				.getBuildProperties(project)) {
115
			protected void modifyModel(IBaseModel model,
116
			protected void modifyModel(IBaseModel model,
116
					IProgressMonitor monitor) throws CoreException {
117
					IProgressMonitor monitor) throws CoreException {
117
				if (!(model instanceof IBuildModel))
118
				if (!(model instanceof IBuildModel))
118
					return;
119
					return;
119
				IFile file = project.getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
120
				IFile file = PDEProject.getBuildProperties(project);
120
				if (file.exists()) {
121
				if (file.exists()) {
121
					WorkspaceBuildModel wbm = new WorkspaceBuildModel(file);
122
					WorkspaceBuildModel wbm = new WorkspaceBuildModel(file);
122
					wbm.load();
123
					wbm.load();
(-)src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java (-3 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 Code 9 Corporation and others.
2
 * Copyright (c) 2008, 2010 Code 9 Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 *     Code 9 Corporation - initial API and implementation
9
 *     Code 9 Corporation - initial API and implementation
10
 *     Rafael Oliveira Nobrega <rafael.oliveira@gmail.com> - bug 242028
10
 *     Rafael Oliveira Nobrega <rafael.oliveira@gmail.com> - bug 242028
11
 *     Simon Archer <sarcher@us.ibm.com> - bug 248519
11
 *     Simon Archer <sarcher@us.ibm.com> - bug 248519
12
 *     IBM - ongoing maintenance
12
 *******************************************************************************/
13
 *******************************************************************************/
13
package org.eclipse.pde.internal.ds.ui.wizards;
14
package org.eclipse.pde.internal.ds.ui.wizards;
14
15
Lines 33-43 Link Here
33
import org.eclipse.jface.wizard.WizardDialog;
34
import org.eclipse.jface.wizard.WizardDialog;
34
import org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel;
35
import org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel;
35
import org.eclipse.pde.internal.core.natures.PDE;
36
import org.eclipse.pde.internal.core.natures.PDE;
37
import org.eclipse.pde.internal.core.project.PDEProject;
36
import org.eclipse.pde.internal.ds.ui.Activator;
38
import org.eclipse.pde.internal.ds.ui.Activator;
37
import org.eclipse.pde.internal.ds.ui.Messages;
39
import org.eclipse.pde.internal.ds.ui.Messages;
38
import org.eclipse.pde.internal.ds.ui.SWTUtil;
40
import org.eclipse.pde.internal.ds.ui.SWTUtil;
39
import org.eclipse.pde.internal.ds.ui.SharedImages;
41
import org.eclipse.pde.internal.ds.ui.SharedImages;
40
import org.eclipse.pde.internal.ui.util.PDEModelUtility;
41
import org.eclipse.swt.SWT;
42
import org.eclipse.swt.SWT;
42
import org.eclipse.swt.events.ModifyEvent;
43
import org.eclipse.swt.events.ModifyEvent;
43
import org.eclipse.swt.events.ModifyListener;
44
import org.eclipse.swt.events.ModifyListener;
Lines 127-133 Link Here
127
		try {
128
		try {
128
			if (project.hasNature(PDE.PLUGIN_NATURE)) {
129
			if (project.hasNature(PDE.PLUGIN_NATURE)) {
129
				WorkspaceBundlePluginModel model = new WorkspaceBundlePluginModel(
130
				WorkspaceBundlePluginModel model = new WorkspaceBundlePluginModel(
130
						project.getFile(PDEModelUtility.F_MANIFEST_FP), null);
131
						PDEProject.getManifest(project),
132
						null);
131
				model.load();
133
				model.load();
132
				String header = model.getBundleModel().getBundle().getHeader(
134
				String header = model.getBundleModel().getBundle().getHeader(
133
						Constants.BUNDLE_SYMBOLICNAME);
135
						Constants.BUNDLE_SYMBOLICNAME);
(-)src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java (-3 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2009 IBM Corporation and others.
2
 * Copyright (c) 2003, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 24-29 Link Here
24
import org.eclipse.pde.core.plugin.IPluginModelBase;
24
import org.eclipse.pde.core.plugin.IPluginModelBase;
25
import org.eclipse.pde.core.plugin.PluginRegistry;
25
import org.eclipse.pde.core.plugin.PluginRegistry;
26
import org.eclipse.pde.internal.core.*;
26
import org.eclipse.pde.internal.core.*;
27
import org.eclipse.pde.internal.core.project.PDEProject;
27
import org.eclipse.pde.internal.core.util.CoreUtility;
28
import org.eclipse.pde.internal.core.util.CoreUtility;
28
import org.eclipse.pde.internal.launching.IPDEConstants;
29
import org.eclipse.pde.internal.launching.IPDEConstants;
29
import org.eclipse.pde.internal.launching.PDELaunchingPlugin;
30
import org.eclipse.pde.internal.launching.PDELaunchingPlugin;
Lines 198-206 Link Here
198
					}
199
					}
199
				}
200
				}
200
			}
201
			}
201
			String[] otherFiles = {ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR, ICoreConstants.BUILD_FILENAME_DESCRIPTOR};
202
			IFile[] otherFiles = new IFile[] {PDEProject.getManifest(project), PDEProject.getBuildProperties(project)};
202
			for (int i = 0; i < otherFiles.length; i++) {
203
			for (int i = 0; i < otherFiles.length; i++) {
203
				IResource file = project.getFile(otherFiles[i]);
204
				IFile file = otherFiles[i];
204
				if (file != null) {
205
				if (file != null) {
205
					long fileTimeStamp = file.getRawLocation().toFile().lastModified();
206
					long fileTimeStamp = file.getRawLocation().toFile().lastModified();
206
					if (timeStamp < fileTimeStamp)
207
					if (timeStamp < fileTimeStamp)
(-)src/org/eclipse/pde/launching/AbstractPDELaunchConfiguration.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2009 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 21-26 Link Here
21
import org.eclipse.jdt.core.IJavaModelMarker;
21
import org.eclipse.jdt.core.IJavaModelMarker;
22
import org.eclipse.jdt.launching.*;
22
import org.eclipse.jdt.launching.*;
23
import org.eclipse.pde.core.plugin.TargetPlatform;
23
import org.eclipse.pde.core.plugin.TargetPlatform;
24
import org.eclipse.pde.internal.core.ICoreConstants;
24
import org.eclipse.pde.internal.core.TargetPlatformHelper;
25
import org.eclipse.pde.internal.core.TargetPlatformHelper;
25
import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
26
import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
26
import org.eclipse.pde.internal.launching.*;
27
import org.eclipse.pde.internal.launching.*;
Lines 234-240 Link Here
234
		// add tracing, if turned on	
235
		// add tracing, if turned on	
235
		if (configuration.getAttribute(IPDELauncherConstants.TRACING, false) && !IPDELauncherConstants.TRACING_NONE.equals(configuration.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null))) {
236
		if (configuration.getAttribute(IPDELauncherConstants.TRACING, false) && !IPDELauncherConstants.TRACING_NONE.equals(configuration.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null))) {
236
			programArgs.add("-debug"); //$NON-NLS-1$
237
			programArgs.add("-debug"); //$NON-NLS-1$
237
			programArgs.add(LaunchArgumentsHelper.getTracingFileArgument(configuration, getConfigDir(configuration).toString() + IPath.SEPARATOR + ".options")); //$NON-NLS-1$
238
			programArgs.add(LaunchArgumentsHelper.getTracingFileArgument(configuration, getConfigDir(configuration).toString() + IPath.SEPARATOR + ICoreConstants.OPTIONS_FILENAME));
238
		}
239
		}
239
240
240
		// add the program args specified by the user
241
		// add the program args specified by the user
(-)src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java (-3 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 IBM Corporation and others.
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-19 Link Here
13
 *******************************************************************************/
13
 *******************************************************************************/
14
package org.eclipse.pde.launching;
14
package org.eclipse.pde.launching;
15
15
16
17
import java.io.File;
16
import java.io.File;
18
import java.util.*;
17
import java.util.*;
19
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IProject;
Lines 149-155 Link Here
149
		// Create the .options file if tracing is turned on
148
		// Create the .options file if tracing is turned on
150
		if (configuration.getAttribute(IPDELauncherConstants.TRACING, false) && !IPDELauncherConstants.TRACING_NONE.equals(configuration.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null))) {
149
		if (configuration.getAttribute(IPDELauncherConstants.TRACING, false) && !IPDELauncherConstants.TRACING_NONE.equals(configuration.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null))) {
151
			programArgs.add("-debug"); //$NON-NLS-1$
150
			programArgs.add("-debug"); //$NON-NLS-1$
152
			String path = getConfigurationDirectory(configuration).getPath() + IPath.SEPARATOR + ".options"; //$NON-NLS-1$
151
			String path = getConfigurationDirectory(configuration).getPath() + IPath.SEPARATOR + ICoreConstants.OPTIONS_FILENAME;
153
			programArgs.add(LaunchArgumentsHelper.getTracingFileArgument(configuration, path));
152
			programArgs.add(LaunchArgumentsHelper.getTracingFileArgument(configuration, path));
154
		}
153
		}
155
154
(-)src/org/eclipse/pde/internal/ui/build/BaseBuildAction.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2009 IBM Corporation and others.
2
 * Copyright (c) 2003, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 32-37 Link Here
32
import org.eclipse.jface.viewers.IStructuredSelection;
32
import org.eclipse.jface.viewers.IStructuredSelection;
33
import org.eclipse.pde.core.plugin.TargetPlatform;
33
import org.eclipse.pde.core.plugin.TargetPlatform;
34
import org.eclipse.pde.internal.build.IXMLConstants;
34
import org.eclipse.pde.internal.build.IXMLConstants;
35
import org.eclipse.pde.internal.core.ICoreConstants;
35
import org.eclipse.pde.internal.core.PDEPreferencesManager;
36
import org.eclipse.pde.internal.core.PDEPreferencesManager;
36
import org.eclipse.pde.internal.core.exports.BuildUtilities;
37
import org.eclipse.pde.internal.core.exports.BuildUtilities;
37
import org.eclipse.pde.internal.core.natures.PDE;
38
import org.eclipse.pde.internal.core.natures.PDE;
Lines 114-120 Link Here
114
		// Force the build if autobuild is off
115
		// Force the build if autobuild is off
115
		IProject project = file.getProject();
116
		IProject project = file.getProject();
116
		if (!project.getWorkspace().isAutoBuilding()) {
117
		if (!project.getWorkspace().isAutoBuilding()) {
117
			String builderID = "feature.xml".equals(file.getName()) ? PDE.FEATURE_BUILDER_ID : PDE.MANIFEST_BUILDER_ID; //$NON-NLS-1$
118
			String builderID = ICoreConstants.FEATURE_FILENAME_DESCRIPTOR.equals(file.getName()) ? PDE.FEATURE_BUILDER_ID : PDE.MANIFEST_BUILDER_ID;
118
			project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, builderID, null, monitor);
119
			project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, builderID, null, monitor);
119
		}
120
		}
120
121
(-)src/org/eclipse/pde/internal/ui/compare/PluginStructureCreator.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
2
 * Copyright (c) 2007, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 17-22 Link Here
17
import org.eclipse.jface.resource.*;
17
import org.eclipse.jface.resource.*;
18
import org.eclipse.jface.text.IDocument;
18
import org.eclipse.jface.text.IDocument;
19
import org.eclipse.pde.core.plugin.*;
19
import org.eclipse.pde.core.plugin.*;
20
import org.eclipse.pde.internal.core.ICoreConstants;
20
import org.eclipse.pde.internal.core.text.IDocumentElementNode;
21
import org.eclipse.pde.internal.core.text.IDocumentElementNode;
21
import org.eclipse.pde.internal.core.text.plugin.*;
22
import org.eclipse.pde.internal.core.text.plugin.*;
22
import org.eclipse.pde.internal.ui.*;
23
import org.eclipse.pde.internal.ui.*;
Lines 128-134 Link Here
128
	}
129
	}
129
130
130
	private boolean isFragment(Object input) {
131
	private boolean isFragment(Object input) {
131
		if (input instanceof ITypedElement && ((ITypedElement) input).getName().equals("fragment.xml")) //$NON-NLS-1$
132
		if (input instanceof ITypedElement && ((ITypedElement) input).getName().equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR))
132
			return true;
133
			return true;
133
		return false;
134
		return false;
134
	}
135
	}
(-)src/org/eclipse/pde/internal/ui/correction/ExternalizeResolution.java (-3 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 20-28 Link Here
20
import org.eclipse.osgi.util.NLS;
20
import org.eclipse.osgi.util.NLS;
21
import org.eclipse.pde.core.IBaseModel;
21
import org.eclipse.pde.core.IBaseModel;
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
23
import org.eclipse.pde.internal.core.ICoreConstants;
23
import org.eclipse.pde.internal.core.PDEManager;
24
import org.eclipse.pde.internal.core.PDEManager;
24
import org.eclipse.pde.internal.core.ibundle.IBundle;
25
import org.eclipse.pde.internal.core.ibundle.IBundle;
25
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
26
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
27
import org.eclipse.pde.internal.core.project.PDEProject;
26
import org.eclipse.pde.internal.core.util.CoreUtility;
28
import org.eclipse.pde.internal.core.util.CoreUtility;
27
import org.eclipse.pde.internal.ui.PDEPlugin;
29
import org.eclipse.pde.internal.ui.PDEPlugin;
28
import org.eclipse.pde.internal.ui.PDEUIMessages;
30
import org.eclipse.pde.internal.ui.PDEUIMessages;
Lines 99-106 Link Here
99
		IFile file = ((IFile) marker.getResource());
101
		IFile file = ((IFile) marker.getResource());
100
		ModelModification modification = null;
102
		ModelModification modification = null;
101
		// if file we are externalizing is not manifest, try to pass manifest in if it exists
103
		// if file we are externalizing is not manifest, try to pass manifest in if it exists
102
		if (!file.getName().equals(PDEModelUtility.F_MANIFEST)) {
104
		if (!file.getName().equals(ICoreConstants.MANIFEST_FILENAME)) {
103
			IFile manifest = file.getProject().getFile(PDEModelUtility.F_MANIFEST_FP);
105
			IFile manifest = PDEProject.getManifest(file.getProject());
104
			if (manifest.exists()) {
106
			if (manifest.exists()) {
105
				modification = new ModelModification(manifest, file) {
107
				modification = new ModelModification(manifest, file) {
106
					protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException {
108
					protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException {
(-)src/org/eclipse/pde/internal/ui/correction/java/JavaResolutionFactory.java (-9 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
2
 * Copyright (c) 2008, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 26-33 Link Here
26
import org.eclipse.pde.core.IBaseModel;
26
import org.eclipse.pde.core.IBaseModel;
27
import org.eclipse.pde.core.plugin.IPluginImport;
27
import org.eclipse.pde.core.plugin.IPluginImport;
28
import org.eclipse.pde.core.plugin.IPluginModelBase;
28
import org.eclipse.pde.core.plugin.IPluginModelBase;
29
import org.eclipse.pde.internal.core.ICoreConstants;
30
import org.eclipse.pde.internal.core.ibundle.*;
29
import org.eclipse.pde.internal.core.ibundle.*;
30
import org.eclipse.pde.internal.core.project.PDEProject;
31
import org.eclipse.pde.internal.core.text.bundle.*;
31
import org.eclipse.pde.internal.core.text.bundle.*;
32
import org.eclipse.pde.internal.ui.*;
32
import org.eclipse.pde.internal.ui.*;
33
import org.eclipse.pde.internal.ui.util.ModelModification;
33
import org.eclipse.pde.internal.ui.util.ModelModification;
Lines 185-195 Link Here
185
		 * @see org.eclipse.pde.internal.ui.correction.java.JavaResolutionFactory.AbstractManifestChange#getModifiedElement()
185
		 * @see org.eclipse.pde.internal.ui.correction.java.JavaResolutionFactory.AbstractManifestChange#getModifiedElement()
186
		 */
186
		 */
187
		public Object getModifiedElement() {
187
		public Object getModifiedElement() {
188
			IPath[] paths = new IPath[] {ICoreConstants.MANIFEST_PATH, ICoreConstants.PLUGIN_PATH};
188
			IFile[] files = new IFile[] {PDEProject.getManifest(getProject()), PDEProject.getPluginXml(getProject())};
189
			for (int i = 0; i < paths.length; i++) {
189
			for (int i = 0; i < files.length; i++) {
190
				IFile file = getProject().getFile(ICoreConstants.MANIFEST_PATH);
190
				if (files[i].exists())
191
				if (file.exists())
191
					return files[i];
192
					return file;
193
			}
192
			}
194
			return super.getModifiedElement();
193
			return super.getModifiedElement();
195
		}
194
		}
Lines 272-278 Link Here
272
		 * @see org.eclipse.pde.internal.ui.correction.java.JavaResolutionFactory.AbstractManifestChange#getModifiedElement()
271
		 * @see org.eclipse.pde.internal.ui.correction.java.JavaResolutionFactory.AbstractManifestChange#getModifiedElement()
273
		 */
272
		 */
274
		public Object getModifiedElement() {
273
		public Object getModifiedElement() {
275
			IFile file = getProject().getFile(ICoreConstants.MANIFEST_PATH);
274
			IFile file = PDEProject.getManifest(getProject());
276
			if (file.exists())
275
			if (file.exists())
277
				return file;
276
				return file;
278
			return super.getModifiedElement();
277
			return super.getModifiedElement();
Lines 331-337 Link Here
331
		 * @see org.eclipse.pde.internal.ui.correction.java.JavaResolutionFactory.AbstractManifestChange#getModifiedElement()
330
		 * @see org.eclipse.pde.internal.ui.correction.java.JavaResolutionFactory.AbstractManifestChange#getModifiedElement()
332
		 */
331
		 */
333
		public Object getModifiedElement() {
332
		public Object getModifiedElement() {
334
			IFile file = getProject().getFile(ICoreConstants.MANIFEST_PATH);
333
			IFile file = PDEProject.getManifest(getProject());
335
			if (file.exists())
334
			if (file.exists())
336
				return file;
335
				return file;
337
			return super.getModifiedElement();
336
			return super.getModifiedElement();
(-)src/org/eclipse/pde/internal/ui/editor/OpenManifestAction.java (-5 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2006, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2006, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 23-30 Link Here
23
import org.eclipse.jface.viewers.ISelection;
23
import org.eclipse.jface.viewers.ISelection;
24
import org.eclipse.jface.viewers.IStructuredSelection;
24
import org.eclipse.jface.viewers.IStructuredSelection;
25
import org.eclipse.osgi.util.NLS;
25
import org.eclipse.osgi.util.NLS;
26
import org.eclipse.pde.internal.core.ICoreConstants;
27
import org.eclipse.pde.internal.core.WorkspaceModelManager;
26
import org.eclipse.pde.internal.core.WorkspaceModelManager;
27
import org.eclipse.pde.internal.core.project.PDEProject;
28
import org.eclipse.pde.internal.ui.*;
28
import org.eclipse.pde.internal.ui.*;
29
import org.eclipse.swt.custom.BusyIndicator;
29
import org.eclipse.swt.custom.BusyIndicator;
30
import org.eclipse.ui.*;
30
import org.eclipse.ui.*;
Lines 67-77 Link Here
67
						Iterator it = projects.iterator();
67
						Iterator it = projects.iterator();
68
						while (it.hasNext()) {
68
						while (it.hasNext()) {
69
							IProject project = (IProject) it.next();
69
							IProject project = (IProject) it.next();
70
							IFile file = project.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
70
							IFile file = PDEProject.getManifest(project);
71
							if (file == null || !file.exists())
71
							if (file == null || !file.exists())
72
								file = project.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
72
								file = PDEProject.getPluginXml(project);
73
							if (file == null || !file.exists())
73
							if (file == null || !file.exists())
74
								file = project.getFile(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR);
74
								file = PDEProject.getFragmentXml(project);
75
							if (file == null || !file.exists())
75
							if (file == null || !file.exists())
76
								MessageDialog.openError(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OpenManifestsAction_title, NLS.bind(PDEUIMessages.OpenManifestsAction_cannotFind, project.getName()));
76
								MessageDialog.openError(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OpenManifestsAction_title, NLS.bind(PDEUIMessages.OpenManifestsAction_cannotFind, project.getName()));
77
							else
77
							else
(-)src/org/eclipse/pde/internal/ui/editor/build/BinSection.java (-3 / +3 lines)
Lines 53-59 Link Here
53
53
54
	protected void handleBuildCheckStateChange(boolean wasTopParentChecked) {
54
	protected void handleBuildCheckStateChange(boolean wasTopParentChecked) {
55
		IResource resource = fParentResource;
55
		IResource resource = fParentResource;
56
		String resourceName = fParentResource.getProjectRelativePath().toString();
56
		String resourceName = fParentResource.getProjectRelativePath().makeRelativeTo(fBundleRoot.getProjectRelativePath()).toPortableString();
57
		IBuild build = fBuildModel.getBuild();
57
		IBuild build = fBuildModel.getBuild();
58
		IBuildEntry includes = build.getEntry(IBuildPropertiesConstants.PROPERTY_BIN_INCLUDES);
58
		IBuildEntry includes = build.getEntry(IBuildPropertiesConstants.PROPERTY_BIN_INCLUDES);
59
		IBuildEntry excludes = build.getEntry(IBuildPropertiesConstants.PROPERTY_BIN_EXCLUDES);
59
		IBuildEntry excludes = build.getEntry(IBuildPropertiesConstants.PROPERTY_BIN_EXCLUDES);
Lines 89-95 Link Here
89
					if (event.getNewValue().equals(".")) //$NON-NLS-1$
89
					if (event.getNewValue().equals(".")) //$NON-NLS-1$
90
						return;
90
						return;
91
					// adding token
91
					// adding token
92
					IFile file = fProject.getFile(new Path(event.getNewValue().toString()));
92
					IFile file = fBundleRoot.getFile(new Path(event.getNewValue().toString()));
93
					if (!file.exists())
93
					if (!file.exists())
94
						return;
94
						return;
95
					fParentResource = fOriginalResource = file;
95
					fParentResource = fOriginalResource = file;
Lines 98-104 Link Here
98
					if (event.getOldValue().equals(".")) //$NON-NLS-1$
98
					if (event.getOldValue().equals(".")) //$NON-NLS-1$
99
						return;
99
						return;
100
					// removing token
100
					// removing token
101
					IFile file = fProject.getFile(new Path(event.getOldValue().toString()));
101
					IFile file = fBundleRoot.getFile(new Path(event.getOldValue().toString()));
102
					if (!file.exists())
102
					if (!file.exists())
103
						return;
103
						return;
104
					fParentResource = fOriginalResource = file;
104
					fParentResource = fOriginalResource = file;
(-)src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java (-14 / +14 lines)
Lines 13-26 Link Here
13
13
14
import java.util.*;
14
import java.util.*;
15
import org.eclipse.core.resources.*;
15
import org.eclipse.core.resources.*;
16
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.IPath;
18
import org.eclipse.jface.action.*;
17
import org.eclipse.jface.action.*;
19
import org.eclipse.jface.viewers.*;
18
import org.eclipse.jface.viewers.*;
20
import org.eclipse.pde.core.IModelChangedEvent;
19
import org.eclipse.pde.core.IModelChangedEvent;
21
import org.eclipse.pde.core.IModelChangedListener;
20
import org.eclipse.pde.core.IModelChangedListener;
22
import org.eclipse.pde.core.build.*;
21
import org.eclipse.pde.core.build.*;
23
import org.eclipse.pde.internal.build.IBuildPropertiesConstants;
22
import org.eclipse.pde.internal.build.IBuildPropertiesConstants;
23
import org.eclipse.pde.internal.core.project.PDEProject;
24
import org.eclipse.pde.internal.ui.PDEPlugin;
24
import org.eclipse.pde.internal.ui.PDEPlugin;
25
import org.eclipse.pde.internal.ui.editor.*;
25
import org.eclipse.pde.internal.ui.editor.*;
26
import org.eclipse.pde.internal.ui.editor.context.InputContext;
26
import org.eclipse.pde.internal.ui.editor.context.InputContext;
Lines 37-43 Link Here
37
37
38
	protected CheckboxTreeViewer fTreeViewer;
38
	protected CheckboxTreeViewer fTreeViewer;
39
	private boolean fDoRefresh = false;
39
	private boolean fDoRefresh = false;
40
	protected IProject fProject;
40
	protected IContainer fBundleRoot;
41
	protected IBuildModel fBuildModel;
41
	protected IBuildModel fBuildModel;
42
	protected IResource fOriginalResource, fParentResource;
42
	protected IResource fOriginalResource, fParentResource;
43
	protected boolean isChecked;
43
	protected boolean isChecked;
Lines 45-53 Link Here
45
	public class TreeContentProvider extends DefaultContentProvider implements ITreeContentProvider {
45
	public class TreeContentProvider extends DefaultContentProvider implements ITreeContentProvider {
46
46
47
		public Object[] getElements(Object parent) {
47
		public Object[] getElements(Object parent) {
48
			if (parent instanceof IProject) {
48
			if (parent instanceof IContainer) {
49
				try {
49
				try {
50
					return ((IProject) parent).members();
50
					return ((IContainer) parent).members();
51
				} catch (CoreException e) {
51
				} catch (CoreException e) {
52
					PDEPlugin.logException(e);
52
					PDEPlugin.logException(e);
53
				}
53
				}
Lines 143-149 Link Here
143
		Composite container = createClientContainer(section, 2, toolkit);
143
		Composite container = createClientContainer(section, 2, toolkit);
144
		fBuildModel = getBuildModel();
144
		fBuildModel = getBuildModel();
145
		if (fBuildModel.getUnderlyingResource() != null)
145
		if (fBuildModel.getUnderlyingResource() != null)
146
			fProject = fBuildModel.getUnderlyingResource().getProject();
146
			fBundleRoot = PDEProject.getBundleRoot(fBuildModel.getUnderlyingResource().getProject());
147
147
148
		fTreeViewer = new CheckboxTreeViewer(toolkit.createTree(container, SWT.CHECK));
148
		fTreeViewer = new CheckboxTreeViewer(toolkit.createTree(container, SWT.CHECK));
149
		fTreeViewer.setContentProvider(new TreeContentProvider());
149
		fTreeViewer.setContentProvider(new TreeContentProvider());
Lines 196-202 Link Here
196
196
197
	protected IResource handleAllUnselected(IResource resource, String name) {
197
	protected IResource handleAllUnselected(IResource resource, String name) {
198
		IResource parent = resource.getParent();
198
		IResource parent = resource.getParent();
199
		if (parent == resource.getProject()) {
199
		if (parent.equals(fBundleRoot)) {
200
			return resource;
200
			return resource;
201
		}
201
		}
202
		try {
202
		try {
Lines 259-265 Link Here
259
							return;
259
							return;
260
						Vector fileExt = new Vector();
260
						Vector fileExt = new Vector();
261
						String[] inclTokens, exclTokens = new String[0];
261
						String[] inclTokens, exclTokens = new String[0];
262
						if (fProject == null || includes == null)
262
						if (fBundleRoot == null || includes == null)
263
							return;
263
							return;
264
						inclTokens = includes.getTokens();
264
						inclTokens = includes.getTokens();
265
						if (excludes != null)
265
						if (excludes != null)
Lines 276-282 Link Here
276
							if (resource.equals(".") || resource.equals("./") || resource.equals(".\\")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
276
							if (resource.equals(".") || resource.equals("./") || resource.equals(".\\")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
277
								// ignore - should be root directory
277
								// ignore - should be root directory
278
							} else if (resource.lastIndexOf(IPath.SEPARATOR) == resource.length() - 1) {
278
							} else if (resource.lastIndexOf(IPath.SEPARATOR) == resource.length() - 1) {
279
								IFolder folder = fProject.getFolder(resource);
279
								IFolder folder = fBundleRoot.getFolder(new Path(resource));
280
								if (!folder.exists())
280
								if (!folder.exists())
281
									continue;
281
									continue;
282
								fTreeViewer.setSubtreeChecked(folder, isIncluded);
282
								fTreeViewer.setSubtreeChecked(folder, isIncluded);
Lines 289-295 Link Here
289
								if (isIncluded)
289
								if (isIncluded)
290
									fileExt.add(resource.substring(2));
290
									fileExt.add(resource.substring(2));
291
							} else {
291
							} else {
292
								IFile file = fProject.getFile(resource);
292
								IFile file = fBundleRoot.getFile(new Path(resource));
293
								if (!file.exists())
293
								if (!file.exists())
294
									continue;
294
									continue;
295
								fTreeViewer.setChecked(file, isIncluded);
295
								fTreeViewer.setChecked(file, isIncluded);
Lines 303-309 Link Here
303
						if (fileExt.size() == 0)
303
						if (fileExt.size() == 0)
304
							return;
304
							return;
305
						try {
305
						try {
306
							IResource[] members = fProject.members();
306
							IResource[] members = fBundleRoot.members();
307
							for (int i = 0; i < members.length; i++) {
307
							for (int i = 0; i < members.length; i++) {
308
								if (!(members[i] instanceof IFolder) && (fileExt.contains(members[i].getFileExtension()))) {
308
								if (!(members[i] instanceof IFolder) && (fileExt.contains(members[i].getFileExtension()))) {
309
									fTreeViewer.setChecked(members[i], includes.contains("*." //$NON-NLS-1$
309
									fTreeViewer.setChecked(members[i], includes.contains("*." //$NON-NLS-1$
Lines 369-375 Link Here
369
				if (includes.contains(resourceName))
369
				if (includes.contains(resourceName))
370
					includes.removeToken(resourceName);
370
					includes.removeToken(resourceName);
371
				if (includes.contains("*." + resource.getFileExtension())) { //$NON-NLS-1$
371
				if (includes.contains("*." + resource.getFileExtension())) { //$NON-NLS-1$
372
					IResource[] members = fProject.members();
372
					IResource[] members = fBundleRoot.members();
373
					for (int i = 0; i < members.length; i++) {
373
					for (int i = 0; i < members.length; i++) {
374
						if (!(members[i] instanceof IFolder) && !members[i].getName().equals(resource.getName()) && (resource.getFileExtension().equals(members[i].getFileExtension()))) {
374
						if (!(members[i] instanceof IFolder) && !members[i].getName().equals(resource.getName()) && (resource.getFileExtension().equals(members[i].getFileExtension()))) {
375
							includes.addToken(members[i].getName());
375
							includes.addToken(members[i].getName());
Lines 379-385 Link Here
379
								&& libraries.length != 0) {
379
								&& libraries.length != 0) {
380
							for (int j = 0; j < libraries.length; j++) {
380
							for (int j = 0; j < libraries.length; j++) {
381
								String libName = libraries[j].getName().substring(7);
381
								String libName = libraries[j].getName().substring(7);
382
								IPath path = fProject.getFile(libName).getProjectRelativePath();
382
								IPath path = fBundleRoot.getFile(new Path(libName)).getProjectRelativePath().makeRelativeTo(fBundleRoot.getProjectRelativePath());
383
								if (path.segmentCount() == 1 && !includes.contains(libName) && !libName.equals(resource.getName()))
383
								if (path.segmentCount() == 1 && !includes.contains(libName) && !libName.equals(resource.getName()))
384
									includes.addToken(libName);
384
									includes.addToken(libName);
385
							}
385
							}
Lines 416-422 Link Here
416
	public void initialize() {
416
	public void initialize() {
417
		if (fTreeViewer.getInput() == null) {
417
		if (fTreeViewer.getInput() == null) {
418
			fTreeViewer.setUseHashlookup(true);
418
			fTreeViewer.setUseHashlookup(true);
419
			fTreeViewer.setInput(fProject);
419
			fTreeViewer.setInput(fBundleRoot);
420
		}
420
		}
421
		fBuildModel.addModelChangedListener(this);
421
		fBuildModel.addModelChangedListener(this);
422
	}
422
	}
(-)src/org/eclipse/pde/internal/ui/editor/build/BuildEditor.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2009 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 13-18 Link Here
13
import org.eclipse.core.resources.IFile;
13
import org.eclipse.core.resources.IFile;
14
import org.eclipse.jface.action.IToolBarManager;
14
import org.eclipse.jface.action.IToolBarManager;
15
import org.eclipse.pde.core.build.IBuildModel;
15
import org.eclipse.pde.core.build.IBuildModel;
16
import org.eclipse.pde.internal.core.ICoreConstants;
16
import org.eclipse.pde.internal.core.build.IBuildObject;
17
import org.eclipse.pde.internal.core.build.IBuildObject;
17
import org.eclipse.pde.internal.ui.*;
18
import org.eclipse.pde.internal.ui.*;
18
import org.eclipse.pde.internal.ui.editor.*;
19
import org.eclipse.pde.internal.ui.editor.*;
Lines 57-63 Link Here
57
		if (fInputContextManager == null)
58
		if (fInputContextManager == null)
58
			return;
59
			return;
59
		String name = file.getName();
60
		String name = file.getName();
60
		if (name.equalsIgnoreCase("build.properties")) { //$NON-NLS-1$
61
		if (name.equalsIgnoreCase(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
61
			if (!fInputContextManager.hasContext(BuildInputContext.CONTEXT_ID)) {
62
			if (!fInputContextManager.hasContext(BuildInputContext.CONTEXT_ID)) {
62
				IEditorInput in = new FileEditorInput(file);
63
				IEditorInput in = new FileEditorInput(file);
63
				fInputContextManager.putContext(in, new BuildInputContext(this, in, false));
64
				fInputContextManager.putContext(in, new BuildInputContext(this, in, false));
(-)src/org/eclipse/pde/internal/ui/editor/build/SrcSection.java (-1 / +1 lines)
Lines 54-60 Link Here
54
54
55
	protected void handleBuildCheckStateChange(boolean wasTopParentChecked) {
55
	protected void handleBuildCheckStateChange(boolean wasTopParentChecked) {
56
		IResource resource = fParentResource;
56
		IResource resource = fParentResource;
57
		String resourceName = fParentResource.getFullPath().removeFirstSegments(1).toString();
57
		String resourceName = fParentResource.getProjectRelativePath().makeRelativeTo(fBundleRoot.getProjectRelativePath()).toPortableString();
58
		IBuild build = fBuildModel.getBuild();
58
		IBuild build = fBuildModel.getBuild();
59
		IBuildEntry includes = build.getEntry(IBuildPropertiesConstants.PROPERTY_SRC_INCLUDES);
59
		IBuildEntry includes = build.getEntry(IBuildPropertiesConstants.PROPERTY_SRC_INCLUDES);
60
		IBuildEntry excludes = build.getEntry(IBuildPropertiesConstants.PROPERTY_SRC_EXCLUDES);
60
		IBuildEntry excludes = build.getEntry(IBuildPropertiesConstants.PROPERTY_SRC_EXCLUDES);
(-)src/org/eclipse/pde/internal/ui/editor/feature/DataSection.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 19-24 Link Here
19
import org.eclipse.jface.viewers.*;
19
import org.eclipse.jface.viewers.*;
20
import org.eclipse.pde.core.IModel;
20
import org.eclipse.pde.core.IModel;
21
import org.eclipse.pde.core.IModelChangedEvent;
21
import org.eclipse.pde.core.IModelChangedEvent;
22
import org.eclipse.pde.internal.core.ICoreConstants;
22
import org.eclipse.pde.internal.core.feature.FeatureData;
23
import org.eclipse.pde.internal.core.feature.FeatureData;
23
import org.eclipse.pde.internal.core.feature.FeaturePlugin;
24
import org.eclipse.pde.internal.core.feature.FeaturePlugin;
24
import org.eclipse.pde.internal.core.ifeature.*;
25
import org.eclipse.pde.internal.core.ifeature.*;
Lines 168-174 Link Here
168
	}
169
	}
169
170
170
	private boolean canAdd(IFeatureModel model, String path) {
171
	private boolean canAdd(IFeatureModel model, String path) {
171
		if ("feature.xml".equals(path)) //$NON-NLS-1$
172
		if (ICoreConstants.FEATURE_FILENAME_DESCRIPTOR.equals(path))
172
			return false;
173
			return false;
173
		IFeatureData[] data = model.getFeature().getData();
174
		IFeatureData[] data = model.getFeature().getData();
174
		for (int i = 0; i < data.length; i++) {
175
		for (int i = 0; i < data.length; i++) {
(-)src/org/eclipse/pde/internal/ui/editor/feature/FeatureEditor.java (-16 / +16 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 25-30 Link Here
25
import org.eclipse.pde.internal.core.ICoreConstants;
25
import org.eclipse.pde.internal.core.ICoreConstants;
26
import org.eclipse.pde.internal.core.build.IBuildObject;
26
import org.eclipse.pde.internal.core.build.IBuildObject;
27
import org.eclipse.pde.internal.core.ifeature.*;
27
import org.eclipse.pde.internal.core.ifeature.*;
28
import org.eclipse.pde.internal.core.project.PDEProject;
28
import org.eclipse.pde.internal.ui.*;
29
import org.eclipse.pde.internal.ui.*;
29
import org.eclipse.pde.internal.ui.editor.*;
30
import org.eclipse.pde.internal.ui.editor.*;
30
import org.eclipse.pde.internal.ui.editor.build.*;
31
import org.eclipse.pde.internal.ui.editor.build.*;
Lines 68-74 Link Here
68
				if (resource != null)
69
				if (resource != null)
69
					input = new FileEditorInput((IFile) resource);
70
					input = new FileEditorInput((IFile) resource);
70
				else {
71
				else {
71
					File file = new File(model.getInstallLocation(), "feature.xml"); //$NON-NLS-1$
72
					File file = new File(model.getInstallLocation(), ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
72
					IFileStore store = EFS.getStore(file.toURI());
73
					IFileStore store = EFS.getStore(file.toURI());
73
					input = new FileStoreEditorInput(store);
74
					input = new FileStoreEditorInput(store);
74
				}
75
				}
Lines 94-103 Link Here
94
		IFile featureFile = null;
95
		IFile featureFile = null;
95
96
96
		String name = file.getName().toLowerCase(Locale.ENGLISH);
97
		String name = file.getName().toLowerCase(Locale.ENGLISH);
97
		if (name.equals("feature.xml")) { //$NON-NLS-1$
98
		if (name.equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) {
98
			featureFile = file;
99
			featureFile = file;
99
			buildFile = project.getFile("build.properties"); //$NON-NLS-1$
100
			buildFile = project.getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
100
		} else if (name.equals("build.properties")) { //$NON-NLS-1$
101
		} else if (name.equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
101
			buildFile = file;
102
			buildFile = file;
102
			featureFile = createFeatureFile(project);
103
			featureFile = createFeatureFile(project);
103
		}
104
		}
Lines 123-135 Link Here
123
		if (fInputContextManager == null)
124
		if (fInputContextManager == null)
124
			return;
125
			return;
125
		String name = file.getName();
126
		String name = file.getName();
126
		if (name.equalsIgnoreCase("feature.xml")) { //$NON-NLS-1$
127
		if (name.equalsIgnoreCase(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) {
127
			/*
128
			/*
128
			 * IEditorInput in = new FileEditorInput(file);
129
			 * IEditorInput in = new FileEditorInput(file);
129
			 * inputContextManager.putContext(in, new FeatureInputContext(this,
130
			 * inputContextManager.putContext(in, new FeatureInputContext(this,
130
			 * in, false));
131
			 * in, false));
131
			 */
132
			 */
132
		} else if (name.equalsIgnoreCase("build.properties")) { //$NON-NLS-1$
133
		} else if (name.equalsIgnoreCase(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
133
			if (!fInputContextManager.hasContext(BuildInputContext.CONTEXT_ID)) {
134
			if (!fInputContextManager.hasContext(BuildInputContext.CONTEXT_ID)) {
134
				IEditorInput in = new FileEditorInput(file);
135
				IEditorInput in = new FileEditorInput(file);
135
				fInputContextManager.putContext(in, new BuildInputContext(this, in, false));
136
				fInputContextManager.putContext(in, new BuildInputContext(this, in, false));
Lines 163-173 Link Here
163
		File buildFile = null;
164
		File buildFile = null;
164
		File featureFile = null;
165
		File featureFile = null;
165
		String name = file.getName().toLowerCase(Locale.ENGLISH);
166
		String name = file.getName().toLowerCase(Locale.ENGLISH);
166
		if (name.equals("feature.xml")) { //$NON-NLS-1$
167
		if (name.equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) {
167
			featureFile = file;
168
			featureFile = file;
168
			File dir = file.getParentFile();
169
			File dir = file.getParentFile();
169
			buildFile = new File(dir, "build.properties"); //$NON-NLS-1$
170
			buildFile = new File(dir, ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
170
		} else if (name.equals("build.properties")) { //$NON-NLS-1$
171
		} else if (name.equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
171
			buildFile = file;
172
			buildFile = file;
172
			File dir = file.getParentFile();
173
			File dir = file.getParentFile();
173
			featureFile = createFeatureFile(dir);
174
			featureFile = createFeatureFile(dir);
Lines 189-208 Link Here
189
	}
190
	}
190
191
191
	private File createFeatureFile(File dir) {
192
	private File createFeatureFile(File dir) {
192
		File pluginFile = new File(dir, "plugin.xml"); //$NON-NLS-1$
193
		File pluginFile = new File(dir, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
193
		return pluginFile;
194
		return pluginFile;
194
	}
195
	}
195
196
196
	private IFile createFeatureFile(IProject project) {
197
	private IFile createFeatureFile(IProject project) {
197
		IFile featureFile = project.getFile(ICoreConstants.FEATURE_PATH);
198
		return PDEProject.getFeatureXml(project);
198
		return featureFile;
199
	}
199
	}
200
200
201
	protected void createStorageContexts(InputContextManager manager, IStorageEditorInput input) {
201
	protected void createStorageContexts(InputContextManager manager, IStorageEditorInput input) {
202
		String name = input.getName().toLowerCase(Locale.ENGLISH);
202
		String name = input.getName().toLowerCase(Locale.ENGLISH);
203
		if (name.equals("build.properties")) { //$NON-NLS-1$
203
		if (name.equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
204
			manager.putContext(input, new BuildInputContext(this, input, true));
204
			manager.putContext(input, new BuildInputContext(this, input, true));
205
		} else if (name.startsWith("feature.xml")) { //$NON-NLS-1$
205
		} else if (name.startsWith(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) {
206
			manager.putContext(input, new FeatureInputContext(this, input, true));
206
			manager.putContext(input, new FeatureInputContext(this, input, true));
207
		}
207
		}
208
	}
208
	}
Lines 343-349 Link Here
343
343
344
	public void showEditorInput(IEditorInput editorInput) {
344
	public void showEditorInput(IEditorInput editorInput) {
345
		String name = editorInput.getName();
345
		String name = editorInput.getName();
346
		if (name.equals("feature.xml")) { //$NON-NLS-1$
346
		if (name.equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) {
347
			setActivePage(0);
347
			setActivePage(0);
348
		} else {
348
		} else {
349
			setActivePage(getPageCount() - 3);
349
			setActivePage(getPageCount() - 3);
(-)src/org/eclipse/pde/internal/ui/editor/feature/FeatureEditorMatchingStrategy.java (-10 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 12-25 Link Here
12
package org.eclipse.pde.internal.ui.editor.feature;
12
package org.eclipse.pde.internal.ui.editor.feature;
13
13
14
import org.eclipse.core.resources.IFile;
14
import org.eclipse.core.resources.IFile;
15
import org.eclipse.pde.internal.core.ICoreConstants;
15
import org.eclipse.ui.*;
16
import org.eclipse.ui.*;
16
import org.eclipse.ui.ide.ResourceUtil;
17
import org.eclipse.ui.ide.ResourceUtil;
17
18
18
public class FeatureEditorMatchingStrategy implements IEditorMatchingStrategy {
19
public class FeatureEditorMatchingStrategy implements IEditorMatchingStrategy {
19
20
20
	private static final String BP = "build.properties"; //$NON-NLS-1$
21
	private static final String FX = "feature.xml"; //$NON-NLS-1$
22
23
	public boolean matches(IEditorReference editorRef, IEditorInput input) {
21
	public boolean matches(IEditorReference editorRef, IEditorInput input) {
24
		if (!(input instanceof IFileEditorInput))
22
		if (!(input instanceof IFileEditorInput))
25
			return false;
23
			return false;
Lines 34-46 Link Here
34
				return false;
32
				return false;
35
			// build.properties matches with editors that have a feature.xml file
33
			// build.properties matches with editors that have a feature.xml file
36
			// as their input and that feature.xml is at the root
34
			// as their input and that feature.xml is at the root
37
			if (inputFile.getName().equals(FX)) {
35
			if (inputFile.getName().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) {
38
				if (currInputFile.getName().equals(BP))
36
				if (currInputFile.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR))
39
					return inputFile.getProjectRelativePath().toString().equals(FX);
37
					return inputFile.getProjectRelativePath().toString().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
40
				return inputFile.equals(currInputFile);
38
				return inputFile.equals(currInputFile);
41
			} else if (inputFile.getName().equals(BP)) {
39
			} else if (inputFile.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
42
				if (currInputFile.getName().equals(FX))
40
				if (currInputFile.getName().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR))
43
					return currInputFile.getProjectRelativePath().toString().equals(FX);
41
					return currInputFile.getProjectRelativePath().toString().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
44
				return inputFile.equals(currInputFile);
42
				return inputFile.equals(currInputFile);
45
			}
43
			}
46
			return false;
44
			return false;
(-)src/org/eclipse/pde/internal/ui/editor/plugin/CreateManifestOperation.java (-4 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 18-25 Link Here
18
import org.eclipse.jface.operation.IRunnableWithProgress;
18
import org.eclipse.jface.operation.IRunnableWithProgress;
19
import org.eclipse.jface.text.*;
19
import org.eclipse.jface.text.*;
20
import org.eclipse.pde.core.plugin.IPluginModelBase;
20
import org.eclipse.pde.core.plugin.IPluginModelBase;
21
import org.eclipse.pde.internal.core.*;
21
import org.eclipse.pde.internal.core.ClasspathHelper;
22
import org.eclipse.pde.internal.core.TargetPlatformHelper;
22
import org.eclipse.pde.internal.core.converter.PDEPluginConverter;
23
import org.eclipse.pde.internal.core.converter.PDEPluginConverter;
24
import org.eclipse.pde.internal.core.project.PDEProject;
23
import org.eclipse.text.edits.*;
25
import org.eclipse.text.edits.*;
24
26
25
public class CreateManifestOperation implements IRunnableWithProgress {
27
public class CreateManifestOperation implements IRunnableWithProgress {
Lines 49-56 Link Here
49
51
50
	private void trimOldManifest() throws BadLocationException, CoreException {
52
	private void trimOldManifest() throws BadLocationException, CoreException {
51
		ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
53
		ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
52
		String filename = fModel.isFragmentModel() ? ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR : ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR;
54
		IProject project = fModel.getUnderlyingResource().getProject();
53
		IFile file = fModel.getUnderlyingResource().getProject().getFile(filename);
55
		IFile file = fModel.isFragmentModel() ? PDEProject.getFragmentXml(project) : PDEProject.getPluginXml(project);
54
		try {
56
		try {
55
			manager.connect(file.getFullPath(), LocationKind.NORMALIZE, null);
57
			manager.connect(file.getFullPath(), LocationKind.NORMALIZE, null);
56
			ITextFileBuffer buffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.NORMALIZE);
58
			ITextFileBuffer buffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.NORMALIZE);
(-)src/org/eclipse/pde/internal/ui/editor/plugin/DependencyManagementSection.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 31-36 Link Here
31
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
31
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
32
import org.eclipse.pde.internal.core.plugin.ExternalPluginModel;
32
import org.eclipse.pde.internal.core.plugin.ExternalPluginModel;
33
import org.eclipse.pde.internal.core.plugin.WorkspacePluginModel;
33
import org.eclipse.pde.internal.core.plugin.WorkspacePluginModel;
34
import org.eclipse.pde.internal.core.project.PDEProject;
34
import org.eclipse.pde.internal.core.text.build.BuildEntry;
35
import org.eclipse.pde.internal.core.text.build.BuildEntry;
35
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
36
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
36
import org.eclipse.pde.internal.launching.PDELaunchingPlugin;
37
import org.eclipse.pde.internal.launching.PDELaunchingPlugin;
Lines 339-345 Link Here
339
		InputContext context = getPage().getPDEEditor().getContextManager().findContext(BuildInputContext.CONTEXT_ID);
340
		InputContext context = getPage().getPDEEditor().getContextManager().findContext(BuildInputContext.CONTEXT_ID);
340
		if (context == null) {
341
		if (context == null) {
341
			if (createIfMissing) {
342
			if (createIfMissing) {
342
				IFile buildFile = getPage().getPDEEditor().getCommonProject().getFile("build.properties"); //$NON-NLS-1$
343
				IFile buildFile = PDEProject.getBuildProperties(getPage().getPDEEditor().getCommonProject());
343
				try {
344
				try {
344
					buildFile.create(new ByteArrayInputStream(new byte[0]), true, new NullProgressMonitor());
345
					buildFile.create(new ByteArrayInputStream(new byte[0]), true, new NullProgressMonitor());
345
				} catch (CoreException e) {
346
				} catch (CoreException e) {
(-)src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 29-34 Link Here
29
import org.eclipse.pde.internal.core.*;
29
import org.eclipse.pde.internal.core.*;
30
import org.eclipse.pde.internal.core.bundle.BundlePluginBase;
30
import org.eclipse.pde.internal.core.bundle.BundlePluginBase;
31
import org.eclipse.pde.internal.core.ibundle.*;
31
import org.eclipse.pde.internal.core.ibundle.*;
32
import org.eclipse.pde.internal.core.project.PDEProject;
32
import org.eclipse.pde.internal.core.text.bundle.*;
33
import org.eclipse.pde.internal.core.text.bundle.*;
33
import org.eclipse.pde.internal.core.util.PDEJavaHelper;
34
import org.eclipse.pde.internal.core.util.PDEJavaHelper;
34
import org.eclipse.pde.internal.ui.*;
35
import org.eclipse.pde.internal.ui.*;
Lines 513-519 Link Here
513
				// add un-exported packages in workspace non-binary plug-ins
514
				// add un-exported packages in workspace non-binary plug-ins
514
				IResource resource = models[i].getUnderlyingResource();
515
				IResource resource = models[i].getUnderlyingResource();
515
				IProject project = resource != null ? resource.getProject() : null;
516
				IProject project = resource != null ? resource.getProject() : null;
516
				if (project == null || !project.hasNature(JavaCore.NATURE_ID) || WorkspaceModelManager.isBinaryProject(project) || !project.exists(ICoreConstants.MANIFEST_PATH))
517
				if (project == null || !project.hasNature(JavaCore.NATURE_ID) || WorkspaceModelManager.isBinaryProject(project) || !PDEProject.getManifest(project).exists())
517
					continue;
518
					continue;
518
				IJavaProject jp = JavaCore.create(project);
519
				IJavaProject jp = JavaCore.create(project);
519
				IPackageFragmentRoot[] roots = jp.getPackageFragmentRoots();
520
				IPackageFragmentRoot[] roots = jp.getPackageFragmentRoots();
(-)src/org/eclipse/pde/internal/ui/editor/plugin/ManifestEditor.java (-32 / +35 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2009 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 31-36 Link Here
31
import org.eclipse.pde.internal.core.build.IBuildObject;
31
import org.eclipse.pde.internal.core.build.IBuildObject;
32
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelProvider;
32
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelProvider;
33
import org.eclipse.pde.internal.core.plugin.*;
33
import org.eclipse.pde.internal.core.plugin.*;
34
import org.eclipse.pde.internal.core.project.PDEProject;
34
import org.eclipse.pde.internal.core.util.CoreUtility;
35
import org.eclipse.pde.internal.core.util.CoreUtility;
35
import org.eclipse.pde.internal.ui.*;
36
import org.eclipse.pde.internal.ui.*;
36
import org.eclipse.pde.internal.ui.editor.*;
37
import org.eclipse.pde.internal.ui.editor.*;
Lines 168-182 Link Here
168
		boolean fragment = false;
169
		boolean fragment = false;
169
170
170
		String name = file.getName().toLowerCase(Locale.ENGLISH);
171
		String name = file.getName().toLowerCase(Locale.ENGLISH);
171
		if (name.equals("manifest.mf")) { //$NON-NLS-1$
172
		if (name.equals(ICoreConstants.MANIFEST_FILENAME_LOWER_CASE)) {
172
			if (container instanceof IFolder)
173
			if (container instanceof IFolder)
173
				container = container.getParent();
174
				container = container.getParent();
174
			manifestFile = file;
175
			manifestFile = file;
175
			buildFile = container.getFile(ICoreConstants.BUILD_PROPERTIES_PATH);
176
			buildFile = container.getFile(ICoreConstants.BUILD_PROPERTIES_PATH);
176
			pluginFile = createPluginFile(container);
177
			pluginFile = createPluginFile(container);
177
		} else if (name.equals("plugin.xml") || name.equals("fragment.xml")) { //$NON-NLS-1$ //$NON-NLS-2$
178
		} else if (name.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)) {
178
			pluginFile = file;
179
			pluginFile = file;
179
			fragment = name.equals("fragment.xml"); //$NON-NLS-1$
180
			fragment = name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR);
180
			buildFile = container.getFile(ICoreConstants.BUILD_PROPERTIES_PATH);
181
			buildFile = container.getFile(ICoreConstants.BUILD_PROPERTIES_PATH);
181
			manifestFile = container.getFile(ICoreConstants.MANIFEST_PATH);
182
			manifestFile = container.getFile(ICoreConstants.MANIFEST_PATH);
182
		}
183
		}
Lines 213-234 Link Here
213
		if (fInputContextManager == null)
214
		if (fInputContextManager == null)
214
			return;
215
			return;
215
		String name = file.getName();
216
		String name = file.getName();
216
		if (name.equalsIgnoreCase("MANIFEST.MF")) { //$NON-NLS-1$
217
		if (name.equalsIgnoreCase(ICoreConstants.MANIFEST_FILENAME)) {
217
			if (!fInputContextManager.hasContext(BundleInputContext.CONTEXT_ID)) {
218
			if (!fInputContextManager.hasContext(BundleInputContext.CONTEXT_ID)) {
218
				IEditorInput in = new FileEditorInput(file);
219
				IEditorInput in = new FileEditorInput(file);
219
				fInputContextManager.putContext(in, new BundleInputContext(this, in, false));
220
				fInputContextManager.putContext(in, new BundleInputContext(this, in, false));
220
			}
221
			}
221
		} else if (name.equalsIgnoreCase("plugin.xml")) { //$NON-NLS-1$
222
		} else if (name.equalsIgnoreCase(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)) {
222
			if (!fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID)) {
223
			if (!fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID)) {
223
				IEditorInput in = new FileEditorInput(file);
224
				IEditorInput in = new FileEditorInput(file);
224
				fInputContextManager.putContext(in, new PluginInputContext(this, in, false, false));
225
				fInputContextManager.putContext(in, new PluginInputContext(this, in, false, false));
225
			}
226
			}
226
		} else if (name.equalsIgnoreCase("fragment.xml")) { //$NON-NLS-1$
227
		} else if (name.equalsIgnoreCase(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)) {
227
			if (!fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID)) {
228
			if (!fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID)) {
228
				IEditorInput in = new FileEditorInput(file);
229
				IEditorInput in = new FileEditorInput(file);
229
				fInputContextManager.putContext(in, new PluginInputContext(this, in, false, true));
230
				fInputContextManager.putContext(in, new PluginInputContext(this, in, false, true));
230
			}
231
			}
231
		} else if (name.equalsIgnoreCase("build.properties")) { //$NON-NLS-1$
232
		} else if (name.equalsIgnoreCase(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
232
			if (!fInputContextManager.hasContext(BuildInputContext.CONTEXT_ID)) {
233
			if (!fInputContextManager.hasContext(BuildInputContext.CONTEXT_ID)) {
233
				IEditorInput in = new FileEditorInput(file);
234
				IEditorInput in = new FileEditorInput(file);
234
				fInputContextManager.putContext(in, new BuildInputContext(this, in, false));
235
				fInputContextManager.putContext(in, new BuildInputContext(this, in, false));
Lines 240-252 Link Here
240
		if (fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID))
241
		if (fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID))
241
			return;
242
			return;
242
		IProject project = fInputContextManager.getCommonProject();
243
		IProject project = fInputContextManager.getCommonProject();
243
		String name = (fInputContextManager.getAggregateModel() instanceof IFragmentModel) ? ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR : ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR;
244
		WorkspacePluginModelBase model = null;
244
		IFile file = project.getFile(name);
245
		IFile file = null;
245
		WorkspacePluginModelBase model;
246
		if (fInputContextManager.getAggregateModel() instanceof IFragmentModel) {
246
		if (name.equals("fragment.xml")) //$NON-NLS-1$
247
			file = PDEProject.getFragmentXml(project);
247
			model = new WorkspaceFragmentModel(file, false);
248
			model = new WorkspaceFragmentModel(file, false);
248
		else
249
		} else {
250
			file = PDEProject.getPluginXml(project);
249
			model = new WorkspacePluginModel(file, false);
251
			model = new WorkspacePluginModel(file, false);
252
		}
250
253
251
		IPluginBase pluginBase = model.getPluginBase(true);
254
		IPluginBase pluginBase = model.getPluginBase(true);
252
		try {
255
		try {
Lines 257-263 Link Here
257
		IEditorInput in = new FileEditorInput(file);
260
		IEditorInput in = new FileEditorInput(file);
258
		fInputContextManager.putContext(in, new PluginInputContext(this, in, false, false));
261
		fInputContextManager.putContext(in, new PluginInputContext(this, in, false, false));
259
262
260
		updateBuildProperties(name);
263
		updateBuildProperties(file.getName());
261
	}
264
	}
262
265
263
	private void updateBuildProperties(String filename) {
266
	private void updateBuildProperties(String filename) {
Lines 323-339 Link Here
323
		File buildFile = null;
326
		File buildFile = null;
324
		File pluginFile = null;
327
		File pluginFile = null;
325
		String name = file.getName().toLowerCase(Locale.ENGLISH);
328
		String name = file.getName().toLowerCase(Locale.ENGLISH);
326
		if (name.equals("manifest.mf")) { //$NON-NLS-1$
329
		if (name.equals(ICoreConstants.MANIFEST_FILENAME_LOWER_CASE)) {
327
			manifestFile = file;
330
			manifestFile = file;
328
			File dir = file.getParentFile().getParentFile();
331
			File dir = file.getParentFile().getParentFile();
329
			buildFile = new File(dir, "build.properties"); //$NON-NLS-1$
332
			buildFile = new File(dir, ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
330
			pluginFile = createPluginFile(dir);
333
			pluginFile = createPluginFile(dir);
331
		} else if (name.equals("build.properties")) { //$NON-NLS-1$
334
		} else if (name.equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
332
			buildFile = file;
335
			buildFile = file;
333
			File dir = file.getParentFile();
336
			File dir = file.getParentFile();
334
			pluginFile = createPluginFile(dir);
337
			pluginFile = createPluginFile(dir);
335
			manifestFile = new File(dir, ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
338
			manifestFile = new File(dir, ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
336
		} else if (name.equals("plugin.xml") || name.equals("fragment.xml")) { //$NON-NLS-1$ //$NON-NLS-2$
339
		} else if (name.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)) {
337
			pluginFile = file;
340
			pluginFile = file;
338
			File dir = file.getParentFile();
341
			File dir = file.getParentFile();
339
			buildFile = new File(dir, ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
342
			buildFile = new File(dir, ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
Lines 348-354 Link Here
348
			if (pluginFile.exists()) {
351
			if (pluginFile.exists()) {
349
				IFileStore store = EFS.getStore(pluginFile.toURI());
352
				IFileStore store = EFS.getStore(pluginFile.toURI());
350
				IEditorInput in = new FileStoreEditorInput(store);
353
				IEditorInput in = new FileStoreEditorInput(store);
351
				manager.putContext(in, new PluginInputContext(this, in, file == pluginFile, name.equals("fragment.xml"))); //$NON-NLS-1$
354
				manager.putContext(in, new PluginInputContext(this, in, file == pluginFile, name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)));
352
			}
355
			}
353
			if (buildFile.exists()) {
356
			if (buildFile.exists()) {
354
				IFileStore store = EFS.getStore(buildFile.toURI());
357
				IFileStore store = EFS.getStore(buildFile.toURI());
Lines 381-393 Link Here
381
		}
384
		}
382
385
383
		String name = input.getName().toLowerCase(Locale.ENGLISH);
386
		String name = input.getName().toLowerCase(Locale.ENGLISH);
384
		if (name.startsWith("manifest.mf")) { //$NON-NLS-1$
387
		if (name.startsWith(ICoreConstants.MANIFEST_FILENAME_LOWER_CASE)) {
385
			manager.putContext(input, new BundleInputContext(this, input, true));
388
			manager.putContext(input, new BundleInputContext(this, input, true));
386
		} else if (name.startsWith("build.properties")) { //$NON-NLS-1$
389
		} else if (name.startsWith(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
387
			manager.putContext(input, new BuildInputContext(this, input, true));
390
			manager.putContext(input, new BuildInputContext(this, input, true));
388
		} else if (name.startsWith("plugin.xml")) { //$NON-NLS-1$
391
		} else if (name.startsWith(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)) {
389
			manager.putContext(input, new PluginInputContext(this, input, true, false));
392
			manager.putContext(input, new PluginInputContext(this, input, true, false));
390
		} else if (name.startsWith("fragment.xml")) { //$NON-NLS-1$
393
		} else if (name.startsWith(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)) {
391
			manager.putContext(input, new PluginInputContext(this, input, true, true));
394
			manager.putContext(input, new PluginInputContext(this, input, true, true));
392
		}
395
		}
393
	}
396
	}
Lines 401-420 Link Here
401
404
402
			if (zip.getEntry(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR) != null) {
405
			if (zip.getEntry(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR) != null) {
403
				input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR));
406
				input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR));
404
				manager.putContext(input, new BundleInputContext(this, input, storage.getName().equals("MANIFEST.MF"))); //$NON-NLS-1$
407
				manager.putContext(input, new BundleInputContext(this, input, storage.getName().equals(ICoreConstants.MANIFEST_FILENAME)));
405
			}
408
			}
406
409
407
			if (zip.getEntry(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) != null) {
410
			if (zip.getEntry(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) != null) {
408
				input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR));
411
				input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR));
409
				manager.putContext(input, new PluginInputContext(this, input, storage.getName().equals("plugin.xml"), false)); //$NON-NLS-1$
412
				manager.putContext(input, new PluginInputContext(this, input, storage.getName().equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR), false));
410
			} else if (zip.getEntry(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR) != null) {
413
			} else if (zip.getEntry(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR) != null) {
411
				input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR));
414
				input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR));
412
				manager.putContext(input, new PluginInputContext(this, input, storage.getName().equals("fragment.xml"), true)); //$NON-NLS-1$
415
				manager.putContext(input, new PluginInputContext(this, input, storage.getName().equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR), true));
413
			}
416
			}
414
417
415
			if (zip.getEntry(ICoreConstants.BUILD_FILENAME_DESCRIPTOR) != null) {
418
			if (zip.getEntry(ICoreConstants.BUILD_FILENAME_DESCRIPTOR) != null) {
416
				input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.BUILD_FILENAME_DESCRIPTOR));
419
				input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.BUILD_FILENAME_DESCRIPTOR));
417
				manager.putContext(input, new BuildInputContext(this, input, storage.getName().equals("build.properties"))); //$NON-NLS-1$
420
				manager.putContext(input, new BuildInputContext(this, input, storage.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)));
418
			}
421
			}
419
		} finally {
422
		} finally {
420
			try {
423
			try {
Lines 616-626 Link Here
616
		InputContext context = null;
619
		InputContext context = null;
617
		if (object instanceof IFile) {
620
		if (object instanceof IFile) {
618
			String name = ((IFile) object).getName();
621
			String name = ((IFile) object).getName();
619
			if (name.equals("plugin.xml") || name.equals("fragment.xml")) //$NON-NLS-1$ //$NON-NLS-2$
622
			if (name.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR))
620
				context = fInputContextManager.findContext(PluginInputContext.CONTEXT_ID);
623
				context = fInputContextManager.findContext(PluginInputContext.CONTEXT_ID);
621
			else if (name.equals("MANIFEST.MF")) //$NON-NLS-1$
624
			else if (name.equals(ICoreConstants.MANIFEST_FILENAME))
622
				context = fInputContextManager.findContext(BundleInputContext.CONTEXT_ID);
625
				context = fInputContextManager.findContext(BundleInputContext.CONTEXT_ID);
623
			else if (name.equals("build.properties")) //$NON-NLS-1$
626
			else if (name.equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR))
624
				context = fInputContextManager.findContext(BuildInputContext.CONTEXT_ID);
627
				context = fInputContextManager.findContext(BuildInputContext.CONTEXT_ID);
625
		} else if (object instanceof IBuildObject) {
628
		} else if (object instanceof IBuildObject) {
626
			context = fInputContextManager.findContext(BuildInputContext.CONTEXT_ID);
629
			context = fInputContextManager.findContext(BuildInputContext.CONTEXT_ID);
Lines 640-649 Link Here
640
	public void showEditorInput(IEditorInput editorInput) {
643
	public void showEditorInput(IEditorInput editorInput) {
641
		String name = editorInput.getName();
644
		String name = editorInput.getName();
642
		String id = getActivePageInstance().getId();
645
		String id = getActivePageInstance().getId();
643
		if (name.equals("build.properties")) { //$NON-NLS-1$
646
		if (name.equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
644
			if (!BuildInputContext.CONTEXT_ID.equals(id))
647
			if (!BuildInputContext.CONTEXT_ID.equals(id))
645
				setActivePage(SHOW_SOURCE ? BuildInputContext.CONTEXT_ID : BuildPage.PAGE_ID);
648
				setActivePage(SHOW_SOURCE ? BuildInputContext.CONTEXT_ID : BuildPage.PAGE_ID);
646
		} else if (name.equals("plugin.xml") || name.equals("fragment.xml")) { //$NON-NLS-1$ //$NON-NLS-2$
649
		} else if (name.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)) {
647
			if (!PluginInputContext.CONTEXT_ID.equals(id)) {
650
			if (!PluginInputContext.CONTEXT_ID.equals(id)) {
648
				if (SHOW_SOURCE) {
651
				if (SHOW_SOURCE) {
649
					setActivePage(PluginInputContext.CONTEXT_ID);
652
					setActivePage(PluginInputContext.CONTEXT_ID);
(-)src/org/eclipse/pde/internal/ui/editor/plugin/ManifestEditorMatchingStrategy.java (-5 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 34-40 Link Here
34
34
35
				// If a MANIFEST.MF file is being opened, make sure we return a positive match
35
				// If a MANIFEST.MF file is being opened, make sure we return a positive match
36
				// only if it is colocated with the plugin.xml/fragment.xml file already open
36
				// only if it is colocated with the plugin.xml/fragment.xml file already open
37
				if (inputFile.getName().equals("MANIFEST.MF")) { //$NON-NLS-1$
37
				if (inputFile.getName().equals(ICoreConstants.MANIFEST_FILENAME)) {
38
					IContainer parent = inputFile.getParent();
38
					IContainer parent = inputFile.getParent();
39
					return parent instanceof IFolder && parent.getName().equals("META-INF") //$NON-NLS-1$
39
					return parent instanceof IFolder && parent.getName().equals("META-INF") //$NON-NLS-1$
40
							&& parent.getParent().equals(editorFile.getParent());
40
							&& parent.getParent().equals(editorFile.getParent());
Lines 42-48 Link Here
42
42
43
				// if a plugin.xml/fragment.xml is being opened, make sure we return a positive match
43
				// if a plugin.xml/fragment.xml is being opened, make sure we return a positive match
44
				// only if the editor that is open is associated with a colocated MANIFEST.MF
44
				// only if the editor that is open is associated with a colocated MANIFEST.MF
45
				if (inputFile.getName().equals("plugin.xml") || inputFile.getName().equals("fragment.xml")) { //$NON-NLS-1$ //$NON-NLS-2$
45
				if (inputFile.getName().equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || inputFile.getName().equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)) {
46
					IContainer parent = inputFile.getParent();
46
					IContainer parent = inputFile.getParent();
47
					IFile file = parent.getFile(ICoreConstants.MANIFEST_PATH);
47
					IFile file = parent.getFile(ICoreConstants.MANIFEST_PATH);
48
					return file.exists() && editorFile.equals(file);
48
					return file.exists() && editorFile.equals(file);
Lines 50-59 Link Here
50
50
51
				// if a build.properties is being opened, only return a positive match
51
				// if a build.properties is being opened, only return a positive match
52
				// if an editor is already open on a sibling plugin.xml/fragment.xml or a META-INF/MANIFEST.MF
52
				// if an editor is already open on a sibling plugin.xml/fragment.xml or a META-INF/MANIFEST.MF
53
				if (inputFile.getName().equals("build.properties")) { //$NON-NLS-1$ 
53
				if (inputFile.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
54
					IContainer parent = inputFile.getParent();
54
					IContainer parent = inputFile.getParent();
55
					if (parent.equals(editorFile.getParent())) {
55
					if (parent.equals(editorFile.getParent())) {
56
						return editorFile.getName().equals("plugin.xml") || editorFile.getName().equals("fragment.xml"); //$NON-NLS-1$ //$NON-NLS-2$
56
						return editorFile.getName().equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || editorFile.getName().equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR);
57
					}
57
					}
58
					IFile file = parent.getFile(ICoreConstants.MANIFEST_PATH);
58
					IFile file = parent.getFile(ICoreConstants.MANIFEST_PATH);
59
					return file.exists() && editorFile.equals(file);
59
					return file.exists() && editorFile.equals(file);
(-)src/org/eclipse/pde/internal/ui/editor/plugin/OverviewPage.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2000, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2000, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 21-26 Link Here
21
import org.eclipse.pde.core.build.*;
21
import org.eclipse.pde.core.build.*;
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
22
import org.eclipse.pde.core.plugin.IPluginModelBase;
23
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
23
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
24
import org.eclipse.pde.internal.core.project.PDEProject;
24
import org.eclipse.pde.internal.ui.*;
25
import org.eclipse.pde.internal.ui.*;
25
import org.eclipse.pde.internal.ui.editor.*;
26
import org.eclipse.pde.internal.ui.editor.*;
26
import org.eclipse.pde.internal.ui.editor.build.BuildInputContext;
27
import org.eclipse.pde.internal.ui.editor.build.BuildInputContext;
Lines 209-215 Link Here
209
			if (!getPDEEditor().hasInputContext(BuildInputContext.CONTEXT_ID)) {
210
			if (!getPDEEditor().hasInputContext(BuildInputContext.CONTEXT_ID)) {
210
				if (!MessageDialog.openQuestion(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OverviewPage_buildTitle, PDEUIMessages.OverviewPage_buildQuestion))
211
				if (!MessageDialog.openQuestion(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OverviewPage_buildTitle, PDEUIMessages.OverviewPage_buildQuestion))
211
					return;
212
					return;
212
				IFile file = getPDEEditor().getCommonProject().getFile("build.properties"); //$NON-NLS-1$
213
				IFile file = PDEProject.getBuildProperties(getPDEEditor().getCommonProject());
213
				WorkspaceBuildModel model = new WorkspaceBuildModel(file);
214
				WorkspaceBuildModel model = new WorkspaceBuildModel(file);
214
				model.save();
215
				model.save();
215
				IEditorInput in = new FileEditorInput(file);
216
				IEditorInput in = new FileEditorInput(file);
(-)src/org/eclipse/pde/internal/ui/nls/ExternalizeStringsOperation.java (-6 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 28-35 Link Here
28
import org.eclipse.pde.core.build.IBuildEntry;
28
import org.eclipse.pde.core.build.IBuildEntry;
29
import org.eclipse.pde.core.build.IBuildModel;
29
import org.eclipse.pde.core.build.IBuildModel;
30
import org.eclipse.pde.core.plugin.*;
30
import org.eclipse.pde.core.plugin.*;
31
import org.eclipse.pde.internal.core.ICoreConstants;
31
import org.eclipse.pde.internal.core.ibundle.IBundle;
32
import org.eclipse.pde.internal.core.ibundle.IBundle;
32
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
33
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
34
import org.eclipse.pde.internal.core.project.PDEProject;
33
import org.eclipse.pde.internal.ui.PDEUIMessages;
35
import org.eclipse.pde.internal.ui.PDEUIMessages;
34
import org.eclipse.pde.internal.ui.util.ModelModification;
36
import org.eclipse.pde.internal.ui.util.ModelModification;
35
import org.eclipse.pde.internal.ui.util.PDEModelUtility;
37
import org.eclipse.pde.internal.ui.util.PDEModelUtility;
Lines 69-75 Link Here
69
					addBundleLocalization(change, monitor, pluginChange);
71
					addBundleLocalization(change, monitor, pluginChange);
70
72
71
				// Update build.properties file (if exists & not already done)
73
				// Update build.properties file (if exists & not already done)
72
				IFile buildProps = changeFile.getFile().getProject().getFile(PDEModelUtility.F_BUILD);
74
				IFile buildProps = PDEProject.getBuildProperties(changeFile.getFile().getProject());
73
				if (buildProps != null && buildProps.exists() && !fFileChanges.containsKey(buildProps)) {
75
				if (buildProps != null && buildProps.exists() && !fFileChanges.containsKey(buildProps)) {
74
					getChangeForBuild(buildProps, monitor, pluginChange, change.getBundleLocalization());
76
					getChangeForBuild(buildProps, monitor, pluginChange, change.getBundleLocalization());
75
				}
77
				}
Lines 132-140 Link Here
132
		change.setEdit(edit);
134
		change.setEdit(edit);
133
		// mark a plugin.xml or a fragment.xml as PLUGIN2 type so they will be compared
135
		// mark a plugin.xml or a fragment.xml as PLUGIN2 type so they will be compared
134
		// with the PluginContentMergeViewer
136
		// with the PluginContentMergeViewer
135
		String textType = file.getName().equals("plugin.xml") || //$NON-NLS-1$
137
		String textType = file.getName().equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || file.getName().equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR) ? "PLUGIN2" //$NON-NLS-1$
136
				file.getName().equals("fragment.xml") ? //$NON-NLS-1$
137
		"PLUGIN2" //$NON-NLS-1$
138
				: file.getFileExtension();
138
				: file.getFileExtension();
139
		change.setTextType(textType);
139
		change.setTextType(textType);
140
		parentChange.add(change);
140
		parentChange.add(change);
Lines 166-172 Link Here
166
166
167
	private void addBundleLocalization(ModelChange change, IProgressMonitor mon, CompositeChange parent) {
167
	private void addBundleLocalization(ModelChange change, IProgressMonitor mon, CompositeChange parent) {
168
		IPluginModelBase base = change.getParentModel();
168
		IPluginModelBase base = change.getParentModel();
169
		IFile manifest = base.getUnderlyingResource().getProject().getFile(PDEModelUtility.F_MANIFEST_FP);
169
		IFile manifest = PDEProject.getManifest(base.getUnderlyingResource().getProject());
170
		// if the edit for this manifest file is in the HashMap, then we must have added
170
		// if the edit for this manifest file is in the HashMap, then we must have added
171
		// the localization already since it is checked first (this must be the second or subsequent
171
		// the localization already since it is checked first (this must be the second or subsequent
172
		// change to the manifest for this plug-in)
172
		// change to the manifest for this plug-in)
(-)src/org/eclipse/pde/internal/ui/nls/NLSFragmentGenerator.java (-6 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
2
 * Copyright (c) 2008, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 23-28 Link Here
23
import org.eclipse.jface.wizard.IWizardContainer;
23
import org.eclipse.jface.wizard.IWizardContainer;
24
import org.eclipse.osgi.util.NLS;
24
import org.eclipse.osgi.util.NLS;
25
import org.eclipse.pde.core.plugin.IPluginModelBase;
25
import org.eclipse.pde.core.plugin.IPluginModelBase;
26
import org.eclipse.pde.internal.core.ICoreConstants;
26
import org.eclipse.pde.internal.core.TargetPlatformHelper;
27
import org.eclipse.pde.internal.core.TargetPlatformHelper;
27
import org.eclipse.pde.internal.core.plugin.ExternalPluginModelBase;
28
import org.eclipse.pde.internal.core.plugin.ExternalPluginModelBase;
28
import org.eclipse.pde.internal.ui.PDEPlugin;
29
import org.eclipse.pde.internal.ui.PDEPlugin;
Lines 53-61 Link Here
53
	private static final String PROPERTIES_EXTENSION = ".properties"; //$NON-NLS-1$
54
	private static final String PROPERTIES_EXTENSION = ".properties"; //$NON-NLS-1$
54
	private static final String JAR_EXTENSION = ".jar"; //$NON-NLS-1$
55
	private static final String JAR_EXTENSION = ".jar"; //$NON-NLS-1$
55
56
56
	private static final String PLUGIN_XML = "plugin.xml"; //$NON-NLS-1$
57
	private static final String BUILD_PROPERTIES = "build.properties"; //$NON-NLS-1$
58
59
	private static final String BIN = "/bin/"; //$NON-NLS-1$
57
	private static final String BIN = "/bin/"; //$NON-NLS-1$
60
	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
58
	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
61
	private static final String BACKSLASH = "\\"; //$NON-NLS-1$
59
	private static final String BACKSLASH = "\\"; //$NON-NLS-1$
Lines 92-98 Link Here
92
			add(new AbstractFilter(false) {
90
			add(new AbstractFilter(false) {
93
				public boolean matches(Object object) {
91
				public boolean matches(Object object) {
94
					String path = object.toString();
92
					String path = object.toString();
95
					return path.indexOf(BIN) != -1 || path.endsWith(SLASH) || path.endsWith(PLUGIN_XML);
93
					return path.indexOf(BIN) != -1 || path.endsWith(SLASH) || path.endsWith(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
96
				}
94
				}
97
			});
95
			});
98
96
Lines 110-116 Link Here
110
			add(new AbstractFilter(false) {
108
			add(new AbstractFilter(false) {
111
				public boolean matches(Object object) {
109
				public boolean matches(Object object) {
112
					String path = object.toString();
110
					String path = object.toString();
113
					return path.indexOf(BIN) != -1 || path.endsWith(BUILD_PROPERTIES);
111
					return path.indexOf(BIN) != -1 || path.endsWith(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
114
				}
112
				}
115
			});
113
			});
116
114
(-)src/org/eclipse/pde/internal/ui/refactoring/ContainerRenameParticipant.java (-4 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2006, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2006, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 19-27 Link Here
19
import org.eclipse.ltk.core.refactoring.Change;
19
import org.eclipse.ltk.core.refactoring.Change;
20
import org.eclipse.ltk.core.refactoring.CompositeChange;
20
import org.eclipse.ltk.core.refactoring.CompositeChange;
21
import org.eclipse.pde.core.plugin.PluginRegistry;
21
import org.eclipse.pde.core.plugin.PluginRegistry;
22
import org.eclipse.pde.internal.core.ICoreConstants;
23
import org.eclipse.pde.internal.core.WorkspaceModelManager;
22
import org.eclipse.pde.internal.core.WorkspaceModelManager;
24
import org.eclipse.pde.internal.core.ibundle.IBundle;
23
import org.eclipse.pde.internal.core.ibundle.IBundle;
24
import org.eclipse.pde.internal.core.project.PDEProject;
25
import org.eclipse.pde.internal.core.text.bundle.*;
25
import org.eclipse.pde.internal.core.text.bundle.*;
26
import org.eclipse.pde.internal.core.util.IdUtil;
26
import org.eclipse.pde.internal.core.util.IdUtil;
27
import org.eclipse.pde.internal.ui.PDEUIMessages;
27
import org.eclipse.pde.internal.ui.PDEUIMessages;
Lines 62-68 Link Here
62
	}
62
	}
63
63
64
	protected Change createManifestChange(IProgressMonitor monitor) throws CoreException {
64
	protected Change createManifestChange(IProgressMonitor monitor) throws CoreException {
65
		IFile manifest = fProject.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
65
		IFile manifest = PDEProject.getManifest(fProject);
66
		if (manifest.exists()) {
66
		if (manifest.exists()) {
67
			monitor.beginTask("", 4); //$NON-NLS-1$
67
			monitor.beginTask("", 4); //$NON-NLS-1$
68
			try {
68
			try {
Lines 90-96 Link Here
90
						// The project/resources get refactored before the TextChange is applied, therefore we need their future locations
90
						// The project/resources get refactored before the TextChange is applied, therefore we need their future locations
91
						IProject newProject = ((IWorkspaceRoot) manifest.getProject().getParent()).getProject(newText);
91
						IProject newProject = ((IWorkspaceRoot) manifest.getProject().getParent()).getProject(newText);
92
92
93
						MovedTextFileChange change = new MovedTextFileChange("", newProject.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR), manifest); //$NON-NLS-1$
93
						MovedTextFileChange change = new MovedTextFileChange("", PDEProject.getManifest(newProject), manifest); //$NON-NLS-1$
94
						MultiTextEdit edit = new MultiTextEdit();
94
						MultiTextEdit edit = new MultiTextEdit();
95
						edit.addChildren(listener.getTextOperations());
95
						edit.addChildren(listener.getTextOperations());
96
						change.setEdit(edit);
96
						change.setEdit(edit);
(-)src/org/eclipse/pde/internal/ui/refactoring/CreateHeaderChangeOperation.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2007, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2007, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 17-25 Link Here
17
import org.eclipse.jface.text.BadLocationException;
17
import org.eclipse.jface.text.BadLocationException;
18
import org.eclipse.ltk.core.refactoring.TextFileChange;
18
import org.eclipse.ltk.core.refactoring.TextFileChange;
19
import org.eclipse.pde.core.plugin.IPluginModelBase;
19
import org.eclipse.pde.core.plugin.IPluginModelBase;
20
import org.eclipse.pde.internal.core.ICoreConstants;
21
import org.eclipse.pde.internal.core.ibundle.IBundle;
20
import org.eclipse.pde.internal.core.ibundle.IBundle;
22
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
21
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
22
import org.eclipse.pde.internal.core.project.PDEProject;
23
import org.eclipse.pde.internal.core.text.bundle.*;
23
import org.eclipse.pde.internal.core.text.bundle.*;
24
import org.eclipse.pde.internal.ui.util.PDEModelUtility;
24
import org.eclipse.pde.internal.ui.util.PDEModelUtility;
25
import org.eclipse.text.edits.*;
25
import org.eclipse.text.edits.*;
Lines 45-51 Link Here
45
			if (res == null)
45
			if (res == null)
46
				return;
46
				return;
47
			IProject proj = res.getProject();
47
			IProject proj = res.getProject();
48
			IFile file = proj.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
48
			IFile file = PDEProject.getManifest(proj);
49
			if (file.exists())
49
			if (file.exists())
50
				fChange = updateBundleHeader(file, monitor);
50
				fChange = updateBundleHeader(file, monitor);
51
		} finally {
51
		} finally {
(-)src/org/eclipse/pde/internal/ui/refactoring/ManifestPackageMoveParticipant.java (-5 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 16-22 Link Here
16
import org.eclipse.jdt.core.*;
16
import org.eclipse.jdt.core.*;
17
import org.eclipse.ltk.core.refactoring.Change;
17
import org.eclipse.ltk.core.refactoring.Change;
18
import org.eclipse.ltk.core.refactoring.CompositeChange;
18
import org.eclipse.ltk.core.refactoring.CompositeChange;
19
import org.eclipse.pde.internal.core.ICoreConstants;
19
import org.eclipse.pde.internal.core.project.PDEProject;
20
import org.eclipse.pde.internal.ui.PDEUIMessages;
20
import org.eclipse.pde.internal.ui.PDEUIMessages;
21
21
22
public class ManifestPackageMoveParticipant extends PDEMoveParticipant {
22
public class ManifestPackageMoveParticipant extends PDEMoveParticipant {
Lines 26-32 Link Here
26
			IPackageFragment fragment = (IPackageFragment) element;
26
			IPackageFragment fragment = (IPackageFragment) element;
27
			IJavaProject javaProject = (IJavaProject) fragment.getAncestor(IJavaElement.JAVA_PROJECT);
27
			IJavaProject javaProject = (IJavaProject) fragment.getAncestor(IJavaElement.JAVA_PROJECT);
28
			IProject project = javaProject.getProject();
28
			IProject project = javaProject.getProject();
29
			if (project.exists(ICoreConstants.MANIFEST_PATH)) {
29
			if (PDEProject.getManifest(project).exists()) {
30
				fProject = javaProject.getProject();
30
				fProject = javaProject.getProject();
31
				fElements = new HashMap();
31
				fElements = new HashMap();
32
				fElements.put(fragment, getNewName(getArguments().getDestination(), element));
32
				fElements.put(fragment, getNewName(getArguments().getDestination(), element));
Lines 41-54 Link Here
41
	}
41
	}
42
42
43
	protected void addChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
43
	protected void addChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
44
		IFile file = fProject.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
44
		IFile file = PDEProject.getManifest(fProject);
45
		if (file.exists()) {
45
		if (file.exists()) {
46
			IProject destProject = getDestinationProject();
46
			IProject destProject = getDestinationProject();
47
			if (destProject != null && !fProject.equals(destProject)) {
47
			if (destProject != null && !fProject.equals(destProject)) {
48
				MoveFromChange change = BundleManifestChange.createMovePackageChange(file, fElements.keySet().toArray(), pm);
48
				MoveFromChange change = BundleManifestChange.createMovePackageChange(file, fElements.keySet().toArray(), pm);
49
				if (change != null) {
49
				if (change != null) {
50
					result.add(change);
50
					result.add(change);
51
					IFile dest = destProject.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
51
					IFile dest = PDEProject.getManifest(destProject);
52
					if (dest.exists()) {
52
					if (dest.exists()) {
53
						Change second = BundleManifestChange.createMoveToPackageChange(dest, change, pm);
53
						Change second = BundleManifestChange.createMoveToPackageChange(dest, change, pm);
54
						if (second != null)
54
						if (second != null)
(-)src/org/eclipse/pde/internal/ui/refactoring/ManifestTypeMoveParticipant.java (-5 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 18-25 Link Here
18
import org.eclipse.jdt.core.*;
18
import org.eclipse.jdt.core.*;
19
import org.eclipse.ltk.core.refactoring.Change;
19
import org.eclipse.ltk.core.refactoring.Change;
20
import org.eclipse.ltk.core.refactoring.CompositeChange;
20
import org.eclipse.ltk.core.refactoring.CompositeChange;
21
import org.eclipse.pde.internal.core.ICoreConstants;
22
import org.eclipse.pde.internal.core.WorkspaceModelManager;
21
import org.eclipse.pde.internal.core.WorkspaceModelManager;
22
import org.eclipse.pde.internal.core.project.PDEProject;
23
import org.eclipse.pde.internal.ui.PDEUIMessages;
23
import org.eclipse.pde.internal.ui.PDEUIMessages;
24
24
25
public class ManifestTypeMoveParticipant extends PDEMoveParticipant {
25
public class ManifestTypeMoveParticipant extends PDEMoveParticipant {
Lines 53-60 Link Here
53
		return false;
53
		return false;
54
	}
54
	}
55
55
56
	protected void addChange(CompositeChange result, String filename, IProgressMonitor pm) throws CoreException {
56
	protected void addChange(CompositeChange result, IFile file, IProgressMonitor pm) throws CoreException {
57
		IFile file = fProject.getFile(filename);
58
		if (file.exists()) {
57
		if (file.exists()) {
59
			Change change = PluginManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), getTextChange(file), pm);
58
			Change change = PluginManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), getTextChange(file), pm);
60
			if (change != null)
59
			if (change != null)
Lines 74-80 Link Here
74
	}
73
	}
75
74
76
	protected void addChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
75
	protected void addChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
77
		IFile file = fProject.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
76
		IFile file = PDEProject.getManifest(fProject);
78
		if (file.exists()) {
77
		if (file.exists()) {
79
			Change change = BundleManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), pm);
78
			Change change = BundleManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), pm);
80
			if (change != null)
79
			if (change != null)
(-)src/org/eclipse/pde/internal/ui/refactoring/PDEMoveParticipant.java (-5 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 12-22 Link Here
12
12
13
import java.util.HashMap;
13
import java.util.HashMap;
14
import java.util.Iterator;
14
import java.util.Iterator;
15
import org.eclipse.core.resources.IFile;
15
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
17
import org.eclipse.ltk.core.refactoring.*;
18
import org.eclipse.ltk.core.refactoring.*;
18
import org.eclipse.ltk.core.refactoring.participants.*;
19
import org.eclipse.ltk.core.refactoring.participants.*;
19
import org.eclipse.pde.internal.core.ICoreConstants;
20
import org.eclipse.pde.internal.core.project.PDEProject;
20
21
21
public abstract class PDEMoveParticipant extends MoveParticipant implements ISharableParticipant {
22
public abstract class PDEMoveParticipant extends MoveParticipant implements ISharableParticipant {
22
23
Lines 36-50 Link Here
36
		CompositeChange result = new CompositeChange(getName());
37
		CompositeChange result = new CompositeChange(getName());
37
		addChange(result, pm);
38
		addChange(result, pm);
38
		if (isInterestingForExtensions()) {
39
		if (isInterestingForExtensions()) {
39
			addChange(result, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR, pm);
40
			addChange(result, PDEProject.getPluginXml(fProject), pm);
40
			addChange(result, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR, pm);
41
			addChange(result, PDEProject.getFragmentXml(fProject), pm);
41
		}
42
		}
42
		return (result.getChildren().length == 0) ? null : result;
43
		return (result.getChildren().length == 0) ? null : result;
43
	}
44
	}
44
45
45
	protected abstract boolean isInterestingForExtensions();
46
	protected abstract boolean isInterestingForExtensions();
46
47
47
	protected void addChange(CompositeChange result, String filename, IProgressMonitor pm) throws CoreException {
48
	protected void addChange(CompositeChange result, IFile file, IProgressMonitor pm) throws CoreException {
48
	}
49
	}
49
50
50
	// add main change (whether to Manifest or build.properties)
51
	// add main change (whether to Manifest or build.properties)
(-)src/org/eclipse/pde/internal/ui/refactoring/PDERenameParticipant.java (-8 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 17-23 Link Here
17
import org.eclipse.jdt.core.IJavaElement;
17
import org.eclipse.jdt.core.IJavaElement;
18
import org.eclipse.ltk.core.refactoring.*;
18
import org.eclipse.ltk.core.refactoring.*;
19
import org.eclipse.ltk.core.refactoring.participants.*;
19
import org.eclipse.ltk.core.refactoring.participants.*;
20
import org.eclipse.pde.internal.core.ICoreConstants;
20
import org.eclipse.pde.internal.core.project.PDEProject;
21
21
22
public abstract class PDERenameParticipant extends RenameParticipant implements ISharableParticipant {
22
public abstract class PDERenameParticipant extends RenameParticipant implements ISharableParticipant {
23
23
Lines 44-56 Link Here
44
		addBundleManifestChange(result, pm);
44
		addBundleManifestChange(result, pm);
45
		if (updateBuildProperties())
45
		if (updateBuildProperties())
46
			addBuildPropertiesChange(result, pm);
46
			addBuildPropertiesChange(result, pm);
47
		addChange(result, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR, pm);
47
		addChange(result, PDEProject.getPluginXml(fProject), pm);
48
		addChange(result, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR, pm);
48
		addChange(result, PDEProject.getFragmentXml(fProject), pm);
49
		return (result.getChildren().length == 0) ? null : result;
49
		return (result.getChildren().length == 0) ? null : result;
50
	}
50
	}
51
51
52
	private void addChange(CompositeChange result, String filename, IProgressMonitor pm) throws CoreException {
52
	private void addChange(CompositeChange result, IFile file, IProgressMonitor pm) throws CoreException {
53
		IFile file = fProject.getFile(filename);
54
		if (file.exists()) {
53
		if (file.exists()) {
55
			Change change = PluginManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), getTextChange(file), pm);
54
			Change change = PluginManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), getTextChange(file), pm);
56
			if (change != null)
55
			if (change != null)
Lines 67-73 Link Here
67
	}
66
	}
68
67
69
	protected void addBundleManifestChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
68
	protected void addBundleManifestChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
70
		addBundleManifestChange(fProject.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR), result, pm);
69
		addBundleManifestChange(PDEProject.getManifest(fProject), result, pm);
71
	}
70
	}
72
71
73
	protected void addBundleManifestChange(IFile file, CompositeChange result, IProgressMonitor pm) throws CoreException {
72
	protected void addBundleManifestChange(IFile file, CompositeChange result, IProgressMonitor pm) throws CoreException {
Lines 79-85 Link Here
79
	}
78
	}
80
79
81
	protected void addBuildPropertiesChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
80
	protected void addBuildPropertiesChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
82
		IFile file = fProject.getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
81
		IFile file = PDEProject.getBuildProperties(fProject);
83
		if (file.exists()) {
82
		if (file.exists()) {
84
			Change change = BuildPropertiesChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), pm);
83
			Change change = BuildPropertiesChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), pm);
85
			if (change != null)
84
			if (change != null)
(-)src/org/eclipse/pde/internal/ui/refactoring/PluginManifestChange.java (-1 / +2 lines)
Lines 17-22 Link Here
17
import org.eclipse.jface.text.IDocument;
17
import org.eclipse.jface.text.IDocument;
18
import org.eclipse.ltk.core.refactoring.*;
18
import org.eclipse.ltk.core.refactoring.*;
19
import org.eclipse.pde.core.plugin.*;
19
import org.eclipse.pde.core.plugin.*;
20
import org.eclipse.pde.internal.core.ICoreConstants;
20
import org.eclipse.pde.internal.core.PDECore;
21
import org.eclipse.pde.internal.core.PDECore;
21
import org.eclipse.pde.internal.core.ischema.*;
22
import org.eclipse.pde.internal.core.ischema.*;
22
import org.eclipse.pde.internal.core.schema.SchemaRegistry;
23
import org.eclipse.pde.internal.core.schema.SchemaRegistry;
Lines 39-45 Link Here
39
40
40
			try {
41
			try {
41
				PluginModelBase model;
42
				PluginModelBase model;
42
				if ("fragment.xml".equals(file.getName())) //$NON-NLS-1$
43
				if (ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR.equals(file.getName()))
43
					model = new FragmentModel(document, false);
44
					model = new FragmentModel(document, false);
44
				else
45
				else
45
					model = new PluginModel(document, false);
46
					model = new PluginModel(document, false);
(-)src/org/eclipse/pde/internal/ui/refactoring/RenameExtensionPointProcessor.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2007, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2007, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 17-24 Link Here
17
import org.eclipse.ltk.core.refactoring.participants.*;
17
import org.eclipse.ltk.core.refactoring.participants.*;
18
import org.eclipse.pde.core.IBaseModel;
18
import org.eclipse.pde.core.IBaseModel;
19
import org.eclipse.pde.core.plugin.*;
19
import org.eclipse.pde.core.plugin.*;
20
import org.eclipse.pde.internal.core.ICoreConstants;
21
import org.eclipse.pde.internal.core.PDECore;
20
import org.eclipse.pde.internal.core.PDECore;
21
import org.eclipse.pde.internal.core.project.PDEProject;
22
import org.eclipse.pde.internal.ui.PDEUIMessages;
22
import org.eclipse.pde.internal.ui.PDEUIMessages;
23
import org.eclipse.pde.internal.ui.util.ModelModification;
23
import org.eclipse.pde.internal.ui.util.ModelModification;
24
import org.eclipse.pde.internal.ui.util.PDEModelUtility;
24
import org.eclipse.pde.internal.ui.util.PDEModelUtility;
Lines 109-115 Link Here
109
		IResource res = base.getUnderlyingResource();
109
		IResource res = base.getUnderlyingResource();
110
		if (res != null) {
110
		if (res != null) {
111
			IProject proj = res.getProject();
111
			IProject proj = res.getProject();
112
			IFile file = proj.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
112
			IFile file = PDEProject.getPluginXml(proj);
113
			if (file.exists())
113
			if (file.exists())
114
				return file;
114
				return file;
115
		}
115
		}
(-)src/org/eclipse/pde/internal/ui/refactoring/RenamePluginProcessor.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
2
 * Copyright (c) 2007, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 19-25 Link Here
19
import org.eclipse.osgi.service.resolver.BundleDescription;
19
import org.eclipse.osgi.service.resolver.BundleDescription;
20
import org.eclipse.pde.core.plugin.IPluginModelBase;
20
import org.eclipse.pde.core.plugin.IPluginModelBase;
21
import org.eclipse.pde.core.plugin.PluginRegistry;
21
import org.eclipse.pde.core.plugin.PluginRegistry;
22
import org.eclipse.pde.internal.core.ICoreConstants;
22
import org.eclipse.pde.internal.core.project.PDEProject;
23
import org.eclipse.pde.internal.ui.PDEUIMessages;
23
import org.eclipse.pde.internal.ui.PDEUIMessages;
24
import org.osgi.framework.Constants;
24
import org.osgi.framework.Constants;
25
25
Lines 36-42 Link Here
36
		IResource res = fInfo.getBase().getUnderlyingResource();
36
		IResource res = fInfo.getBase().getUnderlyingResource();
37
		if (res == null)
37
		if (res == null)
38
			status.addFatalError(PDEUIMessages.RenamePluginProcessor_externalBundleError);
38
			status.addFatalError(PDEUIMessages.RenamePluginProcessor_externalBundleError);
39
		else if (!res.getProject().getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR).exists())
39
		else if (!PDEProject.getManifest(res.getProject()).exists())
40
			status.addFatalError(PDEUIMessages.RenamePluginProcessor_noManifestError);
40
			status.addFatalError(PDEUIMessages.RenamePluginProcessor_noManifestError);
41
		if (fInfo.isRenameProject()) {
41
		if (fInfo.isRenameProject()) {
42
			String newName = fInfo.getNewValue();
42
			String newName = fInfo.getNewValue();
(-)src/org/eclipse/pde/internal/ui/refactoring/ResourceMoveParticipant.java (-6 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
2
 * Copyright (c) 2007, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 17-24 Link Here
17
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.ltk.core.refactoring.Change;
18
import org.eclipse.ltk.core.refactoring.Change;
19
import org.eclipse.ltk.core.refactoring.CompositeChange;
19
import org.eclipse.ltk.core.refactoring.CompositeChange;
20
import org.eclipse.pde.internal.core.ICoreConstants;
21
import org.eclipse.pde.internal.core.WorkspaceModelManager;
20
import org.eclipse.pde.internal.core.WorkspaceModelManager;
21
import org.eclipse.pde.internal.core.project.PDEProject;
22
22
23
public abstract class ResourceMoveParticipant extends PDEMoveParticipant {
23
public abstract class ResourceMoveParticipant extends PDEMoveParticipant {
24
24
Lines 39-46 Link Here
39
		return false;
39
		return false;
40
	}
40
	}
41
41
42
	protected void addChange(CompositeChange result, String filename, IProgressMonitor pm) throws CoreException {
42
	protected void addChange(CompositeChange result, IFile file, IProgressMonitor pm) throws CoreException {
43
		IFile file = fProject.getFile(filename);
44
		if (file.exists()) {
43
		if (file.exists()) {
45
			Change change = PluginManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), getTextChange(file), pm);
44
			Change change = PluginManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), getTextChange(file), pm);
46
			if (change != null)
45
			if (change != null)
Lines 60-72 Link Here
60
	}
59
	}
61
60
62
	protected void addChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
61
	protected void addChange(CompositeChange result, IProgressMonitor pm) throws CoreException {
63
		IFile file = fProject.getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
62
		IFile file = PDEProject.getBuildProperties(fProject);
64
		if (file.exists()) {
63
		if (file.exists()) {
65
			Change change = BuildPropertiesChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), pm);
64
			Change change = BuildPropertiesChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), pm);
66
			if (change != null)
65
			if (change != null)
67
				result.add(change);
66
				result.add(change);
68
		}
67
		}
69
		file = fProject.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
68
		file = PDEProject.getManifest(fProject);
70
		if (file.exists()) {
69
		if (file.exists()) {
71
			Change change = BundleManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), pm);
70
			Change change = BundleManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), pm);
72
			if (change != null)
71
			if (change != null)
(-)src/org/eclipse/pde/internal/ui/search/SearchResult.java (-1 / +2 lines)
Lines 19-24 Link Here
19
import org.eclipse.jface.resource.ImageDescriptor;
19
import org.eclipse.jface.resource.ImageDescriptor;
20
import org.eclipse.jface.text.IDocument;
20
import org.eclipse.jface.text.IDocument;
21
import org.eclipse.pde.core.plugin.IPluginObject;
21
import org.eclipse.pde.core.plugin.IPluginObject;
22
import org.eclipse.pde.internal.core.ICoreConstants;
22
import org.eclipse.pde.internal.ui.PDEPluginImages;
23
import org.eclipse.pde.internal.ui.PDEPluginImages;
23
import org.eclipse.pde.internal.ui.PDEUIMessages;
24
import org.eclipse.pde.internal.ui.PDEUIMessages;
24
import org.eclipse.search.ui.ISearchQuery;
25
import org.eclipse.search.ui.ISearchQuery;
Lines 119-125 Link Here
119
		if (file != null) {
120
		if (file != null) {
120
			IPath path = new Path(object.getModel().getInstallLocation());
121
			IPath path = new Path(object.getModel().getInstallLocation());
121
			IPath filePath = null;
122
			IPath filePath = null;
122
			if ("MANIFEST.MF".equals(file.getName())) //$NON-NLS-1$
123
			if (ICoreConstants.MANIFEST_FILENAME.equals(file.getName()))
123
				filePath = new Path(file.getParentFile().getParent());
124
				filePath = new Path(file.getParentFile().getParent());
124
			else if (file.getName().endsWith("jar")) { //$NON-NLS-1$
125
			else if (file.getName().endsWith("jar")) { //$NON-NLS-1$
125
				filePath = new Path(file.getPath());
126
				filePath = new Path(file.getPath());
(-)src/org/eclipse/pde/internal/ui/search/dependencies/AddNewDependenciesOperation.java (-2 / +3 lines)
Lines 31-36 Link Here
31
import org.eclipse.pde.internal.core.converter.PluginConverter;
31
import org.eclipse.pde.internal.core.converter.PluginConverter;
32
import org.eclipse.pde.internal.core.ibundle.*;
32
import org.eclipse.pde.internal.core.ibundle.*;
33
import org.eclipse.pde.internal.core.plugin.PluginImport;
33
import org.eclipse.pde.internal.core.plugin.PluginImport;
34
import org.eclipse.pde.internal.core.project.PDEProject;
34
import org.eclipse.pde.internal.core.search.PluginJavaSearchUtil;
35
import org.eclipse.pde.internal.core.search.PluginJavaSearchUtil;
35
import org.eclipse.pde.internal.core.text.bundle.*;
36
import org.eclipse.pde.internal.core.text.bundle.*;
36
import org.eclipse.pde.internal.ui.PDEUIMessages;
37
import org.eclipse.pde.internal.ui.PDEUIMessages;
Lines 113-119 Link Here
113
	}
114
	}
114
115
115
	protected final IBuild getBuild() {
116
	protected final IBuild getBuild() {
116
		IFile buildProps = fProject.getFile("build.properties"); //$NON-NLS-1$
117
		IFile buildProps = PDEProject.getBuildProperties(fProject);
117
		if (buildProps != null) {
118
		if (buildProps != null) {
118
			WorkspaceBuildModel model = new WorkspaceBuildModel(buildProps);
119
			WorkspaceBuildModel model = new WorkspaceBuildModel(buildProps);
119
			if (model != null)
120
			if (model != null)
Lines 347-353 Link Here
347
			} else
348
			} else
348
				addRequireBundles(plugins, pbase, build.getEntry(IBuildEntry.SECONDARY_DEPENDENCIES));
349
				addRequireBundles(plugins, pbase, build.getEntry(IBuildEntry.SECONDARY_DEPENDENCIES));
349
			try {
350
			try {
350
				build.write("", new PrintWriter(new FileOutputStream(fProject.getFile("build.properties").getFullPath().toFile()))); //$NON-NLS-1$ //$NON-NLS-2$
351
				build.write("", new PrintWriter(new FileOutputStream(PDEProject.getBuildProperties(fProject).getFullPath().toFile()))); //$NON-NLS-1$ //$NON-NLS-2$
351
			} catch (FileNotFoundException e) {
352
			} catch (FileNotFoundException e) {
352
			}
353
			}
353
		} else {
354
		} else {
(-)src/org/eclipse/pde/internal/ui/shared/target/AddFeatureContainersPage.java (-1 / +1 lines)
Lines 253-259 Link Here
253
		for (int i = 0; i < dirs.length; i++) {
253
		for (int i = 0; i < dirs.length; i++) {
254
			File dir = dirs[i];
254
			File dir = dirs[i];
255
			if (dir.isDirectory()) {
255
			if (dir.isDirectory()) {
256
				File manifest = new File(dir, "feature.xml"); //$NON-NLS-1$
256
				File manifest = new File(dir, ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
257
				if (manifest.exists()) {
257
				if (manifest.exists()) {
258
					IStatus status = doLoadFeature(dir, manifest, result);
258
					IStatus status = doLoadFeature(dir, manifest, result);
259
					if (status != null)
259
					if (status != null)
(-)src/org/eclipse/pde/internal/ui/util/ModelModification.java (-6 / +8 lines)
Lines 14-19 Link Here
14
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.resources.IProject;
15
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.pde.core.IBaseModel;
16
import org.eclipse.pde.core.IBaseModel;
17
import org.eclipse.pde.internal.core.ICoreConstants;
18
import org.eclipse.pde.internal.core.project.PDEProject;
17
19
18
/**
20
/**
19
 * ModelModification class used my the PDEModelUtility
21
 * ModelModification class used my the PDEModelUtility
Lines 54-65 Link Here
54
	 * @param project
56
	 * @param project
55
	 */
57
	 */
56
	public ModelModification(IProject project) {
58
	public ModelModification(IProject project) {
57
		IFile xml = project.getFile(PDEModelUtility.F_PLUGIN);
59
		IFile xml = PDEProject.getPluginXml(project);
58
		if (!xml.exists())
60
		if (!xml.exists())
59
			xml = project.getFile(PDEModelUtility.F_FRAGMENT);
61
			xml = PDEProject.getFragmentXml(project);
60
		if (!xml.exists())
62
		if (!xml.exists())
61
			xml = null;
63
			xml = null;
62
		IFile manifest = project.getFile(PDEModelUtility.F_MANIFEST_FP);
64
		IFile manifest = PDEProject.getManifest(project);
63
		if (!manifest.exists() && xml != null)
65
		if (!manifest.exists() && xml != null)
64
			singleFileModification(xml);
66
			singleFileModification(xml);
65
		else if (manifest.exists())
67
		else if (manifest.exists())
Lines 74-80 Link Here
74
			fModelFile = fXMLFile;
76
			fModelFile = fXMLFile;
75
		else if (fPropertiesFile != null)
77
		else if (fPropertiesFile != null)
76
			fModelFile = fPropertiesFile;
78
			fModelFile = fPropertiesFile;
77
		fIsBundleModel = file.getName().equals(PDEModelUtility.F_MANIFEST);
79
		fIsBundleModel = file.getName().equals(ICoreConstants.MANIFEST_FILENAME);
78
	}
80
	}
79
81
80
	private void createFullBundleModification(IFile bundleFile, IFile xmlFile) {
82
	private void createFullBundleModification(IFile bundleFile, IFile xmlFile) {
Lines 90-98 Link Here
90
		if (file == null)
92
		if (file == null)
91
			return;
93
			return;
92
		String name = file.getName();
94
		String name = file.getName();
93
		if (name.equals(PDEModelUtility.F_MANIFEST))
95
		if (name.equals(ICoreConstants.MANIFEST_FILENAME))
94
			fManifestFile = file;
96
			fManifestFile = file;
95
		else if (name.equals(PDEModelUtility.F_PLUGIN) || name.equals(PDEModelUtility.F_FRAGMENT))
97
		else if (name.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR))
96
			fXMLFile = file;
98
			fXMLFile = file;
97
		else if (name.endsWith(PDEModelUtility.F_PROPERTIES))
99
		else if (name.endsWith(PDEModelUtility.F_PROPERTIES))
98
			fPropertiesFile = file;
100
			fPropertiesFile = file;
(-)src/org/eclipse/pde/internal/ui/util/PDEModelUtility.java (-19 / +13 lines)
Lines 22-27 Link Here
22
import org.eclipse.pde.core.IBaseModel;
22
import org.eclipse.pde.core.IBaseModel;
23
import org.eclipse.pde.core.plugin.IPluginModelBase;
23
import org.eclipse.pde.core.plugin.IPluginModelBase;
24
import org.eclipse.pde.core.plugin.ISharedExtensionsModel;
24
import org.eclipse.pde.core.plugin.ISharedExtensionsModel;
25
import org.eclipse.pde.internal.core.ICoreConstants;
25
import org.eclipse.pde.internal.core.bundle.BundleFragmentModel;
26
import org.eclipse.pde.internal.core.bundle.BundleFragmentModel;
26
import org.eclipse.pde.internal.core.bundle.BundlePluginModel;
27
import org.eclipse.pde.internal.core.bundle.BundlePluginModel;
27
import org.eclipse.pde.internal.core.ibundle.IBundleModel;
28
import org.eclipse.pde.internal.core.ibundle.IBundleModel;
Lines 54-65 Link Here
54
 */
55
 */
55
public class PDEModelUtility {
56
public class PDEModelUtility {
56
57
57
	public static final String F_MANIFEST = "MANIFEST.MF"; //$NON-NLS-1$
58
	public static final String F_MANIFEST_FP = "META-INF/" + F_MANIFEST; //$NON-NLS-1$
59
	public static final String F_PLUGIN = "plugin.xml"; //$NON-NLS-1$
60
	public static final String F_FRAGMENT = "fragment.xml"; //$NON-NLS-1$
61
	public static final String F_PROPERTIES = ".properties"; //$NON-NLS-1$
58
	public static final String F_PROPERTIES = ".properties"; //$NON-NLS-1$
62
	public static final String F_BUILD = "build" + F_PROPERTIES; //$NON-NLS-1$
63
59
64
	// bundle / xml various Object[] indices
60
	// bundle / xml various Object[] indices
65
	private static final int F_Bi = 0; // the manifest.mf-related object will always be 1st
61
	private static final int F_Bi = 0; // the manifest.mf-related object will always be 1st
Lines 405-414 Link Here
405
			return;
401
			return;
406
		// mark a plugin.xml or a fragment.xml as PLUGIN2 type so they will be compared
402
		// mark a plugin.xml or a fragment.xml as PLUGIN2 type so they will be compared
407
		// with the PluginContentMergeViewer
403
		// with the PluginContentMergeViewer
408
		String textType = name.equals("plugin.xml") || //$NON-NLS-1$
404
		String textType = name.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR) ? "PLUGIN2" //$NON-NLS-1$
409
				name.equals("fragment.xml") ? //$NON-NLS-1$
405
				: file.getFileExtension();
410
		"PLUGIN2" //$NON-NLS-1$
411
				: file.getFileExtension(); 
412
		// if the file extension is null, the setTextType method will use type "txt", so no null guard needed
406
		// if the file extension is null, the setTextType method will use type "txt", so no null guard needed
413
		change.setTextType(textType);
407
		change.setTextType(textType);
414
	}
408
	}
Lines 438-446 Link Here
438
	private static PDEFormEditor getOpenEditor(ModelModification modification) {
432
	private static PDEFormEditor getOpenEditor(ModelModification modification) {
439
		IProject project = modification.getFile().getProject();
433
		IProject project = modification.getFile().getProject();
440
		String name = modification.getFile().getName();
434
		String name = modification.getFile().getName();
441
		if (name.equals(F_PLUGIN) || name.equals(F_FRAGMENT) || name.equals(F_MANIFEST)) {
435
		if (name.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR) || name.equals(ICoreConstants.MANIFEST_FILENAME)) {
442
			return getOpenManifestEditor(project);
436
			return getOpenManifestEditor(project);
443
		} else if (name.equals(F_BUILD)) {
437
		} else if (name.equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
444
			PDEFormEditor openEditor = getOpenBuildPropertiesEditor(project);
438
			PDEFormEditor openEditor = getOpenBuildPropertiesEditor(project);
445
			if (openEditor == null)
439
			if (openEditor == null)
446
				openEditor = getOpenManifestEditor(project);
440
				openEditor = getOpenManifestEditor(project);
Lines 454-464 Link Here
454
			return null;
448
			return null;
455
		String name = modification.getFile().getName();
449
		String name = modification.getFile().getName();
456
		IBaseModel model = null;
450
		IBaseModel model = null;
457
		if (name.equals(F_PLUGIN) || name.equals(F_FRAGMENT)) {
451
		if (name.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || name.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)) {
458
			model = openEditor.getAggregateModel();
452
			model = openEditor.getAggregateModel();
459
			if (model instanceof IBundlePluginModelBase)
453
			if (model instanceof IBundlePluginModelBase)
460
				model = ((IBundlePluginModelBase) model).getExtensionsModel();
454
				model = ((IBundlePluginModelBase) model).getExtensionsModel();
461
		} else if (name.equals(F_BUILD)) {
455
		} else if (name.equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
462
			if (openEditor instanceof BuildEditor) {
456
			if (openEditor instanceof BuildEditor) {
463
				model = openEditor.getAggregateModel();
457
				model = openEditor.getAggregateModel();
464
			} else if (openEditor instanceof ManifestEditor) {
458
			} else if (openEditor instanceof ManifestEditor) {
Lines 466-472 Link Here
466
				if (page instanceof BuildSourcePage)
460
				if (page instanceof BuildSourcePage)
467
					model = ((BuildSourcePage) page).getInputContext().getModel();
461
					model = ((BuildSourcePage) page).getInputContext().getModel();
468
			}
462
			}
469
		} else if (name.equals(F_MANIFEST)) {
463
		} else if (name.equals(ICoreConstants.MANIFEST_FILENAME)) {
470
			model = openEditor.getAggregateModel();
464
			model = openEditor.getAggregateModel();
471
			if (model instanceof IBundlePluginModelBase)
465
			if (model instanceof IBundlePluginModelBase)
472
				return model;
466
				return model;
Lines 477-485 Link Here
477
	}
471
	}
478
472
479
	private static IModelTextChangeListener createListener(String filename, IDocument doc, boolean generateEditNames) {
473
	private static IModelTextChangeListener createListener(String filename, IDocument doc, boolean generateEditNames) {
480
		if (filename.equals(F_PLUGIN) || filename.equals(F_FRAGMENT))
474
		if (filename.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || filename.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR))
481
			return new XMLTextChangeListener(doc, generateEditNames);
475
			return new XMLTextChangeListener(doc, generateEditNames);
482
		else if (filename.equals(F_MANIFEST))
476
		else if (filename.equals(ICoreConstants.MANIFEST_FILENAME))
483
			return new BundleTextChangeListener(doc, generateEditNames);
477
			return new BundleTextChangeListener(doc, generateEditNames);
484
		else if (filename.endsWith(F_PROPERTIES))
478
		else if (filename.endsWith(F_PROPERTIES))
485
			return new PropertiesTextChangeListener(doc, generateEditNames);
479
			return new PropertiesTextChangeListener(doc, generateEditNames);
Lines 489-499 Link Here
489
	private static AbstractEditingModel prepareAbstractEditingModel(IFile file, IDocument doc, boolean generateEditNames) {
483
	private static AbstractEditingModel prepareAbstractEditingModel(IFile file, IDocument doc, boolean generateEditNames) {
490
		AbstractEditingModel model;
484
		AbstractEditingModel model;
491
		String filename = file.getName();
485
		String filename = file.getName();
492
		if (filename.equals(F_MANIFEST))
486
		if (filename.equals(ICoreConstants.MANIFEST_FILENAME))
493
			model = new BundleModel(doc, true);
487
			model = new BundleModel(doc, true);
494
		else if (filename.equals(F_FRAGMENT))
488
		else if (filename.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR))
495
			model = new FragmentModel(doc, true);
489
			model = new FragmentModel(doc, true);
496
		else if (filename.equals(F_PLUGIN))
490
		else if (filename.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR))
497
			model = new PluginModel(doc, true);
491
			model = new PluginModel(doc, true);
498
		else if (filename.endsWith(F_PROPERTIES))
492
		else if (filename.endsWith(F_PROPERTIES))
499
			model = new BuildModel(doc, true);
493
			model = new BuildModel(doc, true);
(-)src/org/eclipse/pde/internal/ui/views/plugins/PluginsView.java (-3 / +1 lines)
Lines 502-510 Link Here
502
		String fileName = adapter.getFile().getName();
502
		String fileName = adapter.getFile().getName();
503
		String lcFileName = fileName.toLowerCase(Locale.ENGLISH);
503
		String lcFileName = fileName.toLowerCase(Locale.ENGLISH);
504
		ImageDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(fileName);
504
		ImageDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(fileName);
505
		if (lcFileName.equals("plugin.xml") //$NON-NLS-1$
505
		if (lcFileName.equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) || lcFileName.equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR) || lcFileName.equals(ICoreConstants.MANIFEST_FILENAME_LOWER_CASE)) {
506
				|| lcFileName.equals("fragment.xml") //$NON-NLS-1$
507
				|| lcFileName.equals("manifest.mf")) { //$NON-NLS-1$
508
			fOpenManifestAction.setImageDescriptor(desc);
506
			fOpenManifestAction.setImageDescriptor(desc);
509
			manager.add(fOpenManifestAction);
507
			manager.add(fOpenManifestAction);
510
			manager.add(new Separator());
508
			manager.add(new Separator());
(-)src/org/eclipse/pde/internal/ui/wizards/exports/AntGeneratingExportWizard.java (-1 / +2 lines)
Lines 30-35 Link Here
30
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
30
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
31
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
31
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
32
import org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase;
32
import org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase;
33
import org.eclipse.pde.internal.core.project.PDEProject;
33
import org.eclipse.pde.internal.ui.*;
34
import org.eclipse.pde.internal.ui.*;
34
import org.eclipse.pde.internal.ui.build.BaseBuildAction;
35
import org.eclipse.pde.internal.ui.build.BaseBuildAction;
35
import org.eclipse.swt.SWT;
36
import org.eclipse.swt.SWT;
Lines 75-81 Link Here
75
					File file = new File(installLocation, "build.xml"); //$NON-NLS-1$
76
					File file = new File(installLocation, "build.xml"); //$NON-NLS-1$
76
					if (file.exists()) {
77
					if (file.exists()) {
77
						try {
78
						try {
78
							IFile buildFile = underlyingResource.getProject().getFile("build.properties"); //$NON-NLS-1$
79
							IFile buildFile = PDEProject.getBuildProperties(underlyingResource.getProject());
79
							IBuildModel buildModel = new WorkspaceBuildModel(buildFile);
80
							IBuildModel buildModel = new WorkspaceBuildModel(buildFile);
80
							buildModel.load();
81
							buildModel.load();
81
							if (buildModel != null) {
82
							if (buildModel != null) {
(-)src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizardPage.java (-3 / +2 lines)
Lines 20-27 Link Here
20
import org.eclipse.pde.core.IModel;
20
import org.eclipse.pde.core.IModel;
21
import org.eclipse.pde.core.plugin.IPluginModelBase;
21
import org.eclipse.pde.core.plugin.IPluginModelBase;
22
import org.eclipse.pde.core.plugin.PluginRegistry;
22
import org.eclipse.pde.core.plugin.PluginRegistry;
23
import org.eclipse.pde.internal.core.PDECore;
23
import org.eclipse.pde.internal.core.*;
24
import org.eclipse.pde.internal.core.WorkspaceModelManager;
25
import org.eclipse.pde.internal.ui.IHelpContextIds;
24
import org.eclipse.pde.internal.ui.IHelpContextIds;
26
import org.eclipse.pde.internal.ui.PDEUIMessages;
25
import org.eclipse.pde.internal.ui.PDEUIMessages;
27
import org.eclipse.pde.internal.ui.util.PersistablePluginObject;
26
import org.eclipse.pde.internal.ui.util.PersistablePluginObject;
Lines 59-65 Link Here
59
	}
58
	}
60
59
61
	private boolean hasBuildProperties(IPluginModelBase model) {
60
	private boolean hasBuildProperties(IPluginModelBase model) {
62
		File file = new File(model.getInstallLocation(), "build.properties"); //$NON-NLS-1$
61
		File file = new File(model.getInstallLocation(), ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
63
		return file.exists();
62
		return file.exists();
64
	}
63
	}
65
64
(-)src/org/eclipse/pde/internal/ui/wizards/feature/AbstractCreateFeatureOperation.java (-4 / +6 lines)
Lines 20-29 Link Here
20
import org.eclipse.jface.viewers.StructuredSelection;
20
import org.eclipse.jface.viewers.StructuredSelection;
21
import org.eclipse.pde.core.build.IBuildEntry;
21
import org.eclipse.pde.core.build.IBuildEntry;
22
import org.eclipse.pde.internal.build.IBuildPropertiesConstants;
22
import org.eclipse.pde.internal.build.IBuildPropertiesConstants;
23
import org.eclipse.pde.internal.core.ICoreConstants;
23
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
24
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
24
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
25
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
25
import org.eclipse.pde.internal.core.ifeature.*;
26
import org.eclipse.pde.internal.core.ifeature.*;
26
import org.eclipse.pde.internal.core.natures.PDE;
27
import org.eclipse.pde.internal.core.natures.PDE;
28
import org.eclipse.pde.internal.core.project.PDEProject;
27
import org.eclipse.pde.internal.core.util.CoreUtility;
29
import org.eclipse.pde.internal.core.util.CoreUtility;
28
import org.eclipse.pde.internal.ui.*;
30
import org.eclipse.pde.internal.ui.*;
29
import org.eclipse.swt.widgets.Shell;
31
import org.eclipse.swt.widgets.Shell;
Lines 73-79 Link Here
73
		} else {
75
		} else {
74
			fProject.create(monitor);
76
			fProject.create(monitor);
75
			fProject.open(monitor);
77
			fProject.open(monitor);
76
			file = fProject.getFile("feature.xml"); //$NON-NLS-1$
78
			file = PDEProject.getFeatureXml(fProject);
77
			monitor.worked(3);
79
			monitor.worked(3);
78
		}
80
		}
79
		if (file.exists())
81
		if (file.exists())
Lines 105-115 Link Here
105
	}
107
	}
106
108
107
	protected void createBuildProperties() throws CoreException {
109
	protected void createBuildProperties() throws CoreException {
108
		IFile file = fProject.getFile("build.properties"); //$NON-NLS-1$
110
		IFile file = PDEProject.getBuildProperties(fProject);
109
		if (!file.exists()) {
111
		if (!file.exists()) {
110
			WorkspaceBuildModel model = new WorkspaceBuildModel(file);
112
			WorkspaceBuildModel model = new WorkspaceBuildModel(file);
111
			IBuildEntry ientry = model.getFactory().createEntry("bin.includes"); //$NON-NLS-1$
113
			IBuildEntry ientry = model.getFactory().createEntry("bin.includes"); //$NON-NLS-1$
112
			ientry.addToken("feature.xml"); //$NON-NLS-1$
114
			ientry.addToken(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
113
			String library = fFeatureData.library;
115
			String library = fFeatureData.library;
114
			if (library != null) {
116
			if (library != null) {
115
				String source = fFeatureData.getSourceFolderName();
117
				String source = fFeatureData.getSourceFolderName();
Lines 138-144 Link Here
138
	}
140
	}
139
141
140
	protected IFile createFeature() throws CoreException {
142
	protected IFile createFeature() throws CoreException {
141
		IFile file = fProject.getFile("feature.xml"); //$NON-NLS-1$
143
		IFile file = PDEProject.getFeatureXml(fProject);
142
		WorkspaceFeatureModel model = new WorkspaceFeatureModel();
144
		WorkspaceFeatureModel model = new WorkspaceFeatureModel();
143
		model.setFile(file);
145
		model.setFile(file);
144
		IFeature feature = model.getFeature();
146
		IFeature feature = model.getFeature();
(-)src/org/eclipse/pde/internal/ui/wizards/imports/FeatureImportOperation.java (-1 / +2 lines)
Lines 22-27 Link Here
22
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
22
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
23
import org.eclipse.pde.internal.core.ifeature.*;
23
import org.eclipse.pde.internal.core.ifeature.*;
24
import org.eclipse.pde.internal.core.natures.PDE;
24
import org.eclipse.pde.internal.core.natures.PDE;
25
import org.eclipse.pde.internal.core.project.PDEProject;
25
import org.eclipse.pde.internal.ui.PDEPlugin;
26
import org.eclipse.pde.internal.ui.PDEPlugin;
26
import org.eclipse.pde.internal.ui.PDEUIMessages;
27
import org.eclipse.pde.internal.ui.PDEUIMessages;
27
import org.eclipse.team.core.RepositoryProvider;
28
import org.eclipse.team.core.RepositoryProvider;
Lines 226-232 Link Here
226
	}
227
	}
227
228
228
	private void createBuildProperties(IProject project) {
229
	private void createBuildProperties(IProject project) {
229
		IFile file = project.getFile("build.properties"); //$NON-NLS-1$
230
		IFile file = PDEProject.getBuildProperties(project);
230
		if (!file.exists()) {
231
		if (!file.exists()) {
231
			WorkspaceBuildModel model = new WorkspaceBuildModel(file);
232
			WorkspaceBuildModel model = new WorkspaceBuildModel(file);
232
			IBuildEntry ientry = model.getFactory().createEntry("bin.includes"); //$NON-NLS-1$
233
			IBuildEntry ientry = model.getFactory().createEntry("bin.includes"); //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/ui/wizards/imports/FeatureImportWizardPage.java (-448 / +448 lines)
Lines 1-448 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.imports;
11
package org.eclipse.pde.internal.ui.wizards.imports;
12
12
13
import java.io.*;
13
import java.io.*;
14
import java.lang.reflect.InvocationTargetException;
14
import java.lang.reflect.InvocationTargetException;
15
import java.util.ArrayList;
15
import java.util.ArrayList;
16
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.jface.dialogs.*;
17
import org.eclipse.jface.dialogs.*;
18
import org.eclipse.jface.dialogs.Dialog;
18
import org.eclipse.jface.dialogs.Dialog;
19
import org.eclipse.jface.operation.IRunnableWithProgress;
19
import org.eclipse.jface.operation.IRunnableWithProgress;
20
import org.eclipse.jface.viewers.*;
20
import org.eclipse.jface.viewers.*;
21
import org.eclipse.jface.wizard.WizardPage;
21
import org.eclipse.jface.wizard.WizardPage;
22
import org.eclipse.osgi.util.NLS;
22
import org.eclipse.osgi.util.NLS;
23
import org.eclipse.pde.internal.core.*;
23
import org.eclipse.pde.internal.core.*;
24
import org.eclipse.pde.internal.core.feature.ExternalFeatureModel;
24
import org.eclipse.pde.internal.core.feature.ExternalFeatureModel;
25
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
25
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
26
import org.eclipse.pde.internal.ui.*;
26
import org.eclipse.pde.internal.ui.*;
27
import org.eclipse.pde.internal.ui.elements.DefaultContentProvider;
27
import org.eclipse.pde.internal.ui.elements.DefaultContentProvider;
28
import org.eclipse.pde.internal.ui.parts.WizardCheckboxTablePart;
28
import org.eclipse.pde.internal.ui.parts.WizardCheckboxTablePart;
29
import org.eclipse.pde.internal.ui.util.SWTUtil;
29
import org.eclipse.pde.internal.ui.util.SWTUtil;
30
import org.eclipse.pde.internal.ui.wizards.ListUtil;
30
import org.eclipse.pde.internal.ui.wizards.ListUtil;
31
import org.eclipse.swt.SWT;
31
import org.eclipse.swt.SWT;
32
import org.eclipse.swt.events.*;
32
import org.eclipse.swt.events.*;
33
import org.eclipse.swt.layout.GridData;
33
import org.eclipse.swt.layout.GridData;
34
import org.eclipse.swt.layout.GridLayout;
34
import org.eclipse.swt.layout.GridLayout;
35
import org.eclipse.swt.widgets.*;
35
import org.eclipse.swt.widgets.*;
36
import org.eclipse.ui.PlatformUI;
36
import org.eclipse.ui.PlatformUI;
37
import org.eclipse.ui.forms.widgets.FormToolkit;
37
import org.eclipse.ui.forms.widgets.FormToolkit;
38
import org.eclipse.ui.progress.IProgressService;
38
import org.eclipse.ui.progress.IProgressService;
39
39
40
public class FeatureImportWizardPage extends WizardPage {
40
public class FeatureImportWizardPage extends WizardPage {
41
41
42
	private static final String SETTINGS_DROPLOCATION = "droplocation"; //$NON-NLS-1$
42
	private static final String SETTINGS_DROPLOCATION = "droplocation"; //$NON-NLS-1$
43
	private static final String SETTINGS_DOOTHER = "doother"; //$NON-NLS-1$
43
	private static final String SETTINGS_DOOTHER = "doother"; //$NON-NLS-1$
44
	private static final String SETTINGS_NOT_BINARY = "notbinary"; //$NON-NLS-1$
44
	private static final String SETTINGS_NOT_BINARY = "notbinary"; //$NON-NLS-1$
45
45
46
	private Label fOtherLocationLabel;
46
	private Label fOtherLocationLabel;
47
	private Button fRuntimeLocationButton;
47
	private Button fRuntimeLocationButton;
48
	private Button fBrowseButton;
48
	private Button fBrowseButton;
49
	private Combo fDropLocation;
49
	private Combo fDropLocation;
50
	private boolean fSelfSetLocation;
50
	private boolean fSelfSetLocation;
51
	private String fCurrDropLocation;
51
	private String fCurrDropLocation;
52
52
53
	private CheckboxTableViewer fFeatureViewer;
53
	private CheckboxTableViewer fFeatureViewer;
54
	private TablePart fTablePart;
54
	private TablePart fTablePart;
55
	private IFeatureModel[] fModels;
55
	private IFeatureModel[] fModels;
56
56
57
	private Button fBinaryButton;
57
	private Button fBinaryButton;
58
58
59
	class ContentProvider extends DefaultContentProvider implements IStructuredContentProvider {
59
	class ContentProvider extends DefaultContentProvider implements IStructuredContentProvider {
60
		public Object[] getElements(Object parent) {
60
		public Object[] getElements(Object parent) {
61
			if (fModels != null)
61
			if (fModels != null)
62
				return fModels;
62
				return fModels;
63
			return new Object[0];
63
			return new Object[0];
64
		}
64
		}
65
	}
65
	}
66
66
67
	class TablePart extends WizardCheckboxTablePart {
67
	class TablePart extends WizardCheckboxTablePart {
68
		public TablePart() {
68
		public TablePart() {
69
			super(null, new String[] {PDEUIMessages.FeatureImportWizardPage_reload, PDEUIMessages.WizardCheckboxTablePart_selectAll, PDEUIMessages.WizardCheckboxTablePart_deselectAll});
69
			super(null, new String[] {PDEUIMessages.FeatureImportWizardPage_reload, PDEUIMessages.WizardCheckboxTablePart_selectAll, PDEUIMessages.WizardCheckboxTablePart_deselectAll});
70
			setSelectAllIndex(1);
70
			setSelectAllIndex(1);
71
			setDeselectAllIndex(2);
71
			setDeselectAllIndex(2);
72
		}
72
		}
73
73
74
		public void updateCounter(int count) {
74
		public void updateCounter(int count) {
75
			super.updateCounter(count);
75
			super.updateCounter(count);
76
			dialogChanged();
76
			dialogChanged();
77
		}
77
		}
78
78
79
		protected StructuredViewer createStructuredViewer(Composite parent, int style, FormToolkit toolkit) {
79
		protected StructuredViewer createStructuredViewer(Composite parent, int style, FormToolkit toolkit) {
80
			StructuredViewer viewer = super.createStructuredViewer(parent, style, toolkit);
80
			StructuredViewer viewer = super.createStructuredViewer(parent, style, toolkit);
81
			viewer.setComparator(ListUtil.FEATURE_COMPARATOR);
81
			viewer.setComparator(ListUtil.FEATURE_COMPARATOR);
82
			return viewer;
82
			return viewer;
83
		}
83
		}
84
84
85
		protected void buttonSelected(Button button, int index) {
85
		protected void buttonSelected(Button button, int index) {
86
			if (index == 0)
86
			if (index == 0)
87
				loadFeatureTable();
87
				loadFeatureTable();
88
			else
88
			else
89
				super.buttonSelected(button, index);
89
				super.buttonSelected(button, index);
90
		}
90
		}
91
	}
91
	}
92
92
93
	public FeatureImportWizardPage() {
93
	public FeatureImportWizardPage() {
94
		super("FeatureImportWizardPage"); //$NON-NLS-1$
94
		super("FeatureImportWizardPage"); //$NON-NLS-1$
95
		setTitle(PDEUIMessages.FeatureImportWizard_FirstPage_title);
95
		setTitle(PDEUIMessages.FeatureImportWizard_FirstPage_title);
96
		setDescription(PDEUIMessages.FeatureImportWizard_FirstPage_desc);
96
		setDescription(PDEUIMessages.FeatureImportWizard_FirstPage_desc);
97
		fTablePart = new TablePart();
97
		fTablePart = new TablePart();
98
		PDEPlugin.getDefault().getLabelProvider().connect(this);
98
		PDEPlugin.getDefault().getLabelProvider().connect(this);
99
	}
99
	}
100
100
101
	/*
101
	/*
102
	 * @see IDialogPage#createControl(Composite)
102
	 * @see IDialogPage#createControl(Composite)
103
	 */
103
	 */
104
	public void createControl(Composite parent) {
104
	public void createControl(Composite parent) {
105
		initializeDialogUnits(parent);
105
		initializeDialogUnits(parent);
106
106
107
		Composite composite = new Composite(parent, SWT.NONE);
107
		Composite composite = new Composite(parent, SWT.NONE);
108
		composite.setLayout(new GridLayout(3, false));
108
		composite.setLayout(new GridLayout(3, false));
109
109
110
		fRuntimeLocationButton = new Button(composite, SWT.CHECK);
110
		fRuntimeLocationButton = new Button(composite, SWT.CHECK);
111
		fillHorizontal(fRuntimeLocationButton, 3, false);
111
		fillHorizontal(fRuntimeLocationButton, 3, false);
112
		fRuntimeLocationButton.setText(PDEUIMessages.FeatureImportWizard_FirstPage_runtimeLocation);
112
		fRuntimeLocationButton.setText(PDEUIMessages.FeatureImportWizard_FirstPage_runtimeLocation);
113
113
114
		fOtherLocationLabel = new Label(composite, SWT.NULL);
114
		fOtherLocationLabel = new Label(composite, SWT.NULL);
115
		fOtherLocationLabel.setText(PDEUIMessages.FeatureImportWizard_FirstPage_otherFolder);
115
		fOtherLocationLabel.setText(PDEUIMessages.FeatureImportWizard_FirstPage_otherFolder);
116
116
117
		fDropLocation = new Combo(composite, SWT.DROP_DOWN);
117
		fDropLocation = new Combo(composite, SWT.DROP_DOWN);
118
		fillHorizontal(fDropLocation, 1, true);
118
		fillHorizontal(fDropLocation, 1, true);
119
119
120
		fBrowseButton = new Button(composite, SWT.PUSH);
120
		fBrowseButton = new Button(composite, SWT.PUSH);
121
		fBrowseButton.setText(PDEUIMessages.FeatureImportWizard_FirstPage_browse);
121
		fBrowseButton.setText(PDEUIMessages.FeatureImportWizard_FirstPage_browse);
122
		fBrowseButton.setLayoutData(new GridData());
122
		fBrowseButton.setLayoutData(new GridData());
123
		SWTUtil.setButtonDimensionHint(fBrowseButton);
123
		SWTUtil.setButtonDimensionHint(fBrowseButton);
124
124
125
		creatFeatureTable(composite);
125
		creatFeatureTable(composite);
126
126
127
		fBinaryButton = new Button(composite, SWT.CHECK);
127
		fBinaryButton = new Button(composite, SWT.CHECK);
128
		GridData gd = fillHorizontal(fBinaryButton, 3, false);
128
		GridData gd = fillHorizontal(fBinaryButton, 3, false);
129
		gd.verticalIndent = 5;
129
		gd.verticalIndent = 5;
130
		fBinaryButton.setText(PDEUIMessages.FeatureImportWizard_FirstPage_binaryImport);
130
		fBinaryButton.setText(PDEUIMessages.FeatureImportWizard_FirstPage_binaryImport);
131
131
132
		initializeFields(getDialogSettings());
132
		initializeFields(getDialogSettings());
133
		hookListeners();
133
		hookListeners();
134
134
135
		setControl(composite);
135
		setControl(composite);
136
		dialogChanged();
136
		dialogChanged();
137
		Dialog.applyDialogFont(composite);
137
		Dialog.applyDialogFont(composite);
138
		PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.FEATURE_IMPORT_FIRST_PAGE);
138
		PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.FEATURE_IMPORT_FIRST_PAGE);
139
	}
139
	}
140
140
141
	private String getTargetHome() {
141
	private String getTargetHome() {
142
		PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager();
142
		PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager();
143
		return preferences.getString(ICoreConstants.PLATFORM_PATH);
143
		return preferences.getString(ICoreConstants.PLATFORM_PATH);
144
	}
144
	}
145
145
146
	private void hookListeners() {
146
	private void hookListeners() {
147
		fRuntimeLocationButton.addSelectionListener(new SelectionAdapter() {
147
		fRuntimeLocationButton.addSelectionListener(new SelectionAdapter() {
148
			public void widgetSelected(SelectionEvent e) {
148
			public void widgetSelected(SelectionEvent e) {
149
				setOtherEnabled(!fRuntimeLocationButton.getSelection());
149
				setOtherEnabled(!fRuntimeLocationButton.getSelection());
150
				setLocation(fRuntimeLocationButton.getSelection() ? getTargetHome() : fCurrDropLocation);
150
				setLocation(fRuntimeLocationButton.getSelection() ? getTargetHome() : fCurrDropLocation);
151
				loadFeatureTable();
151
				loadFeatureTable();
152
			}
152
			}
153
		});
153
		});
154
		fDropLocation.addModifyListener(new ModifyListener() {
154
		fDropLocation.addModifyListener(new ModifyListener() {
155
			public void modifyText(ModifyEvent e) {
155
			public void modifyText(ModifyEvent e) {
156
				validateDropLocation();
156
				validateDropLocation();
157
				if (!fRuntimeLocationButton.getSelection()) {
157
				if (!fRuntimeLocationButton.getSelection()) {
158
					String newLoc = fDropLocation.getText();
158
					String newLoc = fDropLocation.getText();
159
					if (getMessageType() != WARNING && !newLoc.equals(fCurrDropLocation) && !fSelfSetLocation)
159
					if (getMessageType() != WARNING && !newLoc.equals(fCurrDropLocation) && !fSelfSetLocation)
160
						setMessage(PDEUIMessages.FeatureImportWizardPage_reloadLocation, WARNING);
160
						setMessage(PDEUIMessages.FeatureImportWizardPage_reloadLocation, WARNING);
161
					fCurrDropLocation = newLoc;
161
					fCurrDropLocation = newLoc;
162
				}
162
				}
163
			}
163
			}
164
		});
164
		});
165
		fBrowseButton.addSelectionListener(new SelectionAdapter() {
165
		fBrowseButton.addSelectionListener(new SelectionAdapter() {
166
			public void widgetSelected(SelectionEvent e) {
166
			public void widgetSelected(SelectionEvent e) {
167
				IPath chosen = chooseDropLocation();
167
				IPath chosen = chooseDropLocation();
168
				if (chosen != null) {
168
				if (chosen != null) {
169
					setLocation(chosen.toOSString());
169
					setLocation(chosen.toOSString());
170
					loadFeatureTable();
170
					loadFeatureTable();
171
				}
171
				}
172
			}
172
			}
173
		});
173
		});
174
	}
174
	}
175
175
176
	private GridData fillHorizontal(Control control, int span, boolean grab) {
176
	private GridData fillHorizontal(Control control, int span, boolean grab) {
177
		GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
177
		GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
178
		gd.horizontalSpan = span;
178
		gd.horizontalSpan = span;
179
		gd.grabExcessHorizontalSpace = grab;
179
		gd.grabExcessHorizontalSpace = grab;
180
		control.setLayoutData(gd);
180
		control.setLayoutData(gd);
181
		return gd;
181
		return gd;
182
	}
182
	}
183
183
184
	private void initializeFields(IDialogSettings initialSettings) {
184
	private void initializeFields(IDialogSettings initialSettings) {
185
		String[] dropItems = new String[0];
185
		String[] dropItems = new String[0];
186
		boolean doOther = false;
186
		boolean doOther = false;
187
		boolean binary = true;
187
		boolean binary = true;
188
188
189
		if (initialSettings != null) {
189
		if (initialSettings != null) {
190
			doOther = initialSettings.getBoolean(SETTINGS_DOOTHER);
190
			doOther = initialSettings.getBoolean(SETTINGS_DOOTHER);
191
			binary = !initialSettings.getBoolean(SETTINGS_NOT_BINARY);
191
			binary = !initialSettings.getBoolean(SETTINGS_NOT_BINARY);
192
192
193
			ArrayList items = new ArrayList();
193
			ArrayList items = new ArrayList();
194
			for (int i = 0; i < 6; i++) {
194
			for (int i = 0; i < 6; i++) {
195
				String curr = initialSettings.get(SETTINGS_DROPLOCATION + String.valueOf(i));
195
				String curr = initialSettings.get(SETTINGS_DROPLOCATION + String.valueOf(i));
196
				if (curr != null && !items.contains(curr))
196
				if (curr != null && !items.contains(curr))
197
					items.add(curr);
197
					items.add(curr);
198
			}
198
			}
199
			if (items.size() == 0)
199
			if (items.size() == 0)
200
				items.add(""); //$NON-NLS-1$
200
				items.add(""); //$NON-NLS-1$
201
			dropItems = (String[]) items.toArray(new String[items.size()]);
201
			dropItems = (String[]) items.toArray(new String[items.size()]);
202
		}
202
		}
203
		fDropLocation.setItems(dropItems);
203
		fDropLocation.setItems(dropItems);
204
		fRuntimeLocationButton.setSelection(!doOther);
204
		fRuntimeLocationButton.setSelection(!doOther);
205
		setOtherEnabled(doOther);
205
		setOtherEnabled(doOther);
206
		fCurrDropLocation = doOther ? dropItems[0] : getTargetHome();
206
		fCurrDropLocation = doOther ? dropItems[0] : getTargetHome();
207
		setLocation(fCurrDropLocation);
207
		setLocation(fCurrDropLocation);
208
		fBinaryButton.setSelection(binary);
208
		fBinaryButton.setSelection(binary);
209
209
210
		validateDropLocation();
210
		validateDropLocation();
211
211
212
		loadFeatureTable();
212
		loadFeatureTable();
213
	}
213
	}
214
214
215
	private void setOtherEnabled(boolean enabled) {
215
	private void setOtherEnabled(boolean enabled) {
216
		fOtherLocationLabel.setEnabled(enabled);
216
		fOtherLocationLabel.setEnabled(enabled);
217
		fDropLocation.setEnabled(enabled);
217
		fDropLocation.setEnabled(enabled);
218
		fBrowseButton.setEnabled(enabled);
218
		fBrowseButton.setEnabled(enabled);
219
	}
219
	}
220
220
221
	public void storeSettings(boolean finishPressed) {
221
	public void storeSettings(boolean finishPressed) {
222
		IDialogSettings settings = getDialogSettings();
222
		IDialogSettings settings = getDialogSettings();
223
		boolean other = !fRuntimeLocationButton.getSelection();
223
		boolean other = !fRuntimeLocationButton.getSelection();
224
		boolean binary = fBinaryButton.getSelection();
224
		boolean binary = fBinaryButton.getSelection();
225
		if (finishPressed || fDropLocation.getText().length() > 0 && other) {
225
		if (finishPressed || fDropLocation.getText().length() > 0 && other) {
226
			settings.put(SETTINGS_DROPLOCATION + String.valueOf(0), fDropLocation.getText());
226
			settings.put(SETTINGS_DROPLOCATION + String.valueOf(0), fDropLocation.getText());
227
			String[] items = fDropLocation.getItems();
227
			String[] items = fDropLocation.getItems();
228
			int nEntries = Math.min(items.length, 5);
228
			int nEntries = Math.min(items.length, 5);
229
			for (int i = 0; i < nEntries; i++)
229
			for (int i = 0; i < nEntries; i++)
230
				settings.put(SETTINGS_DROPLOCATION + String.valueOf(i + 1), items[i]);
230
				settings.put(SETTINGS_DROPLOCATION + String.valueOf(i + 1), items[i]);
231
		}
231
		}
232
		if (finishPressed) {
232
		if (finishPressed) {
233
			settings.put(SETTINGS_DOOTHER, other);
233
			settings.put(SETTINGS_DOOTHER, other);
234
			settings.put(SETTINGS_NOT_BINARY, !binary);
234
			settings.put(SETTINGS_NOT_BINARY, !binary);
235
		}
235
		}
236
	}
236
	}
237
237
238
	/**
238
	/**
239
	 * Browses for a drop location.
239
	 * Browses for a drop location.
240
	 */
240
	 */
241
	private IPath chooseDropLocation() {
241
	private IPath chooseDropLocation() {
242
		DirectoryDialog dialog = new DirectoryDialog(getShell());
242
		DirectoryDialog dialog = new DirectoryDialog(getShell());
243
		dialog.setFilterPath(fDropLocation.getText());
243
		dialog.setFilterPath(fDropLocation.getText());
244
		dialog.setText(PDEUIMessages.FeatureImportWizard_messages_folder_title);
244
		dialog.setText(PDEUIMessages.FeatureImportWizard_messages_folder_title);
245
		dialog.setMessage(PDEUIMessages.FeatureImportWizard_messages_folder_message);
245
		dialog.setMessage(PDEUIMessages.FeatureImportWizard_messages_folder_message);
246
		String res = dialog.open();
246
		String res = dialog.open();
247
		return res != null ? new Path(res) : null;
247
		return res != null ? new Path(res) : null;
248
	}
248
	}
249
249
250
	private void validateDropLocation() {
250
	private void validateDropLocation() {
251
		String errorMessage = null;
251
		String errorMessage = null;
252
		if (isOtherLocation()) {
252
		if (isOtherLocation()) {
253
			IPath curr = getDropLocation();
253
			IPath curr = getDropLocation();
254
			if (curr.segmentCount() == 0)
254
			if (curr.segmentCount() == 0)
255
				errorMessage = PDEUIMessages.FeatureImportWizard_errors_locationMissing;
255
				errorMessage = PDEUIMessages.FeatureImportWizard_errors_locationMissing;
256
			else if (!Path.ROOT.isValidPath(fDropLocation.getText()))
256
			else if (!Path.ROOT.isValidPath(fDropLocation.getText()))
257
				errorMessage = PDEUIMessages.FeatureImportWizard_errors_buildFolderInvalid;
257
				errorMessage = PDEUIMessages.FeatureImportWizard_errors_buildFolderInvalid;
258
			else {
258
			else {
259
				File file = curr.toFile();
259
				File file = curr.toFile();
260
				if (!file.exists() || !file.isDirectory())
260
				if (!file.exists() || !file.isDirectory())
261
					errorMessage = PDEUIMessages.FeatureImportWizard_errors_buildFolderMissing;
261
					errorMessage = PDEUIMessages.FeatureImportWizard_errors_buildFolderMissing;
262
			}
262
			}
263
		}
263
		}
264
		setErrorMessage(errorMessage);
264
		setErrorMessage(errorMessage);
265
		setPageComplete(errorMessage == null);
265
		setPageComplete(errorMessage == null);
266
		fTablePart.setButtonEnabled(0, errorMessage == null);
266
		fTablePart.setButtonEnabled(0, errorMessage == null);
267
	}
267
	}
268
268
269
	public boolean isBinary() {
269
	public boolean isBinary() {
270
		return fBinaryButton.getSelection();
270
		return fBinaryButton.getSelection();
271
	}
271
	}
272
272
273
	/**
273
	/**
274
	 * Returns the drop location.
274
	 * Returns the drop location.
275
	 */
275
	 */
276
	public IPath getDropLocation() {
276
	public IPath getDropLocation() {
277
		return new Path(fDropLocation.getText().trim());
277
		return new Path(fDropLocation.getText().trim());
278
	}
278
	}
279
279
280
	public boolean isOtherLocation() {
280
	public boolean isOtherLocation() {
281
		return !fRuntimeLocationButton.getSelection();
281
		return !fRuntimeLocationButton.getSelection();
282
	}
282
	}
283
283
284
	private void loadFeatureTable() {
284
	private void loadFeatureTable() {
285
		IFeatureModel[] models = getModels();
285
		IFeatureModel[] models = getModels();
286
		fFeatureViewer.setInput(PDEPlugin.getDefault());
286
		fFeatureViewer.setInput(PDEPlugin.getDefault());
287
		if (models != null) {
287
		if (models != null) {
288
			// warning had been issued for unreloaded location
288
			// warning had been issued for unreloaded location
289
			if (getMessageType() == WARNING)
289
			if (getMessageType() == WARNING)
290
				setMessage(null, WARNING);
290
				setMessage(null, WARNING);
291
			if (!fRuntimeLocationButton.getSelection()) {
291
			if (!fRuntimeLocationButton.getSelection()) {
292
				String currItem = fDropLocation.getText();
292
				String currItem = fDropLocation.getText();
293
				if (fDropLocation.indexOf(currItem) == -1) {
293
				if (fDropLocation.indexOf(currItem) == -1) {
294
					fDropLocation.add(currItem, 0);
294
					fDropLocation.add(currItem, 0);
295
					if (fDropLocation.getItemCount() > 6)
295
					if (fDropLocation.getItemCount() > 6)
296
						fDropLocation.remove(6);
296
						fDropLocation.remove(6);
297
					storeSettings(false);
297
					storeSettings(false);
298
				}
298
				}
299
			}
299
			}
300
			fFeatureViewer.setCheckedElements(models);
300
			fFeatureViewer.setCheckedElements(models);
301
		}
301
		}
302
		fTablePart.updateCounter(models != null ? models.length : 0);
302
		fTablePart.updateCounter(models != null ? models.length : 0);
303
		fTablePart.getTableViewer().refresh();
303
		fTablePart.getTableViewer().refresh();
304
304
305
		fTablePart.setButtonEnabled(1, models != null && models.length > 0);
305
		fTablePart.setButtonEnabled(1, models != null && models.length > 0);
306
		fTablePart.setButtonEnabled(2, models != null && models.length > 0);
306
		fTablePart.setButtonEnabled(2, models != null && models.length > 0);
307
307
308
		dialogChanged();
308
		dialogChanged();
309
	}
309
	}
310
310
311
	public void creatFeatureTable(Composite parent) {
311
	public void creatFeatureTable(Composite parent) {
312
		Composite container = new Composite(parent, SWT.NONE);
312
		Composite container = new Composite(parent, SWT.NONE);
313
		GridLayout layout = new GridLayout();
313
		GridLayout layout = new GridLayout();
314
		layout.numColumns = 2;
314
		layout.numColumns = 2;
315
		layout.marginHeight = layout.marginWidth = 0;
315
		layout.marginHeight = layout.marginWidth = 0;
316
		container.setLayout(layout);
316
		container.setLayout(layout);
317
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
317
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
318
		gd.horizontalSpan = 3;
318
		gd.horizontalSpan = 3;
319
		gd.verticalIndent = 5;
319
		gd.verticalIndent = 5;
320
		gd.heightHint = gd.widthHint = 300;
320
		gd.heightHint = gd.widthHint = 300;
321
		container.setLayoutData(gd);
321
		container.setLayoutData(gd);
322
322
323
		fTablePart.createControl(container);
323
		fTablePart.createControl(container);
324
		fFeatureViewer = fTablePart.getTableViewer();
324
		fFeatureViewer = fTablePart.getTableViewer();
325
		fFeatureViewer.setContentProvider(new ContentProvider());
325
		fFeatureViewer.setContentProvider(new ContentProvider());
326
		fFeatureViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
326
		fFeatureViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
327
	}
327
	}
328
328
329
	public void dispose() {
329
	public void dispose() {
330
		super.dispose();
330
		super.dispose();
331
		PDEPlugin.getDefault().getLabelProvider().disconnect(this);
331
		PDEPlugin.getDefault().getLabelProvider().disconnect(this);
332
	}
332
	}
333
333
334
	public IFeatureModel[] getModels() {
334
	public IFeatureModel[] getModels() {
335
		final IPath home = getDropLocation();
335
		final IPath home = getDropLocation();
336
		final boolean useRuntimeLocation = fRuntimeLocationButton.getSelection() || getTargetHome().equals(fDropLocation.getText().trim());
336
		final boolean useRuntimeLocation = fRuntimeLocationButton.getSelection() || getTargetHome().equals(fDropLocation.getText().trim());
337
		IRunnableWithProgress runnable = new IRunnableWithProgress() {
337
		IRunnableWithProgress runnable = new IRunnableWithProgress() {
338
			public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
338
			public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
339
				monitor.beginTask(PDEUIMessages.FeatureImportWizard_messages_updating, IProgressMonitor.UNKNOWN);
339
				monitor.beginTask(PDEUIMessages.FeatureImportWizard_messages_updating, IProgressMonitor.UNKNOWN);
340
				ArrayList result = new ArrayList();
340
				ArrayList result = new ArrayList();
341
				if (useRuntimeLocation) {
341
				if (useRuntimeLocation) {
342
					IFeatureModel[] allModels = PDECore.getDefault().getFeatureModelManager().getModels();
342
					IFeatureModel[] allModels = PDECore.getDefault().getFeatureModelManager().getModels();
343
					for (int i = 0; i < allModels.length; i++)
343
					for (int i = 0; i < allModels.length; i++)
344
						if (allModels[i].getUnderlyingResource() == null)
344
						if (allModels[i].getUnderlyingResource() == null)
345
							result.add(allModels[i]);
345
							result.add(allModels[i]);
346
				} else {
346
				} else {
347
					MultiStatus errors = doLoadFeatures(result, createPath(home));
347
					MultiStatus errors = doLoadFeatures(result, createPath(home));
348
					if (errors != null && errors.getChildren().length > 0)
348
					if (errors != null && errors.getChildren().length > 0)
349
						PDEPlugin.log(errors);
349
						PDEPlugin.log(errors);
350
				}
350
				}
351
				fModels = (IFeatureModel[]) result.toArray(new IFeatureModel[result.size()]);
351
				fModels = (IFeatureModel[]) result.toArray(new IFeatureModel[result.size()]);
352
				monitor.done();
352
				monitor.done();
353
			}
353
			}
354
		};
354
		};
355
		IProgressService pservice = PlatformUI.getWorkbench().getProgressService();
355
		IProgressService pservice = PlatformUI.getWorkbench().getProgressService();
356
		try {
356
		try {
357
			pservice.busyCursorWhile(runnable);
357
			pservice.busyCursorWhile(runnable);
358
		} catch (InvocationTargetException e) {
358
		} catch (InvocationTargetException e) {
359
		} catch (InterruptedException e) {
359
		} catch (InterruptedException e) {
360
		}
360
		}
361
		return fModels;
361
		return fModels;
362
	}
362
	}
363
363
364
	private File createPath(IPath dropLocation) {
364
	private File createPath(IPath dropLocation) {
365
		File featuresDir = new File(dropLocation.toFile(), ICoreConstants.FEATURE_FOLDER_NAME);
365
		File featuresDir = new File(dropLocation.toFile(), ICoreConstants.FEATURE_FOLDER_NAME);
366
		if (featuresDir.exists())
366
		if (featuresDir.exists())
367
			return featuresDir;
367
			return featuresDir;
368
		return null;
368
		return null;
369
	}
369
	}
370
370
371
	private MultiStatus doLoadFeatures(ArrayList result, File path) {
371
	private MultiStatus doLoadFeatures(ArrayList result, File path) {
372
		if (path == null)
372
		if (path == null)
373
			return null;
373
			return null;
374
		File[] dirs = path.listFiles();
374
		File[] dirs = path.listFiles();
375
		if (dirs == null)
375
		if (dirs == null)
376
			return null;
376
			return null;
377
		ArrayList resultStatus = new ArrayList();
377
		ArrayList resultStatus = new ArrayList();
378
		for (int i = 0; i < dirs.length; i++) {
378
		for (int i = 0; i < dirs.length; i++) {
379
			File dir = dirs[i];
379
			File dir = dirs[i];
380
			if (dir.isDirectory()) {
380
			if (dir.isDirectory()) {
381
				File manifest = new File(dir, "feature.xml"); //$NON-NLS-1$
381
				File manifest = new File(dir, ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
382
				if (manifest.exists()) {
382
				if (manifest.exists()) {
383
					IStatus status = doLoadFeature(dir, manifest, result);
383
					IStatus status = doLoadFeature(dir, manifest, result);
384
					if (status != null)
384
					if (status != null)
385
						resultStatus.add(status);
385
						resultStatus.add(status);
386
				}
386
				}
387
			}
387
			}
388
		}
388
		}
389
		return new MultiStatus(IPDEUIConstants.PLUGIN_ID, IStatus.OK, (IStatus[]) resultStatus.toArray(new IStatus[resultStatus.size()]), PDEUIMessages.FeatureImportWizard_DetailedPage_problemsLoading, null);
389
		return new MultiStatus(IPDEUIConstants.PLUGIN_ID, IStatus.OK, (IStatus[]) resultStatus.toArray(new IStatus[resultStatus.size()]), PDEUIMessages.FeatureImportWizard_DetailedPage_problemsLoading, null);
390
	}
390
	}
391
391
392
	private IStatus doLoadFeature(File dir, File manifest, ArrayList result) {
392
	private IStatus doLoadFeature(File dir, File manifest, ArrayList result) {
393
		ExternalFeatureModel model = new ExternalFeatureModel();
393
		ExternalFeatureModel model = new ExternalFeatureModel();
394
		model.setInstallLocation(dir.getAbsolutePath());
394
		model.setInstallLocation(dir.getAbsolutePath());
395
		IStatus status = null;
395
		IStatus status = null;
396
396
397
		InputStream stream = null;
397
		InputStream stream = null;
398
398
399
		try {
399
		try {
400
			stream = new BufferedInputStream(new FileInputStream(manifest));
400
			stream = new BufferedInputStream(new FileInputStream(manifest));
401
			model.load(stream, false);
401
			model.load(stream, false);
402
			if (!model.isValid()) {
402
			if (!model.isValid()) {
403
				status = new Status(IStatus.WARNING, IPDEUIConstants.PLUGIN_ID, IStatus.OK, NLS.bind(PDEUIMessages.FeatureImportWizardPage_importHasInvalid, dir), null);
403
				status = new Status(IStatus.WARNING, IPDEUIConstants.PLUGIN_ID, IStatus.OK, NLS.bind(PDEUIMessages.FeatureImportWizardPage_importHasInvalid, dir), null);
404
			}
404
			}
405
		} catch (Exception e) {
405
		} catch (Exception e) {
406
			// Errors in the file
406
			// Errors in the file
407
			status = new Status(IStatus.ERROR, IPDEUIConstants.PLUGIN_ID, IStatus.OK, e.getMessage(), e);
407
			status = new Status(IStatus.ERROR, IPDEUIConstants.PLUGIN_ID, IStatus.OK, e.getMessage(), e);
408
		}
408
		}
409
		if (stream != null) {
409
		if (stream != null) {
410
			try {
410
			try {
411
				stream.close();
411
				stream.close();
412
			} catch (IOException e) {
412
			} catch (IOException e) {
413
			}
413
			}
414
		}
414
		}
415
		if (status == null)
415
		if (status == null)
416
			result.add(model);
416
			result.add(model);
417
		return status;
417
		return status;
418
	}
418
	}
419
419
420
	public IFeatureModel[] getSelectedModels() {
420
	public IFeatureModel[] getSelectedModels() {
421
		Object[] selected = fFeatureViewer.getCheckedElements();
421
		Object[] selected = fFeatureViewer.getCheckedElements();
422
		IFeatureModel[] result = new IFeatureModel[selected.length];
422
		IFeatureModel[] result = new IFeatureModel[selected.length];
423
		System.arraycopy(selected, 0, result, 0, selected.length);
423
		System.arraycopy(selected, 0, result, 0, selected.length);
424
		return result;
424
		return result;
425
	}
425
	}
426
426
427
	private void dialogChanged() {
427
	private void dialogChanged() {
428
		String message = null;
428
		String message = null;
429
		if (fFeatureViewer != null && fFeatureViewer.getTable().getItemCount() == 0)
429
		if (fFeatureViewer != null && fFeatureViewer.getTable().getItemCount() == 0)
430
			message = PDEUIMessages.FeatureImportWizard_messages_noFeatures;
430
			message = PDEUIMessages.FeatureImportWizard_messages_noFeatures;
431
431
432
		setMessage(message, IMessageProvider.INFORMATION);
432
		setMessage(message, IMessageProvider.INFORMATION);
433
		setPageComplete(fTablePart.getSelectionCount() > 0);
433
		setPageComplete(fTablePart.getSelectionCount() > 0);
434
	}
434
	}
435
435
436
	/* (non-Javadoc)
436
	/* (non-Javadoc)
437
	 * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
437
	 * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
438
	 */
438
	 */
439
	public boolean isPageComplete() {
439
	public boolean isPageComplete() {
440
		return fTablePart.getSelectionCount() > 0;
440
		return fTablePart.getSelectionCount() > 0;
441
	}
441
	}
442
442
443
	private void setLocation(String location) {
443
	private void setLocation(String location) {
444
		fSelfSetLocation = true;
444
		fSelfSetLocation = true;
445
		fDropLocation.setText(location);
445
		fDropLocation.setText(location);
446
		fSelfSetLocation = false;
446
		fSelfSetLocation = false;
447
	}
447
	}
448
}
448
}
(-)src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java (-5 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-19 Link Here
13
import java.io.File;
13
import java.io.File;
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.util.*;
15
import java.util.*;
16
import java.util.jar.JarFile;
17
import java.util.zip.ZipException;
16
import java.util.zip.ZipException;
18
import java.util.zip.ZipFile;
17
import java.util.zip.ZipFile;
19
import org.eclipse.core.resources.*;
18
import org.eclipse.core.resources.*;
Lines 32-37 Link Here
32
import org.eclipse.pde.internal.core.bundle.WorkspaceBundleModel;
31
import org.eclipse.pde.internal.core.bundle.WorkspaceBundleModel;
33
import org.eclipse.pde.internal.core.ibundle.IBundle;
32
import org.eclipse.pde.internal.core.ibundle.IBundle;
34
import org.eclipse.pde.internal.core.natures.PDE;
33
import org.eclipse.pde.internal.core.natures.PDE;
34
import org.eclipse.pde.internal.core.project.PDEProject;
35
import org.eclipse.pde.internal.core.util.CoreUtility;
35
import org.eclipse.pde.internal.core.util.CoreUtility;
36
import org.eclipse.pde.internal.ui.PDEPlugin;
36
import org.eclipse.pde.internal.ui.PDEPlugin;
37
import org.eclipse.pde.internal.ui.PDEUIMessages;
37
import org.eclipse.pde.internal.ui.PDEUIMessages;
Lines 402-408 Link Here
402
			monitor.beginTask("", 4); //$NON-NLS-1$
402
			monitor.beginTask("", 4); //$NON-NLS-1$
403
403
404
			// Extract the source, track build entries and package locations
404
			// Extract the source, track build entries and package locations
405
			WorkspaceBuildModel buildModel = new WorkspaceBuildModel(project.getFile("build.properties")); //$NON-NLS-1$
405
			WorkspaceBuildModel buildModel = new WorkspaceBuildModel(PDEProject.getBuildProperties(project));
406
			Map packageLocations = new HashMap(); // maps package path to a src folder 
406
			Map packageLocations = new HashMap(); // maps package path to a src folder 
407
			boolean sourceFound = extractSourceFolders(project, model, buildModel, packageLocations, new SubProgressMonitor(monitor, 1));
407
			boolean sourceFound = extractSourceFolders(project, model, buildModel, packageLocations, new SubProgressMonitor(monitor, 1));
408
			// If no source was found previously, check if there was a source folder (src) inside the binary plug-in
408
			// If no source was found previously, check if there was a source folder (src) inside the binary plug-in
Lines 1033-1039 Link Here
1033
	 * @param base
1033
	 * @param base
1034
	 */
1034
	 */
1035
	private void modifyBundleClasspathHeader(IProject project, IPluginModelBase base) {
1035
	private void modifyBundleClasspathHeader(IProject project, IPluginModelBase base) {
1036
		IFile file = project.getFile(JarFile.MANIFEST_NAME);
1036
		IFile file = PDEProject.getManifest(project);
1037
		if (file.exists()) {
1037
		if (file.exists()) {
1038
			WorkspaceBundleModel bmodel = new WorkspaceBundleModel(file);
1038
			WorkspaceBundleModel bmodel = new WorkspaceBundleModel(file);
1039
			IBundle bundle = bmodel.getBundle();
1039
			IBundle bundle = bmodel.getBundle();
Lines 1078-1084 Link Here
1078
		}
1078
		}
1079
1079
1080
		// If the build.properties file has a default source folder we need a java nature
1080
		// If the build.properties file has a default source folder we need a java nature
1081
		IFile buildProperties = project.getFile("build.properties"); //$NON-NLS-1$
1081
		IFile buildProperties = PDEProject.getBuildProperties(project);
1082
		if (buildProperties.exists()) {
1082
		if (buildProperties.exists()) {
1083
			WorkspaceBuildModel buildModel = new WorkspaceBuildModel(buildProperties);
1083
			WorkspaceBuildModel buildModel = new WorkspaceBuildModel(buildProperties);
1084
			buildModel.load();
1084
			buildModel.load();
(-)src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizardExpressPage.java (-1 / +2 lines)
Lines 24-29 Link Here
24
import org.eclipse.pde.core.plugin.PluginRegistry;
24
import org.eclipse.pde.core.plugin.PluginRegistry;
25
import org.eclipse.pde.internal.core.WorkspaceModelManager;
25
import org.eclipse.pde.internal.core.WorkspaceModelManager;
26
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
26
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
27
import org.eclipse.pde.internal.core.project.PDEProject;
27
import org.eclipse.pde.internal.ui.*;
28
import org.eclipse.pde.internal.ui.*;
28
import org.eclipse.pde.internal.ui.elements.DefaultContentProvider;
29
import org.eclipse.pde.internal.ui.elements.DefaultContentProvider;
29
import org.eclipse.pde.internal.ui.parts.WizardCheckboxTablePart;
30
import org.eclipse.pde.internal.ui.parts.WizardCheckboxTablePart;
Lines 241-247 Link Here
241
		try {
242
		try {
242
			IBuildModel buildModel = model.getBuildModel();
243
			IBuildModel buildModel = model.getBuildModel();
243
			if (buildModel == null) {
244
			if (buildModel == null) {
244
				IFile buildFile = model.getUnderlyingResource().getProject().getFile("build.properties"); //$NON-NLS-1$
245
				IFile buildFile = PDEProject.getBuildProperties(model.getUnderlyingResource().getProject());
245
				if (buildFile.exists()) {
246
				if (buildFile.exists()) {
246
					buildModel = new WorkspaceBuildModel(buildFile);
247
					buildModel = new WorkspaceBuildModel(buildFile);
247
					buildModel.load();
248
					buildModel.load();
(-)src/org/eclipse/pde/internal/ui/wizards/plugin/NewLibraryPluginCreationOperation.java (-8 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 36-41 Link Here
36
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
36
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
37
import org.eclipse.pde.internal.core.natures.PDE;
37
import org.eclipse.pde.internal.core.natures.PDE;
38
import org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase;
38
import org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase;
39
import org.eclipse.pde.internal.core.project.PDEProject;
39
import org.eclipse.pde.internal.ui.*;
40
import org.eclipse.pde.internal.ui.*;
40
import org.eclipse.pde.internal.ui.search.dependencies.AddNewBinaryDependenciesOperation;
41
import org.eclipse.pde.internal.ui.search.dependencies.AddNewBinaryDependenciesOperation;
41
import org.eclipse.pde.internal.ui.wizards.IProjectProvider;
42
import org.eclipse.pde.internal.ui.wizards.IProjectProvider;
Lines 81-89 Link Here
81
			if (resources[j] instanceof IFile) {
82
			if (resources[j] instanceof IFile) {
82
				if (".project".equals(resources[j].getName()) //$NON-NLS-1$
83
				if (".project".equals(resources[j].getName()) //$NON-NLS-1$
83
						|| ".classpath".equals(resources[j] //$NON-NLS-1$
84
						|| ".classpath".equals(resources[j] //$NON-NLS-1$
84
								.getName()) || "plugin.xml".equals(resources[j] //$NON-NLS-1$
85
								.getName()) || ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR.equals(resources[j].getName()) || ICoreConstants.BUILD_FILENAME_DESCRIPTOR.equals(resources[j].getName())) {
85
								.getName()) || "build.properties".equals(resources[j] //$NON-NLS-1$
86
								.getName())) {
87
					continue;
86
					continue;
88
				}
87
				}
89
				// resource at the root, export root
88
				// resource at the root, export root
Lines 149-155 Link Here
149
		}
148
		}
150
		if (requiredProjects.size() <= 0)
149
		if (requiredProjects.size() <= 0)
151
			return;
150
			return;
152
		IFile file = javaProject.getProject().getFile(ICoreConstants.MANIFEST_PATH);
151
		IFile file = PDEProject.getManifest(javaProject.getProject());
153
		try {
152
		try {
154
			// TODO format manifest
153
			// TODO format manifest
155
			Manifest manifest = new Manifest(file.getContents());
154
			Manifest manifest = new Manifest(file.getContents());
Lines 185-194 Link Here
185
		IProject other = workspaceRoot.getProject(entry.getPath().segment(0));
184
		IProject other = workspaceRoot.getProject(entry.getPath().segment(0));
186
		if (!PDE.hasPluginNature(other))
185
		if (!PDE.hasPluginNature(other))
187
			return false;
186
			return false;
188
		if (other.findMember(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR) != null)
187
		if (PDEProject.getFragmentXml(other).exists())
189
			return false;
188
			return false;
190
		try {
189
		try {
191
			InputStream is = other.getFile(ICoreConstants.MANIFEST_PATH).getContents();
190
			InputStream is = PDEProject.getManifest(other).getContents();
192
			try {
191
			try {
193
				Manifest mf = new Manifest(is);
192
				Manifest mf = new Manifest(is);
194
				if (mf.getMainAttributes().getValue(Constants.FRAGMENT_HOST) != null)
193
				if (mf.getMainAttributes().getValue(Constants.FRAGMENT_HOST) != null)
Lines 275-281 Link Here
275
		}
274
		}
276
275
277
		// delete manifest.mf imported from libraries
276
		// delete manifest.mf imported from libraries
278
		IFile importedManifest = project.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
277
		IFile importedManifest = PDEProject.getManifest(project);
279
		if (importedManifest.exists()) {
278
		if (importedManifest.exists()) {
280
			importedManifest.delete(true, false, monitor);
279
			importedManifest.delete(true, false, monitor);
281
			if (!fData.hasBundleStructure()) {
280
			if (!fData.hasBundleStructure()) {
(-)src/org/eclipse/pde/internal/ui/wizards/plugin/NewProjectCreationOperation.java (-6 / +10 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 30-35 Link Here
30
import org.eclipse.pde.internal.core.ibundle.*;
30
import org.eclipse.pde.internal.core.ibundle.*;
31
import org.eclipse.pde.internal.core.natures.PDE;
31
import org.eclipse.pde.internal.core.natures.PDE;
32
import org.eclipse.pde.internal.core.plugin.*;
32
import org.eclipse.pde.internal.core.plugin.*;
33
import org.eclipse.pde.internal.core.project.PDEProject;
33
import org.eclipse.pde.internal.core.util.CoreUtility;
34
import org.eclipse.pde.internal.core.util.CoreUtility;
34
import org.eclipse.pde.internal.ui.PDEPlugin;
35
import org.eclipse.pde.internal.ui.PDEPlugin;
35
import org.eclipse.pde.internal.ui.PDEUIMessages;
36
import org.eclipse.pde.internal.ui.PDEUIMessages;
Lines 90-96 Link Here
90
	}
91
	}
91
92
92
	private void createBuildPropertiesFile(IProject project) throws CoreException {
93
	private void createBuildPropertiesFile(IProject project) throws CoreException {
93
		IFile file = project.getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
94
		IFile file = PDEProject.getBuildProperties(project);
94
		if (!file.exists()) {
95
		if (!file.exists()) {
95
			WorkspaceBuildModel model = new WorkspaceBuildModel(file);
96
			WorkspaceBuildModel model = new WorkspaceBuildModel(file);
96
			IBuildModelFactory factory = model.getFactory();
97
			IBuildModelFactory factory = model.getFactory();
Lines 133-149 Link Here
133
	}
134
	}
134
135
135
	private void createManifest(IProject project) throws CoreException {
136
	private void createManifest(IProject project) throws CoreException {
137
		IFile fragmentXml = PDEProject.getFragmentXml(project);
138
		IFile pluginXml = PDEProject.getPluginXml(project);
136
		if (fData.hasBundleStructure()) {
139
		if (fData.hasBundleStructure()) {
140
			IFile manifest = PDEProject.getManifest(project);
137
			if (fData instanceof IFragmentFieldData) {
141
			if (fData instanceof IFragmentFieldData) {
138
				fModel = new WorkspaceBundleFragmentModel(project.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR), project.getFile(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR));
142
				fModel = new WorkspaceBundleFragmentModel(manifest, fragmentXml);
139
			} else {
143
			} else {
140
				fModel = new WorkspaceBundlePluginModel(project.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR), project.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR));
144
				fModel = new WorkspaceBundlePluginModel(manifest, pluginXml);
141
			}
145
			}
142
		} else {
146
		} else {
143
			if (fData instanceof IFragmentFieldData) {
147
			if (fData instanceof IFragmentFieldData) {
144
				fModel = new WorkspaceFragmentModel(project.getFile(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR), false);
148
				fModel = new WorkspaceFragmentModel(fragmentXml, false);
145
			} else {
149
			} else {
146
				fModel = new WorkspacePluginModel(project.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR), false);
150
				fModel = new WorkspacePluginModel(pluginXml, false);
147
			}
151
			}
148
		}
152
		}
149
		IPluginBase pluginBase = fModel.getPluginBase();
153
		IPluginBase pluginBase = fModel.getPluginBase();
(-)src/org/eclipse/pde/internal/ui/wizards/product/BaseManifestOperation.java (-4 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 21-26 Link Here
21
import org.eclipse.pde.internal.core.ibundle.*;
21
import org.eclipse.pde.internal.core.ibundle.*;
22
import org.eclipse.pde.internal.core.plugin.WorkspaceFragmentModel;
22
import org.eclipse.pde.internal.core.plugin.WorkspaceFragmentModel;
23
import org.eclipse.pde.internal.core.plugin.WorkspacePluginModel;
23
import org.eclipse.pde.internal.core.plugin.WorkspacePluginModel;
24
import org.eclipse.pde.internal.core.project.PDEProject;
24
import org.eclipse.pde.internal.core.text.bundle.BundleSymbolicNameHeader;
25
import org.eclipse.pde.internal.core.text.bundle.BundleSymbolicNameHeader;
25
import org.eclipse.pde.internal.ui.PDEPlugin;
26
import org.eclipse.pde.internal.ui.PDEPlugin;
26
import org.eclipse.pde.internal.ui.PDEUIMessages;
27
import org.eclipse.pde.internal.ui.PDEUIMessages;
Lines 46-57 Link Here
46
	protected IFile getFile() {
47
	protected IFile getFile() {
47
		IPluginModelBase model = PluginRegistry.findModel(fPluginId);
48
		IPluginModelBase model = PluginRegistry.findModel(fPluginId);
48
		IProject project = model.getUnderlyingResource().getProject();
49
		IProject project = model.getUnderlyingResource().getProject();
49
		String filename = model instanceof IFragmentModel ? ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR : ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR;
50
		return model instanceof IFragmentModel ? PDEProject.getFragmentXml(project) : PDEProject.getPluginXml(project);
50
		return project.getFile(filename);
51
	}
51
	}
52
52
53
	protected IPluginModelBase getModel(IFile file) {
53
	protected IPluginModelBase getModel(IFile file) {
54
		if ("plugin.xml".equals(file.getName())) //$NON-NLS-1$
54
		if (ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR.equals(file.getName()))
55
			return new WorkspacePluginModel(file, false);
55
			return new WorkspacePluginModel(file, false);
56
		return new WorkspaceFragmentModel(file, false);
56
		return new WorkspaceFragmentModel(file, false);
57
	}
57
	}
(-)src/org/eclipse/pde/internal/ui/wizards/product/UpdateSplashProgressOperation.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007,2009 IBM Corporation and others.
2
 * Copyright (c) 2007, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 20-27 Link Here
20
import org.eclipse.pde.core.build.IBuildEntry;
20
import org.eclipse.pde.core.build.IBuildEntry;
21
import org.eclipse.pde.core.build.IBuildModel;
21
import org.eclipse.pde.core.build.IBuildModel;
22
import org.eclipse.pde.core.plugin.*;
22
import org.eclipse.pde.core.plugin.*;
23
import org.eclipse.pde.internal.core.ICoreConstants;
24
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
23
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
24
import org.eclipse.pde.internal.core.project.PDEProject;
25
import org.eclipse.pde.internal.core.text.build.BuildModel;
25
import org.eclipse.pde.internal.core.text.build.BuildModel;
26
import org.eclipse.pde.internal.core.text.build.PropertiesTextChangeListener;
26
import org.eclipse.pde.internal.core.text.build.PropertiesTextChangeListener;
27
import org.eclipse.pde.internal.core.util.PDETextHelper;
27
import org.eclipse.pde.internal.core.util.PDETextHelper;
Lines 476-482 Link Here
476
		pluginCustomModel.save();
476
		pluginCustomModel.save();
477
477
478
		// add the file to build.properties
478
		// add the file to build.properties
479
		IFile buildProps = fProject.getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
479
		IFile buildProps = PDEProject.getBuildProperties(fProject);
480
		if (buildProps.exists()) {
480
		if (buildProps.exists()) {
481
			WorkspaceBuildModel model = new WorkspaceBuildModel(buildProps);
481
			WorkspaceBuildModel model = new WorkspaceBuildModel(buildProps);
482
			model.load();
482
			model.load();
(-)src/org/eclipse/pde/internal/ui/wizards/tools/ConvertProjectToPluginOperation.java (-6 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2009 IBM Corporation and others.
2
 * Copyright (c) 2007, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 28-33 Link Here
28
import org.eclipse.pde.internal.core.ibundle.IBundle;
28
import org.eclipse.pde.internal.core.ibundle.IBundle;
29
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
29
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
30
import org.eclipse.pde.internal.core.natures.PDE;
30
import org.eclipse.pde.internal.core.natures.PDE;
31
import org.eclipse.pde.internal.core.project.PDEProject;
31
import org.eclipse.pde.internal.core.util.CoreUtility;
32
import org.eclipse.pde.internal.core.util.CoreUtility;
32
import org.eclipse.pde.internal.core.util.IdUtil;
33
import org.eclipse.pde.internal.core.util.IdUtil;
33
import org.eclipse.pde.internal.ui.PDEPlugin;
34
import org.eclipse.pde.internal.ui.PDEPlugin;
Lines 105-120 Link Here
105
		loadClasspathEntries(projectToConvert, monitor);
106
		loadClasspathEntries(projectToConvert, monitor);
106
		loadLibraryName(projectToConvert);
107
		loadLibraryName(projectToConvert);
107
108
108
		createManifestFile(projectToConvert.getFile(PDEModelUtility.F_MANIFEST_FP), monitor);
109
		createManifestFile(PDEProject.getManifest(projectToConvert), monitor);
109
110
110
		IFile buildFile = projectToConvert.getFile(PDEModelUtility.F_BUILD);
111
		IFile buildFile = PDEProject.getBuildProperties(projectToConvert);
111
		if (!buildFile.exists()) {
112
		if (!buildFile.exists()) {
112
			WorkspaceBuildModel model = new WorkspaceBuildModel(buildFile);
113
			WorkspaceBuildModel model = new WorkspaceBuildModel(buildFile);
113
			IBuild build = model.getBuild(true);
114
			IBuild build = model.getBuild(true);
114
			IBuildEntry entry = model.getFactory().createEntry(IBuildEntry.BIN_INCLUDES);
115
			IBuildEntry entry = model.getFactory().createEntry(IBuildEntry.BIN_INCLUDES);
115
			if (projectToConvert.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR).exists())
116
			if (PDEProject.getPluginXml(projectToConvert).exists())
116
				entry.addToken(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
117
				entry.addToken(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
117
			if (projectToConvert.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR).exists())
118
			if (PDEProject.getManifest(projectToConvert).exists())
118
				entry.addToken(ICoreConstants.MANIFEST_FOLDER_NAME);
119
				entry.addToken(ICoreConstants.MANIFEST_FOLDER_NAME);
119
			for (int i = 0; i < fLibEntries.length; i++) {
120
			for (int i = 0; i < fLibEntries.length; i++) {
120
				entry.addToken(fLibEntries[i]);
121
				entry.addToken(fLibEntries[i]);
Lines 191-197 Link Here
191
	}
192
	}
192
193
193
	private void organizeExports(final IProject project) {
194
	private void organizeExports(final IProject project) {
194
		PDEModelUtility.modifyModel(new ModelModification(project.getFile(PDEModelUtility.F_MANIFEST_FP)) {
195
		PDEModelUtility.modifyModel(new ModelModification(PDEProject.getManifest(project)) {
195
			protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException {
196
			protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException {
196
				if (!(model instanceof IBundlePluginModelBase))
197
				if (!(model instanceof IBundlePluginModelBase))
197
					return;
198
					return;
(-)src/org/eclipse/pde/internal/ui/wizards/tools/OrganizeManifest.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 30-35 Link Here
30
import org.eclipse.pde.internal.core.*;
30
import org.eclipse.pde.internal.core.*;
31
import org.eclipse.pde.internal.core.ibundle.*;
31
import org.eclipse.pde.internal.core.ibundle.*;
32
import org.eclipse.pde.internal.core.ischema.*;
32
import org.eclipse.pde.internal.core.ischema.*;
33
import org.eclipse.pde.internal.core.project.PDEProject;
33
import org.eclipse.pde.internal.core.schema.SchemaRegistry;
34
import org.eclipse.pde.internal.core.schema.SchemaRegistry;
34
import org.eclipse.pde.internal.core.text.*;
35
import org.eclipse.pde.internal.core.text.*;
35
import org.eclipse.pde.internal.core.text.bundle.*;
36
import org.eclipse.pde.internal.core.text.bundle.*;
Lines 188-195 Link Here
188
		IExtensions ext = modelBase.getExtensions();
189
		IExtensions ext = modelBase.getExtensions();
189
		if (ext.getExtensionPoints().length > 0 || ext.getExtensions().length > 0)
190
		if (ext.getExtensionPoints().length > 0 || ext.getExtensions().length > 0)
190
			return null;
191
			return null;
191
		String name = (modelBase instanceof IBundleFragmentModel) ? ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR : ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR;
192
		IFile pluginFile = (modelBase instanceof IBundleFragmentModel) ? PDEProject.getFragmentXml(project) : PDEProject.getPluginXml(project);
192
		IFile pluginFile = project.getFile(name);
193
		return new DeleteResourceChange(pluginFile.getFullPath(), true);
193
		return new DeleteResourceChange(pluginFile.getFullPath(), true);
194
	}
194
	}
195
195
(-)src/org/eclipse/pde/internal/ui/wizards/tools/OrganizeManifestsAction.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2005, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2005, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 19-25 Link Here
19
import org.eclipse.jface.viewers.ISelection;
19
import org.eclipse.jface.viewers.ISelection;
20
import org.eclipse.jface.viewers.IStructuredSelection;
20
import org.eclipse.jface.viewers.IStructuredSelection;
21
import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
21
import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
22
import org.eclipse.pde.internal.core.ICoreConstants;
22
import org.eclipse.pde.internal.core.project.PDEProject;
23
import org.eclipse.pde.internal.ui.PDEPlugin;
23
import org.eclipse.pde.internal.ui.PDEPlugin;
24
import org.eclipse.pde.internal.ui.PDEUIMessages;
24
import org.eclipse.pde.internal.ui.PDEUIMessages;
25
import org.eclipse.pde.internal.ui.refactoring.PDERefactor;
25
import org.eclipse.pde.internal.ui.refactoring.PDERefactor;
Lines 55-61 Link Here
55
					proj = ((IFile) element).getProject();
55
					proj = ((IFile) element).getProject();
56
				else if (element instanceof IProject)
56
				else if (element instanceof IProject)
57
					proj = (IProject) element;
57
					proj = (IProject) element;
58
				if (proj != null && proj.exists(ICoreConstants.MANIFEST_PATH))
58
				if (proj != null && PDEProject.getManifest(proj).exists())
59
					projects.add(proj);
59
					projects.add(proj);
60
			}
60
			}
61
			if (projects.size() > 0) {
61
			if (projects.size() > 0) {
(-)src/org/eclipse/pde/ui/tests/model/xml/ManifestEditorSpellCheckTestCase.java (-1 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.tests.model.xml;
11
package org.eclipse.pde.ui.tests.model.xml;
12
12
13
import org.eclipse.pde.internal.core.ICoreConstants;
14
13
import junit.framework.Test;
15
import junit.framework.Test;
14
import junit.framework.TestSuite;
16
import junit.framework.TestSuite;
15
17
Lines 63-69 Link Here
63
	public void testNoSpellingAnnotation(){
65
	public void testNoSpellingAnnotation(){
64
66
65
		try {
67
		try {
66
			createAndOpenFile("plugin.xml", fDocument.get());
68
			createAndOpenFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR, fDocument.get());
67
		} catch (CoreException e) {
69
		} catch (CoreException e) {
68
			fail(e.getMessage());
70
			fail(e.getMessage());
69
			e.printStackTrace();
71
			e.printStackTrace();
(-)src/org/eclipse/pde/ui/tests/project/BundleRootTests.java (+232 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 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.ui.tests.project;
12
13
import org.eclipse.pde.core.project.IBundleProjectService;
14
15
import org.eclipse.pde.internal.core.PDECore;
16
17
import junit.framework.TestCase;
18
import org.eclipse.core.resources.*;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.jdt.core.JavaCore;
21
import org.eclipse.pde.core.plugin.IPluginModelBase;
22
import org.eclipse.pde.core.plugin.PluginRegistry;
23
import org.eclipse.pde.core.project.*;
24
import org.eclipse.pde.internal.core.natures.PDE;
25
import org.eclipse.pde.internal.core.project.PDEProject;
26
import org.osgi.framework.Version;
27
28
/**
29
 * Tests flexible bundle root location within PDE projects.
30
 * @since 3.6
31
 */
32
public class BundleRootTests extends TestCase {
33
	
34
	protected IBundleProjectService getBundleProjectService() {
35
		return (IBundleProjectService) PDECore.getDefault().acquireService(IBundleProjectService.class.getName());
36
	}
37
	
38
	/**
39
	 * Creates and returns a project for the test case.
40
	 * 
41
	 * @param test test case
42
	 * @return project test project
43
	 * @exception CoreException on failure
44
	 */
45
	protected IProject createProject() throws CoreException {
46
		String name = getName().toLowerCase().substring(4);
47
		name = "test." + name;
48
		IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
49
		assertFalse("Project should not exist", proj.exists());
50
		proj.create(null);
51
		proj.open(null);
52
		return proj;
53
	}
54
	
55
	/**
56
	 * Provides a project for the test case.
57
	 * 
58
	 * @param test test case
59
	 * @return project which does not yet exist
60
	 * @exception CoreException on failure
61
	 */
62
	protected IBundleProjectDescription newProject() throws CoreException {
63
		String name = getName().toLowerCase().substring(4);
64
		name = "test." + name;
65
		IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
66
		assertFalse("Project should not exist", proj.exists());
67
		IBundleProjectDescription description = getBundleProjectService().getDescription(proj);
68
		description.setSymbolicName(proj.getName());
69
		return description;
70
	}	
71
72
	/**
73
	 * Tests setting/getting the bundle root property for a project.
74
	 */
75
	public void testSetGetLocation() throws CoreException {
76
		IProject project = createProject();
77
		assertEquals("Bundle root unspecified - should be project itself", project, PDEProject.getBundleRoot(project));
78
		// set to something
79
		IFolder folder = project.getFolder(new Path("bundle/root"));
80
		PDEProject.setBundleRoot(project, folder);
81
		assertEquals("Wrong bundle root", folder, PDEProject.getBundleRoot(project));	
82
		// set to null
83
		PDEProject.setBundleRoot(project, null);
84
		assertEquals("Bundle root unspecified - should be project itself", project, PDEProject.getBundleRoot(project));
85
		// set to empty project itself
86
		PDEProject.setBundleRoot(project, project);
87
		assertEquals("Bundle root unspecified - should be project itself", project, PDEProject.getBundleRoot(project));
88
	}
89
	
90
	/**
91
	 * Test getting a root location from a non-existent project
92
	 */
93
	public void testGetOnNonExistantProject() {
94
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getName());
95
		assertFalse("Project should not exist", project.exists());
96
		assertEquals("Root location should be project root", project, PDEProject.getBundleRoot(project));
97
	}
98
	
99
	/**
100
	 * Tests that IPluginModel.getInstallLocation() returns the bundle root location in a project.
101
	 * @throws CoreException 
102
	 */
103
	public void testPluginModelInstallLocation() throws CoreException {
104
		IBundleProjectDescription description = newProject();
105
		IProject project = description.getProject();
106
		IPath root = new Path("some/place");
107
		description.setBundleRoot(root);
108
		IBundleClasspathEntry cp1 = getBundleProjectService().newBundleClasspathEntry(new Path("src"), new Path("bin"), new Path("the.jar"));
109
		description.setBundleClassath(new IBundleClasspathEntry[]{cp1});
110
		IPath nls = new Path("plugin.properties");
111
		description.setLocalization(nls);
112
		description.apply(null);
113
		
114
		IPluginModelBase model = PluginRegistry.findModel(project);
115
		assertEquals("Wrong install location", project.getFolder(root).getLocation(), new Path(model.getInstallLocation()));
116
	}
117
	
118
	/**
119
	 * Minimal bundle project with a non-default root - set a symbolic name, and go.
120
	 * 
121
	 * @throws CoreException
122
	 */
123
	public void testBundleRoot() throws CoreException {
124
		IBundleProjectDescription description = newProject();
125
		IProject project = description.getProject();
126
		IPath root = new Path("bundle/root");
127
		description.setBundleRoot(root);
128
		IBundleClasspathEntry cp1 = getBundleProjectService().newBundleClasspathEntry(new Path("src"), new Path("bin"), new Path("the.jar"));
129
		description.setBundleClassath(new IBundleClasspathEntry[]{cp1});
130
		IPath nls = new Path("plugin.properties");
131
		description.setLocalization(nls);
132
		description.setActivator("org.eclipse.foo.SomeActivator");
133
		description.apply(null);
134
		
135
		IBundleProjectDescription d2 = getBundleProjectService().getDescription(project);
136
		
137
		assertEquals("Wrong bundle root", root, d2.getBundleRoot());
138
		assertEquals("Should be no activator", "org.eclipse.foo.SomeActivator", d2.getActivator());
139
		IPath[] binIncludes = d2.getBinIncludes();
140
		assertNull("Wrong number of entries on bin.includes", binIncludes);
141
		IBundleClasspathEntry[] classpath = d2.getBundleClasspath();
142
		assertNotNull("Wrong Bundle-Classpath", classpath);
143
		assertEquals("Wrong number of Bundle-Classpath entries", 1, classpath.length);
144
		assertEquals("Wrong Bundle-Classpath entry", cp1, classpath[0]);
145
		assertEquals("Wrong Bundle-Name", project.getName(), d2.getBundleName());
146
		assertNull("Wrong Bundle-Vendor", d2.getBundleVendor());
147
		assertEquals("Wrong version", "1.0.0.qualifier", d2.getBundleVersion().toString());
148
		assertEquals("Wrong default output folder", new Path("bin"), d2.getDefaultOutputFolder());
149
		assertNull("Wrong execution environments", d2.getExecutionEnvironments());
150
		assertNull("Wrong host", d2.getHost());
151
		assertEquals("Wrong localization", nls, d2.getLocalization());
152
		assertNull("Wrong project location URI", d2.getLocationURI());
153
		String[] natureIds = d2.getNatureIds();
154
		assertEquals("Wrong number of natures", 2, natureIds.length);
155
		assertEquals("Wrong nature", PDE.PLUGIN_NATURE, natureIds[0]);
156
		assertEquals("Wrong nature", JavaCore.NATURE_ID, natureIds[1]);
157
		assertNull("Wrong imports", d2.getPackageImports());
158
		assertNull("Wrong exports", d2.getPackageExports());
159
		assertEquals("Wrong project", project, d2.getProject());
160
		assertNull("Wrong required bundles", d2.getRequiredBundles());
161
		assertNull("Wrong target version", d2.getTargetVersion());
162
		assertEquals("Wrong symbolic name", project.getName(), d2.getSymbolicName());
163
		assertFalse("Wrong Equinox headers", d2.isEquinoxHeaders());
164
		assertFalse("Wrong singleton", d2.isSingleton());
165
	}
166
	
167
	/**
168
	 * Creates a bundle project at a root location, and then removes PDE/Java natures. Then attempts create
169
	 * a bundle project out of the existing data.
170
	 * 
171
	 * @throws CoreException
172
	 */
173
	public void testAssignRootToExistingProject() throws CoreException {
174
		testBundleRoot(); // create a simple bundle
175
		
176
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("test.assignroottoexistingproject");
177
		
178
		// remove PDE nature
179
		IProjectDescription description = project.getDescription();
180
		description.setNatureIds(new String[]{JavaCore.NATURE_ID});
181
		project.setDescription(description, null);
182
		
183
		// remove existing root property
184
		PDEProject.setBundleRoot(project, null);
185
		
186
		IBundleProjectService service = getBundleProjectService();
187
		// reset the root
188
		Path root = new Path("bundle/root");
189
		service.setBundleRoot(project, root);
190
		
191
		// Resurrect the bundle project, with a modified version
192
		IBundleProjectDescription bpd = service.getDescription(project);
193
		bpd.setBundleVendor("Some Vendor");
194
		bpd.setBundleVersion(new Version("2.0.0"));
195
		bpd.setNatureIds(new String[]{PDE.PLUGIN_NATURE, JavaCore.NATURE_ID});
196
		bpd.apply(null);
197
		
198
		// validate
199
		IBundleProjectDescription d2 = service.getDescription(project);
200
		IPath nls = new Path("plugin.properties");
201
		IBundleClasspathEntry cp1 = service.newBundleClasspathEntry(new Path("src"), new Path("bin"), new Path("the.jar"));
202
		
203
		assertEquals("Wrong bundle root", root, d2.getBundleRoot());
204
		assertEquals("Should be no activator", "org.eclipse.foo.SomeActivator", d2.getActivator());
205
		IPath[] binIncludes = d2.getBinIncludes();
206
		assertNull("Wrong number of entries on bin.includes", binIncludes);
207
		IBundleClasspathEntry[] classpath = d2.getBundleClasspath();
208
		assertNotNull("Wrong Bundle-Classpath", classpath);
209
		assertEquals("Wrong number of Bundle-Classpath entries", 1, classpath.length);
210
		assertEquals("Wrong Bundle-Classpath entry", cp1, classpath[0]);
211
		assertEquals("Wrong Bundle-Name", project.getName(), d2.getBundleName());
212
		assertEquals("Wrong Bundle-Vendor", "Some Vendor", d2.getBundleVendor());
213
		assertEquals("Wrong version", "2.0.0", d2.getBundleVersion().toString());
214
		assertEquals("Wrong default output folder", new Path("bin"), d2.getDefaultOutputFolder());
215
		assertNull("Wrong execution environments", d2.getExecutionEnvironments());
216
		assertNull("Wrong host", d2.getHost());
217
		assertEquals("Wrong localization", nls, d2.getLocalization());
218
		assertNull("Wrong project location URI", d2.getLocationURI());
219
		String[] natureIds = d2.getNatureIds();
220
		assertEquals("Wrong number of natures", 2, natureIds.length);
221
		assertEquals("Wrong nature", PDE.PLUGIN_NATURE, natureIds[0]);
222
		assertEquals("Wrong nature", JavaCore.NATURE_ID, natureIds[1]);
223
		assertNull("Wrong imports", d2.getPackageImports());
224
		assertNull("Wrong exports", d2.getPackageExports());
225
		assertEquals("Wrong project", project, d2.getProject());
226
		assertNull("Wrong required bundles", d2.getRequiredBundles());
227
		assertNull("Wrong target version", d2.getTargetVersion());
228
		assertEquals("Wrong symbolic name", project.getName(), d2.getSymbolicName());
229
		assertFalse("Wrong Equinox headers", d2.isEquinoxHeaders());
230
		assertFalse("Wrong singleton", d2.isSingleton());
231
	}
232
}
(-)src/org/eclipse/pde/ui/tests/project/ProjectCreationTests.java (-56 / +81 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.tests.project;
11
package org.eclipse.pde.ui.tests.project;
12
12
13
import org.eclipse.pde.core.project.IBundleProjectService;
14
15
import org.eclipse.pde.internal.core.PDECore;
16
17
import org.eclipse.pde.internal.core.ICoreConstants;
18
13
import java.io.*;
19
import java.io.*;
14
import java.net.URL;
20
import java.net.URL;
15
import junit.framework.*;
21
import junit.framework.*;
Lines 29-35 Link Here
29
 */
35
 */
30
public class ProjectCreationTests extends TestCase {
36
public class ProjectCreationTests extends TestCase {
31
	
37
	
32
	private static final IBundleClasspathEntry DEFAULT_BUNDLE_CLASSPATH_ENTRY = Factory.newBundleClasspathEntry(null, null, new Path(".")); 
38
	protected static final IBundleClasspathEntry DEFAULT_BUNDLE_CLASSPATH_ENTRY; 
39
	
40
	static {
41
		DEFAULT_BUNDLE_CLASSPATH_ENTRY = getBundleProjectService().newBundleClasspathEntry(null, null, new Path("."));
42
	}
43
	
44
	public static IBundleProjectService getBundleProjectService() {
45
		return (IBundleProjectService) PDECore.getDefault().acquireService(IBundleProjectService.class.getName());
46
	}
33
47
34
	public static Test suite() {
48
	public static Test suite() {
35
		return new TestSuite(ProjectCreationTests.class);
49
		return new TestSuite(ProjectCreationTests.class);
Lines 47-53 Link Here
47
		name = "test." + name;
61
		name = "test." + name;
48
		IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
62
		IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
49
		assertFalse("Project should not exist", proj.exists());
63
		assertFalse("Project should not exist", proj.exists());
50
		IBundleProjectDescription description = Factory.getDescription(proj);
64
		IBundleProjectDescription description = getBundleProjectService().getDescription(proj);
51
		description.setSymbolicName(proj.getName());
65
		description.setSymbolicName(proj.getName());
52
		return description;
66
		return description;
53
	}
67
	}
Lines 62-68 Link Here
62
		IProject project = description.getProject();
76
		IProject project = description.getProject();
63
		description.apply(null);
77
		description.apply(null);
64
		
78
		
65
		IBundleProjectDescription d2 = Factory.getDescription(project);
79
		IBundleProjectDescription d2 = getBundleProjectService().getDescription(project);
66
		
80
		
67
		assertNull("Should be no activator", d2.getActivator());
81
		assertNull("Should be no activator", d2.getActivator());
68
		IPath[] binIncludes = d2.getBinIncludes();
82
		IPath[] binIncludes = d2.getBinIncludes();
Lines 101-111 Link Here
101
	public void testFragment() throws CoreException {
115
	public void testFragment() throws CoreException {
102
		IBundleProjectDescription description = newProject();
116
		IBundleProjectDescription description = newProject();
103
		IProject project = description.getProject();
117
		IProject project = description.getProject();
104
		IHostDescription host = Factory.newHost("some.host", null);
118
		IBundleProjectService service = getBundleProjectService();
119
		IHostDescription host = service.newHost("some.host", null);
105
		description.setHost(host);
120
		description.setHost(host);
106
		description.apply(null);
121
		description.apply(null);
107
		
122
		
108
		IBundleProjectDescription d2 = Factory.getDescription(project);
123
		IBundleProjectDescription d2 = service.getDescription(project);
109
		
124
		
110
		assertNull("Should be no activator", d2.getActivator());
125
		assertNull("Should be no activator", d2.getActivator());
111
		IPath[] binIncludes = d2.getBinIncludes();
126
		IPath[] binIncludes = d2.getBinIncludes();
Lines 145-157 Link Here
145
		IBundleProjectDescription description = newProject();
160
		IBundleProjectDescription description = newProject();
146
		IProject project = description.getProject();
161
		IProject project = description.getProject();
147
		description.setBundleVersion(new Version("1.2.2"));
162
		description.setBundleVersion(new Version("1.2.2"));
148
		IHostDescription host = Factory.newHost("some.host", new VersionRange(new Version("1.0.0"), true, new Version("2.0.0"), false));
163
		IBundleProjectService service = getBundleProjectService();
164
		IHostDescription host = service.newHost("some.host", new VersionRange(new Version("1.0.0"), true, new Version("2.0.0"), false));
149
		description.setHost(host);
165
		description.setHost(host);
150
		IBundleClasspathEntry e1 = Factory.newBundleClasspathEntry(new Path("frag"), new Path("bin"), new Path("frag.jar"));
166
		IBundleClasspathEntry e1 = service.newBundleClasspathEntry(new Path("frag"), new Path("bin"), new Path("frag.jar"));
151
		description.setBundleClassath(new IBundleClasspathEntry[]{e1});
167
		description.setBundleClassath(new IBundleClasspathEntry[]{e1});
152
		description.apply(null);
168
		description.apply(null);
153
		
169
		
154
		IBundleProjectDescription d2 = Factory.getDescription(project);
170
		IBundleProjectDescription d2 = service.getDescription(project);
155
		
171
		
156
		assertNull("Should be no activator", d2.getActivator());
172
		assertNull("Should be no activator", d2.getActivator());
157
		IPath[] binIncludes = d2.getBinIncludes();
173
		IPath[] binIncludes = d2.getBinIncludes();
Lines 190-202 Link Here
190
	public void testTwoSourceFoldersOneJar() throws CoreException {
206
	public void testTwoSourceFoldersOneJar() throws CoreException {
191
		IBundleProjectDescription description = newProject();
207
		IBundleProjectDescription description = newProject();
192
		IProject project = description.getProject();
208
		IProject project = description.getProject();
193
		IBundleClasspathEntry e1 = Factory.newBundleClasspathEntry(new Path("src1"), null, new Path("the.jar"));
209
		IBundleProjectService service = getBundleProjectService();
194
		IBundleClasspathEntry e2 = Factory.newBundleClasspathEntry(new Path("src2"), null, new Path("the.jar"));
210
		IBundleClasspathEntry e1 = service.newBundleClasspathEntry(new Path("src1"), null, new Path("the.jar"));
211
		IBundleClasspathEntry e2 = service.newBundleClasspathEntry(new Path("src2"), null, new Path("the.jar"));
195
		description.setBundleClassath(new IBundleClasspathEntry[]{e1, e2});
212
		description.setBundleClassath(new IBundleClasspathEntry[]{e1, e2});
196
		description.setBundleVersion(new Version("1.2.3"));
213
		description.setBundleVersion(new Version("1.2.3"));
197
		description.apply(null);
214
		description.apply(null);
198
		
215
		
199
		IBundleProjectDescription d2 = Factory.getDescription(project);
216
		IBundleProjectDescription d2 = service.getDescription(project);
200
		
217
		
201
		assertNull("Should be no activator", d2.getActivator());
218
		assertNull("Should be no activator", d2.getActivator());
202
		IPath[] binIncludes = d2.getBinIncludes();
219
		IPath[] binIncludes = d2.getBinIncludes();
Lines 236-248 Link Here
236
	public void testTwoSourceFoldersTwoJars() throws CoreException {
253
	public void testTwoSourceFoldersTwoJars() throws CoreException {
237
		IBundleProjectDescription description = newProject();
254
		IBundleProjectDescription description = newProject();
238
		IProject project = description.getProject();
255
		IProject project = description.getProject();
239
		IBundleClasspathEntry e1 = Factory.newBundleClasspathEntry(new Path("src1"), null, new Path("."));
256
		IBundleProjectService service = getBundleProjectService();
240
		IBundleClasspathEntry e2 = Factory.newBundleClasspathEntry(new Path("src2"), new Path("bin2"), new Path("two.jar"));
257
		IBundleClasspathEntry e1 = service.newBundleClasspathEntry(new Path("src1"), null, new Path("."));
258
		IBundleClasspathEntry e2 = service.newBundleClasspathEntry(new Path("src2"), new Path("bin2"), new Path("two.jar"));
241
		description.setBundleClassath(new IBundleClasspathEntry[]{e1, e2});
259
		description.setBundleClassath(new IBundleClasspathEntry[]{e1, e2});
242
		description.setBundleVersion(new Version("1.2.3"));
260
		description.setBundleVersion(new Version("1.2.3"));
243
		description.apply(null);
261
		description.apply(null);
244
		
262
		
245
		IBundleProjectDescription d2 = Factory.getDescription(project);
263
		IBundleProjectDescription d2 = service.getDescription(project);
246
		
264
		
247
		assertNull("Should be no activator", d2.getActivator());
265
		assertNull("Should be no activator", d2.getActivator());
248
		IPath[] binIncludes = d2.getBinIncludes();
266
		IPath[] binIncludes = d2.getBinIncludes();
Lines 283-290 Link Here
283
		IProject project = description.getProject();
301
		IProject project = description.getProject();
284
		description.setSingleton(true);
302
		description.setSingleton(true);
285
		description.apply(null);
303
		description.apply(null);
286
		
304
		IBundleProjectService service = getBundleProjectService();
287
		IBundleProjectDescription d2 = Factory.getDescription(project);
305
		IBundleProjectDescription d2 = service.getDescription(project);
288
		assertNull("Should be no activator", d2.getActivator());
306
		assertNull("Should be no activator", d2.getActivator());
289
		IPath[] binIncludes = d2.getBinIncludes();
307
		IPath[] binIncludes = d2.getBinIncludes();
290
		assertNull("Wrong number of entries on bin.includes", binIncludes);
308
		assertNull("Wrong number of entries on bin.includes", binIncludes);
Lines 324-339 Link Here
324
		IProject project = description.getProject();
342
		IProject project = description.getProject();
325
		description.setSingleton(true);
343
		description.setSingleton(true);
326
		IPath src = new Path("src");
344
		IPath src = new Path("src");
327
		IBundleClasspathEntry spec = Factory.newBundleClasspathEntry(src, null, new Path("."));
345
		IBundleProjectService service = getBundleProjectService();
346
		IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
328
		description.setBundleClassath(new IBundleClasspathEntry[] {spec});
347
		description.setBundleClassath(new IBundleClasspathEntry[] {spec});
329
		IPackageExportDescription ex0 = Factory.newPackageExport("a.b.c", new Version("2.0.0"), true, null);
348
		IPackageExportDescription ex0 = service.newPackageExport("a.b.c", new Version("2.0.0"), true, null);
330
		IPackageExportDescription ex1 = Factory.newPackageExport("a.b.c.interal", null, false, null);
349
		IPackageExportDescription ex1 = service.newPackageExport("a.b.c.interal", null, false, null);
331
		IPackageExportDescription ex2 = Factory.newPackageExport("a.b.c.interal.x", null, false, new String[]{"x.y.z"});
350
		IPackageExportDescription ex2 = service.newPackageExport("a.b.c.interal.x", null, false, new String[]{"x.y.z"});
332
		IPackageExportDescription ex3 = Factory.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false, new String[]{"d.e.f", "g.h.i"});
351
		IPackageExportDescription ex3 = service.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false, new String[]{"d.e.f", "g.h.i"});
333
		description.setPackageExports(new IPackageExportDescription[]{ex0, ex1, ex2, ex3});
352
		description.setPackageExports(new IPackageExportDescription[]{ex0, ex1, ex2, ex3});
334
		description.apply(null);
353
		description.apply(null);
335
		
354
		
336
		IBundleProjectDescription d2 = Factory.getDescription(project);
355
		IBundleProjectDescription d2 = service.getDescription(project);
337
		assertNull("Should be no activator", d2.getActivator());
356
		assertNull("Should be no activator", d2.getActivator());
338
		IPath[] binIncludes = d2.getBinIncludes();
357
		IPath[] binIncludes = d2.getBinIncludes();
339
		assertNull("Wrong number of entries on bin.includes", binIncludes);
358
		assertNull("Wrong number of entries on bin.includes", binIncludes);
Lines 379-396 Link Here
379
		IProject project = description.getProject();
398
		IProject project = description.getProject();
380
		description.setSingleton(true);
399
		description.setSingleton(true);
381
		IPath src = new Path("src");
400
		IPath src = new Path("src");
382
		IBundleClasspathEntry spec = Factory.newBundleClasspathEntry(src, null, new Path("."));
401
		IBundleProjectService service = getBundleProjectService();
402
		IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
383
		description.setBundleClassath(new IBundleClasspathEntry[] {spec});
403
		description.setBundleClassath(new IBundleClasspathEntry[] {spec});
384
		description.apply(null);
404
		description.apply(null);
385
		
405
		
386
		// modify
406
		// modify
387
		IBundleProjectDescription modify = Factory.getDescription(project);
407
		IBundleProjectDescription modify = service.getDescription(project);
388
		IHostDescription host = Factory.newHost("host." + project.getName(), new VersionRange("[1.0.0,2.0.0)"));
408
		IHostDescription host = service.newHost("host." + project.getName(), new VersionRange("[1.0.0,2.0.0)"));
389
		modify.setHost(host);
409
		modify.setHost(host);
390
		modify.apply(null);
410
		modify.apply(null);
391
		
411
		
392
		// validate
412
		// validate
393
		IBundleProjectDescription d2 = Factory.getDescription(project);
413
		IBundleProjectDescription d2 = service.getDescription(project);
394
		assertNull("Should be no activator", d2.getActivator());
414
		assertNull("Should be no activator", d2.getActivator());
395
		IPath[] binIncludes = d2.getBinIncludes();
415
		IPath[] binIncludes = d2.getBinIncludes();
396
		assertNull("Wrong number of entries on bin.includes", binIncludes);
416
		assertNull("Wrong number of entries on bin.includes", binIncludes);
Lines 431-457 Link Here
431
		IProject project = description.getProject();
451
		IProject project = description.getProject();
432
		description.setSingleton(true);
452
		description.setSingleton(true);
433
		IPath src = new Path("src");
453
		IPath src = new Path("src");
434
		IBundleClasspathEntry spec = Factory.newBundleClasspathEntry(src, null, new Path("."));
454
		IBundleProjectService service = getBundleProjectService();
455
		IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
435
		description.setBundleClassath(new IBundleClasspathEntry[] {spec});
456
		description.setBundleClassath(new IBundleClasspathEntry[] {spec});
436
		description.setBinIncludes(new IPath[]{new Path("plugin.xml")});
457
		description.setBinIncludes(new IPath[]{new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)});
437
		description.setActivator("org.eclipse.foo.Activator");
458
		description.setActivator("org.eclipse.foo.Activator");
438
		description.setEqunioxHeaders(true);
459
		description.setEqunioxHeaders(true);
439
		description.setExecutionEnvironments(new String[]{"J2SE-1.4"});
460
		description.setExecutionEnvironments(new String[]{"J2SE-1.4"});
440
		IRequiredBundleDescription rb1 = Factory.newRequiredBundle(
461
		IRequiredBundleDescription rb1 = service.newRequiredBundle(
441
				"org.eclipse.core.resources",
462
				"org.eclipse.core.resources",
442
				new VersionRange(new Version(3,5,0), true, new Version(4,0,0), false),
463
				new VersionRange(new Version(3,5,0), true, new Version(4,0,0), false),
443
				true, false);
464
				true, false);
444
		IRequiredBundleDescription rb2 = Factory.newRequiredBundle("org.eclipse.core.variables", null, false, false);
465
		IRequiredBundleDescription rb2 = service.newRequiredBundle("org.eclipse.core.variables", null, false, false);
445
		description.setRequiredBundles(new IRequiredBundleDescription[]{rb1, rb2});
466
		description.setRequiredBundles(new IRequiredBundleDescription[]{rb1, rb2});
446
		IPackageImportDescription pi1 = Factory.newPackageImport("com.ibm.icu.text", null, false);
467
		IPackageImportDescription pi1 = service.newPackageImport("com.ibm.icu.text", null, false);
447
		description.setPackageImports(new IPackageImportDescription[]{pi1});
468
		description.setPackageImports(new IPackageImportDescription[]{pi1});
448
		description.apply(null);
469
		description.apply(null);
449
		
470
		
450
		IBundleProjectDescription d2 = Factory.getDescription(project);
471
		IBundleProjectDescription d2 = service.getDescription(project);
451
		assertEquals("Wrong activator", "org.eclipse.foo.Activator", d2.getActivator());
472
		assertEquals("Wrong activator", "org.eclipse.foo.Activator", d2.getActivator());
452
		IPath[] binIncludes = d2.getBinIncludes();
473
		IPath[] binIncludes = d2.getBinIncludes();
453
		assertEquals("Wrong number of entries on bin.includes", 1, binIncludes.length);
474
		assertEquals("Wrong number of entries on bin.includes", 1, binIncludes.length);
454
		assertEquals("Wrong bin.includes", new Path("plugin.xml"), binIncludes[0]);
475
		assertEquals("Wrong bin.includes", new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR), binIncludes[0]);
455
		IBundleClasspathEntry[] classpath = d2.getBundleClasspath();
476
		IBundleClasspathEntry[] classpath = d2.getBundleClasspath();
456
		assertNotNull("Bundle-Classpath should be specified", classpath);
477
		assertNotNull("Bundle-Classpath should be specified", classpath);
457
		assertEquals("Wrong number of bundle classpath entries", 1, classpath.length);
478
		assertEquals("Wrong number of bundle classpath entries", 1, classpath.length);
Lines 496-526 Link Here
496
	public void testModifyBundle() throws CoreException {
517
	public void testModifyBundle() throws CoreException {
497
		IBundleProjectDescription description = newProject();
518
		IBundleProjectDescription description = newProject();
498
		IProject project = description.getProject();
519
		IProject project = description.getProject();
499
		IPackageExportDescription ex0 = Factory.newPackageExport("a.b.c", new Version("2.0.0"), true, null);
520
		IBundleProjectService service = getBundleProjectService();
500
		IPackageExportDescription ex1 = Factory.newPackageExport("a.b.c.interal", null, false, null);
521
		IPackageExportDescription ex0 = service.newPackageExport("a.b.c", new Version("2.0.0"), true, null);
501
		IPackageExportDescription ex2 = Factory.newPackageExport("a.b.c.interal.x", null, false, new String[]{"x.y.z"});
522
		IPackageExportDescription ex1 = service.newPackageExport("a.b.c.interal", null, false, null);
502
		IPackageExportDescription ex3 = Factory.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false, new String[]{"d.e.f", "g.h.i"});
523
		IPackageExportDescription ex2 = service.newPackageExport("a.b.c.interal.x", null, false, new String[]{"x.y.z"});
524
		IPackageExportDescription ex3 = service.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false, new String[]{"d.e.f", "g.h.i"});
503
		description.setPackageExports(new IPackageExportDescription[]{ex0, ex1, ex2, ex3});
525
		description.setPackageExports(new IPackageExportDescription[]{ex0, ex1, ex2, ex3});
504
		description.apply(null);
526
		description.apply(null);
505
		
527
		
506
		// modify the project
528
		// modify the project
507
		IBundleProjectDescription modify = Factory.getDescription(project);
529
		IBundleProjectDescription modify = service.getDescription(project);
508
		IPath src = new Path("src");
530
		IPath src = new Path("src");
509
		IBundleClasspathEntry spec = Factory.newBundleClasspathEntry(src, null, new Path("a.jar"));
531
		IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("a.jar"));
510
		modify.setBundleClassath(new IBundleClasspathEntry[] {spec});
532
		modify.setBundleClassath(new IBundleClasspathEntry[] {spec});
511
		IPackageExportDescription ex4 = Factory.newPackageExport("x.y.z.interal", null, false, new String[]{"zz.top"});
533
		IPackageExportDescription ex4 = service.newPackageExport("x.y.z.interal", null, false, new String[]{"zz.top"});
512
		modify.setPackageExports(new IPackageExportDescription[]{ex0, ex2, ex4, ex3}); // remove, add, re-order
534
		modify.setPackageExports(new IPackageExportDescription[]{ex0, ex2, ex4, ex3}); // remove, add, re-order
513
		modify.setBinIncludes(new IPath[]{new Path("plugin.xml")});
535
		modify.setBinIncludes(new IPath[]{new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)});
514
		modify.setActivator("org.eclipse.foo.Activator");
536
		modify.setActivator("org.eclipse.foo.Activator");
515
		modify.apply(null);
537
		modify.apply(null);
516
		
538
		
517
		// verify attributes
539
		// verify attributes
518
		IBundleProjectDescription d2 = Factory.getDescription(project);
540
		IBundleProjectDescription d2 = service.getDescription(project);
519
		
541
		
520
		assertEquals("Should be no activator", "org.eclipse.foo.Activator", d2.getActivator());
542
		assertEquals("Should be no activator", "org.eclipse.foo.Activator", d2.getActivator());
521
		IPath[] binIncludes = d2.getBinIncludes();
543
		IPath[] binIncludes = d2.getBinIncludes();
522
		assertEquals("Wrong number of entries on bin.includes", 1, binIncludes.length);
544
		assertEquals("Wrong number of entries on bin.includes", 1, binIncludes.length);
523
		assertEquals("Wrong bin.includes entry", new Path("plugin.xml"), binIncludes[0]);
545
		assertEquals("Wrong bin.includes entry", new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR), binIncludes[0]);
524
		IBundleClasspathEntry[] classpath = d2.getBundleClasspath();
546
		IBundleClasspathEntry[] classpath = d2.getBundleClasspath();
525
		assertNotNull("Wrong Bundle-Classpath", classpath);
547
		assertNotNull("Wrong Bundle-Classpath", classpath);
526
		assertEquals("Wrong number of Bundle-Classpath entries", 1, classpath.length);
548
		assertEquals("Wrong number of Bundle-Classpath entries", 1, classpath.length);
Lines 561-577 Link Here
561
	public void testFragToBundle() throws CoreException {
583
	public void testFragToBundle() throws CoreException {
562
		IBundleProjectDescription description = newProject();
584
		IBundleProjectDescription description = newProject();
563
		IProject project = description.getProject();
585
		IProject project = description.getProject();
564
		IHostDescription host = Factory.newHost("some.host", null);
586
		IBundleProjectService service = getBundleProjectService();
587
		IHostDescription host = service.newHost("some.host", null);
565
		description.setHost(host);
588
		description.setHost(host);
566
		description.apply(null);
589
		description.apply(null);
567
		
590
		
568
		//modify to a bundle
591
		//modify to a bundle
569
		IBundleProjectDescription modify = Factory.getDescription(project);
592
		IBundleProjectDescription modify = service.getDescription(project);
570
		modify.setHost(null);
593
		modify.setHost(null);
571
		modify.apply(null);
594
		modify.apply(null);
572
		
595
		
573
		// validate
596
		// validate
574
		IBundleProjectDescription d2 = Factory.getDescription(project);
597
		IBundleProjectDescription d2 = service.getDescription(project);
575
		
598
		
576
		assertNull("Should be no activator", d2.getActivator());
599
		assertNull("Should be no activator", d2.getActivator());
577
		IPath[] binIncludes = d2.getBinIncludes();
600
		IPath[] binIncludes = d2.getBinIncludes();
Lines 610-620 Link Here
610
	public void testJarsAsBundle() throws CoreException, IOException {
633
	public void testJarsAsBundle() throws CoreException, IOException {
611
		IBundleProjectDescription description = newProject();
634
		IBundleProjectDescription description = newProject();
612
		IProject project = description.getProject();
635
		IProject project = description.getProject();
613
		IBundleClasspathEntry one = Factory.newBundleClasspathEntry(null, null, new Path("one.jar"));
636
		IBundleProjectService service = getBundleProjectService();
614
		IBundleClasspathEntry two = Factory.newBundleClasspathEntry(null, null, new Path("lib/two.jar"));
637
		IBundleClasspathEntry one = service.newBundleClasspathEntry(null, null, new Path("one.jar"));
638
		IBundleClasspathEntry two = service.newBundleClasspathEntry(null, null, new Path("lib/two.jar"));
615
		description.setBundleClassath(new IBundleClasspathEntry[]{one, two});
639
		description.setBundleClassath(new IBundleClasspathEntry[]{one, two});
616
		IPackageExportDescription exp1 = Factory.newPackageExport("org.eclipse.one", new Version("1.0.0"), true, null);
640
		IPackageExportDescription exp1 = service.newPackageExport("org.eclipse.one", new Version("1.0.0"), true, null);
617
		IPackageExportDescription exp2 = Factory.newPackageExport("org.eclipse.two", new Version("1.0.0"), true, null);
641
		IPackageExportDescription exp2 = service.newPackageExport("org.eclipse.two", new Version("1.0.0"), true, null);
618
		description.setPackageExports(new IPackageExportDescription[]{exp1, exp2});
642
		description.setPackageExports(new IPackageExportDescription[]{exp1, exp2});
619
		description.setBundleVersion(new Version("1.0.0"));
643
		description.setBundleVersion(new Version("1.0.0"));
620
		description.setExecutionEnvironments(new String[]{"J2SE-1.5"});
644
		description.setExecutionEnvironments(new String[]{"J2SE-1.5"});
Lines 623-629 Link Here
623
		createBogusJar(project.getFile("one.jar"));
647
		createBogusJar(project.getFile("one.jar"));
624
		createBogusJar(project.getFile(new Path("lib/two.jar")));
648
		createBogusJar(project.getFile(new Path("lib/two.jar")));
625
		
649
		
626
		IBundleProjectDescription d2 = Factory.getDescription(project);
650
		IBundleProjectDescription d2 = service.getDescription(project);
627
		
651
		
628
		assertNull("Should be no activator", d2.getActivator());
652
		assertNull("Should be no activator", d2.getActivator());
629
		IPath[] binIncludes = d2.getBinIncludes();
653
		IPath[] binIncludes = d2.getBinIncludes();
Lines 691-701 Link Here
691
	public void testClassFolders() throws CoreException {
715
	public void testClassFolders() throws CoreException {
692
		IBundleProjectDescription description = newProject();
716
		IBundleProjectDescription description = newProject();
693
		IProject project = description.getProject();
717
		IProject project = description.getProject();
694
		IBundleClasspathEntry one = Factory.newBundleClasspathEntry(null, new Path("bin1"), new Path("one.jar"));
718
		IBundleProjectService service = getBundleProjectService();
695
		IBundleClasspathEntry two = Factory.newBundleClasspathEntry(null, new Path("bin2"), new Path("two.jar"));
719
		IBundleClasspathEntry one = service.newBundleClasspathEntry(null, new Path("bin1"), new Path("one.jar"));
720
		IBundleClasspathEntry two = service.newBundleClasspathEntry(null, new Path("bin2"), new Path("two.jar"));
696
		description.setBundleClassath(new IBundleClasspathEntry[]{one, two});
721
		description.setBundleClassath(new IBundleClasspathEntry[]{one, two});
697
		IPackageExportDescription exp1 = Factory.newPackageExport("org.eclipse.one", new Version("1.0.0"), true, null);
722
		IPackageExportDescription exp1 = service.newPackageExport("org.eclipse.one", new Version("1.0.0"), true, null);
698
		IPackageExportDescription exp2 = Factory.newPackageExport("org.eclipse.two", new Version("1.0.0"), true, null);
723
		IPackageExportDescription exp2 = service.newPackageExport("org.eclipse.two", new Version("1.0.0"), true, null);
699
		description.setPackageExports(new IPackageExportDescription[]{exp1, exp2});
724
		description.setPackageExports(new IPackageExportDescription[]{exp1, exp2});
700
		description.setBundleVersion(new Version("1.0.0"));
725
		description.setBundleVersion(new Version("1.0.0"));
701
		description.setExecutionEnvironments(new String[]{"J2SE-1.5"});
726
		description.setExecutionEnvironments(new String[]{"J2SE-1.5"});
Lines 704-710 Link Here
704
		project.getFolder("bin1").create(false, true, null);
729
		project.getFolder("bin1").create(false, true, null);
705
		project.getFolder("bin2").create(false, true, null);
730
		project.getFolder("bin2").create(false, true, null);
706
		
731
		
707
		IBundleProjectDescription d2 = Factory.getDescription(project);
732
		IBundleProjectDescription d2 = service.getDescription(project);
708
		
733
		
709
		assertNull("Should be no activator", d2.getActivator());
734
		assertNull("Should be no activator", d2.getActivator());
710
		IPath[] binIncludes = d2.getBinIncludes();
735
		IPath[] binIncludes = d2.getBinIncludes();
(-)src/org/eclipse/pde/ui/tests/wizards/ConvertProjectToPluginTestCase.java (-11 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2007, 2008 IBM Corporation and others.
2
 *  Copyright (c) 2007, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 12-29 Link Here
12
package org.eclipse.pde.ui.tests.wizards;
12
package org.eclipse.pde.ui.tests.wizards;
13
13
14
import java.lang.reflect.InvocationTargetException;
14
import java.lang.reflect.InvocationTargetException;
15
16
import junit.framework.Test;
15
import junit.framework.Test;
17
import junit.framework.TestSuite;
16
import junit.framework.TestSuite;
18
17
import org.eclipse.core.resources.*;
19
import org.eclipse.core.resources.IProject;
20
import org.eclipse.core.resources.IWorkspaceRoot;
21
import org.eclipse.core.resources.ResourcesPlugin;
22
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.NullProgressMonitor;
19
import org.eclipse.core.runtime.NullProgressMonitor;
24
import org.eclipse.jface.operation.IRunnableWithProgress;
20
import org.eclipse.jface.operation.IRunnableWithProgress;
25
import org.eclipse.pde.internal.core.ICoreConstants;
26
import org.eclipse.pde.internal.core.natures.PDE;
21
import org.eclipse.pde.internal.core.natures.PDE;
22
import org.eclipse.pde.internal.core.project.PDEProject;
27
import org.eclipse.pde.internal.ui.wizards.tools.ConvertProjectToPluginOperation;
23
import org.eclipse.pde.internal.ui.wizards.tools.ConvertProjectToPluginOperation;
28
import org.eclipse.pde.ui.tests.PDETestCase;
24
import org.eclipse.pde.ui.tests.PDETestCase;
29
import org.eclipse.ui.PlatformUI;
25
import org.eclipse.ui.PlatformUI;
Lines 58-65 Link Here
58
		convertProject(project);
54
		convertProject(project);
59
55
60
		assertTrue(project.hasNature(PDE.PLUGIN_NATURE));
56
		assertTrue(project.hasNature(PDE.PLUGIN_NATURE));
61
		assertTrue(project.getFile(ICoreConstants.MANIFEST_PATH).exists());
57
		assertTrue(PDEProject.getManifest(project).exists());
62
		assertTrue(project.getFile(ICoreConstants.BUILD_PROPERTIES_PATH).exists());
58
		assertTrue(PDEProject.getBuildProperties(project).exists());
63
	}
59
	}
64
60
65
	/**
61
	/**
Lines 87-94 Link Here
87
		for (int i = 0; i < projects.length; i++) {
83
		for (int i = 0; i < projects.length; i++) {
88
			IProject project = projects[i];
84
			IProject project = projects[i];
89
			assertTrue(project.hasNature(PDE.PLUGIN_NATURE));
85
			assertTrue(project.hasNature(PDE.PLUGIN_NATURE));
90
			assertTrue(project.getFile(ICoreConstants.MANIFEST_PATH).exists());
86
			assertTrue(PDEProject.getManifest(project).exists());
91
			assertTrue(project.getFile(ICoreConstants.BUILD_PROPERTIES_PATH).exists());
87
			assertTrue(PDEProject.getBuildProperties(project).exists());
92
		}
88
		}
93
	}
89
	}
94
90

Return to bug 297895