+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpdt.internal.corext.codemanipulation;
-
-//import net.sourceforge.phpdt.core.Flags;
-import net.sourceforge.phpdt.core.IField;
-import net.sourceforge.phpdt.core.IJavaProject;
-//import net.sourceforge.phpdt.core.IMethod;
-//import net.sourceforge.phpdt.core.IType;
-import net.sourceforge.phpdt.core.JavaModelException;
-import net.sourceforge.phpdt.core.NamingConventions;
-//import net.sourceforge.phpdt.core.Signature;
-import net.sourceforge.phpdt.internal.corext.util.JavaModelUtil;
-//import net.sourceforge.phpdt.internal.corext.util.JdtFlags;
-//import net.sourceforge.phpdt.ui.CodeGeneration;
-//import net.sourceforge.phpdt.ui.PreferenceConstants;
-
-//import org.eclipse.core.runtime.CoreException;
-
-public class GetterSetterUtil {
-
- private static final String[] EMPTY = new String[0];
-
- // no instances
- private GetterSetterUtil() {
- }
-
-// public static String getGetterName(IField field, String[] excludedNames)
-// throws JavaModelException {
-// boolean useIs = PreferenceConstants.getPreferenceStore().getBoolean(
-// PreferenceConstants.CODEGEN_IS_FOR_GETTERS);
-// return getGetterName(field, excludedNames, useIs);
-// }
-
-// private static String getGetterName(IField field, String[] excludedNames,
-// boolean useIsForBoolGetters) throws JavaModelException {
-// if (excludedNames == null) {
-// excludedNames = EMPTY;
-// }
-// return getGetterName(field.getJavaProject(), field.getElementName(),
-// field.getFlags(), useIsForBoolGetters
-// && JavaModelUtil.isBoolean(field), excludedNames);
-// }
-
- public static String getGetterName(IJavaProject project, String fieldName,
- int flags, boolean isBoolean, String[] excludedNames) {
- return NamingConventions.suggestGetterName(project, fieldName, flags,
- isBoolean, excludedNames);
- }
-
-// public static String getSetterName(IJavaProject project, String fieldName,
-// int flags, boolean isBoolean, String[] excludedNames) {
-// return NamingConventions.suggestSetterName(project, fieldName, flags,
-// isBoolean, excludedNames);
-// }
-
- public static String getSetterName(IField field, String[] excludedNames)
- throws JavaModelException {
- if (excludedNames == null) {
- excludedNames = EMPTY;
- }
- return NamingConventions.suggestSetterName(field.getJavaProject(),
- field.getElementName(), field.getFlags(), JavaModelUtil
- .isBoolean(field), excludedNames);
- }
-
-// public static IMethod getGetter(IField field) throws JavaModelException {
-// IMethod primaryCandidate = JavaModelUtil.findMethod(getGetterName(
-// field, EMPTY, true), new String[0], false, field
-// .getDeclaringType());
-// if (!JavaModelUtil.isBoolean(field)
-// || (primaryCandidate != null && primaryCandidate.exists()))
-// return primaryCandidate;
-// // bug 30906 describes why we need to look for other alternatives here
-// String secondCandidateName = getGetterName(field, EMPTY, false);
-// return JavaModelUtil.findMethod(secondCandidateName, new String[0],
-// false, field.getDeclaringType());
-// }
-
-// public static IMethod getSetter(IField field) throws JavaModelException {
-// String[] args = new String[] { field.getTypeSignature() };
-// return JavaModelUtil.findMethod(getSetterName(field, EMPTY), args,
-// false, field.getDeclaringType());
-// }
-
- /**
- * Create a stub for a getter of the given field using getter/setter
- * templates. The resulting code has to be formatted and indented.
- *
- * @param field
- * The field to create a getter for
- * @param setterName
- * The chosen name for the setter
- * @param addComments
- * If <code>true</code>, comments will be added.
- * @param flags
- * The flags signaling visibility, if static, synchronized or
- * final
- * @return Returns the generated stub.
- * @throws CoreException
- */
-// public static String getSetterStub(IField field, String setterName,
-// boolean addComments, int flags) throws CoreException {
-//
-// String fieldName = field.getElementName();
-// IType parentType = field.getDeclaringType();
-//
-// String returnSig = field.getTypeSignature();
-// String typeName = Signature.toString(returnSig);
-//
-// IJavaProject project = field.getJavaProject();
-//
-// String accessorName = NamingConventions
-// .removePrefixAndSuffixForFieldName(project, fieldName, field
-// .getFlags());
-// String argname = StubUtility.suggestArgumentName(project, accessorName,
-// EMPTY);
-//
-// boolean isStatic = Flags.isStatic(flags);
-// // boolean isSync= Flags.isSynchronized(flags);
-// boolean isFinal = Flags.isFinal(flags);
-//
-// // create the setter stub
-// StringBuffer buf = new StringBuffer();
-// if (addComments) {
-// String comment = CodeGeneration.getSetterComment(field
-// .getCompilationUnit(),
-// parentType.getTypeQualifiedName('.'), setterName, field
-// .getElementName(), typeName, argname, accessorName,
-// String.valueOf('\n'));
-// if (comment != null) {
-// buf.append(comment);
-// buf.append('\n');
-// }
-// }
-// buf.append(JdtFlags.getVisibilityString(flags));
-// buf.append(' ');
-// if (isStatic)
-// buf.append("static "); //$NON-NLS-1$
-// // if (isSync)
-// // buf.append("synchronized "); //$NON-NLS-1$
-// if (isFinal)
-// buf.append("final "); //$NON-NLS-1$
-//
-// buf.append("void "); //$NON-NLS-1$
-// buf.append(setterName);
-// buf.append('(');
-// buf.append(typeName);
-// buf.append(' ');
-// buf.append(argname);
-// buf.append(") {\n"); //$NON-NLS-1$
-//
-// boolean useThis = PreferenceConstants.getPreferenceStore().getBoolean(
-// PreferenceConstants.CODEGEN_KEYWORD_THIS);
-// if (argname.equals(fieldName) || (useThis && !isStatic)) {
-// if (isStatic)
-// fieldName = parentType.getElementName() + '.' + fieldName;
-// else
-// fieldName = "this." + fieldName; //$NON-NLS-1$
-// }
-// String body = CodeGeneration.getSetterMethodBodyContent(field
-// .getCompilationUnit(), parentType.getTypeQualifiedName('.'),
-// setterName, fieldName, argname, String.valueOf('\n'));
-// if (body != null) {
-// buf.append(body);
-// }
-// buf.append("}\n"); //$NON-NLS-1$
-// return buf.toString();
-// }
-
- /**
- * Create a stub for a getter of the given field using getter/setter
- * templates. The resulting code has to be formatted and indented.
- *
- * @param field
- * The field to create a getter for
- * @param getterName
- * The chosen name for the getter
- * @param addComments
- * If <code>true</code>, comments will be added.
- * @param flags
- * The flags signaling visibility, if static, synchronized or
- * final
- * @return Returns the generated stub.
- * @throws CoreException
- */
-// public static String getGetterStub(IField field, String getterName,
-// boolean addComments, int flags) throws CoreException {
-// String fieldName = field.getElementName();
-// IType parentType = field.getDeclaringType();
-//
-// boolean isStatic = Flags.isStatic(flags);
-// // boolean isSync= Flags.isSynchronized(flags);
-// boolean isFinal = Flags.isFinal(flags);
-//
-// String typeName = Signature.toString(field.getTypeSignature());
-// String accessorName = NamingConventions
-// .removePrefixAndSuffixForFieldName(field.getJavaProject(),
-// fieldName, field.getFlags());
-//
-// // create the getter stub
-// StringBuffer buf = new StringBuffer();
-// if (addComments) {
-// String comment = CodeGeneration.getGetterComment(field
-// .getCompilationUnit(),
-// parentType.getTypeQualifiedName('.'), getterName, field
-// .getElementName(), typeName, accessorName, String
-// .valueOf('\n'));
-// if (comment != null) {
-// buf.append(comment);
-// buf.append('\n');
-// }
-// }
-//
-// buf.append(JdtFlags.getVisibilityString(flags));
-// buf.append(' ');
-// if (isStatic)
-// buf.append("static "); //$NON-NLS-1$
-// // if (isSync)
-// // buf.append("synchronized "); //$NON-NLS-1$
-// if (isFinal)
-// buf.append("final "); //$NON-NLS-1$
-//
-// buf.append(typeName);
-// buf.append(' ');
-// buf.append(getterName);
-// buf.append("() {\n"); //$NON-NLS-1$
-//
-// boolean useThis = PreferenceConstants.getPreferenceStore().getBoolean(
-// PreferenceConstants.CODEGEN_KEYWORD_THIS);
-// if (useThis && !isStatic) {
-// fieldName = "this." + fieldName; //$NON-NLS-1$
-// }
-//
-// String body = CodeGeneration.getGetterMethodBodyContent(field
-// .getCompilationUnit(), parentType.getTypeQualifiedName('.'),
-// getterName, fieldName, String.valueOf('\n'));
-// if (body != null) {
-// buf.append(body);
-// }
-// buf.append("}\n"); //$NON-NLS-1$
-// return buf.toString();
-// }
-
-}
// .asList(new String[] {
// "boolean", "byte", "char", "double", "float", "int", "long", "short" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- public static String suggestArgumentName(IJavaProject project,
- String baseName, String[] excluded) {
- // String[] argnames= getArgumentNameSuggestions(project, baseName, 0,
- // excluded);
- // if (argnames.length > 0) {
- // return argnames[0];
- // }
- return baseName;
- }
+// public static String suggestArgumentName(IJavaProject project,
+// String baseName, String[] excluded) {
+// // String[] argnames= getArgumentNameSuggestions(project, baseName, 0,
+// // excluded);
+// // if (argnames.length > 0) {
+// // return argnames[0];
+// // }
+// return baseName;
+// }
// public static String[] suggestArgumentNames(IJavaProject project,
// String[] paramNames) {
*
* @see net.sourceforge.phpdt.internal.corext.template.ContextType#createContext()
*/
- public TemplateContext createContext() {
- return null;
- }
+// public TemplateContext createContext() {
+// return null;
+// }
public static void registerContextTypes(ContextTypeRegistry registry) {
registry.addContextType(new CodeTemplateContextType(
* @param multiVariableGuess
* The multiVariableGuess to set.
*/
- public void setMultiVariableGuess(MultiVariableGuess multiVariableGuess) {
- fMultiVariableGuess = multiVariableGuess;
- }
+// public void setMultiVariableGuess(MultiVariableGuess multiVariableGuess) {
+// fMultiVariableGuess = multiVariableGuess;
+// }
}
******************************************************************************/
package net.sourceforge.phpdt.internal.ui.actions;
-import java.text.MessageFormat;
+//import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
* the message argument
* @return the string
*/
- public static String getFormattedString(String key, Object arg) {
- return getFormattedString(key, new Object[] { arg });
- }
+// public static String getFormattedString(String key, Object arg) {
+// return getFormattedString(key, new Object[] { arg });
+// }
/**
* Returns the formatted resource string associated with the given key in
* the message arguments
* @return the string
*/
- public static String getFormattedString(String key, Object[] args) {
- return MessageFormat.format(getString(key), args);
- }
+// public static String getFormattedString(String key, Object[] args) {
+// return MessageFormat.format(getString(key), args);
+// }
}
\ No newline at end of file
setGroups(groups);
}
- protected void setGroups(ActionGroup[] groups) {
+ private void setGroups(ActionGroup[] groups) {
Assert.isTrue(fGroups == null);
Assert.isNotNull(groups);
fGroups = groups;
*
* @return <code>true</code> if the group is enabled
*/
- protected boolean isEnabled() {
+ private boolean isEnabled() {
return fViewer != null;
}
*******************************************************************************/
package net.sourceforge.phpdt.internal.ui.actions;
-import java.util.ArrayList;
-import java.util.List;
+//import java.util.ArrayList;
+//import java.util.List;
import net.sourceforge.phpdt.core.IJavaElement;
-import net.sourceforge.phpdt.core.ISourceReference;
+//import net.sourceforge.phpdt.core.ISourceReference;
import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.ui.JavaElementLabelProvider;
import net.sourceforge.phpeclipse.phpeditor.EditorUtility;
/**
* Opens the editor on the given element and subsequently selects it.
*/
- public static void open(Object element) throws JavaModelException,
- PartInitException {
- open(element, true);
- }
+// public static void open(Object element) throws JavaModelException,
+// PartInitException {
+// open(element, true);
+// }
/**
* Opens the editor on the given element and subsequently selects it.
* Filters out source references from the given code resolve results. A
* utility method that can be called by subclassers.
*/
- public static List filterResolveResults(IJavaElement[] codeResolveResults) {
- int nResults = codeResolveResults.length;
- List refs = new ArrayList(nResults);
- for (int i = 0; i < nResults; i++) {
- if (codeResolveResults[i] instanceof ISourceReference)
- refs.add(codeResolveResults[i]);
- }
- return refs;
- }
+// public static List filterResolveResults(IJavaElement[] codeResolveResults) {
+// int nResults = codeResolveResults.length;
+// List refs = new ArrayList(nResults);
+// for (int i = 0; i < nResults; i++) {
+// if (codeResolveResults[i] instanceof ISourceReference)
+// refs.add(codeResolveResults[i]);
+// }
+// return refs;
+// }
/**
* Shows a dialog for resolving an ambigous java element. Utility method
*******************************************************************************/
package net.sourceforge.phpdt.internal.ui.actions;
-import java.util.Iterator;
+//import java.util.Iterator;
import net.sourceforge.phpdt.core.ICompilationUnit;
import net.sourceforge.phpdt.core.IJavaElement;
-import net.sourceforge.phpdt.core.IType;
+//import net.sourceforge.phpdt.core.IType;
import net.sourceforge.phpdt.core.JavaModelException;
-import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
+//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
import net.sourceforge.phpdt.ui.IWorkingCopyManager;
//import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
* An empty array is returned if one of the elements stored in the
* structured selection is not of tupe <code>IJavaElement</code>
*/
- public static IJavaElement[] getElements(IStructuredSelection selection) {
- if (!selection.isEmpty()) {
- IJavaElement[] result = new IJavaElement[selection.size()];
- int i = 0;
- for (Iterator iter = selection.iterator(); iter.hasNext(); i++) {
- Object element = (Object) iter.next();
- if (!(element instanceof IJavaElement))
- return EMPTY_RESULT;
- result[i] = (IJavaElement) element;
- }
- return result;
- }
- return EMPTY_RESULT;
- }
+// public static IJavaElement[] getElements(IStructuredSelection selection) {
+// if (!selection.isEmpty()) {
+// IJavaElement[] result = new IJavaElement[selection.size()];
+// int i = 0;
+// for (Iterator iter = selection.iterator(); iter.hasNext(); i++) {
+// Object element = (Object) iter.next();
+// if (!(element instanceof IJavaElement))
+// return EMPTY_RESULT;
+// result[i] = (IJavaElement) element;
+// }
+// return result;
+// }
+// return EMPTY_RESULT;
+// }
public static boolean canOperateOn(PHPEditor editor) {
if (editor == null)
return result;
}
- public static IJavaElement[] codeResolveOrInputHandled(PHPEditor editor,
- Shell shell, String title) {
- try {
- return codeResolveOrInput(editor);
- } catch (JavaModelException e) {
- ExceptionHandler.handle(e, shell, title, ActionMessages
- .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$
- }
- return null;
- }
+// public static IJavaElement[] codeResolveOrInputHandled(PHPEditor editor,
+// Shell shell, String title) {
+// try {
+// return codeResolveOrInput(editor);
+// } catch (JavaModelException e) {
+// ExceptionHandler.handle(e, shell, title, ActionMessages
+// .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$
+// }
+// return null;
+// }
/**
* Converts the text selection provided by the given editor a Java element
return candidate;
}
- public static IJavaElement codeResolveOrInputHandled(PHPEditor editor,
- Shell shell, String title, String message) {
- try {
- return codeResolveOrInput(editor, shell, title, message);
- } catch (JavaModelException e) {
- ExceptionHandler.handle(e, shell, title, ActionMessages
- .getString("SelectionConverter.codeResolveOrInput_failed")); //$NON-NLS-1$
- }
- return null;
- }
+// public static IJavaElement codeResolveOrInputHandled(PHPEditor editor,
+// Shell shell, String title, String message) {
+// try {
+// return codeResolveOrInput(editor, shell, title, message);
+// } catch (JavaModelException e) {
+// ExceptionHandler.handle(e, shell, title, ActionMessages
+// .getString("SelectionConverter.codeResolveOrInput_failed")); //$NON-NLS-1$
+// }
+// return null;
+// }
public static IJavaElement[] codeResolve(PHPEditor editor)
throws JavaModelException {
* by asking the user if code reolve returned more than one result. If the
* selection doesn't cover a Java element <code>null</code> is returned.
*/
- public static IJavaElement codeResolve(PHPEditor editor, Shell shell,
- String title, String message) throws JavaModelException {
- IJavaElement[] elements = codeResolve(editor);
- if (elements == null || elements.length == 0)
- return null;
- IJavaElement candidate = elements[0];
- if (elements.length > 1) {
- candidate = OpenActionUtil.selectJavaElement(elements, shell,
- title, message);
- }
- return candidate;
- }
+// public static IJavaElement codeResolve(PHPEditor editor, Shell shell,
+// String title, String message) throws JavaModelException {
+// IJavaElement[] elements = codeResolve(editor);
+// if (elements == null || elements.length == 0)
+// return null;
+// IJavaElement candidate = elements[0];
+// if (elements.length > 1) {
+// candidate = OpenActionUtil.selectJavaElement(elements, shell,
+// title, message);
+// }
+// return candidate;
+// }
- public static IJavaElement[] codeResolveHandled(PHPEditor editor,
- Shell shell, String title) {
- try {
- return codeResolve(editor);
- } catch (JavaModelException e) {
- ExceptionHandler.handle(e, shell, title, ActionMessages
- .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$
- }
- return null;
- }
+// public static IJavaElement[] codeResolveHandled(PHPEditor editor,
+// Shell shell, String title) {
+// try {
+// return codeResolve(editor);
+// } catch (JavaModelException e) {
+// ExceptionHandler.handle(e, shell, title, ActionMessages
+// .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$
+// }
+// return null;
+// }
public static IJavaElement getElementAtOffset(PHPEditor editor)
throws JavaModelException {
.getSelectionProvider().getSelection());
}
- public static IType getTypeAtOffset(PHPEditor editor)
- throws JavaModelException {
- IJavaElement element = SelectionConverter.getElementAtOffset(editor);
- IType type = (IType) element.getAncestor(IJavaElement.TYPE);
- if (type == null) {
- ICompilationUnit unit = SelectionConverter
- .getInputAsCompilationUnit(editor);
- if (unit != null)
- type = unit.findPrimaryType();
- }
- return type;
- }
+// public static IType getTypeAtOffset(PHPEditor editor)
+// throws JavaModelException {
+// IJavaElement element = SelectionConverter.getElementAtOffset(editor);
+// IType type = (IType) element.getAncestor(IJavaElement.TYPE);
+// if (type == null) {
+// ICompilationUnit unit = SelectionConverter
+// .getInputAsCompilationUnit(editor);
+// if (unit != null)
+// type = unit.findPrimaryType();
+// }
+// return type;
+// }
public static IJavaElement getInput(PHPEditor editor) {
if (editor == null)
return manager.getWorkingCopy(input);
}
- public static ICompilationUnit getInputAsCompilationUnit(PHPEditor editor) {
- Object editorInput = SelectionConverter.getInput(editor);
- if (editorInput instanceof ICompilationUnit)
- return (ICompilationUnit) editorInput;
- else
- return null;
- }
+// public static ICompilationUnit getInputAsCompilationUnit(PHPEditor editor) {
+// Object editorInput = SelectionConverter.getInput(editor);
+// if (editorInput instanceof ICompilationUnit)
+// return (ICompilationUnit) editorInput;
+// else
+// return null;
+// }
private static IJavaElement[] codeResolve(IJavaElement input,
ITextSelection selection) throws JavaModelException {
* @param elements
* the elements of the list.
*/
- public void setElements(Object[] elements) {
- fElements = elements;
- }
+// public void setElements(Object[] elements) {
+// fElements = elements;
+// }
/*
* @see SelectionStatusDialog#computeResult()
private Image fImage;
- private boolean fStatusLineAboveButtons;
+ //private boolean fStatusLineAboveButtons;
/**
* Creates an instane of a status dialog.
*/
public StatusDialog(Shell parent) {
super(parent);
- fStatusLineAboveButtons = false;
+ //fStatusLineAboveButtons = false;
}
/**
* <code>false</code> to the right
*/
public void setStatusLineAboveButtons(boolean aboveButtons) {
- fStatusLineAboveButtons = aboveButtons;
+ //fStatusLineAboveButtons = aboveButtons;
}
/**
* <code>true</code> if the drop adapter is supposed to show
* insertion feedback. Otherwise <code>false</code>
*/
- public void showInsertionFeedback(boolean showInsertionFeedback) {
- fShowInsertionFeedback = showInsertionFeedback;
- }
+// public void showInsertionFeedback(boolean showInsertionFeedback) {
+// fShowInsertionFeedback = showInsertionFeedback;
+// }
/**
* Returns the viewer this adapter is working on.
*/
- protected StructuredViewer getViewer() {
- return fViewer;
- }
+// protected StructuredViewer getViewer() {
+// return fViewer;
+// }
// ---- Hooks to override
// -----------------------------------------------------
*******************************************************************************/
package net.sourceforge.phpdt.internal.ui.phpdocexport;
-import java.text.MessageFormat;
+//import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
* @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);
+// }
}
*/
package net.sourceforge.phpdt.internal.ui.preferences;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
+//import java.io.BufferedReader;
+//import java.io.IOException;
+//import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Hashtable;
import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.core.ToolFactory;
import net.sourceforge.phpdt.internal.ui.PHPUIMessages;
-import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
-import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
+//import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
+//import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
//import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.ui.WebUI;
-import org.eclipse.core.runtime.IStatus;
+//import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.text.Document;
+//import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
+//import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
+//import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
*
* @deprecated Inline to avoid reference to preference page
*/
- public static boolean isCompactingAssignment() {
- return COMPACT.equals(JavaCore.getOptions().get(
- PREF_STYLE_COMPACT_ASSIGNEMENT));
- }
+// public static boolean isCompactingAssignment() {
+// return COMPACT.equals(JavaCore.getOptions().get(
+// PREF_STYLE_COMPACT_ASSIGNEMENT));
+// }
/**
* Gets the current compating assignement configuration
*
* @deprecated Inline to avoid reference to preference page
*/
- public static boolean useSpaces() {
- return SPACE.equals(JavaCore.getOptions().get(PREF_TAB_CHAR));
- }
+// public static boolean useSpaces() {
+// return SPACE.equals(JavaCore.getOptions().get(PREF_TAB_CHAR));
+// }
private static int getPositiveIntValue(String string, int dflt) {
try {
// private SourceViewer fSourceViewer;
- public CodeFormatterPreferencePage() {
- setPreferenceStore(WebUI.getDefault().getPreferenceStore());
- setDescription(PHPUIMessages
- .getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$
-
- fWorkingValues = JavaCore.getOptions();
- fCheckBoxes = new ArrayList();
- fTextBoxes = new ArrayList();
-
- fButtonSelectionListener = new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (!e.widget.isDisposed()) {
- controlChanged((Button) e.widget);
- }
- }
- };
-
- fTextModifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (!e.widget.isDisposed()) {
- textChanged((Text) e.widget);
- }
- }
- };
-
- fPreviewDocument = new Document();
- fPreviewText = loadPreviewFile("CodeFormatterPreviewCode.txt"); //$NON-NLS-1$
- }
+// public CodeFormatterPreferencePage() {
+// setPreferenceStore(WebUI.getDefault().getPreferenceStore());
+// setDescription(PHPUIMessages
+// .getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$
+//
+// fWorkingValues = JavaCore.getOptions();
+// fCheckBoxes = new ArrayList();
+// fTextBoxes = new ArrayList();
+//
+// fButtonSelectionListener = new SelectionListener() {
+// public void widgetDefaultSelected(SelectionEvent e) {
+// }
+//
+// public void widgetSelected(SelectionEvent e) {
+// if (!e.widget.isDisposed()) {
+// controlChanged((Button) e.widget);
+// }
+// }
+// };
+//
+// fTextModifyListener = new ModifyListener() {
+// public void modifyText(ModifyEvent e) {
+// if (!e.widget.isDisposed()) {
+// textChanged((Text) e.widget);
+// }
+// }
+// };
+//
+// fPreviewDocument = new Document();
+// fPreviewText = loadPreviewFile("CodeFormatterPreviewCode.txt"); //$NON-NLS-1$
+// }
/*
* @see IWorkbenchPreferencePage#init()
return textBox;
}
- private void controlChanged(Button button) {
- ControlData data = (ControlData) button.getData();
- boolean selection = button.getSelection();
- String newValue = data.getValue(selection);
- fWorkingValues.put(data.getKey(), newValue);
- updatePreview();
-
- if (PREF_TAB_CHAR.equals(data.getKey())) {
- updateStatus(new StatusInfo());
- if (selection) {
- fTabSizeTextBox.setText((String) fWorkingValues
- .get(PREF_TAB_SIZE));
- }
- }
- }
-
- private void textChanged(Text textControl) {
- String key = (String) textControl.getData();
- String number = textControl.getText();
- IStatus status = validatePositiveNumber(number);
- if (!status.matches(IStatus.ERROR)) {
- fWorkingValues.put(key, number);
- }
- // if (PREF_TAB_SIZE.equals(key)) {
- // fSourceViewer.getTextWidget().setTabs(getPositiveIntValue(number,
- // 0));
- // }
- updateStatus(status);
- updatePreview();
- }
+// private void controlChanged(Button button) {
+// ControlData data = (ControlData) button.getData();
+// boolean selection = button.getSelection();
+// String newValue = data.getValue(selection);
+// fWorkingValues.put(data.getKey(), newValue);
+// updatePreview();
+//
+// if (PREF_TAB_CHAR.equals(data.getKey())) {
+// updateStatus(new StatusInfo());
+// if (selection) {
+// fTabSizeTextBox.setText((String) fWorkingValues
+// .get(PREF_TAB_SIZE));
+// }
+// }
+// }
+
+// private void textChanged(Text textControl) {
+// String key = (String) textControl.getData();
+// String number = textControl.getText();
+// IStatus status = validatePositiveNumber(number);
+// if (!status.matches(IStatus.ERROR)) {
+// fWorkingValues.put(key, number);
+// }
+// // if (PREF_TAB_SIZE.equals(key)) {
+// // fSourceViewer.getTextWidget().setTabs(getPositiveIntValue(number,
+// // 0));
+// // }
+// updateStatus(status);
+// updatePreview();
+// }
/*
* @see IPreferencePage#performOk()
super.performDefaults();
}
- private String loadPreviewFile(String filename) {
- String separator = System.getProperty("line.separator"); //$NON-NLS-1$
- StringBuffer btxt = new StringBuffer(512);
- BufferedReader rin = null;
- try {
- rin = new BufferedReader(new InputStreamReader(getClass()
- .getResourceAsStream(filename)));
- String line;
- while ((line = rin.readLine()) != null) {
- btxt.append(line);
- btxt.append(separator);
- }
- } catch (IOException io) {
- WebUI.log(io);
- } finally {
- if (rin != null) {
- try {
- rin.close();
- } catch (IOException e) {
- }
- }
- }
- return btxt.toString();
- }
+// private String loadPreviewFile(String filename) {
+// String separator = System.getProperty("line.separator"); //$NON-NLS-1$
+// StringBuffer btxt = new StringBuffer(512);
+// BufferedReader rin = null;
+// try {
+// rin = new BufferedReader(new InputStreamReader(getClass()
+// .getResourceAsStream(filename)));
+// String line;
+// while ((line = rin.readLine()) != null) {
+// btxt.append(line);
+// btxt.append(separator);
+// }
+// } catch (IOException io) {
+// WebUI.log(io);
+// } finally {
+// if (rin != null) {
+// try {
+// rin.close();
+// } catch (IOException e) {
+// }
+// }
+// }
+// return btxt.toString();
+// }
private void updatePreview() {
ICodeFormatter formatter = ToolFactory
}
}
- private IStatus validatePositiveNumber(String number) {
- StatusInfo status = new StatusInfo();
- if (number.length() == 0) {
- status.setError(PHPUIMessages
- .getString("CodeFormatterPreferencePage.empty_input")); //$NON-NLS-1$
- } else {
- try {
- int value = Integer.parseInt(number);
- if (value < 0) {
- status
- .setError(PHPUIMessages
- .getFormattedString(
- "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$
- }
- } catch (NumberFormatException e) {
- status.setError(PHPUIMessages.getFormattedString(
- "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$
- }
- }
- return status;
- }
-
- private void updateStatus(IStatus status) {
- if (!status.matches(IStatus.ERROR)) {
- // look if there are more severe errors
- for (int i = 0; i < fTextBoxes.size(); i++) {
- Text curr = (Text) fTextBoxes.get(i);
- if (!(curr == fTabSizeTextBox && usesTabs())) {
- IStatus currStatus = validatePositiveNumber(curr.getText());
- status = StatusUtil.getMoreSevere(currStatus, status);
- }
- }
- }
- setValid(!status.matches(IStatus.ERROR));
- StatusUtil.applyToStatusLine(this, status);
- }
-
- private boolean usesTabs() {
- return TAB.equals(fWorkingValues.get(PREF_TAB_CHAR));
- }
+// private IStatus validatePositiveNumber(String number) {
+// StatusInfo status = new StatusInfo();
+// if (number.length() == 0) {
+// status.setError(PHPUIMessages
+// .getString("CodeFormatterPreferencePage.empty_input")); //$NON-NLS-1$
+// } else {
+// try {
+// int value = Integer.parseInt(number);
+// if (value < 0) {
+// status
+// .setError(PHPUIMessages
+// .getFormattedString(
+// "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$
+// }
+// } catch (NumberFormatException e) {
+// status.setError(PHPUIMessages.getFormattedString(
+// "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$
+// }
+// }
+// return status;
+// }
+
+// private void updateStatus(IStatus status) {
+// if (!status.matches(IStatus.ERROR)) {
+// // look if there are more severe errors
+// for (int i = 0; i < fTextBoxes.size(); i++) {
+// Text curr = (Text) fTextBoxes.get(i);
+// if (!(curr == fTabSizeTextBox && usesTabs())) {
+// IStatus currStatus = validatePositiveNumber(curr.getText());
+// status = StatusUtil.getMoreSevere(currStatus, status);
+// }
+// }
+// }
+// setValid(!status.matches(IStatus.ERROR));
+// StatusUtil.applyToStatusLine(this, status);
+// }
+
+// private boolean usesTabs() {
+// return TAB.equals(fWorkingValues.get(PREF_TAB_CHAR));
+// }
}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpdt.internal.ui.preferences;
-
-//import java.util.StringTokenizer;
-
-import net.sourceforge.phpdt.internal.corext.codemanipulation.CodeGenerationSettings;
-import net.sourceforge.phpdt.internal.corext.util.CodeFormatterUtil;
-import net.sourceforge.phpdt.ui.PreferenceConstants;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
-public class JavaPreferencesSettings {
-
- public static CodeGenerationSettings getCodeGenerationSettings() {
- IPreferenceStore store = PreferenceConstants.getPreferenceStore();
-
- CodeGenerationSettings res = new CodeGenerationSettings();
- res.createComments = store
- .getBoolean(PreferenceConstants.CODEGEN_ADD_COMMENTS);
- res.useKeywordThis = store
- .getBoolean(PreferenceConstants.CODEGEN_KEYWORD_THIS);
- // res.importOrder= getImportOrderPreference(store);
- res.importThreshold = getImportNumberThreshold(store);
- res.tabWidth = CodeFormatterUtil.getTabWidth();
- return res;
- }
-
- public static int getImportNumberThreshold(IPreferenceStore prefs) {
- int threshold = prefs
- .getInt(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD);
- if (threshold < 0) {
- threshold = Integer.MAX_VALUE;
- }
- return threshold;
- }
-
- // public static String[] getImportOrderPreference(IPreferenceStore prefs) {
- // String str= prefs.getString(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
- // if (str != null) {
- // return unpackList(str, ";"); //$NON-NLS-1$
- // }
- // return new String[0];
- // }
-
-// private static String[] unpackList(String str, String separator) {
-// StringTokenizer tok = new StringTokenizer(str, separator); //$NON-NLS-1$
-// int nTokens = tok.countTokens();
-// String[] res = new String[nTokens];
-// for (int i = 0; i < nTokens; i++) {
-// res[i] = tok.nextToken().trim();
-// }
-// return res;
-// }
-
-}
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
+//import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
return comboBox;
}
- protected void addInversedComboBox(Composite parent, String label,
- String key, String[] values, String[] valueLabels, int indent) {
- ControlData data = new ControlData(key, values);
-
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent = indent;
- gd.horizontalSpan = 3;
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(gd);
-
- Combo comboBox = new Combo(composite, SWT.READ_ONLY);
- comboBox.setItems(valueLabels);
- comboBox.setData(data);
- comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- comboBox.addSelectionListener(getSelectionListener());
-
- Label labelControl = new Label(composite, SWT.LEFT | SWT.WRAP);
- labelControl.setText(label);
- labelControl.setLayoutData(new GridData());
-
- fLabels.put(comboBox, labelControl);
-
- String currValue = (String) fWorkingValues.get(key);
- comboBox.select(data.getSelection(currValue));
-
- fComboBoxes.add(comboBox);
- }
+// protected void addInversedComboBox(Composite parent, String label,
+// String key, String[] values, String[] valueLabels, int indent) {
+// ControlData data = new ControlData(key, values);
+//
+// GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+// gd.horizontalIndent = indent;
+// gd.horizontalSpan = 3;
+//
+// Composite composite = new Composite(parent, SWT.NONE);
+// GridLayout layout = new GridLayout();
+// layout.marginHeight = 0;
+// layout.marginWidth = 0;
+// layout.numColumns = 2;
+// composite.setLayout(layout);
+// composite.setLayoutData(gd);
+//
+// Combo comboBox = new Combo(composite, SWT.READ_ONLY);
+// comboBox.setItems(valueLabels);
+// comboBox.setData(data);
+// comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+// comboBox.addSelectionListener(getSelectionListener());
+//
+// Label labelControl = new Label(composite, SWT.LEFT | SWT.WRAP);
+// labelControl.setText(label);
+// labelControl.setLayoutData(new GridData());
+//
+// fLabels.put(comboBox, labelControl);
+//
+// String currValue = (String) fWorkingValues.get(key);
+// comboBox.select(data.getSelection(currValue));
+//
+// fComboBoxes.add(comboBox);
+// }
protected Text addTextField(Composite parent, String label, String key,
int indent, int widthHint) {
validateSettings(key, number);
}
- protected boolean checkValue(String key, String value) {
- return value.equals(fWorkingValues.get(key));
- }
+// protected boolean checkValue(String key, String value) {
+// return value.equals(fWorkingValues.get(key));
+// }
/*
* (non-javadoc) Update fields and validate. @param changedKey Key that
}
}
- protected Button getCheckBox(String key) {
- for (int i = fCheckBoxes.size() - 1; i >= 0; i--) {
- Button curr = (Button) fCheckBoxes.get(i);
- ControlData data = (ControlData) curr.getData();
- if (key.equals(data.getKey())) {
- return curr;
- }
- }
- return null;
- }
+// protected Button getCheckBox(String key) {
+// for (int i = fCheckBoxes.size() - 1; i >= 0; i--) {
+// Button curr = (Button) fCheckBoxes.get(i);
+// ControlData data = (ControlData) curr.getData();
+// if (key.equals(data.getKey())) {
+// return curr;
+// }
+// }
+// return null;
+// }
protected Combo getComboBox(String key) {
for (int i = fComboBoxes.size() - 1; i >= 0; i--) {
return null;
}
- protected void setComboEnabled(String key, boolean enabled) {
- Combo combo = getComboBox(key);
- Label label = (Label) fLabels.get(combo);
- combo.setEnabled(enabled);
- label.setEnabled(enabled);
- }
+// protected void setComboEnabled(String key, boolean enabled) {
+// Combo combo = getComboBox(key);
+// Label label = (Label) fLabels.get(combo);
+// combo.setEnabled(enabled);
+// label.setEnabled(enabled);
+// }
}
*******************************************************************************/
package net.sourceforge.phpdt.internal.ui.text.java;
-import java.text.MessageFormat;
+//import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
* the string used to get the bundle value, must not be null
* @since 3.0
*/
- public static String getFormattedString(String key, Object arg) {
- String format = null;
- try {
- format = fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- if (arg == null)
- arg = ""; //$NON-NLS-1$
- return MessageFormat.format(format, new Object[] { arg });
- }
+// public static String getFormattedString(String key, Object arg) {
+// String format = null;
+// try {
+// format = fgResourceBundle.getString(key);
+// } catch (MissingResourceException e) {
+// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+// }
+// if (arg == null)
+// arg = ""; //$NON-NLS-1$
+// return MessageFormat.format(format, new Object[] { arg });
+// }
/**
* Gets a string from the resource bundle and formats it with the arguments
* the string used to get the bundle value, must not be null
* @since 3.0
*/
- public static String getFormattedString(String key, Object arg1, Object arg2) {
- String format = null;
- try {
- format = fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- if (arg1 == null)
- arg1 = ""; //$NON-NLS-1$
- if (arg2 == null)
- arg2 = ""; //$NON-NLS-1$
- return MessageFormat.format(format, new Object[] { arg1, arg2 });
- }
+// public static String getFormattedString(String key, Object arg1, Object arg2) {
+// String format = null;
+// try {
+// format = fgResourceBundle.getString(key);
+// } catch (MissingResourceException e) {
+// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+// }
+// if (arg1 == null)
+// arg1 = ""; //$NON-NLS-1$
+// if (arg2 == null)
+// arg2 = ""; //$NON-NLS-1$
+// return MessageFormat.format(format, new Object[] { arg1, arg2 });
+// }
/**
* Gets a string from the resource bundle and formats it with the argument
* the string used to get the bundle value, must not be null
* @since 3.0
*/
- public static String getFormattedString(String key, boolean arg) {
- String format = null;
- try {
- format = fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- return MessageFormat.format(format, new Object[] { new Boolean(arg) });
- }
+// public static String getFormattedString(String key, boolean arg) {
+// String format = null;
+// try {
+// format = fgResourceBundle.getString(key);
+// } catch (MissingResourceException e) {
+// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+// }
+// return MessageFormat.format(format, new Object[] { new Boolean(arg) });
+// }
}
* @param notify
* <code>true</code> if participant should be notified
*/
- public void notifyParticipants(boolean notify) {
- fNotify = notify;
- }
+// public void notifyParticipants(boolean notify) {
+// fNotify = notify;
+// }
/**
* Tells this strategy whether to inform its listeners.
import java.util.Iterator;
import net.sourceforge.phpdt.internal.ui.text.HTMLPrinter;
-import net.sourceforge.phpdt.ui.PreferenceConstants;
+//import net.sourceforge.phpdt.ui.PreferenceConstants;
//import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.phpeditor.JavaAnnotationIterator;
import net.sourceforge.phpeclipse.phpeditor.PHPTextHover;
.getAnnotationPreference(annotation);
}
- static boolean isJavaProblemHover(String id) {
- return PreferenceConstants.ID_PROBLEM_HOVER.equals(id);
- }
+// static boolean isJavaProblemHover(String id) {
+// return PreferenceConstants.ID_PROBLEM_HOVER.equals(id);
+// }
}
import org.eclipse.jface.text.ITextHoverExtension;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.information.IInformationProviderExtension2;
-import org.eclipse.ui.IEditorPart;
+//import org.eclipse.ui.IEditorPart;
/**
* Caution: this implementation is a layer breaker and contains some "shortcuts"
installTextHovers();
}
- public BestMatchHover(IEditorPart editor) {
- this();
- setEditor(editor);
- }
+// public BestMatchHover(IEditorPart editor) {
+// this();
+// setEditor(editor);
+// }
/**
* Installs all text hovers.
* the string used to get the bundle value, must not be null
* @since 3.0
*/
- public static String getFormattedString(String key, Object arg1, Object arg2) {
- String format = null;
- try {
- format = fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- if (arg1 == null)
- arg1 = ""; //$NON-NLS-1$
- if (arg2 == null)
- arg2 = ""; //$NON-NLS-1$
- return MessageFormat.format(format, new Object[] { arg1, arg2 });
- }
+// public static String getFormattedString(String key, Object arg1, Object arg2) {
+// String format = null;
+// try {
+// format = fgResourceBundle.getString(key);
+// } catch (MissingResourceException e) {
+// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+// }
+// if (arg1 == null)
+// arg1 = ""; //$NON-NLS-1$
+// if (arg2 == null)
+// arg2 = ""; //$NON-NLS-1$
+// return MessageFormat.format(format, new Object[] { arg1, arg2 });
+// }
/**
* Gets a string from the resource bundle and formats it with the argument
* the string used to get the bundle value, must not be null
* @since 3.0
*/
- public static String getFormattedString(String key, boolean arg) {
- String format = null;
- try {
- format = fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- return MessageFormat.format(format, new Object[] { new Boolean(arg) });
- }
+// public static String getFormattedString(String key, boolean arg) {
+// String format = null;
+// try {
+// format = fgResourceBundle.getString(key);
+// } catch (MissingResourceException e) {
+// return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+// }
+// return MessageFormat.format(format, new Object[] { new Boolean(arg) });
+// }
}
* <code>null</code> if the status field should be hidden
* @since 3.0
*/
- public SourceViewerInformationControl(Shell parent, String statusFieldText) {
- this(parent, SWT.NONE, statusFieldText);
- }
+// public SourceViewerInformationControl(Shell parent, String statusFieldText) {
+// this(parent, SWT.NONE, statusFieldText);
+// }
/*
* @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object)
import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.TypedPosition;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
+//import org.eclipse.jface.text.contentassist.ICompletionProposal;
/**
* This class manages linked positions in a document. Positions are linked by
* a number of additional choices to be displayed when selecting
* a position of this <code>type</code>.
*/
- public void addPosition(int offset, int length,
- ICompletionProposal[] additionalChoices)
- throws BadLocationException {
- String type = fDocument.get(offset, length);
- addPosition(offset, length, type, additionalChoices);
- }
+// public void addPosition(int offset, int length,
+// ICompletionProposal[] additionalChoices)
+// throws BadLocationException {
+// String type = fDocument.get(offset, length);
+// addPosition(offset, length, type, additionalChoices);
+// }
/**
* Adds a linked position of the specified position type to the manager.
* a number of additional choices to be displayed when selecting
* a position of this <code>type</code>.
*/
- public void addPosition(int offset, int length, String type,
- ICompletionProposal[] additionalChoices)
- throws BadLocationException {
- Position[] positions = getPositions(fDocument);
-
- if (positions != null) {
- for (int i = 0; i < positions.length; i++)
- if (collides(positions[i], offset, length))
- throw new BadLocationException(
- LinkedPositionMessages
- .getString(("LinkedPositionManager.error.position.collision"))); //$NON-NLS-1$
- }
-
- String content = fDocument.get(offset, length);
-
- if (containsLineDelimiters(content))
- throw new BadLocationException(
- LinkedPositionMessages
- .getString(("LinkedPositionManager.error.contains.line.delimiters"))); //$NON-NLS-1$
-
- try {
- fDocument.addPosition(fPositionCategoryName, new ProposalPosition(
- offset, length, type, additionalChoices));
- } catch (BadPositionCategoryException e) {
- WebUI.log(e);
- Assert.isTrue(false);
- }
- }
+// public void addPosition(int offset, int length, String type,
+// ICompletionProposal[] additionalChoices)
+// throws BadLocationException {
+// Position[] positions = getPositions(fDocument);
+//
+// if (positions != null) {
+// for (int i = 0; i < positions.length; i++)
+// if (collides(positions[i], offset, length))
+// throw new BadLocationException(
+// LinkedPositionMessages
+// .getString(("LinkedPositionManager.error.position.collision"))); //$NON-NLS-1$
+// }
+//
+// String content = fDocument.get(offset, length);
+//
+// if (containsLineDelimiters(content))
+// throw new BadLocationException(
+// LinkedPositionMessages
+// .getString(("LinkedPositionManager.error.contains.line.delimiters"))); //$NON-NLS-1$
+//
+// try {
+// fDocument.addPosition(fPositionCategoryName, new ProposalPosition(
+// offset, length, type, additionalChoices));
+// } catch (BadPositionCategoryException e) {
+// WebUI.log(e);
+// Assert.isTrue(false);
+// }
+// }
/**
* Tests if a manager is already active for a document.
*/
- public static boolean hasActiveManager(IDocument document) {
- return fgActiveManagers.get(document) != null;
- }
+// public static boolean hasActiveManager(IDocument document) {
+// return fgActiveManagers.get(document) != null;
+// }
private void install(boolean canCoexist) {
+ position.getLength());
}
- public static boolean excludes(Position position, int offset, int length) {
- return (offset + length <= position.getOffset())
- || (position.getOffset() + position.getLength() <= offset);
- }
+// public static boolean excludes(Position position, int offset, int length) {
+// return (offset + length <= position.getOffset())
+// || (position.getOffset() + position.getLength() <= offset);
+// }
/*
* Collides if spacing if positions intersect each other or are adjacent.
*/
package net.sourceforge.phpdt.internal.ui.text.link;
-import java.text.MessageFormat;
+//import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
* @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);
+// }
}
*
* @param offset
*/
- public void setInitialOffset(int offset) {
- fInitialOffset = offset;
- }
+// public void setInitialOffset(int offset) {
+// fInitialOffset = offset;
+// }
/**
* Sets the final position of the caret when the linked mode is exited
* @return an array of choices, including the initial one. Clients must not
* modify it.
*/
- public ICompletionProposal[] getChoices() {
- updateChoicePositions();
- return fChoices;
- }
+// public ICompletionProposal[] getChoices() {
+// updateChoicePositions();
+// return fChoices;
+// }
/**
*
*/
- private void updateChoicePositions() {
- for (int i = 0; i < fChoices.length; i++) {
- // if (fChoices[i] instanceof JavaCompletionProposal)
- // ((JavaCompletionProposal)fChoices[i]).setReplacementOffset(offset);
- }
- }
+// private void updateChoicePositions() {
+// for (int i = 0; i < fChoices.length; i++) {
+// // if (fChoices[i] instanceof JavaCompletionProposal)
+// // ((JavaCompletionProposal)fChoices[i]).setReplacementOffset(offset);
+// }
+// }
}