Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2010-11-17 13:25:10 -0500
committerpfullbright2010-11-17 13:25:10 -0500
commitdb287299090f592c77820c09e3fa01c283f3ad7b (patch)
tree9d437502b16b75d78574f029931730555343d6f2
parent4fdc02979bc424c5e73bba1236a93fab2c38653b (diff)
downloadwebtools.dali-db287299090f592c77820c09e3fa01c283f3ad7b.tar.gz
webtools.dali-db287299090f592c77820c09e3fa01c283f3ad7b.tar.xz
webtools.dali-db287299090f592c77820c09e3fa01c283f3ad7b.zip
added validation hooks (so that devs can trigger project build/update in workbench)
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml44
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties11
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java23
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java8
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java44
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java70
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java18
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java124
10 files changed, 318 insertions, 32 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
index 0748348e98..458eeef0b6 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
@@ -17,8 +17,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)",
org.eclipse.jpt.utility;bundle-version="[1.6.0,2.0.0)",
org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
org.eclipse.jst.j2ee;bundle-version="[1.1.402,2.0.0)",
+ org.eclipse.jst.j2ee.core;bundle-version="[1.2.100,2.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)"
+ org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
+ org.eclipse.wst.validation;bundle-version="[1.2.200,2.0.0)"
Export-Package: org.eclipse.jpt.jaxb.core,
org.eclipse.jpt.jaxb.core.context,
org.eclipse.jpt.jaxb.core.internal;x-internal:=true,
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties
index 5720258092..1d673dda6d 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties
@@ -13,6 +13,8 @@ providerName = Eclipse Web Tools Platform
JAXB_PLATFORMS = JAXB Platforms
+JAXB_PROBLEM_MARKER = JAXB Problem
+
GENERIC_PLATFORM_GROUP_LABEL = Generic JAXB
GENERIC_2_2_PLATFORM_LABEL = Generic JAXB 2.2
GENERIC_2_1_PLATFORM_LABEL = Generic JAXB 2.1
@@ -20,3 +22,5 @@ GENERIC_2_1_PLATFORM_LABEL = Generic JAXB 2.1
JAXB_FACET_LABEL = JAXB
JAXB_FACET_DESCRIPTION = Adds support for data binding using the Java Architecture for XML Binding (JAXB).
JAXB_TEMPLATE_LABEL = JAXB Project
+
+JAXB_VALIDATOR = JAXB Validator
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
index c6858c3dc5..4b84e7723f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
@@ -22,6 +22,26 @@
<!-- ***** extensions ***** -->
+ <!-- =================================================================================== -->
+ <!-- Extension: JAXB Problem Marker -->
+ <!-- **** Do NOT qualify the marker id with org.eclipse.jpt.jaxb.core, see bug 252891 -->
+ <!-- =================================================================================== -->
+ <extension
+ point="org.eclipse.core.resources.markers"
+ id="jaxbProblemMarker"
+ name="%JAXB_PROBLEM_MARKER">
+
+ <persistent value="true"/>
+
+ <!-- Can't use text marker until we have specific models for each input type (XML, java)
+ <super type="org.eclipse.core.resources.textmarker"/>
+ -->
+
+ <super type="org.eclipse.wst.validation.problemmarker2"/>
+ <super type="org.eclipse.jdt.core.problem"/>
+ </extension>
+
+
<extension
point="org.eclipse.jpt.jaxb.core.jaxbPlatforms">
@@ -152,4 +172,28 @@
</extension>
+
+ <extension
+ point="org.eclipse.wst.validation.validatorV2"
+ id="jaxbValidator"
+ name="%JAXB_VALIDATOR">
+
+ <validator
+ class="org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidator"
+ markerId="org.eclipse.jpt.jaxb.core.jaxbProblemMarker">
+ <include>
+ <rules>
+ <facet id="jpt.jaxb"/>
+ </rules>
+ </include>
+ <include>
+ <rules>
+ <contentType id="org.eclipse.jdt.core.javaSource" exactMatch="false"/>
+ <contentType id="org.eclipse.jpt.core.content.javaPackageInfo" exactMatch="false"/>
+ </rules>
+ </include>
+ </validator>
+
+ </extension>
+
</plugin>
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties
new file mode 100644
index 0000000000..ee23219ec4
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties
@@ -0,0 +1,11 @@
+################################################################################
+# Copyright (c) 2010 Oracle. All rights reserved.
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0, which accompanies this distribution
+# and is available at http://www.eclipse.org/legal/epl-v10.html.
+#
+# Contributors:
+# Oracle - initial API and implementation
+################################################################################
+
+NO_JAXB_PROJECT=This project has the JAXB facet, but no JAXB content could be created. See the error log for more details.
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java
index fef5860eb7..bff5349067 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java
@@ -23,6 +23,8 @@ import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType;
import org.eclipse.jpt.utility.CommandExecutor;
import org.eclipse.jpt.utility.synchronizers.CallbackSynchronizer;
import org.eclipse.jpt.utility.synchronizers.Synchronizer;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
/**
* A JAXB project is associated with an Eclipse project (and its corresponding
@@ -298,17 +300,16 @@ public interface JaxbProject
// * Return an {@link IFile} that best represents the given runtime location
// */
// IFile getPlatformFile(IPath runtimePath);
-//
-//
-// // ********** validation **********
-//
-// /**
-// * Return JPA project's validation messages.
-// */
-// Iterator<IMessage> validationMessages(IReporter reporter);
-
-
-
+
+
+ // ********** validation **********
+
+ /**
+ * Return project's validation messages.
+ */
+ Iterable<IMessage> validationMessages(IReporter reporter);
+
+
// ********** modifying shared documents **********
/**
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java
index 6d4529d2e5..e51fc631b4 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java
@@ -62,6 +62,14 @@ public class JptJaxbCorePlugin
public static final String DEFAULT_JAXB_PLATFORM_2_2_PREF_KEY =
"defaultJaxbPlatform_" + JaxbFacet.VERSION_2_2.getVersionString(); //$NON-NLS-1$
+ /**
+ * The identifier for the JAXB validation marker
+ * (value <code>"org.eclipse.jpt.jaxb.core.jaxbProblemMarker"</code>).
+ */
+ public static final String VALIDATION_MARKER_ID = PLUGIN_ID + ".jaxbProblemMarker"; //$NON-NLS-1$
+
+
+
// **************** fields ************************************************
private volatile GenericJaxbProjectManager projectManager;
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java
index a59486c078..ff20203a9c 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jaxb.core.internal;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -51,11 +53,15 @@ import org.eclipse.jpt.utility.internal.ThreadLocalCommandExecutor;
import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.utility.internal.iterables.SnapshotCloneIterable;
import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.utility.internal.synchronizers.CallbackSynchronousSynchronizer;
import org.eclipse.jpt.utility.internal.synchronizers.SynchronousSynchronizer;
import org.eclipse.jpt.utility.synchronizers.CallbackSynchronizer;
import org.eclipse.jpt.utility.synchronizers.Synchronizer;
+import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
/**
* JAXB project. Holds all the JAXB stuff.
@@ -1023,22 +1029,21 @@ public abstract class AbstractJaxbProject
// ********** validation **********
-//
-// public Iterator<IMessage> validationMessages(IReporter reporter) {
-// List<IMessage> messages = new ArrayList<IMessage>();
-// this.validate(messages, reporter);
-// return messages.iterator();
-// }
-//
-// protected void validate(List<IMessage> messages, IReporter reporter) {
-// if (reporter.isCancelled()) {
-// throw new ValidationCancelledException();
-// }
-// validateLibraryProvider(messages);
-// validateConnection(messages);
-// this.rootContextNode.validate(messages, reporter);
-// }
-//
+
+ public Iterable<IMessage> validationMessages(IReporter reporter) {
+ List<IMessage> messages = new ArrayList<IMessage>();
+ this.validate(messages, reporter);
+ return new SnapshotCloneIterable<IMessage>(messages);
+ }
+
+ protected void validate(List<IMessage> messages, IReporter reporter) {
+ if (reporter.isCancelled()) {
+ throw new ValidationCancelledException();
+ }
+ //validateLibraryProvider(messages);
+ //this.rootContextNode.validate(messages, reporter);
+ }
+
// protected void validateLibraryProvider(List<IMessage> messages) {
// try {
// ILibraryProvider libraryProvider = LibraryProviderFramework.getCurrentProvider(getProject(), JpaFacet.FACET);
@@ -1047,9 +1052,9 @@ public abstract class AbstractJaxbProject
// if (! libraryProvider.isEnabledFor(
// facetedProject, facetVersion)) {
// messages.add(
-// DefaultJpaValidationMessages.buildMessage(
+// DefaultValidationMessages.buildMessage(
// IMessage.HIGH_SEVERITY,
-// JpaValidationMessages.PROJECT_INVALID_LIBRARY_PROVIDER,
+// JaxbValidationMessages.PROJECT_INVALID_LIBRARY_PROVIDER,
// this));
// }
// }
@@ -1058,8 +1063,7 @@ public abstract class AbstractJaxbProject
// JptCorePlugin.log(ce);
// }
// }
-
-
+
// ********** dispose **********
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java
new file mode 100644
index 0000000000..f0db845560
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.validation;
+
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
+import org.eclipse.wst.validation.internal.core.Message;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class DefaultValidationMessages {
+
+ private static String[] DEFAULT_PARMS = new String[0];
+ private static TextRange DEFAULT_TEXT_RANGE = TextRange.Empty.instance();
+
+ public static IMessage buildMessage(
+ int defaultSeverity, String messageId, Object targetObject) {
+ return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject);
+ }
+
+ public static IMessage buildMessage(
+ int defaultSeverity, String messageId, String[] parms, Object targetObject) {
+ return buildMessage(defaultSeverity, messageId, parms, targetObject, DEFAULT_TEXT_RANGE);
+ }
+
+ public static IMessage buildMessage(
+ int defaultSeverity, String messageId, Object targetObject, TextRange textRange) {
+ return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject, textRange);
+ }
+
+ public static IMessage buildMessage(
+ int defaultSeverity, String messageId, String[] parms, Object targetObject, TextRange textRange) {
+
+ //determine whether default severity should be overridden
+ int severity = defaultSeverity;
+
+ // TODO JAXB validation preferences
+// int severityPreference = JpaValidationPreferences.getProblemSeverityPreference(targetObject, messageId);
+// if (severityPreference!=JpaValidationPreferences.NO_SEVERITY_PREFERENCE){
+// severity = severityPreference;
+// }
+
+ IMessage message = new Message(JaxbValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject);
+ message.setMarkerId(JptJaxbCorePlugin.VALIDATION_MARKER_ID);
+ if (textRange == null) {
+ //log an exception and then continue without setting location information
+ //At least the user will still get the validation message and will
+ //be able to see other validation messages with valid textRanges
+ JptJaxbCorePlugin.log(new IllegalArgumentException("Null text range for message ID: " + messageId)); //$NON-NLS-1$
+ }
+ else {
+ message.setLineNo(textRange.getLineNumber());
+ message.setOffset(textRange.getOffset());
+ message.setLength(textRange.getLength());
+ }
+ return message;
+ }
+
+
+ private DefaultValidationMessages() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java
new file mode 100644
index 0000000000..fb8434da88
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.validation;
+
+@SuppressWarnings("nls")
+public interface JaxbValidationMessages {
+
+ public static final String BUNDLE_NAME = "jaxb_validation";
+
+ public static final String NO_JAXB_PROJECT = "NO_JAXB_PROJECT";
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java
new file mode 100644
index 0000000000..4b4a9faab7
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.validation;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jpt.core.IResourcePart;
+import org.eclipse.jpt.jaxb.core.JaxbProject;
+import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
+import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.wst.validation.AbstractValidator;
+import org.eclipse.wst.validation.ValidationResult;
+import org.eclipse.wst.validation.ValidationState;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IProjectValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+
+/**
+ * This class is referenced in the JAXB extension for the
+ * WTP validator extension point.
+ */
+public class JaxbValidator
+ extends AbstractValidator
+ implements IValidator {
+
+ public JaxbValidator() {
+ super();
+ }
+
+
+ // ********** IValidator implementation **********
+
+ public void validate(IValidationContext context, IReporter reporter) {
+ validate(reporter, project(context));
+ }
+
+ public void cleanup(IReporter reporter) {
+ // nothing to do
+ }
+
+
+ // **************** AbstractValidator impl *********************************
+
+ @Override
+ public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
+ if (resource.getType() != IResource.FILE)
+ return null;
+ ValidationResult result = new ValidationResult();
+ IReporter reporter = result.getReporter(monitor);
+ IProject project = resource.getProject();
+ this.clearMarkers(project);
+ result.setSuspendValidation(project);
+ this.validate(reporter, project);
+ return result;
+ }
+
+
+ // **************** internal conv. *****************************************
+ private void clearMarkers(IProject project) {
+ try {
+ clearMarkers_(project);
+ }
+ catch (CoreException ce) {
+ JptJaxbCorePlugin.log(ce);
+ }
+ }
+
+ private void clearMarkers_(IProject project) throws CoreException {
+ IMarker[] markers = project.findMarkers(JptJaxbCorePlugin.VALIDATION_MARKER_ID, true, IResource.DEPTH_INFINITE);
+ for (IMarker marker : markers) {
+ marker.delete();
+ }
+ }
+
+ private void validate(IReporter reporter, IProject project) {
+ for (IMessage message : this.getValidationMessages(reporter, project)) {
+ // check to see if the message should be ignored based on preferences
+ // TODO JAXB validation preferences
+// if (!JpaValidationPreferences.isProblemIgnored(project, message.getId())){
+ reporter.addMessage(this, adjustMessage(message));
+// }
+
+ }
+ }
+
+ private IProject project(IValidationContext context) {
+ return ((IProjectValidationContext) context).getProject();
+ }
+
+ private Iterable<IMessage> getValidationMessages(IReporter reporter, IProject project) {
+ JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(project);
+ if (jaxbProject != null) {
+ return jaxbProject.validationMessages(reporter);
+ }
+ return new SingleElementIterable<IMessage>(
+ DefaultValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JaxbValidationMessages.NO_JAXB_PROJECT,
+ project));
+ }
+
+ private IMessage adjustMessage(IMessage message) {
+ IAdaptable targetObject = (IAdaptable) message.getTargetObject();
+ IResource targetResource = ((IResourcePart) targetObject.getAdapter(IResourcePart.class)).getResource();
+ message.setTargetObject(targetResource);
+ if (message.getLineNumber() == IMessage.LINENO_UNSET) {
+ message.setAttribute(IMarker.LOCATION, " ");
+ }
+ return message;
+ }
+}

Back to the top