Author: dazarov
Date: 2011-12-20 13:10:14 -0500 (Tue, 20 Dec 2011)
New Revision: 37464
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java
Log:
Add @SuppressWarnings quick fix
https://issues.jboss.org/browse/JBIDE-10187
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java 2011-12-20
17:31:33 UTC (rev 37463)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java 2011-12-20
18:10:14 UTC (rev 37464)
@@ -14,7 +14,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
@@ -49,6 +48,7 @@
import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.common.ui.CommonUIMessages;
import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.validation.WarningNameManager;
import org.osgi.service.prefs.BackingStoreException;
/**
@@ -71,7 +71,13 @@
public AddSuppressWarningsMarkerResolution(IFile file, IJavaElement element, String
preferenceKey){
this.file = file;
this.element = getAnnatatableElement(element);
- this.preferenceKey = getShortName(preferenceKey);;
+ String[] names = WarningNameManager.getInstance().getWarningNames(preferenceKey);
+ if(names != null && names.length > 0){
+ this.preferenceKey = names[0];
+ }else{
+ this.preferenceKey = null;
+ }
+
label = NLS.bind(CommonUIMessages.ADD_SUPPRESS_WARNINGS_TITLE, this.preferenceKey,
element.getElementName());
if(element instanceof IMethod){
label += "()";
@@ -96,7 +102,7 @@
@Override
public void run(IMarker marker) {
- if(element != null){
+ if(element != null && preferenceKey != null){
disablePreference();
try {
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);