JBoss Tools SVN: r38154 - in trunk/documentation/guides/GettingStartedGuide/en-US: images/getting_started and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2012-01-24 22:07:16 -0500 (Tue, 24 Jan 2012)
New Revision: 38154
Added:
trunk/documentation/guides/GettingStartedGuide/en-US/images/getting_started/jboss_perspective_01.png
trunk/documentation/guides/GettingStartedGuide/en-US/images/getting_started/jboss_perspective_02.png
trunk/documentation/guides/GettingStartedGuide/en-US/images/getting_started/jboss_perspective_03.png
Modified:
trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml
trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml
Log:
updated with information concerning the jboss perspective
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml 2012-01-25 01:36:03 UTC (rev 38153)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml 2012-01-25 03:07:16 UTC (rev 38154)
@@ -8,7 +8,7 @@
<productname>JBoss Developer Studio</productname>
<productnumber>5.0</productnumber>
<edition>5.0.0</edition>
-<pubsnumber>4</pubsnumber>
+<pubsnumber>5</pubsnumber>
<abstract>
<para>The Getting Started Guide explains the JBoss Developer Studio.</para>
</abstract>
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml 2012-01-25 01:36:03 UTC (rev 38153)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml 2012-01-25 03:07:16 UTC (rev 38154)
@@ -281,6 +281,23 @@
</mediaobject>
</figure>
</section>
+ <section id="JBoss_Perspective">
+ <title>JBoss Perspective</title>
+ <para>
+ The JBoss perspective is designed to incorporate the views most often used by developers using JBoss, while also changing standard menu items to reflect what a JBoss devleoper would want and need.
+ </para>
+ <figure>
+ <title>JBoss Perspective</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/getting_started/jboss_perspective_01.png" scale="90"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The JBoss perspective views include: <guilabel>Project Explorer</guilabel>, <guilabel>JBoss Central</guilabel>, <guilabel>Outline</guilabel>, <guilabel>Palette</guilabel>, <guilabel>Properties</guilabes> and <guilabel>Servers</guilabel>.
+ </para>
+ </section>
<section id="Support">
<?dbhtml filename="Support.html"?>
<title>Support</title>
Added: trunk/documentation/guides/GettingStartedGuide/en-US/images/getting_started/jboss_perspective_01.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/guides/GettingStartedGuide/en-US/images/getting_started/jboss_perspective_01.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/guides/GettingStartedGuide/en-US/images/getting_started/jboss_perspective_02.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/guides/GettingStartedGuide/en-US/images/getting_started/jboss_perspective_02.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/guides/GettingStartedGuide/en-US/images/getting_started/jboss_perspective_03.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/guides/GettingStartedGuide/en-US/images/getting_started/jboss_perspective_03.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
12 years, 11 months
JBoss Tools SVN: r38153 - trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-01-24 20:36:03 -0500 (Tue, 24 Jan 2012)
New Revision: 38153
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator.qfxresult
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator3.qfxresult
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator.qfxresult
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator3.qfxresult
Log:
Add the code which is supposed to be inserted by the Quick Fix into its description https://issues.jboss.org/browse/JBIDE-10636
Deleted: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator.qfxresult
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator.qfxresult 2012-01-25 01:20:38 UTC (rev 38152)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator.qfxresult 2012-01-25 01:36:03 UTC (rev 38153)
@@ -1,10 +0,0 @@
-package org.jboss.jsr299.tck.tests.jbt.quickfixes;
-
-import javax.decorator.Decorator;
-@Decorator
-public class TestDecorator {
-
- public void method(String parameter){
-
- }
-}
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator.qfxresult
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator.qfxresult (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator.qfxresult 2012-01-25 01:36:03 UTC (rev 38153)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.decorator.Decorator;
+
+
+@Decorator
+public class TestDecorator {
+
+ public void method(String parameter){
+
+ }
+}
Deleted: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator3.qfxresult
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator3.qfxresult 2012-01-25 01:20:38 UTC (rev 38152)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator3.qfxresult 2012-01-25 01:36:03 UTC (rev 38153)
@@ -1,14 +0,0 @@
-package org.jboss.jsr299.tck.tests.jbt.quickfixes;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-@Decorator
-public class TestDecorator3 {
- @Inject @Delegate @AAnnotation String str;
-
-
- public String produce(){
- return str;
- }
-}
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator3.qfxresult
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator3.qfxresult (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TestDecorator3.qfxresult 2012-01-25 01:36:03 UTC (rev 38153)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+
+@Decorator
+public class TestDecorator3 {
+ @Inject @Delegate @AAnnotation String str;
+
+
+ public String produce(){
+ return str;
+ }
+}
12 years, 11 months
JBoss Tools SVN: r38152 - in trunk: common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-01-24 20:20:38 -0500 (Tue, 24 Jan 2012)
New Revision: 38152
Added:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/BaseMarkerResolution.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddAnnotationMarkerResolution.java
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/AddNameMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddRetentionAnnotationMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddTargetAnnotationMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/ChangeAnnotationMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAnnotationMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.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/MakeMethodPublicMarkerResolution.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/MarkerResolutionUtils.java
Log:
Add the code which is supposed to be inserted by the Quick Fix into its description https://issues.jboss.org/browse/JBIDE-10636
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddAnnotationMarkerResolution.java 2012-01-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddAnnotationMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
@@ -21,24 +18,18 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.internal.core.refactoring.CDIMarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
-public class AddAnnotationMarkerResolution implements
- IMarkerResolution2 {
+public class AddAnnotationMarkerResolution extends BaseMarkerResolution {
private IJavaElement element;
private String qualifiedName;
- private String label;
- private String description;
public AddAnnotationMarkerResolution(IJavaElement element, String qualifiedName){
this.element = element;
@@ -67,70 +58,31 @@
}
label = NLS.bind(CDIUIMessages.ADD_ANNOTATION_MARKER_RESOLUTION_TITLE, new String[]{shortName, element.getElementName(), type});
- description = getPreview();
+ init();
}
@Override
- public String getLabel() {
- return label;
+ protected ICompilationUnit getCompilationUnit(){
+ return CDIMarkerResolutionUtils.getJavaMember(element).getCompilationUnit();
}
-
- @Override
- public void run(IMarker marker) {
- try{
- ICompilationUnit original = CDIMarkerResolutionUtils.getJavaMember(element).getCompilationUnit();
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
- private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ @Override
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
MultiTextEdit edit = new MultiTextEdit();
change.setEdit(edit);
- CDIMarkerResolutionUtils.addAnnotation(qualifiedName, compilationUnit, element, "", edit);
+ try {
+ CDIMarkerResolutionUtils.addAnnotation(qualifiedName, compilationUnit, element, "", edit);
+ } catch (JavaModelException e) {
+ CDIUIPlugin.getDefault().logError(e);
+ }
return change;
}
- private CompilationUnitChange getPreviewChange(){
- try{
- ICompilationUnit original = CDIMarkerResolutionUtils.getJavaMember(element).getCompilationUnit();
-
- return getChange(original);
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- return null;
- }
-
- private String getPreview(){
- TextChange previewChange = getPreviewChange();
-
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
- }
- return label;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
@Override
public Image getImage() {
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-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -13,9 +13,6 @@
import java.text.MessageFormat;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -23,31 +20,27 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.InsertEdit;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
/**
* @author Daniel Azarov
*/
-public class AddLocalBeanMarkerResolution implements IMarkerResolution2 {
+public class AddLocalBeanMarkerResolution extends BaseMarkerResolution {
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 SPACE = " "; //$NON-NLS-1$
- private String label;
- private String description;
private IMethod method;
private IFile file;
@@ -55,101 +48,55 @@
this.label = MessageFormat.format(CDIUIMessages.ADD_LOCAL_BEAN_MARKER_RESOLUTION_TITLE, new Object[]{method.getDeclaringType().getElementName()});
this.method = method;
this.file = file;
- description = getPreview();
+ init();
}
@Override
- public String getLabel() {
- return label;
+ protected ICompilationUnit getCompilationUnit(){
+ return EclipseUtil.getCompilationUnit(file);
}
@Override
- public void run(IMarker marker) {
- try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
- if(original == null) {
- return;
- }
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
-
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
-
- private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
MultiTextEdit edit = new MultiTextEdit();
change.setEdit(edit);
-
- IBuffer buffer = compilationUnit.getBuffer();
-
- int flag = method.getFlags();
-
- String text = buffer.getText(method.getSourceRange().getOffset(), method.getSourceRange().getLength());
-
- // make method public
- int position = method.getSourceRange().getOffset();
-
- if((flag & Flags.AccPublic) == 0){
- if((flag & Flags.AccPrivate) != 0){
- position += text.indexOf(PRIVATE);
- edit.addChild(new ReplaceEdit(position, PRIVATE.length(), PUBLIC));
- }else if((flag & Flags.AccProtected) != 0){
- 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));
- }
- }
-
- // add @LocalBean annotation
- MarkerResolutionUtils.addAnnotation(CDIConstants.LOCAL_BEAN_ANNOTATION_TYPE_NAME, compilationUnit, method.getDeclaringType(), "", edit);
-
- return change;
- }
-
- private CompilationUnitChange getPreviewChange(){
try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ IBuffer buffer = compilationUnit.getBuffer();
- return getChange(original);
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- return null;
- }
+ int flag = method.getFlags();
+
+ String text = buffer.getText(method.getSourceRange().getOffset(), method.getSourceRange().getLength());
- private String getPreview(){
- TextChange previewChange = getPreviewChange();
-
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
+ // make method public
+ int position = method.getSourceRange().getOffset();
+
+ if((flag & Flags.AccPublic) == 0){
+ if((flag & Flags.AccPrivate) != 0){
+ position += text.indexOf(PRIVATE);
+ edit.addChild(new ReplaceEdit(position, PRIVATE.length(), PUBLIC));
+ }else if((flag & Flags.AccProtected) != 0){
+ 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));
+ }
+ }
+
+ // add @LocalBean annotation
+ MarkerResolutionUtils.addAnnotation(CDIConstants.LOCAL_BEAN_ANNOTATION_TYPE_NAME, compilationUnit, method.getDeclaringType(), "", edit);
+ } catch (JavaModelException e) {
+ CDIUIPlugin.getDefault().logError(e);
}
- return label;
+ return change;
}
@Override
- public String getDescription() {
- return description;
- }
-
- @Override
public Image getImage() {
return CDIImages.QUICKFIX_ADD;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddNameMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddNameMarkerResolution.java 2012-01-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddNameMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -20,7 +20,6 @@
public AddNameMarkerResolution(IAnnotation annotation, String parameter) {
super(annotation, "\""+parameter+"\"");
label = NLS.bind(CDIUIMessages.ADD_NAME_MARKER_RESOLUTION_TITLE, parameter);
- description = getPreview();
}
@Override
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddRetentionAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddRetentionAnnotationMarkerResolution.java 2012-01-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddRetentionAnnotationMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -10,103 +10,52 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.internal.core.refactoring.CDIMarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
-public class AddRetentionAnnotationMarkerResolution implements
- IMarkerResolution2 {
+public class AddRetentionAnnotationMarkerResolution extends BaseMarkerResolution {
private IType type;
- private String label;
- private String description;
public AddRetentionAnnotationMarkerResolution(IType type){
this.type = type;
label = NLS.bind(CDIUIMessages.ADD_RETENTION_MARKER_RESOLUTION_TITLE, type.getElementName());
- description = getPreview();
+ init();
}
@Override
- public String getLabel() {
- return label;
+ protected ICompilationUnit getCompilationUnit(){
+ return type.getCompilationUnit();
}
-
- @Override
- public void run(IMarker marker) {
- try{
- ICompilationUnit original = type.getCompilationUnit();
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
- private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ @Override
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
MultiTextEdit edit = new MultiTextEdit();
change.setEdit(edit);
-
- CDIMarkerResolutionUtils.addImport(CDIConstants.RETENTION_POLICY_RUNTIME_TYPE_NAME, compilationUnit, true, edit);
-
- CDIMarkerResolutionUtils.addAnnotation(CDIConstants.RETENTION_ANNOTATION_TYPE_NAME, compilationUnit, type, "(RUNTIME)", edit);
-
- return change;
- }
-
- private CompilationUnitChange getPreviewChange(){
try{
- ICompilationUnit original = type.getCompilationUnit();
+ CDIMarkerResolutionUtils.addImport(CDIConstants.RETENTION_POLICY_RUNTIME_TYPE_NAME, compilationUnit, true, edit);
- return getChange(original);
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
+ CDIMarkerResolutionUtils.addAnnotation(CDIConstants.RETENTION_ANNOTATION_TYPE_NAME, compilationUnit, type, "(RUNTIME)", edit);
+ } catch (JavaModelException e) {
+ CDIUIPlugin.getDefault().logError(e);
}
- return null;
+ return change;
}
- private String getPreview(){
- TextChange previewChange = getPreviewChange();
-
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
- }
- return label;
- }
-
@Override
- public String getDescription() {
- return description;
- }
-
- @Override
public Image getImage() {
return CDIImages.QUICKFIX_ADD;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java 2012-01-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -13,108 +13,55 @@
import java.text.MessageFormat;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.internal.core.refactoring.CDIMarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
-import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
/**
* @author Daniel Azarov
*/
-public class AddSerializableInterfaceMarkerResolution implements IMarkerResolution2 {
+public class AddSerializableInterfaceMarkerResolution extends BaseMarkerResolution {
public static final String SERIALIZABLE = "java.io.Serializable"; //$NON-NLS-1$
- private String label;
- private String description;
private IType type;
private IFile file;
-
public AddSerializableInterfaceMarkerResolution(IType type, IFile file){
this.label = MessageFormat.format(CDIUIMessages.ADD_SERIALIZABLE_INTERFACE_MARKER_RESOLUTION_TITLE, new Object[]{type.getElementName()});
this.type = type;
this.file = file;
- description = getPreview();
+ init();
}
@Override
- public String getLabel() {
- return label;
+ protected ICompilationUnit getCompilationUnit(){
+ return EclipseUtil.getCompilationUnit(file);
}
@Override
- public void run(IMarker marker) {
- try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
- if(original == null) {
- return;
- }
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
-
- private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
MultiTextEdit edit = new MultiTextEdit();
change.setEdit(edit);
-
- CDIMarkerResolutionUtils.addInterfaceToClass(compilationUnit, type, SERIALIZABLE, edit);
-
- return change;
- }
-
- private CompilationUnitChange getPreviewChange(){
try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
-
- return getChange(original);
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
+ CDIMarkerResolutionUtils.addInterfaceToClass(compilationUnit, type, SERIALIZABLE, edit);
+ } catch (JavaModelException e) {
+ CDIUIPlugin.getDefault().logError(e);
}
- return null;
- }
-
- private String getPreview(){
- TextChange previewChange = getPreviewChange();
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
- }
- return label;
+ return change;
}
-
- @Override
- public String getDescription() {
- return description;
- }
@Override
public Image getImage() {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddTargetAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddTargetAnnotationMarkerResolution.java 2012-01-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddTargetAnnotationMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -10,31 +10,22 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.internal.core.refactoring.CDIMarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
-public class AddTargetAnnotationMarkerResolution implements
- IMarkerResolution2 {
+public class AddTargetAnnotationMarkerResolution extends BaseMarkerResolution {
private IType type;
- private String label;
- private String description;
private String[] qualifiedNames;
private String[] shortNames;
private String totalList;
@@ -45,75 +36,36 @@
shortNames = CDIMarkerResolutionUtils.getShortNames(qualifiedNames);
totalList = CDIMarkerResolutionUtils.OPEN_BRACE+CDIMarkerResolutionUtils.getTotalList(shortNames)+CDIMarkerResolutionUtils.CLOSE_BRACE;
label = NLS.bind(CDIUIMessages.ADD_TARGET_MARKER_RESOLUTION_TITLE, totalList, type.getElementName());
- description = getPreview();
+ init();
}
-
+
@Override
- public String getLabel() {
- return label;
+ protected ICompilationUnit getCompilationUnit(){
+ return type.getCompilationUnit();
}
-
- @Override
- public void run(IMarker marker) {
- try{
- ICompilationUnit original = type.getCompilationUnit();
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
- private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ @Override
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
MultiTextEdit edit = new MultiTextEdit();
change.setEdit(edit);
- for(String qualifiedName : qualifiedNames){
- CDIMarkerResolutionUtils.addImport(qualifiedName, compilationUnit, true, edit);
- }
- CDIMarkerResolutionUtils.addAnnotation(CDIConstants.TARGET_ANNOTATION_TYPE_NAME, compilationUnit, type, "("+totalList+")", edit);
-
- return change;
- }
-
- private CompilationUnitChange getPreviewChange(){
try{
- ICompilationUnit original = type.getCompilationUnit();
+ for(String qualifiedName : qualifiedNames){
+ CDIMarkerResolutionUtils.addImport(qualifiedName, compilationUnit, true, edit);
+ }
- return getChange(original);
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
+ CDIMarkerResolutionUtils.addAnnotation(CDIConstants.TARGET_ANNOTATION_TYPE_NAME, compilationUnit, type, "("+totalList+")", edit);
+ } catch (JavaModelException e) {
+ CDIUIPlugin.getDefault().logError(e);
}
- return null;
- }
-
- private String getPreview(){
- TextChange previewChange = getPreviewChange();
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
- }
- return label;
+ return change;
}
@Override
- public String getDescription() {
- return description;
- }
-
- @Override
public Image getImage() {
return CDIImages.QUICKFIX_ADD;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/ChangeAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/ChangeAnnotationMarkerResolution.java 2012-01-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/ChangeAnnotationMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -10,29 +10,22 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.text.edits.TextEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.internal.core.refactoring.CDIMarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
-public class ChangeAnnotationMarkerResolution implements
- IMarkerResolution2 {
+public class ChangeAnnotationMarkerResolution extends BaseMarkerResolution {
private IAnnotation annotation;
protected String sourceString = "";
@@ -41,9 +34,6 @@
private String[] qualifiedNames = new String[0];
- protected String label;
- protected String description;
-
public ChangeAnnotationMarkerResolution(IAnnotation annotation){
this.annotation = annotation;
@@ -56,7 +46,7 @@
}
label = NLS.bind(CDIUIMessages.CHANGE_ANNOTATION_MARKER_RESOLUTION_TITLE, sourceString, changeString);
- description = getPreview();
+ init();
}
public ChangeAnnotationMarkerResolution(IAnnotation annotation, String parameter){
@@ -86,72 +76,31 @@
}
@Override
- public String getLabel() {
- return label;
- }
-
- @Override
- public void run(IMarker marker) {
- try{
- ICompilationUnit original = CDIMarkerResolutionUtils.getJavaMember(annotation).getCompilationUnit();
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
-
- private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
MultiTextEdit edit = new MultiTextEdit();
change.setEdit(edit);
-
- for(String qualifiedName : qualifiedNames){
- CDIMarkerResolutionUtils.addImport(qualifiedName, compilationUnit, true, edit);
- }
-
- IAnnotation workingCopyAnnotation = CDIMarkerResolutionUtils.findWorkingCopy(compilationUnit, annotation);
-
- TextEdit re = new ReplaceEdit(workingCopyAnnotation.getSourceRange().getOffset(), workingCopyAnnotation.getSourceRange().getLength(), changeString);
- edit.addChild(re);
-
- return change;
- }
-
- private CompilationUnitChange getPreviewChange(){
try{
- ICompilationUnit original = CDIMarkerResolutionUtils.getJavaMember(annotation).getCompilationUnit();
+ for(String qualifiedName : qualifiedNames){
+ CDIMarkerResolutionUtils.addImport(qualifiedName, compilationUnit, true, edit);
+ }
- return getChange(original);
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
+ IAnnotation workingCopyAnnotation = CDIMarkerResolutionUtils.findWorkingCopy(compilationUnit, annotation);
+
+ TextEdit re = new ReplaceEdit(workingCopyAnnotation.getSourceRange().getOffset(), workingCopyAnnotation.getSourceRange().getLength(), changeString);
+ edit.addChild(re);
+ } catch (JavaModelException e) {
+ CDIUIPlugin.getDefault().logError(e);
}
- return null;
- }
-
- protected String getPreview(){
- TextChange previewChange = getPreviewChange();
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
- }
- return label;
+ return change;
}
@Override
- public String getDescription() {
- return description;
+ protected ICompilationUnit getCompilationUnit(){
+ return CDIMarkerResolutionUtils.getJavaMember(annotation).getCompilationUnit();
}
@Override
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAnnotationMarkerResolution.java 2012-01-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAnnotationMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
@@ -21,24 +18,18 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.internal.core.refactoring.CDIMarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
-public class DeleteAnnotationMarkerResolution implements
- IMarkerResolution2 {
+public class DeleteAnnotationMarkerResolution extends BaseMarkerResolution {
private IJavaElement element;
private String qualifiedName;
- private String label;
- private String description;
public DeleteAnnotationMarkerResolution(IJavaElement element, String qualifiedName){
this.element = element;
@@ -67,72 +58,31 @@
}
label = NLS.bind(CDIUIMessages.DELETE_ANNOTATION_MARKER_RESOLUTION_TITLE, new String[]{shortName, element.getElementName(), type});
- description = getPreview();
+ init();
}
-
+
@Override
- public String getLabel() {
- return label;
+ protected ICompilationUnit getCompilationUnit(){
+ return CDIMarkerResolutionUtils.getJavaMember(element).getCompilationUnit();
}
@Override
- public void run(IMarker marker) {
- try{
- ICompilationUnit original = CDIMarkerResolutionUtils.getJavaMember(element).getCompilationUnit();
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
-
- private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
MultiTextEdit edit = new MultiTextEdit();
change.setEdit(edit);
-
- CDIMarkerResolutionUtils.deleteAnnotation(qualifiedName, compilationUnit, element, edit);
-
- return change;
- }
-
- private CompilationUnitChange getPreviewChange(){
try{
- ICompilationUnit original = CDIMarkerResolutionUtils.getJavaMember(element).getCompilationUnit();
-
- return getChange(original);
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
+ CDIMarkerResolutionUtils.deleteAnnotation(qualifiedName, compilationUnit, element, edit);
+ } catch (JavaModelException e) {
+ CDIUIPlugin.getDefault().logError(e);
}
- return null;
- }
-
- protected String getPreview(){
- TextChange previewChange = getPreviewChange();
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
- }
- return label;
+ return change;
}
-
+
@Override
- public String getDescription() {
- return description;
- }
-
- @Override
public Image getImage() {
return CDIImages.QUICKFIX_REMOVE;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java 2012-01-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -15,21 +15,16 @@
import java.util.Set;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.text.edits.TextEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.core.IBean;
@@ -38,119 +33,64 @@
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
-import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
/**
* @author Daniel Azarov
*/
-public class MakeBeanScopedDependentMarkerResolution implements IMarkerResolution2{
- private String label;
+public class MakeBeanScopedDependentMarkerResolution extends BaseMarkerResolution {
private IBean bean;
private IFile file;
- private String description;
+ private IAnnotation annotation;
public MakeBeanScopedDependentMarkerResolution(IBean bean, IFile file){
this.label = MessageFormat.format(CDIUIMessages.MAKE_BEAN_SCOPED_DEPENDENT_MARKER_RESOLUTION_TITLE, new Object[]{bean.getElementName()});
this.bean = bean;
this.file = file;
- description = getPreview();
+ annotation = getScopeAnnotation();
+ init();
}
@Override
- public String getLabel() {
- return label;
+ protected ICompilationUnit getCompilationUnit(){
+ return EclipseUtil.getCompilationUnit(file);
}
-
- @Override
- public void run(IMarker marker) {
- IAnnotation originalAnnotation = getScopeAnnotation();
- if(originalAnnotation == null)
- return;
- try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
- if(original == null) {
- return;
- }
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(originalAnnotation, compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
-
- }
- private CompilationUnitChange getChange(IAnnotation originalAnnotation, ICompilationUnit compilationUnit) throws JavaModelException{
+ @Override
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
+ if(annotation != null){
+ MultiTextEdit edit = new MultiTextEdit();
- MultiTextEdit edit = new MultiTextEdit();
+ change.setEdit(edit);
- change.setEdit(edit);
+ try{
+ CDIMarkerResolutionUtils.addImport(CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME, compilationUnit, edit);
- CDIMarkerResolutionUtils.addImport(CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME, compilationUnit, edit);
+ IAnnotation workingCopyAnnotation = getWorkingCopyAnnotation(annotation, compilationUnit);
- IAnnotation workingCopyAnnotation = getWorkingCopyAnnotation(originalAnnotation, compilationUnit);
-
- if(workingCopyAnnotation != null){
- String shortName = CDIMarkerResolutionUtils.getShortName(CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME);
+ if(workingCopyAnnotation != null){
+ String shortName = CDIMarkerResolutionUtils.getShortName(CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME);
- TextEdit re = new ReplaceEdit(workingCopyAnnotation.getSourceRange().getOffset(), workingCopyAnnotation.getSourceRange().getLength(), CDIMarkerResolutionUtils.AT+shortName);
- edit.addChild(re);
+ TextEdit re = new ReplaceEdit(workingCopyAnnotation.getSourceRange().getOffset(), workingCopyAnnotation.getSourceRange().getLength(), CDIMarkerResolutionUtils.AT+shortName);
+ edit.addChild(re);
- IBuffer buffer = compilationUnit.getBuffer();
+ IBuffer buffer = compilationUnit.getBuffer();
- // delete import
- String qualifiedName = getFullyQualifiedName();
- if(qualifiedName != null){
- CDIMarkerResolutionUtils.deleteImportForAnnotation(qualifiedName, workingCopyAnnotation, compilationUnit, buffer, edit);
+ // delete import
+ String qualifiedName = getFullyQualifiedName();
+ if(qualifiedName != null){
+ CDIMarkerResolutionUtils.deleteImportForAnnotation(qualifiedName, workingCopyAnnotation, compilationUnit, buffer, edit);
+ }
+ }
+ } catch (JavaModelException e) {
+ CDIUIPlugin.getDefault().logError(e);
}
}
return change;
}
- private CompilationUnitChange getPreviewChange(){
- IAnnotation originalAnnotation = getScopeAnnotation();
- if(originalAnnotation == null)
- return null;
- try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
- if(original == null) {
- return null;
- }
-
- return getChange(originalAnnotation, original);
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- return null;
- }
-
- private String getPreview(){
- TextChange previewChange = getPreviewChange();
- if(previewChange != null){
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
- }
- }
- return label;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
-
private IAnnotation getWorkingCopyAnnotation(IAnnotation annotation, ICompilationUnit compilationUnit){
IType type = compilationUnit.getType(bean.getBeanClass().getElementName());
if(type != null){
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-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -13,139 +13,82 @@
import java.text.MessageFormat;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.InsertEdit;
import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.CDIMarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
-import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
/**
* @author Daniel Azarov
*/
-public class MakeFieldStaticMarkerResolution implements IMarkerResolution2 {
- 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 SPACE = " "; //$NON-NLS-1$
-
- private String label;
+public class MakeFieldStaticMarkerResolution extends BaseMarkerResolution {
private IField field;
private IFile file;
- private String description;
public MakeFieldStaticMarkerResolution(IField field, IFile file){
this.label = MessageFormat.format(CDIUIMessages.MAKE_FIELD_STATIC_MARKER_RESOLUTION_TITLE, new Object[]{field.getElementName()});
this.field = field;
this.file = file;
- description = getPreview();
+ init();
}
-
+
@Override
- public String getLabel() {
- return label;
+ protected ICompilationUnit getCompilationUnit(){
+ return EclipseUtil.getCompilationUnit(file);
}
-
+
@Override
- public void run(IMarker marker) {
- try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
- if(original == null) {
- return;
- }
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
-
- private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit) {
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
MultiTextEdit edit = new MultiTextEdit();
change.setEdit(edit);
- IBuffer buffer = compilationUnit.getBuffer();
-
- int flag = field.getFlags();
-
- String text = buffer.getText(field.getSourceRange().getOffset(), field.getSourceRange().getLength());
-
- int position = field.getSourceRange().getOffset();
- if((flag & Flags.AccPublic) != 0){
- position += text.indexOf(PUBLIC)+PUBLIC.length();
- InsertEdit ie = new InsertEdit(position, SPACE+STATIC);
- edit.addChild(ie);
- }else if((flag & Flags.AccPrivate) != 0){
- position += text.indexOf(PRIVATE)+PRIVATE.length();
- InsertEdit ie = new InsertEdit(position, SPACE+STATIC);
- edit.addChild(ie);
- }else if((flag & Flags.AccProtected) != 0){
- position += text.indexOf(PROTECTED)+PROTECTED.length();
- InsertEdit ie = new InsertEdit(position, SPACE+STATIC);
- edit.addChild(ie);
- }else{
- String type = Signature.getSignatureSimpleName(field.getTypeSignature());
- position += text.indexOf(type);
- InsertEdit ie = new InsertEdit(position, SPACE+STATIC);
- edit.addChild(ie);
- }
-
- return change;
- }
-
- private CompilationUnitChange getPreviewChange(){
try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ IBuffer buffer = compilationUnit.getBuffer();
- return getChange(original);
+ int flag = field.getFlags();
+
+ String text = buffer.getText(field.getSourceRange().getOffset(), field.getSourceRange().getLength());
+
+ int position = field.getSourceRange().getOffset();
+ if((flag & Flags.AccPublic) != 0){
+ 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){
+ 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){
+ position += text.indexOf(CDIMarkerResolutionUtils.PROTECTED)+CDIMarkerResolutionUtils.PROTECTED.length();
+ InsertEdit ie = new InsertEdit(position, CDIMarkerResolutionUtils.SPACE+CDIMarkerResolutionUtils.STATIC);
+ edit.addChild(ie);
+ }else{
+ String type = Signature.getSignatureSimpleName(field.getTypeSignature());
+ position += text.indexOf(type);
+ InsertEdit ie = new InsertEdit(position, CDIMarkerResolutionUtils.SPACE+CDIMarkerResolutionUtils.STATIC);
+ edit.addChild(ie);
+ }
}catch(CoreException ex){
CDIUIPlugin.getDefault().logError(ex);
}
- return null;
+ return change;
}
- private String getPreview(){
- TextChange previewChange = getPreviewChange();
-
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
- }
- return label;
- }
-
@Override
- public String getDescription() {
- return description;
- }
-
- @Override
public Image getImage() {
return CDIImages.QUICKFIX_EDIT;
}
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-25 00:51:01 UTC (rev 38151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -13,144 +13,87 @@
import java.text.MessageFormat;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
-import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.swt.graphics.Image;
import org.eclipse.text.edits.InsertEdit;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.internal.core.refactoring.CDIMarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
-import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
-import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
/**
* @author Daniel Azarov
*/
-public class MakeMethodPublicMarkerResolution implements IMarkerResolution2 {
- 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 SPACE = " "; //$NON-NLS-1$
-
- private String label;
+public class MakeMethodPublicMarkerResolution extends BaseMarkerResolution {
private IMethod method;
private IFile file;
- private String description;
public MakeMethodPublicMarkerResolution(IMethod method, IFile file){
this.label = MessageFormat.format(CDIUIMessages.MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE, new Object[]{method.getElementName()});
this.method = method;
this.file = file;
- description = getPreview();
+ init();
}
@Override
- public String getLabel() {
- return label;
+ protected ICompilationUnit getCompilationUnit(){
+ return EclipseUtil.getCompilationUnit(file);
}
@Override
- public void run(IMarker marker) {
- try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
- if(original == null) {
- return;
- }
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- CompilationUnitChange change = getChange(compilationUnit);
-
- if(change.getEdit().hasChildren()){
- change.perform(new NullProgressMonitor());
- original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
- }
- compilationUnit.discardWorkingCopy();
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
-
- private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
MultiTextEdit edit = new MultiTextEdit();
change.setEdit(edit);
- IBuffer buffer = compilationUnit.getBuffer();
- IMethod workingCopyMethod = CDIMarkerResolutionUtils.findWorkingCopy(compilationUnit, method);
- if(workingCopyMethod != null){
- int flag = workingCopyMethod.getFlags();
+ try{
+ IBuffer buffer = compilationUnit.getBuffer();
- String text = buffer.getText(workingCopyMethod.getSourceRange().getOffset(), workingCopyMethod.getSourceRange().getLength());
-
- // make method public
- int position = workingCopyMethod.getSourceRange().getOffset();
- if((flag & Flags.AccPublic) == 0){
- if((flag & Flags.AccPrivate) != 0){
- position += text.indexOf(PRIVATE);
- ReplaceEdit re = new ReplaceEdit(position, PRIVATE.length(), PUBLIC);
- edit.addChild(re);
- }else if((flag & Flags.AccProtected) != 0){
- position += text.indexOf(PROTECTED);
- ReplaceEdit re = new ReplaceEdit(position, PROTECTED.length(), PUBLIC);
- edit.addChild(re);
- }else{
- String type = Signature.getSignatureSimpleName(workingCopyMethod.getReturnType());
- position += text.indexOf(type);
- InsertEdit ie = new InsertEdit(position, PUBLIC+SPACE);
- edit.addChild(ie);
+ IMethod workingCopyMethod = CDIMarkerResolutionUtils.findWorkingCopy(compilationUnit, method);
+ if(workingCopyMethod != null){
+ int flag = workingCopyMethod.getFlags();
+
+ String text = buffer.getText(workingCopyMethod.getSourceRange().getOffset(), workingCopyMethod.getSourceRange().getLength());
+
+ // make method public
+ int position = workingCopyMethod.getSourceRange().getOffset();
+ if((flag & Flags.AccPublic) == 0){
+ if((flag & Flags.AccPrivate) != 0){
+ position += text.indexOf(CDIMarkerResolutionUtils.PRIVATE);
+ ReplaceEdit re = new ReplaceEdit(position, CDIMarkerResolutionUtils.PRIVATE.length(), CDIMarkerResolutionUtils.PUBLIC);
+ edit.addChild(re);
+ }else if((flag & Flags.AccProtected) != 0){
+ position += text.indexOf(CDIMarkerResolutionUtils.PROTECTED);
+ ReplaceEdit re = new ReplaceEdit(position, CDIMarkerResolutionUtils.PROTECTED.length(), CDIMarkerResolutionUtils.PUBLIC);
+ edit.addChild(re);
+ }else{
+ String type = Signature.getSignatureSimpleName(workingCopyMethod.getReturnType());
+ position += text.indexOf(type);
+ InsertEdit ie = new InsertEdit(position, CDIMarkerResolutionUtils.PUBLIC+CDIMarkerResolutionUtils.SPACE);
+ edit.addChild(ie);
+ }
}
}
- }
-
- return change;
- }
-
- private CompilationUnitChange getPreviewChange(){
- try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
-
- return getChange(original);
}catch(CoreException ex){
CDIUIPlugin.getDefault().logError(ex);
}
- return null;
+ return change;
}
- private String getPreview(){
- TextChange previewChange = getPreviewChange();
-
- try {
- return MarkerResolutionUtils.getPreview(previewChange);
- } catch (CoreException e) {
- CommonUIPlugin.getDefault().logError(e);
- }
- return label;
- }
-
@Override
- public String getDescription() {
- return description;
- }
-
- @Override
public Image getImage() {
return CDIImages.QUICKFIX_EDIT;
}
-
}
Added: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/BaseMarkerResolution.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/BaseMarkerResolution.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/BaseMarkerResolution.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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.refactoring;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ui.IMarkerResolution2;
+import org.jboss.tools.common.CommonPlugin;
+
+abstract public class BaseMarkerResolution implements IMarkerResolution2 {
+ protected String label;
+ protected String description;
+
+ protected final void init(){
+ description = getPreview();
+ }
+
+ @Override
+ public final String getLabel() {
+ return label;
+ }
+
+ @Override
+ public final void run(IMarker marker) {
+ try{
+ ICompilationUnit original = getCompilationUnit();
+ if(original != null){
+ ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
+
+ TextChange change = getChange(compilationUnit);
+
+ if(change.getEdit().hasChildren()){
+ change.perform(new NullProgressMonitor());
+ original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
+ }
+ compilationUnit.discardWorkingCopy();
+ }
+ }catch(CoreException ex){
+ CommonPlugin.getDefault().logError(ex);
+ }
+ }
+
+ @Override
+ public final String getDescription() {
+ return description;
+ }
+
+ private TextChange getPreviewChange(){
+ ICompilationUnit original = getCompilationUnit();
+ if(original != null){
+ return getChange(original);
+ }
+ return null;
+ }
+
+ private String getPreview(){
+ TextChange previewChange = getPreviewChange();
+ if(previewChange != null){
+ try {
+ return MarkerResolutionUtils.getPreview(previewChange);
+ } catch (CoreException e) {
+ CommonPlugin.getDefault().logError(e);
+ }
+ }
+ return label;
+ }
+
+ abstract protected ICompilationUnit getCompilationUnit();
+
+ abstract protected TextChange getChange(ICompilationUnit compilationUnit);
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/BaseMarkerResolution.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/MarkerResolutionUtils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/MarkerResolutionUtils.java 2012-01-25 00:51:01 UTC (rev 38151)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/MarkerResolutionUtils.java 2012-01-25 01:20:38 UTC (rev 38152)
@@ -64,6 +64,9 @@
public static final String CLOSE_DEL = "</del>"; //$NON-NLS-1$
public static final String NEW_LINE = "\n"; //$NON-NLS-1$
public static final String LINE_BREAK = "<br>"; //$NON-NLS-1$
+ public static final String PUBLIC = "public"; //$NON-NLS-1$
+ public static final String PRIVATE = "private"; //$NON-NLS-1$
+ public static final String PROTECTED = "protected"; //$NON-NLS-1$
public static final char C_SPACE = ' '; //$NON-NLS-1$
public static final char C_TAB = '\t';
12 years, 11 months
JBoss Tools SVN: r38151 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-24 19:51:01 -0500 (Tue, 24 Jan 2012)
New Revision: 38151
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java
Log:
JBIDE-10703
https://issues.jboss.org/browse/JBIDE-10703
SeamGuiPlugin is modified to follow the common pattern.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java 2012-01-25 00:46:46 UTC (rev 38150)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java 2012-01-25 00:51:01 UTC (rev 38151)
@@ -37,16 +37,6 @@
plugin = this;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
/**
* Returns the shared instance
*
12 years, 11 months
JBoss Tools SVN: r38150 - trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-24 19:46:46 -0500 (Tue, 24 Jan 2012)
New Revision: 38150
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtPlugin.java
Log:
JBIDE-10703
https://issues.jboss.org/browse/JBIDE-10703
SeamExtPlugin is modified to follow the common pattern.
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtPlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtPlugin.java 2012-01-25 00:43:48 UTC (rev 38149)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtPlugin.java 2012-01-25 00:46:46 UTC (rev 38150)
@@ -2,7 +2,6 @@
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
-import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
@@ -19,26 +18,9 @@
* The constructor
*/
public SeamExtPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
plugin = this;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
/**
* Returns the shared instance
*
12 years, 11 months
JBoss Tools SVN: r38149 - in trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml: model and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-24 19:43:48 -0500 (Tue, 24 Jan 2012)
New Revision: 38149
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/SeamPagesXMLPlugin.java
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesEntityRecognizer.java
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/AddViewSupport.java
Log:
JBIDE-10703
https://issues.jboss.org/browse/JBIDE-10703
SeamPagesEntityRecognizer is modified to follow the common pattern.
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/SeamPagesXMLPlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/SeamPagesXMLPlugin.java 2012-01-25 00:24:32 UTC (rev 38148)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/SeamPagesXMLPlugin.java 2012-01-25 00:43:48 UTC (rev 38149)
@@ -10,43 +10,20 @@
******************************************************************************/
package org.jboss.tools.seam.pages.xml;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.common.log.BaseUIPlugin;
/**
*/
-public class SeamPagesXMLPlugin extends AbstractUIPlugin {
+public class SeamPagesXMLPlugin extends BaseUIPlugin {
public static final String PLUGIN_ID = "org.jboss.tools.seam.xml"; //$NON-NLS-1$
public SeamPagesXMLPlugin() {
- super();
- INSTANCE = this;
+ plugin = this;
}
- public static void log(String msg) {
- if(isDebugEnabled()) INSTANCE.getLog().log(new Status(Status.INFO, PLUGIN_ID, Status.OK, msg, null));
- }
-
- public static void log(IStatus status) {
- if(isDebugEnabled() || !status.isOK()) INSTANCE.getLog().log(status);
- }
-
- public static void log(String message, Throwable exception) {
- INSTANCE.getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, message, exception));
- }
-
- public static void log(Exception ex) {
- INSTANCE.getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, SeamPagesXMLMessages.SEAM_PAGES_XML_PLUGIN_NO_MESSAGE, ex));
- }
-
- public static boolean isDebugEnabled() {
- return INSTANCE.isDebugging();
- }
-
public static SeamPagesXMLPlugin getDefault() {
- return INSTANCE;
+ return plugin;
}
- static SeamPagesXMLPlugin INSTANCE = null;
+ private static SeamPagesXMLPlugin plugin = null;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesEntityRecognizer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesEntityRecognizer.java 2012-01-25 00:24:32 UTC (rev 38148)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesEntityRecognizer.java 2012-01-25 00:43:48 UTC (rev 38149)
@@ -25,7 +25,7 @@
Class<?> c = SeamPagesEntityRecognizer.class;
XMLEntityResolver.registerPublicEntity(PUBLIC_ID_12, c, "/meta/pages-1.2.dtd"); //$NON-NLS-1$
} catch (IOException e) {
- SeamPagesXMLPlugin.log(e);
+ SeamPagesXMLPlugin.getDefault().logError(e);
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/AddViewSupport.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/AddViewSupport.java 2012-01-25 00:24:32 UTC (rev 38148)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/AddViewSupport.java 2012-01-25 00:43:48 UTC (rev 38149)
@@ -95,7 +95,7 @@
templateString = buffer.getString();
}
catch (Exception e) {
- SeamPagesXMLPlugin.log("Could not create template for new html", e); //$NON-NLS-1$
+ SeamPagesXMLPlugin.getDefault().logError("Could not create template for new html", e); //$NON-NLS-1$
}
}
12 years, 11 months
JBoss Tools SVN: r38148 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-24 19:24:32 -0500 (Tue, 24 Jan 2012)
New Revision: 38148
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/SeamTemplatesActivator.java
Log:
JBIDE-10703
https://issues.jboss.org/browse/JBIDE-10703
SeamTemplatesActivator is modified to follow the common pattern.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/SeamTemplatesActivator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/SeamTemplatesActivator.java 2012-01-25 00:22:59 UTC (rev 38147)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/SeamTemplatesActivator.java 2012-01-25 00:24:32 UTC (rev 38148)
@@ -18,7 +18,6 @@
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
/**
* @author Vitali (vyemialyanchyk(a)exadel.com)
@@ -40,23 +39,6 @@
plugin = this;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
/**
* Returns the shared instance
*
12 years, 11 months
JBoss Tools SVN: r38147 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-24 19:22:59 -0500 (Tue, 24 Jan 2012)
New Revision: 38147
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/RichFacesTemplatesActivator.java
Log:
JBIDE-10703
https://issues.jboss.org/browse/JBIDE-10703
RichFacesTemplatesActivator is modified to follow the common pattern.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/RichFacesTemplatesActivator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/RichFacesTemplatesActivator.java 2012-01-25 00:20:10 UTC (rev 38146)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/RichFacesTemplatesActivator.java 2012-01-25 00:22:59 UTC (rev 38147)
@@ -18,7 +18,6 @@
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
@@ -38,23 +37,6 @@
plugin = this;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
/**
* Returns the shared instance
*
12 years, 11 months
JBoss Tools SVN: r38146 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/src/org/jboss/tools/jsf/vpe/myfaces.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-24 19:20:10 -0500 (Tue, 24 Jan 2012)
New Revision: 38146
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/src/org/jboss/tools/jsf/vpe/myfaces/MyFacesTemplatesPlugin.java
Log:
JBIDE-10703
https://issues.jboss.org/browse/JBIDE-10703
MyFacesTemplatesPlugin is modified to follow the common pattern.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/src/org/jboss/tools/jsf/vpe/myfaces/MyFacesTemplatesPlugin.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/src/org/jboss/tools/jsf/vpe/myfaces/MyFacesTemplatesPlugin.java 2012-01-25 00:15:57 UTC (rev 38145)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/src/org/jboss/tools/jsf/vpe/myfaces/MyFacesTemplatesPlugin.java 2012-01-25 00:20:10 UTC (rev 38146)
@@ -1,7 +1,6 @@
package org.jboss.tools.jsf.vpe.myfaces;
import org.jboss.tools.common.log.BaseUIPlugin;
-import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
@@ -18,26 +17,9 @@
* The constructor
*/
public MyFacesTemplatesPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
plugin = this;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
/**
* Returns the shared instance
*
12 years, 11 months
JBoss Tools SVN: r38145 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-24 19:15:57 -0500 (Tue, 24 Jan 2012)
New Revision: 38145
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/JstlTemplatePlugin.java
Log:
JBIDE-10703
https://issues.jboss.org/browse/JBIDE-10703
JstlTemplatePlugin is modified to follow the common pattern.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/JstlTemplatePlugin.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/JstlTemplatePlugin.java 2012-01-25 00:14:54 UTC (rev 38144)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/JstlTemplatePlugin.java 2012-01-25 00:15:57 UTC (rev 38145)
@@ -11,7 +11,6 @@
package org.jboss.tools.jsf.vpe.jstl;
import org.jboss.tools.common.log.BaseUIPlugin;
-import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
@@ -30,28 +29,9 @@
* The default constructor.
*/
public JstlTemplatePlugin() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
plugin = this;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
/**
* Returns the shared instance
*
12 years, 11 months