From 18fd4ccf916aa3039d0d74b6bc59b9aee5a00c00 Mon Sep 17 00:00:00 2001 From: incastrix Date: Wed, 23 Dec 2009 17:36:26 +0000 Subject: [PATCH] Refactory: remove unused classes, imports, fields and methods. --- .../corext/codemanipulation/GetterSetterUtil.java | 253 ------------------ .../corext/codemanipulation/StubUtility.java | 18 +- .../template/php/CodeTemplateContextType.java | 6 +- .../template/php/CompilationUnitContext.java | 6 +- .../phpdt/internal/ui/actions/ActionMessages.java | 14 +- .../internal/ui/actions/CompositeActionGroup.java | 2 +- .../internal/ui/actions/FoldingActionGroup.java | 2 +- .../phpdt/internal/ui/actions/OpenActionUtil.java | 32 ++-- .../internal/ui/actions/SelectionConverter.java | 158 ++++++------ .../ui/dialogs/ElementListSelectionDialog.java | 6 +- .../phpdt/internal/ui/dialogs/StatusDialog.java | 6 +- .../internal/ui/dnd/JdtViewerDropAdapter.java | 12 +- .../ui/phpdocexport/JavadocExportMessages.java | 14 +- .../preferences/CodeFormatterPreferencePage.java | 282 ++++++++++---------- .../ui/preferences/JavaPreferencesSettings.java | 64 ----- .../ui/preferences/OptionsConfigurationBlock.java | 106 ++++---- .../internal/ui/text/java/JavaHoverMessages.java | 68 +++--- .../ui/text/java/JavaReconcilingStrategy.java | 6 +- .../ui/text/java/hover/AnnotationHover.java | 8 +- .../ui/text/java/hover/BestMatchHover.java | 10 +- .../ui/text/java/hover/JavaHoverMessages.java | 44 ++-- .../java/hover/SourceViewerInformationControl.java | 6 +- .../ui/text/link/LinkedPositionManager.java | 84 +++--- .../ui/text/link/LinkedPositionMessages.java | 14 +- .../internal/ui/text/link/LinkedPositionUI.java | 6 +- .../internal/ui/text/link/ProposalPosition.java | 20 +- 26 files changed, 465 insertions(+), 782 deletions(-) delete mode 100644 net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/GetterSetterUtil.java delete mode 100644 net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/JavaPreferencesSettings.java diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/GetterSetterUtil.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/GetterSetterUtil.java deleted file mode 100644 index 2e95a36..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/GetterSetterUtil.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 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.codemanipulation; - -//import net.sourceforge.phpdt.core.Flags; -import net.sourceforge.phpdt.core.IField; -import net.sourceforge.phpdt.core.IJavaProject; -//import net.sourceforge.phpdt.core.IMethod; -//import net.sourceforge.phpdt.core.IType; -import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpdt.core.NamingConventions; -//import net.sourceforge.phpdt.core.Signature; -import net.sourceforge.phpdt.internal.corext.util.JavaModelUtil; -//import net.sourceforge.phpdt.internal.corext.util.JdtFlags; -//import net.sourceforge.phpdt.ui.CodeGeneration; -//import net.sourceforge.phpdt.ui.PreferenceConstants; - -//import org.eclipse.core.runtime.CoreException; - -public class GetterSetterUtil { - - private static final String[] EMPTY = new String[0]; - - // no instances - private GetterSetterUtil() { - } - -// public static String getGetterName(IField field, String[] excludedNames) -// throws JavaModelException { -// boolean useIs = PreferenceConstants.getPreferenceStore().getBoolean( -// PreferenceConstants.CODEGEN_IS_FOR_GETTERS); -// return getGetterName(field, excludedNames, useIs); -// } - -// private static String getGetterName(IField field, String[] excludedNames, -// boolean useIsForBoolGetters) throws JavaModelException { -// if (excludedNames == null) { -// excludedNames = EMPTY; -// } -// return getGetterName(field.getJavaProject(), field.getElementName(), -// field.getFlags(), useIsForBoolGetters -// && JavaModelUtil.isBoolean(field), excludedNames); -// } - - public static String getGetterName(IJavaProject project, String fieldName, - int flags, boolean isBoolean, String[] excludedNames) { - return NamingConventions.suggestGetterName(project, fieldName, flags, - isBoolean, excludedNames); - } - -// public static String getSetterName(IJavaProject project, String fieldName, -// int flags, boolean isBoolean, String[] excludedNames) { -// return NamingConventions.suggestSetterName(project, fieldName, flags, -// isBoolean, excludedNames); -// } - - public static String getSetterName(IField field, String[] excludedNames) - throws JavaModelException { - if (excludedNames == null) { - excludedNames = EMPTY; - } - return NamingConventions.suggestSetterName(field.getJavaProject(), - field.getElementName(), field.getFlags(), JavaModelUtil - .isBoolean(field), excludedNames); - } - -// public static IMethod getGetter(IField field) throws JavaModelException { -// IMethod primaryCandidate = JavaModelUtil.findMethod(getGetterName( -// field, EMPTY, true), new String[0], false, field -// .getDeclaringType()); -// if (!JavaModelUtil.isBoolean(field) -// || (primaryCandidate != null && primaryCandidate.exists())) -// return primaryCandidate; -// // bug 30906 describes why we need to look for other alternatives here -// String secondCandidateName = getGetterName(field, EMPTY, false); -// return JavaModelUtil.findMethod(secondCandidateName, new String[0], -// false, field.getDeclaringType()); -// } - -// public static IMethod getSetter(IField field) throws JavaModelException { -// String[] args = new String[] { field.getTypeSignature() }; -// return JavaModelUtil.findMethod(getSetterName(field, EMPTY), args, -// false, field.getDeclaringType()); -// } - - /** - * Create a stub for a getter of the given field using getter/setter - * templates. The resulting code has to be formatted and indented. - * - * @param field - * The field to create a getter for - * @param setterName - * The chosen name for the setter - * @param addComments - * If true, comments will be added. - * @param flags - * The flags signaling visibility, if static, synchronized or - * final - * @return Returns the generated stub. - * @throws CoreException - */ -// public static String getSetterStub(IField field, String setterName, -// boolean addComments, int flags) throws CoreException { -// -// String fieldName = field.getElementName(); -// IType parentType = field.getDeclaringType(); -// -// String returnSig = field.getTypeSignature(); -// String typeName = Signature.toString(returnSig); -// -// IJavaProject project = field.getJavaProject(); -// -// String accessorName = NamingConventions -// .removePrefixAndSuffixForFieldName(project, fieldName, field -// .getFlags()); -// String argname = StubUtility.suggestArgumentName(project, accessorName, -// EMPTY); -// -// boolean isStatic = Flags.isStatic(flags); -// // boolean isSync= Flags.isSynchronized(flags); -// boolean isFinal = Flags.isFinal(flags); -// -// // create the setter stub -// StringBuffer buf = new StringBuffer(); -// if (addComments) { -// String comment = CodeGeneration.getSetterComment(field -// .getCompilationUnit(), -// parentType.getTypeQualifiedName('.'), setterName, field -// .getElementName(), typeName, argname, accessorName, -// String.valueOf('\n')); -// if (comment != null) { -// buf.append(comment); -// buf.append('\n'); -// } -// } -// buf.append(JdtFlags.getVisibilityString(flags)); -// buf.append(' '); -// if (isStatic) -// buf.append("static "); //$NON-NLS-1$ -// // if (isSync) -// // buf.append("synchronized "); //$NON-NLS-1$ -// if (isFinal) -// buf.append("final "); //$NON-NLS-1$ -// -// buf.append("void "); //$NON-NLS-1$ -// buf.append(setterName); -// buf.append('('); -// buf.append(typeName); -// buf.append(' '); -// buf.append(argname); -// buf.append(") {\n"); //$NON-NLS-1$ -// -// boolean useThis = PreferenceConstants.getPreferenceStore().getBoolean( -// PreferenceConstants.CODEGEN_KEYWORD_THIS); -// if (argname.equals(fieldName) || (useThis && !isStatic)) { -// if (isStatic) -// fieldName = parentType.getElementName() + '.' + fieldName; -// else -// fieldName = "this." + fieldName; //$NON-NLS-1$ -// } -// String body = CodeGeneration.getSetterMethodBodyContent(field -// .getCompilationUnit(), parentType.getTypeQualifiedName('.'), -// setterName, fieldName, argname, String.valueOf('\n')); -// if (body != null) { -// buf.append(body); -// } -// buf.append("}\n"); //$NON-NLS-1$ -// return buf.toString(); -// } - - /** - * Create a stub for a getter of the given field using getter/setter - * templates. The resulting code has to be formatted and indented. - * - * @param field - * The field to create a getter for - * @param getterName - * The chosen name for the getter - * @param addComments - * If true, comments will be added. - * @param flags - * The flags signaling visibility, if static, synchronized or - * final - * @return Returns the generated stub. - * @throws CoreException - */ -// public static String getGetterStub(IField field, String getterName, -// boolean addComments, int flags) throws CoreException { -// String fieldName = field.getElementName(); -// IType parentType = field.getDeclaringType(); -// -// boolean isStatic = Flags.isStatic(flags); -// // boolean isSync= Flags.isSynchronized(flags); -// boolean isFinal = Flags.isFinal(flags); -// -// String typeName = Signature.toString(field.getTypeSignature()); -// String accessorName = NamingConventions -// .removePrefixAndSuffixForFieldName(field.getJavaProject(), -// fieldName, field.getFlags()); -// -// // create the getter stub -// StringBuffer buf = new StringBuffer(); -// if (addComments) { -// String comment = CodeGeneration.getGetterComment(field -// .getCompilationUnit(), -// parentType.getTypeQualifiedName('.'), getterName, field -// .getElementName(), typeName, accessorName, String -// .valueOf('\n')); -// if (comment != null) { -// buf.append(comment); -// buf.append('\n'); -// } -// } -// -// buf.append(JdtFlags.getVisibilityString(flags)); -// buf.append(' '); -// if (isStatic) -// buf.append("static "); //$NON-NLS-1$ -// // if (isSync) -// // buf.append("synchronized "); //$NON-NLS-1$ -// if (isFinal) -// buf.append("final "); //$NON-NLS-1$ -// -// buf.append(typeName); -// buf.append(' '); -// buf.append(getterName); -// buf.append("() {\n"); //$NON-NLS-1$ -// -// boolean useThis = PreferenceConstants.getPreferenceStore().getBoolean( -// PreferenceConstants.CODEGEN_KEYWORD_THIS); -// if (useThis && !isStatic) { -// fieldName = "this." + fieldName; //$NON-NLS-1$ -// } -// -// String body = CodeGeneration.getGetterMethodBodyContent(field -// .getCompilationUnit(), parentType.getTypeQualifiedName('.'), -// getterName, fieldName, String.valueOf('\n')); -// if (body != null) { -// buf.append(body); -// } -// buf.append("}\n"); //$NON-NLS-1$ -// return buf.toString(); -// } - -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/StubUtility.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/StubUtility.java index 1196951..2041355 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/StubUtility.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/StubUtility.java @@ -1355,15 +1355,15 @@ public class StubUtility { // .asList(new String[] { // "boolean", "byte", "char", "double", "float", "int", "long", "short" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ - public static String suggestArgumentName(IJavaProject project, - String baseName, String[] excluded) { - // String[] argnames= getArgumentNameSuggestions(project, baseName, 0, - // excluded); - // if (argnames.length > 0) { - // return argnames[0]; - // } - return baseName; - } +// public static String suggestArgumentName(IJavaProject project, +// String baseName, String[] excluded) { +// // String[] argnames= getArgumentNameSuggestions(project, baseName, 0, +// // excluded); +// // if (argnames.length > 0) { +// // return argnames[0]; +// // } +// return baseName; +// } // public static String[] suggestArgumentNames(IJavaProject project, // String[] paramNames) { diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplateContextType.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplateContextType.java index 12d7b28..67543bf 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplateContextType.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplateContextType.java @@ -459,9 +459,9 @@ public class CodeTemplateContextType extends TemplateContextType { * * @see net.sourceforge.phpdt.internal.corext.template.ContextType#createContext() */ - public TemplateContext createContext() { - return null; - } +// public TemplateContext createContext() { +// return null; +// } public static void registerContextTypes(ContextTypeRegistry registry) { registry.addContextType(new CodeTemplateContextType( diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitContext.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitContext.java index a7defad..17fcd57 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitContext.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitContext.java @@ -106,7 +106,7 @@ public abstract class CompilationUnitContext extends DocumentTemplateContext { * @param multiVariableGuess * The multiVariableGuess to set. */ - public void setMultiVariableGuess(MultiVariableGuess multiVariableGuess) { - fMultiVariableGuess = multiVariableGuess; - } +// public void setMultiVariableGuess(MultiVariableGuess multiVariableGuess) { +// fMultiVariableGuess = multiVariableGuess; +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/ActionMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/ActionMessages.java index 91d8132..2cbba05 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/ActionMessages.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/ActionMessages.java @@ -10,7 +10,7 @@ ******************************************************************************/ package net.sourceforge.phpdt.internal.ui.actions; -import java.text.MessageFormat; +//import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -67,9 +67,9 @@ public class ActionMessages { * the message argument * @return the string */ - public static String getFormattedString(String key, Object arg) { - return getFormattedString(key, new Object[] { arg }); - } +// public static String getFormattedString(String key, Object arg) { +// return getFormattedString(key, new Object[] { arg }); +// } /** * Returns the formatted resource string associated with the given key in @@ -83,7 +83,7 @@ public class ActionMessages { * the message arguments * @return the string */ - 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); +// } } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/CompositeActionGroup.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/CompositeActionGroup.java index 2b7979d..cf9969d 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/CompositeActionGroup.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/CompositeActionGroup.java @@ -29,7 +29,7 @@ public class CompositeActionGroup extends ActionGroup { setGroups(groups); } - protected void setGroups(ActionGroup[] groups) { + private void setGroups(ActionGroup[] groups) { Assert.isTrue(fGroups == null); Assert.isNotNull(groups); fGroups = groups; diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/FoldingActionGroup.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/FoldingActionGroup.java index 844fe84..2612bb0 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/FoldingActionGroup.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/FoldingActionGroup.java @@ -102,7 +102,7 @@ public class FoldingActionGroup extends ActionGroup { * * @return true if the group is enabled */ - protected boolean isEnabled() { + private boolean isEnabled() { return fViewer != null; } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/OpenActionUtil.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/OpenActionUtil.java index 02c7b6b..18d7855 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/OpenActionUtil.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/OpenActionUtil.java @@ -10,11 +10,11 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.ui.actions; -import java.util.ArrayList; -import java.util.List; +//import java.util.ArrayList; +//import java.util.List; import net.sourceforge.phpdt.core.IJavaElement; -import net.sourceforge.phpdt.core.ISourceReference; +//import net.sourceforge.phpdt.core.ISourceReference; import net.sourceforge.phpdt.core.JavaModelException; import net.sourceforge.phpdt.ui.JavaElementLabelProvider; import net.sourceforge.phpeclipse.phpeditor.EditorUtility; @@ -33,10 +33,10 @@ public class OpenActionUtil { /** * Opens the editor on the given element and subsequently selects it. */ - public static void open(Object element) throws JavaModelException, - PartInitException { - open(element, true); - } +// public static void open(Object element) throws JavaModelException, +// PartInitException { +// open(element, true); +// } /** * Opens the editor on the given element and subsequently selects it. @@ -52,15 +52,15 @@ public class OpenActionUtil { * Filters out source references from the given code resolve results. A * utility method that can be called by subclassers. */ - public static List filterResolveResults(IJavaElement[] codeResolveResults) { - int nResults = codeResolveResults.length; - List refs = new ArrayList(nResults); - for (int i = 0; i < nResults; i++) { - if (codeResolveResults[i] instanceof ISourceReference) - refs.add(codeResolveResults[i]); - } - return refs; - } +// public static List filterResolveResults(IJavaElement[] codeResolveResults) { +// int nResults = codeResolveResults.length; +// List refs = new ArrayList(nResults); +// for (int i = 0; i < nResults; i++) { +// if (codeResolveResults[i] instanceof ISourceReference) +// refs.add(codeResolveResults[i]); +// } +// return refs; +// } /** * Shows a dialog for resolving an ambigous java element. Utility method diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/SelectionConverter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/SelectionConverter.java index 7fb9328..21f7c26 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/SelectionConverter.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/SelectionConverter.java @@ -10,13 +10,13 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.ui.actions; -import java.util.Iterator; +//import java.util.Iterator; import net.sourceforge.phpdt.core.ICompilationUnit; import net.sourceforge.phpdt.core.IJavaElement; -import net.sourceforge.phpdt.core.IType; +//import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; +//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; import net.sourceforge.phpdt.ui.IWorkingCopyManager; //import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.PHPEditor; @@ -68,20 +68,20 @@ public class SelectionConverter { * An empty array is returned if one of the elements stored in the * structured selection is not of tupe IJavaElement */ - public static IJavaElement[] getElements(IStructuredSelection selection) { - if (!selection.isEmpty()) { - IJavaElement[] result = new IJavaElement[selection.size()]; - int i = 0; - for (Iterator iter = selection.iterator(); iter.hasNext(); i++) { - Object element = (Object) iter.next(); - if (!(element instanceof IJavaElement)) - return EMPTY_RESULT; - result[i] = (IJavaElement) element; - } - return result; - } - return EMPTY_RESULT; - } +// public static IJavaElement[] getElements(IStructuredSelection selection) { +// if (!selection.isEmpty()) { +// IJavaElement[] result = new IJavaElement[selection.size()]; +// int i = 0; +// for (Iterator iter = selection.iterator(); iter.hasNext(); i++) { +// Object element = (Object) iter.next(); +// if (!(element instanceof IJavaElement)) +// return EMPTY_RESULT; +// result[i] = (IJavaElement) element; +// } +// return result; +// } +// return EMPTY_RESULT; +// } public static boolean canOperateOn(PHPEditor editor) { if (editor == null) @@ -108,16 +108,16 @@ public class SelectionConverter { return result; } - public static IJavaElement[] codeResolveOrInputHandled(PHPEditor editor, - Shell shell, String title) { - try { - return codeResolveOrInput(editor); - } catch (JavaModelException e) { - ExceptionHandler.handle(e, shell, title, ActionMessages - .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$ - } - return null; - } +// public static IJavaElement[] codeResolveOrInputHandled(PHPEditor editor, +// Shell shell, String title) { +// try { +// return codeResolveOrInput(editor); +// } catch (JavaModelException e) { +// ExceptionHandler.handle(e, shell, title, ActionMessages +// .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$ +// } +// return null; +// } /** * Converts the text selection provided by the given editor a Java element @@ -139,16 +139,16 @@ public class SelectionConverter { return candidate; } - public static IJavaElement codeResolveOrInputHandled(PHPEditor editor, - Shell shell, String title, String message) { - try { - return codeResolveOrInput(editor, shell, title, message); - } catch (JavaModelException e) { - ExceptionHandler.handle(e, shell, title, ActionMessages - .getString("SelectionConverter.codeResolveOrInput_failed")); //$NON-NLS-1$ - } - return null; - } +// public static IJavaElement codeResolveOrInputHandled(PHPEditor editor, +// Shell shell, String title, String message) { +// try { +// return codeResolveOrInput(editor, shell, title, message); +// } catch (JavaModelException e) { +// ExceptionHandler.handle(e, shell, title, ActionMessages +// .getString("SelectionConverter.codeResolveOrInput_failed")); //$NON-NLS-1$ +// } +// return null; +// } public static IJavaElement[] codeResolve(PHPEditor editor) throws JavaModelException { @@ -161,29 +161,29 @@ public class SelectionConverter { * by asking the user if code reolve returned more than one result. If the * selection doesn't cover a Java element null is returned. */ - public static IJavaElement codeResolve(PHPEditor editor, Shell shell, - String title, String message) throws JavaModelException { - IJavaElement[] elements = codeResolve(editor); - if (elements == null || elements.length == 0) - return null; - IJavaElement candidate = elements[0]; - if (elements.length > 1) { - candidate = OpenActionUtil.selectJavaElement(elements, shell, - title, message); - } - return candidate; - } +// public static IJavaElement codeResolve(PHPEditor editor, Shell shell, +// String title, String message) throws JavaModelException { +// IJavaElement[] elements = codeResolve(editor); +// if (elements == null || elements.length == 0) +// return null; +// IJavaElement candidate = elements[0]; +// if (elements.length > 1) { +// candidate = OpenActionUtil.selectJavaElement(elements, shell, +// title, message); +// } +// return candidate; +// } - public static IJavaElement[] codeResolveHandled(PHPEditor editor, - Shell shell, String title) { - try { - return codeResolve(editor); - } catch (JavaModelException e) { - ExceptionHandler.handle(e, shell, title, ActionMessages - .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$ - } - return null; - } +// public static IJavaElement[] codeResolveHandled(PHPEditor editor, +// Shell shell, String title) { +// try { +// return codeResolve(editor); +// } catch (JavaModelException e) { +// ExceptionHandler.handle(e, shell, title, ActionMessages +// .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$ +// } +// return null; +// } public static IJavaElement getElementAtOffset(PHPEditor editor) throws JavaModelException { @@ -191,18 +191,18 @@ public class SelectionConverter { .getSelectionProvider().getSelection()); } - public static IType getTypeAtOffset(PHPEditor editor) - throws JavaModelException { - IJavaElement element = SelectionConverter.getElementAtOffset(editor); - IType type = (IType) element.getAncestor(IJavaElement.TYPE); - if (type == null) { - ICompilationUnit unit = SelectionConverter - .getInputAsCompilationUnit(editor); - if (unit != null) - type = unit.findPrimaryType(); - } - return type; - } +// public static IType getTypeAtOffset(PHPEditor editor) +// throws JavaModelException { +// IJavaElement element = SelectionConverter.getElementAtOffset(editor); +// IType type = (IType) element.getAncestor(IJavaElement.TYPE); +// if (type == null) { +// ICompilationUnit unit = SelectionConverter +// .getInputAsCompilationUnit(editor); +// if (unit != null) +// type = unit.findPrimaryType(); +// } +// return type; +// } public static IJavaElement getInput(PHPEditor editor) { if (editor == null) @@ -215,13 +215,13 @@ public class SelectionConverter { return manager.getWorkingCopy(input); } - public static ICompilationUnit getInputAsCompilationUnit(PHPEditor editor) { - Object editorInput = SelectionConverter.getInput(editor); - if (editorInput instanceof ICompilationUnit) - return (ICompilationUnit) editorInput; - else - return null; - } +// public static ICompilationUnit getInputAsCompilationUnit(PHPEditor editor) { +// Object editorInput = SelectionConverter.getInput(editor); +// if (editorInput instanceof ICompilationUnit) +// return (ICompilationUnit) editorInput; +// else +// return null; +// } private static IJavaElement[] codeResolve(IJavaElement input, ITextSelection selection) throws JavaModelException { diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dialogs/ElementListSelectionDialog.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dialogs/ElementListSelectionDialog.java index e8588c5..207fd6f 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dialogs/ElementListSelectionDialog.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dialogs/ElementListSelectionDialog.java @@ -34,9 +34,9 @@ public class ElementListSelectionDialog extends * @param elements * the elements of the list. */ - public void setElements(Object[] elements) { - fElements = elements; - } +// public void setElements(Object[] elements) { +// fElements = elements; +// } /* * @see SelectionStatusDialog#computeResult() diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dialogs/StatusDialog.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dialogs/StatusDialog.java index b58b7fb..752f1bf 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dialogs/StatusDialog.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dialogs/StatusDialog.java @@ -30,14 +30,14 @@ public abstract class StatusDialog extends Dialog { private Image fImage; - private boolean fStatusLineAboveButtons; + //private boolean fStatusLineAboveButtons; /** * Creates an instane of a status dialog. */ public StatusDialog(Shell parent) { super(parent); - fStatusLineAboveButtons = false; + //fStatusLineAboveButtons = false; } /** @@ -49,7 +49,7 @@ public abstract class StatusDialog extends Dialog { * false to the right */ public void setStatusLineAboveButtons(boolean aboveButtons) { - fStatusLineAboveButtons = aboveButtons; + //fStatusLineAboveButtons = aboveButtons; } /** diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dnd/JdtViewerDropAdapter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dnd/JdtViewerDropAdapter.java index 571857a..3840bc5 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dnd/JdtViewerDropAdapter.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/dnd/JdtViewerDropAdapter.java @@ -97,16 +97,16 @@ public class JdtViewerDropAdapter implements DropTargetListener { * true if the drop adapter is supposed to show * insertion feedback. Otherwise false */ - public void showInsertionFeedback(boolean showInsertionFeedback) { - fShowInsertionFeedback = showInsertionFeedback; - } +// public void showInsertionFeedback(boolean showInsertionFeedback) { +// fShowInsertionFeedback = showInsertionFeedback; +// } /** * Returns the viewer this adapter is working on. */ - protected StructuredViewer getViewer() { - return fViewer; - } +// protected StructuredViewer getViewer() { +// return fViewer; +// } // ---- Hooks to override // ----------------------------------------------------- diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/phpdocexport/JavadocExportMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/phpdocexport/JavadocExportMessages.java index b6a785b..4c42220 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/phpdocexport/JavadocExportMessages.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/phpdocexport/JavadocExportMessages.java @@ -10,7 +10,7 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.ui.phpdocexport; -import java.text.MessageFormat; +//import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -39,15 +39,15 @@ public class JavadocExportMessages { * @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); +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java index 8803804..f7fc07f 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java @@ -4,9 +4,9 @@ */ package net.sourceforge.phpdt.internal.ui.preferences; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; +//import java.io.BufferedReader; +//import java.io.IOException; +//import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Hashtable; @@ -14,20 +14,20 @@ import net.sourceforge.phpdt.core.ICodeFormatter; import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.ToolFactory; import net.sourceforge.phpdt.internal.ui.PHPUIMessages; -import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo; -import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil; +//import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo; +//import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil; import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout; //import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.ui.WebUI; -import org.eclipse.core.runtime.IStatus; +//import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.text.Document; +//import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; +//import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; +//import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -112,19 +112,19 @@ public class CodeFormatterPreferencePage extends PreferencePage implements * * @deprecated Inline to avoid reference to preference page */ - public static boolean isCompactingAssignment() { - return COMPACT.equals(JavaCore.getOptions().get( - PREF_STYLE_COMPACT_ASSIGNEMENT)); - } +// public static boolean isCompactingAssignment() { +// return COMPACT.equals(JavaCore.getOptions().get( +// PREF_STYLE_COMPACT_ASSIGNEMENT)); +// } /** * Gets the current compating assignement configuration * * @deprecated Inline to avoid reference to preference page */ - public static boolean useSpaces() { - return SPACE.equals(JavaCore.getOptions().get(PREF_TAB_CHAR)); - } +// public static boolean useSpaces() { +// return SPACE.equals(JavaCore.getOptions().get(PREF_TAB_CHAR)); +// } private static int getPositiveIntValue(String string, int dflt) { try { @@ -188,37 +188,37 @@ public class CodeFormatterPreferencePage extends PreferencePage implements // private SourceViewer fSourceViewer; - public CodeFormatterPreferencePage() { - setPreferenceStore(WebUI.getDefault().getPreferenceStore()); - setDescription(PHPUIMessages - .getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$ - - fWorkingValues = JavaCore.getOptions(); - fCheckBoxes = new ArrayList(); - fTextBoxes = new ArrayList(); - - fButtonSelectionListener = new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - } - - public void widgetSelected(SelectionEvent e) { - if (!e.widget.isDisposed()) { - controlChanged((Button) e.widget); - } - } - }; - - fTextModifyListener = new ModifyListener() { - public void modifyText(ModifyEvent e) { - if (!e.widget.isDisposed()) { - textChanged((Text) e.widget); - } - } - }; - - fPreviewDocument = new Document(); - fPreviewText = loadPreviewFile("CodeFormatterPreviewCode.txt"); //$NON-NLS-1$ - } +// public CodeFormatterPreferencePage() { +// setPreferenceStore(WebUI.getDefault().getPreferenceStore()); +// setDescription(PHPUIMessages +// .getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$ +// +// fWorkingValues = JavaCore.getOptions(); +// fCheckBoxes = new ArrayList(); +// fTextBoxes = new ArrayList(); +// +// fButtonSelectionListener = new SelectionListener() { +// public void widgetDefaultSelected(SelectionEvent e) { +// } +// +// public void widgetSelected(SelectionEvent e) { +// if (!e.widget.isDisposed()) { +// controlChanged((Button) e.widget); +// } +// } +// }; +// +// fTextModifyListener = new ModifyListener() { +// public void modifyText(ModifyEvent e) { +// if (!e.widget.isDisposed()) { +// textChanged((Text) e.widget); +// } +// } +// }; +// +// fPreviewDocument = new Document(); +// fPreviewText = loadPreviewFile("CodeFormatterPreviewCode.txt"); //$NON-NLS-1$ +// } /* * @see IWorkbenchPreferencePage#init() @@ -408,36 +408,36 @@ public class CodeFormatterPreferencePage extends PreferencePage implements return textBox; } - private void controlChanged(Button button) { - ControlData data = (ControlData) button.getData(); - boolean selection = button.getSelection(); - String newValue = data.getValue(selection); - fWorkingValues.put(data.getKey(), newValue); - updatePreview(); - - if (PREF_TAB_CHAR.equals(data.getKey())) { - updateStatus(new StatusInfo()); - if (selection) { - fTabSizeTextBox.setText((String) fWorkingValues - .get(PREF_TAB_SIZE)); - } - } - } - - private void textChanged(Text textControl) { - String key = (String) textControl.getData(); - String number = textControl.getText(); - IStatus status = validatePositiveNumber(number); - if (!status.matches(IStatus.ERROR)) { - fWorkingValues.put(key, number); - } - // if (PREF_TAB_SIZE.equals(key)) { - // fSourceViewer.getTextWidget().setTabs(getPositiveIntValue(number, - // 0)); - // } - updateStatus(status); - updatePreview(); - } +// private void controlChanged(Button button) { +// ControlData data = (ControlData) button.getData(); +// boolean selection = button.getSelection(); +// String newValue = data.getValue(selection); +// fWorkingValues.put(data.getKey(), newValue); +// updatePreview(); +// +// if (PREF_TAB_CHAR.equals(data.getKey())) { +// updateStatus(new StatusInfo()); +// if (selection) { +// fTabSizeTextBox.setText((String) fWorkingValues +// .get(PREF_TAB_SIZE)); +// } +// } +// } + +// private void textChanged(Text textControl) { +// String key = (String) textControl.getData(); +// String number = textControl.getText(); +// IStatus status = validatePositiveNumber(number); +// if (!status.matches(IStatus.ERROR)) { +// fWorkingValues.put(key, number); +// } +// // if (PREF_TAB_SIZE.equals(key)) { +// // fSourceViewer.getTextWidget().setTabs(getPositiveIntValue(number, +// // 0)); +// // } +// updateStatus(status); +// updatePreview(); +// } /* * @see IPreferencePage#performOk() @@ -466,30 +466,30 @@ public class CodeFormatterPreferencePage extends PreferencePage implements super.performDefaults(); } - private String loadPreviewFile(String filename) { - String separator = System.getProperty("line.separator"); //$NON-NLS-1$ - StringBuffer btxt = new StringBuffer(512); - BufferedReader rin = null; - try { - rin = new BufferedReader(new InputStreamReader(getClass() - .getResourceAsStream(filename))); - String line; - while ((line = rin.readLine()) != null) { - btxt.append(line); - btxt.append(separator); - } - } catch (IOException io) { - WebUI.log(io); - } finally { - if (rin != null) { - try { - rin.close(); - } catch (IOException e) { - } - } - } - return btxt.toString(); - } +// private String loadPreviewFile(String filename) { +// String separator = System.getProperty("line.separator"); //$NON-NLS-1$ +// StringBuffer btxt = new StringBuffer(512); +// BufferedReader rin = null; +// try { +// rin = new BufferedReader(new InputStreamReader(getClass() +// .getResourceAsStream(filename))); +// String line; +// while ((line = rin.readLine()) != null) { +// btxt.append(line); +// btxt.append(separator); +// } +// } catch (IOException io) { +// WebUI.log(io); +// } finally { +// if (rin != null) { +// try { +// rin.close(); +// } catch (IOException e) { +// } +// } +// } +// return btxt.toString(); +// } private void updatePreview() { ICodeFormatter formatter = ToolFactory @@ -514,45 +514,45 @@ public class CodeFormatterPreferencePage extends PreferencePage implements } } - private IStatus validatePositiveNumber(String number) { - StatusInfo status = new StatusInfo(); - if (number.length() == 0) { - status.setError(PHPUIMessages - .getString("CodeFormatterPreferencePage.empty_input")); //$NON-NLS-1$ - } else { - try { - int value = Integer.parseInt(number); - if (value < 0) { - status - .setError(PHPUIMessages - .getFormattedString( - "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$ - } - } catch (NumberFormatException e) { - status.setError(PHPUIMessages.getFormattedString( - "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$ - } - } - return status; - } - - private void updateStatus(IStatus status) { - if (!status.matches(IStatus.ERROR)) { - // look if there are more severe errors - for (int i = 0; i < fTextBoxes.size(); i++) { - Text curr = (Text) fTextBoxes.get(i); - if (!(curr == fTabSizeTextBox && usesTabs())) { - IStatus currStatus = validatePositiveNumber(curr.getText()); - status = StatusUtil.getMoreSevere(currStatus, status); - } - } - } - setValid(!status.matches(IStatus.ERROR)); - StatusUtil.applyToStatusLine(this, status); - } - - private boolean usesTabs() { - return TAB.equals(fWorkingValues.get(PREF_TAB_CHAR)); - } +// private IStatus validatePositiveNumber(String number) { +// StatusInfo status = new StatusInfo(); +// if (number.length() == 0) { +// status.setError(PHPUIMessages +// .getString("CodeFormatterPreferencePage.empty_input")); //$NON-NLS-1$ +// } else { +// try { +// int value = Integer.parseInt(number); +// if (value < 0) { +// status +// .setError(PHPUIMessages +// .getFormattedString( +// "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$ +// } +// } catch (NumberFormatException e) { +// status.setError(PHPUIMessages.getFormattedString( +// "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$ +// } +// } +// return status; +// } + +// private void updateStatus(IStatus status) { +// if (!status.matches(IStatus.ERROR)) { +// // look if there are more severe errors +// for (int i = 0; i < fTextBoxes.size(); i++) { +// Text curr = (Text) fTextBoxes.get(i); +// if (!(curr == fTabSizeTextBox && usesTabs())) { +// IStatus currStatus = validatePositiveNumber(curr.getText()); +// status = StatusUtil.getMoreSevere(currStatus, status); +// } +// } +// } +// setValid(!status.matches(IStatus.ERROR)); +// StatusUtil.applyToStatusLine(this, status); +// } + +// private boolean usesTabs() { +// return TAB.equals(fWorkingValues.get(PREF_TAB_CHAR)); +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/JavaPreferencesSettings.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/JavaPreferencesSettings.java deleted file mode 100644 index f827ba5..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/JavaPreferencesSettings.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 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.ui.preferences; - -//import java.util.StringTokenizer; - -import net.sourceforge.phpdt.internal.corext.codemanipulation.CodeGenerationSettings; -import net.sourceforge.phpdt.internal.corext.util.CodeFormatterUtil; -import net.sourceforge.phpdt.ui.PreferenceConstants; - -import org.eclipse.jface.preference.IPreferenceStore; - -public class JavaPreferencesSettings { - - public static CodeGenerationSettings getCodeGenerationSettings() { - IPreferenceStore store = PreferenceConstants.getPreferenceStore(); - - CodeGenerationSettings res = new CodeGenerationSettings(); - res.createComments = store - .getBoolean(PreferenceConstants.CODEGEN_ADD_COMMENTS); - res.useKeywordThis = store - .getBoolean(PreferenceConstants.CODEGEN_KEYWORD_THIS); - // res.importOrder= getImportOrderPreference(store); - res.importThreshold = getImportNumberThreshold(store); - res.tabWidth = CodeFormatterUtil.getTabWidth(); - return res; - } - - public static int getImportNumberThreshold(IPreferenceStore prefs) { - int threshold = prefs - .getInt(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD); - if (threshold < 0) { - threshold = Integer.MAX_VALUE; - } - return threshold; - } - - // public static String[] getImportOrderPreference(IPreferenceStore prefs) { - // String str= prefs.getString(PreferenceConstants.ORGIMPORTS_IMPORTORDER); - // if (str != null) { - // return unpackList(str, ";"); //$NON-NLS-1$ - // } - // return new String[0]; - // } - -// private static String[] unpackList(String str, String separator) { -// StringTokenizer tok = new StringTokenizer(str, separator); //$NON-NLS-1$ -// int nTokens = tok.countTokens(); -// String[] res = new String[nTokens]; -// for (int i = 0; i < nTokens; i++) { -// res[i] = tok.nextToken().trim(); -// } -// return res; -// } - -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/OptionsConfigurationBlock.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/OptionsConfigurationBlock.java index 4e22c99..48263fd 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/OptionsConfigurationBlock.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/OptionsConfigurationBlock.java @@ -41,7 +41,7 @@ import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; +//import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; @@ -274,39 +274,39 @@ public abstract class OptionsConfigurationBlock { return comboBox; } - protected void addInversedComboBox(Composite parent, String label, - String key, String[] values, String[] valueLabels, int indent) { - ControlData data = new ControlData(key, values); - - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); - gd.horizontalIndent = indent; - gd.horizontalSpan = 3; - - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.numColumns = 2; - composite.setLayout(layout); - composite.setLayoutData(gd); - - Combo comboBox = new Combo(composite, SWT.READ_ONLY); - comboBox.setItems(valueLabels); - comboBox.setData(data); - comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - comboBox.addSelectionListener(getSelectionListener()); - - Label labelControl = new Label(composite, SWT.LEFT | SWT.WRAP); - labelControl.setText(label); - labelControl.setLayoutData(new GridData()); - - fLabels.put(comboBox, labelControl); - - String currValue = (String) fWorkingValues.get(key); - comboBox.select(data.getSelection(currValue)); - - fComboBoxes.add(comboBox); - } +// protected void addInversedComboBox(Composite parent, String label, +// String key, String[] values, String[] valueLabels, int indent) { +// ControlData data = new ControlData(key, values); +// +// GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); +// gd.horizontalIndent = indent; +// gd.horizontalSpan = 3; +// +// Composite composite = new Composite(parent, SWT.NONE); +// GridLayout layout = new GridLayout(); +// layout.marginHeight = 0; +// layout.marginWidth = 0; +// layout.numColumns = 2; +// composite.setLayout(layout); +// composite.setLayoutData(gd); +// +// Combo comboBox = new Combo(composite, SWT.READ_ONLY); +// comboBox.setItems(valueLabels); +// comboBox.setData(data); +// comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); +// comboBox.addSelectionListener(getSelectionListener()); +// +// Label labelControl = new Label(composite, SWT.LEFT | SWT.WRAP); +// labelControl.setText(label); +// labelControl.setLayoutData(new GridData()); +// +// fLabels.put(comboBox, labelControl); +// +// String currValue = (String) fWorkingValues.get(key); +// comboBox.select(data.getSelection(currValue)); +// +// fComboBoxes.add(comboBox); +// } protected Text addTextField(Composite parent, String label, String key, int indent, int widthHint) { @@ -385,9 +385,9 @@ public abstract class OptionsConfigurationBlock { validateSettings(key, number); } - protected boolean checkValue(String key, String value) { - return value.equals(fWorkingValues.get(key)); - } +// protected boolean checkValue(String key, String value) { +// return value.equals(fWorkingValues.get(key)); +// } /* * (non-javadoc) Update fields and validate. @param changedKey Key that @@ -553,16 +553,16 @@ public abstract class OptionsConfigurationBlock { } } - protected Button getCheckBox(String key) { - for (int i = fCheckBoxes.size() - 1; i >= 0; i--) { - Button curr = (Button) fCheckBoxes.get(i); - ControlData data = (ControlData) curr.getData(); - if (key.equals(data.getKey())) { - return curr; - } - } - return null; - } +// protected Button getCheckBox(String key) { +// for (int i = fCheckBoxes.size() - 1; i >= 0; i--) { +// Button curr = (Button) fCheckBoxes.get(i); +// ControlData data = (ControlData) curr.getData(); +// if (key.equals(data.getKey())) { +// return curr; +// } +// } +// return null; +// } protected Combo getComboBox(String key) { for (int i = fComboBoxes.size() - 1; i >= 0; i--) { @@ -575,11 +575,11 @@ public abstract class OptionsConfigurationBlock { return null; } - protected void setComboEnabled(String key, boolean enabled) { - Combo combo = getComboBox(key); - Label label = (Label) fLabels.get(combo); - combo.setEnabled(enabled); - label.setEnabled(enabled); - } +// protected void setComboEnabled(String key, boolean enabled) { +// Combo combo = getComboBox(key); +// Label label = (Label) fLabels.get(combo); +// combo.setEnabled(enabled); +// label.setEnabled(enabled); +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/JavaHoverMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/JavaHoverMessages.java index bedafbc..05b9b36 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/JavaHoverMessages.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/JavaHoverMessages.java @@ -10,7 +10,7 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.ui.text.java; -import java.text.MessageFormat; +//import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -40,17 +40,17 @@ class JavaHoverMessages { * the string used to get the bundle value, must not be null * @since 3.0 */ - public static String getFormattedString(String key, Object arg) { - String format = null; - try { - format = fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ - } - if (arg == null) - arg = ""; //$NON-NLS-1$ - return MessageFormat.format(format, new Object[] { arg }); - } +// public static String getFormattedString(String key, Object arg) { +// String format = null; +// try { +// format = fgResourceBundle.getString(key); +// } catch (MissingResourceException e) { +// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ +// } +// if (arg == null) +// arg = ""; //$NON-NLS-1$ +// return MessageFormat.format(format, new Object[] { arg }); +// } /** * Gets a string from the resource bundle and formats it with the arguments @@ -59,19 +59,19 @@ class JavaHoverMessages { * the string used to get the bundle value, must not be null * @since 3.0 */ - public static String getFormattedString(String key, Object arg1, Object arg2) { - String format = null; - try { - format = fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ - } - if (arg1 == null) - arg1 = ""; //$NON-NLS-1$ - if (arg2 == null) - arg2 = ""; //$NON-NLS-1$ - return MessageFormat.format(format, new Object[] { arg1, arg2 }); - } +// public static String getFormattedString(String key, Object arg1, Object arg2) { +// String format = null; +// try { +// format = fgResourceBundle.getString(key); +// } catch (MissingResourceException e) { +// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ +// } +// if (arg1 == null) +// arg1 = ""; //$NON-NLS-1$ +// if (arg2 == null) +// arg2 = ""; //$NON-NLS-1$ +// return MessageFormat.format(format, new Object[] { arg1, arg2 }); +// } /** * Gets a string from the resource bundle and formats it with the argument @@ -80,13 +80,13 @@ class JavaHoverMessages { * the string used to get the bundle value, must not be null * @since 3.0 */ - public static String getFormattedString(String key, boolean arg) { - String format = null; - try { - format = fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ - } - return MessageFormat.format(format, new Object[] { new Boolean(arg) }); - } +// public static String getFormattedString(String key, boolean arg) { +// String format = null; +// try { +// format = fgResourceBundle.getString(key); +// } catch (MissingResourceException e) { +// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ +// } +// return MessageFormat.format(format, new Object[] { new Boolean(arg) }); +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/JavaReconcilingStrategy.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/JavaReconcilingStrategy.java index 7f91e31..9642c6f 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/JavaReconcilingStrategy.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/JavaReconcilingStrategy.java @@ -192,9 +192,9 @@ public class JavaReconcilingStrategy implements IReconcilingStrategy, * @param notify * true if participant should be notified */ - public void notifyParticipants(boolean notify) { - fNotify = notify; - } +// public void notifyParticipants(boolean notify) { +// fNotify = notify; +// } /** * Tells this strategy whether to inform its listeners. diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AnnotationHover.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AnnotationHover.java index d18653e..23c07b9 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AnnotationHover.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AnnotationHover.java @@ -14,7 +14,7 @@ package net.sourceforge.phpdt.internal.ui.text.java.hover; import java.util.Iterator; import net.sourceforge.phpdt.internal.ui.text.HTMLPrinter; -import net.sourceforge.phpdt.ui.PreferenceConstants; +//import net.sourceforge.phpdt.ui.PreferenceConstants; //import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.JavaAnnotationIterator; import net.sourceforge.phpeclipse.phpeditor.PHPTextHover; @@ -154,7 +154,7 @@ public class AnnotationHover extends AbstractJavaEditorTextHover { .getAnnotationPreference(annotation); } - static boolean isJavaProblemHover(String id) { - return PreferenceConstants.ID_PROBLEM_HOVER.equals(id); - } +// static boolean isJavaProblemHover(String id) { +// return PreferenceConstants.ID_PROBLEM_HOVER.equals(id); +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/BestMatchHover.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/BestMatchHover.java index 97b1b75..44c629f 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/BestMatchHover.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/BestMatchHover.java @@ -25,7 +25,7 @@ import org.eclipse.jface.text.ITextHover; import org.eclipse.jface.text.ITextHoverExtension; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.information.IInformationProviderExtension2; -import org.eclipse.ui.IEditorPart; +//import org.eclipse.ui.IEditorPart; /** * Caution: this implementation is a layer breaker and contains some "shortcuts" @@ -43,10 +43,10 @@ public class BestMatchHover extends AbstractJavaEditorTextHover implements installTextHovers(); } - public BestMatchHover(IEditorPart editor) { - this(); - setEditor(editor); - } +// public BestMatchHover(IEditorPart editor) { +// this(); +// setEditor(editor); +// } /** * Installs all text hovers. diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaHoverMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaHoverMessages.java index 3582118..2f38786 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaHoverMessages.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaHoverMessages.java @@ -58,19 +58,19 @@ class JavaHoverMessages { * the string used to get the bundle value, must not be null * @since 3.0 */ - public static String getFormattedString(String key, Object arg1, Object arg2) { - String format = null; - try { - format = fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ - } - if (arg1 == null) - arg1 = ""; //$NON-NLS-1$ - if (arg2 == null) - arg2 = ""; //$NON-NLS-1$ - return MessageFormat.format(format, new Object[] { arg1, arg2 }); - } +// public static String getFormattedString(String key, Object arg1, Object arg2) { +// String format = null; +// try { +// format = fgResourceBundle.getString(key); +// } catch (MissingResourceException e) { +// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ +// } +// if (arg1 == null) +// arg1 = ""; //$NON-NLS-1$ +// if (arg2 == null) +// arg2 = ""; //$NON-NLS-1$ +// return MessageFormat.format(format, new Object[] { arg1, arg2 }); +// } /** * Gets a string from the resource bundle and formats it with the argument @@ -79,13 +79,13 @@ class JavaHoverMessages { * the string used to get the bundle value, must not be null * @since 3.0 */ - public static String getFormattedString(String key, boolean arg) { - String format = null; - try { - format = fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ - } - return MessageFormat.format(format, new Object[] { new Boolean(arg) }); - } +// public static String getFormattedString(String key, boolean arg) { +// String format = null; +// try { +// format = fgResourceBundle.getString(key); +// } catch (MissingResourceException e) { +// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ +// } +// return MessageFormat.format(format, new Object[] { new Boolean(arg) }); +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/SourceViewerInformationControl.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/SourceViewerInformationControl.java index d2760fc..9ec2472 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/SourceViewerInformationControl.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/SourceViewerInformationControl.java @@ -272,9 +272,9 @@ public class SourceViewerInformationControl implements IInformationControl, * null if the status field should be hidden * @since 3.0 */ - public SourceViewerInformationControl(Shell parent, String statusFieldText) { - this(parent, SWT.NONE, statusFieldText); - } +// public SourceViewerInformationControl(Shell parent, String statusFieldText) { +// this(parent, SWT.NONE, statusFieldText); +// } /* * @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object) diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionManager.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionManager.java index 333a11c..56b2f29 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionManager.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionManager.java @@ -34,7 +34,7 @@ import org.eclipse.jface.text.IDocumentListener; import org.eclipse.jface.text.IPositionUpdater; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.TypedPosition; -import org.eclipse.jface.text.contentassist.ICompletionProposal; +//import org.eclipse.jface.text.contentassist.ICompletionProposal; /** * This class manages linked positions in a document. Positions are linked by @@ -268,12 +268,12 @@ public class LinkedPositionManager implements IDocumentListener, * a number of additional choices to be displayed when selecting * a position of this type. */ - public void addPosition(int offset, int length, - ICompletionProposal[] additionalChoices) - throws BadLocationException { - String type = fDocument.get(offset, length); - addPosition(offset, length, type, additionalChoices); - } +// public void addPosition(int offset, int length, +// ICompletionProposal[] additionalChoices) +// throws BadLocationException { +// String type = fDocument.get(offset, length); +// addPosition(offset, length, type, additionalChoices); +// } /** * Adds a linked position of the specified position type to the manager. @@ -301,41 +301,41 @@ public class LinkedPositionManager implements IDocumentListener, * a number of additional choices to be displayed when selecting * a position of this type. */ - public void addPosition(int offset, int length, String type, - ICompletionProposal[] additionalChoices) - throws BadLocationException { - Position[] positions = getPositions(fDocument); - - if (positions != null) { - for (int i = 0; i < positions.length; i++) - if (collides(positions[i], offset, length)) - throw new BadLocationException( - LinkedPositionMessages - .getString(("LinkedPositionManager.error.position.collision"))); //$NON-NLS-1$ - } - - String content = fDocument.get(offset, length); - - if (containsLineDelimiters(content)) - throw new BadLocationException( - LinkedPositionMessages - .getString(("LinkedPositionManager.error.contains.line.delimiters"))); //$NON-NLS-1$ - - try { - fDocument.addPosition(fPositionCategoryName, new ProposalPosition( - offset, length, type, additionalChoices)); - } catch (BadPositionCategoryException e) { - WebUI.log(e); - Assert.isTrue(false); - } - } +// public void addPosition(int offset, int length, String type, +// ICompletionProposal[] additionalChoices) +// throws BadLocationException { +// Position[] positions = getPositions(fDocument); +// +// if (positions != null) { +// for (int i = 0; i < positions.length; i++) +// if (collides(positions[i], offset, length)) +// throw new BadLocationException( +// LinkedPositionMessages +// .getString(("LinkedPositionManager.error.position.collision"))); //$NON-NLS-1$ +// } +// +// String content = fDocument.get(offset, length); +// +// if (containsLineDelimiters(content)) +// throw new BadLocationException( +// LinkedPositionMessages +// .getString(("LinkedPositionManager.error.contains.line.delimiters"))); //$NON-NLS-1$ +// +// try { +// fDocument.addPosition(fPositionCategoryName, new ProposalPosition( +// offset, length, type, additionalChoices)); +// } catch (BadPositionCategoryException e) { +// WebUI.log(e); +// Assert.isTrue(false); +// } +// } /** * Tests if a manager is already active for a document. */ - public static boolean hasActiveManager(IDocument document) { - return fgActiveManagers.get(document) != null; - } +// public static boolean hasActiveManager(IDocument document) { +// return fgActiveManagers.get(document) != null; +// } private void install(boolean canCoexist) { @@ -548,10 +548,10 @@ public class LinkedPositionManager implements IDocumentListener, + position.getLength()); } - public static boolean excludes(Position position, int offset, int length) { - return (offset + length <= position.getOffset()) - || (position.getOffset() + position.getLength() <= offset); - } +// public static boolean excludes(Position position, int offset, int length) { +// return (offset + length <= position.getOffset()) +// || (position.getOffset() + position.getLength() <= offset); +// } /* * Collides if spacing if positions intersect each other or are adjacent. diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionMessages.java index decf492..71c3e5d 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionMessages.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionMessages.java @@ -4,7 +4,7 @@ */ package net.sourceforge.phpdt.internal.ui.text.link; -import java.text.MessageFormat; +//import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -33,14 +33,14 @@ public class LinkedPositionMessages { * @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); +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java index 696fb61..d9e63ed 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java @@ -225,9 +225,9 @@ public class LinkedPositionUI implements ILinkedPositionListener, * * @param offset */ - public void setInitialOffset(int offset) { - fInitialOffset = offset; - } +// public void setInitialOffset(int offset) { +// fInitialOffset = offset; +// } /** * Sets the final position of the caret when the linked mode is exited diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/ProposalPosition.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/ProposalPosition.java index 4996443..b265de9 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/ProposalPosition.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/link/ProposalPosition.java @@ -55,18 +55,18 @@ public class ProposalPosition extends TypedPosition { * @return an array of choices, including the initial one. Clients must not * modify it. */ - public ICompletionProposal[] getChoices() { - updateChoicePositions(); - return fChoices; - } +// public ICompletionProposal[] getChoices() { +// updateChoicePositions(); +// return fChoices; +// } /** * */ - private void updateChoicePositions() { - for (int i = 0; i < fChoices.length; i++) { - // if (fChoices[i] instanceof JavaCompletionProposal) - // ((JavaCompletionProposal)fChoices[i]).setReplacementOffset(offset); - } - } +// private void updateChoicePositions() { +// for (int i = 0; i < fChoices.length; i++) { +// // if (fChoices[i] instanceof JavaCompletionProposal) +// // ((JavaCompletionProposal)fChoices[i]).setReplacementOffset(offset); +// } +// } } -- 1.7.1