A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / php / PHPDoubleClickSelector.java
index e91ca82..9a38d3b 100644 (file)
@@ -1,17 +1,16 @@
 /**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
-    IBM Corporation - Initial implementation
-    www.phpeclipse.de
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
+
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
-
 import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
 
 import org.eclipse.jface.text.BadLocationException;
@@ -25,21 +24,25 @@ import org.eclipse.jface.text.ITextViewer;
 public class PHPDoubleClickSelector implements ITextDoubleClickStrategy {
 
        protected ITextViewer fText;
+
        protected int fPos;
+
        protected int fStartPos;
+
        protected int fEndPos;
 
-       protected static char[] fgBrackets = { '{', '}', '(', ')', '[', ']', '"', '"' };
+       protected static char[] fgBrackets = { '{', '}', '(', ')', '[', ']', '"',
+                       '"' };
 
-       /* 
+       /*
         * Create a PHPDoubleClickSelector.
         */
        public PHPDoubleClickSelector() {
                super();
        }
 
-       /* (non-Javadoc)
-        * Method declared on ITextDoubleClickStrategy
+       /*
+        * (non-Javadoc) Method declared on ITextDoubleClickStrategy
         */
        public void doubleClicked(ITextViewer text) {
 
@@ -92,13 +95,15 @@ public class PHPDoubleClickSelector implements ITextDoubleClickStrategy {
                        }
 
                        if (fStartPos > -1 && bracketIndex1 < bracketIndex2) {
-                               fEndPos = searchForClosingBracket(fStartPos, prevChar, fgBrackets[bracketIndex1 + 1], doc);
+                               fEndPos = searchForClosingBracket(fStartPos, prevChar,
+                                               fgBrackets[bracketIndex1 + 1], doc);
                                if (fEndPos > -1)
                                        return true;
                                else
                                        fStartPos = -1;
                        } else if (fEndPos > -1) {
-                               fStartPos = searchForOpenBracket(fEndPos, fgBrackets[bracketIndex2 - 1], nextChar, doc);
+                               fStartPos = searchForOpenBracket(fEndPos,
+                                               fgBrackets[bracketIndex2 - 1], nextChar, doc);
                                if (fStartPos > -1)
                                        return true;
                                else
@@ -156,14 +161,19 @@ public class PHPDoubleClickSelector implements ITextDoubleClickStrategy {
 
        /**
         * Returns the position of the closing bracket after startPosition.
+        * 
         * @returns the location of the closing bracket.
-        * @param startPosition - the beginning position
-        * @param openBracket - the character that represents the open bracket
-        * @param closeBracket - the character that represents the close bracket
-        * @param document - the document being searched
+        * @param startPosition -
+        *            the beginning position
+        * @param openBracket -
+        *            the character that represents the open bracket
+        * @param closeBracket -
+        *            the character that represents the close bracket
+        * @param document -
+        *            the document being searched
         */
-       protected int searchForClosingBracket(int startPosition, char openBracket, char closeBracket, IDocument document)
-               throws BadLocationException {
+       protected int searchForClosingBracket(int startPosition, char openBracket,
+                       char closeBracket, IDocument document) throws BadLocationException {
                int stack = 1;
                int closePosition = startPosition + 1;
                int length = document.getLength();
@@ -187,14 +197,19 @@ public class PHPDoubleClickSelector implements ITextDoubleClickStrategy {
 
        /**
         * Returns the position of the open bracket before startPosition.
+        * 
         * @returns the location of the starting bracket.
-        * @param startPosition - the beginning position
-        * @param openBracket - the character that represents the open bracket
-        * @param closeBracket - the character that represents the close bracket
-        * @param document - the document being searched
+        * @param startPosition -
+        *            the beginning position
+        * @param openBracket -
+        *            the character that represents the open bracket
+        * @param closeBracket -
+        *            the character that represents the close bracket
+        * @param document -
+        *            the document being searched
         */
-       protected int searchForOpenBracket(int startPosition, char openBracket, char closeBracket, IDocument document)
-               throws BadLocationException {
+       protected int searchForOpenBracket(int startPosition, char openBracket,
+                       char closeBracket, IDocument document) throws BadLocationException {
                int stack = 1;
                int openPos = startPosition - 1;
                char nextChar;
@@ -215,8 +230,8 @@ public class PHPDoubleClickSelector implements ITextDoubleClickStrategy {
        }
 
        /**
-        * Select the area between the selected bracket and the closing bracket. Return
-        * true if successful.
+        * Select the area between the selected bracket and the closing bracket.
+        * Return true if successful.
         */
        protected boolean selectBracketBlock() {
                if (matchBracketsAt()) {
@@ -232,7 +247,7 @@ public class PHPDoubleClickSelector implements ITextDoubleClickStrategy {
        }
 
        /**
-        * Select the word at the current selection. 
+        * Select the word at the current selection.
         */
        protected void selectWord() {
                if (matchWord()) {