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

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (+1 lines)
Lines 3047-3052 Link Here
3047
	public static String PDEJavaHelper_msgContentAssistAvailable;
3047
	public static String PDEJavaHelper_msgContentAssistAvailable;
3048
3048
3049
	public static String AddExportPackageResolution_Label;
3049
	public static String AddExportPackageResolution_Label;
3050
	public static String AddBundleClassPathResolution_add;
3050
	
3051
	
3051
	// target provisioning stuff
3052
	// target provisioning stuff
3052
	public static String UpdateSiteDownloader_message;
3053
	public static String UpdateSiteDownloader_message;
(-)src/org/eclipse/pde/internal/ui/pderesources.properties (+1 lines)
Lines 2398-2400 Link Here
2398
StateViewPage_showOnlyUnresolved_label=Show only unresolved plug-ins
2398
StateViewPage_showOnlyUnresolved_label=Show only unresolved plug-ins
2399
StateViewPage_focusActionDescription=Focus on selected item
2399
StateViewPage_focusActionDescription=Focus on selected item
2400
SchemaPreviewLauncher_msgEditorHasUnsavedChanges=Open schema editor has unsaved changes
2400
SchemaPreviewLauncher_msgEditorHasUnsavedChanges=Open schema editor has unsaved changes
2401
AddBundleClassPathResolution_add=Add ''{0}'' to the bundle classpath
(-)src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java (+2 lines)
Lines 94-99 Link Here
94
				return new IMarkerResolution[] {new RenameProvidePackageResolution(AbstractPDEMarkerResolution.RENAME_TYPE)};
94
				return new IMarkerResolution[] {new RenameProvidePackageResolution(AbstractPDEMarkerResolution.RENAME_TYPE)};
95
			case PDEMarkerFactory.M_EXECUTION_ENVIRONMENT_NOT_SET:
95
			case PDEMarkerFactory.M_EXECUTION_ENVIRONMENT_NOT_SET:
96
				return new IMarkerResolution[] { new AddDefaultExecutionEnvironmentResolution(AbstractPDEMarkerResolution.CREATE_TYPE) };
96
				return new IMarkerResolution[] { new AddDefaultExecutionEnvironmentResolution(AbstractPDEMarkerResolution.CREATE_TYPE) };
97
			case PDEMarkerFactory.M_MISSING_BUNDLE_CLASSPATH_ENTRY:
98
				return new IMarkerResolution[] {new  AddBundleClassPathMarkerResolution(AbstractPDEMarkerResolution.CREATE_TYPE, marker.getAttribute("entry", null))}; //$NON-NLS-1$)
97
		}
99
		}
98
		return NO_RESOLUTIONS;
100
		return NO_RESOLUTIONS;
99
	}
101
	}
(-)src/org/eclipse/pde/internal/ui/correction/AddBundleClassPathMarkerResolution.java (+46 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.correction;
12
13
import org.eclipse.osgi.util.NLS;
14
import org.eclipse.pde.internal.core.ibundle.IBundle;
15
import org.eclipse.pde.internal.core.text.bundle.Bundle;
16
import org.eclipse.pde.internal.core.text.bundle.BundleClasspathHeader;
17
import org.eclipse.pde.internal.core.text.bundle.BundleModel;
18
import org.eclipse.pde.internal.ui.PDEUIMessages;
19
import org.osgi.framework.Constants;
20
21
public class AddBundleClassPathMarkerResolution extends
22
AbstractManifestMarkerResolution {
23
24
	private String fValue;
25
26
	public AddBundleClassPathMarkerResolution(int type, String value) {
27
		super(type);
28
		this.fValue = value;
29
	}
30
31
	public String getLabel() {
32
		return NLS.bind(PDEUIMessages.AddBundleClassPathResolution_add, fValue);
33
	}
34
35
	protected void createChange(BundleModel model) {
36
		IBundle bundle = model.getBundle();
37
		if (bundle instanceof Bundle) {
38
			BundleClasspathHeader header = (BundleClasspathHeader)bundle.getManifestHeader(Constants.BUNDLE_CLASSPATH);
39
			if (header != null)
40
				header.addLibrary(fValue);
41
			else
42
				model.getBundle().setHeader(Constants.BUNDLE_CLASSPATH, fValue);
43
		}
44
	}
45
46
}
(-)src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java (+1 lines)
Lines 43-48 Link Here
43
	public static final int M_MISSING_EXPORT_PKGS = 0x1018; // other problem
43
	public static final int M_MISSING_EXPORT_PKGS = 0x1018; // other problem
44
	public static final int M_DEPRECATED_PROVIDE_PACKAGE = 0x1019; // deprecation
44
	public static final int M_DEPRECATED_PROVIDE_PACKAGE = 0x1019; // deprecation
45
	public static final int M_EXECUTION_ENVIRONMENT_NOT_SET = 0x1020; // other problem
45
	public static final int M_EXECUTION_ENVIRONMENT_NOT_SET = 0x1020; // other problem
46
	public static final int M_MISSING_BUNDLE_CLASSPATH_ENTRY = 0x1021; // fatal problem
46
47
47
	// build properties fixes
48
	// build properties fixes
48
	public static final int B_APPEND_SLASH_FOLDER_ENTRY = 0x2001;
49
	public static final int B_APPEND_SLASH_FOLDER_ENTRY = 0x2001;
(-)src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java (-4 / +59 lines)
Lines 49-54 Link Here
49
import org.eclipse.osgi.service.resolver.VersionRange;
49
import org.eclipse.osgi.service.resolver.VersionRange;
50
import org.eclipse.osgi.util.ManifestElement;
50
import org.eclipse.osgi.util.ManifestElement;
51
import org.eclipse.osgi.util.NLS;
51
import org.eclipse.osgi.util.NLS;
52
import org.eclipse.pde.core.build.IBuild;
52
import org.eclipse.pde.core.plugin.IFragmentModel;
53
import org.eclipse.pde.core.plugin.IFragmentModel;
53
import org.eclipse.pde.core.plugin.IPluginBase;
54
import org.eclipse.pde.core.plugin.IPluginBase;
54
import org.eclipse.pde.core.plugin.IPluginModelBase;
55
import org.eclipse.pde.core.plugin.IPluginModelBase;
Lines 59-64 Link Here
59
import org.eclipse.pde.internal.core.PDECore;
60
import org.eclipse.pde.internal.core.PDECore;
60
import org.eclipse.pde.internal.core.PDECoreMessages;
61
import org.eclipse.pde.internal.core.PDECoreMessages;
61
import org.eclipse.pde.internal.core.TargetPlatformHelper;
62
import org.eclipse.pde.internal.core.TargetPlatformHelper;
63
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
62
import org.eclipse.pde.internal.core.ibundle.IBundle;
64
import org.eclipse.pde.internal.core.ibundle.IBundle;
63
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
65
import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
64
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
66
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
Lines 484-494 Link Here
484
486
485
	private void validateBundleClasspath() {
487
	private void validateBundleClasspath() {
486
		IHeader header = getHeader(Constants.BUNDLE_CLASSPATH);
488
		IHeader header = getHeader(Constants.BUNDLE_CLASSPATH);
487
		if (header != null && header.getElements().length == 0) {
489
		if (header != null) {
488
			report(PDECoreMessages.BundleErrorReporter_ClasspathNotEmpty, 
490
			if (header.getElements().length == 0) {
489
					header.getLineNumber() + 1, CompilerFlags.ERROR, 
491
				report(PDECoreMessages.BundleErrorReporter_ClasspathNotEmpty, 
490
					PDEMarkerFactory.CAT_FATAL);
492
						header.getLineNumber() + 1, CompilerFlags.ERROR, 
493
						PDEMarkerFactory.CAT_FATAL);
494
			} 
491
		}
495
		}
496
		validateBundleClasspathMappings(header);
497
	}
498
	
499
	private void validateBundleClasspathMappings(IHeader header) {
500
		IFile buildProperties = fProject.getFile("build.properties"); //$NON-NLS-1$
501
		if(buildProperties != null && buildProperties.exists()) {
502
			WorkspaceBuildModel wbm = 
503
				new WorkspaceBuildModel(buildProperties);
504
			wbm.load();
505
			if (!wbm.isLoaded())
506
				return;
507
508
			IBuild build = wbm.getBuild();
509
			if(build != null) {
510
				ArrayList sourceEntries = 
511
					PDEBuilderHelper.getSourceEntries(build);
512
				// verify classpath entry <-> source entry mappings
513
				for(int i = 0; i < sourceEntries.size(); i++) {
514
					String entry = (String) sourceEntries.get(i);
515
					validateMapping(header, entry, sourceEntries.size());
516
				}
517
518
			}
519
		}			
520
	}
521
522
	private void validateMapping(IHeader header, String entry, int sourceEntrySize) {
523
		boolean match = false;
524
		ManifestElement[] elements = 
525
			header != null ? header.getElements() : new ManifestElement[0];
526
		for(int i = 0; i < elements.length; i++) {
527
			if(entry.equals(elements[i].getValue()))
528
				match = true;
529
		}
530
		// if we have no match, report an error
531
		if(!match) { 
532
			// however, catch the case when we have a source.. entry and no Bundle-ClassPath entry
533
			if(entry.equals(".") && sourceEntrySize == 1) //$NON-NLS-1$
534
				return;
535
			int line = header != null ? header.getLineNumber() + 1 : 1;
536
			IMarker marker = report(PDECoreMessages.BundleErrorReporter_missingClassPathEntries, 
537
					line,
538
					CompilerFlags.ERROR,
539
					PDEMarkerFactory.M_MISSING_BUNDLE_CLASSPATH_ENTRY,
540
					PDEMarkerFactory.CAT_FATAL);
541
			try {
542
				if (marker != null) {
543
					marker.setAttribute("entry", entry); //$NON-NLS-1$
544
				}
545
			} catch (CoreException e) {}
546
			}
492
	}
547
	}
493
548
494
	private void validateRequireBundle(IProgressMonitor monitor) {
549
	private void validateRequireBundle(IProgressMonitor monitor) {
(-)src/org/eclipse/pde/internal/core/builders/PDEBuilderHelper.java (+18 lines)
Lines 16-22 Link Here
16
import org.eclipse.core.resources.IResource;
16
import org.eclipse.core.resources.IResource;
17
import org.eclipse.core.runtime.IPath;
17
import org.eclipse.core.runtime.IPath;
18
import org.eclipse.jdt.core.IClasspathEntry;
18
import org.eclipse.jdt.core.IClasspathEntry;
19
import org.eclipse.pde.core.build.IBuild;
19
import org.eclipse.pde.core.build.IBuildEntry;
20
import org.eclipse.pde.core.build.IBuildEntry;
21
import org.eclipse.pde.internal.build.IBuildPropertiesConstants;
20
22
21
public class PDEBuilderHelper {
23
public class PDEBuilderHelper {
22
	
24
	
Lines 45-49 Link Here
45
		}
47
		}
46
		return unlisted;
48
		return unlisted;
47
	}
49
	}
50
	
51
	public static ArrayList getSourceEntries(IBuild build) {
52
		ArrayList sourceEntryKeys = new ArrayList();
53
		IBuildEntry[] entries = build.getBuildEntries();
54
		for (int i = 0; i < entries.length; i++) {
55
			String name = entries[i].getName();
56
			if (name.startsWith(IBuildPropertiesConstants.PROPERTY_SOURCE_PREFIX)) {
57
				// splice the entry
58
				String entry = 
59
					name.substring(IBuildPropertiesConstants.PROPERTY_SOURCE_PREFIX.length(), name.length());
60
				sourceEntryKeys.add(entry);
61
			}
62
		}
63
		return sourceEntryKeys;
64
	}
65
48
66
49
}
67
}
(-)src/org/eclipse/pde/internal/core/PDECoreMessages.java (+1 lines)
Lines 183-188 Link Here
183
	public static String BundleErrorReporter_unecessaryDependencyDueToFragmentHost;
183
	public static String BundleErrorReporter_unecessaryDependencyDueToFragmentHost;
184
	public static String BundleErrorReporter_missingPackagesInProject;
184
	public static String BundleErrorReporter_missingPackagesInProject;
185
	public static String BundleErrorReporter_noExecutionEnvironmentSet;
185
	public static String BundleErrorReporter_noExecutionEnvironmentSet;
186
	public static String BundleErrorReporter_missingClassPathEntries;
186
187
187
	public static String BundleErrorReporter_startHeader_autoStartDeprecated;
188
	public static String BundleErrorReporter_startHeader_autoStartDeprecated;
188
189
(-)src/org/eclipse/pde/internal/core/pderesources.properties (+1 lines)
Lines 158-163 Link Here
158
BundleErrorReporter_unecessaryDependencyDueToFragmentHost=The ''{0}'' dependency is not necessary as it is already specified in Fragment-Host header
158
BundleErrorReporter_unecessaryDependencyDueToFragmentHost=The ''{0}'' dependency is not necessary as it is already specified in Fragment-Host header
159
BundleErrorReporter_localization_properties_file_not_exist=no valid properties files exist in the localization directory specified
159
BundleErrorReporter_localization_properties_file_not_exist=no valid properties files exist in the localization directory specified
160
BundleErrorReporter_illegalManifestVersion=The bundle manifest version is invalid. Valid ranges are 1-2.
160
BundleErrorReporter_illegalManifestVersion=The bundle manifest version is invalid. Valid ranges are 1-2.
161
BundleErrorReporter_missingClassPathEntries=There is a mismatch between the bundle classpath and build.properties
161
162
162
ManifestConsistencyChecker_projectCheck=static project references may interfere with the correct dynamic build order of plug-in projects
163
ManifestConsistencyChecker_projectCheck=static project references may interfere with the correct dynamic build order of plug-in projects
163
ManifestConsistencyChecker_buildPropertiesSubtask=Verifying build.properties
164
ManifestConsistencyChecker_buildPropertiesSubtask=Verifying build.properties

Return to bug 198724