Author: dazarov
Date: 2012-01-27 12:30:19 -0500 (Fri, 27 Jan 2012)
New Revision: 38245
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java
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/MakeMethodBusinessMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java
Log:
Constructions like "flag & Flags.AccPublic == 0" changed to
Flags.isPublic(flag)
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java 2012-01-27
15:52:45 UTC (rev 38244)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java 2012-01-27
17:30:19 UTC (rev 38245)
@@ -73,17 +73,16 @@
// make method public
int position = method.getSourceRange().getOffset();
- if((flag & Flags.AccPublic) == 0){
- if((flag & Flags.AccPrivate) != 0){
+ if(!Flags.isPublic(flag)){
+ if(Flags.isPrivate(flag)){
position += text.indexOf(PRIVATE);
edit.addChild(new ReplaceEdit(position, PRIVATE.length(), PUBLIC));
- }else if((flag & Flags.AccProtected) != 0){
+ }else if(Flags.isProtected(flag)){
position += text.indexOf(PROTECTED);
edit.addChild(new ReplaceEdit(position, PROTECTED.length(), PUBLIC));
}else{
String type = Signature.getSignatureSimpleName(method.getReturnType());
position += text.indexOf(type);
- buffer.replace(position, 0, PUBLIC+SPACE);
edit.addChild(new InsertEdit(position, PUBLIC+SPACE));
}
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java 2012-01-27
15:52:45 UTC (rev 38244)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java 2012-01-27
17:30:19 UTC (rev 38245)
@@ -111,7 +111,7 @@
String text = buffer.getText(field.getSourceRange().getOffset(),
field.getSourceRange().getLength());
int position = field.getSourceRange().getOffset();
- if((flag & Flags.AccPublic) != 0){
+ if(Flags.isPublic(flag)){
position += text.indexOf(PUBLIC);
TextEdit re = new ReplaceEdit(position, PUBLIC.length(), PROTECTED);
edit.addChild(re);
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 2012-01-27
15:52:45 UTC (rev 38244)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java 2012-01-27
17:30:19 UTC (rev 38245)
@@ -64,15 +64,15 @@
String text = buffer.getText(field.getSourceRange().getOffset(),
field.getSourceRange().getLength());
int position = field.getSourceRange().getOffset();
- if((flag & Flags.AccPublic) != 0){
+ if(Flags.isPublic(flag)){
position +=
text.indexOf(CDIMarkerResolutionUtils.PUBLIC)+CDIMarkerResolutionUtils.PUBLIC.length();
InsertEdit ie = new InsertEdit(position,
CDIMarkerResolutionUtils.SPACE+CDIMarkerResolutionUtils.STATIC);
edit.addChild(ie);
- }else if((flag & Flags.AccPrivate) != 0){
+ }else if(Flags.isPrivate(flag)){
position +=
text.indexOf(CDIMarkerResolutionUtils.PRIVATE)+CDIMarkerResolutionUtils.PRIVATE.length();
InsertEdit ie = new InsertEdit(position,
CDIMarkerResolutionUtils.SPACE+CDIMarkerResolutionUtils.STATIC);
edit.addChild(ie);
- }else if((flag & Flags.AccProtected) != 0){
+ }else if(Flags.isProtected(flag)){
position +=
text.indexOf(CDIMarkerResolutionUtils.PROTECTED)+CDIMarkerResolutionUtils.PROTECTED.length();
InsertEdit ie = new InsertEdit(position,
CDIMarkerResolutionUtils.SPACE+CDIMarkerResolutionUtils.STATIC);
edit.addChild(ie);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java 2012-01-27
15:52:45 UTC (rev 38244)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java 2012-01-27
17:30:19 UTC (rev 38245)
@@ -76,20 +76,19 @@
// make method public
int position = method.getSourceRange().getOffset();
- if((flag & Flags.AccPublic) != 0){
- // do nothing
- }else if((flag & Flags.AccPrivate) != 0){
- position += text.indexOf(PRIVATE);
- buffer.replace(position, PRIVATE.length(), PUBLIC);
- }else if((flag & Flags.AccProtected) != 0){
- position += text.indexOf(PROTECTED);
- buffer.replace(position, PROTECTED.length(), PUBLIC);
- }else{
- String type = Signature.getSignatureSimpleName(method.getReturnType());
- position += text.indexOf(type);
- buffer.replace(position, 0, PUBLIC+SPACE);
+ if(!Flags.isPublic(flag)){
+ if(Flags.isPrivate(flag)){
+ position += text.indexOf(PRIVATE);
+ buffer.replace(position, PRIVATE.length(), PUBLIC);
+ }else if(Flags.isProtected(flag)){
+ position += text.indexOf(PROTECTED);
+ buffer.replace(position, PROTECTED.length(), PUBLIC);
+ }else{
+ String type = Signature.getSignatureSimpleName(method.getReturnType());
+ position += text.indexOf(type);
+ buffer.replace(position, 0, PUBLIC+SPACE);
+ }
}
-
compilationUnit.commitWorkingCopy(false, new NullProgressMonitor());
compilationUnit.discardWorkingCopy();
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java 2012-01-27
15:52:45 UTC (rev 38244)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java 2012-01-27
17:30:19 UTC (rev 38245)
@@ -69,12 +69,12 @@
// make method public
int position = workingCopyMethod.getSourceRange().getOffset();
- if((flag & Flags.AccPublic) == 0){
- if((flag & Flags.AccPrivate) != 0){
+ if(!Flags.isPublic(flag)){
+ if(Flags.isPrivate(flag)){
position += text.indexOf(CDIMarkerResolutionUtils.PRIVATE);
ReplaceEdit re = new ReplaceEdit(position,
CDIMarkerResolutionUtils.PRIVATE.length(), CDIMarkerResolutionUtils.PUBLIC);
edit.addChild(re);
- }else if((flag & Flags.AccProtected) != 0){
+ }else if(Flags.isProtected(flag)){
position += text.indexOf(CDIMarkerResolutionUtils.PROTECTED);
ReplaceEdit re = new ReplaceEdit(position,
CDIMarkerResolutionUtils.PROTECTED.length(), CDIMarkerResolutionUtils.PUBLIC);
edit.addChild(re);
Show replies by date