A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / JavaSelectMarkerRulerAction.java
index ec3ed89..e265b54 100644 (file)
@@ -32,33 +32,39 @@ import org.eclipse.ui.texteditor.ITextEditor;
 import org.eclipse.ui.texteditor.ITextEditorExtension;
 import org.eclipse.ui.texteditor.SelectMarkerRulerAction;
 
-
 /**
- * A special select marker ruler action which activates quick fix if clicked on a quick fixable problem.
+ * A special select marker ruler action which activates quick fix if clicked on
+ * a quick fixable problem.
  */
 public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction {
 
        private ITextEditor fTextEditor;
+
        private Position fPosition;
 
-       public JavaSelectMarkerRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler) {
+       public JavaSelectMarkerRulerAction(ResourceBundle bundle, String prefix,
+                       ITextEditor editor, IVerticalRulerInfo ruler) {
                super(bundle, prefix, editor, ruler);
-               fTextEditor= editor;
-               PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.JAVA_SELECT_MARKER_RULER_ACTION);
+               fTextEditor = editor;
+               PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+                               IJavaHelpContextIds.JAVA_SELECT_MARKER_RULER_ACTION);
        }
 
        public void run() {
-//             if (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
-//                     return;
+               // if
+               // (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
+               // return;
 
                if (fPosition != null) {
-                       ITextOperationTarget operation= (ITextOperationTarget) fTextEditor.getAdapter(ITextOperationTarget.class);
-//                     final int opCode= PHPUnitEditor.CORRECTIONASSIST_PROPOSALS;
-//                     if (operation != null && operation.canDoOperation(opCode)) {
-//                             fTextEditor.selectAndReveal(fPosition.getOffset(), fPosition.getLength());
-//                             operation.doOperation(opCode);
-//                             return;
-//                     }
+                       ITextOperationTarget operation = (ITextOperationTarget) fTextEditor
+                                       .getAdapter(ITextOperationTarget.class);
+                       // final int opCode= PHPUnitEditor.CORRECTIONASSIST_PROPOSALS;
+                       // if (operation != null && operation.canDoOperation(opCode)) {
+                       // fTextEditor.selectAndReveal(fPosition.getOffset(),
+                       // fPosition.getLength());
+                       // operation.doOperation(opCode);
+                       // return;
+                       // }
                        return;
                }
                super.run();
@@ -66,13 +72,14 @@ public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction {
 
        public void update() {
                // Begin Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20114
-               if (!(fTextEditor instanceof ITextEditorExtension) || ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly()) {
-                       fPosition= null;
+               if (!(fTextEditor instanceof ITextEditorExtension)
+                               || ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly()) {
+                       fPosition = null;
                        super.update();
                        return;
                }
                // End Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20114
-               fPosition= getJavaAnnotationPosition();
+               fPosition = getJavaAnnotationPosition();
                if (fPosition != null)
                        setEnabled(true);
                else
@@ -80,37 +87,41 @@ public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction {
        }
 
        private Position getJavaAnnotationPosition() {
-               AbstractMarkerAnnotationModel model= getAnnotationModel();
-               IDocument document= getDocument();
+               AbstractMarkerAnnotationModel model = getAnnotationModel();
+               IDocument document = getDocument();
                if (model == null)
                        return null;
-               ICompilationUnit cu= getCompilationUnit();
+               ICompilationUnit cu = getCompilationUnit();
                if (cu == null) {
                        return null;
                }
 
-//             boolean hasAssistLightbulb= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.APPEARANCE_QUICKASSIST_LIGHTBULB);
-               Annotation assistAnnotation= null;
+               // boolean hasAssistLightbulb=
+               // PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.APPEARANCE_QUICKASSIST_LIGHTBULB);
+               Annotation assistAnnotation = null;
 
-               Iterator iter= model.getAnnotationIterator();
+               Iterator iter = model.getAnnotationIterator();
                while (iter.hasNext()) {
-                       Annotation annotation= (Annotation) iter.next();
+                       Annotation annotation = (Annotation) iter.next();
                        if (annotation instanceof IJavaAnnotation) {
-                               IJavaAnnotation javaAnnotation= (IJavaAnnotation)annotation;
+                               IJavaAnnotation javaAnnotation = (IJavaAnnotation) annotation;
                                if (!javaAnnotation.isMarkedDeleted()) {
-                                       Position position= model.getPosition(annotation);
-//                                     if (includesRulerLine(position, document) && JavaCorrectionProcessor.hasCorrections(javaAnnotation))
-//                                             return position;
+                                       Position position = model.getPosition(annotation);
+                                       // if (includesRulerLine(position, document) &&
+                                       // JavaCorrectionProcessor.hasCorrections(javaAnnotation))
+                                       // return position;
                                }
                        }
-//                     else if (hasAssistLightbulb && annotation instanceof AssistAnnotation) {
-//                             // there is only one AssistAnnotation at a time
-//                             assistAnnotation= annotation;
-//                     }
+                       // else if (hasAssistLightbulb && annotation instanceof
+                       // AssistAnnotation) {
+                       // // there is only one AssistAnnotation at a time
+                       // assistAnnotation= annotation;
+                       // }
                }
                if (assistAnnotation != null) {
-                       Position position= model.getPosition(assistAnnotation);
-                       // no need to check 'JavaCorrectionProcessor.hasAssists': annotation only created when
+                       Position position = model.getPosition(assistAnnotation);
+                       // no need to check 'JavaCorrectionProcessor.hasAssists': annotation
+                       // only created when
                        // there are assists
                        if (includesRulerLine(position, document))
                                return position;
@@ -119,14 +130,13 @@ public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction {
        }
 
        private ICompilationUnit getCompilationUnit() {
-               IEditorInput input= fTextEditor.getEditorInput();
+               IEditorInput input = fTextEditor.getEditorInput();
                if (input instanceof IFileEditorInput) {
-                       IFile file= ((IFileEditorInput) input).getFile();
-                       IJavaElement element= JavaCore.create(file);
+                       IFile file = ((IFileEditorInput) input).getFile();
+                       IJavaElement element = JavaCore.create(file);
                        if (element instanceof ICompilationUnit)
                                return (ICompilationUnit) element;
                }
                return null;
        }
 }
-