null
if the attribute does not exist. */
public static String getProfileName(IMarker marker) {
- return marker.getAttribute(StaticProfilePluginErrorReporter.STATIC_PROFILE_MARKER_ATTRIBUTE, null);
+ return marker.getAttribute(ProfilePluginValidationConstants.STATIC_PROFILE_MARKER_ATTRIBUTE, 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
index afddf316cf5..1ee7db28852 100644
--- 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
@@ -16,7 +16,7 @@
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;
+import org.eclipse.papyrus.toolsmiths.validation.profile.constants.ProfilePluginValidationConstants;
/**
* Resolution for markers created for missing genModel attributes in the extension point.
@@ -41,6 +41,6 @@ public class MissingUriAttributeMarkerResolution
@Override
protected String getAttributeValue() {
- return getMarker().getAttribute(StaticProfilePluginErrorReporter.STATIC_PROFILE_STEREOTYPE_URI, ""); //$NON-NLS-1$
+ return getMarker().getAttribute(ProfilePluginValidationConstants.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
index 655ee8e7669..06d88e1cb29 100644
--- 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
@@ -18,6 +18,7 @@ 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.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.papyrus.infra.emf.utils.ResourceUtils;
import org.eclipse.papyrus.toolsmiths.plugin.builder.Activator;
@@ -75,7 +76,8 @@ public class NoEcoreGenPackageMarkerResolution extends AbstractPapyrusMarkerReso
extension.add(packageElement);
IFile genModel = MarkerResolutionUtils.getGenModelFile(marker);
if (genModel != null) {
- packageElement.setAttribute("genModel", ResourceUtils.mapAndEncodePath(genModel)); //$NON-NLS-1$
+ IPath relativePath = genModel.getProjectRelativePath();
+ packageElement.setAttribute("genModel", ResourceUtils.getStringURI(relativePath)); //$NON-NLS-1$
}
String uri = MarkerResolutionUtils.getStereotypeUri(marker);
if (uri != null) {
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
index e62d2ba72b4..0b815aa4450 100644
--- 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
@@ -18,7 +18,7 @@ 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;
+import org.eclipse.papyrus.toolsmiths.validation.common.checkers.BuildPropertiesChecker;
/**
* Resolution that adds the missing file to the binary build.
@@ -39,7 +39,7 @@ public class ResourceMissingFromBinaryBuildMarkerResolution extends AbstractPapy
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.addToBuild(marker.getAttribute(BuildPropertiesChecker.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
index 3c2980e4afe..6271fc9df62 100644
--- 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
@@ -16,7 +16,7 @@
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.papyrus.toolsmiths.validation.profile.constants.ProfilePluginValidationConstants;
import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
@@ -33,21 +33,21 @@ public class StaticProfileMarkerResolutionGenerator implements IMarkerResolution
public IMarkerResolution[] getResolutions(IMarker marker) {
int problemId = marker.getAttribute(PDEMarkerFactory.PROBLEM_ID, PDEMarkerFactory.NO_RESOLUTION);
switch (problemId) {
- case StaticProfilePluginErrorReporter.NO_GENMODEL_MARKER_ID:
+ case ProfilePluginValidationConstants.NO_GENMODEL_MARKER_ID:
return new IMarkerResolution[] { new MissingGenModelAttributeMarkerResolution() };
- case StaticProfilePluginErrorReporter.NO_URI_MARKER_ID:
+ case ProfilePluginValidationConstants.NO_URI_MARKER_ID:
return new IMarkerResolution[] { new MissingUriAttributeMarkerResolution() };
- case StaticProfilePluginErrorReporter.NO_ECORE_GEN_PACKAGE_MARKER_ID:
+ case ProfilePluginValidationConstants.NO_ECORE_GEN_PACKAGE_MARKER_ID:
return new IMarkerResolution[] { new NoEcoreGenPackageMarkerResolution() };
- case StaticProfilePluginErrorReporter.NO_UML2_GEN_PACKAGE_MARKER_ID:
+ case ProfilePluginValidationConstants.NO_UML2_GEN_PACKAGE_MARKER_ID:
return new IMarkerResolution[] { new NoUMLGenPackageMarkerResolution() };
- case StaticProfilePluginErrorReporter.NO_UML2_GEN_PACKAGE_LOCATION_MARKER_ID:
+ case ProfilePluginValidationConstants.NO_UML2_GEN_PACKAGE_LOCATION_MARKER_ID:
return new IMarkerResolution[] { new NoLocationUMLGenPackageMarkerResolution() };
- case StaticProfilePluginErrorReporter.PAPYRUS_PROFILE_EXTENSION_NO_NAME_MARKER_ID:
+ case ProfilePluginValidationConstants.PAPYRUS_PROFILE_EXTENSION_NO_NAME_MARKER_ID:
return new IMarkerResolution[] { new PapyrusProfileExtensionMissingNameMarkerResolution() };
- case StaticProfilePluginErrorReporter.NO_PAPYRUS_PROFILE_MARKER_ID:
+ case ProfilePluginValidationConstants.NO_PAPYRUS_PROFILE_MARKER_ID:
return new IMarkerResolution[] { new NoPapyrusProfileExtensionMarkerResolution() };
- case StaticProfilePluginErrorReporter.MISSING_FROM_BINARY_BUILD_MARKER_ID:
+ case ProfilePluginValidationConstants.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.architecture/src/org/eclipse/papyrus/toolsmiths/validation/architecture/internal/checkers/ArchitecturePluginChecker.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.architecture/src/org/eclipse/papyrus/toolsmiths/validation/architecture/internal/checkers/ArchitecturePluginChecker.java
index e2f6ef483cc..2a059ee2146 100644
--- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.architecture/src/org/eclipse/papyrus/toolsmiths/validation/architecture/internal/checkers/ArchitecturePluginChecker.java
+++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.architecture/src/org/eclipse/papyrus/toolsmiths/validation/architecture/internal/checkers/ArchitecturePluginChecker.java
@@ -192,7 +192,7 @@ public class ArchitecturePluginChecker {
ArchitecturePluginXMLValidator validator = new ArchitecturePluginXMLValidator(modelFile);
return new PluginErrorReporter<>(pluginXML, modelFile, model, ARCHITECTURE_PLUGIN_VALIDATION_MARKER_TYPE, domain -> domain.getId())
- .requireExtensionPoint(ARCHITECTURE_EXTENSION_POINT_IDENTIFIER, validator::matchExtension, null);
+ .requireExtensionPoint(ARCHITECTURE_EXTENSION_POINT_IDENTIFIER, validator::matchExtension, null, null);
}
/**
diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/META-INF/MANIFEST.MF b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/META-INF/MANIFEST.MF
index 2c4d6ab21a0..4169f780bc1 100644
--- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/META-INF/MANIFEST.MF
+++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/META-INF/MANIFEST.MF
@@ -10,10 +10,11 @@ Require-Bundle: org.eclipse.emf.transaction;bundle-version="[1.9.0,2.0.0)",
org.eclipse.papyrus.infra.architecture;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.core.architecture;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.core;bundle-version="[4.0.0,5.0.0)",
- org.eclipse.papyrus.infra.tools;bundle-version="[4.0.0,5.0.0)"
+ org.eclipse.papyrus.infra.tools;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.emf;bundle-version="[2.0.0,3.0.0)"
Export-Package: org.eclipse.papyrus.toolsmiths.validation.common,
org.eclipse.papyrus.toolsmiths.validation.common.checkers,
- org.eclipse.papyrus.toolsmiths.validation.common.internal.utils;x-friends:="org.eclipse.papyrus.toolsmiths.validation.elementtypes,org.eclipse.papyrus.toolsmiths.validation.architecture",
+ org.eclipse.papyrus.toolsmiths.validation.common.internal.utils;x-friends:="org.eclipse.papyrus.toolsmiths.validation.elementtypes,org.eclipse.papyrus.toolsmiths.validation.architecture,org.eclipse.papyrus.toolsmiths.validation.profile",
org.eclipse.papyrus.toolsmiths.validation.common.utils
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/checkers/BuildPropertiesChecker.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/checkers/BuildPropertiesChecker.java
index 37ac76f652e..f301882125b 100644
--- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/checkers/BuildPropertiesChecker.java
+++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/checkers/BuildPropertiesChecker.java
@@ -75,6 +75,8 @@ public class BuildPropertiesChecker extends AbstractPluginChecker {
private static final String GENMODEL_EXTENSION = "genmodel"; //$NON-NLS-1$
private static final String ECORE_EXTENSION = "ecore"; //$NON-NLS-1$
+ public static final int MISSING_FROM_BINARY_BUILD_MARKER_ID = 0xff1009;
+ public static final String BINARY_BUILD_PATH = "binaryBuildPath"; //$NON-NLS-1$
private final Resource modelResource;
@@ -226,7 +228,7 @@ public class BuildPropertiesChecker extends AbstractPluginChecker {
// Create marker for every required resource that wasn't matched
List+ * Text nodes were also added in the index, and not only elements as expected by the missing attribute marker resolution) + *
+ * + * @see org.eclipse.pde.internal.core.builders.XMLErrorReporter#report(java.lang.String, int, int, int, org.w3c.dom.Element, java.lang.String, java.lang.String) + */ + @Override + public VirtualMarker report(String message, int line, int severity, int fixId, Element element, String attrName, + String category) { + VirtualMarker marker = report(message, line, severity, fixId, category); + if (marker == null) { + return null; + } + marker.setAttribute(PDEMarkerFactory.MPK_LOCATION_PATH, generateLocationPath(element, attrName)); + return marker; + } + + private String generateLocationPath(Node node, String attrName) { + if (node == null) { + return ""; // //$NON-NLS-1$ + } + + int childIndex = 0; + for (Node previousSibling = node.getPreviousSibling(); previousSibling != null; previousSibling = previousSibling.getPreviousSibling()) { + if ((previousSibling instanceof Element)) { + // filter text + childIndex += 1; + } + } + + StringBuilder sb = new StringBuilder(); + Node parent = node.getParentNode(); + if (parent != null && !(parent instanceof Document)) { + sb.append(generateLocationPath(parent, null)); + sb.append(F_CHILD_SEP); + } + composeNodeString(node, childIndex, attrName, sb); + return sb.toString(); + } + + private String composeNodeString(Node node, int index, String attrName, StringBuilder sb) { + sb.append('('); + sb.append(index); + sb.append(')'); + sb.append(node.getNodeName()); + if (attrName != null) { + sb.append(F_ATT_PREFIX); + sb.append(attrName); + } + return sb.toString(); + } + protected VirtualMarker reportProblem(String message, int line, int severity, String category) { VirtualMarker marker = report(message, line, severity, category); addMarkerID(marker); @@ -334,6 +413,8 @@ public class PluginErrorReporter- * Overrides marker deletion to delete only some selected markers by id) - *
- */ -@SuppressWarnings("restriction") -public class SelectiveDeleteErrorReporter extends IncrementalErrorReporter { - - public static final String SOURCE_ID = "source_id"; //$NON-NLS-1$ - private final IResource fResource; - private final Collection