Author: dazarov
Date: 2011-12-22 14:34:52 -0500 (Thu, 22 Dec 2011)
New Revision: 37535
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java
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/messages.properties
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/CommonUIMessages.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java 2011-12-22
18:02:11 UTC (rev 37534)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java 2011-12-22
19:34:52 UTC (rev 37535)
@@ -79,6 +79,10 @@
public static String ADD_SUPPRESS_WARNINGS_MESSAGE;
public static String ADD_SUPPRESS_WARNINGS_QUESTION1;
public static String ADD_SUPPRESS_WARNINGS_QUESTION2;
+ public static String ADD_SUPPRESS_WARNINGS_CANCEL;
+ public static String ADD_SUPPRESS_WARNINGS_PROJECT;
+ public static String ADD_SUPPRESS_WARNINGS_WORKSPACE;
+ public static String ADD_SUPPRESS_WARNINGS_DISABLE;
static {
NLS.initializeMessages(BUNDLE_NAME, CommonUIMessages.class);
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-22
18:02:11 UTC (rev 37534)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java 2011-12-22
19:34:52 UTC (rev 37535)
@@ -29,6 +29,7 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.BodyDeclaration;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
import org.eclipse.jdt.internal.core.JavaElement;
@@ -171,7 +172,7 @@
CommonUIMessages.ADD_SUPPRESS_WARNINGS_MESSAGE+
CommonUIMessages.ADD_SUPPRESS_WARNINGS_QUESTION1,
MessageDialog.QUESTION_WITH_CANCEL,
- new String[]{"Cancel", "Disable"},
+ new String[]{CommonUIMessages.ADD_SUPPRESS_WARNINGS_CANCEL,
CommonUIMessages.ADD_SUPPRESS_WARNINGS_DISABLE},
0);
int result = dialog.open();
if(result == 1){
@@ -188,7 +189,7 @@
CommonUIMessages.ADD_SUPPRESS_WARNINGS_MESSAGE+
NLS.bind(CommonUIMessages.ADD_SUPPRESS_WARNINGS_QUESTION2,
file.getProject().getName()),
MessageDialog.QUESTION_WITH_CANCEL,
- new String[]{"Cancel", "Workspace", "Project"},
+ new String[]{CommonUIMessages.ADD_SUPPRESS_WARNINGS_CANCEL,
CommonUIMessages.ADD_SUPPRESS_WARNINGS_WORKSPACE,
CommonUIMessages.ADD_SUPPRESS_WARNINGS_PROJECT},
0);
int result = dialog.open();
if(result == 1){
@@ -298,6 +299,14 @@
if(node != null){
position = node.getStartPosition();
+ if(node instanceof BodyDeclaration && ((BodyDeclaration)node).getJavadoc() !=
null){
+ position += ((BodyDeclaration)node).getJavadoc().getLength();
+ char c = buffer.getChar(position);
+ while((c == '\r' || c == '\n') && position <
buffer.getLength()-2 ){
+ position++;
+ c = buffer.getChar(position);
+ }
+ }
}
String str = AT+name;
@@ -314,7 +323,7 @@
index--;
}
index++;
- if(index != position){
+ if(index < position){
String spaces = buffer.getText(index, position-index);
str += spaces;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties 2011-12-22
18:02:11 UTC (rev 37534)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties 2011-12-22
19:34:52 UTC (rev 37535)
@@ -37,4 +37,8 @@
ADD_SUPPRESS_WARNINGS_TITLE=Add @SuppressWarnings ''{0}'' to
''{1}''
ADD_SUPPRESS_WARNINGS_MESSAGE=This quick fix uses warning names that are not supported by
The Java Validator and will cause \"Unsupported @SuppressWarning\" problem
message.\n\n
ADD_SUPPRESS_WARNINGS_QUESTION1=Do you want to disable 'Unsupported
@SuppressWarnings' validation?
-ADD_SUPPRESS_WARNINGS_QUESTION2=Do you want to disable 'Unsupported
@SuppressWarnings' validation on the Workspace or on the project
''{0}''?
\ No newline at end of file
+ADD_SUPPRESS_WARNINGS_QUESTION2=Do you want to disable 'Unsupported
@SuppressWarnings' validation on the Workspace or on the project
''{0}''?
+ADD_SUPPRESS_WARNINGS_CANCEL=Cancel
+ADD_SUPPRESS_WARNINGS_PROJECT=Project
+ADD_SUPPRESS_WARNINGS_WORKSPACE=Workspace
+ADD_SUPPRESS_WARNINGS_DISABLE=Disable
\ No newline at end of file