From: incastrix Date: Mon, 12 Oct 2009 18:20:47 +0000 (+0000) Subject: Refactory: remove unused classes, imports, fields and methods. X-Git-Url: http://git.phpeclipse.com Refactory: remove unused classes, imports, fields and methods. --- diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java index efd1b93..31224b3 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java @@ -32,7 +32,7 @@ import org.eclipse.jface.text.ITextHoverExtension; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWT; +//import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IPartListener; diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java index 26ea209..836c07e 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java @@ -103,7 +103,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // IDocument document = ((ITextEditor) editorPart) // .getDocumentProvider().getDocument(editorInput); int lineNumber = textSelection.getStartLine() + 1; - int offset = textSelection.getOffset(); + //int offset = textSelection.getOffset(); try { // if (type == null) { // IClassFile classFile= diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/ExternalPHPParser.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/ExternalPHPParser.java index 7329758..f5f9fdb 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/ExternalPHPParser.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/ExternalPHPParser.java @@ -280,35 +280,35 @@ public class ExternalPHPParser { * @throws CoreException * an exception throwed by the MarkerUtilities */ - private void setMarker(final IFile file, final String message, - final int charStart, final int charEnd, final int errorLevel, - final String location) throws CoreException { - if (file != null) { - final Hashtable attributes = new Hashtable(); - MarkerUtilities.setMessage(attributes, message); - switch (errorLevel) { - case ERROR: - attributes.put(IMarker.SEVERITY, new Integer( - IMarker.SEVERITY_ERROR)); - break; - case WARNING: - attributes.put(IMarker.SEVERITY, new Integer( - IMarker.SEVERITY_WARNING)); - break; - case INFO: - attributes.put(IMarker.SEVERITY, new Integer( - IMarker.SEVERITY_INFO)); - break; - case TASK: - attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK)); - break; - } - attributes.put(IMarker.LOCATION, location); - MarkerUtilities.setCharStart(attributes, charStart); - MarkerUtilities.setCharEnd(attributes, charEnd); - MarkerUtilities.createMarker(file, attributes, PROBLEM_ID); // IMarker.PROBLEM); - } - } +// private void setMarker(final IFile file, final String message, +// final int charStart, final int charEnd, final int errorLevel, +// final String location) throws CoreException { +// if (file != null) { +// final Hashtable attributes = new Hashtable(); +// MarkerUtilities.setMessage(attributes, message); +// switch (errorLevel) { +// case ERROR: +// attributes.put(IMarker.SEVERITY, new Integer( +// IMarker.SEVERITY_ERROR)); +// break; +// case WARNING: +// attributes.put(IMarker.SEVERITY, new Integer( +// IMarker.SEVERITY_WARNING)); +// break; +// case INFO: +// attributes.put(IMarker.SEVERITY, new Integer( +// IMarker.SEVERITY_INFO)); +// break; +// case TASK: +// attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK)); +// break; +// } +// attributes.put(IMarker.LOCATION, location); +// MarkerUtilities.setCharStart(attributes, charStart); +// MarkerUtilities.setCharEnd(attributes, charEnd); +// MarkerUtilities.createMarker(file, attributes, PROBLEM_ID); // IMarker.PROBLEM); +// } +// } private String getParserOutput(String command, String consoleMessage) { try { diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/PHPConsole.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/PHPConsole.java index a5f1820..8e74c17 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/PHPConsole.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/PHPConsole.java @@ -14,10 +14,10 @@ public class PHPConsole { private MessageConsoleStream stream; - private boolean hasMessages; + //private boolean hasMessages; public PHPConsole() { - hasMessages = false; + //hasMessages = false; myConsole = new MessageConsole("PHPeclipse Console", null); ConsolePlugin.getDefault().getConsoleManager().addConsoles( new IConsole[] { myConsole }); @@ -55,7 +55,7 @@ public class PHPConsole { * @param message */ public void print(String message) { - hasMessages = true; + //hasMessages = true; stream.print(message); } @@ -63,7 +63,7 @@ public class PHPConsole { * */ public void println() { - hasMessages = true; + //hasMessages = true; stream.println(); } @@ -71,7 +71,7 @@ public class PHPConsole { * @param message */ public void println(String message) { - hasMessages = true; + //hasMessages = true; stream.println(message); } diff --git a/net.sourceforge.phpeclipse.launching/META-INF/MANIFEST.MF b/net.sourceforge.phpeclipse.launching/META-INF/MANIFEST.MF index bf16a64..378796f 100644 --- a/net.sourceforge.phpeclipse.launching/META-INF/MANIFEST.MF +++ b/net.sourceforge.phpeclipse.launching/META-INF/MANIFEST.MF @@ -11,7 +11,6 @@ Export-Package: net.sourceforge.phpdt.internal.launching;x-internal:=true Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui, org.eclipse.jface.text, - org.eclipse.ui.workbench.texteditor, net.sourceforge.phpeclipse, net.sourceforge.phpeclipse.debug.core, org.eclipse.debug.ui, diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/ConsoleLineTracker.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/ConsoleLineTracker.java index 830e02c..56d2081 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/ConsoleLineTracker.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/ConsoleLineTracker.java @@ -1,94 +1,94 @@ package net.sourceforge.phpdt.internal.launching; -import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpeclipse.phpeditor.EditorUtility; +//import net.sourceforge.phpdt.core.JavaModelException; +//import net.sourceforge.phpeclipse.phpeditor.EditorUtility; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; +//import org.eclipse.core.resources.IFile; +//import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.debug.ui.console.IConsole; import org.eclipse.debug.ui.console.IConsoleLineTracker; import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; +//import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.texteditor.ITextEditor; +//import org.eclipse.ui.IEditorPart; +//import org.eclipse.ui.PartInitException; +//import org.eclipse.ui.texteditor.ITextEditor; public class ConsoleLineTracker implements IConsoleLineTracker { - private static class JavadocConsoleHyperLink /* - * TODO XXX Disabled for 3.1 - * implements - * IConsoleHyperlink - */{ - - private IPath fExternalPath; - - private int fLineNumber; - - public JavadocConsoleHyperLink(IPath externalPath, int lineNumber) { - fExternalPath = externalPath; - fLineNumber = lineNumber; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkEntered() - */ - public void linkEntered() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkExited() - */ - public void linkExited() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkActivated() - */ - public void linkActivated() { - try { - IFile[] files = ResourcesPlugin.getWorkspace().getRoot() - .findFilesForLocation(fExternalPath); - if (files.length > 0) { - for (int i = 0; i < files.length; i++) { - IFile curr = files[0]; - IEditorPart part = EditorUtility.openInEditor(curr, - true); - if (part != null) { - if (part instanceof ITextEditor) { - revealLine((ITextEditor) part, fLineNumber); - } - return; - } - } - } - } catch (BadLocationException e) { - PHPLaunchingPlugin.log(e); - } catch (PartInitException e) { - PHPLaunchingPlugin.log(e); - } catch (JavaModelException e) { - PHPLaunchingPlugin.log(e); - } - } - - private void revealLine(ITextEditor editor, int lineNumber) - throws BadLocationException { - IDocument document = editor.getDocumentProvider().getDocument( - editor.getEditorInput()); - IRegion region = document.getLineInformation(lineNumber - 1); - editor.selectAndReveal(region.getOffset(), 0); - } - - } +// private static class JavadocConsoleHyperLink /* +// * TODO XXX Disabled for 3.1 +// * implements +// * IConsoleHyperlink +// */{ +// +// private IPath fExternalPath; +// +// private int fLineNumber; +// +// public JavadocConsoleHyperLink(IPath externalPath, int lineNumber) { +// fExternalPath = externalPath; +// fLineNumber = lineNumber; +// } +// +// /* +// * (non-Javadoc) +// * +// * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkEntered() +// */ +// public void linkEntered() { +// } +// +// /* +// * (non-Javadoc) +// * +// * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkExited() +// */ +// public void linkExited() { +// } +// +// /* +// * (non-Javadoc) +// * +// * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkActivated() +// */ +// public void linkActivated() { +// try { +// IFile[] files = ResourcesPlugin.getWorkspace().getRoot() +// .findFilesForLocation(fExternalPath); +// if (files.length > 0) { +// for (int i = 0; i < files.length; i++) { +// IFile curr = files[0]; +// IEditorPart part = EditorUtility.openInEditor(curr, +// true); +// if (part != null) { +// if (part instanceof ITextEditor) { +// revealLine((ITextEditor) part, fLineNumber); +// } +// return; +// } +// } +// } +// } catch (BadLocationException e) { +// PHPLaunchingPlugin.log(e); +// } catch (PartInitException e) { +// PHPLaunchingPlugin.log(e); +// } catch (JavaModelException e) { +// PHPLaunchingPlugin.log(e); +// } +// } +// +// private void revealLine(ITextEditor editor, int lineNumber) +// throws BadLocationException { +// IDocument document = editor.getDocumentProvider().getDocument( +// editor.getEditorInput()); +// IRegion region = document.getLineInformation(lineNumber - 1); +// editor.selectAndReveal(region.getOffset(), 0); +// } +// +// } private IConsole fConsole; diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationDialog.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationDialog.java index 70effbe..13b7844 100644 --- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationDialog.java +++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationDialog.java @@ -43,9 +43,9 @@ public class ConfigurationDialog extends Dialog { private Button okButton; - private Text fName; + //private Text fName; - private Text fUrl; + //private Text fUrl; // private Text fPassword; @@ -168,13 +168,13 @@ public class ConfigurationDialog extends Dialog { // WorkbenchHelp.setHelp(composite, ContextIds.PREF_DIALOG); createLabel(composite, PHPHelpPlugin.getResource("%name")); - fName = createText(composite, fConfiguration.getName() + "", - new StringModifyListener() { - public void valueChanged(String name) { - fConfiguration.setName(name); - validateFields(); - } - }); +// fName = createText(composite, fConfiguration.getName() + "", +// new StringModifyListener() { +// public void valueChanged(String name) { +// fConfiguration.setName(name); +// validateFields(); +// } +// }); Group group = new Group(composite, SWT.NONE); GridLayout layout = new GridLayout(2, false); @@ -225,13 +225,13 @@ public class ConfigurationDialog extends Dialog { // }); createLabel(group, PHPHelpPlugin.getResource("%url")); - fUrl = createText(group, fConfiguration.getURL(), - new StringModifyListener() { - public void valueChanged(String s) { - fConfiguration.setURL(s); - validateFields(); - } - }); +// fUrl = createText(group, fConfiguration.getURL(), +// new StringModifyListener() { +// public void valueChanged(String s) { +// fConfiguration.setURL(s); +// validateFields(); +// } +// }); createLabel(group, PHPHelpPlugin.getResource("%parseType")); createTypeCombo(group, PHPHelpPlugin.getTypes(), fConfiguration diff --git a/net.sourceforge.phpeclipse.smarty.ui/META-INF/MANIFEST.MF b/net.sourceforge.phpeclipse.smarty.ui/META-INF/MANIFEST.MF index 0b2d011..b1a0c73 100644 --- a/net.sourceforge.phpeclipse.smarty.ui/META-INF/MANIFEST.MF +++ b/net.sourceforge.phpeclipse.smarty.ui/META-INF/MANIFEST.MF @@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.jface.text, net.sourceforge.phpeclipse.ui, org.eclipse.ui.editors;bundle-version="3.4.0", - org.eclipse.core.resources;bundle-version="3.4.1", org.eclipse.core.runtime;bundle-version="3.4.0", org.eclipse.ui.ide Bundle-RequiredExecutionEnvironment: J2SE-1.4 diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.java index b308d22..c127e33 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/CodeGenerationMessages.java @@ -10,7 +10,7 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.corext.codemanipulation; -import java.text.MessageFormat; +//import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -39,15 +39,15 @@ public class CodeGenerationMessages { * @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/corext/codemanipulation/GetterSetterUtil.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/codemanipulation/GetterSetterUtil.java index 2ac2194..2e95a36 100644 --- 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 @@ -10,20 +10,20 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.corext.codemanipulation; -import net.sourceforge.phpdt.core.Flags; +//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.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.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 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; +//import org.eclipse.core.runtime.CoreException; public class GetterSetterUtil { @@ -33,22 +33,22 @@ public class GetterSetterUtil { 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(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) { @@ -56,11 +56,11 @@ public class GetterSetterUtil { 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(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 { @@ -72,24 +72,24 @@ public class GetterSetterUtil { .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()); - } +// 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 @@ -107,74 +107,74 @@ public class GetterSetterUtil { * @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(); - } +// 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 @@ -192,62 +192,62 @@ public class GetterSetterUtil { * @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(); - } +// 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 e7731df..1196951 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 @@ -7,13 +7,13 @@ package net.sourceforge.phpdt.internal.corext.codemanipulation; //import java.util.Arrays; //import java.util.Comparator; //import java.util.List; -import java.util.StringTokenizer; +//import java.util.StringTokenizer; -import net.sourceforge.phpdt.core.Flags; -import net.sourceforge.phpdt.core.IBuffer; +//import net.sourceforge.phpdt.core.Flags; +//import net.sourceforge.phpdt.core.IBuffer; import net.sourceforge.phpdt.core.ICodeFormatter; import net.sourceforge.phpdt.core.ICompilationUnit; -import net.sourceforge.phpdt.core.IJavaElement; +//import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IMethod; import net.sourceforge.phpdt.core.IPackageFragment; @@ -41,7 +41,7 @@ import org.eclipse.jface.text.templates.Template; import org.eclipse.jface.text.templates.TemplateBuffer; import org.eclipse.jface.text.templates.TemplateException; import org.eclipse.jface.text.templates.TemplateVariable; -import org.eclipse.swt.SWT; +//import org.eclipse.swt.SWT; public class StubUtility { @@ -85,58 +85,58 @@ public class StubUtility { * type names are qualified. * @throws JavaModelException */ - public static String genStub(ICompilationUnit cu, String destTypeName, - IMethod method, IType definingType, GenStubSettings settings) - throws CoreException { - // IImportsStructure imports) throws CoreException { - String methName = method.getElementName(); - String[] paramNames = suggestArgumentNames(method.getJavaProject(), - method.getParameterNames()); - String returnType = method.isConstructor() ? null : method - .getReturnType(); - String lineDelimiter = String.valueOf('\n'); // reformatting required - - StringBuffer buf = new StringBuffer(); - // add method comment - if (settings.createComments && cu != null) { - IMethod overridden = null; - if (settings.methodOverwrites && returnType != null) { - overridden = JavaModelUtil.findMethod(methName, method - .getParameterTypes(), false, definingType.getMethods()); - } - String comment = getMethodComment(cu, destTypeName, methName, - paramNames, method.getExceptionTypes(), returnType, - overridden, lineDelimiter); - if (comment != null) { - buf.append(comment); - } else { - buf.append("/**").append(lineDelimiter); //$NON-NLS-1$ - buf.append(" *").append(lineDelimiter); //$NON-NLS-1$ - buf.append(" */").append(lineDelimiter); //$NON-NLS-1$ - } - buf.append(lineDelimiter); - } - // add method declaration - String bodyContent = null; - if (!settings.noBody) { - String bodyStatement = getDefaultMethodBodyStatement(methName, - paramNames, returnType, settings.callSuper); - bodyContent = getMethodBodyContent(returnType == null, method - .getJavaProject(), destTypeName, methName, bodyStatement, - lineDelimiter); - if (bodyContent == null) { - bodyContent = ""; //$NON-NLS-1$ - } - } - int flags = settings.methodModifiers; - if (flags == -1) { - flags = method.getFlags(); - } - - genMethodDeclaration(destTypeName, method, flags, bodyContent, buf); // imports, - // buf); - return buf.toString(); - } +// public static String genStub(ICompilationUnit cu, String destTypeName, +// IMethod method, IType definingType, GenStubSettings settings) +// throws CoreException { +// // IImportsStructure imports) throws CoreException { +// String methName = method.getElementName(); +// String[] paramNames = suggestArgumentNames(method.getJavaProject(), +// method.getParameterNames()); +// String returnType = method.isConstructor() ? null : method +// .getReturnType(); +// String lineDelimiter = String.valueOf('\n'); // reformatting required +// +// StringBuffer buf = new StringBuffer(); +// // add method comment +// if (settings.createComments && cu != null) { +// IMethod overridden = null; +// if (settings.methodOverwrites && returnType != null) { +// overridden = JavaModelUtil.findMethod(methName, method +// .getParameterTypes(), false, definingType.getMethods()); +// } +// String comment = getMethodComment(cu, destTypeName, methName, +// paramNames, method.getExceptionTypes(), returnType, +// overridden, lineDelimiter); +// if (comment != null) { +// buf.append(comment); +// } else { +// buf.append("/**").append(lineDelimiter); //$NON-NLS-1$ +// buf.append(" *").append(lineDelimiter); //$NON-NLS-1$ +// buf.append(" */").append(lineDelimiter); //$NON-NLS-1$ +// } +// buf.append(lineDelimiter); +// } +// // add method declaration +// String bodyContent = null; +// if (!settings.noBody) { +// String bodyStatement = getDefaultMethodBodyStatement(methName, +// paramNames, returnType, settings.callSuper); +// bodyContent = getMethodBodyContent(returnType == null, method +// .getJavaProject(), destTypeName, methName, bodyStatement, +// lineDelimiter); +// if (bodyContent == null) { +// bodyContent = ""; //$NON-NLS-1$ +// } +// } +// int flags = settings.methodModifiers; +// if (flags == -1) { +// flags = method.getFlags(); +// } +// +// genMethodDeclaration(destTypeName, method, flags, bodyContent, buf); // imports, +// // buf); +// return buf.toString(); +// } /** * Generates a method stub not including the method comment. Given a @@ -158,13 +158,13 @@ public class StubUtility { * The buffer to append the gerenated code. * @throws JavaModelException */ - public static void genMethodDeclaration(String destTypeName, - IMethod method, String bodyContent, StringBuffer buf) - throws CoreException { // IImportsStructure imports, StringBuffer - // buf) throws CoreException { - genMethodDeclaration(destTypeName, method, method.getFlags(), - bodyContent, buf); - } +// public static void genMethodDeclaration(String destTypeName, +// IMethod method, String bodyContent, StringBuffer buf) +// throws CoreException { // IImportsStructure imports, StringBuffer +// // buf) throws CoreException { +// genMethodDeclaration(destTypeName, method, method.getFlags(), +// bodyContent, buf); +// } /** * Generates a method stub not including the method comment. Given a @@ -186,135 +186,135 @@ public class StubUtility { * The buffer to append the gerenated code. * @throws JavaModelException */ - public static void genMethodDeclaration(String destTypeName, - IMethod method, int flags, String bodyContent, StringBuffer buf) - throws CoreException { - // IImportsStructure imports, StringBuffer buf) throws CoreException { - IType parentType = method.getDeclaringType(); - String methodName = method.getElementName(); - String[] paramTypes = method.getParameterTypes(); - String[] paramNames = suggestArgumentNames(parentType.getJavaProject(), - method.getParameterNames()); - - String[] excTypes = method.getExceptionTypes(); - - boolean isConstructor = method.isConstructor(); - String retTypeSig = isConstructor ? null : method.getReturnType(); - - int lastParam = paramTypes.length - 1; - - if (Flags.isPublic(flags) - || (parentType.isInterface() && bodyContent != null)) { - buf.append("public "); //$NON-NLS-1$ - } else if (Flags.isProtected(flags)) { - buf.append("protected "); //$NON-NLS-1$ - } else if (Flags.isPrivate(flags)) { - buf.append("private "); //$NON-NLS-1$ - } - // if (Flags.isSynchronized(flags)) { - // buf.append("synchronized "); //$NON-NLS-1$ - // } - // if (Flags.isVolatile(flags)) { - // buf.append("volatile "); //$NON-NLS-1$ - // } - // if (Flags.isStrictfp(flags)) { - // buf.append("strictfp "); //$NON-NLS-1$ - // } - if (Flags.isStatic(flags)) { - buf.append("static "); //$NON-NLS-1$ - } - - if (isConstructor) { - buf.append(destTypeName); - } else { - String retTypeFrm; - if (!isPrimitiveType(retTypeSig)) { - retTypeFrm = resolveAndAdd(retTypeSig, parentType); - } else { - retTypeFrm = Signature.toString(retTypeSig); - } - buf.append(retTypeFrm); - buf.append(' '); - buf.append(methodName); - } - buf.append('('); - for (int i = 0; i <= lastParam; i++) { - String paramTypeSig = paramTypes[i]; - String paramTypeFrm; - - if (!isPrimitiveType(paramTypeSig)) { - paramTypeFrm = resolveAndAdd(paramTypeSig, parentType); - } else { - paramTypeFrm = Signature.toString(paramTypeSig); - } - buf.append(paramTypeFrm); - buf.append(' '); - buf.append(paramNames[i]); - if (i < lastParam) { - buf.append(", "); //$NON-NLS-1$ - } - } - buf.append(')'); - - int lastExc = excTypes.length - 1; - if (lastExc >= 0) { - buf.append(" throws "); //$NON-NLS-1$ - for (int i = 0; i <= lastExc; i++) { - String excTypeSig = excTypes[i]; - String excTypeFrm = resolveAndAdd(excTypeSig, parentType); - buf.append(excTypeFrm); - if (i < lastExc) { - buf.append(", "); //$NON-NLS-1$ - } - } - } - if (bodyContent == null) { - buf.append(";\n\n"); //$NON-NLS-1$ - } else { - buf.append(" {\n\t"); //$NON-NLS-1$ - if ((bodyContent != null) && (bodyContent.length() > 0)) { - buf.append(bodyContent); - buf.append('\n'); - } - buf.append("}\n"); //$NON-NLS-1$ - } - } +// public static void genMethodDeclaration(String destTypeName, +// IMethod method, int flags, String bodyContent, StringBuffer buf) +// throws CoreException { +// // IImportsStructure imports, StringBuffer buf) throws CoreException { +// IType parentType = method.getDeclaringType(); +// String methodName = method.getElementName(); +// String[] paramTypes = method.getParameterTypes(); +// String[] paramNames = suggestArgumentNames(parentType.getJavaProject(), +// method.getParameterNames()); +// +// String[] excTypes = method.getExceptionTypes(); +// +// boolean isConstructor = method.isConstructor(); +// String retTypeSig = isConstructor ? null : method.getReturnType(); +// +// int lastParam = paramTypes.length - 1; +// +// if (Flags.isPublic(flags) +// || (parentType.isInterface() && bodyContent != null)) { +// buf.append("public "); //$NON-NLS-1$ +// } else if (Flags.isProtected(flags)) { +// buf.append("protected "); //$NON-NLS-1$ +// } else if (Flags.isPrivate(flags)) { +// buf.append("private "); //$NON-NLS-1$ +// } +// // if (Flags.isSynchronized(flags)) { +// // buf.append("synchronized "); //$NON-NLS-1$ +// // } +// // if (Flags.isVolatile(flags)) { +// // buf.append("volatile "); //$NON-NLS-1$ +// // } +// // if (Flags.isStrictfp(flags)) { +// // buf.append("strictfp "); //$NON-NLS-1$ +// // } +// if (Flags.isStatic(flags)) { +// buf.append("static "); //$NON-NLS-1$ +// } +// +// if (isConstructor) { +// buf.append(destTypeName); +// } else { +// String retTypeFrm; +// if (!isPrimitiveType(retTypeSig)) { +// retTypeFrm = resolveAndAdd(retTypeSig, parentType); +// } else { +// retTypeFrm = Signature.toString(retTypeSig); +// } +// buf.append(retTypeFrm); +// buf.append(' '); +// buf.append(methodName); +// } +// buf.append('('); +// for (int i = 0; i <= lastParam; i++) { +// String paramTypeSig = paramTypes[i]; +// String paramTypeFrm; +// +// if (!isPrimitiveType(paramTypeSig)) { +// paramTypeFrm = resolveAndAdd(paramTypeSig, parentType); +// } else { +// paramTypeFrm = Signature.toString(paramTypeSig); +// } +// buf.append(paramTypeFrm); +// buf.append(' '); +// buf.append(paramNames[i]); +// if (i < lastParam) { +// buf.append(", "); //$NON-NLS-1$ +// } +// } +// buf.append(')'); +// +// int lastExc = excTypes.length - 1; +// if (lastExc >= 0) { +// buf.append(" throws "); //$NON-NLS-1$ +// for (int i = 0; i <= lastExc; i++) { +// String excTypeSig = excTypes[i]; +// String excTypeFrm = resolveAndAdd(excTypeSig, parentType); +// buf.append(excTypeFrm); +// if (i < lastExc) { +// buf.append(", "); //$NON-NLS-1$ +// } +// } +// } +// if (bodyContent == null) { +// buf.append(";\n\n"); //$NON-NLS-1$ +// } else { +// buf.append(" {\n\t"); //$NON-NLS-1$ +// if ((bodyContent != null) && (bodyContent.length() > 0)) { +// buf.append(bodyContent); +// buf.append('\n'); +// } +// buf.append("}\n"); //$NON-NLS-1$ +// } +// } - public static String getDefaultMethodBodyStatement(String methodName, - String[] paramNames, String retTypeSig, boolean callSuper) { - StringBuffer buf = new StringBuffer(); - if (callSuper) { - if (retTypeSig != null) { - if (!Signature.SIG_VOID.equals(retTypeSig)) { - buf.append("return "); //$NON-NLS-1$ - } - buf.append("super."); //$NON-NLS-1$ - buf.append(methodName); - } else { - buf.append("super"); //$NON-NLS-1$ - } - buf.append('('); - for (int i = 0; i < paramNames.length; i++) { - if (i > 0) { - buf.append(", "); //$NON-NLS-1$ - } - buf.append(paramNames[i]); - } - buf.append(");"); //$NON-NLS-1$ - } else { - if (retTypeSig != null && !retTypeSig.equals(Signature.SIG_VOID)) { - if (!isPrimitiveType(retTypeSig) - || Signature.getArrayCount(retTypeSig) > 0) { - buf.append("return null;"); //$NON-NLS-1$ - } else if (retTypeSig.equals(Signature.SIG_BOOLEAN)) { - buf.append("return false;"); //$NON-NLS-1$ - } else { - buf.append("return 0;"); //$NON-NLS-1$ - } - } - } - return buf.toString(); - } +// public static String getDefaultMethodBodyStatement(String methodName, +// String[] paramNames, String retTypeSig, boolean callSuper) { +// StringBuffer buf = new StringBuffer(); +// if (callSuper) { +// if (retTypeSig != null) { +// if (!Signature.SIG_VOID.equals(retTypeSig)) { +// buf.append("return "); //$NON-NLS-1$ +// } +// buf.append("super."); //$NON-NLS-1$ +// buf.append(methodName); +// } else { +// buf.append("super"); //$NON-NLS-1$ +// } +// buf.append('('); +// for (int i = 0; i < paramNames.length; i++) { +// if (i > 0) { +// buf.append(", "); //$NON-NLS-1$ +// } +// buf.append(paramNames[i]); +// } +// buf.append(");"); //$NON-NLS-1$ +// } else { +// if (retTypeSig != null && !retTypeSig.equals(Signature.SIG_VOID)) { +// if (!isPrimitiveType(retTypeSig) +// || Signature.getArrayCount(retTypeSig) > 0) { +// buf.append("return null;"); //$NON-NLS-1$ +// } else if (retTypeSig.equals(Signature.SIG_BOOLEAN)) { +// buf.append("return false;"); //$NON-NLS-1$ +// } else { +// buf.append("return 0;"); //$NON-NLS-1$ +// } +// } +// } +// return buf.toString(); +// } public static String getMethodBodyContent(boolean isConstructor, IJavaProject project, String destTypeName, String methodName, @@ -383,25 +383,25 @@ public class StubUtility { return evaluateTemplate(context, template); } - public static String getCatchBodyContent(ICompilationUnit cu, - String exceptionType, String variableName, String lineDelimiter) - throws CoreException { - Template template = WebUI.getDefault() - .getCodeTemplateStore().findTemplate( - CodeTemplateContextType.CATCHBLOCK); - if (template == null) { - return null; - } - - CodeTemplateContext context = new CodeTemplateContext(template - .getContextTypeId(), cu.getJavaProject(), lineDelimiter); - context.setVariable(CodeTemplateContextType.EXCEPTION_TYPE, - exceptionType); - context - .setVariable(CodeTemplateContextType.EXCEPTION_VAR, - variableName); //$NON-NLS-1$ - return evaluateTemplate(context, template); - } +// public static String getCatchBodyContent(ICompilationUnit cu, +// String exceptionType, String variableName, String lineDelimiter) +// throws CoreException { +// Template template = WebUI.getDefault() +// .getCodeTemplateStore().findTemplate( +// CodeTemplateContextType.CATCHBLOCK); +// if (template == null) { +// return null; +// } +// +// CodeTemplateContext context = new CodeTemplateContext(template +// .getContextTypeId(), cu.getJavaProject(), lineDelimiter); +// context.setVariable(CodeTemplateContextType.EXCEPTION_TYPE, +// exceptionType); +// context +// .setVariable(CodeTemplateContextType.EXCEPTION_VAR, +// variableName); //$NON-NLS-1$ +// return evaluateTemplate(context, template); +// } /** * @see net.sourceforge.phpdt.ui.CodeGeneration#getTypeComment(ICompilationUnit, @@ -884,31 +884,31 @@ public class StubUtility { textBuffer.replace(offset, length, buf.toString()); } - private static boolean isPrimitiveType(String typeName) { - char first = Signature.getElementType(typeName).charAt(0); - return (first != Signature.C_RESOLVED && first != Signature.C_UNRESOLVED); - } +// private static boolean isPrimitiveType(String typeName) { +// char first = Signature.getElementType(typeName).charAt(0); +// return (first != Signature.C_RESOLVED && first != Signature.C_UNRESOLVED); +// } - private static String resolveAndAdd(String refTypeSig, IType declaringType) - throws JavaModelException {// , IImportsStructure imports) throws - // JavaModelException { - String resolvedTypeName = JavaModelUtil.getResolvedTypeName(refTypeSig, - declaringType); - if (resolvedTypeName != null) { - StringBuffer buf = new StringBuffer(); - // if (imports != null) { - // buf.append(imports.addImport(resolvedTypeName)); - // } else { - buf.append(resolvedTypeName); - // } - int arrayCount = Signature.getArrayCount(refTypeSig); - for (int i = 0; i < arrayCount; i++) { - buf.append("[]"); //$NON-NLS-1$ - } - return buf.toString(); - } - return Signature.toString(refTypeSig); - } +// private static String resolveAndAdd(String refTypeSig, IType declaringType) +// throws JavaModelException {// , IImportsStructure imports) throws +// // JavaModelException { +// String resolvedTypeName = JavaModelUtil.getResolvedTypeName(refTypeSig, +// declaringType); +// if (resolvedTypeName != null) { +// StringBuffer buf = new StringBuffer(); +// // if (imports != null) { +// // buf.append(imports.addImport(resolvedTypeName)); +// // } else { +// buf.append(resolvedTypeName); +// // } +// int arrayCount = Signature.getArrayCount(refTypeSig); +// for (int i = 0; i < arrayCount; i++) { +// buf.append("[]"); //$NON-NLS-1$ +// } +// return buf.toString(); +// } +// return Signature.toString(refTypeSig); +// } /** * Finds a method in a list of methods. @@ -1191,29 +1191,29 @@ public class StubUtility { /** * Examines a string and returns the first line delimiter found. */ - public static String getLineDelimiterUsed(IJavaElement elem) - throws JavaModelException { - ICompilationUnit cu = (ICompilationUnit) elem - .getAncestor(IJavaElement.COMPILATION_UNIT); - if (cu != null && cu.exists()) { - IBuffer buf = cu.getBuffer(); - int length = buf.getLength(); - for (int i = 0; i < length; i++) { - char ch = buf.getChar(i); - if (ch == SWT.CR) { - if (i + 1 < length) { - if (buf.getChar(i + 1) == SWT.LF) { - return "\r\n"; //$NON-NLS-1$ - } - } - return "\r"; //$NON-NLS-1$ - } else if (ch == SWT.LF) { - return "\n"; //$NON-NLS-1$ - } - } - } - return System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - } +// public static String getLineDelimiterUsed(IJavaElement elem) +// throws JavaModelException { +// ICompilationUnit cu = (ICompilationUnit) elem +// .getAncestor(IJavaElement.COMPILATION_UNIT); +// if (cu != null && cu.exists()) { +// IBuffer buf = cu.getBuffer(); +// int length = buf.getLength(); +// for (int i = 0; i < length; i++) { +// char ch = buf.getChar(i); +// if (ch == SWT.CR) { +// if (i + 1 < length) { +// if (buf.getChar(i + 1) == SWT.LF) { +// return "\r\n"; //$NON-NLS-1$ +// } +// } +// return "\r"; //$NON-NLS-1$ +// } else if (ch == SWT.LF) { +// return "\n"; //$NON-NLS-1$ +// } +// } +// } +// return System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ +// } /** * Embodies the policy which line delimiter to use when inserting into a @@ -1365,82 +1365,82 @@ public class StubUtility { return baseName; } - public static String[] suggestArgumentNames(IJavaProject project, - String[] paramNames) { - String prefixes = project.getOption( - JavaCore.CODEASSIST_ARGUMENT_PREFIXES, true); - String suffixes = project.getOption( - JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, true); - if (prefixes.length() + suffixes.length() == 0) { - return paramNames; - } - - String[] newNames = new String[paramNames.length]; - // Ensure that the codegeneration preferences are respected - for (int i = 0; i < paramNames.length; i++) { - String curr = paramNames[i]; - if (!hasPrefixOrSuffix(prefixes, suffixes, curr)) { - newNames[i] = suggestArgumentName(project, paramNames[i], null); - } else { - newNames[i] = curr; - } - } - return newNames; - } - - public static boolean hasFieldName(IJavaProject project, String name) { - String prefixes = project.getOption(JavaCore.CODEASSIST_FIELD_PREFIXES, - true); - String suffixes = project.getOption(JavaCore.CODEASSIST_FIELD_SUFFIXES, - true); - String staticPrefixes = project.getOption( - JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, true); - String staticSuffixes = project.getOption( - JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, true); - - return hasPrefixOrSuffix(prefixes, suffixes, name) - || hasPrefixOrSuffix(staticPrefixes, staticSuffixes, name); - } - - public static boolean hasParameterName(IJavaProject project, String name) { - String prefixes = project.getOption( - JavaCore.CODEASSIST_ARGUMENT_PREFIXES, true); - String suffixes = project.getOption( - JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, true); - return hasPrefixOrSuffix(prefixes, suffixes, name); - } +// public static String[] suggestArgumentNames(IJavaProject project, +// String[] paramNames) { +// String prefixes = project.getOption( +// JavaCore.CODEASSIST_ARGUMENT_PREFIXES, true); +// String suffixes = project.getOption( +// JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, true); +// if (prefixes.length() + suffixes.length() == 0) { +// return paramNames; +// } +// +// String[] newNames = new String[paramNames.length]; +// // Ensure that the codegeneration preferences are respected +// for (int i = 0; i < paramNames.length; i++) { +// String curr = paramNames[i]; +// if (!hasPrefixOrSuffix(prefixes, suffixes, curr)) { +// newNames[i] = suggestArgumentName(project, paramNames[i], null); +// } else { +// newNames[i] = curr; +// } +// } +// return newNames; +// } - public static boolean hasLocalVariableName(IJavaProject project, String name) { - String prefixes = project.getOption(JavaCore.CODEASSIST_LOCAL_PREFIXES, - true); - String suffixes = project.getOption(JavaCore.CODEASSIST_LOCAL_SUFFIXES, - true); - return hasPrefixOrSuffix(prefixes, suffixes, name); - } +// public static boolean hasFieldName(IJavaProject project, String name) { +// String prefixes = project.getOption(JavaCore.CODEASSIST_FIELD_PREFIXES, +// true); +// String suffixes = project.getOption(JavaCore.CODEASSIST_FIELD_SUFFIXES, +// true); +// String staticPrefixes = project.getOption( +// JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, true); +// String staticSuffixes = project.getOption( +// JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, true); +// +// return hasPrefixOrSuffix(prefixes, suffixes, name) +// || hasPrefixOrSuffix(staticPrefixes, staticSuffixes, name); +// } - public static boolean hasConstantName(String name) { - return Character.isUpperCase(name.charAt(0)); - } +// public static boolean hasParameterName(IJavaProject project, String name) { +// String prefixes = project.getOption( +// JavaCore.CODEASSIST_ARGUMENT_PREFIXES, true); +// String suffixes = project.getOption( +// JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, true); +// return hasPrefixOrSuffix(prefixes, suffixes, name); +// } - private static boolean hasPrefixOrSuffix(String prefixes, String suffixes, - String name) { - final String listSeparartor = ","; //$NON-NLS-1$ +// public static boolean hasLocalVariableName(IJavaProject project, String name) { +// String prefixes = project.getOption(JavaCore.CODEASSIST_LOCAL_PREFIXES, +// true); +// String suffixes = project.getOption(JavaCore.CODEASSIST_LOCAL_SUFFIXES, +// true); +// return hasPrefixOrSuffix(prefixes, suffixes, name); +// } - StringTokenizer tok = new StringTokenizer(prefixes, listSeparartor); - while (tok.hasMoreTokens()) { - String curr = tok.nextToken(); - if (name.startsWith(curr)) { - return true; - } - } +// public static boolean hasConstantName(String name) { +// return Character.isUpperCase(name.charAt(0)); +// } - tok = new StringTokenizer(suffixes, listSeparartor); - while (tok.hasMoreTokens()) { - String curr = tok.nextToken(); - if (name.endsWith(curr)) { - return true; - } - } - return false; - } +// private static boolean hasPrefixOrSuffix(String prefixes, String suffixes, +// String name) { +// final String listSeparartor = ","; //$NON-NLS-1$ +// +// StringTokenizer tok = new StringTokenizer(prefixes, listSeparartor); +// while (tok.hasMoreTokens()) { +// String curr = tok.nextToken(); +// if (name.startsWith(curr)) { +// return true; +// } +// } +// +// tok = new StringTokenizer(suffixes, listSeparartor); +// while (tok.hasMoreTokens()) { +// String curr = tok.nextToken(); +// if (name.endsWith(curr)) { +// return true; +// } +// } +// return false; +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplates.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplates.java index 668967a..700b4ac 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplates.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplates.java @@ -19,7 +19,7 @@ import net.sourceforge.phpeclipse.ui.WebUI; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.text.templates.Template; +//import org.eclipse.jface.text.templates.Template; /** * CodeTemplates gives access to the available code templates. @@ -42,9 +42,9 @@ public class CodeTemplates extends /** Singleton. */ private static CodeTemplates fgTemplates; - public static Template getCodeTemplate(String name) { - return getInstance().getFirstTemplate(name); - } +// public static Template getCodeTemplate(String name) { +// return getInstance().getFirstTemplate(name); +// } /** * Returns an instance of templates. @@ -90,17 +90,17 @@ public class CodeTemplates extends /** * Resets the template set with the default templates. */ - public void restoreDefaults() throws CoreException { - clear(); - addFromStream(getDefaultsAsStream(), false, true, fgResourceBundle); - } +// public void restoreDefaults() throws CoreException { +// clear(); +// addFromStream(getDefaultsAsStream(), false, true, fgResourceBundle); +// } /** * Saves the template set. */ - public void save() throws CoreException { - saveToFile(getTemplateFile()); - } +// public void save() throws CoreException { +// saveToFile(getTemplateFile()); +// } private static InputStream getDefaultsAsStream() { return CodeTemplates.class.getResourceAsStream(DEFAULT_FILE); diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitCompletion.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitCompletion.java index 7684b9d..eae8473 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitCompletion.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitCompletion.java @@ -12,10 +12,10 @@ package net.sourceforge.phpdt.internal.corext.template.php; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; +//import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Vector; +//import java.util.Vector; import net.sourceforge.phpdt.core.CompletionRequestorAdapter; import net.sourceforge.phpdt.core.ICompilationUnit; @@ -41,13 +41,13 @@ class CompilationUnitCompletion extends CompletionRequestorAdapter { } } - private ICompilationUnit fUnit; + //private ICompilationUnit fUnit; private List fLocalVariables = new ArrayList(); private Map fTypes = new HashMap(); - private boolean fError; + //private boolean fError; /** * Creates a compilation unit completion. @@ -66,19 +66,19 @@ class CompilationUnitCompletion extends CompletionRequestorAdapter { * the compilation unit, may be null. */ public void reset(ICompilationUnit unit) { - fUnit = unit; + //fUnit = unit; fLocalVariables.clear(); fTypes.clear(); - fError = false; + //fError = false; } /* * @see ICompletionRequestor#acceptError(IProblem) */ public void acceptError(IProblem error) { - fError = true; + //fError = true; } /* @@ -96,44 +96,44 @@ class CompilationUnitCompletion extends CompletionRequestorAdapter { /** * Tests if the code completion process produced errors. */ - public boolean hasErrors() { - return fError; - } - - boolean existsLocalName(String name) { - for (Iterator iterator = fLocalVariables.iterator(); iterator.hasNext();) { - LocalVariable localVariable = (LocalVariable) iterator.next(); - - if (localVariable.name.equals(name)) - return true; - } - - return false; - } - - String[] getLocalVariableNames() { - String[] res = new String[fLocalVariables.size()]; - int i = 0; - for (Iterator iterator = fLocalVariables.iterator(); iterator.hasNext();) { - LocalVariable localVariable = (LocalVariable) iterator.next(); - res[i++] = localVariable.name; - } - return res; - } - - LocalVariable[] findLocalArrays() { - Vector vector = new Vector(); - - for (Iterator iterator = fLocalVariables.iterator(); iterator.hasNext();) { - LocalVariable localVariable = (LocalVariable) iterator.next(); - - if (isArray(localVariable.typeName)) - vector.add(localVariable); - } - - return (LocalVariable[]) vector - .toArray(new LocalVariable[vector.size()]); - } +// public boolean hasErrors() { +// return fError; +// } + +// boolean existsLocalName(String name) { +// for (Iterator iterator = fLocalVariables.iterator(); iterator.hasNext();) { +// LocalVariable localVariable = (LocalVariable) iterator.next(); +// +// if (localVariable.name.equals(name)) +// return true; +// } +// +// return false; +// } + +// String[] getLocalVariableNames() { +// String[] res = new String[fLocalVariables.size()]; +// int i = 0; +// for (Iterator iterator = fLocalVariables.iterator(); iterator.hasNext();) { +// LocalVariable localVariable = (LocalVariable) iterator.next(); +// res[i++] = localVariable.name; +// } +// return res; +// } + +// LocalVariable[] findLocalArrays() { +// Vector vector = new Vector(); +// +// for (Iterator iterator = fLocalVariables.iterator(); iterator.hasNext();) { +// LocalVariable localVariable = (LocalVariable) iterator.next(); +// +// if (isArray(localVariable.typeName)) +// vector.add(localVariable); +// } +// +// return (LocalVariable[]) vector +// .toArray(new LocalVariable[vector.size()]); +// } // LocalVariable[] findLocalCollections() throws JavaModelException { // Vector vector= new Vector(); @@ -155,13 +155,13 @@ class CompilationUnitCompletion extends CompletionRequestorAdapter { // LocalVariable[vector.size()]); // } - String simplifyTypeName(String qualifiedName) { - return (String) fTypes.get(qualifiedName); - } +// String simplifyTypeName(String qualifiedName) { +// return (String) fTypes.get(qualifiedName); +// } - private static boolean isArray(String type) { - return type.endsWith("[]"); //$NON-NLS-1$ - } +// private static boolean isArray(String type) { +// return type.endsWith("[]"); //$NON-NLS-1$ +// } // returns fully qualified name if successful // private String qualify(String typeName) throws JavaModelException { diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/JavaTemplateMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/JavaTemplateMessages.java index 7756536..1eafeb2 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/JavaTemplateMessages.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/JavaTemplateMessages.java @@ -46,7 +46,7 @@ class JavaTemplateMessages { /** * 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/corext/template/php/TemplateSet.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/TemplateSet.java index a0d83fa..d3fdd6a 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/TemplateSet.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/TemplateSet.java @@ -388,9 +388,9 @@ public class TemplateSet { /** * Returns all templates. */ - public Template[] getTemplates() { - return (Template[]) fTemplates.toArray(new Template[fTemplates.size()]); - } +// public Template[] getTemplates() { +// return (Template[]) fTemplates.toArray(new Template[fTemplates.size()]); +// } /** * Returns all templates with a given name. @@ -409,14 +409,14 @@ public class TemplateSet { /** * Returns the first templates with the given name. */ - public Template getFirstTemplate(String name) { - for (Iterator iterator = fTemplates.iterator(); iterator.hasNext();) { - Template curr = (Template) iterator.next(); - if (curr.getName().equals(name)) { - return curr; - } - } - return null; - } +// public Template getFirstTemplate(String name) { +// for (Iterator iterator = fTemplates.iterator(); iterator.hasNext();) { +// Template curr = (Template) iterator.next(); +// if (curr.getName().equals(name)) { +// return curr; +// } +// } +// return null; +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/Templates.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/Templates.java index b520985..98a9e42 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/Templates.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/Templates.java @@ -11,7 +11,7 @@ package net.sourceforge.phpdt.internal.corext.template.php; import java.io.File; -import java.io.InputStream; +//import java.io.InputStream; import java.util.ResourceBundle; import net.sourceforge.phpeclipse.PHPeclipsePlugin; @@ -29,7 +29,7 @@ import org.eclipse.core.runtime.IPath; public class Templates extends net.sourceforge.phpdt.internal.corext.template.php.TemplateSet { - private static final String DEFAULT_FILE = "default-templates.xml"; //$NON-NLS-1$ + //private static final String DEFAULT_FILE = "default-templates.xml"; //$NON-NLS-1$ private static final String TEMPLATE_FILE = "templates.xml"; //$NON-NLS-1$ @@ -84,21 +84,21 @@ public class Templates extends /** * Resets the template set with the default templates. */ - public void restoreDefaults() throws CoreException { - clear(); - addFromStream(getDefaultsAsStream(), true, true, fgResourceBundle); - } +// public void restoreDefaults() throws CoreException { +// clear(); +// addFromStream(getDefaultsAsStream(), true, true, fgResourceBundle); +// } /** * Saves the template set. */ - public void save() throws CoreException { - saveToFile(getTemplateFile()); - } +// public void save() throws CoreException { +// saveToFile(getTemplateFile()); +// } - private static InputStream getDefaultsAsStream() { - return Templates.class.getResourceAsStream(DEFAULT_FILE); - } +// private static InputStream getDefaultsAsStream() { +// return Templates.class.getResourceAsStream(DEFAULT_FILE); +// } private static File getTemplateFile() { IPath path = PHPeclipsePlugin.getDefault().getStateLocation(); diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/PHPUIException.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/PHPUIException.java deleted file mode 100644 index 4db626b..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/PHPUIException.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -package net.sourceforge.phpdt.internal.ui; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; - -/** - * An exception to wrap a status. This is necessary to use the core's - * IRunnableWithProgress support - */ - -public class PHPUIException extends CoreException { - - public PHPUIException(IStatus status) { - super(status); - } -} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/ActionUtil.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/ActionUtil.java index 3b9f31b..1b3733a 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/ActionUtil.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/ActionUtil.java @@ -12,18 +12,18 @@ package net.sourceforge.phpdt.internal.ui.actions; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaProject; -import net.sourceforge.phpdt.core.IPackageFragment; -import net.sourceforge.phpdt.core.IPackageFragmentRoot; -import net.sourceforge.phpdt.internal.corext.refactoring.util.ResourceUtil; +//import net.sourceforge.phpdt.core.IPackageFragment; +//import net.sourceforge.phpdt.core.IPackageFragmentRoot; +//import net.sourceforge.phpdt.internal.corext.refactoring.util.ResourceUtil; //import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.PHPEditor; //import net.sourceforge.phpeclipse.ui.WebUI; -import org.eclipse.core.resources.IFolder; +//import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.resources.IResource; +//import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.widgets.Shell; @@ -37,22 +37,22 @@ public class ActionUtil { } // bug 31998 we will have to disable renaming of linked packages (and cus) - public static boolean mustDisableJavaModelAction(Shell shell, Object element) { - if (!(element instanceof IPackageFragment) - && !(element instanceof IPackageFragmentRoot)) - return false; - - IResource resource = ResourceUtil.getResource(element); - if ((resource == null) || (!(resource instanceof IFolder)) - || (!resource.isLinked())) - return false; - - MessageDialog - .openInformation( - shell, - ActionMessages.getString("ActionUtil.not_possible"), ActionMessages.getString("ActionUtil.no_linked")); //$NON-NLS-1$ //$NON-NLS-2$ - return true; - } +// public static boolean mustDisableJavaModelAction(Shell shell, Object element) { +// if (!(element instanceof IPackageFragment) +// && !(element instanceof IPackageFragmentRoot)) +// return false; +// +// IResource resource = ResourceUtil.getResource(element); +// if ((resource == null) || (!(resource instanceof IFolder)) +// || (!resource.isLinked())) +// return false; +// +// MessageDialog +// .openInformation( +// shell, +// ActionMessages.getString("ActionUtil.not_possible"), ActionMessages.getString("ActionUtil.no_linked")); //$NON-NLS-1$ //$NON-NLS-2$ +// return true; +// } public static boolean isProcessable(Shell shell, PHPEditor editor) { if (editor == null) diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerConfigurationBlock.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerConfigurationBlock.java index d7940e6..ef2bd0b 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerConfigurationBlock.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerConfigurationBlock.java @@ -10,7 +10,7 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.ui.preferences; -import java.util.ArrayList; +//import java.util.ArrayList; import java.util.Map; import net.sourceforge.phpdt.core.IJavaProject; @@ -208,9 +208,9 @@ public class CompilerConfigurationBlock extends OptionsConfigurationBlock { //private static final String CLEAN = JavaCore.CLEAN; - private static final String ENABLED = JavaCore.ENABLED; + //private static final String ENABLED = JavaCore.ENABLED; - private static final String DISABLED = JavaCore.DISABLED; + //private static final String DISABLED = JavaCore.DISABLED; // private static final String PUBLIC= JavaCore.PUBLIC; // private static final String PROTECTED= JavaCore.PROTECTED; @@ -221,7 +221,7 @@ public class CompilerConfigurationBlock extends OptionsConfigurationBlock { //private static final String USER_CONF = "user"; //$NON-NLS-1$ - private ArrayList fComplianceControls; + //private ArrayList fComplianceControls; private PixelConverter fPixelConverter; @@ -234,7 +234,7 @@ public class CompilerConfigurationBlock extends OptionsConfigurationBlock { IJavaProject project) { super(context, project, getKeys()); - fComplianceControls = new ArrayList(); + //fComplianceControls = new ArrayList(); // fComplianceStatus= new StatusInfo(); fMaxNumberProblemsStatus = new StatusInfo(); diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AbstractJavaEditorTextHover.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AbstractJavaEditorTextHover.java index d0576c1..ba23080 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AbstractJavaEditorTextHover.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AbstractJavaEditorTextHover.java @@ -26,7 +26,7 @@ import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlCreator; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextViewer; -import org.eclipse.swt.SWT; +//import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorPart; //import org.eclipse.ui.PlatformUI; diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java index 8f33483..a4afa5d 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java @@ -13,19 +13,19 @@ package net.sourceforge.phpdt.internal.ui.text.phpdoc; import java.text.BreakIterator; -import net.sourceforge.phpdt.core.ICompilationUnit; +//import net.sourceforge.phpdt.core.ICompilationUnit; //import net.sourceforge.phpdt.core.IJavaElement; -import net.sourceforge.phpdt.core.IMethod; -import net.sourceforge.phpdt.core.ISourceRange; -import net.sourceforge.phpdt.core.IType; -import net.sourceforge.phpdt.internal.corext.util.Strings; -import net.sourceforge.phpdt.ui.CodeGeneration; -import net.sourceforge.phpdt.ui.IWorkingCopyManager; +//import net.sourceforge.phpdt.core.IMethod; +//import net.sourceforge.phpdt.core.ISourceRange; +//import net.sourceforge.phpdt.core.IType; +//import net.sourceforge.phpdt.internal.corext.util.Strings; +//import net.sourceforge.phpdt.ui.CodeGeneration; +//import net.sourceforge.phpdt.ui.IWorkingCopyManager; import net.sourceforge.phpdt.ui.PreferenceConstants; //import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.ui.WebUI; -import org.eclipse.core.runtime.CoreException; +//import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Preferences; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.BadLocationException; @@ -37,8 +37,8 @@ import org.eclipse.jface.text.ITypedRegion; import org.eclipse.jface.text.TextUtilities; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; +//import org.eclipse.ui.IWorkbenchWindow; +//import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.ITextEditorExtension3; @@ -175,24 +175,24 @@ public class JavaDocAutoIndentStrategy extends * Removes start and end of a comment and corrects indentation and line * delimiters. */ - private String prepareTemplateComment(String comment, String indentation, - String lineDelimiter) { - // trim comment start and end if any - if (comment.endsWith("*/")) //$NON-NLS-1$ - comment = comment.substring(0, comment.length() - 2); - comment = comment.trim(); - if (comment.startsWith("/*")) { //$NON-NLS-1$ - if (comment.length() > 2 && comment.charAt(2) == '*') { - comment = comment.substring(3); // remove '/**' - } else { - comment = comment.substring(2); // remove '/*' - } - } - // return Strings.changeIndent(comment, 0, - // CodeFormatterUtil.getTabWidth(), indentation, lineDelimiter); - return Strings.changeIndent(comment, 0, getTabWidth(), indentation, - lineDelimiter); - } +// private String prepareTemplateComment(String comment, String indentation, +// String lineDelimiter) { +// // trim comment start and end if any +// if (comment.endsWith("*/")) //$NON-NLS-1$ +// comment = comment.substring(0, comment.length() - 2); +// comment = comment.trim(); +// if (comment.startsWith("/*")) { //$NON-NLS-1$ +// if (comment.length() > 2 && comment.charAt(2) == '*') { +// comment = comment.substring(3); // remove '/**' +// } else { +// comment = comment.substring(2); // remove '/*' +// } +// } +// // return Strings.changeIndent(comment, 0, +// // CodeFormatterUtil.getTabWidth(), indentation, lineDelimiter); +// return Strings.changeIndent(comment, 0, getTabWidth(), indentation, +// lineDelimiter); +// } public static int getTabWidth() { Preferences preferences = WebUI.getDefault() @@ -201,43 +201,43 @@ public class JavaDocAutoIndentStrategy extends .getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); } - private String createTypeTags(IDocument document, DocumentCommand command, - String indentation, String lineDelimiter, IType type) - throws CoreException { - String comment = CodeGeneration.getTypeComment(type - .getCompilationUnit(), type.getTypeQualifiedName('.'), - lineDelimiter); - if (comment != null) { - return prepareTemplateComment(comment.trim(), indentation, - lineDelimiter); - } - return null; - } +// private String createTypeTags(IDocument document, DocumentCommand command, +// String indentation, String lineDelimiter, IType type) +// throws CoreException { +// String comment = CodeGeneration.getTypeComment(type +// .getCompilationUnit(), type.getTypeQualifiedName('.'), +// lineDelimiter); +// if (comment != null) { +// return prepareTemplateComment(comment.trim(), indentation, +// lineDelimiter); +// } +// return null; +// } - private String createMethodTags(IDocument document, - DocumentCommand command, String indentation, String lineDelimiter, - IMethod method) throws CoreException, BadLocationException { - IRegion partition = TextUtilities.getPartition(document, fPartitioning, - command.offset, false); - ISourceRange sourceRange = method.getSourceRange(); - if (sourceRange == null - || sourceRange.getOffset() != partition.getOffset()) - return null; - - // IMethod inheritedMethod= getInheritedMethod(method); - // String comment= CodeGeneration.getMethodComment(method, - // inheritedMethod, lineDelimiter); - // if (comment != null) { - // comment= comment.trim(); - // boolean javadocComment= comment.startsWith("/**"); //$NON-NLS-1$ - // boolean isJavaDoc= partition.getLength() >= 3 && - // document.get(partition.getOffset(), 3).equals("/**"); //$NON-NLS-1$ - // if (javadocComment == isJavaDoc) { - // return prepareTemplateComment(comment, indentation, lineDelimiter); - // } - // } - return null; - } +// private String createMethodTags(IDocument document, +// DocumentCommand command, String indentation, String lineDelimiter, +// IMethod method) throws CoreException, BadLocationException { +// IRegion partition = TextUtilities.getPartition(document, fPartitioning, +// command.offset, false); +// ISourceRange sourceRange = method.getSourceRange(); +// if (sourceRange == null +// || sourceRange.getOffset() != partition.getOffset()) +// return null; +// +// // IMethod inheritedMethod= getInheritedMethod(method); +// // String comment= CodeGeneration.getMethodComment(method, +// // inheritedMethod, lineDelimiter); +// // if (comment != null) { +// // comment= comment.trim(); +// // boolean javadocComment= comment.startsWith("/**"); //$NON-NLS-1$ +// // boolean isJavaDoc= partition.getLength() >= 3 && +// // document.get(partition.getOffset(), 3).equals("/**"); //$NON-NLS-1$ +// // if (javadocComment == isJavaDoc) { +// // return prepareTemplateComment(comment, indentation, lineDelimiter); +// // } +// // } +// return null; +// } /** * Returns the method inherited from, null if method is newly @@ -911,28 +911,28 @@ public class JavaDocAutoIndentStrategy extends * Returns the compilation unit of the CompilationUnitEditor invoking the * AutoIndentStrategy, might return null on error. */ - private static ICompilationUnit getCompilationUnit() { - - IWorkbenchWindow window = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow(); - if (window == null) - return null; - - IWorkbenchPage page = window.getActivePage(); - if (page == null) - return null; - - IEditorPart editor = page.getActiveEditor(); - if (editor == null) - return null; - - IWorkingCopyManager manager = WebUI.getDefault() - .getWorkingCopyManager(); - ICompilationUnit unit = manager.getWorkingCopy(editor.getEditorInput()); - if (unit == null) - return null; - - return unit; - } +// private static ICompilationUnit getCompilationUnit() { +// +// IWorkbenchWindow window = PlatformUI.getWorkbench() +// .getActiveWorkbenchWindow(); +// if (window == null) +// return null; +// +// IWorkbenchPage page = window.getActivePage(); +// if (page == null) +// return null; +// +// IEditorPart editor = page.getActiveEditor(); +// if (editor == null) +// return null; +// +// IWorkingCopyManager manager = WebUI.getDefault() +// .getWorkingCopyManager(); +// ICompilationUnit unit = manager.getWorkingCopy(editor.getEditorInput()); +// if (unit == null) +// return null; +// +// return unit; +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java index b9f3421..30ce20f 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java @@ -85,9 +85,9 @@ public class PHPFileUtil { * Returns true iff the file extension is a valid PHP Unit name * implementation is not creating extra strings. */ - public final static boolean isValidPHPUnitName(String filename) { - return PHPFileUtil.isPHPFileName(filename); - } +// public final static boolean isValidPHPUnitName(String filename) { +// return PHPFileUtil.isPHPFileName(filename); +// } /** * @return Returns the PHP extensions. @@ -134,17 +134,17 @@ public class PHPFileUtil { * @return the file for the given absolute file path or null * if no existing file can be found */ - public static IFile createFile(IPath absoluteFilePath, IProject project) { - if (absoluteFilePath == null || project == null) { - return null; - } - - String projectPath = project.getFullPath().toString(); - String filePath = absoluteFilePath.toString().substring( - projectPath.length() + 1); - return project.getFile(filePath); - - } +// public static IFile createFile(IPath absoluteFilePath, IProject project) { +// if (absoluteFilePath == null || project == null) { +// return null; +// } +// +// String projectPath = project.getFullPath().toString(); +// String filePath = absoluteFilePath.toString().substring( +// projectPath.length() + 1); +// return project.getFile(filePath); +// +// } /** * Determine the path of an include name string diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/StringMatcher.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/StringMatcher.java index 756f28e..dc778c3 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/StringMatcher.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/StringMatcher.java @@ -98,46 +98,46 @@ public class StringMatcher { * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc" * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned */ - public StringMatcher.Position find(String text, int start, int end) { - if (text == null) - throw new IllegalArgumentException(); - - int tlen = text.length(); - if (start < 0) - start = 0; - if (end > tlen) - end = tlen; - if (end < 0 || start >= end) - return null; - if (fLength == 0) - return new Position(start, start); - if (fIgnoreWildCards) { - int x = posIn(text, start, end); - if (x < 0) - return null; - return new Position(x, x + fLength); - } - - int segCount = fSegments.length; - if (segCount == 0)// pattern contains only '*'(s) - return new Position(start, end); - - int curPos = start; - int matchStart = -1; - int i; - for (i = 0; i < segCount && curPos < end; ++i) { - String current = fSegments[i]; - int nextMatch = regExpPosIn(text, curPos, end, current); - if (nextMatch < 0) - return null; - if (i == 0) - matchStart = nextMatch; - curPos = nextMatch + current.length(); - } - if (i < segCount) - return null; - return new Position(matchStart, curPos); - } +// public StringMatcher.Position find(String text, int start, int end) { +// if (text == null) +// throw new IllegalArgumentException(); +// +// int tlen = text.length(); +// if (start < 0) +// start = 0; +// if (end > tlen) +// end = tlen; +// if (end < 0 || start >= end) +// return null; +// if (fLength == 0) +// return new Position(start, start); +// if (fIgnoreWildCards) { +// int x = posIn(text, start, end); +// if (x < 0) +// return null; +// return new Position(x, x + fLength); +// } +// +// int segCount = fSegments.length; +// if (segCount == 0)// pattern contains only '*'(s) +// return new Position(start, end); +// +// int curPos = start; +// int matchStart = -1; +// int i; +// for (i = 0; i < segCount && curPos < end; ++i) { +// String current = fSegments[i]; +// int nextMatch = regExpPosIn(text, curPos, end, current); +// if (nextMatch < 0) +// return null; +// if (i == 0) +// matchStart = nextMatch; +// curPos = nextMatch + current.length(); +// } +// if (i < segCount) +// return null; +// return new Position(matchStart, curPos); +// } /** * match the given text with the pattern @@ -320,24 +320,24 @@ public class StringMatcher { * @return the starting index in the text of the pattern , or -1 if not * found */ - protected int posIn(String text, int start, int end) {// no wild card in - // pattern - int max = end - fLength; - - if (!fIgnoreCase) { - int i = text.indexOf(fPattern, start); - if (i == -1 || i > max) - return -1; - return i; - } - - for (int i = start; i <= max; ++i) { - if (text.regionMatches(true, i, fPattern, 0, fLength)) - return i; - } - - return -1; - } +// protected int posIn(String text, int start, int end) {// no wild card in +// // pattern +// int max = end - fLength; +// +// if (!fIgnoreCase) { +// int i = text.indexOf(fPattern, start); +// if (i == -1 || i > max) +// return -1; +// return i; +// } +// +// for (int i = start; i <= max; ++i) { +// if (text.regionMatches(true, i, fPattern, 0, fLength)) +// return i; +// } +// +// return -1; +// } /** * @param text, a simple regular expression that may only diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/TwoArrayQuickSorter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/TwoArrayQuickSorter.java index 2db0f37..98461df 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/TwoArrayQuickSorter.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/util/TwoArrayQuickSorter.java @@ -38,9 +38,9 @@ public class TwoArrayQuickSorter { * @param ignoreCase * specifies whether sorting is case sensitive or not. */ - public TwoArrayQuickSorter(boolean ignoreCase) { - fComparator = new StringComparator(ignoreCase); - } +// public TwoArrayQuickSorter(boolean ignoreCase) { +// fComparator = new StringComparator(ignoreCase); +// } /** * Creates a sorter with a comparator. diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ltk/ui/wizards/RenameLocalVariablePage.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ltk/ui/wizards/RenameLocalVariablePage.java index 53895f4..c1b741f 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ltk/ui/wizards/RenameLocalVariablePage.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ltk/ui/wizards/RenameLocalVariablePage.java @@ -190,7 +190,7 @@ public class RenameLocalVariablePage extends UserInputWizardPage { private void validate() { String txt = txtNewName.getText(); - Scanner s; + //Scanner s; setPageComplete(isVariable(txt) && !txt.equals(info.getOldName())); } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/wizards/NewTypeWizardPage.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/wizards/NewTypeWizardPage.java index 2157335..cde654e 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/wizards/NewTypeWizardPage.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/wizards/NewTypeWizardPage.java @@ -1697,29 +1697,29 @@ public abstract class NewTypeWizardPage extends NewContainerWizardPage { /* * Called from createType to construct the source for this type */ - private String constructTypeStub(String lineDelimiter) { // ImportsManager - // imports, - // String - // lineDelimiter) - // { - StringBuffer buf = new StringBuffer(); - - int modifiers = getModifiers(); - buf.append(Flags.toString(modifiers)); - if (modifiers != 0) { - buf.append(' '); - } - buf.append(fIsClass ? "class " : "interface "); //$NON-NLS-2$ //$NON-NLS-1$ - buf.append(getTypeName()); - // writeSuperClass(buf, imports); - // writeSuperInterfaces(buf, imports); - buf.append('{'); - buf.append(lineDelimiter); - buf.append(lineDelimiter); - buf.append('}'); - buf.append(lineDelimiter); - return buf.toString(); - } +// private String constructTypeStub(String lineDelimiter) { // ImportsManager +// // imports, +// // String +// // lineDelimiter) +// // { +// StringBuffer buf = new StringBuffer(); +// +// int modifiers = getModifiers(); +// buf.append(Flags.toString(modifiers)); +// if (modifiers != 0) { +// buf.append(' '); +// } +// buf.append(fIsClass ? "class " : "interface "); //$NON-NLS-2$ //$NON-NLS-1$ +// buf.append(getTypeName()); +// // writeSuperClass(buf, imports); +// // writeSuperInterfaces(buf, imports); +// buf.append('{'); +// buf.append(lineDelimiter); +// buf.append(lineDelimiter); +// buf.append('}'); +// buf.append(lineDelimiter); +// return buf.toString(); +// } /** * @deprecated Overwrite createTypeMembers(IType, IImportsManager, diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java index e87c627..4e3dcea 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java @@ -468,7 +468,7 @@ public class IdentifierIndexManager { } public boolean equals(Object o) { - String s = (String) o; + //String s = (String) o; return compare(this, o) == 0; } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/EditorHighlightingSynchronizer.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/EditorHighlightingSynchronizer.java index 73390c4..9e60ed9 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/EditorHighlightingSynchronizer.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/EditorHighlightingSynchronizer.java @@ -24,7 +24,7 @@ import org.eclipse.jface.text.link.LinkedModeModel; */ public class EditorHighlightingSynchronizer implements ILinkedModeListener { - private final PHPEditor fEditor; + //private final PHPEditor fEditor; // private final boolean fWasOccurrencesOn; @@ -38,7 +38,7 @@ public class EditorHighlightingSynchronizer implements ILinkedModeListener { */ public EditorHighlightingSynchronizer(PHPEditor editor) { Assert.isLegal(editor != null); - fEditor = editor; + //fEditor = editor; // fWasOccurrencesOn= fEditor.isMarkingOccurrences(); // // if (fWasOccurrencesOn) diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/EditorUtility.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/EditorUtility.java index 5952b81..0e1ed18 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/EditorUtility.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/EditorUtility.java @@ -20,7 +20,7 @@ import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.JavaModelException; import net.sourceforge.phpdt.internal.corext.util.JavaModelUtil; import net.sourceforge.phpdt.ui.JavaUI; -import net.sourceforge.phpeclipse.PHPeclipsePlugin; +//import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.ui.WebUI; import org.eclipse.core.resources.IFile; @@ -49,16 +49,16 @@ import org.eclipse.ui.texteditor.ITextEditor; */ public class EditorUtility { - public static boolean isEditorInput(Object element, IEditorPart editor) { - if (editor != null) { - try { - return editor.getEditorInput().equals(getEditorInput(element)); - } catch (JavaModelException x) { - PHPeclipsePlugin.log(x.getStatus()); - } - } - return false; - } +// public static boolean isEditorInput(Object element, IEditorPart editor) { +// if (editor != null) { +// try { +// return editor.getEditorInput().equals(getEditorInput(element)); +// } catch (JavaModelException x) { +// PHPeclipsePlugin.log(x.getStatus()); +// } +// } +// return false; +// } /** * Tests if a cu is currently shown in an editor @@ -66,24 +66,24 @@ public class EditorUtility { * @return the IEditorPart if shown, null if element is not open in an * editor */ - public static IEditorPart isOpenInEditor(Object inputElement) { - IEditorInput input = null; - - try { - input = getEditorInput(inputElement); - } catch (JavaModelException x) { - PHPeclipsePlugin.log(x.getStatus()); - } - - if (input != null) { - IWorkbenchPage p = WebUI.getActivePage(); - if (p != null) { - return p.findEditor(input); - } - } - - return null; - } +// public static IEditorPart isOpenInEditor(Object inputElement) { +// IEditorInput input = null; +// +// try { +// input = getEditorInput(inputElement); +// } catch (JavaModelException x) { +// PHPeclipsePlugin.log(x.getStatus()); +// } +// +// if (input != null) { +// IWorkbenchPage p = WebUI.getActivePage(); +// if (p != null) { +// return p.findEditor(input); +// } +// } +// +// return null; +// } /** * Opens a Java editor for an element such as IJavaElement, @@ -222,20 +222,20 @@ public class EditorUtility { * If the current active editor edits a java element return it, else return * null */ - public static IJavaElement getActiveEditorJavaInput() { - IWorkbenchPage page = WebUI.getActivePage(); - if (page != null) { - IEditorPart part = page.getActiveEditor(); - if (part != null) { - IEditorInput editorInput = part.getEditorInput(); - if (editorInput != null) { - return (IJavaElement) editorInput - .getAdapter(IJavaElement.class); - } - } - } - return null; - } +// public static IJavaElement getActiveEditorJavaInput() { +// IWorkbenchPage page = WebUI.getActivePage(); +// if (page != null) { +// IEditorPart part = page.getActiveEditor(); +// if (part != null) { +// IEditorInput editorInput = part.getEditorInput(); +// if (editorInput != null) { +// return (IJavaElement) editorInput +// .getAdapter(IJavaElement.class); +// } +// } +// } +// return null; +// } /** * Gets the working copy of an compilation unit opened in an editor @@ -264,18 +264,18 @@ public class EditorUtility { * @return the corresponding member in the shared working copy or * null if not found */ - public static IMember getWorkingCopy(IMember member) - throws JavaModelException { - ICompilationUnit cu = member.getCompilationUnit(); - if (cu != null) { - ICompilationUnit workingCopy = getWorkingCopy(cu); - if (workingCopy != null) { - return JavaModelUtil.findMemberInCompilationUnit(workingCopy, - member); - } - } - return null; - } +// public static IMember getWorkingCopy(IMember member) +// throws JavaModelException { +// ICompilationUnit cu = member.getCompilationUnit(); +// if (cu != null) { +// ICompilationUnit workingCopy = getWorkingCopy(cu); +// if (workingCopy != null) { +// return JavaModelUtil.findMemberInCompilationUnit(workingCopy, +// member); +// } +// } +// return null; +// } /** * Returns the compilation unit for the given java element. diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/php/PHPAutoIndentStrategy.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/php/PHPAutoIndentStrategy.java index 0283480..9c961ac 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/php/PHPAutoIndentStrategy.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/phpeditor/php/PHPAutoIndentStrategy.java @@ -261,7 +261,7 @@ public class PHPAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy { int start = document.getLineOffset(line); int whiteend = findEndOfWhiteSpace(document, start, command.offset); - int offset = -1; + //int offset = -1; // if (command.offset > 0 && command.offset < docLength && // document.getChar(command.offset-1) == '{') { // offset = command.offset; diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java index 7ae8cfb..fb23514 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java @@ -800,8 +800,8 @@ public class WebUI extends AbstractUIPlugin implements IPreferenceConstants { | IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE); - ISavedState savedState = workspace.addSaveParticipant( - /*PHPeclipsePlugin*/WebUI.this, modelManager); +// ISavedState savedState = workspace.addSaveParticipant( +// /*PHPeclipsePlugin*/WebUI.this, modelManager); WorkspaceJob processSavedState = new WorkspaceJob( Util.bind("savedState.jobName")) { //$NON-NLS-1$