Refactory: remove unused classes, imports, fields and methods.
authorincastrix <incastrix>
Wed, 23 Dec 2009 17:09:19 +0000 (17:09 +0000)
committerincastrix <incastrix>
Wed, 23 Dec 2009 17:09:19 +0000 (17:09 +0000)
net.sourceforge.phpeclipse/META-INF/MANIFEST.MF
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSLine.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/PHPDocBufferCommentReader.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/PHPDocUtil.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/TemplateMessages.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JdtFlags.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/Strings.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java

index 855b575..e32a817 100644 (file)
@@ -34,13 +34,11 @@ Export-Package: net.sourceforge.phpdt.core,
  net.sourceforge.phpdt.internal.core.util;x-internal:=true,
  net.sourceforge.phpdt.internal.corext;x-internal:=true,
  net.sourceforge.phpdt.internal.corext.phpdoc,
- net.sourceforge.phpdt.internal.corext.refactoring.util;x-internal:=true,
  net.sourceforge.phpdt.internal.corext.template;x-internal:=true,
  net.sourceforge.phpdt.internal.corext.template.php;x-internal:=true,
  net.sourceforge.phpdt.internal.corext.textmanipulation;x-internal:=true,
  net.sourceforge.phpdt.internal.corext.util;x-internal:=true,
  net.sourceforge.phpdt.internal.formatter;x-internal:=true,
- net.sourceforge.phpdt.internal.formatter.align;x-internal:=true,
  net.sourceforge.phpdt.internal.formatter.impl;x-internal:=true,
  net.sourceforge.phpdt.ltk.core,
  net.sourceforge.phpeclipse,
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSLine.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSLine.java
new file mode 100644 (file)
index 0000000..3845e8e
--- /dev/null
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.corext.refactoring.nls;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+//incastrix
+//import org.eclipse.jface.text.Assert;
+import org.eclipse.core.runtime.Assert;
+
+public class NLSLine {
+
+       private int fLineNumber;
+
+       private List fElements;
+
+       public NLSLine(int lineNumber) {
+               fLineNumber = lineNumber;
+               Assert.isTrue(fLineNumber >= 0);
+               fElements = new ArrayList();
+       }
+
+       public int getLineNumber() {
+               return fLineNumber;
+       }
+
+       /**
+        * Adds a NLS element to this line.
+        */
+       public void add(NLSElement element) {
+               Assert.isNotNull(element);
+               fElements.add(element);
+       }
+
+       public NLSElement[] getElements() {
+               return (NLSElement[]) fElements
+                               .toArray(new NLSElement[fElements.size()]);
+       }
+
+       public NLSElement get(int index) {
+               return (NLSElement) fElements.get(index);
+       }
+
+       public boolean exists(int index) {
+               return index >= 0 && index < fElements.size();
+       }
+
+       public int size() {
+               return fElements.size();
+       }
+
+       /*
+        * non javaDoc only for debugging
+        * 
+        * @see Object#toString()
+        */
+       public String toString() {
+               StringBuffer result = new StringBuffer();
+               result.append("Line: " + fLineNumber + "\n"); //$NON-NLS-2$ //$NON-NLS-1$
+               for (Iterator iter = fElements.iterator(); iter.hasNext();) {
+                       result.append("\t"); //$NON-NLS-1$
+                       result.append(iter.next().toString());
+                       result.append("\n"); //$NON-NLS-1$
+               }
+               return result.toString();
+       }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/PHPDocBufferCommentReader.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/PHPDocBufferCommentReader.java
deleted file mode 100644 (file)
index 1e5ccc2..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package net.sourceforge.phpdt.internal.corext.phpdoc;
-
-import net.sourceforge.phpdt.core.IBuffer;
-import net.sourceforge.phpdt.internal.corext.util.Strings;
-
-/**
- * Reads a phpdoc comment from a phpdoc comment. Skips star-character on begin
- * of line
- */
-public class PHPDocBufferCommentReader extends SingleCharReader {
-
-       private IBuffer fBuffer;
-
-       private int fCurrPos;
-
-       private int fStartPos;
-
-       private int fEndPos;
-
-       private boolean fWasNewLine;
-
-       public PHPDocBufferCommentReader(IBuffer buf, int start, int end) {
-               fBuffer = buf;
-               fStartPos = start + 3;
-               fEndPos = end - 2;
-
-               reset();
-       }
-
-       /**
-        * @see java.io.Reader#read()
-        */
-       public int read() {
-               if (fCurrPos < fEndPos) {
-                       char ch;
-                       if (fWasNewLine) {
-                               do {
-                                       ch = fBuffer.getChar(fCurrPos++);
-                               } while (fCurrPos < fEndPos && Character.isWhitespace(ch));
-                               if (ch == '*') {
-                                       if (fCurrPos < fEndPos) {
-                                               do {
-                                                       ch = fBuffer.getChar(fCurrPos++);
-                                               } while (ch == '*');
-                                       } else {
-                                               return -1;
-                                       }
-                               }
-                       } else {
-                               ch = fBuffer.getChar(fCurrPos++);
-                       }
-                       fWasNewLine = Strings.isLineDelimiterChar(ch);
-
-                       return ch;
-               }
-               return -1;
-       }
-
-       /**
-        * @see java.io.Reader#close()
-        */
-       public void close() {
-               fBuffer = null;
-       }
-
-       /**
-        * @see java.io.Reader#reset()
-        */
-       public void reset() {
-               fCurrPos = fStartPos;
-               fWasNewLine = true;
-       }
-
-}
index 426a5e9..7043892 100644 (file)
@@ -55,19 +55,19 @@ public class PHPDocUtil {
                }
        }
 
-       static String getEncoding(String filename) {
-               String encoding = null;
-               IFile file = PHPeclipsePlugin.getWorkspace().getRoot()
-                               .getFileForLocation(new Path(filename));
-               if (file != null) {
-                       try {
-                               encoding = file.getCharset();
-                       } catch (CoreException e) {
-                               // TODO: should log the fact that we could not get the encoding?
-                       }
-               }
-               return encoding;
-       }
+//     static String getEncoding(String filename) {
+//             String encoding = null;
+//             IFile file = PHPeclipsePlugin.getWorkspace().getRoot()
+//                             .getFileForLocation(new Path(filename));
+//             if (file != null) {
+//                     try {
+//                             encoding = file.getCharset();
+//                     } catch (CoreException e) {
+//                             // TODO: should log the fact that we could not get the encoding?
+//                     }
+//             }
+//             return encoding;
+//     }
 
        public static String getUsage(String filename,
                        PHPIdentifierLocation location) {
index 36af986..9751c49 100644 (file)
@@ -10,7 +10,7 @@
  *******************************************************************************/
 package net.sourceforge.phpdt.internal.corext.template;
 
-import java.text.MessageFormat;
+//import java.text.MessageFormat;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
@@ -39,14 +39,14 @@ public class TemplateMessages {
         * @param key
         *            the string used to get the bundle value, must not be null
         */
-       public static String getFormattedString(String key, Object arg) {
-               return MessageFormat.format(getString(key), new Object[] { arg });
-       }
+//     public static String getFormattedString(String key, Object arg) {
+//             return MessageFormat.format(getString(key), new Object[] { arg });
+//     }
 
        /**
         * Gets a string from the resource bundle and formats it with arguments
         */
-       public static String getFormattedString(String key, Object[] args) {
-               return MessageFormat.format(getString(key), args);
-       }
+//     public static String getFormattedString(String key, Object[] args) {
+//             return MessageFormat.format(getString(key), args);
+//     }
 }
index de16099..0e9eab3 100644 (file)
@@ -195,14 +195,14 @@ public class JavaModelUtil {
         *            the member (eg. from the original)
         * @return the member found, or null if not existing
         */
-       public static IMember findMemberInCompilationUnit(ICompilationUnit cu,
-                       IMember member) throws JavaModelException {
-               IJavaElement[] elements = cu.findElements(member);
-               if (elements != null && elements.length > 0) {
-                       return (IMember) elements[0];
-               }
-               return null;
-       }
+//     public static IMember findMemberInCompilationUnit(ICompilationUnit cu,
+//                     IMember member) throws JavaModelException {
+//             IJavaElement[] elements = cu.findElements(member);
+//             if (elements != null && elements.length > 0) {
+//                     return (IMember) elements[0];
+//             }
+//             return null;
+//     }
 
        /**
         * Returns the element of the given compilation unit which is "equal" to the
@@ -365,10 +365,10 @@ public class JavaModelUtil {
         *            If the method is a constructor
         * @return The first found method or <code>null</code>, if nothing found
         */
-       public static IMethod findMethod(String name, String[] paramTypes,
-                       boolean isConstructor, IType type) throws JavaModelException {
-               return findMethod(name, paramTypes, isConstructor, type.getMethods());
-       }
+//     public static IMethod findMethod(String name, String[] paramTypes,
+//                     boolean isConstructor, IType type) throws JavaModelException {
+//             return findMethod(name, paramTypes, isConstructor, type.getMethods());
+//     }
 
        /**
         * Finds a method by name. This searches for a method with a name and
@@ -387,16 +387,16 @@ public class JavaModelUtil {
         *            The methods to search in
         * @return The found method or <code>null</code>, if nothing found
         */
-       public static IMethod findMethod(String name, String[] paramTypes,
-                       boolean isConstructor, IMethod[] methods) throws JavaModelException {
-               for (int i = methods.length - 1; i >= 0; i--) {
-                       if (isSameMethodSignature(name, paramTypes, isConstructor,
-                                       methods[i])) {
-                               return methods[i];
-                       }
-               }
-               return null;
-       }
+//     public static IMethod findMethod(String name, String[] paramTypes,
+//                     boolean isConstructor, IMethod[] methods) throws JavaModelException {
+//             for (int i = methods.length - 1; i >= 0; i--) {
+//                     if (isSameMethodSignature(name, paramTypes, isConstructor,
+//                                     methods[i])) {
+//                             return methods[i];
+//                     }
+//             }
+//             return null;
+//     }
 
        /**
         * Finds a method declararion in a type's hierarchy. The search is top down,
@@ -487,28 +487,28 @@ public class JavaModelUtil {
         * @return Returns <code>true</code> if the method has the given name and
         *         parameter types and constructor state.
         */
-       public static boolean isSameMethodSignature(String name,
-                       String[] paramTypes, boolean isConstructor, IMethod curr)
-                       throws JavaModelException {
-               if (isConstructor || name.equals(curr.getElementName())) {
-                       if (isConstructor == curr.isConstructor()) {
-                               String[] currParamTypes = curr.getParameterTypes();
-                               if (paramTypes.length == currParamTypes.length) {
-                                       for (int i = 0; i < paramTypes.length; i++) {
-                                               String t1 = Signature.getSimpleName(Signature
-                                                               .toString(paramTypes[i]));
-                                               String t2 = Signature.getSimpleName(Signature
-                                                               .toString(currParamTypes[i]));
-                                               if (!t1.equals(t2)) {
-                                                       return false;
-                                               }
-                                       }
-                                       return true;
-                               }
-                       }
-               }
-               return false;
-       }
+//     public static boolean isSameMethodSignature(String name,
+//                     String[] paramTypes, boolean isConstructor, IMethod curr)
+//                     throws JavaModelException {
+//             if (isConstructor || name.equals(curr.getElementName())) {
+//                     if (isConstructor == curr.isConstructor()) {
+//                             String[] currParamTypes = curr.getParameterTypes();
+//                             if (paramTypes.length == currParamTypes.length) {
+//                                     for (int i = 0; i < paramTypes.length; i++) {
+//                                             String t1 = Signature.getSimpleName(Signature
+//                                                             .toString(paramTypes[i]));
+//                                             String t2 = Signature.getSimpleName(Signature
+//                                                             .toString(currParamTypes[i]));
+//                                             if (!t1.equals(t2)) {
+//                                                     return false;
+//                                             }
+//                                     }
+//                                     return true;
+//                             }
+//                     }
+//             }
+//             return false;
+//     }
 
        /**
         * Checks whether the given type has a valid main method or not.
index 4f19663..49e0f69 100644 (file)
@@ -256,15 +256,15 @@ public class JdtFlags {
        // return VISIBILITY_CODE_INVALID;
        // }
 
-       public static String getVisibilityString(int visibilityCode) {
-               if (Modifier.isPublic(visibilityCode))
-                       return VISIBILITY_STRING_PUBLIC;
-               if (Modifier.isProtected(visibilityCode))
-                       return VISIBILITY_STRING_PROTECTED;
-               if (Modifier.isPrivate(visibilityCode))
-                       return VISIBILITY_STRING_PRIVATE;
-               return VISIBILITY_STRING_PACKAGE;
-       }
+//     public static String getVisibilityString(int visibilityCode) {
+//             if (Modifier.isPublic(visibilityCode))
+//                     return VISIBILITY_STRING_PUBLIC;
+//             if (Modifier.isProtected(visibilityCode))
+//                     return VISIBILITY_STRING_PROTECTED;
+//             if (Modifier.isPrivate(visibilityCode))
+//                     return VISIBILITY_STRING_PRIVATE;
+//             return VISIBILITY_STRING_PACKAGE;
+//     }
 
        public static void assertVisibility(int visibility) {
                Assert.isTrue(visibility == Modifier.PUBLIC
@@ -273,29 +273,29 @@ public class JdtFlags {
                                visibility == Modifier.PRIVATE);
        }
 
-       public static boolean isHigherVisibility(int newVisibility,
-                       int oldVisibility) {
-               assertVisibility(oldVisibility);
-               assertVisibility(newVisibility);
-               switch (oldVisibility) {
-               case Modifier.PRIVATE:
-                       return // newVisibility == Modifier.NONE ||
-                       newVisibility == Modifier.PUBLIC
-                                       || newVisibility == Modifier.PROTECTED;
-                       // case Modifier.NONE :
-                       // return newVisibility == Modifier.PUBLIC
-                       // || newVisibility == Modifier.PROTECTED;
-
-               case Modifier.PROTECTED:
-                       return newVisibility == Modifier.PUBLIC;
-
-               case Modifier.PUBLIC:
-                       return false;
-               default:
-                       // Assert.isTrue(false);
-                       return false;
-               }
-       }
+//     public static boolean isHigherVisibility(int newVisibility,
+//                     int oldVisibility) {
+//             assertVisibility(oldVisibility);
+//             assertVisibility(newVisibility);
+//             switch (oldVisibility) {
+//             case Modifier.PRIVATE:
+//                     return // newVisibility == Modifier.NONE ||
+//                     newVisibility == Modifier.PUBLIC
+//                                     || newVisibility == Modifier.PROTECTED;
+//                     // case Modifier.NONE :
+//                     // return newVisibility == Modifier.PUBLIC
+//                     // || newVisibility == Modifier.PROTECTED;
+//
+//             case Modifier.PROTECTED:
+//                     return newVisibility == Modifier.PUBLIC;
+//
+//             case Modifier.PUBLIC:
+//                     return false;
+//             default:
+//                     // Assert.isTrue(false);
+//                     return false;
+//             }
+//     }
 
 //     public static int getLowerVisibility(int visibility1, int visibility2) {
 //             if (isHigherVisibility(visibility1, visibility2))
index 334e22d..c634a6d 100644 (file)
  *******************************************************************************/
 package net.sourceforge.phpdt.internal.corext.util;
 
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DefaultLineTracker;
-import org.eclipse.jface.text.ILineTracker;
-import org.eclipse.jface.text.IRegion;
+//import org.eclipse.jface.text.BadLocationException;
+//import org.eclipse.jface.text.DefaultLineTracker;
+//import org.eclipse.jface.text.ILineTracker;
+//import org.eclipse.jface.text.IRegion;
 
 /**
  * Helper class to provide String manipulation functions not available in
@@ -109,23 +109,23 @@ public class Strings {
         * doesn't contain any leading tabs or spaces then the string itself is
         * returned.
         */
-       public static String trimLeadingTabsAndSpaces(String line) {
-               int size = line.length();
-               int start = size;
-               for (int i = 0; i < size; i++) {
-                       char c = line.charAt(i);
-                       if (!isIndentChar(c)) {
-                               start = i;
-                               break;
-                       }
-               }
-               if (start == 0)
-                       return line;
-               else if (start == size)
-                       return ""; //$NON-NLS-1$
-               else
-                       return line.substring(start);
-       }
+//     public static String trimLeadingTabsAndSpaces(String line) {
+//             int size = line.length();
+//             int start = size;
+//             for (int i = 0; i < size; i++) {
+//                     char c = line.charAt(i);
+//                     if (!isIndentChar(c)) {
+//                             start = i;
+//                             break;
+//                     }
+//             }
+//             if (start == 0)
+//                     return line;
+//             else if (start == size)
+//                     return ""; //$NON-NLS-1$
+//             else
+//                     return line.substring(start);
+//     }
 
 //     public static String trimTrailingTabsAndSpaces(String line) {
 //             int size = line.length();
@@ -327,39 +327,39 @@ public class Strings {
         * changed. (It is considered to have no indent as it might start in the
         * middle of a line)
         */
-       public static String changeIndent(String code, int codeIndentLevel,
-                       int tabWidth, String newIndent, String lineDelim) {
-               try {
-                       ILineTracker tracker = new DefaultLineTracker();
-                       tracker.set(code);
-                       int nLines = tracker.getNumberOfLines();
-                       if (nLines == 1) {
-                               return code;
-                       }
-
-                       StringBuffer buf = new StringBuffer();
-
-                       for (int i = 0; i < nLines; i++) {
-                               IRegion region = tracker.getLineInformation(i);
-                               int start = region.getOffset();
-                               int end = start + region.getLength();
-                               String line = code.substring(start, end);
-
-                               if (i == 0) { // no indent for first line (contained in the
-                                                               // formatted string)
-                                       buf.append(line);
-                               } else { // no new line after last line
-                                       buf.append(lineDelim);
-                                       buf.append(newIndent);
-                                       buf.append(trimIndent(line, codeIndentLevel, tabWidth));
-                               }
-                       }
-                       return buf.toString();
-               } catch (BadLocationException e) {
-                       // can not happen
-                       return code;
-               }
-       }
+//     public static String changeIndent(String code, int codeIndentLevel,
+//                     int tabWidth, String newIndent, String lineDelim) {
+//             try {
+//                     ILineTracker tracker = new DefaultLineTracker();
+//                     tracker.set(code);
+//                     int nLines = tracker.getNumberOfLines();
+//                     if (nLines == 1) {
+//                             return code;
+//                     }
+//
+//                     StringBuffer buf = new StringBuffer();
+//
+//                     for (int i = 0; i < nLines; i++) {
+//                             IRegion region = tracker.getLineInformation(i);
+//                             int start = region.getOffset();
+//                             int end = start + region.getLength();
+//                             String line = code.substring(start, end);
+//
+//                             if (i == 0) { // no indent for first line (contained in the
+//                                                             // formatted string)
+//                                     buf.append(line);
+//                             } else { // no new line after last line
+//                                     buf.append(lineDelim);
+//                                     buf.append(newIndent);
+//                                     buf.append(trimIndent(line, codeIndentLevel, tabWidth));
+//                             }
+//                     }
+//                     return buf.toString();
+//             } catch (BadLocationException e) {
+//                     // can not happen
+//                     return code;
+//             }
+//     }
 
        /**
         * Concatenate the given strings into one strings using the passed line
index 0d390cc..ba72251 100644 (file)
@@ -76,7 +76,7 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
+//import org.eclipse.core.runtime.Path;
 //import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Plugin;
 import org.eclipse.core.runtime.Status;
@@ -231,7 +231,7 @@ public class PHPeclipsePlugin extends /*AbstractUIPlugin*/Plugin implements
 
        /*private MembersOrderPreferenceCache fMembersOrderPreferenceCache;*/
 
-       private IFile fLastEditorFile = null;
+       //private IFile fLastEditorFile = null;
 
 /*     private JavaEditorTextHoverDescriptor[] fJavaEditorTextHoverDescriptors;*/
 
@@ -482,9 +482,9 @@ public class PHPeclipsePlugin extends /*AbstractUIPlugin*/Plugin implements
 //             return getDefault().internalGetImageDescriptorRegistry();
 //     }
 
-       static IPath getInstallLocation() {
-               return new Path(getDefault().getBundle().getEntry("/").getFile());
-       }
+//     static IPath getInstallLocation() {
+//             return new Path(getDefault().getBundle().getEntry("/").getFile());
+//     }
 
        // public static int getJVM() {
        // return jvm;
@@ -678,9 +678,9 @@ public class PHPeclipsePlugin extends /*AbstractUIPlugin*/Plugin implements
 //             return fJavaTextTools;
 //     }
 
-       public IFile getLastEditorFile() {
-               return fLastEditorFile;
-       }
+//     public IFile getLastEditorFile() {
+//             return fLastEditorFile;
+//     }
 
        /**
         * Returns the string from the plugin's resource bundle, or 'key' if not
@@ -933,7 +933,7 @@ public class PHPeclipsePlugin extends /*AbstractUIPlugin*/Plugin implements
 //     }
 
        public void setLastEditorFile(IFile textEditor) {
-               this.fLastEditorFile = textEditor;
+               //this.fLastEditorFile = textEditor;
        }
 
        /*