[jbosstools-commits] JBoss Tools SVN: r44020 - in trunk: cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker and 11 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Sep 25 21:05:23 EDT 2012


Author: dazarov
Date: 2012-09-25 21:05:22 -0400 (Tue, 25 Sep 2012)
New Revision: 44020

Added:
   trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IPreferenceInfo.java
   trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/PreferenceInfoManager.java
Modified:
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
   trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java
   trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
   trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java
   trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/FacesConfigValidator.java
   trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java
   trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
   trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/WebXMLCoreValidator.java
   trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
   trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
   trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java
   trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
   trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsCoreValidator.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
Log:
Configure Problem Severity should open project settings if they are enabled for the project https://issues.jboss.org/browse/JBIDE-12538

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -109,11 +109,13 @@
 import org.jboss.tools.common.validation.ContextValidationHelper;
 import org.jboss.tools.common.validation.EditorValidationContext;
 import org.jboss.tools.common.validation.IJavaElementValidator;
+import org.jboss.tools.common.validation.IPreferenceInfo;
 import org.jboss.tools.common.validation.IProjectValidationContext;
 import org.jboss.tools.common.validation.IStringValidator;
 import org.jboss.tools.common.validation.ITypedReporter;
 import org.jboss.tools.common.validation.IValidatingProjectSet;
 import org.jboss.tools.common.validation.IValidatingProjectTree;
+import org.jboss.tools.common.validation.PreferenceInfoManager;
 import org.jboss.tools.common.validation.ValidationUtil;
 import org.jboss.tools.common.validation.ValidatorManager;
 import org.jboss.tools.jst.web.kb.internal.validation.KBValidator;
@@ -125,6 +127,8 @@
 	public static final String ID = "org.jboss.tools.cdi.core.CoreValidator"; //$NON-NLS-1$
 	public static final String PROBLEM_TYPE = "org.jboss.tools.cdi.core.cdiproblem"; //$NON-NLS-1$
 	public static final String PREFERENCE_PAGE_ID = "org.jboss.tools.cdi.ui.preferences.CDIValidatorPreferencePage"; //$NON-NLS-1$
+	public static final String PROPERTY_PAGE_ID = "org.jboss.tools.cdi.ui.propertyPages.CDIValidatorPreferencePage"; //$NON-NLS-1$
+	
 
 	ICDIProject rootCdiProject;
 	Map<IProject, CDIValidationContext> cdiContexts = new HashMap<IProject, CDIValidationContext>();
@@ -2729,4 +2733,30 @@
 	protected boolean shouldCleanAllAnnotations() {
 		return true;
 	}
+
+	@Override
+	protected void registerPreferenceInfo() {
+		if(PreferenceInfoManager.getPreferenceInfo(PROBLEM_TYPE) == null){
+			PreferenceInfoManager.register(PROBLEM_TYPE, new CDIPreferenceInfo());
+		}
+	}
+	
+	class CDIPreferenceInfo implements IPreferenceInfo{
+
+		@Override
+		public String getPreferencePageId() {
+			return PREFERENCE_PAGE_ID;
+		}
+
+		@Override
+		public String getPropertyPageId() {
+			return PROPERTY_PAGE_ID;
+		}
+
+		@Override
+		public String getPluginId() {
+			return CDICorePlugin.PLUGIN_ID;
+		}
+		
+	}
 }
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -1078,7 +1078,7 @@
 				CDIUIPlugin.getDefault().logError(e);
 			}
 		}
-		return null;
+		return new IJavaCompletionProposal[]{};
 	}
 	
 	

Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -12,18 +12,23 @@
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.internal.ui.JavaPlugin;
 import org.eclipse.jdt.internal.ui.JavaPluginImages;
 import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
 import org.eclipse.jface.preference.IPreferenceNode;
 import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.PreferenceDialog;
 import org.eclipse.jface.preference.PreferenceManager;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.contentassist.IContextInformation;
@@ -34,8 +39,10 @@
 import org.eclipse.ui.dialogs.PreferencesUtil;
 import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceNode;
 import org.eclipse.ui.progress.UIJob;
+import org.jboss.tools.common.preferences.SeverityPreferences;
 import org.jboss.tools.common.quickfix.IBaseMarkerResolution;
 import org.jboss.tools.common.ui.CommonUIMessages;
+import org.jboss.tools.common.ui.marker.AddSuppressWarningsMarkerResolution.SP;
 import org.jboss.tools.common.ui.preferences.SeverityPreferencePage;
 
 /**
@@ -46,13 +53,20 @@
 	private static final int PREFERENCE_SIZE = 40;
 	private static final String DOTS = "...";
 	
+	private IProject project;
 	private String preferencePageId;
+	private String propertyPageId;
 	private String preferenceKey;
+	private String pluginId;
 	private String label;
+	private SP preferences = new SP();
 	
-	public ConfigureProblemSeverityMarkerResolution(String preferencePageId, String preferenceKey){
+	public ConfigureProblemSeverityMarkerResolution(IProject project, String preferencePageId, String propertyPageId, String preferenceKey, String pluginId){
+		this.project = project;
 		this.preferencePageId = preferencePageId;
+		this.propertyPageId = propertyPageId;
 		this.preferenceKey = preferenceKey;
+		this.pluginId = pluginId;
 		String preferenceName = getPreferenceLabel();
 		label = NLS.bind(CommonUIMessages.CONFIGURE_PROBLEM_SEVERITY, preferenceName);
 	}
@@ -64,11 +78,25 @@
 	public void run(IMarker marker) {
 		UIJob job = new UIJob(""){ //$NON-NLS-1$
 			public IStatus runInUIThread(IProgressMonitor monitor) {
-				PreferencesUtil.createPreferenceDialogOn(DebugUIPlugin.getShell(),
+				IEclipsePreferences projectPreferences = preferences.getProjectPreferences(project);
+				String projectValue = null;
+				if(projectPreferences != null){
+					projectValue = projectPreferences.get(preferenceKey, null);
+				}
+				if(projectValue != null){
+					PreferencesUtil.createPropertyDialogOn(DebugUIPlugin.getShell(),
+							project,
+							ConfigureProblemSeverityMarkerResolution.this.propertyPageId,
+							new String[]{ConfigureProblemSeverityMarkerResolution.this.preferencePageId},
+							ConfigureProblemSeverityMarkerResolution.this.preferenceKey).open();
+				}else{
+					PreferencesUtil.createPreferenceDialogOn(DebugUIPlugin.getShell(),
 						ConfigureProblemSeverityMarkerResolution.this.preferencePageId,
 						new String[]{ConfigureProblemSeverityMarkerResolution.this.preferencePageId},
 						ConfigureProblemSeverityMarkerResolution.this.preferenceKey).open();
+				}
 				return Status.OK_STATUS;
+				
 			}
 		};
 		job.setSystem(true);
@@ -165,4 +193,23 @@
 	public int getRelevance() {
 		return 0;
 	}
+	
+	class SP extends SeverityPreferences{
+
+		@Override
+		protected Set<String> getSeverityOptionNames() {
+			return null;
+		}
+
+		@Override
+		protected String createSeverityOption(String shortName) {
+			return null;
+		}
+
+		@Override
+		protected String getPluginId() {
+			return pluginId;
+		}
+		
+	}
 }

Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -29,7 +29,10 @@
 import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
 import org.jboss.tools.common.EclipseUtil;
 import org.jboss.tools.common.quickfix.IQuickFixGenerator;
+import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
 import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.validation.IPreferenceInfo;
+import org.jboss.tools.common.validation.PreferenceInfoManager;
 import org.jboss.tools.common.validation.ValidationErrorManager;
 import org.jboss.tools.common.validation.java.TempJavaProblemAnnotation;
 
@@ -49,22 +52,28 @@
 				IFile file = (IFile)marker.getResource();
 				if(file != null){
 					String preferenceKey = getPreferenceKey(marker);
-					String preferencePageId = getPreferencePageId(marker);
-					if(preferenceKey != null && preferencePageId != null){
-						int severity = marker.getAttribute(IMarker.SEVERITY, 0);
-						if(severity == IMarker.SEVERITY_WARNING){
-							IJavaElement element = findJavaElement(file, position);
-							if(element != null){
-								if(element instanceof IMethod){
-									ILocalVariable parameter = findParameter((IMethod)element, position);
-									if(parameter != null){
+					String markerType = getProblemType(marker);
+					IPreferenceInfo info = PreferenceInfoManager.getPreferenceInfo(markerType);
+					if(info != null){
+						String propertyPageId = info.getPropertyPageId();
+						String preferencePageId = info.getPreferencePageId();
+						String pluginId = info.getPluginId();
+						if(preferenceKey != null && preferencePageId != null && propertyPageId != null && pluginId != null){
+							int severity = marker.getAttribute(IMarker.SEVERITY, 0);
+							if(severity == IMarker.SEVERITY_WARNING){
+								IJavaElement element = findJavaElement(file, position);
+								if(element != null){
+									if(element instanceof IMethod){
+										ILocalVariable parameter = findParameter((IMethod)element, position);
+										if(parameter != null){
 										resolutions.add(new AddSuppressWarningsMarkerResolution(file, parameter, preferenceKey));
+										}
 									}
+									resolutions.add(new AddSuppressWarningsMarkerResolution(file, element, preferenceKey));
 								}
-								resolutions.add(new AddSuppressWarningsMarkerResolution(file, element, preferenceKey));
 							}
+							resolutions.add(new ConfigureProblemSeverityMarkerResolution(file.getProject(), preferencePageId, propertyPageId, preferenceKey, pluginId));
 						}
-						resolutions.add(new ConfigureProblemSeverityMarkerResolution(preferencePageId, preferenceKey));
 					}
 				}
 			}
@@ -109,12 +118,7 @@
 	
 	@Override
 	public boolean hasResolutions(IMarker marker) {
-		try {
-			return getPreferenceKey(marker) != null && getPreferencePageId(marker) != null;
-		} catch (CoreException ex) {
-			CommonUIPlugin.getDefault().logError(ex);
-		}
-		return false;
+		return true;
 	}
 	
 	private String getPreferenceKey(IMarker marker)throws CoreException{
@@ -122,6 +126,14 @@
 		return attribute; 
 	}
 
+	private String getProblemType(IMarker marker)throws CoreException{
+		return marker.getType();
+	}
+	
+	private String getProblemType(Annotation annotation){
+		return annotation.getType();
+	}
+
 	private String getPreferencePageId(IMarker marker)throws CoreException{
 		String attribute = marker.getAttribute(ValidationErrorManager.PREFERENCE_PAGE_ID_NAME, null);
 		return attribute; 
@@ -159,53 +171,50 @@
 
 	@Override
 	public boolean hasProposals(Annotation annotation, Position position) {
-		return getPreferenceKey(annotation) != null && getPreferencePageId(annotation) != null;
+		return true;
 	}
 
 	@Override
 	public IJavaCompletionProposal[] getProposals(Annotation annotation, Position position) {
 		ArrayList<IJavaCompletionProposal> proposals = new ArrayList<IJavaCompletionProposal>();
 		String preferenceKey = getPreferenceKey(annotation);
-		String preferencePageId = getPreferencePageId(annotation);
-		if(preferenceKey != null && preferencePageId != null){
-			if(annotation instanceof TempJavaProblemAnnotation){
-				TempJavaProblemAnnotation tAnnotation = (TempJavaProblemAnnotation)annotation;
-				if(JavaMarkerAnnotation.WARNING_ANNOTATION_TYPE.equals(tAnnotation.getType())){
-					int offset = position.getOffset();
-					IFile file = getFile(tAnnotation);
-					if(file != null){
-						IJavaElement element = findJavaElement(tAnnotation, offset);
-						if(element != null){
-							if(element instanceof IMethod){
-								try{
-									ILocalVariable parameter = findParameter((IMethod)element, offset);
-									if(parameter != null){
-										proposals.add(new AddSuppressWarningsMarkerResolution(file, parameter, preferenceKey, tAnnotation.getCompilationUnit()));
+		String problemType = getProblemType(annotation);
+		IPreferenceInfo info = PreferenceInfoManager.getPreferenceInfo(problemType);
+		if(info != null){
+			String preferencePageId = info.getPreferencePageId();
+			String propertyPageId = info.getPropertyPageId();
+			String pluginId = info.getPluginId();
+			if(preferenceKey != null && preferencePageId != null && propertyPageId != null && pluginId != null){
+				IFile file = MarkerResolutionUtils.getFile();
+				if(annotation instanceof TempJavaProblemAnnotation){
+					TempJavaProblemAnnotation tAnnotation = (TempJavaProblemAnnotation)annotation;
+					
+					if(JavaMarkerAnnotation.WARNING_ANNOTATION_TYPE.equals(tAnnotation.getType())){
+						int offset = position.getOffset();
+						
+						if(file != null){
+							IJavaElement element = findJavaElement(tAnnotation, offset);
+							if(element != null){
+								if(element instanceof IMethod){
+									try{
+										ILocalVariable parameter = findParameter((IMethod)element, offset);
+										if(parameter != null){
+											proposals.add(new AddSuppressWarningsMarkerResolution(file, parameter, preferenceKey, tAnnotation.getCompilationUnit()));
+										}
+									}catch(JavaModelException ex){
+										CommonUIPlugin.getDefault().logError(ex);
 									}
-								}catch(JavaModelException ex){
-									CommonUIPlugin.getDefault().logError(ex);
 								}
+								proposals.add(new AddSuppressWarningsMarkerResolution(file, element, preferenceKey, tAnnotation.getCompilationUnit()));
 							}
-							proposals.add(new AddSuppressWarningsMarkerResolution(file, element, preferenceKey, tAnnotation.getCompilationUnit()));
 						}
 					}
 				}
+				proposals.add(new ConfigureProblemSeverityMarkerResolution(file.getProject(), preferencePageId, propertyPageId, preferenceKey, pluginId));
 			}
-			proposals.add(new ConfigureProblemSeverityMarkerResolution(preferencePageId, preferenceKey));
 		}
 		return proposals.toArray(new IJavaCompletionProposal[]{});
 	}
 	
 	
-	private IFile getFile(TempJavaProblemAnnotation annotation){
-		if(annotation.getCompilationUnit() != null){
-			try {
-				return (IFile)annotation.getCompilationUnit().getUnderlyingResource();
-			} catch (JavaModelException e) {
-				CommonUIPlugin.getDefault().logError(e);
-			}
-		}
-		return null;
-	}
-
 }

Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IPreferenceInfo.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IPreferenceInfo.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IPreferenceInfo.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ *     Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.validation;
+
+/**
+ * Preference info for quick fixes
+ * @author Daniel Azarov
+ */
+public interface IPreferenceInfo {
+	/**
+	 * Return id of preference page
+	 */
+	public String getPreferencePageId();
+	
+	/**
+	 * Return id of property page
+	 */
+	public String getPropertyPageId();
+	
+	/**
+	 * Return id of plugin
+	 */
+	public String getPluginId();
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IPreferenceInfo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/PreferenceInfoManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/PreferenceInfoManager.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/PreferenceInfoManager.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ *     Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.validation;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Preference Info Manager store info from validators and returns it to Quick fixes 
+ * @author Daniel Azarov
+ */
+public class PreferenceInfoManager {
+	private static Map<String, IPreferenceInfo> infos = Collections.synchronizedMap(new HashMap<String, IPreferenceInfo>());
+	
+	/*
+	 * register IPreferenceInfo for problemType
+	 * this method is designed to be called from validator
+	 */
+	public static void register(String problemType, IPreferenceInfo info){
+		if(!infos.containsKey(problemType)){
+			infos.put(problemType, info);
+		}
+	}
+	
+	/*
+	 * returns IPreferenceInfo for problemType
+	 */
+	public static IPreferenceInfo getPreferenceInfo(String problemType){
+		return infos.get(problemType);
+	}
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/PreferenceInfoManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -70,6 +70,7 @@
 	 * Constructor
 	 */
 	public ValidationErrorManager() {
+		registerPreferenceInfo();
 	}
 
 //	/**
@@ -610,4 +611,12 @@
 //		reporter.removeAllMessages(validationManager, resource);
 		WorkbenchReporter.removeAllMessages(resource, new String[]{getMarkerOwner().getName()}, null);
 	}
+	
+	/*
+	 * register IPreferenceInfo in PreferenceInfoManager
+	 * validator is supposed to have own implementation of IPreferenceInfo
+	 * and register it in PreferenceInfoManager
+	 * see CDICoreValidator.registerPreferenceInfo() as an example
+	 */
+	protected abstract void registerPreferenceInfo();
 }
\ No newline at end of file

Modified: trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -105,4 +105,10 @@
 	protected String getPreferencePageId() {
 		return null;
 	}
+
+	@Override
+	protected void registerPreferenceInfo() {
+		// TODO Auto-generated method stub
+		
+	}
 }
\ No newline at end of file

Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/FacesConfigValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/FacesConfigValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/FacesConfigValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -42,10 +42,12 @@
 import org.jboss.tools.common.model.impl.XModelImpl;
 import org.jboss.tools.common.model.util.EclipseResourceUtil;
 import org.jboss.tools.common.validation.ContextValidationHelper;
+import org.jboss.tools.common.validation.IPreferenceInfo;
 import org.jboss.tools.common.validation.IProjectValidationContext;
 import org.jboss.tools.common.validation.IValidatingProjectSet;
 import org.jboss.tools.common.validation.IValidatingProjectTree;
 import org.jboss.tools.common.validation.IValidator;
+import org.jboss.tools.common.validation.PreferenceInfoManager;
 import org.jboss.tools.common.validation.ValidationErrorManager;
 import org.jboss.tools.common.validation.ValidatorManager;
 import org.jboss.tools.common.validation.internal.ProjectValidationContext;
@@ -74,6 +76,8 @@
 	public static final String ID = "org.jboss.tools.esb.validator.ESBCoreValidator"; //$NON-NLS-1$
 	public static final String PROBLEM_TYPE = "org.jboss.tools.jsf.facesconfigproblem"; //$NON-NLS-1$
 	public static final String PREFERENCE_PAGE_ID = CompositeComponentValidator.PREFERENCE_PAGE_ID;
+	public static final String PROPERTY_PAGE_ID = CompositeComponentValidator.PROPERTY_PAGE_ID;
+	
 
 	public static String SHORT_ID = "jsf-verification"; //$NON-NLS-1$
 
@@ -432,6 +436,32 @@
 		return files;
 	}
 
+	@Override
+	protected void registerPreferenceInfo() {
+		if(PreferenceInfoManager.getPreferenceInfo(PROBLEM_TYPE) == null){
+			PreferenceInfoManager.register(PROBLEM_TYPE, new JSFPreferenceInfo());
+		}
+	}
+	
+	class JSFPreferenceInfo implements IPreferenceInfo{
+
+		@Override
+		public String getPreferencePageId() {
+			return PREFERENCE_PAGE_ID;
+		}
+
+		@Override
+		public String getPropertyPageId() {
+			return PROPERTY_PAGE_ID;
+		}
+
+		@Override
+		public String getPluginId() {
+			return JSFModelPlugin.PLUGIN_ID;
+		}
+		
+	}
+
 }
 
 class JSFCheckFromViewId extends JSFCheckToViewId {

Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -34,8 +34,10 @@
 import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
 import org.jboss.tools.common.el.core.resolver.ELContext;
 import org.jboss.tools.common.validation.ContextValidationHelper;
+import org.jboss.tools.common.validation.IPreferenceInfo;
 import org.jboss.tools.common.validation.IProjectValidationContext;
 import org.jboss.tools.common.validation.IValidatingProjectTree;
+import org.jboss.tools.common.validation.PreferenceInfoManager;
 import org.jboss.tools.common.validation.ValidatorManager;
 import org.jboss.tools.jsf.JSFModelPlugin;
 import org.jboss.tools.jsf.project.JSFNature;
@@ -67,7 +69,7 @@
 	public static final String PROBLEM_TYPE = "org.jboss.tools.jsf.compositeproblem"; //$NON-NLS-1$
 	public static final String SHORT_ID = "jboss.jsf.core"; //$NON-NLS-1$
 	public static final String PREFERENCE_PAGE_ID = "org.jboss.tools.jsf.ui.preferences.JSFValidationPreferencePage"; //$NON-NLS-1$
-
+	public static final String PROPERTY_PAGE_ID = "org.jboss.tools.jsf.ui.propertyPages.JSFValidationPreferencePage"; //$NON-NLS-1$
 	private static final String COMPOSITE_COMPONENT_URI_PREFIX = "http://java.sun.com/jsf/composite/"; //$NON-NLS-1$
 	
 	public static final String MESSAGE_ID_ATTRIBUTE_NAME = "JSF2_message_id"; //$NON-NLS-1$
@@ -397,4 +399,30 @@
 		// TODO
 		return null;
 	}
+
+	@Override
+	protected void registerPreferenceInfo() {
+		if(PreferenceInfoManager.getPreferenceInfo(PROBLEM_TYPE) == null){
+			PreferenceInfoManager.register(PROBLEM_TYPE, new CompositeComponentPreferenceInfo());
+		}
+	}
+	
+	class CompositeComponentPreferenceInfo implements IPreferenceInfo{
+
+		@Override
+		public String getPreferencePageId() {
+			return PREFERENCE_PAGE_ID;
+		}
+
+		@Override
+		public String getPropertyPageId() {
+			return PROPERTY_PAGE_ID;
+		}
+
+		@Override
+		public String getPluginId() {
+			return JSFModelPlugin.PLUGIN_ID;
+		}
+		
+	}
 }
\ No newline at end of file

Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/WebXMLCoreValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/WebXMLCoreValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/WebXMLCoreValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -32,10 +32,12 @@
 import org.jboss.tools.common.model.XModelObject;
 import org.jboss.tools.common.model.util.EclipseResourceUtil;
 import org.jboss.tools.common.validation.ContextValidationHelper;
+import org.jboss.tools.common.validation.IPreferenceInfo;
 import org.jboss.tools.common.validation.IProjectValidationContext;
 import org.jboss.tools.common.validation.IValidatingProjectSet;
 import org.jboss.tools.common.validation.IValidatingProjectTree;
 import org.jboss.tools.common.validation.IValidator;
+import org.jboss.tools.common.validation.PreferenceInfoManager;
 import org.jboss.tools.common.validation.ValidationErrorManager;
 import org.jboss.tools.common.validation.ValidatorManager;
 import org.jboss.tools.common.validation.internal.ProjectValidationContext;
@@ -52,6 +54,7 @@
 	public static final String ID = "org.jboss.tools.esb.validator.ESBCoreValidator"; //$NON-NLS-1$
 	public static final String PROBLEM_TYPE = "org.jboss.tools.jst.web.webxmlproblem"; //$NON-NLS-1$
 	public static final String PREFERENCE_PAGE_ID = "org.jboss.tools.jst.web.ui.WebXMLValidatorPreferencePage"; //$NON-NLS-1$
+	public static final String PROPERTY_PAGE_ID = "org.jboss.tools.jst.web.ui.propertyPages.WebXMLValidatorPreferencePage"; //$NON-NLS-1$
 
 	public static String SHORT_ID = "verification"; //$NON-NLS-1$
 
@@ -290,4 +293,30 @@
 		return PREFERENCE_PAGE_ID;
 	}
 
+	@Override
+	protected void registerPreferenceInfo() {
+		if(PreferenceInfoManager.getPreferenceInfo(PROBLEM_TYPE) == null){
+			PreferenceInfoManager.register(PROBLEM_TYPE, new WebXMLPreferenceInfo());
+		}
+	}
+	
+	class WebXMLPreferenceInfo implements IPreferenceInfo{
+
+		@Override
+		public String getPreferencePageId() {
+			return PREFERENCE_PAGE_ID;
+		}
+
+		@Override
+		public String getPropertyPageId() {
+			return PROPERTY_PAGE_ID;
+		}
+
+		@Override
+		public String getPluginId() {
+			return WebModelPlugin.PLUGIN_ID;
+		}
+		
+	}
+
 }

Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -64,10 +64,12 @@
 import org.jboss.tools.common.validation.ContextValidationHelper;
 import org.jboss.tools.common.validation.EditorValidationContext;
 import org.jboss.tools.common.validation.IELValidationDelegate;
+import org.jboss.tools.common.validation.IPreferenceInfo;
 import org.jboss.tools.common.validation.IProjectValidationContext;
 import org.jboss.tools.common.validation.IStringValidator;
 import org.jboss.tools.common.validation.ITypedReporter;
 import org.jboss.tools.common.validation.IValidatingProjectTree;
+import org.jboss.tools.common.validation.PreferenceInfoManager;
 import org.jboss.tools.common.validation.ValidatorManager;
 import org.jboss.tools.jst.web.kb.PageContextFactory;
 import org.jboss.tools.jst.web.kb.WebKbPlugin;
@@ -83,6 +85,8 @@
 	public static final String ID = "org.jboss.tools.jst.web.kb.ELValidator"; //$NON-NLS-1$
 	public static final String PROBLEM_TYPE = "org.jboss.tools.jst.web.kb.elproblem"; //$NON-NLS-1$
 	public static final String PREFERENCE_PAGE_ID = "org.jboss.tools.jst.web.ui.preferences.ELValidatorPreferencePage"; //$NON-NLS-1$
+	public static final String PROPERTY_PAGE_ID = "org.jboss.tools.jst.web.ui.properties.ELValidatorPreferencePage"; //$NON-NLS-1$
+	
 
 	private static final String EXTENSION_POINT_ID = "org.jboss.tools.jst.web.kb.elValidationDelegate"; //$NON-NLS-1$
 
@@ -676,4 +680,30 @@
 	protected String getMessageBundleName() {
 		return BUNDLE_NAME;
 	}
+
+	@Override
+	protected void registerPreferenceInfo() {
+		if(PreferenceInfoManager.getPreferenceInfo(PROBLEM_TYPE) == null){
+			PreferenceInfoManager.register(PROBLEM_TYPE, new ELPreferenceInfo());
+		}
+	}
+	
+	class ELPreferenceInfo implements IPreferenceInfo{
+
+		@Override
+		public String getPreferencePageId() {
+			return PREFERENCE_PAGE_ID;
+		}
+
+		@Override
+		public String getPropertyPageId() {
+			return PROPERTY_PAGE_ID;
+		}
+
+		@Override
+		public String getPluginId() {
+			return WebKbPlugin.PLUGIN_ID;
+		}
+		
+	}
 }
\ No newline at end of file

Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -40,10 +40,12 @@
 import org.jboss.tools.common.model.util.EclipseResourceUtil;
 import org.jboss.tools.common.text.ITextSourceReference;
 import org.jboss.tools.common.validation.ContextValidationHelper;
+import org.jboss.tools.common.validation.IPreferenceInfo;
 import org.jboss.tools.common.validation.IProjectValidationContext;
 import org.jboss.tools.common.validation.IValidatingProjectSet;
 import org.jboss.tools.common.validation.IValidatingProjectTree;
 import org.jboss.tools.common.validation.IValidator;
+import org.jboss.tools.common.validation.PreferenceInfoManager;
 import org.jboss.tools.common.validation.ValidationUtil;
 import org.jboss.tools.common.validation.ValidatorManager;
 import org.jboss.tools.common.validation.internal.SimpleValidatingProjectTree;
@@ -1114,4 +1116,30 @@
 		return marker;
 	}
 
+	@Override
+	protected void registerPreferenceInfo() {
+		if(PreferenceInfoManager.getPreferenceInfo(PROBLEM_TYPE) == null){
+			PreferenceInfoManager.register(PROBLEM_TYPE, new SeamPreferenceInfo());
+		}
+	}
+	
+	class SeamPreferenceInfo implements IPreferenceInfo{
+
+		@Override
+		public String getPreferencePageId() {
+			return PREFERENCE_PAGE_ID;
+		}
+
+		@Override
+		public String getPropertyPageId() {
+			return PROPERTY_PAGE_ID;
+		}
+
+		@Override
+		public String getPluginId() {
+			return SeamCorePlugin.PLUGIN_ID;
+		}
+		
+	}
+
 }

Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -118,6 +118,12 @@
 				public String getMarkerType() {
 					return ValidationErrorManager.DEFAULT_VALIDATION_MARKER;
 				}
+
+				@Override
+				protected void registerPreferenceInfo() {
+					// TODO Auto-generated method stub
+					
+				}
 			};
 			errorManager.init(project, null, null, this, reporter);
 

Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -21,6 +21,8 @@
 
 	public static final String MARKED_SEAM_PROJECT_MESSAGE_GROUP = "markedSeamProject"; //$NON-NLS-1$
 	public static final String PREFERENCE_PAGE_ID = "org.jboss.tools.seam.ui.preferences.SeamValidatorPreferencePage"; //$NON-NLS-1$
+	public static final String PROPERTY_PAGE_ID = "org.jboss.tools.seam.ui.propertyPages.SeamValidatorPreferencePage"; //$NON-NLS-1$
+	
 
 	/* (non-Javadoc)
 	 * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getPreference(org.eclipse.core.resources.IProject, java.lang.String)

Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -95,6 +95,12 @@
 			public String getMarkerType() {
 				return ValidationErrorManager.DEFAULT_VALIDATION_MARKER;
 			}
+
+			@Override
+			protected void registerPreferenceInfo() {
+				// TODO Auto-generated method stub
+				
+			}
 		};
 		//errorManager.init(project, null, this, reporter);
 

Modified: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsCoreValidator.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsCoreValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsCoreValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -29,10 +29,12 @@
 import org.jboss.tools.common.model.XModelObject;
 import org.jboss.tools.common.model.util.EclipseResourceUtil;
 import org.jboss.tools.common.validation.ContextValidationHelper;
+import org.jboss.tools.common.validation.IPreferenceInfo;
 import org.jboss.tools.common.validation.IProjectValidationContext;
 import org.jboss.tools.common.validation.IValidatingProjectSet;
 import org.jboss.tools.common.validation.IValidatingProjectTree;
 import org.jboss.tools.common.validation.IValidator;
+import org.jboss.tools.common.validation.PreferenceInfoManager;
 import org.jboss.tools.common.validation.ValidationErrorManager;
 import org.jboss.tools.common.validation.ValidatorManager;
 import org.jboss.tools.common.validation.internal.ProjectValidationContext;
@@ -53,6 +55,7 @@
 	public static final String ID = "org.jboss.tools.struts.validation.StrutsCoreValidator"; //$NON-NLS-1$
 	public static final String PROBLEM_TYPE = "org.jboss.tools.struts.strutsproblem"; //$NON-NLS-1$
 	public static final String PREFERENCE_PAGE_ID = "org.jboss.tools.struts.ui.StrutsValidatorPreferencePage"; //$NON-NLS-1$
+	public static final String PROPERTY_PAGE_ID = "org.jboss.tools.struts.ui.propertyPages.StrutsValidatorPreferencePage"; //$NON-NLS-1$
 
 	public static String SHORT_ID = "verification"; //$NON-NLS-1$
 
@@ -275,4 +278,27 @@
 		return PREFERENCE_PAGE_ID;
 	}
 
+	@Override
+	protected void registerPreferenceInfo() {
+		if(PreferenceInfoManager.getPreferenceInfo(PROBLEM_TYPE) == null){
+			PreferenceInfoManager.register(PROBLEM_TYPE, new StrutsPreferenceInfo());
+		}
+	}
+	
+	class StrutsPreferenceInfo implements IPreferenceInfo{
+
+		public String getPreferencePageId() {
+			return PREFERENCE_PAGE_ID;
+		}
+
+		public String getPropertyPageId() {
+			return PROPERTY_PAGE_ID;
+		}
+
+		public String getPluginId() {
+			return StrutsModelPlugin.PLUGIN_ID;
+		}
+		
+	}
+
 }

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java	2012-09-25 20:39:44 UTC (rev 44019)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java	2012-09-26 01:05:22 UTC (rev 44020)
@@ -295,4 +295,10 @@
 		return new SimpleValidatingProjectTree(project);
 	}
 
+	@Override
+	protected void registerPreferenceInfo() {
+		// TODO Auto-generated method stub
+		
+	}
+
 }



More information about the jbosstools-commits mailing list