### Eclipse Workspace Patch 1.0 #P org.eclipse.pde.ui Index: src/org/eclipse/pde/internal/ui/PDEUIMessages.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java,v retrieving revision 1.325 diff -u -r1.325 PDEUIMessages.java --- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 7 Sep 2007 21:06:32 -0000 1.325 +++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 11 Sep 2007 20:30:43 -0000 @@ -587,6 +587,8 @@ public static String RemoveUnknownExecEnvironments_label; + public static String AddDefaultExecutionEnvironment_label; + public static String RevertUnsupportSingletonResolution_desc; public static String AddLibraryDialog_emptyLibraries; Index: src/org/eclipse/pde/internal/ui/pderesources.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties,v retrieving revision 1.923 diff -u -r1.923 pderesources.properties --- src/org/eclipse/pde/internal/ui/pderesources.properties 7 Sep 2007 21:06:32 -0000 1.923 +++ src/org/eclipse/pde/internal/ui/pderesources.properties 11 Sep 2007 20:30:46 -0000 @@ -2014,6 +2014,7 @@ RemoveRequireBundleResolution_label=Remove bundle ''{0}'' from the list RemoveUnknownExecEnvironments_label=Remove all unknown Execution Environments +AddDefaultExecutionEnvironment_label=Add default Execution Environment RegisterCSWizard_registerCheatSheet=Register Cheat Sheet RegisterCSWizardPage_wizardPageDescription=Allow the cheat sheet to be accessed through the Help menu RegisterCSWizardPage_labelInstructionText=Optionally, specify the category and description to use when selecting the cheat sheet from a dialog: Index: src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java,v retrieving revision 1.29 diff -u -r1.29 ResolutionGenerator.java --- src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java 26 Jul 2007 18:59:09 -0000 1.29 +++ src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java 11 Sep 2007 20:30:46 -0000 @@ -91,6 +91,8 @@ new ChooseClassXMLResolution(AbstractPDEMarkerResolution.RENAME_TYPE, marker)}; case PDEMarkerFactory.M_DEPRECATED_PROVIDE_PACKAGE: return new IMarkerResolution[] {new RenameProvidePackageResolution(AbstractPDEMarkerResolution.RENAME_TYPE)}; + case PDEMarkerFactory.M_EXECUTION_ENVIRONMENT_NOT_SET: + return new IMarkerResolution[] { new AddDefaultExecutionEnvironmentResolution(AbstractPDEMarkerResolution.CREATE_TYPE) }; } return NO_RESOLUTIONS; } Index: src/org/eclipse/pde/internal/ui/correction/AddDefaultExecutionEnvironmentResolution.java =================================================================== RCS file: src/org/eclipse/pde/internal/ui/correction/AddDefaultExecutionEnvironmentResolution.java diff -N src/org/eclipse/pde/internal/ui/correction/AddDefaultExecutionEnvironmentResolution.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/pde/internal/ui/correction/AddDefaultExecutionEnvironmentResolution.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.internal.ui.correction; + +import org.eclipse.jdt.launching.IVMInstall; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.jdt.launching.environments.IExecutionEnvironment; +import org.eclipse.pde.internal.core.ibundle.IManifestHeader; +import org.eclipse.pde.internal.core.text.bundle.BundleModel; +import org.eclipse.pde.internal.core.text.bundle.RequiredExecutionEnvironmentHeader; +import org.eclipse.pde.internal.ui.PDEUIMessages; +import org.osgi.framework.Constants; + +public class AddDefaultExecutionEnvironmentResolution extends AbstractManifestMarkerResolution { + + public AddDefaultExecutionEnvironmentResolution(int type) { + super(type); + } + + protected void createChange(BundleModel model) { + + IManifestHeader header = model.getBundle().getManifestHeader(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT); + if(header == null) { + // Initialise header with empty value + model.getBundle().setHeader(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, ""); + } + + // Get header + header = model.getBundle().getManifestHeader(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT); + + if(header != null && header instanceof RequiredExecutionEnvironmentHeader) { + + // Get available EEs & default install VM + IExecutionEnvironment[] systemEnvs = JavaRuntime.getExecutionEnvironmentsManager().getExecutionEnvironments(); + IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall(); + + for(int i = 0; i < systemEnvs.length; i++) { + + // Get strictly compatible EE for the default VM + if(systemEnvs[i].isStrictlyCompatible(defaultVM)) { + ((RequiredExecutionEnvironmentHeader) header).addExecutionEnvironment(systemEnvs[i]); + break; + } + } + } + } + + public String getLabel() { + return PDEUIMessages.AddDefaultExecutionEnvironment_label; + } +} #P org.eclipse.pde.core Index: src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java,v retrieving revision 1.17 diff -u -r1.17 PDEMarkerFactory.java --- src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java 26 Jul 2007 18:59:10 -0000 1.17 +++ src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java 11 Sep 2007 20:30:50 -0000 @@ -41,7 +41,8 @@ public static final int M_UNECESSARY_DEP = 0x1017; // other problem public static final int M_MISSING_EXPORT_PKGS = 0x1018; // other problem public static final int M_DEPRECATED_PROVIDE_PACKAGE = 0x1019; // deprecation - + public static final int M_EXECUTION_ENVIRONMENT_NOT_SET = 0x1020; // other problem + // build properties fixes public static final int B_APPEND_SLASH_FOLDER_ENTRY = 0x2001; public static final int B_REMOVE_SLASH_FILE_ENTRY = 0x2002; Index: src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java,v retrieving revision 1.45 diff -u -r1.45 BundleErrorReporter.java --- src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java 7 Aug 2007 19:07:15 -0000 1.45 +++ src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java 11 Sep 2007 20:30:49 -0000 @@ -358,8 +358,13 @@ if (desc == null) return; String[] bundleEnvs = desc.getExecutionEnvironments(); - if (bundleEnvs == null || bundleEnvs.length == 0) + if (bundleEnvs == null || bundleEnvs.length == 0) { + + // No EE specified + report(PDECoreMessages.BundleErrorReporter_noExecutionEnvironmentSet, 1, sev, + PDEMarkerFactory.M_EXECUTION_ENVIRONMENT_NOT_SET, PDEMarkerFactory.CAT_EE); return; + } IHeader header = getHeader(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT); if (header == null) Index: src/org/eclipse/pde/internal/core/PDECoreMessages.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java,v retrieving revision 1.39 diff -u -r1.39 PDECoreMessages.java --- src/org/eclipse/pde/internal/core/PDECoreMessages.java 28 Aug 2007 19:16:46 -0000 1.39 +++ src/org/eclipse/pde/internal/core/PDECoreMessages.java 11 Sep 2007 20:30:48 -0000 @@ -182,6 +182,7 @@ public static String BundleErrorReporter_importexport_servicesDeprecated; public static String BundleErrorReporter_unecessaryDependencyDueToFragmentHost; public static String BundleErrorReporter_missingPackagesInProject; + public static String BundleErrorReporter_noExecutionEnvironmentSet; public static String BundleErrorReporter_startHeader_autoStartDeprecated; Index: src/org/eclipse/pde/internal/core/pderesources.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties,v retrieving revision 1.75 diff -u -r1.75 pderesources.properties --- src/org/eclipse/pde/internal/core/pderesources.properties 28 Aug 2007 19:16:46 -0000 1.75 +++ src/org/eclipse/pde/internal/core/pderesources.properties 11 Sep 2007 20:30:49 -0000 @@ -147,6 +147,7 @@ BundleErrorReporter_unresolvedHost=Host bundle ''{0}'' exists but is unresolved BundleErrorReporter_lazyStart_unsupported=The Eclipse-LazyStart header is not supported by pre-3.2 targets BundleErrorReporter_unsatisfiedConstraint=Unsatisfied constraint: ''{0}'' +BundleErrorReporter_noExecutionEnvironmentSet=No Execution Environment has been set BundleTextChangeListener_editNames_newLine=Add a new line at the end of the file BundleTextChangeListener_editNames_remove=Remove "{0}" header BundleTextChangeListener_editNames_insert=Insert "{0}" header