diff options
author | Alexandra Buzila | 2020-11-25 16:45:18 +0000 |
---|---|---|
committer | Vincent Lorenzo | 2021-03-20 16:40:01 +0000 |
commit | 77404c4659d7a2cd4ff9859819ef6eb0e87d3aca (patch) | |
tree | 0efaf0d9faa8e7df0aecb64849fbfdc749f04160 | |
parent | 83d957748dbced4422e12f42989c1ac9e21bd7d6 (diff) | |
download | org.eclipse.papyrus-77404c4659d7a2cd4ff9859819ef6eb0e87d3aca.tar.gz org.eclipse.papyrus-77404c4659d7a2cd4ff9859819ef6eb0e87d3aca.tar.xz org.eclipse.papyrus-77404c4659d7a2cd4ff9859819ef6eb0e87d3aca.zip |
Bug 568495 - Static Profile Improvements
- validate the 'org.eclipse.emf.ecore.generated_package',
'org.eclipse.uml2.uml.generated_package' and
'org.eclipse.papyrus.uml.extensionpoints.UMLProfile' extension points
and add quick fixes for validation problems
- externalize strings
Change-Id: I54e02c4ca805e0f34c9b301c8a3ed25b55a51f63
Signed-off-by: Alexandra Buzila <abuzila@eclipsesource.com>
Also-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
34 files changed, 1249 insertions, 218 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF index 0208c8a64de..184e930d44a 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.6.0,4.0.0)", org.eclipse.papyrus.infra.core.log;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.tools;bundle-version="[4.0.0,5.0.0)", - org.eclipse.uml2.types;bundle-version="[2.5.0,3.0.0)" + org.eclipse.uml2.types;bundle-version="[2.5.0,3.0.0)", + org.eclipse.pde.core;bundle-version="[3.14.100,4.0.0)" Bundle-Vendor: Eclipse Modeling Project Bundle-ActivationPolicy: lazy Bundle-Version: 4.1.0.qualifier diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ResourceUtils.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ResourceUtils.java index 83eb3960660..038c00c26f3 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ResourceUtils.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ResourceUtils.java @@ -15,30 +15,48 @@ *****************************************************************************/ package org.eclipse.papyrus.infra.emf.utils; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; +import java.util.stream.Collectors; import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.impl.URIMappingRegistryImpl; import org.eclipse.emf.ecore.xmi.XMIResource; import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.pde.core.plugin.IPluginExtension; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.core.plugin.IPluginObject; +import org.eclipse.pde.core.plugin.PluginRegistry; +import org.eclipse.pde.internal.core.text.plugin.PluginElementNode; /** * * This class provides methods for EMF Resource * */ +@SuppressWarnings("restriction") public class ResourceUtils { + private static final String ECORE_URI_MAPPING_EXTENSION_POINT = "org.eclipse.emf.ecore.uri_mapping"; //$NON-NLS-1$ + private static final String PATH_SEPARATOR = "/"; + + private ResourceUtils() { // to prevent instanciation } @@ -72,7 +90,7 @@ public class ResourceUtils { * */ public static Collection<String> getAllResourceIds(final XMIResource resource) { - final Set<String> ids = new HashSet<String>(); + final Set<String> ids = new HashSet<>(); final Iterator<EObject> iterator = resource.getAllContents(); while (iterator.hasNext()) { final EObject current = iterator.next(); @@ -91,7 +109,7 @@ public class ResourceUtils { * @return */ public static Map<String, Object> getSaveOptions() { - Map<String, Object> saveOptions = new HashMap<String, Object>(); + Map<String, Object> saveOptions = new HashMap<>(); // default save options. saveOptions.put(XMLResource.OPTION_DECLARE_XML, Boolean.TRUE); @@ -108,4 +126,59 @@ public class ResourceUtils { return saveOptions; } + /** + * Return an encoded path string that can be used as a path attribute in a an extension for the given file. + * If an Ecore URI mapping exists for the path, it will be used as a path segment. + * Otherwise, a project-relative encoded path will be returned. + */ + public static String mapAndEncodePath(IFile file) { + // check if we have a mapping that we can use + URI pluginURI = URI.createPlatformPluginURI(file.getProject().getName() + PATH_SEPARATOR + file.getProjectRelativePath().toString(), true); + String path = pluginURI.toString(); + + // check local mappings first + for (Entry<String, String> entry : getLocalUriMappings(file.getProject()).entrySet()) { + String targetURI = entry.getValue(); + if (targetURI != null && targetURI.endsWith(PATH_SEPARATOR) && path.startsWith(targetURI)) { + return path.replaceFirst(targetURI, entry.getKey()); + } + } + // check registered mappings + for (Entry<URI, URI> entry : URIMappingRegistryImpl.INSTANCE.entrySet()) { + String targetURI = entry.getValue().toString(); + if (targetURI != null && targetURI.endsWith(PATH_SEPARATOR) && path.startsWith(targetURI)) { + return path.replaceFirst(targetURI, entry.getKey().toString()); + } + } + // no mapping were found - fallback to project relative path + IPath relativePath = file.getProjectRelativePath(); + return getStringURI(relativePath); + } + + /** Return the `org.eclipse.emf.ecore.uri_mapping` extension declarations in the given project. */ + public static Map<String, String> getLocalUriMappings(IProject project) { + HashMap<String, String> localMappings = new HashMap<>(); + final IPluginModelBase model = PluginRegistry.findModel(project.getName()); + for (IPluginExtension extension : model.getExtensions().getExtensions()) { + if (!Objects.equals(extension.getPoint(), ECORE_URI_MAPPING_EXTENSION_POINT)) { + continue; + } + List<IPluginObject> pluginObjects = Arrays.stream(extension.getChildren()).filter(child -> Objects.equals("mapping", child.getName())).collect(Collectors.toList()); //$NON-NLS-1$ + pluginObjects.forEach(pluginObject -> { + if ((pluginObject instanceof PluginElementNode)) { + PluginElementNode node = (PluginElementNode) pluginObject; + localMappings.put(node.getAttribute("source").getValue(), node.getAttribute("target").getValue()); //$NON-NLS-1$ //$NON-NLS-2$ + } + }); + } + return localMappings; + } + + /** Returns an encoded string representation of the path. */ + public static String getStringURI(IPath path) { + return Arrays.stream(path.segments()) + .map(segment -> URI.encodeSegment(segment, false)) + .collect(Collectors.joining(PATH_SEPARATOR)); + } + } diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/META-INF/MANIFEST.MF b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/META-INF/MANIFEST.MF index 74325ddae89..6b3011b9491 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/META-INF/MANIFEST.MF +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/META-INF/MANIFEST.MF @@ -30,5 +30,8 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)", org.eclipse.papyrus.uml.tools;bundle-version="[5.0.0,6.0.0)", org.eclipse.uml2.uml;bundle-version="[5.5.0,6.0.0)", org.eclipse.papyrus.uml.tools.utils;bundle-version="[4.0.0,5.0.0)", - org.eclipse.papyrus.toolsmiths.validation.profile;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrus.toolsmiths.validation.profile;bundle-version="[2.0.0,3.0.0)", + org.eclipse.pde.ui;bundle-version="[3.11.0,4.0.0)", + org.eclipse.papyrus.toolsmiths.validation.common;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.emf;bundle-version="[4.0.0,5.0.0)" diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/plugin.xml b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/plugin.xml index eddbf953c29..7642ee9066a 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/plugin.xml +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/plugin.xml @@ -85,6 +85,10 @@ class="org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix.ManifestResolutionGenerator" markerType="org.eclipse.jdt.core.problem"> </markerResolutionGenerator> + <markerResolutionGenerator + class="org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix.StaticProfileMarkerResolutionGenerator" + markerType="org.eclipse.pde.core.problem"> + </markerResolutionGenerator> </extension> <extension point="org.eclipse.ui.preferencePages"> diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/AbstractPapyrusBuilder.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/AbstractPapyrusBuilder.java index 638daf2a896..3d045e010b5 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/AbstractPapyrusBuilder.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/AbstractPapyrusBuilder.java @@ -79,9 +79,9 @@ public abstract class AbstractPapyrusBuilder { try { marker = res.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); - marker.setAttribute(IMarker.MESSAGE, "Papyrus Builder: " + message); + marker.setAttribute(IMarker.MESSAGE, Messages.AbstractPapyrusBuilder_PapyrusBuilder + message); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); - marker.setAttribute("code", 10000); + marker.setAttribute("code", 10000); //$NON-NLS-1$ marker.setAttribute(IMarker.SOURCE_ID, Activator.PLUGIN_ID); marker.setAttribute(IJavaModelMarker.ID, 7500); } catch (CoreException e) { diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/GenericEMFModelBuilder.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/GenericEMFModelBuilder.java index 572a173539e..5e114a0a2f5 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/GenericEMFModelBuilder.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/GenericEMFModelBuilder.java @@ -55,6 +55,7 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.emf.helpers.BundleResourceURIHelper; import org.eclipse.papyrus.emf.validation.DependencyValidationUtils; import org.eclipse.papyrus.toolsmiths.plugin.builder.preferences.PluginBuilderPreferencesConstants; +import org.eclipse.uml2.uml.resource.UMLResource; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -415,7 +416,7 @@ public class GenericEMFModelBuilder extends AbstractPapyrusBuilder { if (bundleName != null) { result.add(bundleName); } else { - Activator.log.warn(NLS.bind("Papyrus Builder: We don't found bundle for nsURI {0}", currentNS_URI)); //$NON-NLS-1$ + Activator.log.warn(NLS.bind(Messages.GenericEMFModelBuilder_noBundleFoundForNsUri, currentNS_URI)); } } } @@ -431,8 +432,8 @@ public class GenericEMFModelBuilder extends AbstractPapyrusBuilder { */ protected String getBundleNameFromNS_URI(final String nsURI) { // TODO : find a generic way for that! - if (nsURI.equals("http://www.eclipse.org/uml2/schemas/UML2/2") || nsURI.equals("http://www.eclipse.org/uml2/schemas/Ecore/5")) { - return "org.eclipse.uml2.uml.resources"; + if (nsURI.equals(UMLResource.UML2_PROFILE_NS_URI) || nsURI.equals(UMLResource.ECORE_PROFILE_NS_URI)) { + return "org.eclipse.uml2.uml.resources"; //$NON-NLS-1$ } return RESOURCE_HELPER.getBundleNameFromNS_URI(nsURI); } diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/ManifestBuilder.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/ManifestBuilder.java index cbd134d5239..f522c686791 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/ManifestBuilder.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/ManifestBuilder.java @@ -36,9 +36,9 @@ import org.osgi.framework.Version; */ public class ManifestBuilder extends AbstractPapyrusBuilder { - public static final String DEPENDENCY_MARKER_ATTRIBUTE = "dependency"; + public static final String DEPENDENCY_MARKER_ATTRIBUTE = "dependency"; //$NON-NLS-1$ - public static final String KIND_MARKER_ATTRIBUTE = "kind"; + public static final String KIND_MARKER_ATTRIBUTE = "kind"; //$NON-NLS-1$ public static final int REEXPORT_KIND = 0; diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/Messages.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/Messages.java new file mode 100644 index 00000000000..e2552a11c3e --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/Messages.java @@ -0,0 +1,68 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder; + +import org.eclipse.osgi.util.NLS; + +/** + * + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.papyrus.toolsmiths.plugin.builder.messages"; //$NON-NLS-1$ + public static String AbstractPapyrusBuilder_PapyrusBuilder; + public static String GenericEMFModelBuilder_noBundleFoundForNsUri; + public static String MarkerResolutionUtils_selectGenmodel; + public static String MismatchedUriAttributeMarkerResolution_description; + public static String MismatchedUriAttributeMarkerResolution_label; + public static String MissingDependenciesMarkerResolution_description; + public static String MissingDependenciesMarkerResolution_label; + public static String MissingGenModelAttributeMarkerResolution_description; + public static String MissingGenModelAttributeMarkerResolution_label; + public static String MissingUriAttributeMarkerResolution_description; + public static String MissingUriAttributeMarkerResolution_label; + public static String NoEcoreGenPackageMarkerResolution_description; + public static String NoEcoreGenPackageMarkerResolution_label; + public static String NoLocationUMLGenPackageMarkerResolution_description; + public static String NoLocationUMLGenPackageMarkerResolution_label; + public static String NoPapyrusProfileExtensionMarkerResolution_description; + public static String NoPapyrusProfileExtensionMarkerResolution_label; + public static String NoUMLGenPackageMarkerResolution_description; + public static String NoUMLGenPackageMarkerResolution_label; + public static String PapyrusProfileExtensionMissingNameMarkerResolution_description; + public static String PapyrusProfileExtensionMissingNameMarkerResolution_label; + public static String PluginBuilderPreferenceGroup_activateBuilder; + public static String PluginBuilderPreferenceGroup_activateBuildModel; + public static String PluginBuilderPreferenceGroup_checkDependenciesRange; + public static String PluginBuilderPreferenceGroup_checkModelDependencies; + public static String PluginBuilderPreferenceGroup_checkNoReexportedDependencies; + public static String PluginBuilderPreferenceGroup_manifestValidation; + public static String PluginBuilderPreferenceGroup_modelValidation; + public static String PluginBuilderPreferenceGroup_PapyrusPluginBuilder; + public static String PluginBuilderPreferenceGroup_validateManifest; + public static String PluginBuilderPreferenceGroup_validateModels; + public static String PluginBuilderPreferencePage_builderPreferenceGroupDescription; + public static String ResourceMissingFromBinaryBuildMarkerResolution_description; + public static String ResourceMissingFromBinaryBuildMarkerResolution_label; + public static String XWTModelBuilder_noBundleProvidingResourceUri; + public static String XWTModelBuilder_noBundleWithUri; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/PapyrusPluginBuilder.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/PapyrusPluginBuilder.java index 856cbf49c85..051acfd3025 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/PapyrusPluginBuilder.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/PapyrusPluginBuilder.java @@ -69,13 +69,14 @@ public class PapyrusPluginBuilder extends IncrementalProjectBuilder { if (getProject() == null) { return null; } - // remove all previously created marker - clean(monitor); if (!isPapyrusPluginBuilderActivated()) { return null; } + // remove all previously created marker + clean(monitor); + // TODO : we also remove all java marker // getProject().deleteMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true, -1); diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/XWTModelBuilder.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/XWTModelBuilder.java index 49fc6d9d67d..0eca0e89ca3 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/XWTModelBuilder.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/XWTModelBuilder.java @@ -33,13 +33,13 @@ public class XWTModelBuilder extends GenericEMFModelBuilder { static final String XWT_EXTENSION = "xwt";//$NON-NLS-1$ - static final String ENVIRONMENT_XMI_EXTENSION = "xmi"; + static final String ENVIRONMENT_XMI_EXTENSION = "xmi"; //$NON-NLS-1$ - static final String CTX_EXTENSION = "ctx"; + static final String CTX_EXTENSION = "ctx"; //$NON-NLS-1$ - private static final String XWT_URI = "http://www.eclipse.org/xwt"; + private static final String XWT_URI = "http://www.eclipse.org/xwt"; //$NON-NLS-1$ - private static final String XWT_PRESENTATION_URI = "http://www.eclipse.org/xwt/presentation"; + private static final String XWT_PRESENTATION_URI = "http://www.eclipse.org/xwt/presentation"; //$NON-NLS-1$ /** * @see org.eclipse.papyrus.toolsmiths.plugin.builder.GenericEMFModelBuilder#getModelBundleDependenciesFromXML(org.eclipse.emf.ecore.resource.Resource) @@ -57,13 +57,13 @@ public class XWTModelBuilder extends GenericEMFModelBuilder { // we ignore this one continue; } - if (current.startsWith("clr-namespace:")) { - String substring = current.replaceAll("clr-namespace:", ""); + if (current.startsWith("clr-namespace:")) { //$NON-NLS-1$ + String substring = current.replaceAll("clr-namespace:", ""); //$NON-NLS-1$ //$NON-NLS-2$ // assuming the path contains the bundle name IPluginModelBase pluginModelBase = PluginRegistry.findModel(substring); - while (pluginModelBase == null && substring.contains(".")) { + while (pluginModelBase == null && substring.contains(".")) { //$NON-NLS-1$ int lastIndex = substring.lastIndexOf('.'); substring = substring.substring(0, lastIndex); pluginModelBase = PluginRegistry.findModel(substring); @@ -73,12 +73,12 @@ public class XWTModelBuilder extends GenericEMFModelBuilder { bundleFound = pluginModelBase.getBundleDescription().getName(); } } else if (XWT_URI.equals(current) || XWT_PRESENTATION_URI.equals(current)) { - bundleFound = "org.eclipse.xwt"; + bundleFound = "org.eclipse.xwt"; //$NON-NLS-1$ } else { bundleFound = getBundleNameFromNS_URI(current); } if (bundleFound == null) { - Activator.log.warn(NLS.bind("Papyrus Builder: We are not able to find the bundle providing the URI", current)); + Activator.log.warn(NLS.bind(Messages.XWTModelBuilder_noBundleWithUri, current)); } } @@ -104,7 +104,7 @@ public class XWTModelBuilder extends GenericEMFModelBuilder { dependencies.add(bundleName); } else { - Activator.log.warn(NLS.bind("We can't find the bundle providing the resource uri {0}", resource.getURI())); + Activator.log.warn(NLS.bind(Messages.XWTModelBuilder_noBundleProvidingResourceUri, resource.getURI())); } dependencies.addAll(getModelBundleDependenciesFromXML(resource)); @@ -123,7 +123,7 @@ public class XWTModelBuilder extends GenericEMFModelBuilder { String str = super.getBundleNameFromResource(resource); if (str == null) { org.eclipse.emf.common.util.URI uri = resource.getURI(); - if (uri.scheme().equals("ppe") && uri.segments()[0].equals("environment")) { + if (uri.scheme().equals("ppe") && uri.segments()[0].equals("environment")) { //$NON-NLS-1$ //$NON-NLS-2$ str = uri.segments()[1]; } } @@ -149,6 +149,6 @@ public class XWTModelBuilder extends GenericEMFModelBuilder { */ @Override protected boolean isIgnoredNS_URI(String ns_URI) { - return super.isIgnoredNS_URI(ns_URI) || "clr-namespace:java.lang".equals(ns_URI); + return super.isIgnoredNS_URI(ns_URI) || "clr-namespace:java.lang".equals(ns_URI); //$NON-NLS-1$ } } diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/helper/StaticProfileHelper.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/helper/StaticProfileHelper.java index 67d5a49ee21..262f518088d 100644 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/helper/StaticProfileHelper.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/helper/StaticProfileHelper.java @@ -78,7 +78,7 @@ public class StaticProfileHelper { private static class StaticProfileResourceVisitor implements IResourceVisitor { - private static final String GENMODEL_EXTENSION = "genmodel"; + private static final String GENMODEL_EXTENSION = "genmodel"; //$NON-NLS-1$ private Map<IFile, List<Profile>> foundProfiles = new HashMap<>(); private final boolean includeSubProfiles; diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/messages.properties b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/messages.properties new file mode 100644 index 00000000000..7a3a1381700 --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/messages.properties @@ -0,0 +1,37 @@ +AbstractPapyrusBuilder_PapyrusBuilder=Papyrus Builder: +GenericEMFModelBuilder_noBundleFoundForNsUri=Papyrus Builder: Bundle for nsURI {0} could not be found +MarkerResolutionUtils_selectGenmodel=Select genmodel file +MismatchedUriAttributeMarkerResolution_description=Replace the URI with the nsURI of the stereotype applied in the profile. +MismatchedUriAttributeMarkerResolution_label=Use value from profile +MissingDependenciesMarkerResolution_description=Add the missing dependencies in the manifest, with a calculated range. +MissingDependenciesMarkerResolution_label=Add missing dependencies, with a calculated range +MissingGenModelAttributeMarkerResolution_description=Add 'genModel' attribute to extension point +MissingGenModelAttributeMarkerResolution_label=Add 'genModel' attribute to extension point +MissingUriAttributeMarkerResolution_description=Add 'uri' attribute to extension point, pointing to the NSUri of the stereotype defined in the profile +MissingUriAttributeMarkerResolution_label=Add 'uri' attribute to extension point +NoEcoreGenPackageMarkerResolution_description=Add an entry for the 'org.eclipse.emf.ecore.generated_package' extension and configure it. +NoEcoreGenPackageMarkerResolution_label=Add Ecore generated package declaration +NoLocationUMLGenPackageMarkerResolution_description=Add attribute 'location' to the extension point. +NoLocationUMLGenPackageMarkerResolution_label=Add attribute 'location' +NoPapyrusProfileExtensionMarkerResolution_description=Add an entry for the 'org.eclipse.papyrus.uml.extensionpoints.UMLProfile' extension point and configure it. +NoPapyrusProfileExtensionMarkerResolution_label=Add 'org.eclipse.papyrus.uml.extensionpoints.UMLProfile' extension point declaration +NoUMLGenPackageMarkerResolution_description=Add an entry for the 'org.eclipse.uml2.uml.generated_package' extension and configure it. +NoUMLGenPackageMarkerResolution_label=Add 'org.eclipse.uml2.uml.generated_package' extension point declaration +PapyrusProfileExtensionMissingNameMarkerResolution_description=Add 'name' attribute to extension point. The name will be used to display the profile in the UI. +PapyrusProfileExtensionMissingNameMarkerResolution_label=Add 'name' attribute +PluginBuilderPreferenceGroup_activateBuilder=Activate the Papyrus Plugin Builder +PluginBuilderPreferenceGroup_activateBuildModel=Activate Papyrus Build Model +PluginBuilderPreferenceGroup_checkDependenciesRange=Check dependencies range +PluginBuilderPreferenceGroup_checkModelDependencies=Check model dependencies are included into the manifest file. +PluginBuilderPreferenceGroup_checkNoReexportedDependencies=Check there is no reexported dependencies +PluginBuilderPreferenceGroup_manifestValidation=Manifest Validation +PluginBuilderPreferenceGroup_modelValidation=Model Validation +PluginBuilderPreferenceGroup_PapyrusPluginBuilder=Papyrus Plugin Builder +PluginBuilderPreferenceGroup_validateManifest=Validate Manifest +PluginBuilderPreferenceGroup_validateModels=Validate models +PluginBuilderPreferencePage_builderPreferenceGroupDescription=Papyrus Plugin Builder add validation steps for plugin declared with the Papyrus Plugin nature. +ResourceMissingFromBinaryBuildMarkerResolution_description=Add resource to 'build.properties' file. +ResourceMissingFromBinaryBuildMarkerResolution_label=Add to binary build +XWTModelBuilder_noBundleProvidingResourceUri=We can''t find the bundle providing the resource uri ''{0}'' +XWTModelBuilder_noBundleWithUri=Papyrus Builder: We are not able to find the bundle providing the URI + diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/preferences/PluginBuilderPreferenceGroup.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/preferences/PluginBuilderPreferenceGroup.java index 0df6e1580e8..f68caacfc43 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/preferences/PluginBuilderPreferenceGroup.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/preferences/PluginBuilderPreferenceGroup.java @@ -21,6 +21,7 @@ import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.papyrus.infra.ui.preferences.AbstractPreferenceGroup; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; @@ -102,12 +103,12 @@ public class PluginBuilderPreferenceGroup extends AbstractPreferenceGroup implem GridLayout layout = new GridLayout(); layout.numColumns = 2; fieldGroup.setLayout(layout); - fieldGroup.setText("Papyrus Plugin Builder"); + fieldGroup.setText(Messages.PluginBuilderPreferenceGroup_PapyrusPluginBuilder); GridDataFactory.fillDefaults().grab(true, false).applyTo(fieldGroup); // the editor to activate Papyrus Plugin Builder - globalPapyrusPluginEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.ACTIVATE_MAIN_PAPYRUS_BUILDER, "Activate the Papyrus Plugin Builder", fieldGroup); + globalPapyrusPluginEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.ACTIVATE_MAIN_PAPYRUS_BUILDER, Messages.PluginBuilderPreferenceGroup_activateBuilder, fieldGroup); globalPapyrusPluginEditor.setPage(dialogPage); addFieldEditor(globalPapyrusPluginEditor); globalPapyrusPluginEditor.setPropertyChangeListener(this); @@ -127,17 +128,17 @@ public class PluginBuilderPreferenceGroup extends AbstractPreferenceGroup implem protected void createModelPreferenceEditors(final Composite parent) { // model group modelGroup = new Group(parent, SWT.NONE); - modelGroup.setText("Model Validation"); + modelGroup.setText(Messages.PluginBuilderPreferenceGroup_modelValidation); GridDataFactory.fillDefaults().grab(true, false).applyTo(modelGroup); - mainModelCheckEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.ACTIVATE_PAPYRUS_MODEL_BUILDER, "Activate Papyrus Build Model", modelGroup); + mainModelCheckEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.ACTIVATE_PAPYRUS_MODEL_BUILDER, Messages.PluginBuilderPreferenceGroup_activateBuildModel, modelGroup); addFieldEditor(mainModelCheckEditor); compositeInModelGroup = new Composite(modelGroup, SWT.NONE); - modelDependenciesEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.PAPYRUS_MODEL_BUILDER_CHECK_MODEL_DEPENDENCIES, "Check model dependencies are included into the manifest file.", compositeInModelGroup); + modelDependenciesEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.PAPYRUS_MODEL_BUILDER_CHECK_MODEL_DEPENDENCIES, Messages.PluginBuilderPreferenceGroup_checkModelDependencies, compositeInModelGroup); addFieldEditor(modelDependenciesEditor); - modelValidationEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.PAPYRUS_MODEL_BUILDER_VALIDATE_MODEL, "Validate models", compositeInModelGroup); + modelValidationEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.PAPYRUS_MODEL_BUILDER_VALIDATE_MODEL, Messages.PluginBuilderPreferenceGroup_validateModels, compositeInModelGroup); addFieldEditor(modelValidationEditor); // must be set after the creation of the editor @@ -153,17 +154,17 @@ public class PluginBuilderPreferenceGroup extends AbstractPreferenceGroup implem protected void createManifestPreferenceEditors(final Composite parent) { // manifest group manifestGroup = new Group(parent, SWT.NONE); - manifestGroup.setText("Manifest Validation"); + manifestGroup.setText(Messages.PluginBuilderPreferenceGroup_manifestValidation); GridDataFactory.fillDefaults().grab(true, false).applyTo(manifestGroup); - mainManifestCheckEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.ACTIVATE_PAPYRUS_MANIFEST_BUILDER, "Validate Manifest", manifestGroup); + mainManifestCheckEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.ACTIVATE_PAPYRUS_MANIFEST_BUILDER, Messages.PluginBuilderPreferenceGroup_validateManifest, manifestGroup); addFieldEditor(mainManifestCheckEditor); compositeInManifestGroup = new Composite(manifestGroup, SWT.NONE); - manifestDependencyReexportEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.PAPYRUS_MANIFEST_BUILDER_CHECK_NO_REEXPORT, "Check there is no reexported dependencies", compositeInManifestGroup); + manifestDependencyReexportEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.PAPYRUS_MANIFEST_BUILDER_CHECK_NO_REEXPORT, Messages.PluginBuilderPreferenceGroup_checkNoReexportedDependencies, compositeInManifestGroup); addFieldEditor(manifestDependencyReexportEditor); - manifestDependencyRangeEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.PAPYRUS_MANIFEST_BUILDER_CHECK_DEPENDENCY_RANGE, "Check dependencies range", compositeInManifestGroup); + manifestDependencyRangeEditor = new BooleanFieldEditor(PluginBuilderPreferencesConstants.PAPYRUS_MANIFEST_BUILDER_CHECK_DEPENDENCY_RANGE, Messages.PluginBuilderPreferenceGroup_checkDependenciesRange, compositeInManifestGroup); addFieldEditor(manifestDependencyRangeEditor); // must be set after the creation of the editor diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/preferences/PluginBuilderPreferencePage.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/preferences/PluginBuilderPreferencePage.java index bdcd9169c9c..2b911a978d9 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/preferences/PluginBuilderPreferencePage.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/preferences/PluginBuilderPreferencePage.java @@ -16,6 +16,7 @@ package org.eclipse.papyrus.toolsmiths.plugin.builder.preferences; import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage; import org.eclipse.papyrus.toolsmiths.plugin.builder.Activator; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; @@ -33,7 +34,7 @@ public class PluginBuilderPreferencePage extends AbstractPapyrusPreferencePage { @Override protected void createPageContents(Composite parent) { final Label label = new Label(parent, SWT.NONE); - label.setText("Papyrus Plugin Builder add validation steps for plugin declared with the Papyrus Plugin nature."); + label.setText(Messages.PluginBuilderPreferencePage_builderPreferenceGroupDescription); final PluginBuilderPreferenceGroup builderGroup = new PluginBuilderPreferenceGroup(parent, getTitle(), this); addPreferenceGroup(builderGroup); } diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/AbstractMissingAttributeMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/AbstractMissingAttributeMarkerResolution.java new file mode 100644 index 00000000000..da8ba9f8290 --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/AbstractMissingAttributeMarkerResolution.java @@ -0,0 +1,111 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import java.util.StringTokenizer; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Activator; +import org.eclipse.pde.core.IBaseModel; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.internal.core.builders.PDEMarkerFactory; +import org.eclipse.pde.internal.core.builders.XMLErrorReporter; +import org.eclipse.pde.internal.core.text.IDocumentElementNode; +import org.eclipse.pde.internal.ui.util.ModelModification; +import org.eclipse.pde.internal.ui.util.PDEModelUtility; + +/** + * Marker Resolution that adds a missing attribute to the {@link IDocumentElementNode} referenced by the marker. + */ +@SuppressWarnings("restriction") +public abstract class AbstractMissingAttributeMarkerResolution extends AbstractPapyrusMarkerResolution { + private IMarker marker; + private String attribute; + + /** + * Marker Resolution for the missing attribute with the given name. + * + * @param attribute + * the name of the missing attribute + */ + public AbstractMissingAttributeMarkerResolution(String attribute) { + this.attribute = attribute; + } + + protected IMarker getMarker() { + return marker; + } + + @Override + public void run(IMarker marker) { + this.marker = marker; + if (!(marker.getResource() instanceof IFile)) { + return; + } + ModelModification modification = new ModelModification((IFile) marker.getResource()) { + @Override + protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException { + if (model instanceof IPluginModelBase) { + addMissingAttribute((IPluginModelBase) model); + } + } + }; + PDEModelUtility.modifyModel(modification, null); + } + + protected abstract String getAttributeValue(); + + protected void addMissingAttribute(IPluginModelBase model) { + try { + String locationPath = (String) marker.getAttribute(PDEMarkerFactory.MPK_LOCATION_PATH); + IDocumentElementNode node = getNodeWithMarker(model, locationPath); + + String value = getAttributeValue(); + if (value != null) { + node.setXMLAttribute(attribute, value); + } + } catch (CoreException e) { + Activator.log.error(e); + } + } + + private IDocumentElementNode getNodeWithMarker(IPluginModelBase model, String locationPath) { + IDocumentElementNode node = null; + StringTokenizer strtok = new StringTokenizer(locationPath, Character.toString(XMLErrorReporter.F_CHILD_SEP)); + while (strtok.hasMoreTokens()) { + String token = strtok.nextToken(); + if (node != null) { + IDocumentElementNode[] children = node.getChildNodes(); + int childIndex = Integer.parseInt(token.substring(1, token.indexOf(')'))); + if ((childIndex >= 0) || (childIndex < children.length)) { + node = children[childIndex]; + } + } else { + node = (IDocumentElementNode) model.getPluginBase(); + } + + int attr = token.indexOf(XMLErrorReporter.F_ATT_PREFIX); + if (attr != -1) { + return node; + } + } + return node; + } + +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/DependencyRangeMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/DependencyRangeMarkerResolution.java index e278781740d..1775754c403 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/DependencyRangeMarkerResolution.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/DependencyRangeMarkerResolution.java @@ -62,7 +62,7 @@ public class DependencyRangeMarkerResolution extends AbstractPapyrusMarkerResolu ManifestEditor me = new ManifestEditor(project); me.init(); - String version = ""; + String version = ""; //$NON-NLS-1$ BundleSpecification bundle = null; switch (marker.getAttribute(ManifestBuilder.KIND_MARKER_ATTRIBUTE, 0)) { case ManifestBuilder.EXCLUDE_MINIMUM_RANGE_KIND: diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MarkerResolutionUtils.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MarkerResolutionUtils.java new file mode 100644 index 00000000000..5e2f095149f --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MarkerResolutionUtils.java @@ -0,0 +1,104 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.papyrus.toolsmiths.plugin.builder.helper.StaticProfileHelper; +import org.eclipse.papyrus.toolsmiths.validation.profile.internal.checkers.StaticProfilePluginErrorReporter; +import org.eclipse.papyrus.uml.tools.utils.StaticProfileUtil; +import org.eclipse.ui.IMarkerResolution; +import org.eclipse.uml2.uml.Profile; + +/** + * Helper class with utility methods used by {@link IMarkerResolution marker resolutions}. + */ +public final class MarkerResolutionUtils { + + /** + * Returns the genmodel file for the profile for which the given marker was created. + */ + public static IFile getGenModelFile(IMarker marker) throws CoreException { + IFile umlModelFile = getUMLModelFile(marker); + if (umlModelFile == null) { + return null; + } + + IPath genModelFilePath = umlModelFile.getFullPath().removeFileExtension().addFileExtension("genmodel"); //$NON-NLS-1$ + return ResourcesPlugin.getWorkspace().getRoot().getFile(genModelFilePath); + + } + + /** Returns the UML model file of the profile for which this marker was created. */ + public static IFile getUMLModelFile(IMarker marker) throws CoreException { + Optional<Profile> profileOptional = MarkerResolutionUtils.getProfile(marker); + if (profileOptional.isEmpty()) { + return null; + } + Profile profile = profileOptional.get(); + Resource umlModelResource = profile.eResource(); + return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(umlModelResource.getURI().toPlatformString(true))); + } + + /** + * Returns the stereotype URI of the profile for which the given marker was created. + * + * @see MarkerResolutionUtils#getProfile(IMarker) + */ + public static String getStereotypeUri(IMarker marker) { + Optional<Profile> profile = getProfile(marker); + if (profile.isEmpty()) { + return null; + } + return getStereotypeUri(profile.get()); + + } + + /** Returns the NS URI of the stereotype applied to the profile. */ + public static String getStereotypeUri(Profile profile) { + return new StaticProfileUtil(profile).getDefinition().getNsURI(); + } + + /** Returns the profile name stored in the marker attribute {@link StaticProfilePluginErrorReporter#STATIC_PROFILE_MARKER_ATTRIBUTE} or <code>null</code> if the attribute does not exist. */ + public static String getProfileName(IMarker marker) { + return marker.getAttribute(StaticProfilePluginErrorReporter.STATIC_PROFILE_MARKER_ATTRIBUTE, null); + } + + /** + * Returns the {@link Profile} for which this marker was created. + * + * @see MarkerResolutionUtils#getProfileName(IMarker) + */ + public static Optional<Profile> getProfile(IMarker marker) { + String profileName = getProfileName(marker); + if (profileName == null || profileName.isBlank()) { + return Optional.empty(); + } + Map<IFile, List<Profile>> profiles = StaticProfileHelper.findStaticProfiles(marker.getResource().getProject(), true); + return profiles.values().stream().flatMap(List::stream).filter(profile -> Objects.equals(profile.getName(), profileName)).findFirst(); + } + +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingDependenciesMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingDependenciesMarkerResolution.java index 765fa626090..04ca52f2e2f 100755 --- a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingDependenciesMarkerResolution.java +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingDependenciesMarkerResolution.java @@ -24,6 +24,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.papyrus.eclipse.project.editors.file.ManifestEditor; import org.eclipse.papyrus.emf.validation.DependencyValidationUtils; import org.eclipse.papyrus.toolsmiths.plugin.builder.Activator; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; import org.eclipse.papyrus.toolsmiths.plugin.builder.helper.BundleVersionHelper; /** @@ -38,7 +39,7 @@ public class MissingDependenciesMarkerResolution extends AbstractPapyrusMarkerRe */ @Override public String getLabel() { - return "Add missing dependencies, with a calculated range"; //$NON-NLS-1$ + return Messages.MissingDependenciesMarkerResolution_label; } /** @@ -83,7 +84,7 @@ public class MissingDependenciesMarkerResolution extends AbstractPapyrusMarkerRe */ @Override public String getDescription() { - return "Add the missing dependencies in the manifest, with a calculated range."; //$NON-NLS-1$ + return Messages.MissingDependenciesMarkerResolution_description; } } diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingGenModelAttributeMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingGenModelAttributeMarkerResolution.java new file mode 100644 index 00000000000..b87922a81c9 --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingGenModelAttributeMarkerResolution.java @@ -0,0 +1,57 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.papyrus.infra.emf.utils.ResourceUtils; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Activator; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; + +/** + * Resolution for markers created for missing genModel attributes in an extension point. + * + */ +public class MissingGenModelAttributeMarkerResolution + extends AbstractMissingAttributeMarkerResolution { + + MissingGenModelAttributeMarkerResolution() { + super("genModel"); //$NON-NLS-1$ + } + + @Override + public String getLabel() { + return Messages.MissingGenModelAttributeMarkerResolution_label; + } + + @Override + public String getDescription() { + return Messages.MissingGenModelAttributeMarkerResolution_description; + } + + @Override + protected String getAttributeValue() { + try { + IFile genModelFile = MarkerResolutionUtils.getGenModelFile(getMarker()); + if (genModelFile != null) { + return ResourceUtils.getStringURI(genModelFile.getProjectRelativePath()); + } + } catch (CoreException e) { + Activator.log.error(e); + } + return null; + } +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingUriAttributeMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingUriAttributeMarkerResolution.java new file mode 100644 index 00000000000..afddf316cf5 --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/MissingUriAttributeMarkerResolution.java @@ -0,0 +1,46 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; +import org.eclipse.papyrus.toolsmiths.validation.profile.internal.checkers.StaticProfilePluginErrorReporter; + +/** + * Resolution for markers created for missing genModel attributes in the extension point. + * + */ +public class MissingUriAttributeMarkerResolution + extends AbstractMissingAttributeMarkerResolution { + + MissingUriAttributeMarkerResolution() { + super("uri"); //$NON-NLS-1$ + } + + @Override + public String getLabel() { + return Messages.MissingUriAttributeMarkerResolution_label; + } + + @Override + public String getDescription() { + return Messages.MissingUriAttributeMarkerResolution_description; + } + + @Override + protected String getAttributeValue() { + return getMarker().getAttribute(StaticProfilePluginErrorReporter.STATIC_PROFILE_STEREOTYPE_URI, ""); //$NON-NLS-1$ + } +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoEcoreGenPackageMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoEcoreGenPackageMarkerResolution.java new file mode 100644 index 00000000000..655ee8e7669 --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoEcoreGenPackageMarkerResolution.java @@ -0,0 +1,93 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.papyrus.infra.emf.utils.ResourceUtils; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Activator; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; +import org.eclipse.papyrus.toolsmiths.validation.profile.constants.ProfilePluginValidationConstants; +import org.eclipse.pde.core.IBaseModel; +import org.eclipse.pde.core.plugin.IPluginElement; +import org.eclipse.pde.core.plugin.IPluginExtension; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.internal.ui.util.ModelModification; +import org.eclipse.pde.internal.ui.util.PDEModelUtility; + +/** + * Resolution that adds an entry for the 'org.eclipse.emf.ecore.generated_package' extension and configures it. + */ +@SuppressWarnings("restriction") +public class NoEcoreGenPackageMarkerResolution extends AbstractPapyrusMarkerResolution { + + private IMarker marker; + + @Override + public String getDescription() { + return Messages.NoEcoreGenPackageMarkerResolution_description; + } + + @Override + public String getLabel() { + return Messages.NoEcoreGenPackageMarkerResolution_label; + } + + @Override + public void run(IMarker marker) { + this.marker = marker; + if (!(marker.getResource() instanceof IFile)) { + return; + } + ModelModification modification = new ModelModification((IFile) marker.getResource()) { + @Override + protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException { + if (model instanceof IPluginModelBase) { + addExtension((IPluginModelBase) model); + } + } + }; + PDEModelUtility.modifyModel(modification, null); + } + + private void addExtension(IPluginModelBase model) { + try { + IPluginExtension extension = model.getFactory().createExtension(); + extension.setPoint(ProfilePluginValidationConstants.ECORE_GENERATED_PACKAGE_EXTENSION_POINT); + model.getPluginBase().add(extension); + IPluginElement packageElement = model.getFactory().createElement(extension); + packageElement.setName("package"); //$NON-NLS-1$ + extension.add(packageElement); + IFile genModel = MarkerResolutionUtils.getGenModelFile(marker); + if (genModel != null) { + packageElement.setAttribute("genModel", ResourceUtils.mapAndEncodePath(genModel)); //$NON-NLS-1$ + } + String uri = MarkerResolutionUtils.getStereotypeUri(marker); + if (uri != null) { + packageElement.setAttribute("uri", uri); //$NON-NLS-1$ + } + + // XXX needed? + // packageElement.setAttribute("class", ""); + + } catch (CoreException e) { + Activator.log.error(e); + } + } + +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoLocationUMLGenPackageMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoLocationUMLGenPackageMarkerResolution.java new file mode 100644 index 00000000000..66b2c42eb92 --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoLocationUMLGenPackageMarkerResolution.java @@ -0,0 +1,71 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import java.util.Optional; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.papyrus.infra.emf.utils.ResourceUtils; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Activator; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; +import org.eclipse.uml2.uml.Profile; + +/** + * Resolution for markers created for missing genModel attributes in the extension point. + * + */ +public class NoLocationUMLGenPackageMarkerResolution + extends AbstractMissingAttributeMarkerResolution { + + NoLocationUMLGenPackageMarkerResolution() { + super("location"); //$NON-NLS-1$ + } + + @Override + public String getLabel() { + return Messages.NoLocationUMLGenPackageMarkerResolution_label; + } + + @Override + public String getDescription() { + return Messages.NoLocationUMLGenPackageMarkerResolution_description; + } + + @Override + protected String getAttributeValue() { + Optional<Profile> profileOptional = MarkerResolutionUtils.getProfile(getMarker()); + if (profileOptional.isEmpty()) { + return null; + } + Profile profile = profileOptional.get(); + Resource resource = profile.eResource(); + String uriFragment = resource.getURIFragment(profile); + + try { + IFile umlModelFile = MarkerResolutionUtils.getUMLModelFile(getMarker()); + if (umlModelFile == null) { + return null; + } + + return ResourceUtils.mapAndEncodePath(umlModelFile) + "#" + uriFragment; //$NON-NLS-1$ + } catch (CoreException e) { + Activator.log.error(e); + } + return null; + } +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoPapyrusProfileExtensionMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoPapyrusProfileExtensionMarkerResolution.java new file mode 100644 index 00000000000..1a599cb0234 --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoPapyrusProfileExtensionMarkerResolution.java @@ -0,0 +1,93 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import java.util.Optional; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.papyrus.infra.emf.utils.ResourceUtils; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Activator; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; +import org.eclipse.papyrus.toolsmiths.validation.profile.constants.ProfilePluginValidationConstants; +import org.eclipse.pde.core.IBaseModel; +import org.eclipse.pde.core.plugin.IPluginElement; +import org.eclipse.pde.core.plugin.IPluginExtension; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.internal.ui.util.ModelModification; +import org.eclipse.pde.internal.ui.util.PDEModelUtility; +import org.eclipse.uml2.uml.Profile; + +/** + * Resolution that adds an entry for the 'org.eclipse.papyrus.uml.extensionpoints.UMLProfile' extension and configures it. + */ +@SuppressWarnings("restriction") +public class NoPapyrusProfileExtensionMarkerResolution extends AbstractPapyrusMarkerResolution { + private IMarker marker; + + @Override + public String getDescription() { + return Messages.NoPapyrusProfileExtensionMarkerResolution_description; + } + + @Override + public String getLabel() { + return Messages.NoPapyrusProfileExtensionMarkerResolution_label; + } + + @Override + public void run(IMarker marker) { + this.marker = marker; + if (!(marker.getResource() instanceof IFile)) { + return; + } + ModelModification modification = new ModelModification((IFile) marker.getResource()) { + @Override + protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException { + if (model instanceof IPluginModelBase) { + addExtension((IPluginModelBase) model); + } + } + }; + PDEModelUtility.modifyModel(modification, null); + } + + private void addExtension(IPluginModelBase model) { + try { + IPluginExtension extension = model.getFactory().createExtension(); + extension.setPoint(ProfilePluginValidationConstants.UMLPROFILE_EXTENSION_POINT); + model.getPluginBase().add(extension); + IPluginElement packageElement = model.getFactory().createElement(extension); + packageElement.setName("profile"); //$NON-NLS-1$ + extension.add(packageElement); + + Optional<Profile> profileOptional = MarkerResolutionUtils.getProfile(marker); + if (profileOptional.isEmpty()) { + return; + } + Profile profile = profileOptional.get(); + packageElement.setAttribute("name", profile.getName()); //$NON-NLS-1$ + IFile modelFile = MarkerResolutionUtils.getUMLModelFile(marker); + packageElement.setAttribute("path", ResourceUtils.mapAndEncodePath(modelFile)); //$NON-NLS-1$ + + } catch (CoreException e) { + Activator.log.error(e); + } + } + +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoUMLGenPackageMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoUMLGenPackageMarkerResolution.java new file mode 100644 index 00000000000..af91a4680a4 --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/NoUMLGenPackageMarkerResolution.java @@ -0,0 +1,102 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import java.util.Optional; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.papyrus.infra.emf.utils.ResourceUtils; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Activator; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; +import org.eclipse.papyrus.toolsmiths.validation.profile.constants.ProfilePluginValidationConstants; +import org.eclipse.pde.core.IBaseModel; +import org.eclipse.pde.core.plugin.IPluginElement; +import org.eclipse.pde.core.plugin.IPluginExtension; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.internal.ui.util.ModelModification; +import org.eclipse.pde.internal.ui.util.PDEModelUtility; +import org.eclipse.uml2.uml.Profile; + +/** + * Resolution that adds an entry for the 'org.eclipse.emf.ecore.generated_package' extension and configures it. + */ +@SuppressWarnings("restriction") +public class NoUMLGenPackageMarkerResolution extends AbstractPapyrusMarkerResolution { + + private IMarker marker; + + @Override + public String getDescription() { + return Messages.NoUMLGenPackageMarkerResolution_description; + } + + @Override + public String getLabel() { + return Messages.NoUMLGenPackageMarkerResolution_label; + } + + @Override + public void run(IMarker marker) { + this.marker = marker; + if (!(marker.getResource() instanceof IFile)) { + return; + } + ModelModification modification = new ModelModification((IFile) marker.getResource()) { + @Override + protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException { + if (model instanceof IPluginModelBase) { + addExtension((IPluginModelBase) model); + } + } + }; + PDEModelUtility.modifyModel(modification, null); + } + + private void addExtension(IPluginModelBase model) { + try { + IPluginExtension extension = model.getFactory().createExtension(); + extension.setPoint(ProfilePluginValidationConstants.UML_GENERATED_PACKAGE_EXTENSION_POINT); + model.getPluginBase().add(extension); + IPluginElement packageElement = model.getFactory().createElement(extension); + packageElement.setName("profile"); //$NON-NLS-1$ + extension.add(packageElement); + + Optional<Profile> profileOptional = MarkerResolutionUtils.getProfile(marker); + if (profileOptional.isEmpty()) { + return; + } + Profile profile = profileOptional.get(); + String uri = MarkerResolutionUtils.getStereotypeUri(profile); + if (uri != null) { + packageElement.setAttribute("uri", uri); //$NON-NLS-1$ + } + Resource resource = profile.eResource(); + String uriFragment = resource.getURIFragment(profile); + IFile umlModelFile = MarkerResolutionUtils.getUMLModelFile(marker); + if (umlModelFile != null) { + String location = ResourceUtils.mapAndEncodePath(umlModelFile) + "#" + uriFragment; //$NON-NLS-1$ + packageElement.setAttribute("location", location); //$NON-NLS-1$ + } + } catch (CoreException e) { + Activator.log.error(e); + } + } + +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/PapyrusProfileExtensionMissingNameMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/PapyrusProfileExtensionMissingNameMarkerResolution.java new file mode 100644 index 00000000000..1c2d1bef3fe --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/PapyrusProfileExtensionMissingNameMarkerResolution.java @@ -0,0 +1,52 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import java.util.Optional; + +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; +import org.eclipse.uml2.uml.Profile; + +/** + * Resolution for markers created for missing profile name attribute in the extension point. + */ +public class PapyrusProfileExtensionMissingNameMarkerResolution extends AbstractMissingAttributeMarkerResolution { + + public PapyrusProfileExtensionMissingNameMarkerResolution() { + super("name"); //$NON-NLS-1$ + } + + @Override + public String getDescription() { + return Messages.PapyrusProfileExtensionMissingNameMarkerResolution_description; + } + + @Override + public String getLabel() { + return Messages.PapyrusProfileExtensionMissingNameMarkerResolution_label; + } + + @Override + protected String getAttributeValue() { + Optional<Profile> profileOptional = MarkerResolutionUtils.getProfile(getMarker()); + if (profileOptional.isEmpty()) { + return null; + } + Profile profile = profileOptional.get(); + return profile.getName(); + } + +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/ResourceMissingFromBinaryBuildMarkerResolution.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/ResourceMissingFromBinaryBuildMarkerResolution.java new file mode 100644 index 00000000000..e62d2ba72b4 --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/ResourceMissingFromBinaryBuildMarkerResolution.java @@ -0,0 +1,46 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * alex - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import org.eclipse.core.resources.IMarker; +import org.eclipse.papyrus.eclipse.project.editors.file.BuildEditor; +import org.eclipse.papyrus.toolsmiths.plugin.builder.Messages; +import org.eclipse.papyrus.toolsmiths.validation.profile.internal.checkers.StaticProfilePluginErrorReporter; + +/** + * Resolution that adds the missing file to the binary build. + */ +public class ResourceMissingFromBinaryBuildMarkerResolution extends AbstractPapyrusMarkerResolution { + + @Override + public String getDescription() { + return Messages.ResourceMissingFromBinaryBuildMarkerResolution_description; + } + + @Override + public String getLabel() { + return Messages.ResourceMissingFromBinaryBuildMarkerResolution_label; + } + + @Override + public void run(IMarker marker) { + BuildEditor buildEditor = new BuildEditor(marker.getResource().getProject()); + buildEditor.init(); + buildEditor.addToBuild(marker.getAttribute(StaticProfilePluginErrorReporter.STATIC_PROFILE_BINARY_BUILD_PATH, "")); //$NON-NLS-1$ + buildEditor.save(); + } + +} diff --git a/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/StaticProfileMarkerResolutionGenerator.java b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/StaticProfileMarkerResolutionGenerator.java new file mode 100644 index 00000000000..3c2980e4afe --- /dev/null +++ b/plugins/toolsmiths/builder/org.eclipse.papyrus.toolsmiths.plugin.builder/src/org/eclipse/papyrus/toolsmiths/plugin/builder/quickfix/StaticProfileMarkerResolutionGenerator.java @@ -0,0 +1,57 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST, EclipseSource and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexandra Buzila (EclipseSource) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.plugin.builder.quickfix; + +import org.eclipse.core.resources.IMarker; +import org.eclipse.papyrus.toolsmiths.validation.profile.internal.checkers.StaticProfilePluginErrorReporter; +import org.eclipse.pde.internal.core.builders.PDEMarkerFactory; +import org.eclipse.ui.IMarkerResolution; +import org.eclipse.ui.IMarkerResolutionGenerator; + +/** + * Resolution generator for markers created by the validation of static profiles. + * + */ +@SuppressWarnings("restriction") +public class StaticProfileMarkerResolutionGenerator implements IMarkerResolutionGenerator { + private static IMarkerResolution[] NO_RESOLUTIONS = new IMarkerResolution[0]; + + @Override + public IMarkerResolution[] getResolutions(IMarker marker) { + int problemId = marker.getAttribute(PDEMarkerFactory.PROBLEM_ID, PDEMarkerFactory.NO_RESOLUTION); + switch (problemId) { + case StaticProfilePluginErrorReporter.NO_GENMODEL_MARKER_ID: + return new IMarkerResolution[] { new MissingGenModelAttributeMarkerResolution() }; + case StaticProfilePluginErrorReporter.NO_URI_MARKER_ID: + return new IMarkerResolution[] { new MissingUriAttributeMarkerResolution() }; + case StaticProfilePluginErrorReporter.NO_ECORE_GEN_PACKAGE_MARKER_ID: + return new IMarkerResolution[] { new NoEcoreGenPackageMarkerResolution() }; + case StaticProfilePluginErrorReporter.NO_UML2_GEN_PACKAGE_MARKER_ID: + return new IMarkerResolution[] { new NoUMLGenPackageMarkerResolution() }; + case StaticProfilePluginErrorReporter.NO_UML2_GEN_PACKAGE_LOCATION_MARKER_ID: + return new IMarkerResolution[] { new NoLocationUMLGenPackageMarkerResolution() }; + case StaticProfilePluginErrorReporter.PAPYRUS_PROFILE_EXTENSION_NO_NAME_MARKER_ID: + return new IMarkerResolution[] { new PapyrusProfileExtensionMissingNameMarkerResolution() }; + case StaticProfilePluginErrorReporter.NO_PAPYRUS_PROFILE_MARKER_ID: + return new IMarkerResolution[] { new NoPapyrusProfileExtensionMarkerResolution() }; + case StaticProfilePluginErrorReporter.MISSING_FROM_BINARY_BUILD_MARKER_ID: + return new IMarkerResolution[] { new ResourceMissingFromBinaryBuildMarkerResolution() }; + default: + return NO_RESOLUTIONS; + } + } + +} diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/constants/ProfilePluginValidationConstants.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/constants/ProfilePluginValidationConstants.java index 0f409ff8298..71360bf45d9 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/constants/ProfilePluginValidationConstants.java +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/constants/ProfilePluginValidationConstants.java @@ -34,4 +34,14 @@ public class ProfilePluginValidationConstants { * The uml generated package extension point identifier. */ public static final String UML_GENERATED_PACKAGE_EXTENSION_POINT = "org.eclipse.uml2.uml.generated_package"; //$NON-NLS-1$ + + /** + * The EMF Ecore generated package extension point identifier. + */ + public static final String ECORE_GENERATED_PACKAGE_EXTENSION_POINT = "org.eclipse.emf.ecore.generated_package"; //$NON-NLS-1$ + + /** + * The EMF Ecore URI mapping extension point identifier. + */ + public static final String ECORE_URI_MAPPING_EXTENSION_POINT = "org.eclipse.emf.ecore.uri_mapping"; //$NON-NLS-1$ } diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileExtensionsChecker.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileExtensionsChecker.java deleted file mode 100644 index 44cb52188b2..00000000000 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileExtensionsChecker.java +++ /dev/null @@ -1,98 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2019, 2020 CEA LIST, EclipseSource and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation - * Remi Schnekenburger (EclipseSource) - Bug 568495 - * - *****************************************************************************/ -package org.eclipse.papyrus.toolsmiths.validation.profile.internal.checkers; - -import java.util.Collection; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.toolsmiths.validation.common.checkers.IPluginChecker; -import org.eclipse.papyrus.toolsmiths.validation.common.utils.ProjectManagementService; -import org.eclipse.papyrus.toolsmiths.validation.profile.internal.messages.Messages; -import org.eclipse.pde.internal.core.builders.DefaultSAXParser; -import org.eclipse.pde.internal.core.builders.PDEMarkerFactory; -import org.eclipse.uml2.uml.Profile; - -/** - * This class allows to check the extensions of the 'plugin.xml' needed for the profiles. - */ -@SuppressWarnings("restriction") -public class ProfileExtensionsChecker implements IPluginChecker { - - /** - * The current project resource. - */ - private final IProject project; - - /** - * The file of the UML profile. - */ - private final IFile profileFile; - - /** - * The existing profiles in the UML file. - */ - private final Collection<Profile> existingProfiles; - - /** - * Constructor. - * - * @param project - * The current project to check. - * @param profileFile - * The file of the UML profile. - * @param existingProfiles - * The existing profiles in the UML file. - */ - public ProfileExtensionsChecker(final IProject project, final IFile profileFile, final Collection<Profile> existingProfiles) { - this.project = project; - this.profileFile = profileFile; - this.existingProfiles = existingProfiles; - } - - /** - * This allows to check the extensions of the profile. - * {@inheritDoc} - * - * @see org.eclipse.papyrus.toolsmiths.validation.common.checkers.IPluginChecker#check(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - public void check(final IProgressMonitor monitor) { - - if (monitor != null && monitor.isCanceled()) { - return; - } - - final IFile pluginXML = ProjectManagementService.getPluginXMLFile(project); - - if (pluginXML == null) { - MarkersService.createMarker(profileFile, PDEMarkerFactory.MARKER_ID, "No extensions are declared for this static profile", IMarker.SEVERITY_ERROR); - return; - } - monitor.subTask(NLS.bind(Messages.StaticProfileExtensionsBuilder_subTask_checkingFile, profileFile)); - for (Profile profile : existingProfiles) { - StaticProfilePluginErrorReporter reporter = new StaticProfilePluginErrorReporter(pluginXML, profile, profileFile); - DefaultSAXParser.parse(pluginXML, reporter); - reporter.validateContent(monitor); - } - if (null != monitor) { - monitor.worked(1); - } - } - -} diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfilePluginChecker.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfilePluginChecker.java index ae6a22faeee..11fdf88ea88 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfilePluginChecker.java +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfilePluginChecker.java @@ -33,6 +33,7 @@ import org.eclipse.papyrus.toolsmiths.validation.common.utils.PluginValidationSe import org.eclipse.papyrus.toolsmiths.validation.common.utils.ProjectManagementService; import org.eclipse.papyrus.toolsmiths.validation.profile.Activator; import org.eclipse.papyrus.toolsmiths.validation.profile.constants.ProfilePluginValidationConstants; +import org.eclipse.papyrus.toolsmiths.validation.profile.internal.messages.Messages; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.uml2.uml.Profile; @@ -57,7 +58,7 @@ public class ProfilePluginChecker { // Open the progress monitor dialog new ProgressMonitorDialog(shell).run(true, true, monitor -> { final Collection<IFile> profileFiles = ProjectManagementService.getFilesFromProject(project, "profile.uml", true); //$NON-NLS-1$ - monitor.beginTask("Validate Profile plug-in.", 1 + (profileFiles.size() * 4)); // $NON-NLS-1$ + monitor.beginTask(Messages.ProfilePluginChecker_validateProfilePluginTask, 1 + (profileFiles.size() * 4)); // $NON-NLS-1$ monitor.subTask("Prepare validation."); //$NON-NLS-1$ // First of all, delete the existing markers for project diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/SelectiveDeleteErrorReporter.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/SelectiveDeleteErrorReporter.java index 6c315338bc1..cdd152b4d12 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/SelectiveDeleteErrorReporter.java +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/SelectiveDeleteErrorReporter.java @@ -37,7 +37,7 @@ import org.eclipse.pde.internal.core.builders.PDEMarkerFactory; @SuppressWarnings("restriction") public class SelectiveDeleteErrorReporter extends IncrementalErrorReporter { - public static final String SOURCE_ID = "source_id"; + public static final String SOURCE_ID = "source_id"; //$NON-NLS-1$ private final IResource fResource; private final Collection<VirtualMarker> fReportedMarkers = new ArrayList<>(); private int fErrorCount; diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/StaticProfilePluginErrorReporter.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/StaticProfilePluginErrorReporter.java index 997130c6777..af59e839779 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/StaticProfilePluginErrorReporter.java +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/StaticProfilePluginErrorReporter.java @@ -9,7 +9,7 @@ * SPDX-License-Identifier: EPL-2.0 * * Contributors: - * Remi SChnekenburger (EclipseSource) - Initial API and implementation + * Remi Schnekenburger (EclipseSource) - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrus.toolsmiths.validation.profile.internal.checkers; @@ -17,6 +17,7 @@ package org.eclipse.papyrus.toolsmiths.validation.profile.internal.checkers; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -30,15 +31,20 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.impl.URIMappingRegistryImpl; import org.eclipse.emf.ecore.xmi.XMIResource; import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.toolsmiths.validation.common.utils.ProjectManagementService; import org.eclipse.papyrus.toolsmiths.validation.profile.Activator; +import org.eclipse.papyrus.toolsmiths.validation.profile.constants.ProfilePluginValidationConstants; import org.eclipse.papyrus.toolsmiths.validation.profile.internal.messages.Messages; import org.eclipse.papyrus.uml.tools.model.UmlModel; +import org.eclipse.papyrus.uml.tools.utils.StaticProfileUtil; +import org.eclipse.pde.core.build.IBuild; +import org.eclipse.pde.core.build.IBuildEntry; +import org.eclipse.pde.core.build.IBuildModel; import org.eclipse.pde.internal.core.builders.CompilerFlags; import org.eclipse.pde.internal.core.builders.IncrementalErrorReporter.VirtualMarker; import org.eclipse.pde.internal.core.builders.PluginBaseErrorReporter; import org.eclipse.pde.internal.core.builders.XMLErrorReporter; import org.eclipse.uml2.uml.Profile; -import org.eclipse.uml2.uml.Stereotype; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -48,28 +54,44 @@ import org.w3c.dom.Node; @SuppressWarnings("restriction") public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { - private static final String NAME = "name"; - - private static final String PLATFORM_PLUGIN = "platform:/plugin/"; - - private static final String LOCATION = "location"; - - private static final String ORG_ECLIPSE_UML2_UML_GENERATED_PACKAGE = "org.eclipse.uml2.uml.generated_package";//$NON-NLS-1$ + /** Problem IDs for the markers generated by this error reporter. */ + public static final int NO_GENMODEL_MARKER_ID = 0xff1001; + public static final int PAPYRUS_PROFILE_EXTENSION_NO_NAME_MARKER_ID = 0xff1002; + public static final int MISSING_UML_EXTENSION_MARKER_ID = 0xff1003; + public static final int NO_URI_MARKER_ID = 0xff1004; + public static final int NO_ECORE_GEN_PACKAGE_MARKER_ID = 0xff1005; + public static final int NO_UML2_GEN_PACKAGE_MARKER_ID = 0xff1006; + public static final int NO_PAPYRUS_PROFILE_MARKER_ID = 0xff1007; + public static final int NO_UML2_GEN_PACKAGE_LOCATION_MARKER_ID = 0xff1008; + public static final int MISSING_FROM_BINARY_BUILD_MARKER_ID = 0xff1009; + + /** Attributes of markers created by this error reporter */ + public static final String STATIC_PROFILE_STEREOTYPE_URI = "staticProfileStereotypeUri"; //$NON-NLS-1$ + public static final String STATIC_PROFILE_MARKER_ATTRIBUTE = "staticProfile"; //$NON-NLS-1$ + public static final String STATIC_PROFILE_BINARY_BUILD_PATH = "binaryBuildPath"; //$NON-NLS-1$ + + private static final String NAME = "name"; //$NON-NLS-1$ + private static final String PATH = "path"; //$NON-NLS-1$ + private static final String LOCATION = "location"; //$NON-NLS-1$ + private static final String URI = "uri"; //$NON-NLS-1$ + private static final String GEN_MODEL_ATTRIBUTE = "genModel"; //$NON-NLS-1$ + private static final String PACKAGE = "package"; //$NON-NLS-1$ + private static final String ICONPATH = "iconpath"; //$NON-NLS-1$ + private static final String MAPPING = "mapping"; //$NON-NLS-1$ + private static final String GENMODEL_EXTENSION = "genmodel"; //$NON-NLS-1$ + private static final String PROFILE = "profile"; //$NON-NLS-1$ + private static final String TARGET = "target"; //$NON-NLS-1$ + private static final String SOURCE = "source"; //$NON-NLS-1$ + private static final String POINT = "point"; //$NON-NLS-1$ - private static final String ORG_ECLIPSE_EMF_ECORE_GENERATED_PACKAGE = "org.eclipse.emf.ecore.generated_package";//$NON-NLS-1$ - private static final String NS_URI = "nsURI"; //$NON-NLS-1$ - private static final String ECORE_EPACKAGE_STEREOTYPE = "Ecore::EPackage"; //$NON-NLS-1$ + private static final String PATHMAP = "pathmap://"; //$NON-NLS-1$ + private static final String PLATFORM_PLUGIN = "platform:/plugin/"; //$NON-NLS-1$ - private static final String PAPYRUS_UML_PROFILES_EXTENSION_POINT_FULL_ID = "org.eclipse.papyrus.uml.extensionpoints.UMLProfile"; //$NON-NLS-1$ private static final String STATIC_PROFILE_CATEGORY = "Papyrus-staticProfile";//$NON-NLS-1$ - public static final String STATIC_PROFILE_MARKER_ATTRIBUTE = "staticProfile"; //$NON-NLS-1$ - - private static final String POINT = "point"; //$NON-NLS-1$ + private static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$ + private static final String ID_SEPARATOR = "_"; //$NON-NLS-1$ - private static final int FIX_ID = 0; - - private static final String SEPARATOR = "_"; private final List<String> foundPoints = new ArrayList<>(); @@ -133,10 +155,10 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { */ private static String sourceID(IFile file, Profile profile) { StringBuilder builder = new StringBuilder(); - builder.append("staticprofile"); - builder.append(SEPARATOR); + builder.append("staticprofile"); //$NON-NLS-1$ + builder.append(ID_SEPARATOR); builder.append(file.getProjectRelativePath().toString()); - builder.append(SEPARATOR); + builder.append(ID_SEPARATOR); String name = profile.getQualifiedName(); builder.append(name); return builder.toString(); @@ -144,7 +166,7 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { @Override protected String getRootElementName() { - return "plugin"; + return "plugin"; //$NON-NLS-1$ } @Override @@ -154,13 +176,13 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { postValidatePapyrusExtensions(); // now check the found extensions and throw error for inexisting ones - if (!foundPoints.contains(ORG_ECLIPSE_EMF_ECORE_GENERATED_PACKAGE)) { + if (!foundPoints.contains(ProfilePluginValidationConstants.ECORE_GENERATED_PACKAGE_EXTENSION_POINT)) { reportNoEcoreGeneratedPackage(); } - if (!foundPoints.contains(ORG_ECLIPSE_UML2_UML_GENERATED_PACKAGE)) { + if (!foundPoints.contains(ProfilePluginValidationConstants.UML_GENERATED_PACKAGE_EXTENSION_POINT)) { reportNoUML2GeneratedPackage(); } - if (!foundPoints.contains(PAPYRUS_UML_PROFILES_EXTENSION_POINT_FULL_ID)) { + if (!foundPoints.contains(ProfilePluginValidationConstants.UMLPROFILE_EXTENSION_POINT)) { if (profile.getNestingPackage() == null) { reportNoPapyrusProfile(); } @@ -179,30 +201,58 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { for (Element papyrusProfileExtension : papyrusProfileExtensions) { String name = papyrusProfileExtension.getAttribute(NAME); - String path = decodePath(papyrusProfileExtension.getAttribute("path")); + String path = decodePath(papyrusProfileExtension.getAttribute(PATH)); // check path - if (profilePath.equals(path)) { - foundPoints.add(PAPYRUS_UML_PROFILES_EXTENSION_POINT_FULL_ID); - // UI name shall not be null - if (name == null || name.isEmpty()) { - VirtualMarker marker = report(NLS.bind(Messages.StaticProfilePluginErrorReporter_uiLabelIsNull, profile.getLabel()), getLine(papyrusProfileExtension, NAME), CompilerFlags.WARNING, FIX_ID, papyrusProfileExtension, NAME, - STATIC_PROFILE_CATEGORY); - addMarkerAttribute(marker, STATIC_PROFILE_MARKER_ATTRIBUTE, profile.getLabel()); + if (!profilePath.equals(path)) { + continue; + } + foundPoints.add(ProfilePluginValidationConstants.UMLPROFILE_EXTENSION_POINT); + // UI name shall not be null + if (name == null || name.isEmpty()) { + VirtualMarker marker = report(NLS.bind(Messages.StaticProfilePluginErrorReporter_uiLabelIsNull, profile.getLabel()), getLine(papyrusProfileExtension, NAME), CompilerFlags.ERROR, PAPYRUS_PROFILE_EXTENSION_NO_NAME_MARKER_ID, + papyrusProfileExtension, NAME, + STATIC_PROFILE_CATEGORY); + addMarkerAttribute(marker, STATIC_PROFILE_MARKER_ATTRIBUTE, profile.getLabel()); + } + + // make sure icon is in the binary build + String iconPath = papyrusProfileExtension.getAttribute(ICONPATH); + if (iconPath != null && !iconPath.isBlank()) { + IFile iconFile = profileFile.getProject().getFile(iconPath); + if (iconFile.exists() && !binaryBuildContains(iconFile.getProjectRelativePath())) { + VirtualMarker marker = addErrorMarker(papyrusProfileExtension, ICONPATH, NLS.bind(Messages.StaticProfilePluginErrorReporter_resourceMissingFromBinaryBuild, iconPath), MISSING_FROM_BINARY_BUILD_MARKER_ID); + marker.setAttribute(STATIC_PROFILE_BINARY_BUILD_PATH, iconPath); } } } } + private boolean binaryBuildContains(IPath path) { + final IBuildModel buildModel = ProjectManagementService.getPluginBuild(profileFile.getProject()); + final IBuild build = buildModel.getBuild(); + final IBuildEntry buildEntry = build.getEntry(IBuildEntry.BIN_INCLUDES); + final String[] tokens = buildEntry.getTokens(); + + if (path.segmentCount() > 1) { + String containingFolder = path.removeLastSegments(1).addTrailingSeparator().toString(); + boolean foundFolder = Arrays.stream(tokens).anyMatch(containingFolder::equals); + if (foundFolder) { + return true; + } + } + return Arrays.stream(tokens).anyMatch(path.toString()::equals); + } + /** * Reports that no ECore generated package was found for the current profile. */ private void reportNoEcoreGeneratedPackage() { - VirtualMarker marker = reportForProfile(NLS.bind(Messages.StaticProfilePluginErrorReporter_noEcoreGeneratedPackageFound, profile.getLabel()), 1, CompilerFlags.ERROR, STATIC_PROFILE_CATEGORY); + VirtualMarker marker = reportForProfile(NLS.bind(Messages.StaticProfilePluginErrorReporter_noEcoreGeneratedPackageFound, profile.getLabel()), 1, CompilerFlags.ERROR, NO_ECORE_GEN_PACKAGE_MARKER_ID, STATIC_PROFILE_CATEGORY); addMarkerAttribute(marker, STATIC_PROFILE_MARKER_ATTRIBUTE, profile.getLabel()); } - private VirtualMarker reportForProfile(String message, int line, int severity, String category) { - VirtualMarker marker = report(message, line, severity, category); + private VirtualMarker reportForProfile(String message, int line, int severity, int fixId, String category) { + VirtualMarker marker = report(message, line, severity, fixId, category); addMarkerID(marker); return marker; } @@ -218,7 +268,7 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { * Reports that no UML2 generated package was found for the current profile. */ private void reportNoUML2GeneratedPackage() { - VirtualMarker marker = reportForProfile(NLS.bind(Messages.StaticProfilePluginErrorReporter_noUML2GeneratedPackage, profile.getLabel()), 1, CompilerFlags.ERROR, STATIC_PROFILE_CATEGORY); + VirtualMarker marker = reportForProfile(NLS.bind(Messages.StaticProfilePluginErrorReporter_noUML2GeneratedPackage, profile.getLabel()), 1, CompilerFlags.ERROR, NO_UML2_GEN_PACKAGE_MARKER_ID, STATIC_PROFILE_CATEGORY); addMarkerAttribute(marker, STATIC_PROFILE_MARKER_ATTRIBUTE, profile.getLabel()); } @@ -226,7 +276,7 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { * Reports that no Papyrus profile extension was found for the current profile. */ private void reportNoPapyrusProfile() { - VirtualMarker marker = reportForProfile(NLS.bind(Messages.StaticProfilePluginErrorReporter_NoPapyrusProfileExtensionFound, profile.getLabel()), 1, CompilerFlags.WARNING, STATIC_PROFILE_CATEGORY); + VirtualMarker marker = reportForProfile(NLS.bind(Messages.StaticProfilePluginErrorReporter_NoPapyrusProfileExtensionFound, profile.getLabel()), 1, CompilerFlags.WARNING, NO_PAPYRUS_PROFILE_MARKER_ID, STATIC_PROFILE_CATEGORY); addMarkerAttribute(marker, STATIC_PROFILE_MARKER_ATTRIBUTE, profile.getLabel()); } @@ -236,27 +286,27 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { String pointID = element.getAttribute(POINT); // find the correct checker switch (pointID) { - case ORG_ECLIPSE_EMF_ECORE_GENERATED_PACKAGE: - if (foundPoints.contains(ORG_ECLIPSE_EMF_ECORE_GENERATED_PACKAGE)) { + case ProfilePluginValidationConstants.ECORE_GENERATED_PACKAGE_EXTENSION_POINT: + if (foundPoints.contains(ProfilePluginValidationConstants.ECORE_GENERATED_PACKAGE_EXTENSION_POINT)) { // already found the extension that should be checked, so avoid checking others. break; } // check if this is the correct profile to test checkEcoreGeneratedPackage(element); break; - case ORG_ECLIPSE_UML2_UML_GENERATED_PACKAGE: - if (foundPoints.contains(ORG_ECLIPSE_UML2_UML_GENERATED_PACKAGE)) { + case ProfilePluginValidationConstants.UML_GENERATED_PACKAGE_EXTENSION_POINT: + if (foundPoints.contains(ProfilePluginValidationConstants.UML_GENERATED_PACKAGE_EXTENSION_POINT)) { break; } checkUML2GeneratedPackage(element); break; - case PAPYRUS_UML_PROFILES_EXTENSION_POINT_FULL_ID: - if (foundPoints.contains(PAPYRUS_UML_PROFILES_EXTENSION_POINT_FULL_ID)) { + case ProfilePluginValidationConstants.UMLPROFILE_EXTENSION_POINT: + if (foundPoints.contains(ProfilePluginValidationConstants.UMLPROFILE_EXTENSION_POINT)) { break; } checkPapyrusProfile(element); break; - case "org.eclipse.emf.ecore.uri_mapping": + case ProfilePluginValidationConstants.ECORE_URI_MAPPING_EXTENSION_POINT: collectMapping(element); break; default: @@ -268,10 +318,10 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { private void collectMapping(Element element) { for (int i = 0; i < element.getChildNodes().getLength(); i++) { Node node = element.getChildNodes().item(i); - if (node instanceof Element && "mapping".equals(((Element) node).getNodeName())) {//$NON-NLS-1$ + if (node instanceof Element && MAPPING.equals(((Element) node).getNodeName())) { Element profileElement = (Element) node; - String sourceURI = profileElement.getAttribute("source");//$NON-NLS-1$ - String targetURI = profileElement.getAttribute("target");//$NON-NLS-1$ + String sourceURI = profileElement.getAttribute(SOURCE); + String targetURI = profileElement.getAttribute(TARGET); localURIMappings.put(sourceURI, targetURI); } } @@ -296,7 +346,7 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { for (int i = 0; i < element.getChildNodes().getLength(); i++) { Node node = element.getChildNodes().item(i); - if (node instanceof Element && "profile".equals(((Element) node).getNodeName())) {//$NON-NLS-1$ + if (node instanceof Element && PROFILE.equals(((Element) node).getNodeName())) { papyrusProfileExtensions.add((Element) node); } } @@ -313,25 +363,33 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { * uri="http://www.eclipse.org/papyrus/sysml/1.4/SysML/Activities"> * </profile> */ + String stereotypeNsURI = profileURI(profile); + if (stereotypeNsURI == null || stereotypeNsURI.isBlank()) { + // can't check this profile + return; + } for (int i = 0; i < element.getChildNodes().getLength(); i++) { Node node = element.getChildNodes().item(i); - if (node instanceof Element && "profile".equals(((Element) node).getNodeName())) { //$NON-NLS-1$ + if (node instanceof Element && PROFILE.equals(((Element) node).getNodeName())) { Element profileElement = (Element) node; - String extensionNsURI = profileElement.getAttribute("uri");//$NON-NLS-1$ + String extensionNsURI = profileElement.getAttribute(URI); + if (extensionNsURI == null || extensionNsURI.isBlank()) { + VirtualMarker marker = addErrorMarker(profileElement, URI, NLS.bind(Messages.StaticProfilePluginErrorReporter_missingExtensionPointAttribute, URI), NO_URI_MARKER_ID); + marker.setAttribute(STATIC_PROFILE_STEREOTYPE_URI, stereotypeNsURI); + } String extensionlocation = profileElement.getAttribute(LOCATION); - + if (extensionlocation == null || extensionlocation.isBlank()) { + addErrorMarker(profileElement, LOCATION, NLS.bind(Messages.StaticProfilePluginErrorReporter_missingExtensionPointAttribute, LOCATION), NO_UML2_GEN_PACKAGE_LOCATION_MARKER_ID); + } // check this is the good extension point => genmodel should match first - String stereotypeNsURI = profileURI(profile); if (Objects.equals(stereotypeNsURI, extensionNsURI)) { - foundPoints.add(ORG_ECLIPSE_UML2_UML_GENERATED_PACKAGE); + foundPoints.add(ProfilePluginValidationConstants.UML_GENERATED_PACKAGE_EXTENSION_POINT); final String profileId = ((XMIResource) profile.eResource()).getID(profile); String uml2ProfileFile = profileFile.getProjectRelativePath().removeFileExtension().addFileExtension(UmlModel.UML_FILE_EXTENSION).lastSegment(); if (!extensionlocation.endsWith(uml2ProfileFile + "#" + profileId)) { //$NON-NLS-1$ - VirtualMarker marker = reportForProfile(NLS.bind(Messages.StaticProfilePluginErrorReporter_wrongLocationForProfile, profile.getLabel()), getLine(profileElement, LOCATION), CompilerFlags.ERROR, FIX_ID, profileElement, LOCATION, - STATIC_PROFILE_CATEGORY); - addMarkerAttribute(marker, STATIC_PROFILE_MARKER_ATTRIBUTE, profile.getLabel()); + addErrorMarker(profileElement, LOCATION, NLS.bind(Messages.StaticProfilePluginErrorReporter_wrongLocationForProfile, profile.getLabel()), MISSING_UML_EXTENSION_MARKER_ID); } } } @@ -349,42 +407,68 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { private void checkEcoreGeneratedPackage(Element element) { for (int i = 0; i < element.getChildNodes().getLength(); i++) { Node node = element.getChildNodes().item(i); - if (node instanceof Element && "package".equals(((Element) node).getNodeName())) {//$NON-NLS-1$ + if (node instanceof Element && PACKAGE.equals(((Element) node).getNodeName())) { Element packageElement = (Element) node; - String extensionNsURI = packageElement.getAttribute("uri");//$NON-NLS-1$ - String extensionGenModel = packageElement.getAttribute("genModel");//$NON-NLS-1$ + String extensionGenModel = packageElement.getAttribute(GEN_MODEL_ATTRIBUTE); - // check this is the good extension point => genmodel should match first - if (extensionGenModel == null) { + // genmodel should be set + if (extensionGenModel == null || extensionGenModel.isBlank()) { + addErrorMarker(packageElement, GEN_MODEL_ATTRIBUTE, NLS.bind(Messages.StaticProfilePluginErrorReporter_missingExtensionPointAttribute, GEN_MODEL_ATTRIBUTE), NO_GENMODEL_MARKER_ID); return; } // retrieve profile file path and compare with given path in extension point IPath projectRelativePath = profileFile.getProjectRelativePath(); - String genModelFile = projectRelativePath.removeFileExtension().addFileExtension("genmodel").toString(); //$NON-NLS-1$ - // compare with genmodel + IPath genModelFilePath = projectRelativePath.removeFileExtension().addFileExtension(GENMODEL_EXTENSION); + String genModelFile = genModelFilePath.toString(); + // compare with profile genmodel if (!Objects.equals(genModelFile, extensionGenModel)) { - // this one did not match, return; + // different profile, return return; } - // compare URI with profile uri in stereotype ecore::epackage + boolean genModelEntryFound = binaryBuildContains(genModelFilePath); + if (!genModelEntryFound) { + VirtualMarker marker = addErrorMarker(packageElement, GEN_MODEL_ATTRIBUTE, NLS.bind(Messages.StaticProfilePluginErrorReporter_resourceMissingFromBinaryBuild, genModelFile), MISSING_FROM_BINARY_BUILD_MARKER_ID); + marker.setAttribute(STATIC_PROFILE_BINARY_BUILD_PATH, genModelFile); + } String stereotypeNsURI = profileURI(profile); + + // uri should be set + String extensionNsURI = packageElement.getAttribute(URI); + if (extensionNsURI == null || extensionNsURI.isBlank()) { + VirtualMarker marker = addErrorMarker(packageElement, URI, NLS.bind(Messages.StaticProfilePluginErrorReporter_missingExtensionPointAttribute, URI), NO_URI_MARKER_ID); + marker.setAttribute(STATIC_PROFILE_STEREOTYPE_URI, stereotypeNsURI); + return; + } + + // compare URI with profile uri in stereotype ecore::epackage if (Objects.equals(stereotypeNsURI, extensionNsURI)) { - foundPoints.add(ORG_ECLIPSE_EMF_ECORE_GENERATED_PACKAGE); + foundPoints.add(ProfilePluginValidationConstants.ECORE_GENERATED_PACKAGE_EXTENSION_POINT); } } } } - private static String profileURI(Profile profile) { - Stereotype ePackageSt = profile.getAppliedStereotype(ECORE_EPACKAGE_STEREOTYPE); - if (ePackageSt != null) { - Object value = profile.getValue(ePackageSt, NS_URI); - return (String) value; + private VirtualMarker addErrorMarker(Element element, String attribute, String message, int problemId) { + VirtualMarker marker = reportForProfile(message, + getLine(element, attribute), CompilerFlags.ERROR, problemId, element, attribute, STATIC_PROFILE_CATEGORY); + addMarkerAttribute(marker, STATIC_PROFILE_MARKER_ATTRIBUTE, profile.getLabel()); + return marker; + } + @Override + protected int getLine(Element element, String attName) { + // when multiple elements with the same name exist, + // an incorrect line is returned from the super call if the attribute does not exist in the element + if (element.hasAttribute(attName)) { + return super.getLine(element, attName); } - return null; + return getLine(element); + } + + private static String profileURI(Profile profile) { + return new StaticProfileUtil(profile).getDefinition().getNsURI(); } private String decodePath(String path) { @@ -392,7 +476,8 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { return null; } - if (path.startsWith("pathmap://")) { + // check pathmap, relative URI or platform based uri + if (path.startsWith(PATHMAP)) { // try to decode using uri mappers extensions return decodePathmapPath(path); } else if (path.startsWith(PLATFORM_PLUGIN)) { @@ -435,7 +520,7 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { private String cutPluginPath(String decodePath) { if (decodePath.startsWith(PLATFORM_PLUGIN)) { String cutPath = decodePath.substring(PLATFORM_PLUGIN.length()); - int index = cutPath.indexOf('/'); + int index = cutPath.indexOf(PATH_SEPARATOR); cutPath = cutPath.substring(index + 1); // remove initial '/' return cutPath; } @@ -444,8 +529,8 @@ public class StaticProfilePluginErrorReporter extends PluginBaseErrorReporter { private String replaceString(String path, String sourceURI, String targetURI) { String newPath = path.substring(sourceURI.length(), path.length()); - if (!targetURI.endsWith("/")) { - newPath = "/".concat(newPath); + if (!targetURI.endsWith(PATH_SEPARATOR)) { + newPath = PATH_SEPARATOR.concat(newPath); } newPath = targetURI.concat(newPath); return newPath; diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/messages/Messages.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/messages/Messages.java index 8e7f7931a0b..8f4011a1651 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/messages/Messages.java +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/messages/Messages.java @@ -21,13 +21,18 @@ import org.eclipse.osgi.util.NLS; */ public class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.papyrus.toolsmiths.validation.profile.internal.messages.messages"; //$NON-NLS-1$ + public static String ProfileExtensionsChecker_noExternsionsDeclared; + public static String ProfilePluginChecker_validateProfilePluginTask; + public static String StaticProfilePluginErrorReporter_missingExtensionPointAttribute; public static String StaticProfileExtensionsBuilder_nsURI_differs; public static String StaticProfileExtensionsBuilder_subTask_checkingFile; public static String StaticProfilePluginErrorReporter_noEcoreGeneratedPackageFound; public static String StaticProfilePluginErrorReporter_NoPapyrusProfileExtensionFound; public static String StaticProfilePluginErrorReporter_noUML2GeneratedPackage; + public static String StaticProfilePluginErrorReporter_resourceMissingFromBinaryBuild; public static String StaticProfilePluginErrorReporter_uiLabelIsNull; public static String StaticProfilePluginErrorReporter_wrongLocationForProfile; + public static String StaticProfilePluginErrorReporter_stereotypeMismatch; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/messages/messages.properties b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/messages/messages.properties index 8083ca69eda..9237d2f4a9c 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/messages/messages.properties +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/messages/messages.properties @@ -1,3 +1,5 @@ +ProfileExtensionsChecker_noExternsionsDeclared=No extensions are declared for this static profile +ProfilePluginChecker_validateProfilePluginTask=Validate Profile plug-in. StaticProfileExtensionsBuilder_nsURI_differs=NsURI in profile {0} and in extension point {1} differ StaticProfileExtensionsBuilder_subTask_checkingFile=checking file: {0} StaticProfilePluginErrorReporter_noEcoreGeneratedPackageFound=No Ecore generated Package found for profile {0} @@ -5,3 +7,6 @@ StaticProfilePluginErrorReporter_NoPapyrusProfileExtensionFound=No Papyrus exten StaticProfilePluginErrorReporter_noUML2GeneratedPackage=No UML2 generated Package found for {0} StaticProfilePluginErrorReporter_uiLabelIsNull=UI Label is null for the profile {0} StaticProfilePluginErrorReporter_wrongLocationForProfile=Wrong location for profile {0} +StaticProfilePluginErrorReporter_missingExtensionPointAttribute=Element is missing required attribute ''{0}'' +StaticProfilePluginErrorReporter_resourceMissingFromBinaryBuild=Resource ''{0}'' is missing from the binary build. +StaticProfilePluginErrorReporter_stereotypeMismatch=URI mismatch. URI ''{0}'' does not match the value from profile ''{1}'' |