Author: dazarov
Date: 2010-12-06 11:01:31 -0500 (Mon, 06 Dec 2010)
New Revision: 27193
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java
Log:
https://jira.jboss.org/browse/JBIDE-7674
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java 2010-12-06
16:00:50 UTC (rev 27192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java 2010-12-06
16:01:31 UTC (rev 27193)
@@ -20,6 +20,7 @@
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.Signature;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.ui.CDIUIMessages;
@@ -33,7 +34,8 @@
private static final String PUBLIC = "public"; //$NON-NLS-1$
private static final String PRIVATE = "private"; //$NON-NLS-1$
private static final String PROTECTED = "protected"; //$NON-NLS-1$
- private static final String STATIC = " static"; //$NON-NLS-1$
+ private static final String STATIC = "static"; //$NON-NLS-1$
+ private static final String SPACE = " "; //$NON-NLS-1$
private String label;
private IField field;
@@ -63,13 +65,17 @@
int position = field.getSourceRange().getOffset();
if((flag & Flags.AccPublic) != 0){
position += text.indexOf(PUBLIC)+PUBLIC.length();
- buffer.replace(position, 0, STATIC);
+ buffer.replace(position, 0, SPACE+STATIC);
}else if((flag & Flags.AccPrivate) != 0){
position += text.indexOf(PRIVATE)+PRIVATE.length();
- buffer.replace(position, 0, STATIC);
+ buffer.replace(position, 0, SPACE+STATIC);
}else if((flag & Flags.AccProtected) != 0){
position += text.indexOf(PROTECTED)+PROTECTED.length();
- buffer.replace(position, 0, STATIC);
+ buffer.replace(position, 0, SPACE+STATIC);
+ }else{
+ String type = Signature.getSignatureSimpleName(field.getTypeSignature());
+ position += text.indexOf(type);
+ buffer.replace(position, 0, STATIC+SPACE);
}
compilationUnit.commitWorkingCopy(false, new NullProgressMonitor());