* @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)
- 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;
- }
- MarkerUtilities.setCharStart(attributes, charStart);
- MarkerUtilities.setCharEnd(attributes, charEnd);
- MarkerUtilities.createMarker(file, attributes, PROBLEM_ID);
- }
- }
+// private void setMarker(final IFile file, final String message,
+// final int charStart, final int charEnd, final int errorLevel)
+// 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;
+// }
+// MarkerUtilities.setCharStart(attributes, charStart);
+// MarkerUtilities.setCharEnd(attributes, charEnd);
+// MarkerUtilities.createMarker(file, attributes, PROBLEM_ID);
+// }
+// }
/**
* This will set a marker.
* @throws CoreException
* an exception throwed by the MarkerUtilities
*/
- private void setMarker(final IFile file, final String message,
- final int line, final int errorLevel, final String location)
- throws CoreException {
- if (file != null) {
- String markerKind = PROBLEM_ID;
- 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.SEVERITY_INFO));
- markerKind = IMarker.TASK;
- break;
- }
- attributes.put(IMarker.LOCATION, location);
- MarkerUtilities.setLineNumber(attributes, line);
- MarkerUtilities.createMarker(file, attributes, markerKind);
- }
- }
+// private void setMarker(final IFile file, final String message,
+// final int line, final int errorLevel, final String location)
+// throws CoreException {
+// if (file != null) {
+// String markerKind = PROBLEM_ID;
+// 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.SEVERITY_INFO));
+// markerKind = IMarker.TASK;
+// break;
+// }
+// attributes.put(IMarker.LOCATION, location);
+// MarkerUtilities.setLineNumber(attributes, line);
+// MarkerUtilities.createMarker(file, attributes, markerKind);
+// }
+// }
/**
* This will set a marker.
* @throws CoreException
* an exception throwed by the MarkerUtilities
*/
- private void setMarker(final String message, final int charStart,
- final int charEnd, final int errorLevel, final String location)
- throws CoreException {
- if (fFileToParse != null) {
- setMarker(fFileToParse, message, charStart, charEnd, errorLevel,
- location);
- }
- }
+// private void setMarker(final String message, final int charStart,
+// final int charEnd, final int errorLevel, final String location)
+// throws CoreException {
+// if (fFileToParse != null) {
+// setMarker(fFileToParse, message, charStart, charEnd, errorLevel,
+// location);
+// }
+// }
/**
* This will set a marker.
/* package */
// This method is not called. It is left here in case
// we decide to do tool migration in the future
- private static void readInOldTools() {
- readIn20Tools();
- readIn21Tools();
- }
+// private static void readInOldTools() {
+// readIn20Tools();
+// readIn21Tools();
+// }
- private static void readIn21Tools() {
- }
+// private static void readIn21Tools() {
+// }
public static void readIn20Tools() {
boolean migrationSuccessful = true;
/**
* @param parent
*/
- private void buildSettingsComposite(Composite parent) {
-
- // settingsInfoComposite = new Group(parent, SWT.NONE);
- // settingsInfoComposite.setText("Settings");
- // settingsInfoComposite.setLayout(new GridLayout(2,false));
- //
- //
- // //the test suite to launch
- // Label testSuiteLabel = new Label(settingsInfoComposite, SWT.NONE);
- // testSuiteLabel.setText("Test suite to run:");
- // //testSuiteLabel.setLayoutData(new GridData())
- // Text testSuiteText = new Text(settingsInfoComposite, SWT.NONE);
- //
- // //the path to php
- // Label phpPathLabel = new Label(settingsInfoComposite, SWT.NONE);
- // phpPathLabel.setText("php Path:");
- // //testSuiteLabel.setLayoutData(new GridData())
- // Text phpPathText = new Text(settingsInfoComposite, SWT.NONE);
-
- }
+// private void buildSettingsComposite(Composite parent) {
+//
+// // settingsInfoComposite = new Group(parent, SWT.NONE);
+// // settingsInfoComposite.setText("Settings");
+// // settingsInfoComposite.setLayout(new GridLayout(2,false));
+// //
+// //
+// // //the test suite to launch
+// // Label testSuiteLabel = new Label(settingsInfoComposite, SWT.NONE);
+// // testSuiteLabel.setText("Test suite to run:");
+// // //testSuiteLabel.setLayoutData(new GridData())
+// // Text testSuiteText = new Text(settingsInfoComposite, SWT.NONE);
+// //
+// // //the path to php
+// // Label phpPathLabel = new Label(settingsInfoComposite, SWT.NONE);
+// // phpPathLabel.setText("php Path:");
+// // //testSuiteLabel.setLayoutData(new GridData())
+// // Text phpPathText = new Text(settingsInfoComposite, SWT.NONE);
+//
+// }
private void setActions() {
package net.sourceforge.phpdt.internal.corext.codemanipulation;
import java.util.Arrays;
-import java.util.Comparator;
+//import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;
// return result;
// }
- private static String getSeeTag(String declaringClassQualifiedName,
- String methodName, String[] parameterTypesQualifiedNames) {
- StringBuffer buf = new StringBuffer();
- buf.append("@see "); //$NON-NLS-1$
- buf.append(declaringClassQualifiedName);
- buf.append('#');
- buf.append(methodName);
- buf.append('(');
- for (int i = 0; i < parameterTypesQualifiedNames.length; i++) {
- if (i > 0) {
- buf.append(", "); //$NON-NLS-1$
- }
- buf.append(parameterTypesQualifiedNames[i]);
- }
- buf.append(')');
- return buf.toString();
- }
+// private static String getSeeTag(String declaringClassQualifiedName,
+// String methodName, String[] parameterTypesQualifiedNames) {
+// StringBuffer buf = new StringBuffer();
+// buf.append("@see "); //$NON-NLS-1$
+// buf.append(declaringClassQualifiedName);
+// buf.append('#');
+// buf.append(methodName);
+// buf.append('(');
+// for (int i = 0; i < parameterTypesQualifiedNames.length; i++) {
+// if (i > 0) {
+// buf.append(", "); //$NON-NLS-1$
+// }
+// buf.append(parameterTypesQualifiedNames[i]);
+// }
+// buf.append(')');
+// return buf.toString();
+// }
private static String getSeeTag(IMethod overridden)
throws JavaModelException {
*
* @return The found method or null, if nothing found
*/
- private static IMethod findMethod(IMethod method, List allMethods)
- throws JavaModelException {
- String name = method.getElementName();
- String[] paramTypes = method.getParameterTypes();
- boolean isConstructor = method.isConstructor();
-
- for (int i = allMethods.size() - 1; i >= 0; i--) {
- IMethod curr = (IMethod) allMethods.get(i);
- if (JavaModelUtil.isSameMethodSignature(name, paramTypes,
- isConstructor, curr)) {
- return curr;
- }
- }
- return null;
- }
+// private static IMethod findMethod(IMethod method, List allMethods)
+// throws JavaModelException {
+// String name = method.getElementName();
+// String[] paramTypes = method.getParameterTypes();
+// boolean isConstructor = method.isConstructor();
+//
+// for (int i = allMethods.size() - 1; i >= 0; i--) {
+// IMethod curr = (IMethod) allMethods.get(i);
+// if (JavaModelUtil.isSameMethodSignature(name, paramTypes,
+// isConstructor, curr)) {
+// return curr;
+// }
+// }
+// return null;
+// }
/**
* Creates needed constructors for a type.
// name, dimensions, excluded); //$NON-NLS-1$
// return sortByLength(res); // longest first
// }
- private static String[] sortByLength(String[] proposals) {
- Arrays.sort(proposals, new Comparator() {
- public int compare(Object o1, Object o2) {
- return ((String) o2).length() - ((String) o1).length();
- }
- });
- return proposals;
- }
-
- private static String workaround38111(String baseName) {
+// private static String[] sortByLength(String[] proposals) {
+// Arrays.sort(proposals, new Comparator() {
+// public int compare(Object o1, Object o2) {
+// return ((String) o2).length() - ((String) o1).length();
+// }
+// });
+// return proposals;
+// }
+
+/* private static String workaround38111(String baseName) {
if (BASE_TYPES.contains(baseName))
return baseName;
return Character.toUpperCase(baseName.charAt(0))
+ baseName.substring(1);
}
-
+*/
private static final List BASE_TYPES = Arrays
.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$
*******************************************************************************/
package net.sourceforge.phpdt.internal.corext.template.php;
-import java.lang.reflect.InvocationTargetException;
+//import java.lang.reflect.InvocationTargetException;
import net.sourceforge.phpdt.core.ICompilationUnit;
-import net.sourceforge.phpdt.internal.corext.Assert;
-import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitCompletion.LocalVariable;
+//import net.sourceforge.phpdt.internal.corext.Assert;
+//import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitCompletion.LocalVariable;
import net.sourceforge.phpdt.internal.corext.util.Strings;
import net.sourceforge.phpdt.internal.ui.preferences.CodeFormatterPreferencePage;
import net.sourceforge.phpdt.internal.ui.text.template.contentassist.MultiVariable;
-import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
+//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.ui.WebUI;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
+//import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.templates.TemplateException;
import org.eclipse.jface.text.templates.TemplateTranslator;
import org.eclipse.jface.text.templates.TemplateVariable;
-import org.eclipse.swt.widgets.Shell;
+//import org.eclipse.swt.widgets.Shell;
/**
* A context for java source.
}
}
- private static void handleException(Shell shell, Exception e) {
- String title = JavaTemplateMessages
- .getString("JavaContext.error.title"); //$NON-NLS-1$
- if (e instanceof CoreException)
- ExceptionHandler.handle((CoreException) e, shell, title, null);
- else if (e instanceof InvocationTargetException)
- ExceptionHandler.handle((InvocationTargetException) e, shell,
- title, null);
- else {
- PHPeclipsePlugin.log(e);
- MessageDialog.openError(shell, title, e.getMessage());
- }
- }
+// private static void handleException(Shell shell, Exception e) {
+// String title = JavaTemplateMessages
+// .getString("JavaContext.error.title"); //$NON-NLS-1$
+// if (e instanceof CoreException)
+// ExceptionHandler.handle((CoreException) e, shell, title, null);
+// else if (e instanceof InvocationTargetException)
+// ExceptionHandler.handle((InvocationTargetException) e, shell,
+// title, null);
+// else {
+// PHPeclipsePlugin.log(e);
+// MessageDialog.openError(shell, title, e.getMessage());
+// }
+// }
// private CompilationUnitCompletion getCompletion() {
// ICompilationUnit compilationUnit= getCompilationUnit();
// public String guessArrayType() {
// return firstOrNull(guessArrayTypes());
// }
- private String firstOrNull(String[] strings) {
- if (strings.length > 0)
- return strings[0];
- else
- return null;
- }
+// private String firstOrNull(String[] strings) {
+// if (strings.length > 0)
+// return strings[0];
+// else
+// return null;
+// }
/**
* Returns the name of the type of a local array, <code>null</code> if no
//
// return (String[]) ret.toArray(new String[ret.size()]);
// }
- private String getArrayTypeFromLocalArray(
- CompilationUnitCompletion completion, LocalVariable array) {
- String arrayTypeName = array.typeName;
- String typeName = getScalarType(arrayTypeName);
- int dimension = getArrayDimension(arrayTypeName) - 1;
- Assert.isTrue(dimension >= 0);
-
- String qualifiedName = createQualifiedTypeName(array.typePackageName,
- typeName);
- String innerTypeName = completion.simplifyTypeName(qualifiedName);
-
- return innerTypeName == null ? createArray(typeName, dimension)
- : createArray(innerTypeName, dimension);
- }
-
- private static String createArray(String type, int dimension) {
- StringBuffer buffer = new StringBuffer(type);
- for (int i = 0; i < dimension; i++)
- buffer.append("[]"); //$NON-NLS-1$
- return buffer.toString();
- }
-
- private static String getScalarType(String type) {
- return type.substring(0, type.indexOf('['));
- }
-
- private static int getArrayDimension(String type) {
-
- int dimension = 0;
- int index = type.indexOf('[');
-
- while (index != -1) {
- dimension++;
- index = type.indexOf('[', index + 1);
- }
-
- return dimension;
- }
-
- private static String createQualifiedTypeName(String packageName,
- String className) {
- StringBuffer buffer = new StringBuffer();
-
- if (packageName.length() != 0) {
- buffer.append(packageName);
- buffer.append('.');
- }
- buffer.append(className);
-
- return buffer.toString();
- }
+// private String getArrayTypeFromLocalArray(
+// CompilationUnitCompletion completion, LocalVariable array) {
+// String arrayTypeName = array.typeName;
+// String typeName = getScalarType(arrayTypeName);
+// int dimension = getArrayDimension(arrayTypeName) - 1;
+// Assert.isTrue(dimension >= 0);
+//
+// String qualifiedName = createQualifiedTypeName(array.typePackageName,
+// typeName);
+// String innerTypeName = completion.simplifyTypeName(qualifiedName);
+//
+// return innerTypeName == null ? createArray(typeName, dimension)
+// : createArray(innerTypeName, dimension);
+// }
+
+// private static String createArray(String type, int dimension) {
+// StringBuffer buffer = new StringBuffer(type);
+// for (int i = 0; i < dimension; i++)
+// buffer.append("[]"); //$NON-NLS-1$
+// return buffer.toString();
+// }
+
+// private static String getScalarType(String type) {
+// return type.substring(0, type.indexOf('['));
+// }
+
+// private static int getArrayDimension(String type) {
+//
+// int dimension = 0;
+// int index = type.indexOf('[');
+//
+// while (index != -1) {
+// dimension++;
+// index = type.indexOf('[', index + 1);
+// }
+//
+// return dimension;
+// }
+
+// private static String createQualifiedTypeName(String packageName,
+// String className) {
+// StringBuffer buffer = new StringBuffer();
+//
+// if (packageName.length() != 0) {
+// buffer.append(packageName);
+// buffer.append('.');
+// }
+// buffer.append(className);
+//
+// return buffer.toString();
+// }
/**
* Returns a proposal for a variable name of a local array element,
}
}
- private static ImageDescriptor createManaged(String prefix, String name,
- String key) {
- try {
- ImageDescriptor result = ImageDescriptor
- .createFromURL(makeIconFileURL(prefix, name
- .substring(NAME_PREFIX_LENGTH)));
- if (fgAvoidSWTErrorMap == null) {
- fgAvoidSWTErrorMap = new HashMap();
- }
- fgAvoidSWTErrorMap.put(key, result);
- if (fgImageRegistry != null) {
- WebUI
- .logErrorMessage("Image registry already defined"); //$NON-NLS-1$
- }
- return result;
- } catch (MalformedURLException e) {
- return ImageDescriptor.getMissingImageDescriptor();
- }
- }
+// private static ImageDescriptor createManaged(String prefix, String name,
+// String key) {
+// try {
+// ImageDescriptor result = ImageDescriptor
+// .createFromURL(makeIconFileURL(prefix, name
+// .substring(NAME_PREFIX_LENGTH)));
+// if (fgAvoidSWTErrorMap == null) {
+// fgAvoidSWTErrorMap = new HashMap();
+// }
+// fgAvoidSWTErrorMap.put(key, result);
+// if (fgImageRegistry != null) {
+// WebUI
+// .logErrorMessage("Image registry already defined"); //$NON-NLS-1$
+// }
+// return result;
+// } catch (MalformedURLException e) {
+// return ImageDescriptor.getMissingImageDescriptor();
+// }
+// }
protected static ImageDescriptor create(String prefix, String name) {
try {
return contentAssistComposite;
}
- private void createDependency(final Button master, String masterKey,
- final Control slave) {
- indent(slave);
- boolean masterState = fStore.getBoolean(masterKey);
- slave.setEnabled(masterState);
- SelectionListener listener = new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- slave.setEnabled(master.getSelection());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
- master.addSelectionListener(listener);
- fMasterSlaveListeners.add(listener);
- }
-
- private static void indent(Control control) {
- GridData gridData = new GridData();
- gridData.horizontalIndent = 20;
- control.setLayoutData(gridData);
- }
+// private void createDependency(final Button master, String masterKey,
+// final Control slave) {
+// indent(slave);
+// boolean masterState = fStore.getBoolean(masterKey);
+// slave.setEnabled(masterState);
+// SelectionListener listener = new SelectionListener() {
+// public void widgetSelected(SelectionEvent e) {
+// slave.setEnabled(master.getSelection());
+// }
+//
+// public void widgetDefaultSelected(SelectionEvent e) {
+// }
+// };
+// master.addSelectionListener(listener);
+// fMasterSlaveListeners.add(listener);
+// }
+
+// private static void indent(Control control) {
+// GridData gridData = new GridData();
+// gridData.horizontalIndent = 20;
+// control.setLayoutData(gridData);
+// }
private static Text getTextControl(Control[] labelledTextField) {
return (Text) labelledTextField[1];
return new Control[] { labelControl, textControl };
}
- private void addCompletionRadioButtons(Composite contentAssistComposite) {
- Composite completionComposite = new Composite(contentAssistComposite,
- SWT.NONE);
- GridData ccgd = new GridData();
- ccgd.horizontalSpan = 2;
- completionComposite.setLayoutData(ccgd);
- GridLayout ccgl = new GridLayout();
- ccgl.marginWidth = 0;
- ccgl.numColumns = 2;
- completionComposite.setLayout(ccgl);
-
- // SelectionListener completionSelectionListener= new SelectionAdapter()
- // {
- // public void widgetSelected(SelectionEvent e) {
- // boolean insert= fCompletionInsertsRadioButton.getSelection();
- // fStore.setValue(PreferenceConstants.CODEASSIST_INSERT_COMPLETION,
- // insert);
- // }
- // };
- //
- // fCompletionInsertsRadioButton= new Button(completionComposite,
- // SWT.RADIO | SWT.LEFT);
- // fCompletionInsertsRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionInserts"));
- // //$NON-NLS-1$
- // fCompletionInsertsRadioButton.setLayoutData(new GridData());
- // fCompletionInsertsRadioButton.addSelectionListener(completionSelectionListener);
- //
- // fCompletionOverwritesRadioButton= new Button(completionComposite,
- // SWT.RADIO | SWT.LEFT);
- // fCompletionOverwritesRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionOverwrites"));
- // //$NON-NLS-1$
- // fCompletionOverwritesRadioButton.setLayoutData(new GridData());
- // fCompletionOverwritesRadioButton.addSelectionListener(completionSelectionListener);
- }
+// private void addCompletionRadioButtons(Composite contentAssistComposite) {
+// Composite completionComposite = new Composite(contentAssistComposite,
+// SWT.NONE);
+// GridData ccgd = new GridData();
+// ccgd.horizontalSpan = 2;
+// completionComposite.setLayoutData(ccgd);
+// GridLayout ccgl = new GridLayout();
+// ccgl.marginWidth = 0;
+// ccgl.numColumns = 2;
+// completionComposite.setLayout(ccgl);
+//
+// // SelectionListener completionSelectionListener= new SelectionAdapter()
+// // {
+// // public void widgetSelected(SelectionEvent e) {
+// // boolean insert= fCompletionInsertsRadioButton.getSelection();
+// // fStore.setValue(PreferenceConstants.CODEASSIST_INSERT_COMPLETION,
+// // insert);
+// // }
+// // };
+// //
+// // fCompletionInsertsRadioButton= new Button(completionComposite,
+// // SWT.RADIO | SWT.LEFT);
+// // fCompletionInsertsRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionInserts"));
+// // //$NON-NLS-1$
+// // fCompletionInsertsRadioButton.setLayoutData(new GridData());
+// // fCompletionInsertsRadioButton.addSelectionListener(completionSelectionListener);
+// //
+// // fCompletionOverwritesRadioButton= new Button(completionComposite,
+// // SWT.RADIO | SWT.LEFT);
+// // fCompletionOverwritesRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionOverwrites"));
+// // //$NON-NLS-1$
+// // fCompletionOverwritesRadioButton.setLayoutData(new GridData());
+// // fCompletionOverwritesRadioButton.addSelectionListener(completionSelectionListener);
+// }
public void initialize() {
initializeFields();
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.text.Collator;
+//import java.text.Collator;
import java.util.ArrayList;
-import java.util.Comparator;
+//import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.SortedSet;
+//import java.util.SortedSet;
import java.util.StringTokenizer;
-import java.util.TreeSet;
+//import java.util.TreeSet;
import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds;
// });
// return composite;
// }
- private String[][] createAnnotationTypeListModel(
- MarkerAnnotationPreferences preferences) {
- ArrayList listModelItems = new ArrayList();
- SortedSet sortedPreferences = new TreeSet(new Comparator() {
- /*
- * @see java.util.Comparator#compare(java.lang.Object,
- * java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- if (!(o2 instanceof AnnotationPreference))
- return -1;
- if (!(o1 instanceof AnnotationPreference))
- return 1;
- AnnotationPreference a1 = (AnnotationPreference) o1;
- AnnotationPreference a2 = (AnnotationPreference) o2;
- return Collator.getInstance().compare(a1.getPreferenceLabel(),
- a2.getPreferenceLabel());
- }
- });
- sortedPreferences.addAll(preferences.getAnnotationPreferences());
- Iterator e = sortedPreferences.iterator();
- while (e.hasNext()) {
- AnnotationPreference info = (AnnotationPreference) e.next();
- listModelItems.add(new String[] { info.getPreferenceLabel(),
- info.getColorPreferenceKey(), info.getTextPreferenceKey(),
- info.getOverviewRulerPreferenceKey(),
- info.getHighlightPreferenceKey(),
- info.getVerticalRulerPreferenceKey(),
- info.getTextStylePreferenceKey() });
- }
- String[][] items = new String[listModelItems.size()][];
- listModelItems.toArray(items);
- return items;
- }
+// private String[][] createAnnotationTypeListModel(
+// MarkerAnnotationPreferences preferences) {
+// ArrayList listModelItems = new ArrayList();
+// SortedSet sortedPreferences = new TreeSet(new Comparator() {
+// /*
+// * @see java.util.Comparator#compare(java.lang.Object,
+// * java.lang.Object)
+// */
+// public int compare(Object o1, Object o2) {
+// if (!(o2 instanceof AnnotationPreference))
+// return -1;
+// if (!(o1 instanceof AnnotationPreference))
+// return 1;
+// AnnotationPreference a1 = (AnnotationPreference) o1;
+// AnnotationPreference a2 = (AnnotationPreference) o2;
+// return Collator.getInstance().compare(a1.getPreferenceLabel(),
+// a2.getPreferenceLabel());
+// }
+// });
+// sortedPreferences.addAll(preferences.getAnnotationPreferences());
+// Iterator e = sortedPreferences.iterator();
+// while (e.hasNext()) {
+// AnnotationPreference info = (AnnotationPreference) e.next();
+// listModelItems.add(new String[] { info.getPreferenceLabel(),
+// info.getColorPreferenceKey(), info.getTextPreferenceKey(),
+// info.getOverviewRulerPreferenceKey(),
+// info.getHighlightPreferenceKey(),
+// info.getVerticalRulerPreferenceKey(),
+// info.getTextStylePreferenceKey() });
+// }
+// String[][] items = new String[listModelItems.size()][];
+// listModelItems.toArray(items);
+// return items;
+// }
private Control createTypingPage(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
return composite;
}
- private void addFiller(Composite composite) {
- Label filler = new Label(composite, SWT.LEFT);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
- gd.heightHint = convertHeightInCharsToPixels(1) / 2;
- filler.setLayoutData(gd);
- }
+// private void addFiller(Composite composite) {
+// Label filler = new Label(composite, SWT.LEFT);
+// GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+// gd.horizontalSpan = 2;
+// gd.heightHint = convertHeightInCharsToPixels(1) / 2;
+// filler.setLayoutData(gd);
+// }
private static void indent(Control control) {
GridData gridData = new GridData();
});
}
- private void addCompletionRadioButtons(Composite contentAssistComposite) {
- Composite completionComposite = new Composite(contentAssistComposite,
- SWT.NONE);
- GridData ccgd = new GridData();
- ccgd.horizontalSpan = 2;
- completionComposite.setLayoutData(ccgd);
- GridLayout ccgl = new GridLayout();
- ccgl.marginWidth = 0;
- ccgl.numColumns = 2;
- completionComposite.setLayout(ccgl);
- // SelectionListener completionSelectionListener= new SelectionAdapter()
- // {
- // public void widgetSelected(SelectionEvent e) {
- // boolean insert= fCompletionInsertsRadioButton.getSelection();
- // fOverlayStore.setValue(PreferenceConstants.CODEASSIST_INSERT_COMPLETION,
- // insert);
- // }
- // };
- //
- // fCompletionInsertsRadioButton= new Button(completionComposite,
- // SWT.RADIO
- // | SWT.LEFT);
- // fCompletionInsertsRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionInserts"));
- // //$NON-NLS-1$
- // fCompletionInsertsRadioButton.setLayoutData(new GridData());
- // fCompletionInsertsRadioButton.addSelectionListener(completionSelectionListener);
- //
- // fCompletionOverwritesRadioButton= new Button(completionComposite,
- // SWT.RADIO | SWT.LEFT);
- // fCompletionOverwritesRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionOverwrites"));
- // //$NON-NLS-1$
- // fCompletionOverwritesRadioButton.setLayoutData(new GridData());
- // fCompletionOverwritesRadioButton.addSelectionListener(completionSelectionListener);
- }
+// private void addCompletionRadioButtons(Composite contentAssistComposite) {
+// Composite completionComposite = new Composite(contentAssistComposite,
+// SWT.NONE);
+// GridData ccgd = new GridData();
+// ccgd.horizontalSpan = 2;
+// completionComposite.setLayoutData(ccgd);
+// GridLayout ccgl = new GridLayout();
+// ccgl.marginWidth = 0;
+// ccgl.numColumns = 2;
+// completionComposite.setLayout(ccgl);
+// // SelectionListener completionSelectionListener= new SelectionAdapter()
+// // {
+// // public void widgetSelected(SelectionEvent e) {
+// // boolean insert= fCompletionInsertsRadioButton.getSelection();
+// // fOverlayStore.setValue(PreferenceConstants.CODEASSIST_INSERT_COMPLETION,
+// // insert);
+// // }
+// // };
+// //
+// // fCompletionInsertsRadioButton= new Button(completionComposite,
+// // SWT.RADIO
+// // | SWT.LEFT);
+// // fCompletionInsertsRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionInserts"));
+// // //$NON-NLS-1$
+// // fCompletionInsertsRadioButton.setLayoutData(new GridData());
+// // fCompletionInsertsRadioButton.addSelectionListener(completionSelectionListener);
+// //
+// // fCompletionOverwritesRadioButton= new Button(completionComposite,
+// // SWT.RADIO | SWT.LEFT);
+// // fCompletionOverwritesRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionOverwrites"));
+// // //$NON-NLS-1$
+// // fCompletionOverwritesRadioButton.setLayoutData(new GridData());
+// // fCompletionOverwritesRadioButton.addSelectionListener(completionSelectionListener);
+// }
private Control createNavigationPage(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
}
}
- private IStatus getBrowserLikeLinksKeyModifierStatus() {
- if (fBrowserLikeLinksKeyModifierStatus == null)
- fBrowserLikeLinksKeyModifierStatus = new StatusInfo();
- return fBrowserLikeLinksKeyModifierStatus;
- }
+// private IStatus getBrowserLikeLinksKeyModifierStatus() {
+// if (fBrowserLikeLinksKeyModifierStatus == null)
+// fBrowserLikeLinksKeyModifierStatus = new StatusInfo();
+// return fBrowserLikeLinksKeyModifierStatus;
+// }
/**
* Computes the state mask for the given modifier string.
textLimit, indentation, isNumber));
}
- private static Label getLabelControl(Control[] labelledTextField) {
- return (Label) labelledTextField[0];
- }
+// private static Label getLabelControl(Control[] labelledTextField) {
+// return (Label) labelledTextField[0];
+// }
private static Text getTextControl(Control[] labelledTextField) {
return (Text) labelledTextField[1];
*******************************************************************************/
package net.sourceforge.phpdt.internal.ui.preferences;
-import java.util.StringTokenizer;
+//import java.util.StringTokenizer;
import net.sourceforge.phpdt.internal.corext.codemanipulation.CodeGenerationSettings;
import net.sourceforge.phpdt.internal.corext.util.CodeFormatterUtil;
// 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;
- }
+// 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 java.util.Map;
import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
-import net.sourceforge.phpdt.internal.ui.util.PixelConverter;
+//import net.sourceforge.phpdt.internal.ui.util.PixelConverter;
import net.sourceforge.phpdt.ui.PreferenceConstants;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
+//import org.eclipse.swt.widgets.Label;
/**
* Configures Java Editor hover preferences.
return composite;
}
- private void addFiller(Composite composite) {
- PixelConverter pixelConverter = new PixelConverter(composite);
-
- Label filler = new Label(composite, SWT.LEFT);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
- gd.heightHint = pixelConverter.convertHeightInCharsToPixels(1) / 2;
- filler.setLayoutData(gd);
- }
+// private void addFiller(Composite composite) {
+// PixelConverter pixelConverter = new PixelConverter(composite);
+//
+// Label filler = new Label(composite, SWT.LEFT);
+// GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+// gd.horizontalSpan = 2;
+// gd.heightHint = pixelConverter.convertHeightInCharsToPixels(1) / 2;
+// filler.setLayoutData(gd);
+// }
private Button addCheckBox(Composite parent, String label, String key,
int indentation) {
return 1; // sensible default
}
- private boolean prefIndentBracesForBlocks() {
- Plugin plugin = JavaCore.getPlugin();
- if (plugin != null) {
- String option = JavaCore
- .getOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK);
- return option
- .equals(DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- }
-
- return false; // sensible default
- }
-
- private boolean prefIndentBracesForArrays() {
- Plugin plugin = JavaCore.getPlugin();
- if (plugin != null) {
- String option = JavaCore
- .getOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER);
- return option
- .equals(DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- }
-
- return false; // sensible default
- }
-
- private boolean prefIndentBracesForMethods() {
- Plugin plugin = JavaCore.getPlugin();
- if (plugin != null) {
- String option = JavaCore
- .getOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION);
- return option
- .equals(DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- }
-
- return false; // sensible default
- }
+// private boolean prefIndentBracesForBlocks() {
+// Plugin plugin = JavaCore.getPlugin();
+// if (plugin != null) {
+// String option = JavaCore
+// .getOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK);
+// return option
+// .equals(DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
+// }
+//
+// return false; // sensible default
+// }
+
+// private boolean prefIndentBracesForArrays() {
+// Plugin plugin = JavaCore.getPlugin();
+// if (plugin != null) {
+// String option = JavaCore
+// .getOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER);
+// return option
+// .equals(DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
+// }
+//
+// return false; // sensible default
+// }
+
+// private boolean prefIndentBracesForMethods() {
+// Plugin plugin = JavaCore.getPlugin();
+// if (plugin != null) {
+// String option = JavaCore
+// .getOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION);
+// return option
+// .equals(DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
+// }
+//
+// return false; // sensible default
+// }
private int prefContinuationIndent() {
Plugin plugin = JavaCore.getPlugin();
import java.text.BreakIterator;
import net.sourceforge.phpdt.core.ICompilationUnit;
-import net.sourceforge.phpdt.core.IJavaElement;
+//import net.sourceforge.phpdt.core.IJavaElement;
import net.sourceforge.phpdt.core.IMethod;
import net.sourceforge.phpdt.core.ISourceRange;
import net.sourceforge.phpdt.core.IType;
}
}
- private String createJavaDocTags(IDocument document,
- DocumentCommand command, String indentation, String lineDelimiter,
- ICompilationUnit unit) throws CoreException, BadLocationException {
- IJavaElement element = unit.getElementAt(command.offset);
- if (element == null)
- return null;
-
- switch (element.getElementType()) {
- case IJavaElement.TYPE:
- return createTypeTags(document, command, indentation,
- lineDelimiter, (IType) element);
-
- case IJavaElement.METHOD:
- return createMethodTags(document, command, indentation,
- lineDelimiter, (IMethod) element);
-
- default:
- return null;
- }
- }
+// private String createJavaDocTags(IDocument document,
+// DocumentCommand command, String indentation, String lineDelimiter,
+// ICompilationUnit unit) throws CoreException, BadLocationException {
+// IJavaElement element = unit.getElementAt(command.offset);
+// if (element == null)
+// return null;
+//
+// switch (element.getElementType()) {
+// case IJavaElement.TYPE:
+// return createTypeTags(document, command, indentation,
+// lineDelimiter, (IType) element);
+//
+// case IJavaElement.METHOD:
+// return createMethodTags(document, command, indentation,
+// lineDelimiter, (IMethod) element);
+//
+// default:
+// return null;
+// }
+// }
/*
* Removes start and end of a comment and corrects indentation and line
*/
public class PHPDocCompletionProcessor implements IContentAssistProcessor {
- private static class PHPDocCompletionProposalComparator implements
- Comparator {
- public int compare(Object o1, Object o2) {
- ICompletionProposal c1 = (ICompletionProposal) o1;
- ICompletionProposal c2 = (ICompletionProposal) o2;
- return c1.getDisplayString().compareTo(c2.getDisplayString());
- }
- };
+// private static class PHPDocCompletionProposalComparator implements
+// Comparator {
+// public int compare(Object o1, Object o2) {
+// ICompletionProposal c1 = (ICompletionProposal) o1;
+// ICompletionProposal c2 = (ICompletionProposal) o2;
+// return c1.getDisplayString().compareTo(c2.getDisplayString());
+// }
+// };
// private IEditorPart fEditor;
// private IWorkingCopyManager fManager;
return false;
}
- private static boolean confirmSynchronized(IJavaElement member) {
- // Synchronized types are allowed but meaningless.
- return member.getElementType() != IJavaElement.TYPE;
- }
+// private static boolean confirmSynchronized(IJavaElement member) {
+// // Synchronized types are allowed but meaningless.
+// return member.getElementType() != IJavaElement.TYPE;
+// }
public static ImageDescriptor getMethodImageDescriptor(
boolean isInInterface, int flags) {
}
}
- private int appendToGroup(IMenuManager menu, IAction action) {
- if (action != null && action.isEnabled()) {
- menu.appendToGroup(fGroupName, action);
- return 1;
- }
- return 0;
- }
-
- private int addAction(IMenuManager menu, IAction action) {
- if (action != null && action.isEnabled()) {
- menu.add(action);
- return 1;
- }
- return 0;
- }
+// private int appendToGroup(IMenuManager menu, IAction action) {
+// if (action != null && action.isEnabled()) {
+// menu.appendToGroup(fGroupName, action);
+// return 1;
+// }
+// return 0;
+// }
+
+// private int addAction(IMenuManager menu, IAction action) {
+// if (action != null && action.isEnabled()) {
+// menu.add(action);
+// return 1;
+// }
+// return 0;
+// }
private int addEditorAction(IMenuManager menu, String actionID) {
if (fEditor == null)
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
+//import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
+//import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionDelegate;
import org.eclipse.ui.dialogs.ListSelectionDialog;
}
}
- private IWorkbenchPage getActivePage() {
- IWorkbenchWindow workbenchWindow = fEditor.getEditorSite()
- .getWorkbenchWindow();
- IWorkbenchPage page = workbenchWindow.getActivePage();
- return page;
- }
+// private IWorkbenchPage getActivePage() {
+// IWorkbenchWindow workbenchWindow = fEditor.getEditorSite()
+// .getWorkbenchWindow();
+// IWorkbenchPage page = workbenchWindow.getActivePage();
+// return page;
+// }
public IContainer getWorkingLocation(IFileEditorInput editorInput) {
if (editorInput == null || editorInput.getFile() == null) {
return editorInput.getFile().getParent();
}
- private IFile getIncludeFile(IProject project,
- IFileEditorInput editorInput, String relativeFilename) {
- IContainer container = getWorkingLocation(editorInput);
- String fullPath = project.getFullPath().toString();
- IFile file = null;
- if (relativeFilename.startsWith("../")) {
- Path path = new Path(relativeFilename);
- file = container.getFile(path);
- return file;
- }
- int index = relativeFilename.lastIndexOf('/');
-
- if (index >= 0) {
- Path path = new Path(relativeFilename);
- file = project.getFile(path);
- if (file.exists()) {
- return file;
- }
- }
-
- Path path = new Path(relativeFilename);
- file = container.getFile(path);
-
- return file;
- }
+// private IFile getIncludeFile(IProject project,
+// IFileEditorInput editorInput, String relativeFilename) {
+// IContainer container = getWorkingLocation(editorInput);
+// String fullPath = project.getFullPath().toString();
+// IFile file = null;
+// if (relativeFilename.startsWith("../")) {
+// Path path = new Path(relativeFilename);
+// file = container.getFile(path);
+// return file;
+// }
+// int index = relativeFilename.lastIndexOf('/');
+//
+// if (index >= 0) {
+// Path path = new Path(relativeFilename);
+// file = project.getFile(path);
+// if (file.exists()) {
+// return file;
+// }
+// }
+//
+// Path path = new Path(relativeFilename);
+// file = container.getFile(path);
+//
+// return file;
+// }
public void run(IAction action) {
if (fEditor == null) {
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
+//import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
}
}
- private boolean checkEnabled(IStructuredSelection selection) {
- if (selection.isEmpty())
- return false;
- return true;
- }
+// private boolean checkEnabled(IStructuredSelection selection) {
+// if (selection.isEmpty())
+// return false;
+// return true;
+// }
public void run(IAction action) {
if (fEditor == null) {
}
}
- private String getAttributeValue(NamedNodeMap attributes, String name) {
- Node node = attributes.getNamedItem(name);
-
- return node == null ? null : node.getNodeValue();
- }
+// private String getAttributeValue(NamedNodeMap attributes, String name) {
+// Node node = attributes.getNamedItem(name);
+//
+// return node == null ? null : node.getNodeValue();
+// }
/**
* Convenience method for saving to a file.
* the annotation
* @return <code>true</code> iff the annotation is an override annotation
*/
- private boolean isOverrideIndicator(Annotation annotation) {
- return false; // annotation instanceof
- // OverrideIndicatorManager.OverrideIndicator;
- }
+// private boolean isOverrideIndicator(Annotation annotation) {
+// return false; // annotation instanceof
+// // OverrideIndicatorManager.OverrideIndicator;
+// }
/**
* @param annotation
}
- private boolean isQuickFixTarget(Annotation a) {
- return false; // JavaCorrectionProcessor.hasCorrections(a) || a
- // instanceof AssistAnnotation;
- }
+// private boolean isQuickFixTarget(Annotation a) {
+// return false; // JavaCorrectionProcessor.hasCorrections(a) || a
+// // instanceof AssistAnnotation;
+// }
private void triggerAction(String actionID) {
IAction action = getTextEditor().getAction(actionID);
// }
}
- private boolean indicateQuixFixableProblems() {
- return PreferenceConstants.getPreferenceStore().getBoolean(
- PreferenceConstants.EDITOR_CORRECTION_INDICATION);
- }
+// private boolean indicateQuixFixableProblems() {
+// return PreferenceConstants.getPreferenceStore().getBoolean(
+// PreferenceConstants.EDITOR_CORRECTION_INDICATION);
+// }
/*
* @see Annotation#paint
* is <code>true</code>
* @since 3.0
*/
- private boolean getBoolean(IPreferenceStore store, String key) {
- return key != null && store.getBoolean(key);
- }
+// private boolean getBoolean(IPreferenceStore store, String key) {
+// return key != null && store.getBoolean(key);
+// }
protected boolean isPrefQuickDiffAlwaysOn() {
return false; // never show change ruler for the non-editable java
import net.sourceforge.phpeclipse.ui.WebUI;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
+//import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.preference.IPreferenceStore;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
return userdefsyntaxdata;
}
- private static File getSyntaxFile() {
- IPath path = PHPeclipsePlugin.getDefault().getStateLocation();
- path = path.append(PHPSYNTAX_FILE);
- return path.toFile();
- }
+// private static File getSyntaxFile() {
+// IPath path = PHPeclipsePlugin.getDefault().getStateLocation();
+// path = path.append(PHPSYNTAX_FILE);
+// return path.toFile();
+// }
private static String getAttributeValue(NamedNodeMap attributes, String name) {
Node node = attributes.getNamedItem(name);
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
+//import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DocumentCommand;
import org.eclipse.jface.text.IAutoEditStrategy;
}
}
- private static class BracketLevel {
- int fOffset;
-
- int fLength;
-
- LinkedPositionManager fManager;
-
- LinkedPositionUI fEditor;
- };
+// private static class BracketLevel {
+// int fOffset;
+//
+// int fLength;
+//
+// LinkedPositionManager fManager;
+//
+// LinkedPositionUI fEditor;
+// };
private class BracketInserter implements VerifyKeyListener,
LinkedPositionUI.ExitListener {
}
}
- private boolean hasIdentifierToTheLeft(IDocument document, int offset) {
- try {
- int start = offset;
- IRegion startLine = document.getLineInformationOfOffset(start);
- int minStart = startLine.getOffset();
- while (start != minStart
- && Character.isWhitespace(document.getChar(start - 1)))
- --start;
- return start != minStart
- && Scanner.isPHPIdentifierPart(document
- .getChar(start - 1));
- } catch (BadLocationException e) {
- return true;
- }
- }
+// private boolean hasIdentifierToTheLeft(IDocument document, int offset) {
+// try {
+// int start = offset;
+// IRegion startLine = document.getLineInformationOfOffset(start);
+// int minStart = startLine.getOffset();
+// while (start != minStart
+// && Character.isWhitespace(document.getChar(start - 1)))
+// --start;
+// return start != minStart
+// && Scanner.isPHPIdentifierPart(document
+// .getChar(start - 1));
+// } catch (BadLocationException e) {
+// return true;
+// }
+// }
private boolean hasCharacterToTheLeft(IDocument document, int offset,
char character) {
return store.getBoolean(SPACES_FOR_TABS);
}
- private Color getColor(String key) {
- RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), key);
- return getColor(rgb);
- }
+// private Color getColor(String key) {
+// RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), key);
+// return getColor(rgb);
+// }
private Color getColor(RGB rgb) {
JavaTextTools textTools = WebUI.getDefault()
// IVerticalRuler ruler, int styles) {
// return new AdaptedSourceViewer(parent, ruler, styles);
// }
- private boolean isValidSelection(int offset, int length) {
- IDocumentProvider provider = getDocumentProvider();
- if (provider != null) {
- IDocument document = provider.getDocument(getEditorInput());
- if (document != null) {
- int end = offset + length;
- int documentLength = document.getLength();
- return 0 <= offset && offset <= documentLength && 0 <= end
- && end <= documentLength;
- }
- }
- return false;
- }
+// private boolean isValidSelection(int offset, int length) {
+// IDocumentProvider provider = getDocumentProvider();
+// if (provider != null) {
+// IDocument document = provider.getDocument(getEditorInput());
+// if (document != null) {
+// int end = offset + length;
+// int documentLength = document.getLength();
+// return 0 <= offset && offset <= documentLength && 0 <= end
+// && end <= documentLength;
+// }
+// }
+// return false;
+// }
/*
* @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#getInputElement()
/**
* Returns the updated java element for the old java element.
*/
- private IJavaElement findElement(IJavaElement element) {
- if (element == null)
- return null;
- IWorkingCopyManager manager = WebUI.getDefault()
- .getWorkingCopyManager();
- ICompilationUnit unit = manager.getWorkingCopy(getEditorInput());
- if (unit != null) {
- try {
- synchronized (unit) {
- unit.reconcile();
- }
- IJavaElement[] findings = unit.findElements(element);
- if (findings != null && findings.length > 0)
- return findings[0];
- } catch (JavaModelException x) {
- PHPeclipsePlugin.log(x.getStatus());
- // nothing found, be tolerant and go on
- }
- }
- return null;
- }
+// private IJavaElement findElement(IJavaElement element) {
+// if (element == null)
+// return null;
+// IWorkingCopyManager manager = WebUI.getDefault()
+// .getWorkingCopyManager();
+// ICompilationUnit unit = manager.getWorkingCopy(getEditorInput());
+// if (unit != null) {
+// try {
+// synchronized (unit) {
+// unit.reconcile();
+// }
+// IJavaElement[] findings = unit.findElements(element);
+// if (findings != null && findings.length > 0)
+// return findings[0];
+// } catch (JavaModelException x) {
+// PHPeclipsePlugin.log(x.getStatus());
+// // nothing found, be tolerant and go on
+// }
+// }
+// return null;
+// }
/**
* Returns the offset of the given Java element.
*/
- private int getOffset(IJavaElement element) {
- if (element instanceof ISourceReference) {
- ISourceReference sr = (ISourceReference) element;
- try {
- ISourceRange srcRange = sr.getSourceRange();
- if (srcRange != null)
- return srcRange.getOffset();
- } catch (JavaModelException e) {
- }
- }
- return -1;
- }
+// private int getOffset(IJavaElement element) {
+// if (element instanceof ISourceReference) {
+// ISourceReference sr = (ISourceReference) element;
+// try {
+// ISourceRange srcRange = sr.getSourceRange();
+// if (srcRange != null)
+// return srcRange.getOffset();
+// } catch (JavaModelException e) {
+// }
+// }
+// return -1;
+// }
/*
* @see AbstractTextEditor#restoreSelection()
*/
package net.sourceforge.phpeclipse.phpeditor.php;
-import java.util.ArrayList;
+//import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITypedRegion;
+//import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IPartitionTokenScanner;
import org.eclipse.jface.text.rules.IToken;
* @return <code>true</code> if the current offset is in a string else
* returns false.
*/
- private boolean isInString(String contentType) {
- if (fContentType == contentType)
- return (fInString || fInDoubString);
- else
- return false;
- }
+// private boolean isInString(String contentType) {
+// if (fContentType == contentType)
+// return (fInString || fInDoubString);
+// else
+// return false;
+// }
/**
* Returns the previouse partition stack for the given offset.
*
* @return The stack as a string array.
*/
- private String[] getPartitionStack(int offset) {
- ArrayList types = new ArrayList();
- int tmpOffset = 0;
- try {
- ITypedRegion region = fDocument.getPartition(offset);
- tmpOffset = region.getOffset();
- while (tmpOffset - 1 > 0) {
- region = fDocument.getPartition(tmpOffset - 1);
- tmpOffset = region.getOffset();
- types.add(0, region.getType());
- }
- } catch (BadLocationException e) {
- if (DEBUG) {
- e.printStackTrace();
- }
- }
-
- String[] retVal = new String[types.size()];
-
- retVal = (String[]) types.toArray(retVal);
- return retVal;
- }
+// private String[] getPartitionStack(int offset) {
+// ArrayList types = new ArrayList();
+// int tmpOffset = 0;
+// try {
+// ITypedRegion region = fDocument.getPartition(offset);
+// tmpOffset = region.getOffset();
+// while (tmpOffset - 1 > 0) {
+// region = fDocument.getPartition(tmpOffset - 1);
+// tmpOffset = region.getOffset();
+// types.add(0, region.getType());
+// }
+// } catch (BadLocationException e) {
+// if (DEBUG) {
+// e.printStackTrace();
+// }
+// }
+//
+// String[] retVal = new String[types.size()];
+//
+// retVal = (String[]) types.toArray(retVal);
+// return retVal;
+// }
}
return (TypedRegion[]) list.toArray(new TypedRegion[list.size()]);
}
- private void showList(List list) {
- try {
- throw new NullPointerException();
- } catch (Exception e) {
- e.printStackTrace();
- }
- System.out.println(">>>>>List start");
- TypedRegion temp;
- for (int i = 0; i < list.size(); i++) {
- temp = (TypedRegion) list.get(i);
- System.out.print("Offset: ");
- System.out.print(temp.getOffset());
- System.out.print(", Length: ");
- System.out.print(temp.getLength());
- System.out.print(", Type: ");
- System.out.print(temp.getType());
- System.out.println("");
- }
- System.out.println("<<<<<List end");
- }
+// private void showList(List list) {
+// try {
+// throw new NullPointerException();
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// System.out.println(">>>>>List start");
+// TypedRegion temp;
+// for (int i = 0; i < list.size(); i++) {
+// temp = (TypedRegion) list.get(i);
+// System.out.print("Offset: ");
+// System.out.print(temp.getOffset());
+// System.out.print(", Length: ");
+// System.out.print(temp.getLength());
+// System.out.print(", Type: ");
+// System.out.print(temp.getType());
+// System.out.println("");
+// }
+// System.out.println("<<<<<List end");
+// }
private void addOuterPartitions(List list, int offset, int length,
FlatNode prev, FlatNode next) {
import net.sourceforge.phpeclipse.ui.templates.template.BasicCompletionProcessor;
import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLPartitionScanner;
-import org.eclipse.jface.preference.IPreferenceStore;
+//import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
/** Preference key for alphabetic ordering of proposals */
private final static String ORDER_PROPOSALS = PreferenceConstants.CODEASSIST_ORDER_PROPOSALS;
- private static BasicCompletionProcessor getHTMLProcessor(
- ContentAssistant assistant) {
- IContentAssistProcessor p = assistant
- .getContentAssistProcessor(XMLPartitionScanner.XML_TAG);
- if (p instanceof BasicCompletionProcessor)
- return (BasicCompletionProcessor) p;
- return null;
- }
+// private static BasicCompletionProcessor getHTMLProcessor(
+// ContentAssistant assistant) {
+// IContentAssistProcessor p = assistant
+// .getContentAssistProcessor(XMLPartitionScanner.XML_TAG);
+// if (p instanceof BasicCompletionProcessor)
+// return (BasicCompletionProcessor) p;
+// return null;
+// }
- private static void configureHTMLProcessor(ContentAssistant assistant,
- IPreferenceStore store) {
- BasicCompletionProcessor hcp = getHTMLProcessor(assistant);
- if (hcp == null)
- return;
+// private static void configureHTMLProcessor(ContentAssistant assistant,
+// IPreferenceStore store) {
+// BasicCompletionProcessor hcp = getHTMLProcessor(assistant);
+// if (hcp == null)
+// return;
+//
+// String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
+// if (triggers != null)
+// hcp.setCompletionProposalAutoActivationCharacters(triggers
+// .toCharArray());
+//
+// boolean enabled;
+// // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
+// // jdcp.restrictProposalsToMatchingCases(enabled);
+//
+// enabled = store.getBoolean(ORDER_PROPOSALS);
+// // hcp.orderProposalsAlphabetically(enabled);
+// }
- String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
- if (triggers != null)
- hcp.setCompletionProposalAutoActivationCharacters(triggers
- .toCharArray());
-
- boolean enabled;
- // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
- // jdcp.restrictProposalsToMatchingCases(enabled);
-
- enabled = store.getBoolean(ORDER_PROPOSALS);
- // hcp.orderProposalsAlphabetically(enabled);
- }
-
- private static void changeHTMLProcessor(ContentAssistant assistant,
- IPreferenceStore store, String key) {
- BasicCompletionProcessor jdcp = getHTMLProcessor(assistant);
- if (jdcp == null)
- return;
-
- if (AUTOACTIVATION_TRIGGERS_HTML.equals(key)) {
- String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
- if (triggers != null)
- jdcp.setCompletionProposalAutoActivationCharacters(triggers
- .toCharArray());
- // } else if (CASE_SENSITIVITY.equals(key)) {
- // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
- // jdcp.restrictProposalsToMatchingCases(enabled);
- } else if (ORDER_PROPOSALS.equals(key)) {
- boolean enable = store.getBoolean(ORDER_PROPOSALS);
- // jdcp.orderProposalsAlphabetically(enable);
- }
- }
+// private static void changeHTMLProcessor(ContentAssistant assistant,
+// IPreferenceStore store, String key) {
+// BasicCompletionProcessor jdcp = getHTMLProcessor(assistant);
+// if (jdcp == null)
+// return;
+//
+// if (AUTOACTIVATION_TRIGGERS_HTML.equals(key)) {
+// String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
+// if (triggers != null)
+// jdcp.setCompletionProposalAutoActivationCharacters(triggers
+// .toCharArray());
+// // } else if (CASE_SENSITIVITY.equals(key)) {
+// // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
+// // jdcp.restrictProposalsToMatchingCases(enabled);
+// } else if (ORDER_PROPOSALS.equals(key)) {
+// boolean enable = store.getBoolean(ORDER_PROPOSALS);
+// // jdcp.orderProposalsAlphabetically(enable);
+// }
+// }
}
package net.sourceforge.phpeclipse.xdebug.php.model;
/*org.eclipse.jdt.internal.debug.ui.actions;*/
-import java.util.ArrayList;
-import java.util.Iterator;
+//import java.util.ArrayList;
+//import java.util.Iterator;
import java.util.List;
import net.sourceforge.phpdt.internal.core.CompilationUnit;
return (String) fLabels.get(fLabels.size() - 1);
}
- private void nestLabel(String label) {
- if (fLabels == null) {
- fLabels = new ArrayList();
- }
- fLabels.add(label);
- }
+// private void nestLabel(String label) {
+// if (fLabels == null) {
+// fLabels = new ArrayList();
+// }
+// fLabels.add(label);
+// }
- private void popLabel() {
- if (fLabels == null || fLabels.isEmpty()) {
- return;
- }
- fLabels.remove(fLabels.size() - 1);
- }
+// private void popLabel() {
+// if (fLabels == null || fLabels.isEmpty()) {
+// return;
+// }
+// fLabels.remove(fLabels.size() - 1);
+// }
/* (non-Javadoc)
* @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.LineComment)
import net.sourceforge.phpeclipse.ui.templates.template.BasicCompletionProcessor;
import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLPartitionScanner;
-import org.eclipse.jface.preference.IPreferenceStore;
+//import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
/** Preference key for alphabetic ordering of proposals */
private final static String ORDER_PROPOSALS = PreferenceConstants.CODEASSIST_ORDER_PROPOSALS;
- private static BasicCompletionProcessor getHTMLProcessor(
- ContentAssistant assistant) {
- IContentAssistProcessor p = assistant
- .getContentAssistProcessor(XMLPartitionScanner.XML_TAG);
- if (p instanceof BasicCompletionProcessor)
- return (BasicCompletionProcessor) p;
- return null;
- }
+// private static BasicCompletionProcessor getHTMLProcessor(
+// ContentAssistant assistant) {
+// IContentAssistProcessor p = assistant
+// .getContentAssistProcessor(XMLPartitionScanner.XML_TAG);
+// if (p instanceof BasicCompletionProcessor)
+// return (BasicCompletionProcessor) p;
+// return null;
+// }
- private static void configureHTMLProcessor(ContentAssistant assistant,
- IPreferenceStore store) {
- BasicCompletionProcessor hcp = getHTMLProcessor(assistant);
- if (hcp == null)
- return;
+// private static void configureHTMLProcessor(ContentAssistant assistant,
+// IPreferenceStore store) {
+// BasicCompletionProcessor hcp = getHTMLProcessor(assistant);
+// if (hcp == null)
+// return;
+//
+// String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
+// if (triggers != null)
+// hcp.setCompletionProposalAutoActivationCharacters(triggers
+// .toCharArray());
+//
+// boolean enabled;
+// // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
+// // jdcp.restrictProposalsToMatchingCases(enabled);
+//
+// enabled = store.getBoolean(ORDER_PROPOSALS);
+// // hcp.orderProposalsAlphabetically(enabled);
+// }
- String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
- if (triggers != null)
- hcp.setCompletionProposalAutoActivationCharacters(triggers
- .toCharArray());
-
- boolean enabled;
- // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
- // jdcp.restrictProposalsToMatchingCases(enabled);
-
- enabled = store.getBoolean(ORDER_PROPOSALS);
- // hcp.orderProposalsAlphabetically(enabled);
- }
-
- private static void changeHTMLProcessor(ContentAssistant assistant,
- IPreferenceStore store, String key) {
- BasicCompletionProcessor jdcp = getHTMLProcessor(assistant);
- if (jdcp == null)
- return;
-
- if (AUTOACTIVATION_TRIGGERS_HTML.equals(key)) {
- String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
- if (triggers != null)
- jdcp.setCompletionProposalAutoActivationCharacters(triggers
- .toCharArray());
- // } else if (CASE_SENSITIVITY.equals(key)) {
- // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
- // jdcp.restrictProposalsToMatchingCases(enabled);
- } else if (ORDER_PROPOSALS.equals(key)) {
- boolean enable = store.getBoolean(ORDER_PROPOSALS);
- // jdcp.orderProposalsAlphabetically(enable);
- }
- }
+// private static void changeHTMLProcessor(ContentAssistant assistant,
+// IPreferenceStore store, String key) {
+// BasicCompletionProcessor jdcp = getHTMLProcessor(assistant);
+// if (jdcp == null)
+// return;
+//
+// if (AUTOACTIVATION_TRIGGERS_HTML.equals(key)) {
+// String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
+// if (triggers != null)
+// jdcp.setCompletionProposalAutoActivationCharacters(triggers
+// .toCharArray());
+// // } else if (CASE_SENSITIVITY.equals(key)) {
+// // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
+// // jdcp.restrictProposalsToMatchingCases(enabled);
+// } else if (ORDER_PROPOSALS.equals(key)) {
+// boolean enable = store.getBoolean(ORDER_PROPOSALS);
+// // jdcp.orderProposalsAlphabetically(enable);
+// }
+// }
}
import net.sourceforge.phpdt.core.IJavaElement;
import net.sourceforge.phpdt.core.IJavaModelStatus;
import net.sourceforge.phpdt.core.IJavaModelStatusConstants;
-import net.sourceforge.phpdt.core.IMember;
+//import net.sourceforge.phpdt.core.IMember;
import net.sourceforge.phpdt.core.IParent;
import net.sourceforge.phpdt.core.JavaModelException;
-import net.sourceforge.phpdt.core.jdom.DOMFactory;
-import net.sourceforge.phpdt.core.jdom.IDOMCompilationUnit;
-import net.sourceforge.phpdt.core.jdom.IDOMNode;
+//import net.sourceforge.phpdt.core.jdom.DOMFactory;
+//import net.sourceforge.phpdt.core.jdom.IDOMCompilationUnit;
+//import net.sourceforge.phpdt.core.jdom.IDOMNode;
import net.sourceforge.phpdt.internal.core.util.Util;
/**
* Returns the cached source for this element or compute it if not already
* cached.
*/
- private String getSourceFor(IJavaElement element) throws JavaModelException {
- String source = (String) fSources.get(element);
- if (source == null && element instanceof IMember) {
- IMember member = (IMember) element;
- ICompilationUnit cu = member.getCompilationUnit();
- String cuSource = cu.getSource();
- IDOMCompilationUnit domCU = new DOMFactory().createCompilationUnit(
- cuSource, cu.getElementName());
- IDOMNode node = ((JavaElement) element).findNode(domCU);
- source = new String(node.getCharacters());
- fSources.put(element, source);
- }
- return source;
- }
+// private String getSourceFor(IJavaElement element) throws JavaModelException {
+// String source = (String) fSources.get(element);
+// if (source == null && element instanceof IMember) {
+// IMember member = (IMember) element;
+// ICompilationUnit cu = member.getCompilationUnit();
+// String cuSource = cu.getSource();
+// IDOMCompilationUnit domCU = new DOMFactory().createCompilationUnit(
+// cuSource, cu.getElementName());
+// IDOMNode node = ((JavaElement) element).findNode(domCU);
+// source = new String(node.getCharacters());
+// fSources.put(element, source);
+// }
+// return source;
+// }
/**
* Returns <code>true</code> if this element is the main type of its
import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.internal.core.builder.PHPBuilder;
import net.sourceforge.phpdt.internal.core.util.Util;
-import net.sourceforge.phpdt.internal.core.util.PHPFileUtil;
+//import net.sourceforge.phpdt.internal.core.util.PHPFileUtil;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import org.eclipse.core.resources.IFile;
+//import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
* Returns whether the given resource is in one of the given output folders
* and if it is filtered out from this output folder.
*/
- private boolean isResFilteredFromOutput(OutputsInfo info, IResource res,
- int elementType) {
- if (info != null) {
- IPath resPath = res.getFullPath();
- for (int i = 0; i < info.outputCount; i++) {
- if (info.paths[i].isPrefixOf(resPath)) {
- if (info.traverseModes[i] != IGNORE) {
- // case of bin=src
- if (info.traverseModes[i] == SOURCE
- && elementType == IJavaElement.CLASS_FILE) {
- return true;
- } else {
- // case of .class file under project and no source
- // folder
- // proj=bin
- if (elementType == IJavaElement.JAVA_PROJECT
- && res instanceof IFile
- && PHPFileUtil.isPHPFile((IFile) res)) {
- return true;
- }
- }
- } else {
- return true;
- }
- }
- }
- }
- return false;
- }
+// private boolean isResFilteredFromOutput(OutputsInfo info, IResource res,
+// int elementType) {
+// if (info != null) {
+// IPath resPath = res.getFullPath();
+// for (int i = 0; i < info.outputCount; i++) {
+// if (info.paths[i].isPrefixOf(resPath)) {
+// if (info.traverseModes[i] != IGNORE) {
+// // case of bin=src
+// if (info.traverseModes[i] == SOURCE
+// && elementType == IJavaElement.CLASS_FILE) {
+// return true;
+// } else {
+// // case of .class file under project and no source
+// // folder
+// // proj=bin
+// if (elementType == IJavaElement.JAVA_PROJECT
+// && res instanceof IFile
+// && PHPFileUtil.isPHPFile((IFile) res)) {
+// return true;
+// }
+// }
+// } else {
+// return true;
+// }
+// }
+// }
+// }
+// return false;
+// }
/*
* Merges all awaiting deltas.
}
}
- private static char[] computeBaseTypeNames(char firstName,
- char[][] excludedNames) {
- char[] name = new char[] { firstName };
-
- for (int i = 0; i < excludedNames.length; i++) {
- if (CharOperation.equals(name, excludedNames[i], false)) {
- name[0]++;
- if (name[0] > 'z')
- name[0] = 'a';
- if (name[0] == firstName)
- return null;
- i = 0;
- }
- }
-
- return name;
- }
+// private static char[] computeBaseTypeNames(char firstName,
+// char[][] excludedNames) {
+// char[] name = new char[] { firstName };
+//
+// for (int i = 0; i < excludedNames.length; i++) {
+// if (CharOperation.equals(name, excludedNames[i], false)) {
+// name[0]++;
+// if (name[0] > 'z')
+// name[0] = 'a';
+// if (name[0] == firstName)
+// return null;
+// i = 0;
+// }
+// }
+//
+// return name;
+// }
private static char[][] computeNames(char[] sourceName) {
char[][] names = new char[5][];
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
+//import org.eclipse.core.runtime.IPath;
/**
* The element info for <code>PackageFragmentRoot</code>s.
// protected synchronized SourceMapper getSourceMapper() {
// return this.sourceMapper;
// }
- private static boolean isClasspathEntry(IPath path,
- IClasspathEntry[] resolvedClasspath) {
- for (int i = 0, length = resolvedClasspath.length; i < length; i++) {
- IClasspathEntry entry = resolvedClasspath[i];
- if (entry.getPath().equals(path)) {
- return true;
- }
- }
- return false;
- }
+// private static boolean isClasspathEntry(IPath path,
+// IClasspathEntry[] resolvedClasspath) {
+// for (int i = 0, length = resolvedClasspath.length; i < length; i++) {
+// IClasspathEntry entry = resolvedClasspath[i];
+// if (entry.getPath().equals(path)) {
+// return true;
+// }
+// }
+// return false;
+// }
/**
* Set the fNonJavaResources to res value
* source paths. Returns either F_SOURCEATTACHED, F_SOURCEDETACHED,
* F_SOURCEATTACHED | F_SOURCEDETACHED or 0 if there is no difference.
*/
- private int getSourceAttachmentDeltaFlag(IPath oldPath, IPath newPath,
- IPath sourcePath) {
- if (oldPath == null) {
- if (newPath != null) {
- return IJavaElementDelta.F_SOURCEATTACHED;
- } else {
- if (sourcePath != null) {
- // if source path is specified and no root path, it needs to
- // be recomputed dynamically
- return IJavaElementDelta.F_SOURCEATTACHED
- | IJavaElementDelta.F_SOURCEDETACHED;
- } else {
- return 0;
- }
- }
- } else if (newPath == null) {
- return IJavaElementDelta.F_SOURCEDETACHED;
- } else if (!oldPath.equals(newPath)) {
- return IJavaElementDelta.F_SOURCEATTACHED
- | IJavaElementDelta.F_SOURCEDETACHED;
- } else {
- return 0;
- }
- }
+// private int getSourceAttachmentDeltaFlag(IPath oldPath, IPath newPath,
+// IPath sourcePath) {
+// if (oldPath == null) {
+// if (newPath != null) {
+// return IJavaElementDelta.F_SOURCEATTACHED;
+// } else {
+// if (sourcePath != null) {
+// // if source path is specified and no root path, it needs to
+// // be recomputed dynamically
+// return IJavaElementDelta.F_SOURCEATTACHED
+// | IJavaElementDelta.F_SOURCEDETACHED;
+// } else {
+// return 0;
+// }
+// }
+// } else if (newPath == null) {
+// return IJavaElementDelta.F_SOURCEDETACHED;
+// } else if (!oldPath.equals(newPath)) {
+// return IJavaElementDelta.F_SOURCEATTACHED
+// | IJavaElementDelta.F_SOURCEDETACHED;
+// } else {
+// return 0;
+// }
+// }
/*
* Returns the source attachment flag for the delta between the 2 give
import net.sourceforge.phpdt.internal.core.util.SimpleLookupTable;
import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
+//import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
// binaryLocations[i].cleanup();
}
- private void createFolder(IContainer folder) throws CoreException {
- if (!folder.exists()) {
- createFolder(folder.getParent());
- ((IFolder) folder).create(true, true, null);
- }
- }
+// private void createFolder(IContainer folder) throws CoreException {
+// if (!folder.exists()) {
+// createFolder(folder.getParent());
+// ((IFolder) folder).create(true, true, null);
+// }
+// }
private NameEnvironmentAnswer findClass(String qualifiedTypeName,
char[] typeName) {
return newState;
}
- private static char[][] readNames(DataInputStream in) throws IOException {
- int length = in.readInt();
- char[][] names = new char[length][];
- for (int i = 0; i < length; i++) {
- int nLength = in.readInt();
- char[] name = new char[nLength];
- for (int j = 0; j < nLength; j++)
- name[j] = in.readChar();
- names[i] = name;
- }
- return names;
- }
+// private static char[][] readNames(DataInputStream in) throws IOException {
+// int length = in.readInt();
+// char[][] names = new char[length][];
+// for (int i = 0; i < length; i++) {
+// int nLength = in.readInt();
+// char[] name = new char[nLength];
+// for (int j = 0; j < nLength; j++)
+// name[j] = in.readChar();
+// names[i] = name;
+// }
+// return names;
+// }
void tagAsNoopBuild() {
this.buildNumber = -1; // tag the project since it has no source
// }
}
- private void writeNames(char[][] names, DataOutputStream out)
- throws IOException {
- int length = names == null ? 0 : names.length;
- out.writeInt(length);
- for (int i = 0; i < length; i++) {
- char[] name = names[i];
- int nLength = name.length;
- out.writeInt(nLength);
- for (int j = 0; j < nLength; j++)
- out.writeChar(name[j]);
- }
- }
+// private void writeNames(char[][] names, DataOutputStream out)
+// throws IOException {
+// int length = names == null ? 0 : names.length;
+// out.writeInt(length);
+// for (int i = 0; i < length; i++) {
+// char[] name = names[i];
+// int nLength = name.length;
+// out.writeInt(nLength);
+// for (int j = 0; j < nLength; j++)
+// out.writeChar(name[j]);
+// }
+// }
/**
* Returns a string representation of the receiver.
import net.sourceforge.phpdt.internal.core.util.PHPFileUtil;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
+//import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
return sig.substring(i + 1);
}
- private static IFile findFirstClassFile(IFolder folder) {
- try {
- IResource[] members = folder.members();
- for (int i = 0, max = members.length; i < max; i++) {
- IResource member = members[i];
- if (member.getType() == IResource.FOLDER) {
- return findFirstClassFile((IFolder) member);
- // } else if
- // (net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(member.getName()))
- // {
- // return (IFile) member;
- }
- }
- } catch (CoreException e) {
- // ignore
- }
- return null;
- }
+// private static IFile findFirstClassFile(IFolder folder) {
+// try {
+// IResource[] members = folder.members();
+// for (int i = 0, max = members.length; i < max; i++) {
+// IResource member = members[i];
+// if (member.getType() == IResource.FOLDER) {
+// return findFirstClassFile((IFolder) member);
+// // } else if
+// // (net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(member.getName()))
+// // {
+// // return (IFile) member;
+// }
+// }
+// } catch (CoreException e) {
+// // ignore
+// }
+// return null;
+// }
/**
* Finds the first line separator used by the given text.
*******************************************************************************/
package net.sourceforge.phpdt.internal.corext.util;
-import java.util.Map;
+//import java.util.Map;
import net.sourceforge.phpdt.core.ToolFactory;
import net.sourceforge.phpdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.jface.text.DefaultPositionUpdater;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.Position;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.InsertEdit;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
+//import org.eclipse.text.edits.DeleteEdit;
+//import org.eclipse.text.edits.InsertEdit;
+//import org.eclipse.text.edits.MultiTextEdit;
+//import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.text.edits.TextEdit;
public class CodeFormatterUtil {
// return getOldAPICompatibleResult(string, edit, indentationLevel,
// positions, lineSeparator, options);
// }
- private static String getOldAPICompatibleResult(String string,
- TextEdit edit, int indentationLevel, int[] positions,
- String lineSeparator, Map options) {
- Position[] p = null;
-
- if (positions != null) {
- p = new Position[positions.length];
- for (int i = 0; i < positions.length; i++) {
- p[i] = new Position(positions[i], 0);
- }
- }
- String res = evaluateFormatterEdit(string, edit, p);
-
- if (positions != null) {
- for (int i = 0; i < positions.length; i++) {
- Position curr = p[i];
- positions[i] = curr.getOffset();
- }
- }
- return res;
- }
+// private static String getOldAPICompatibleResult(String string,
+// TextEdit edit, int indentationLevel, int[] positions,
+// String lineSeparator, Map options) {
+// Position[] p = null;
+//
+// if (positions != null) {
+// p = new Position[positions.length];
+// for (int i = 0; i < positions.length; i++) {
+// p[i] = new Position(positions[i], 0);
+// }
+// }
+// String res = evaluateFormatterEdit(string, edit, p);
+//
+// if (positions != null) {
+// for (int i = 0; i < positions.length; i++) {
+// Position curr = p[i];
+// positions[i] = curr.getOffset();
+// }
+// }
+// return res;
+// }
/**
* Evaluates the edit on the given string.
// }
// return edit;
// }
- private static TextEdit shifEdit(TextEdit oldEdit, int diff) {
- TextEdit newEdit;
- if (oldEdit instanceof ReplaceEdit) {
- ReplaceEdit edit = (ReplaceEdit) oldEdit;
- newEdit = new ReplaceEdit(edit.getOffset() - diff,
- edit.getLength(), edit.getText());
- } else if (oldEdit instanceof InsertEdit) {
- InsertEdit edit = (InsertEdit) oldEdit;
- newEdit = new InsertEdit(edit.getOffset() - diff, edit.getText());
- } else if (oldEdit instanceof DeleteEdit) {
- DeleteEdit edit = (DeleteEdit) oldEdit;
- newEdit = new DeleteEdit(edit.getOffset() - diff, edit.getLength());
- } else if (oldEdit instanceof MultiTextEdit) {
- newEdit = new MultiTextEdit();
- } else {
- return null; // not supported
- }
- TextEdit[] children = oldEdit.getChildren();
- for (int i = 0; i < children.length; i++) {
- TextEdit shifted = shifEdit(children[i], diff);
- if (shifted != null) {
- newEdit.addChild(shifted);
- }
- }
- return newEdit;
- }
+// private static TextEdit shifEdit(TextEdit oldEdit, int diff) {
+// TextEdit newEdit;
+// if (oldEdit instanceof ReplaceEdit) {
+// ReplaceEdit edit = (ReplaceEdit) oldEdit;
+// newEdit = new ReplaceEdit(edit.getOffset() - diff,
+// edit.getLength(), edit.getText());
+// } else if (oldEdit instanceof InsertEdit) {
+// InsertEdit edit = (InsertEdit) oldEdit;
+// newEdit = new InsertEdit(edit.getOffset() - diff, edit.getText());
+// } else if (oldEdit instanceof DeleteEdit) {
+// DeleteEdit edit = (DeleteEdit) oldEdit;
+// newEdit = new DeleteEdit(edit.getOffset() - diff, edit.getLength());
+// } else if (oldEdit instanceof MultiTextEdit) {
+// newEdit = new MultiTextEdit();
+// } else {
+// return null; // not supported
+// }
+// TextEdit[] children = oldEdit.getChildren();
+// for (int i = 0; i < children.length; i++) {
+// TextEdit shifted = shifEdit(children[i], diff);
+// if (shifted != null) {
+// newEdit.addChild(shifted);
+// }
+// }
+// return newEdit;
+// }
private static Document createDocument(String string, Position[] positions)
throws IllegalArgumentException {
return type.getTypeQualifiedName('.');
}
- private static void getTypeQualifiedName(IType type, StringBuffer buf) {
- IType outerType = type.getDeclaringType();
- if (outerType != null) {
- getTypeQualifiedName(outerType, buf);
- buf.append('.');
- }
- buf.append(type.getElementName());
- }
+// private static void getTypeQualifiedName(IType type, StringBuffer buf) {
+// IType outerType = type.getDeclaringType();
+// if (outerType != null) {
+// getTypeQualifiedName(outerType, buf);
+// buf.append('.');
+// }
+// buf.append(type.getElementName());
+// }
/**
* Returns the fully qualified name of the given type using '.' as
* @param token
* the token of which the priority is requested
*/
- private static int getTokenPriority(int token) {
- switch (token) {
- case TokenNameextends:
- // case TokenNameimplements :
- // case TokenNamethrows :
- return 10;
- case TokenNameSEMICOLON:
- // ;
- return 20;
- case TokenNameCOMMA:
- // ,
- return 25;
- case TokenNameEQUAL:
- // =
- return 30;
- case TokenNameAND_AND:
- // &&
- case TokenNameOR_OR:
- // ||
- return 40;
- case TokenNameQUESTION:
- // ?
- case TokenNameCOLON:
- // :
- return 50; // it's better cutting on ?: than on ;
- case TokenNameEQUAL_EQUAL:
- // ==
- case TokenNameEQUAL_EQUAL_EQUAL:
- // ===
- case TokenNameNOT_EQUAL:
- // !=
- case TokenNameNOT_EQUAL_EQUAL:
- // !=
- return 60;
- case TokenNameLESS:
- // <
- case TokenNameLESS_EQUAL:
- // <=
- case TokenNameGREATER:
- // >
- case TokenNameGREATER_EQUAL:
- // >=
- // case TokenNameinstanceof : // instanceof
- return 70;
- case TokenNamePLUS:
- // +
- case TokenNameMINUS:
- // -
- return 80;
- case TokenNameMULTIPLY:
- // *
- case TokenNameDIVIDE:
- // /
- case TokenNameREMAINDER:
- // %
- return 90;
- case TokenNameLEFT_SHIFT:
- // <<
- case TokenNameRIGHT_SHIFT:
- // >>
- // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>>
- return 100;
- case TokenNameAND:
- // &
- case TokenNameOR:
- // |
- case TokenNameXOR:
- // ^
- return 110;
- case TokenNameMULTIPLY_EQUAL:
- // *=
- case TokenNameDIVIDE_EQUAL:
- // /=
- case TokenNameREMAINDER_EQUAL:
- // %=
- case TokenNamePLUS_EQUAL:
- // +=
- case TokenNameMINUS_EQUAL:
- // -=
- case TokenNameLEFT_SHIFT_EQUAL:
- // <<=
- case TokenNameRIGHT_SHIFT_EQUAL:
- // >>=
- // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>=
- case TokenNameAND_EQUAL:
- // &=
- case TokenNameXOR_EQUAL:
- // ^=
- case TokenNameOR_EQUAL:
- // .=
- case TokenNameDOT_EQUAL:
- // |=
- return 120;
- case TokenNameDOT:
- // .
- return 130;
- default:
- return Integer.MAX_VALUE;
- }
- }
+// private static int getTokenPriority(int token) {
+// switch (token) {
+// case TokenNameextends:
+// // case TokenNameimplements :
+// // case TokenNamethrows :
+// return 10;
+// case TokenNameSEMICOLON:
+// // ;
+// return 20;
+// case TokenNameCOMMA:
+// // ,
+// return 25;
+// case TokenNameEQUAL:
+// // =
+// return 30;
+// case TokenNameAND_AND:
+// // &&
+// case TokenNameOR_OR:
+// // ||
+// return 40;
+// case TokenNameQUESTION:
+// // ?
+// case TokenNameCOLON:
+// // :
+// return 50; // it's better cutting on ?: than on ;
+// case TokenNameEQUAL_EQUAL:
+// // ==
+// case TokenNameEQUAL_EQUAL_EQUAL:
+// // ===
+// case TokenNameNOT_EQUAL:
+// // !=
+// case TokenNameNOT_EQUAL_EQUAL:
+// // !=
+// return 60;
+// case TokenNameLESS:
+// // <
+// case TokenNameLESS_EQUAL:
+// // <=
+// case TokenNameGREATER:
+// // >
+// case TokenNameGREATER_EQUAL:
+// // >=
+// // case TokenNameinstanceof : // instanceof
+// return 70;
+// case TokenNamePLUS:
+// // +
+// case TokenNameMINUS:
+// // -
+// return 80;
+// case TokenNameMULTIPLY:
+// // *
+// case TokenNameDIVIDE:
+// // /
+// case TokenNameREMAINDER:
+// // %
+// return 90;
+// case TokenNameLEFT_SHIFT:
+// // <<
+// case TokenNameRIGHT_SHIFT:
+// // >>
+// // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>>
+// return 100;
+// case TokenNameAND:
+// // &
+// case TokenNameOR:
+// // |
+// case TokenNameXOR:
+// // ^
+// return 110;
+// case TokenNameMULTIPLY_EQUAL:
+// // *=
+// case TokenNameDIVIDE_EQUAL:
+// // /=
+// case TokenNameREMAINDER_EQUAL:
+// // %=
+// case TokenNamePLUS_EQUAL:
+// // +=
+// case TokenNameMINUS_EQUAL:
+// // -=
+// case TokenNameLEFT_SHIFT_EQUAL:
+// // <<=
+// case TokenNameRIGHT_SHIFT_EQUAL:
+// // >>=
+// // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>=
+// case TokenNameAND_EQUAL:
+// // &=
+// case TokenNameXOR_EQUAL:
+// // ^=
+// case TokenNameOR_EQUAL:
+// // .=
+// case TokenNameDOT_EQUAL:
+// // |=
+// return 120;
+// case TokenNameDOT:
+// // .
+// return 130;
+// default:
+// return Integer.MAX_VALUE;
+// }
+// }
/**
* Handles the exception raised when an invalid token is encountered.
* Pops the top statement of the stack if it is a <code>BLOCK</code> or a
* <code>NONINDENT_BLOCK</code>.
*/
- private int popBlock() {
- int delta = 0;
- if ((constructionsCount > 0)
- && ((constructions[constructionsCount - 1] == BLOCK) || (constructions[constructionsCount - 1] == NONINDENT_BLOCK))) {
- if (constructions[constructionsCount - 1] == BLOCK)
- delta--;
- constructionsCount--;
- }
- return delta;
- }
+// private int popBlock() {
+// int delta = 0;
+// if ((constructionsCount > 0)
+// && ((constructions[constructionsCount - 1] == BLOCK) || (constructions[constructionsCount - 1] == NONINDENT_BLOCK))) {
+// if (constructions[constructionsCount - 1] == BLOCK)
+// delta--;
+// constructionsCount--;
+// }
+// return delta;
+// }
/**
* Pops elements until the stack is empty or the top element is
* @param token
* the token to be left as the top of the stack
*/
- private int popExclusiveUntil(int token) {
- int delta = 0;
- int startCount = constructionsCount;
- for (int i = startCount - 1; i >= 0 && constructions[i] != token; i--) {
- if (constructions[i] != NONINDENT_BLOCK)
- delta--;
- constructionsCount--;
- }
- return delta;
- }
+// private int popExclusiveUntil(int token) {
+// int delta = 0;
+// int startCount = constructionsCount;
+// for (int i = startCount - 1; i >= 0 && constructions[i] != token; i--) {
+// if (constructions[i] != NONINDENT_BLOCK)
+// delta--;
+// constructionsCount--;
+// }
+// return delta;
+// }
/**
* Pops elements until the stack is empty or the top element is a
return 1;
}
- private static boolean separateFirstArgumentOn(int currentToken) {
- // return (currentToken == TokenNameCOMMA || currentToken ==
- // TokenNameSEMICOLON);
- return currentToken != TokenNameif && currentToken != TokenNameLPAREN
- && currentToken != TokenNameNOT
- && currentToken != TokenNamewhile
- && currentToken != TokenNamefor
- && currentToken != TokenNameforeach
- && currentToken != TokenNameswitch;
- }
+// private static boolean separateFirstArgumentOn(int currentToken) {
+// // return (currentToken == TokenNameCOMMA || currentToken ==
+// // TokenNameSEMICOLON);
+// return currentToken != TokenNameif && currentToken != TokenNameLPAREN
+// && currentToken != TokenNameNOT
+// && currentToken != TokenNamewhile
+// && currentToken != TokenNamefor
+// && currentToken != TokenNameforeach
+// && currentToken != TokenNameswitch;
+// }
/**
* Set the positions to map. The mapped positions should be retrieved using