From f8910d71d35a4f2b7ebff00fcfdce026dc1de5e9 Mon Sep 17 00:00:00 2001 From: bananeweizen Date: Tue, 17 Jan 2006 21:50:46 +0000 Subject: [PATCH 1/1] replaced a lot of deprecated code; if someone runs into a commit conflict afterwards, he may overwrite these changes as there is no changed functionality --- .../debug/core/PHPDegugCorePluginImages.java | 31 +- .../debug/ui/actions/ToggleBreakpointAdapter.java | 99 +++--- .../debug/ui/launcher/PHPEnvironmentTab2.java | 100 +++--- .../PHPExternalToolsPreferencePage.java | 58 ++-- .../internal/launching/InterpreterRunner.java | 22 +- .../phpdt/internal/launching/PHPInterpreter.java | 18 - .../phpdt/internal/launching/PHPRuntime.java | 21 +- .../template/BasicCompletionProcessor.java | 16 +- .../webbrowser/internal/BrowserTableComposite.java | 70 ++-- .../webbrowser/internal/ExternalBrowserDialog.java | 58 ++-- .../webbrowser/internal/InternalBrowserDialog.java | 20 +- .../internal/InternetPreferencePage.java | 12 +- .../phpeclipse/webbrowser/internal/WebBrowser.java | 8 +- .../internal/WebBrowserPreferencePage.java | 22 +- .../compiler/lookup/SourceTypeBinding.java | 74 ++-- .../phpdt/internal/compiler/parser/Parser.java | 12 +- .../core/CopyResourceElementsOperation.java | 74 ++-- .../sourceforge/phpdt/internal/core/Openable.java | 58 ++-- .../corext/template/php/HTMLContextType.java | 16 +- .../phpdt/internal/corext/util/JavaModelUtil.java | 172 ++++---- .../phpdt/internal/corext/util/Resources.java | 50 ++-- .../ui/actions/AbstractToggleLinkingAction.java | 14 +- .../ui/dialogs/CheckedTreeSelectionDialog.java | 4 +- .../ui/dialogs/ElementListSelectionDialog.java | 14 +- .../internal/ui/filters/CustomFiltersDialog.java | 46 +- .../AbstractConfigurationBlockPreferencePage.java | 54 ++-- .../ui/preferences/CodeTemplatePreferencePage.java | 26 +- .../ui/preferences/CompilerPreferencePage.java | 27 +- .../ui/preferences/CompilerPropertyPage.java | 60 ++-- .../ui/preferences/EditTemplateDialog.java | 178 ++++---- .../ui/preferences/JavaEditorPreferencePage.java | 20 +- .../ui/preferences/SpellingPreferencePage.java | 10 +- .../ui/preferences/TodoTaskInputDialog.java | 48 ++-- .../ui/preferences/TodoTaskPreferencePage.java | 22 +- .../ui/preferences/TodoTaskPropertyPage.java | 60 ++-- .../text/java/JavaStringAutoIndentStrategyDQ.java | 50 ++-- .../text/java/JavaStringAutoIndentStrategySQ.java | 50 ++-- .../internal/ui/text/link/LinkedPositionUI.java | 244 ++++++------ .../ui/text/phpdoc/JavaDocAutoIndentStrategy.java | 198 +++++----- .../phpdt/internal/ui/util/PHPFileUtil.java | 4 - .../ui/viewsupport/JavaElementImageProvider.java | 11 +- .../ui/viewsupport/MemberFilterAction.java | 20 +- .../ltk/ui/wizards/RenameLocalVariablePage.java | 2 - .../phpdt/ui/actions/GenerateActionGroup.java | 112 +++--- .../sourceforge/phpdt/ui/text/JavaTextTools.java | 1 - .../ui/text/PHPSourceViewerConfiguration.java | 12 +- .../sourceforge/phpeclipse/PHPeclipsePlugin.java | 10 +- .../obfuscator/export/ObfuscatorExportWizard.java | 20 +- .../phpeclipse/phpeditor/BracketPainter.java | 70 ++-- .../phpeclipse/phpeditor/DocumentAdapter.java | 132 +++--- .../phpeclipse/phpeditor/GotoAnnotationAction.java | 22 +- .../phpeclipse/phpeditor/GotoErrorAction.java | 22 +- .../phpeclipse/phpeditor/JavaOutlinePage.java | 421 ++++++++++---------- .../phpeditor/JavaSelectMarkerRulerAction.java | 24 +- .../phpeditor/JavaSelectMarkerRulerAction2.java | 24 +- .../phpeclipse/phpeditor/PHPEditor.java | 10 +- .../phpeclipse/phpeditor/PHPUnitEditor.java | 36 +- .../phpeclipse/phpeditor/ProblemPainter.java | 135 +++---- .../phpeditor/php/PHPAutoIndentStrategy.java | 30 +- .../phpeclipse/phpeditor/php/PHPCodeScanner.java | 2 - .../phpeditor/php/PHPCompletionProcessor.java | 2 - .../preferences/PHPProjectLibraryPage.java | 4 +- 62 files changed, 1613 insertions(+), 1649 deletions(-) diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java index a49505e..42de200 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java @@ -4,7 +4,7 @@ * 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 *******************************************************************************/ @@ -20,7 +20,8 @@ import org.eclipse.swt.graphics.Image; public class PHPDegugCorePluginImages { private final static URL BASE_URL = - PHPDebugCorePlugin.getDefault().getDescriptor().getInstallURL(); + PHPDebugCorePlugin.getDefault().getBundle().getEntry("/"); + private final static ImageRegistry PLUGIN_REGISTRY = PHPDebugCorePlugin.getDefault().getImageRegistry(); @@ -91,12 +92,12 @@ public class PHPDegugCorePluginImages { create(PATH_LCL, "restore_log.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_READ_LOG_DISABLED = create(PATH_LCL_DISABLED, "restore_log.gif"); //$NON-NLS-1$ - + public static final ImageDescriptor DESC_REMOVE_LOG = create(PATH_LCL, "remove.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_REMOVE_LOG_DISABLED = create(PATH_LCL_DISABLED, "remove.gif"); //$NON-NLS-1$ - + public static final ImageDescriptor DESC_FILTER = create(PATH_LCL, "filter_ps.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_FILTER_DISABLED = @@ -106,36 +107,36 @@ public class PHPDegugCorePluginImages { create(PATH_LCL, "export_log.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_EXPORT_DISABLED = create(PATH_LCL_DISABLED, "export_log.gif"); //$NON-NLS-1$ - + public static final ImageDescriptor DESC_IMPORT = create(PATH_LCL, "import_log.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_IMPORT_DISABLED = create(PATH_LCL_DISABLED, "import_log.gif"); //$NON-NLS-1$ - + public static final ImageDescriptor DESC_COLLAPSE_ALL = create(PATH_LCL, "collapseall.gif"); //$NON-NLS-1$ - + public static final ImageDescriptor DESC_HORIZONTAL_VIEW = create(PATH_LCL, "th_horizontal.gif"); //$NON-NLS-1$ - - public static final ImageDescriptor DESC_HORIZONTAL_VIEW_DISABLED = + + public static final ImageDescriptor DESC_HORIZONTAL_VIEW_DISABLED = create(PATH_LCL_DISABLED, "th_horizontal.gif"); //$NON-NLS-1$ - + public static final ImageDescriptor DESC_VERTICAL_VIEW = create(PATH_LCL, "th_vertical.gif"); //$NON-NLS-1$ - - public static final ImageDescriptor DESC_VERTICAL_VIEW_DISABLED = + + public static final ImageDescriptor DESC_VERTICAL_VIEW_DISABLED = create(PATH_LCL_DISABLED, "th_vertical.gif"); //$NON-NLS-1$ - + public static final ImageDescriptor DESC_HIDE_PANE = create(PATH_EVENTS, "hide_pane.gif"); //$NON-NLS-1$ - + /* * Event Details */ public static final ImageDescriptor DESC_PREV_EVENT = create(PATH_EVENTS, "event_prev.gif"); //$NON-NLS-1$ - public static final ImageDescriptor DESC_NEXT_EVENT = + public static final ImageDescriptor DESC_NEXT_EVENT = create(PATH_EVENTS, "event_next.gif"); //$NON-NLS-1$ /* * Overlays diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java index f898f61..dfdc1ea 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -24,13 +24,10 @@ import net.sourceforge.phpdt.core.Signature; import net.sourceforge.phpdt.debug.core.PHPDebugModel; import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint; import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin; -import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; - import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.internal.ui.actions.ActionMessages; import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; @@ -45,11 +42,11 @@ import org.eclipse.ui.texteditor.ITextEditor; /** * Toggles a line breakpoint in a Java editor. - * + * * @since 3.0 */ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { - + protected void report(String message, IWorkbenchPart part) { IEditorStatusLine statusLine= (IEditorStatusLine) part.getAdapter(IEditorStatusLine.class); if (statusLine != null) { @@ -58,12 +55,12 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { } else { statusLine.setMessage(true, null, null); } - } + } if (message != null && PHPDebugUiPlugin.getActiveWorkbenchShell() != null) { PHPDebugUiPlugin.getActiveWorkbenchShell().getDisplay().beep(); } } - + // protected IType getType(ITextSelection selection) { // IMember member= ActionDelegateHelper.getDefault().getCurrentMember(selection); // IType type= null; @@ -82,8 +79,8 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // PHPDebugUiPlugin.log(e); // } // return type; -// } - +// } + /* (non-Javadoc) * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(IWorkbenchPart, ISelection) */ @@ -118,7 +115,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } // } // } - + // String typeName= null; IResource resource; PHPLineBreakpoint breakpoint= null; @@ -130,12 +127,12 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { } // } else { // typeName= type.getFullyQualifiedName(); -// PHPLineBreakpoint breakpoint=PHPDebugModel.lineBreakpointExists(lineNumber); -// if (breakpoint==null) +// PHPLineBreakpoint breakpoint=PHPDebugModel.lineBreakpointExists(lineNumber); +// if (breakpoint==null) // PHPDebugModel.createLineBreakpoint(getFile(), lineNumber, 0, true, null); // else -// DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); -// +// DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); +// PHPLineBreakpoint existingBreakpoint= PHPDebugModel.lineBreakpointExists(lineNumber); //typeName, lineNumber); if (existingBreakpoint != null) { DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(existingBreakpoint, true); @@ -259,7 +256,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } return false; } - + protected IMethod[] getMethods(IStructuredSelection selection) { if (selection.isEmpty()) { return new IMethod[0]; @@ -269,7 +266,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { while (iterator.hasNext()) { Object thing = iterator.next(); try { - if (thing instanceof IMethod && !Flags.isAbstract(((IMethod)thing).getFlags())) { + if (thing instanceof IMethod && !Flags.isAbstract(((IMethod)thing).getFlags())) { methods.add(thing); } } catch (JavaModelException e) { @@ -278,7 +275,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { return (IMethod[]) methods.toArray(new IMethod[methods.size()]); } } - + // protected IField[] getFields(IStructuredSelection selection) { // if (selection.isEmpty()) { // return new IField[0]; @@ -287,7 +284,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // Iterator iterator = selection.iterator(); // while (iterator.hasNext()) { // Object thing = iterator.next(); -// if (thing instanceof IField) { +// if (thing instanceof IField) { // fields.add(thing); // } else if (thing instanceof IJavaFieldVariable) { // IField field= getField((IJavaFieldVariable) thing); @@ -298,7 +295,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } // return (IField[]) fields.toArray(new IField[fields.size()]); // } -// } +// } /* (non-Javadoc) * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) @@ -364,27 +361,27 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } // } } - + public static String resolveMethodSignature(IType type, String methodSignature) throws JavaModelException { String[] parameterTypes= Signature.getParameterTypes(methodSignature); int length= length= parameterTypes.length; String[] resolvedParameterTypes= new String[length]; - + for (int i = 0; i < length; i++) { resolvedParameterTypes[i]= resolveType(type, parameterTypes[i]); if (resolvedParameterTypes[i] == null) { return null; } } - + String resolvedReturnType= resolveType(type, Signature.getReturnType(methodSignature)); if (resolvedReturnType == null) { return null; } - + return Signature.createMethodSignature(resolvedParameterTypes, resolvedReturnType); } - + private static String resolveType(IType type, String typeSignature) throws JavaModelException { // int count= Signature.getArrayCount(typeSignature); // String elementTypeSignature= Signature.getElementType(typeSignature); @@ -402,8 +399,8 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // String resolvedElementTypeSignature= Signature.createTypeSignature(resolvedElementTypeName, true).replace('.', '/'); // return Signature.createArraySignature(resolvedElementTypeSignature, count); return ""; - } - + } + protected static IResource getResource(IEditorPart editor) { IResource resource; IEditorInput editorInput = editor.getEditorInput(); @@ -414,10 +411,10 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { } return resource; } - + /** * Returns a handle to the specified method or null if none. - * + * * @param editorPart the editor containing the method * @param typeName * @param methodName @@ -445,7 +442,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { } return null; } - + // protected IJavaBreakpoint getBreakpoint(IMember element) { // IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); // IBreakpoint[] breakpoints= breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier()); @@ -494,7 +491,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // JDIDebugUIPlugin.log(e); // } // } -// } +// } // } // return null; // } @@ -507,7 +504,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // return (breakpointField.getElementName().equals(watchpoint.getFieldName()) && // breakpointField.getDeclaringType().getFullyQualifiedName().equals(watchpoint.getTypeName())); // } -// +// // protected CompilationUnit parseCompilationUnit(ITextEditor editor) { // IEditorInput editorInput = editor.getEditorInput(); // IDocument document= editor.getDocumentProvider().getDocument(editorInput); @@ -515,7 +512,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // parser.setSource(document.get().toCharArray()); // return (CompilationUnit) parser.createAST(null); // } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) */ @@ -528,11 +525,11 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } return false; } - + /** * Returns a selection of the member in the given text selection, * or the original selection if none. - * + * * @param part * @param selection * @return a structured selection of the member in the given text selection, @@ -572,7 +569,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } /** - * Returns a list of matching types (IType - Java model) that correspond to the + * Returns a list of matching types (IType - Java model) that correspond to the * declaring type (ReferenceType - JDI model) of the given variable. */ // protected static List searchForDeclaringType(IJavaFieldVariable variable) { @@ -581,7 +578,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // if (launch == null) { // return types; // } -// +// // ILaunchConfiguration configuration= launch.getLaunchConfiguration(); // IJavaProject[] javaProjects = null; // IWorkspace workspace= ResourcesPlugin.getWorkspace(); @@ -624,13 +621,13 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // ArrayList typeRefsFound= new ArrayList(3); // ITypeNameRequestor requestor= new TypeInfoRequestor(typeRefsFound); // try { -// engine.searchAllTypeNames( -// getPackage(declaringType), -// getTypeName(declaringType), -// SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, -// IJavaSearchConstants.CLASS, -// scope, -// requestor, +// engine.searchAllTypeNames( +// getPackage(declaringType), +// getTypeName(declaringType), +// SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, +// IJavaSearchConstants.CLASS, +// scope, +// requestor, // IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, // null); // } catch (JavaModelException x) { @@ -649,10 +646,10 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } // return types; // } - + /** * Returns the package name of the given fully qualified type name. - * The package name is assumed to be the dot-separated prefix of the + * The package name is assumed to be the dot-separated prefix of the * type name. */ // protected static char[] getPackage(String fullyQualifiedName) { @@ -662,10 +659,10 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } // return fullyQualifiedName.substring(0, index).toCharArray(); // } -// +// // /** // * Returns a simple type name from the given fully qualified type name. -// * The type name is assumed to be the last contiguous segment of the +// * The type name is assumed to be the last contiguous segment of the // * fullyQualifiedName not containing a '.' or '$' // */ // protected static char[] getTypeName(String fullyQualifiedName) { @@ -677,7 +674,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } // return typeName.toCharArray(); // } -// +// // /** // * Return the associated IField (Java model) for the given // * IJavaFieldVariable (JDI model) @@ -701,5 +698,5 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { // } // } // return null; -// } +// } } diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab2.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab2.java index c6dd5e0..418077a 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab2.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab2.java @@ -66,8 +66,8 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.ListSelectionDialog; -import org.eclipse.ui.help.WorkbenchHelp; /** * @author Christian @@ -105,7 +105,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { protected Button appendEnvironment; protected Button replaceEnvironment; protected Button envSelectButton; - + /** * Content provider for the environment table */ @@ -155,7 +155,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { } } } - + /** * Label provider for the environment table */ @@ -187,21 +187,21 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { // Create main composite Composite mainComposite = new Composite(parent, SWT.NONE); setControl(mainComposite); - WorkbenchHelp.setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB); GridLayout layout = new GridLayout(); layout.numColumns = 2; GridData gridData = new GridData(GridData.FILL_HORIZONTAL); mainComposite.setLayout(layout); mainComposite.setLayoutData(gridData); mainComposite.setFont(parent.getFont()); - + createEnvironmentTable(mainComposite); createTableButtons(mainComposite); createAppendReplace(mainComposite); - + Dialog.applyDialogFont(mainComposite); } - + /** * Creates and configures the widgets which allow the user to * choose whether the specified environment should be appended @@ -216,7 +216,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { appendReplaceComposite.setLayoutData(gridData); appendReplaceComposite.setLayout(layout); appendReplaceComposite.setFont(parent.getFont()); - + appendEnvironment= createRadioButton(appendReplaceComposite, LaunchConfigurationsMessages.EnvironmentTab_16); //$NON-NLS-1$ appendEnvironment.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { @@ -225,7 +225,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { }); replaceEnvironment= createRadioButton(appendReplaceComposite, LaunchConfigurationsMessages.EnvironmentTab_17); //$NON-NLS-1$ } - + /** * Updates the enablement of the append/replace widgets. The * widgets should disable when there are no environment variables specified. @@ -235,7 +235,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { appendEnvironment.setEnabled(enable); replaceEnvironment.setEnabled(enable); } - + /** * Creates and configures the table that displayed the key/value * pairs that comprise the environment. @@ -290,7 +290,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { tc.setText(envTableColumnHeaders[i]); } } - + /** * Responds to a selection changed event in the environment table * @param event the selection change event @@ -300,7 +300,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { envEditButton.setEnabled(size == 1); envRemoveButton.setEnabled(size > 0); } - + /** * Creates the add/edit/remove buttons for the environment table * @param parent the composite in which the buttons should be created @@ -332,7 +332,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { handleEnvAddCGIButtonSelected(); } }); - + envSelectButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_18, null); //$NON-NLS-1$ envSelectButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { @@ -356,7 +356,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { }); envRemoveButton.setEnabled(false); } - + /** * Adds a new environment variable to the table. */ @@ -364,20 +364,20 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { MultipleInputDialog dialog = new MultipleInputDialog(getShell(), LaunchConfigurationsMessages.EnvironmentTab_22); //$NON-NLS-1$ dialog.addTextField(NAME_LABEL, null, false); dialog.addVariablesField(VALUE_LABEL, null, true); - + if (dialog.open() != Window.OK) { return; } - + String name = dialog.getStringValue(NAME_LABEL); String value = dialog.getStringValue(VALUE_LABEL); - + if (name != null && value != null && name.length() > 0 && value.length() >0) { addVariable(new EnvironmentVariable(name.trim(), value.trim())); updateAppendReplace(); } } - + /** * Attempts to add the given variable. Returns whether the variable * was added or not (as when the user answers not to overwrite an @@ -403,9 +403,9 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { updateLaunchConfigurationDialog(); return true; } - + /** - * Displays a dialog that allows user to select native environment variables + * Displays a dialog that allows user to select native environment variables * to add to the table. */ private void handleEnvSelectButtonSelected() { @@ -418,30 +418,30 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { EnvironmentVariable var = (EnvironmentVariable) items[i].getData(); envVariables.remove(var.getName()); } - + ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(), envVariables, createSelectionDialogContentProvider(), createSelectionDialogLabelProvider(), LaunchConfigurationsMessages.EnvironmentTab_19); //$NON-NLS-1$ dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); //$NON-NLS-1$ - + int button = dialog.open(); if (button == Window.OK) { - Object[] selected = dialog.getResult(); + Object[] selected = dialog.getResult(); for (int i = 0; i < selected.length; i++) { - environmentTable.add(selected[i]); + environmentTable.add(selected[i]); } } - + updateAppendReplace(); updateLaunchConfigurationDialog(); } - + /** - * Displays a dialog that allows user to select native environment variables + * Displays a dialog that allows user to select native environment variables * to add to the table. */ private void handleEnvAddCGIButtonSelected() { Map envVariables = new HashMap(); - + envVariables.put("HTTP_COOKIE",new EnvironmentVariable("HTTP_COOKIE", "TestCookie=1")); envVariables.put("REDIRECT_QUERY_STRING",new EnvironmentVariable("REDIRECT_QUERY_STRING", "")); @@ -460,26 +460,26 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { // envVariables.put("REQUEST_URI" + OSFilePath; // envVariables.put("PATH_INFO=" + OSFilePath; // envVariables.put("PATH_TRANSLATED=" + OSFilePath; - - + + //get Environment Variables from the table TableItem[] items = environmentTable.getTable().getItems(); for (int i = 0; i < items.length; i++) { EnvironmentVariable var = (EnvironmentVariable) items[i].getData(); envVariables.remove(var.getName()); } - + ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(), envVariables, createSelectionDialogContentProvider(), createSelectionDialogLabelProvider(), LaunchConfigurationsMessages.EnvironmentTab_19); //$NON-NLS-1$ dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); //$NON-NLS-1$ - + int button = dialog.open(); if (button == Window.OK) { - Object[] selected = dialog.getResult(); + Object[] selected = dialog.getResult(); for (int i = 0; i < selected.length; i++) { - environmentTable.add(selected[i]); + environmentTable.add(selected[i]); } } - + updateAppendReplace(); updateLaunchConfigurationDialog(); } @@ -506,7 +506,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { return false; } public void removeListener(ILabelProviderListener listener) { - } + } }; } @@ -525,7 +525,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { String s2 = (String)o2; return s1.compareTo(s2); } - + }; TreeMap envVars = new TreeMap(comparator); envVars.putAll((Map)inputElement); @@ -538,7 +538,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { } return elements; } - public void dispose() { + public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } @@ -574,7 +574,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { MultipleInputDialog dialog= new MultipleInputDialog(getShell(), LaunchConfigurationsMessages.EnvironmentTab_11); //$NON-NLS-1$ dialog.addTextField(NAME_LABEL, originalName, false); dialog.addVariablesField(VALUE_LABEL, value, true); - + if (dialog.open() != Window.OK) { return; } @@ -598,7 +598,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { IStructuredSelection sel = (IStructuredSelection) environmentTable.getSelection(); environmentTable.getControl().setRedraw(false); for (Iterator i = sel.iterator(); i.hasNext(); ) { - EnvironmentVariable var = (EnvironmentVariable) i.next(); + EnvironmentVariable var = (EnvironmentVariable) i.next(); environmentTable.remove(var); } environmentTable.getControl().setRedraw(true); @@ -645,7 +645,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { * Stores the environment in the given configuration * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ - public void performApply(ILaunchConfigurationWorkingCopy configuration) { + public void performApply(ILaunchConfigurationWorkingCopy configuration) { // Convert the table's items into a Map so that this can be saved in the // configuration's attributes. TableItem[] items = environmentTable.getTable().getItems(); @@ -654,7 +654,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { { EnvironmentVariable var = (EnvironmentVariable) items[i].getData(); map.put(var.getName(), var.getValue()); - } + } if (map.size() == 0) { configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null); } else { @@ -669,7 +669,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { public String getName() { return LaunchConfigurationsMessages.EnvironmentTab_Environment_7; //$NON-NLS-1$ } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() */ @@ -690,25 +690,25 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { // do nothing when deactivated } - + private class NativeEnvironmentDialog extends ListSelectionDialog { public NativeEnvironmentDialog(Shell parentShell, Object input, IStructuredContentProvider contentProvider, ILabelProvider labelProvider, String message) { super(parentShell, input, contentProvider, labelProvider, message); setShellStyle(getShellStyle() | SWT.RESIZE); } - + protected IDialogSettings getDialogSettings() { IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings(); IDialogSettings section = settings.getSection(getDialogSettingsSectionName()); if (section == null) { section = settings.addNewSection(getDialogSettingsSectionName()); - } + } return section; } - + /** * Returns the name of the section that this dialog stores its settings in - * + * * @return String */ protected String getDialogSettingsSectionName() { @@ -726,7 +726,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { } return super.getInitialLocation(initialSize); } - + /* (non-Javadoc) * @see org.eclipse.jface.window.Window#getInitialSize() */ @@ -734,7 +734,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab { Point size = super.getInitialSize(); return DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(), size); } - + /* (non-Javadoc) * @see org.eclipse.jface.window.Window#close() */ diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java index 91d3c15..7e4df13 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java @@ -30,9 +30,9 @@ public class PHPExternalToolsPreferencePage extends PreferencePage implements IW StringFieldEditor apacheRestartSFE; StringFieldEditor mySQLCommandSFE; - + StringFieldEditor externalParserSFE; - + FileFieldEditor apacheRunFFE; FileFieldEditor mysqlRunFFE; @@ -40,7 +40,7 @@ public class PHPExternalToolsPreferencePage extends PreferencePage implements IW FileFieldEditor phpRunFFE; FileFieldEditor httpdConfFFE; - + FileFieldEditor etcHostsFFE; BooleanFieldEditor apacheStartBFE; @@ -82,7 +82,7 @@ public class PHPExternalToolsPreferencePage extends PreferencePage implements IW } public boolean performOk() { -// PHPFileUtil.setExtensions(null); +// PHPFileUtil.setExtensions(null); // phpParserExtensionsSFE.store(); xamppStartSFE.store(); xamppStopSFE.store(); @@ -120,24 +120,24 @@ public class PHPExternalToolsPreferencePage extends PreferencePage implements IW apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); apacheSettingsGroup.setLayout(new GridLayout()); - + xamppStartSFE = new StringFieldEditor(ExternalToolsPlugin.XAMPP_START_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.xampp_start"), apacheSettingsGroup); - xamppStartSFE.setPreferencePage(this); + xamppStartSFE.setPage(this); xamppStartSFE.setPreferenceStore(getPreferenceStore()); xamppStartSFE.load(); new Label(apacheSettingsGroup, SWT.NONE); - + xamppStopSFE = new StringFieldEditor(ExternalToolsPlugin.XAMPP_STOP_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.xampp_stop"), apacheSettingsGroup); - xamppStopSFE.setPreferencePage(this); + xamppStopSFE.setPage(this); xamppStopSFE.setPreferenceStore(getPreferenceStore()); xamppStopSFE.load(); new Label(apacheSettingsGroup, SWT.NONE); - + apacheStartBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_START_BACKGROUND, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.start_background"), apacheSettingsGroup); - apacheStartBFE.setPreferencePage(this); + apacheStartBFE.setPage(this); apacheStartBFE.setPreferenceStore(getPreferenceStore()); apacheStartBFE.load(); @@ -145,60 +145,60 @@ public class PHPExternalToolsPreferencePage extends PreferencePage implements IW new Label(apacheSettingsGroup, SWT.NONE); apacheStartSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_START_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.start"), apacheSettingsGroup); - apacheStartSFE.setPreferencePage(this); + apacheStartSFE.setPage(this); apacheStartSFE.setPreferenceStore(getPreferenceStore()); apacheStartSFE.load(); new Label(apacheSettingsGroup, SWT.NONE); apacheStopBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_STOP_BACKGROUND, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.stop_background"), apacheSettingsGroup); - apacheStopBFE.setPreferencePage(this); + apacheStopBFE.setPage(this); apacheStopBFE.setPreferenceStore(getPreferenceStore()); apacheStopBFE.load(); new Label(apacheSettingsGroup, SWT.NONE); new Label(apacheSettingsGroup, SWT.NONE); apacheStopSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_STOP_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.stop"), apacheSettingsGroup); - apacheStopSFE.setPreferencePage(this); + apacheStopSFE.setPage(this); apacheStopSFE.setPreferenceStore(getPreferenceStore()); apacheStopSFE.load(); new Label(apacheSettingsGroup, SWT.NONE); apacheRestartBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_RESTART_BACKGROUND, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.restart_background"), apacheSettingsGroup); - apacheRestartBFE.setPreferencePage(this); + apacheRestartBFE.setPage(this); apacheRestartBFE.setPreferenceStore(getPreferenceStore()); apacheRestartBFE.load(); new Label(apacheSettingsGroup, SWT.NONE); new Label(apacheSettingsGroup, SWT.NONE); apacheRestartSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_RESTART_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.restart"), apacheSettingsGroup); - apacheRestartSFE.setPreferencePage(this); + apacheRestartSFE.setPage(this); apacheRestartSFE.setPreferenceStore(getPreferenceStore()); apacheRestartSFE.load(); new Label(apacheSettingsGroup, SWT.NONE); apacheRunFFE = new FileFieldEditor(ExternalToolsPlugin.APACHE_RUN_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.run"), apacheSettingsGroup); - apacheRunFFE.setPreferencePage(this); + apacheRunFFE.setPage(this); apacheRunFFE.setPreferenceStore(getPreferenceStore()); apacheRunFFE.load(); - httpdConfFFE = new FileFieldEditor(ExternalToolsPlugin.HTTPD_CONF_PATH_PREF, + httpdConfFFE = new FileFieldEditor(ExternalToolsPlugin.HTTPD_CONF_PATH_PREF, "Path to httpd.conf:", apacheSettingsGroup); - httpdConfFFE.setPreferencePage(this); + httpdConfFFE.setPage(this); httpdConfFFE.setPreferenceStore(getPreferenceStore()); httpdConfFFE.load(); - etcHostsFFE = new FileFieldEditor(ExternalToolsPlugin.ETC_HOSTS_PATH_PREF, + etcHostsFFE = new FileFieldEditor(ExternalToolsPlugin.ETC_HOSTS_PATH_PREF, "Path to etc/hosts:", apacheSettingsGroup); - etcHostsFFE.setPreferencePage(this); + etcHostsFFE.setPage(this); etcHostsFFE.setPreferenceStore(getPreferenceStore()); etcHostsFFE.load(); phpRunFFE = new FileFieldEditor(ExternalToolsPlugin.PHP_RUN_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.console.php"), apacheSettingsGroup); - phpRunFFE.setPreferencePage(this); + phpRunFFE.setPage(this); phpRunFFE.setPreferenceStore(getPreferenceStore()); phpRunFFE.load(); @@ -214,7 +214,7 @@ public class PHPExternalToolsPreferencePage extends PreferencePage implements IW mysqlStartBFE = new BooleanFieldEditor(ExternalToolsPlugin.MYSQL_START_BACKGROUND, PHPPreferencesMessages .getString("PHPBasePreferencePage.mySQLGroup.start_background"), mySQLSettingsGroup); - mysqlStartBFE.setPreferencePage(this); + mysqlStartBFE.setPage(this); mysqlStartBFE.setPreferenceStore(getPreferenceStore()); mysqlStartBFE.load(); new Label(mySQLSettingsGroup, SWT.NONE); @@ -222,36 +222,36 @@ public class PHPExternalToolsPreferencePage extends PreferencePage implements IW mySQLCommandSFE = new StringFieldEditor(ExternalToolsPlugin.MYSQL_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.mySQLGroup.command"), mySQLSettingsGroup); - mySQLCommandSFE.setPreferencePage(this); + mySQLCommandSFE.setPage(this); mySQLCommandSFE.setPreferenceStore(getPreferenceStore()); mySQLCommandSFE.load(); new Label(mySQLSettingsGroup, SWT.NONE); mysqlRunFFE = new FileFieldEditor(ExternalToolsPlugin.MYSQL_RUN_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.mySQLGroup.run"), mySQLSettingsGroup); - mysqlRunFFE.setPreferencePage(this); + mysqlRunFFE.setPage(this); mysqlRunFFE.setPreferenceStore(getPreferenceStore()); mysqlRunFFE.load(); - + Composite parserSettingsComposite = new Composite(composite, SWT.NULL); parserSettingsComposite.setLayout(new GridLayout()); parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE); parserSettingsGroup.setText("External parser command"); parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); parserSettingsGroup.setLayout(new GridLayout()); - + externalParserSFE = new StringFieldEditor( ExternalToolsPlugin.EXTERNAL_PARSER_PREF, PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"), parserSettingsGroup ); - externalParserSFE.setPreferencePage(this); + externalParserSFE.setPage(this); externalParserSFE.setPreferenceStore(getPreferenceStore()); externalParserSFE.load(); - + return composite; } } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunner.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunner.java index ee56530..cf8141a 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunner.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunner.java @@ -13,8 +13,6 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.Launch; import org.eclipse.debug.core.model.IProcess; public class InterpreterRunner { @@ -22,10 +20,10 @@ public class InterpreterRunner { public InterpreterRunner() { } - public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) { - String commandLine = renderCommandLine(configuration); + public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) { + String commandLine = renderCommandLine(configuration); File workingDirectory = configuration.getAbsoluteWorkingDirectory(); - + setEnvironmentVariables(configuration); String[] env = configuration.getEnvironment(); Process nativePHPProcess = null; @@ -38,7 +36,7 @@ public class InterpreterRunner { IProcess process = DebugPlugin.newProcess(launch, nativePHPProcess, renderLabel(configuration)); process.setAttribute(PHPLaunchingPlugin.PLUGIN_ID + ".launcher.cmdline", commandLine); process.setAttribute(IProcess.ATTR_PROCESS_TYPE, PHPLaunchConfigurationAttribute.PHP_LAUNCH_PROCESS_TYPE); - + return process ; } @@ -67,7 +65,7 @@ public class InterpreterRunner { return buffer.toString(); } - + protected void setEnvironmentVariables(InterpreterRunnerConfiguration configuration) { IPath FilePath= new Path(configuration.getAbsoluteFileName()); String OSFilePath= FilePath.toOSString(); @@ -88,11 +86,11 @@ public class InterpreterRunner { configuration.addEnvironmentValue("GATEWAY_INTERFACE","CGI / 1.1",true); configuration.addEnvironmentValue("REQUEST_METHOD","GET",true); - + Map stringVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment(); if (stringVars.containsKey("SYSTEMROOT")) configuration.addEnvironmentValue("SYSTEMROOT",(String) stringVars.get("SYSTEMROOT"),true); - + } protected String renderLoadPath(InterpreterRunnerConfiguration configuration) { @@ -118,8 +116,8 @@ public class InterpreterRunner { return aPath; } - + protected String getDebugCommandLineArgument() { - return "" ; - } + return "" ; + } } diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPInterpreter.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPInterpreter.java index acbbf91..9ea4586 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPInterpreter.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPInterpreter.java @@ -1,25 +1,7 @@ package net.sourceforge.phpdt.internal.launching; import java.io.File; -import java.io.FileWriter; import java.io.IOException; -import java.util.ArrayList; - -import net.sourceforge.phpdt.internal.ui.phpdocexport.JavadocExportMessages; -import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.Launch; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.ui.IDebugUIConstants; public class PHPInterpreter { diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPRuntime.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPRuntime.java index 0613535..0b392a6 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPRuntime.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPRuntime.java @@ -18,7 +18,6 @@ import java.util.List; import javax.xml.parsers.SAXParserFactory; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; @@ -28,7 +27,7 @@ import org.xml.sax.XMLReader; public class PHPRuntime { protected static PHPRuntime runtime; - + protected List installedInterpreters; protected PHPInterpreter selectedInterpreter; protected PHPRuntime() { @@ -41,7 +40,7 @@ public class PHPRuntime { } return runtime; } - + public PHPInterpreter getSelectedInterpreter() { if (selectedInterpreter == null) { loadRuntimeConfiguration(); @@ -56,7 +55,7 @@ public class PHPRuntime { if (each.getInstallLocation().toString().equals(installLocation)) return each; } - + return getSelectedInterpreter(); } @@ -78,7 +77,7 @@ public class PHPRuntime { loadRuntimeConfiguration(); return installedInterpreters; } - + public void setInstalledInterpreters(List newInstalledInterpreters) { installedInterpreters = newInstalledInterpreters; if (installedInterpreters.size() > 0) @@ -86,7 +85,7 @@ public class PHPRuntime { else setSelectedInterpreter(null); } - + protected void saveRuntimeConfiguration() { writeXML(getRuntimeConfigurationWriter()); } @@ -99,7 +98,7 @@ public class PHPRuntime { return null; } - + protected void loadRuntimeConfiguration() { installedInterpreters = new ArrayList(); try { @@ -120,14 +119,14 @@ public class PHPRuntime { } catch(FileNotFoundException e) {} return new StringReader(""); } - + protected void writeXML(Writer writer) { try { writer.write(""); Iterator interpretersIterator = installedInterpreters.iterator(); while (interpretersIterator.hasNext()) { writer.write(""); } writer.write(""); @@ -174,7 +173,7 @@ public class PHPRuntime { public void skippedEntity(String name) throws SAXException {} }; } - + protected File getRuntimeConfigurationFile() { IPath stateLocation = PHPLaunchingPlugin.getDefault().getStateLocation(); IPath fileLocation = stateLocation.append("runtimeConfiguration.xml"); diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java index 213316b..fcffda1 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -106,7 +106,7 @@ public class BasicCompletionProcessor extends TemplateCompletionProcessor { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, * int) */ @@ -119,7 +119,7 @@ public class BasicCompletionProcessor extends TemplateCompletionProcessor { String prefix = extractPrefix(viewer, offset); prefix = prefix.toLowerCase(); - Region region = new Region(offset - prefix.length(), prefix.length()); + IRegion region = new Region(offset - prefix.length(), prefix.length()); TemplateContext context = createContext(viewer, region); if (context == null) return new ICompletionProposal[0]; @@ -151,17 +151,17 @@ public class BasicCompletionProcessor extends TemplateCompletionProcessor { public char[] getCompletionProposalAutoActivationCharacters() { return fProposalAutoActivationSet; } - + /** * Sets this processor's set of characters triggering the activation of the * completion proposal computation. - * + * * @param activationSet the activation set */ public void setCompletionProposalAutoActivationCharacters(char[] activationSet) { fProposalAutoActivationSet= activationSet; } - + /** * Order the given proposals. */ @@ -172,7 +172,7 @@ public class BasicCompletionProcessor extends TemplateCompletionProcessor { /** * Tells this processor to order the proposals alphabetically. - * + * * @param order true if proposals should be ordered. */ // public void orderProposalsAlphabetically(boolean order) { diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableComposite.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableComposite.java index aca9922..c8aeec5 100644 --- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableComposite.java +++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableComposite.java @@ -39,9 +39,9 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** - * + * */ public class BrowserTableComposite extends Composite { protected Table table; @@ -50,10 +50,10 @@ public class BrowserTableComposite extends Composite { protected Button remove; protected Button search; protected IWebBrowser selection; - + protected Label location; protected Label parameters; - + public BrowserTableComposite(Composite parent, int style) { super(parent, style); createWidgets(); @@ -70,32 +70,32 @@ public class BrowserTableComposite extends Composite { GridData data = new GridData(GridData.FILL_BOTH); setLayoutData(data); - + Label label = new Label(this, SWT.NONE); label.setText(WebBrowserUIPlugin.getResource("%browserList")); data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); data.horizontalSpan = 2; label.setLayoutData(data); - + table = new Table(this, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION); data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); data.widthHint = 300; table.setLayoutData(data); table.setHeaderVisible(false); table.setLinesVisible(false); - + TableLayout tableLayout = new TableLayout(); new TableColumn(table, SWT.NONE); - + tableLayout.addColumnData(new ColumnWeightData(100)); table.setLayout(tableLayout); - + tableViewer = new CheckboxTableViewer(table); - + tableViewer.setContentProvider(new BrowserContentProvider()); tableViewer.setLabelProvider(new BrowserTableLabelProvider()); - + tableViewer.setInput("root"); // uncheck any other elements that might be checked and leave only the element checked to @@ -105,7 +105,7 @@ public class BrowserTableComposite extends Composite { checkNewDefaultBrowser(e.getElement()); IWebBrowser browser = (IWebBrowser) e.getElement(); BrowserManager.getInstance().setCurrentWebBrowser(browser); - + // if no other browsers are checked, don't allow the single one currently // checked to become unchecked, and lose a current browser. That is, don't // permit unchecking if no other item is checked which is supposed to be the case. @@ -114,7 +114,7 @@ public class BrowserTableComposite extends Composite { tableViewer.setChecked(e.getElement(), true); } }); - + // set a default, checked browser based on the current browser. If there is not a // current browser, but the first item exists, use that instead. // This will work currently until workbench shutdown, because current browser is not yet persisted. @@ -126,11 +126,11 @@ public class BrowserTableComposite extends Composite { if (obj != null) tableViewer.setChecked(obj, true); } - + tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { Object obj = getSelection(event.getSelection()); - + if (obj instanceof IInternalWebBrowser) { selection = (IInternalWebBrowser) obj; remove.setEnabled(false); @@ -141,14 +141,14 @@ public class BrowserTableComposite extends Composite { edit.setEnabled(true); } else selection = null; - + if (selection == null) { edit.setEnabled(false); remove.setEnabled(false); } } }); - + Composite buttonComp = new Composite(this, SWT.NONE); layout = new GridLayout(); layout.horizontalSpacing = 0; @@ -159,7 +159,7 @@ public class BrowserTableComposite extends Composite { buttonComp.setLayout(layout); data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL); buttonComp.setLayoutData(data); - + Button add = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%add")); add.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { @@ -169,7 +169,7 @@ public class BrowserTableComposite extends Composite { tableViewer.refresh(); } }); - + edit = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%edit")); edit.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { @@ -183,7 +183,7 @@ public class BrowserTableComposite extends Composite { tableViewer.refresh(wc.save()); } catch (Exception ex) { } } - } + } else if(browser2 instanceof IExternalWebBrowser) { IExternalWebBrowserWorkingCopy wc = ((IExternalWebBrowser) browser2).getWorkingCopy(); ExternalBrowserDialog dialog = new ExternalBrowserDialog(getShell(), wc); @@ -193,7 +193,7 @@ public class BrowserTableComposite extends Composite { } catch (Exception ex) { } } } - } + } }); edit.setEnabled(false); @@ -205,13 +205,13 @@ public class BrowserTableComposite extends Composite { if (browser2 instanceof IInternalWebBrowser){ remove.setEnabled(false); return; // nothing else possible to do - } + } else if(browser2 instanceof IExternalWebBrowser) { remove.setEnabled(true); ((IExternalWebBrowser) browser2).delete(); - + tableViewer.remove(browser2); - + // need here to ensure that if the item deleted was checked, ie, was // the current browser, that the new current browser will be the first in the // list, typically, the internal browser, which cannot be deleted, and be current. @@ -227,20 +227,20 @@ public class BrowserTableComposite extends Composite { } }); remove.setEnabled(false); - + search = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%search")); search.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { java.util.List browsersToCreate = BrowserSearcher.search(getShell()); - + if (browsersToCreate == null) // cancelled return; - + if (browsersToCreate.isEmpty()) { // no browsers found WebBrowserUtil.openMessage(WebBrowserUIPlugin.getResource("%searchingNoneFound")); return; } - + Iterator iterator = browsersToCreate.iterator(); while (iterator.hasNext()) { IExternalWebBrowserWorkingCopy browser2 = (IExternalWebBrowserWorkingCopy) iterator.next(); @@ -249,8 +249,8 @@ public class BrowserTableComposite extends Composite { tableViewer.refresh(); } }); - WorkbenchHelp.setHelp(search, ContextIds.PREF_BROWSER_EXTERNAL_SEARCH); - + PlatformUI.getWorkbench().getHelpSystem().setHelp(search, ContextIds.PREF_BROWSER_EXTERNAL_SEARCH); + tableViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent e) { checkNewDefaultBrowser(e.getElement()); @@ -260,23 +260,23 @@ public class BrowserTableComposite extends Composite { }); search.setEnabled(true); } - + public IWebBrowser getSelectedWebBrowser() { return selection; } - + protected Object getSelection(ISelection sel2) { IStructuredSelection sel = (IStructuredSelection) sel2; return sel.getFirstElement(); } - + // Uncheck all the items except the current one that was just checked protected void checkNewDefaultBrowser(Object browser) { TableItem[] children = tableViewer.getTable().getItems(); for (int i = 0; i < children.length; i++) { TableItem item = children[i]; - - if (!(item.getData().equals(browser))) + + if (!(item.getData().equals(browser))) item.setChecked(false); } } diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalBrowserDialog.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalBrowserDialog.java index f6aadff..4b3b9c9 100644 --- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalBrowserDialog.java +++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalBrowserDialog.java @@ -30,9 +30,9 @@ import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** - * + * */ public class ExternalBrowserDialog extends Dialog { protected IExternalWebBrowserWorkingCopy browser; @@ -44,11 +44,11 @@ public class ExternalBrowserDialog extends Dialog { protected Text browserLocationTextfield; protected Text browserParametersTextfield; private Button okButton; - + interface StringModifyListener { public void valueChanged(String s); } - + /** * @param parentShell */ @@ -66,7 +66,7 @@ public class ExternalBrowserDialog extends Dialog { protected void configureShell(Shell shell) { super.configureShell(shell); - + if (isEdit) shell.setText(WebBrowserUIPlugin.getResource("%editExternalBrowser")); else @@ -82,7 +82,7 @@ public class ExternalBrowserDialog extends Dialog { text.setLayoutData(data); if (listener != null) text.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { + public void modifyText(ModifyEvent e) { listener.valueChanged(text.getText()); } }); @@ -95,12 +95,12 @@ public class ExternalBrowserDialog extends Dialog { protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); ((GridLayout)composite.getLayout()).numColumns = 3; - + if (isEdit) - WorkbenchHelp.setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_EDIT); + PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_EDIT); else - WorkbenchHelp.setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_ADD); - + PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_ADD); + SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%name")); browserNameTextfield = createText(composite, browser.getName(), new StringModifyListener() { public void valueChanged(String s) { @@ -108,33 +108,33 @@ public class ExternalBrowserDialog extends Dialog { validateFields(); } }); - + new Label(composite, SWT.NONE); - + SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%location")); browserLocationTextfield = createText(composite, browser.getLocation(), new StringModifyListener() { public void valueChanged(String s) { browser.setLocation(s); validateFields(); } - }); - + }); + browseButton = SWTUtil.createButton(composite, WebBrowserUIPlugin.getResource("%browse")); browseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); dialog.setText(WebBrowserUIPlugin.getResource("%browseMessage")); - + String fname = browserLocationTextfield.getText(); - + dialog.setFileName(fname); fname = dialog.open(); - + if (fname != null) browserLocationTextfield.setText(fname); } }); - + SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%parameters")); browserParametersTextfield = createText(composite, browser.getParameters(), new StringModifyListener() { public void valueChanged(String s) { @@ -143,12 +143,12 @@ public class ExternalBrowserDialog extends Dialog { }); new Label(composite, SWT.NONE); - + new Label(composite, SWT.NONE); Label urlLabel = new Label(composite, SWT.NONE); urlLabel.setText(WebBrowserUIPlugin.getResource("%parametersMessage", WebBrowserPreference.URL_PARAMETER)); - - + + return composite; } @@ -168,36 +168,36 @@ public class ExternalBrowserDialog extends Dialog { WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%locationInvalid")); return; } - + browser.save(); super.okPressed(); } - + private void setOKButtonEnabled(boolean curIsEnabled) { if (okButton == null) okButton = getButton(IDialogConstants.OK_ID); - + if (okButton != null) okButton.setEnabled(curIsEnabled); } - + protected Control createButtonBar(Composite parent) { Control buttonControl = super.createButtonBar(parent); validateFields(); return buttonControl; } - + protected void validateFields() { boolean valid = true; - + String name = browserNameTextfield.getText(); if (name == null || name.trim().length() < 1) valid = false; - + String location = browserLocationTextfield.getText(); if (location == null || location.trim().length() < 1) valid = false; - + setOKButtonEnabled(valid); } } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalBrowserDialog.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalBrowserDialog.java index 7f09e03..e0261e8 100644 --- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalBrowserDialog.java +++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalBrowserDialog.java @@ -20,16 +20,16 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** - * + * */ public class InternalBrowserDialog extends Dialog { protected IInternalWebBrowserWorkingCopy browser; protected boolean isEdit; protected Button newPageCheckbox; protected Button clearURLHistoryCheckbox; - + /** * @param parentShell */ @@ -41,7 +41,7 @@ public class InternalBrowserDialog extends Dialog { protected void configureShell(Shell shell) { super.configureShell(shell); - + if (isEdit) shell.setText(WebBrowserUIPlugin.getResource("%editInternalBrowser")); } @@ -52,21 +52,21 @@ public class InternalBrowserDialog extends Dialog { protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); ((GridLayout)composite.getLayout()).numColumns = 1; - + Composite comp = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(1, true); layout.marginHeight = 10; layout.marginWidth = 10; comp.setLayout(layout); comp.setLayoutData(new GridData(GridData.FILL_BOTH)); - WorkbenchHelp.setHelp(composite, ContextIds.PREF_BROWSER_INTERNAL); - + PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER_INTERNAL); + newPageCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin.getResource("%prefBrowserNewPage"), false); clearURLHistoryCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin.getResource("%clearURLHistory"), true); - + newPageCheckbox.setSelection(browser.getUseNewPage()); clearURLHistoryCheckbox.setSelection(browser.getClearHistoryOnExit()); - + return composite; } @@ -77,7 +77,7 @@ public class InternalBrowserDialog extends Dialog { browser.setUseNewPage(newPageCheckbox.getSelection()); browser.setClearHistoryOnExit(clearURLHistoryCheckbox.getSelection()); browser.save(); - + super.okPressed(); } } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternetPreferencePage.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternetPreferencePage.java index 2628bf2..0b5c512 100644 --- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternetPreferencePage.java +++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternetPreferencePage.java @@ -20,7 +20,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** * A preference page that holds internet preferences. */ @@ -41,7 +41,7 @@ public class InternetPreferencePage extends PreferencePage implements IWorkbench */ protected Control createContents(Composite parent) { initializeDialogUnits(parent); - + Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 1; @@ -52,15 +52,15 @@ public class InternetPreferencePage extends PreferencePage implements IWorkbench composite.setLayout(layout); GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); composite.setLayoutData(data); - WorkbenchHelp.setHelp(composite, ContextIds.PREF_BROWSER); - + PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER); + Label label = new Label(composite, SWT.WRAP); label.setText(WebBrowserUIPlugin.getResource("%preferenceInternetDescription")); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); label.setLayoutData(data); - + Dialog.applyDialogFont(composite); - + return composite; } diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowser.java index 1556311..24cfb5d 100644 --- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowser.java +++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowser.java @@ -45,7 +45,7 @@ import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; public class WebBrowser extends Composite { protected Composite toolbarComp; @@ -103,7 +103,7 @@ public class WebBrowser extends Composite { setLayout(layout); setLayoutData(new GridData(GridData.FILL_BOTH)); clipboard = new Clipboard(parent.getDisplay()); - WorkbenchHelp.setHelp(this, ContextIds.WEB_BROWSER); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.WEB_BROWSER); if (showToolbar) { toolbarComp = new Composite(this, SWT.NONE); @@ -142,7 +142,7 @@ public class WebBrowser extends Composite { } }); combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - WorkbenchHelp.setHelp(combo, ContextIds.WEB_BROWSER_URL); + PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ContextIds.WEB_BROWSER_URL); ToolBar toolbar = new ToolBar(top, SWT.FLAT); fillToolBar(toolbar); @@ -167,7 +167,7 @@ public class WebBrowser extends Composite { forward.setEnabled(browser.isForwardEnabled()); } - WorkbenchHelp.setHelp(browser, ContextIds.WEB_BROWSER_WEB); + PlatformUI.getWorkbench().getHelpSystem().setHelp(browser, ContextIds.WEB_BROWSER_WEB); GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.FILL; diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreferencePage.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreferencePage.java index 7559114..cda95fd 100644 --- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreferencePage.java +++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreferencePage.java @@ -20,7 +20,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** * The preference page that holds webbrowser preferences. */ @@ -41,7 +41,7 @@ public class WebBrowserPreferencePage extends PreferencePage implements IWorkben */ protected Control createContents(Composite parent) { initializeDialogUnits(parent); - + Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 1; @@ -52,32 +52,32 @@ public class WebBrowserPreferencePage extends PreferencePage implements IWorkben composite.setLayout(layout); GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); composite.setLayoutData(data); - WorkbenchHelp.setHelp(composite, ContextIds.PREF_BROWSER); - + PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER); + Label label = new Label(composite, SWT.WRAP); label.setText(WebBrowserUIPlugin.getResource("%preferenceWebBrowserDescription")); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); label.setLayoutData(data); - + BrowserTableComposite browserComposite = new BrowserTableComposite(composite, SWT.NONE); - + data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); browserComposite.setLayoutData(data); - + Dialog.applyDialogFont(composite); - + return composite; } - + /** * Initializes this preference page using the passed desktop. * * @param desktop the current desktop */ public void init(IWorkbench workbench) { } - + /** - * + * */ public void setVisible(boolean visible) { super.setVisible(visible); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SourceTypeBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SourceTypeBinding.java index 87fd4e9..266a332 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SourceTypeBinding.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SourceTypeBinding.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -40,9 +40,9 @@ public class SourceTypeBinding extends ReferenceBinding { public final static int FIELD = 1; public final static int CLASS_LITERAL = 2; public final static int CHANGED_DECLARING_CLASS = 3; - + Hashtable[] synthetics; - + protected SourceTypeBinding() { } public SourceTypeBinding(char[][] compoundName, PackageBinding fPackage, ClassScope scope) { @@ -115,14 +115,14 @@ public FieldBinding addSyntheticField(LocalVariableBinding actualOuterLocalVaria if (synthetics[FIELD] == null) { synthetics[FIELD] = new Hashtable(5); } - + FieldBinding synthField = (FieldBinding) synthetics[FIELD].get(actualOuterLocalVariable); if (synthField == null) { synthField = new SyntheticFieldBinding( - CharOperation.concat(SyntheticArgumentBinding.OuterLocalPrefix, actualOuterLocalVariable.name), - actualOuterLocalVariable.type, - AccPrivate | AccFinal ,//| AccSynthetic, - this, + CharOperation.concat(SyntheticArgumentBinding.OuterLocalPrefix, actualOuterLocalVariable.name), + actualOuterLocalVariable.type, + AccPrivate | AccFinal ,//| AccSynthetic, + this, Constant.NotAConstant, synthetics[FIELD].size()); synthetics[FIELD].put(actualOuterLocalVariable, synthField); @@ -188,7 +188,7 @@ public FieldBinding addSyntheticField(ReferenceBinding enclosingType) { break; } } - } + } return synthField; } /* Add a new synthetic field for a class literal access. @@ -227,7 +227,7 @@ public FieldBinding addSyntheticField(TypeBinding targetType, BlockScope blockSc break; } } - } + } return synthField; } @@ -296,7 +296,7 @@ public SyntheticAccessMethodBinding addSyntheticMethod(FieldBinding targetField, if (accessors == null) { accessMethod = new SyntheticAccessMethodBinding(targetField, isReadAccess, this); synthetics[METHOD].put(targetField, accessors = new SyntheticAccessMethodBinding[2]); - accessors[isReadAccess ? 0 : 1] = accessMethod; + accessors[isReadAccess ? 0 : 1] = accessMethod; } else { if ((accessMethod = accessors[isReadAccess ? 0 : 1]) == null) { accessMethod = new SyntheticAccessMethodBinding(targetField, isReadAccess, this); @@ -324,7 +324,7 @@ public SyntheticAccessMethodBinding addSyntheticMethod(MethodBinding targetMetho if (accessors == null) { accessMethod = new SyntheticAccessMethodBinding(targetMethod, isSuperAccess, this); synthetics[METHOD].put(targetMethod, accessors = new SyntheticAccessMethodBinding[2]); - accessors[isSuperAccess ? 0 : 1] = accessMethod; + accessors[isSuperAccess ? 0 : 1] = accessMethod; } else { if ((accessMethod = accessors[isSuperAccess ? 0 : 1]) == null) { accessMethod = new SyntheticAccessMethodBinding(targetMethod, isSuperAccess, this); @@ -365,7 +365,7 @@ public FieldBinding[] fields() { int newSize = fields.length - failed; if (newSize == 0) return fields = NoFields; - + FieldBinding[] newFields = new FieldBinding[newSize]; for (int i = 0, n = 0, max = fields.length; i < max; i++) if (fields[i] != null) @@ -386,7 +386,7 @@ public FieldBinding[] fields() { } if (newFields != null){ System.arraycopy(newFields, 0, fields = new FieldBinding[count], 0, count); - } + } throw e; } return fields; @@ -543,7 +543,7 @@ public MethodBinding[] getMethods(char[] selector) { } } } - + if (foundProblem || count > 1) { for (int m = methods.length; --m >= 0;) { MethodBinding method = methods[m]; @@ -574,12 +574,12 @@ public MethodBinding[] getMethods(char[] selector) { } } } - + if (failed > 0) { int newSize = methods.length - failed; if (newSize == 0) return methods = NoMethods; - + MethodBinding[] newMethods = new MethodBinding[newSize]; for (int i = 0, n = 0, max = methods.length; i < max; i++) if (methods[i] != null) @@ -615,10 +615,10 @@ public MethodBinding[] getMethods(char[] selector) { } if (newMethods != null){ System.arraycopy(newMethods, 0, methods = new MethodBinding[count], 0, count); - } + } modifiers ^= AccUnresolved; throw e; - } + } return NoMethods; } /* Answer the synthetic field for @@ -626,7 +626,7 @@ public MethodBinding[] getMethods(char[] selector) { */ public FieldBinding getSyntheticField(LocalVariableBinding actualOuterLocalVariable) { - + if (synthetics == null || synthetics[FIELD] == null) return null; return (FieldBinding) synthetics[FIELD].get(actualOuterLocalVariable); } @@ -683,7 +683,7 @@ public MethodBinding[] methods() { try { if ((modifiers & AccUnresolved) == 0) return methods; - + int failed = 0; for (int m = 0, max = methods.length; m < max; m++) { if (resolveTypesFor(methods[m]) == null) { @@ -691,7 +691,7 @@ public MethodBinding[] methods() { failed++; } } - + for (int m = methods.length; --m >= 0;) { MethodBinding method = methods[m]; if (method != null) { @@ -721,7 +721,7 @@ public MethodBinding[] methods() { } } } - + if (failed > 0) { int newSize = methods.length - failed; if (newSize == 0) { @@ -734,7 +734,7 @@ public MethodBinding[] methods() { methods = newMethods; } } - + // handle forward references to potential default abstract methods addDefaultAbstractMethods(); } catch(AbortCompilation e){ @@ -751,10 +751,10 @@ public MethodBinding[] methods() { } if (newMethods != null){ System.arraycopy(newMethods, 0, methods = new MethodBinding[count], 0, count); - } + } modifiers ^= AccUnresolved; throw e; - } + } modifiers ^= AccUnresolved; return methods; } @@ -883,7 +883,7 @@ public ReferenceBinding[] superInterfaces() { return superInterfaces; } public SyntheticAccessMethodBinding[] syntheticAccessMethods() { - + if (synthetics == null || synthetics[METHOD] == null || synthetics[METHOD].size() == 0) return null; // difficult to compute size up front because of the embedded arrays so assume there is only 1 @@ -902,9 +902,9 @@ public SyntheticAccessMethodBinding[] syntheticAccessMethods() { if (methodAccessors[1] != null) numberOfAccessors++; if (index + numberOfAccessors > bindings.length) System.arraycopy(bindings, 0, (bindings = new SyntheticAccessMethodBinding[index + numberOfAccessors]), 0, index); - if (methodAccessors[0] != null) - bindings[index++] = methodAccessors[0]; // super access - if (methodAccessors[1] != null) + if (methodAccessors[0] != null) + bindings[index++] = methodAccessors[0]; // super access + if (methodAccessors[1] != null) bindings[index++] = methodAccessors[1]; // normal access } else { @@ -915,9 +915,9 @@ public SyntheticAccessMethodBinding[] syntheticAccessMethods() { if (fieldAccessors[1] != null) numberOfAccessors++; if (index + numberOfAccessors > bindings.length) System.arraycopy(bindings, 0, (bindings = new SyntheticAccessMethodBinding[index + numberOfAccessors]), 0, index); - if (fieldAccessors[0] != null) + if (fieldAccessors[0] != null) bindings[index++] = fieldAccessors[0]; // read access - if (fieldAccessors[1] != null) + if (fieldAccessors[1] != null) bindings[index++] = fieldAccessors[1]; // write access } } @@ -935,7 +935,7 @@ public SyntheticAccessMethodBinding[] syntheticAccessMethods() { * Answer the collection of synthetic fields to append into the classfile */ public FieldBinding[] syntheticFields() { - + if (synthetics == null) return null; int fieldSize = synthetics[FIELD] == null ? 0 : synthetics[FIELD].size(); @@ -1051,9 +1051,9 @@ public FieldBinding getSyntheticField(ReferenceBinding targetEnclosingType, bool // class T { class M{}} // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N(). if (!onlyExactMatch){ - Enumeration enum = synthetics[FIELD].elements(); - while (enum.hasMoreElements()) { - field = (FieldBinding) enum.nextElement(); + Enumeration e = synthetics[FIELD].elements(); + while (e.hasMoreElements()) { + field = (FieldBinding) e.nextElement(); if (CharOperation.prefixEquals(SyntheticArgumentBinding.EnclosingInstancePrefix, field.name) && targetEnclosingType.isSuperclassOf((ReferenceBinding) field.type)) return field; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index 2cb48e4..a9fdbb2 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -2527,7 +2527,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI FieldReference ref = (FieldReference) lhs; if (!containsVariableSet(ref.token)) { if (null==initHandler || initHandler.reportError()) { - problemReporter.uninitializedLocalVariable(new String(ref.token), ref.sourceStart(), ref.sourceEnd(), + problemReporter.uninitializedLocalVariable(new String(ref.token), ref.sourceStart, ref.sourceEnd, referenceContext, compilationUnit.compilationResult); } addVariableSet(ref.token); @@ -2553,7 +2553,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI // example: // $var = & new Object(); if (fMethodVariables != null) { - VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart()); + VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart); lhsInfo.reference = classRef; lhsInfo.typeIdentifier = classRef.token; fMethodVariables.put(new String(((FieldReference) lhs).token), lhsInfo); @@ -2569,7 +2569,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI if (fMethodVariables != null) { VariableInfo rhsInfo = (VariableInfo) fMethodVariables.get(((FieldReference) rhs).token); if (rhsInfo != null && rhsInfo.reference != null) { - VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart()); + VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart); lhsInfo.reference = rhsInfo.reference; lhsInfo.typeIdentifier = rhsInfo.typeIdentifier; fMethodVariables.put(new String(((FieldReference) lhs).token), lhsInfo); @@ -2587,7 +2587,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI if (fMethodVariables != null) { VariableInfo rhsInfo = (VariableInfo) fMethodVariables.get(((FieldReference) rhs).token); if (rhsInfo != null && rhsInfo.reference != null) { - VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart()); + VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart); lhsInfo.reference = rhsInfo.reference; lhsInfo.typeIdentifier = rhsInfo.typeIdentifier; fMethodVariables.put(new String(((FieldReference) lhs).token), lhsInfo); @@ -2598,7 +2598,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI // example: // $var = new Object(); if (fMethodVariables != null) { - VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart()); + VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart); lhsInfo.reference = (SingleTypeReference) rhs; lhsInfo.typeIdentifier = ((SingleTypeReference) rhs).token; fMethodVariables.put(new String(((FieldReference) lhs).token), lhsInfo); @@ -2609,7 +2609,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI } if (rememberedVar == false && lhs != null && lhs instanceof FieldReference) { if (fMethodVariables != null) { - VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart()); + VariableInfo lhsInfo = new VariableInfo(((FieldReference) lhs).sourceStart); fMethodVariables.put(new String(((FieldReference) lhs).token), lhsInfo); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java index 7f8d1c4..12ebbfe 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -62,7 +62,7 @@ import org.eclipse.core.runtime.Path; * same type of container. * *
  • This operation can be used to copy and rename elements within - * the same container. + * the same container. * *
  • This operation only copies compilation units and package fragments. * It does not copy package fragment roots - a platform operation must be used for that. @@ -76,7 +76,7 @@ public class CopyResourceElementsOperation extends MultiOperation { */ protected ArrayList fRenamedCompilationUnits = null; /** - * Table specifying deltas for elements being + * Table specifying deltas for elements being * copied/moved/renamed. Keyed by elements' project(s), and * values are the corresponding deltas. */ @@ -135,7 +135,7 @@ public class CopyResourceElementsOperation extends MultiOperation { // for (int i = 0, max = nonJavaResources.length, index = 0; i < max; i++){ // if (nonJavaResources[i] instanceof IResource) actualNonJavaResources[index++] = (IResource)nonJavaResources[i]; // } - + // if (actualNonJavaResourceCount != 0) { // int correctKindChildrenSize = correctKindChildren.size(); // IResource[] result = new IResource[correctKindChildrenSize + actualNonJavaResourceCount]; @@ -168,12 +168,12 @@ public class CopyResourceElementsOperation extends MultiOperation { } parentFolder = parentFolder.getFolder(new Path(subFolderName)); sourceFolder = sourceFolder.getFolder(new Path(subFolderName)); - if (sourceFolder.isReadOnly()) { - parentFolder.setReadOnly(true); + if (sourceFolder.getResourceAttributes().isReadOnly()) { + parentFolder.getResourceAttributes().setReadOnly(true); } IPackageFragment sideEffectPackage = root.getPackageFragment(sideEffectPackageName.toString()); if (i < names.length - 1 // all but the last one are side effect packages - && !net.sourceforge.phpdt.internal.core.util.Util.isExcluded(parentFolder, exclusionsPatterns)) { + && !net.sourceforge.phpdt.internal.core.util.Util.isExcluded(parentFolder, exclusionsPatterns)) { if (projectDelta == null) { projectDelta = getDeltaFor(root.getJavaProject()); } @@ -214,7 +214,7 @@ public class CopyResourceElementsOperation extends MultiOperation { *
  • one rooted in the source project *
  • one rooted in the destination project * If the operation is rooted in a single project, the delta is rooted in that project - * + * */ protected void prepareDeltas(IJavaElement sourceElement, IJavaElement destinationElement, boolean isMove) { if (net.sourceforge.phpdt.internal.core.util.Util.isExcluded(sourceElement) || net.sourceforge.phpdt.internal.core.util.Util.isExcluded(destinationElement)) return; @@ -240,7 +240,7 @@ public class CopyResourceElementsOperation extends MultiOperation { String newCUName = getNewNameFor(source); String destName = (newCUName != null) ? newCUName : source.getElementName(); String newContent = updatedContent(source, dest, newCUName); // null if unchanged - + // copy resource IFile sourceResource = (IFile)(source.isWorkingCopy() ? source.getOriginalElement() : source).getResource(); IContainer destFolder = (IContainer)dest.getResource(); // can be an IFolder or an IProject @@ -254,7 +254,7 @@ public class CopyResourceElementsOperation extends MultiOperation { } else { // abort throw new JavaModelException(new JavaModelStatus( - IJavaModelStatusConstants.NAME_COLLISION, + IJavaModelStatusConstants.NAME_COLLISION, Util.bind("status.nameCollision", destFile.getFullPath().toString()))); //$NON-NLS-1$ } } @@ -266,19 +266,19 @@ public class CopyResourceElementsOperation extends MultiOperation { if (newContent != null) flags |= IResource.KEEP_HISTORY; sourceResource.copy(destFile.getFullPath(), flags, getSubProgressMonitor(1)); } - this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); + this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); } catch (JavaModelException e) { throw e; } catch (CoreException e) { throw new JavaModelException(e); } - + // update new resource content try { if (newContent != null){ String encoding = source.getJavaProject().getOption(JavaCore.CORE_ENCODING, true); destFile.setContents( - new ByteArrayInputStream(encoding == null ? newContent.getBytes() : newContent.getBytes(encoding)), + new ByteArrayInputStream(encoding == null ? newContent.getBytes() : newContent.getBytes(encoding)), force ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, getSubProgressMonitor(1)); } @@ -287,7 +287,7 @@ public class CopyResourceElementsOperation extends MultiOperation { } catch (CoreException e) { throw new JavaModelException(e); } - + // register the correct change deltas ICompilationUnit destCU = dest.getCompilationUnit(destName); prepareDeltas(source, destCU, isMove()); @@ -302,7 +302,7 @@ public class CopyResourceElementsOperation extends MultiOperation { } else { if (!force) { throw new JavaModelException(new JavaModelStatus( - IJavaModelStatusConstants.NAME_COLLISION, + IJavaModelStatusConstants.NAME_COLLISION, Util.bind("status.nameCollision", destFile.getFullPath().toString()))); //$NON-NLS-1$ } // update new resource content @@ -312,8 +312,8 @@ public class CopyResourceElementsOperation extends MultiOperation { if (newContent != null){ String encoding = source.getJavaProject().getOption(JavaCore.CORE_ENCODING, true); destFile.setContents( - new ByteArrayInputStream(encoding == null ? newContent.getBytes() : newContent.getBytes(encoding)), - force ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, + new ByteArrayInputStream(encoding == null ? newContent.getBytes() : newContent.getBytes(encoding)), + force ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, getSubProgressMonitor(1)); } } catch(IOException e) { @@ -368,7 +368,7 @@ public class CopyResourceElementsOperation extends MultiOperation { processDeltas(); } } - + /** * Copies/moves a package fragment with the name newName * to the destination package.
    @@ -381,7 +381,7 @@ public class CopyResourceElementsOperation extends MultiOperation { String newFragName = (newName == null) ? source.getElementName() : newName; IPackageFragment newFrag = root.getPackageFragment(newFragName); IResource[] resources = collectResourcesOfInterest(source); - + // if isMove() can we move the folder itself ? (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=22458) boolean shouldMoveFolder = isMove() && !newFrag.getResource().exists(); // if new pkg fragment exists, it is an override IFolder srcFolder = (IFolder)source.getResource(); @@ -399,15 +399,15 @@ public class CopyResourceElementsOperation extends MultiOperation { break; } } - } + } } createNeededPackageFragments((IContainer) source.getParent().getResource(), root, newFragName, shouldMoveFolder); - + // Process resources if (shouldMoveFolder) { // move underlying resource srcFolder.move(destPath, force, true /* keep history */, getSubProgressMonitor(1)); - this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); + this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); } else { // process the leaf resources if (resources.length > 0) { @@ -424,7 +424,7 @@ public class CopyResourceElementsOperation extends MultiOperation { deleteResource(destinationResource, IResource.KEEP_HISTORY); } else { throw new JavaModelException(new JavaModelStatus( - IJavaModelStatusConstants.NAME_COLLISION, + IJavaModelStatusConstants.NAME_COLLISION, Util.bind("status.nameCollision", destinationResource.getFullPath().toString()))); //$NON-NLS-1$ } } @@ -440,7 +440,7 @@ public class CopyResourceElementsOperation extends MultiOperation { deleteResource(destinationResource, IResource.KEEP_HISTORY); } else { throw new JavaModelException(new JavaModelStatus( - IJavaModelStatusConstants.NAME_COLLISION, + IJavaModelStatusConstants.NAME_COLLISION, Util.bind("status.nameCollision", destinationResource.getFullPath().toString()))); //$NON-NLS-1$ } } @@ -449,7 +449,7 @@ public class CopyResourceElementsOperation extends MultiOperation { } } } - + // Discard empty old package (if still empty after the rename) boolean isEmpty = true; if (isMove()) { @@ -473,12 +473,12 @@ public class CopyResourceElementsOperation extends MultiOperation { } else { rootResource = source.getParent().getResource(); } - + // delete recursively empty folders deleteEmptyPackageFragment(source, false, rootResource); } } - + // Update package statement in compilation unit if needed if (!newFrag.getElementName().equals(source.getElementName())) { // if package has been renamed, update the compilation units for (int i = 0; i < resources.length; i++) { @@ -506,7 +506,7 @@ public class CopyResourceElementsOperation extends MultiOperation { } } } - + //register the correct change deltas prepareDeltas(source, newFrag, isMove() && isEmpty); } catch (DOMException dom) { @@ -548,9 +548,9 @@ public class CopyResourceElementsOperation extends MultiOperation { private void updatePackageStatement(IDOMCompilationUnit domCU, String pkgName) throws JavaModelException { boolean defaultPackage = pkgName.equals(IPackageFragment.DEFAULT_PACKAGE_NAME); boolean seenPackageNode = false; - Enumeration enum = domCU.getChildren(); - while (enum.hasMoreElements()) { - IDOMNode node = (IDOMNode) enum.nextElement(); + Enumeration e = domCU.getChildren(); + while (e.hasMoreElements()) { + IDOMNode node = (IDOMNode) e.nextElement(); if (node.getNodeType() == IDOMNode.PACKAGE) { if (! defaultPackage) { node.setName(pkgName); @@ -608,7 +608,7 @@ public class CopyResourceElementsOperation extends MultiOperation { if (!status.isOK()) { return status; } - + if (fRenamingsList != null && fRenamingsList.length != fElementsToProcess.length) { return new JavaModelStatus(IJavaModelStatusConstants.INDEX_OUT_OF_BOUNDS); } @@ -620,7 +620,7 @@ public class CopyResourceElementsOperation extends MultiOperation { protected void verify(IJavaElement element) throws JavaModelException { if (element == null || !element.exists()) error(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, element); - + if (element.isReadOnly() && (isRename() || isMove())) error(IJavaModelStatusConstants.READ_ONLY, element); @@ -630,16 +630,16 @@ public class CopyResourceElementsOperation extends MultiOperation { error(JavaModelStatus.INVALID_RESOURCE, element); } } - + int elementType = element.getElementType(); - + if (elementType == IJavaElement.COMPILATION_UNIT) { if (isMove() && ((ICompilationUnit) element).isWorkingCopy()) error(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, element); } else if (elementType != IJavaElement.PACKAGE_FRAGMENT) { error(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, element); } - + JavaElement dest = (JavaElement) getDestinationParent(element); verifyDestination(element, dest); if (fRenamings != null) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Openable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Openable.java index 63b87b8..1364b4f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Openable.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Openable.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -60,8 +60,8 @@ protected Openable(JavaElement parent, String name) { } else { JavaModelManager.getJavaModelManager().getElementsOutOfSynchWithBuffers().put(this, this); } - } - + } + /** * Builds this element's structure and properties in the given * info object, based on this element's current contents (reuse buffer @@ -82,7 +82,7 @@ protected Openable(JavaElement parent, String name) { //protected void buildStructure(OpenableElementInfo info, IProgressMonitor monitor) throws JavaModelException { // // if (monitor != null && monitor.isCanceled()) return; -// +// // // remove existing (old) infos // removeInfo(); // HashMap newElements = new HashMap(11); @@ -93,11 +93,11 @@ protected Openable(JavaElement parent, String name) { // Object value = newElements.get(key); // JavaModelManager.getJavaModelManager().putInfo(key, value); // } -// +// // // add the info for this at the end, to ensure that a getInfo cannot reply null in case the LRU cache needs // // to be flushed. Might lead to performance issues. // // see PR 1G2K5S7: ITPJCORE:ALL - NPE when accessing source for a binary type -// JavaModelManager.getJavaModelManager().putInfo(this, info); +// JavaModelManager.getJavaModelManager().putInfo(this, info); //} /* * Returns whether this element can be removed from the Java model cache to make space. @@ -192,7 +192,7 @@ protected void closing(Object info) { // // fix for 1FVGGKF // JavaProject project = (JavaProject)getJavaProject(); // ISearchableNameEnvironment environment = project.getSearchableNameEnvironment(); -// +// // // fix for 1FVXGDK // SelectionEngine engine = new SelectionEngine(environment, requestor, project.getOptions(true)); // engine.select(cu, offset, offset + length - 1); @@ -220,7 +220,7 @@ protected void generateInfos(Object info, HashMap newElements, IProgressMonitor if (JavaModelManager.VERBOSE){ System.out.println("OPENING Element ("+ Thread.currentThread()+"): " + this.toStringWithAncestors()); //$NON-NLS-1$//$NON-NLS-2$ } - + // open the parent if necessary openParent(info, newElements, monitor); if (monitor != null && monitor.isCanceled()) return; @@ -238,7 +238,7 @@ protected void generateInfos(Object info, HashMap newElements, IProgressMonitor newElements.remove(this); throw e; } - + // remove out of sync buffer for this element JavaModelManager.getJavaModelManager().getElementsOutOfSynchWithBuffers().remove(this); @@ -253,7 +253,7 @@ protected void generateInfos(Object info, HashMap newElements, IProgressMonitor * is the first time a request is being made for the buffer, an attempt is * made to create and fill this element's buffer. If the buffer has been * closed since it was first opened, the buffer is re-created. - * + * * @see IOpenable */ public IBuffer getBuffer() throws JavaModelException { @@ -299,7 +299,7 @@ public IResource getCorrespondingResource() throws JavaModelException { * @see IJavaElement */ public IOpenable getOpenable() { - return this; + return this; } @@ -327,14 +327,14 @@ public IResource getUnderlyingResource() throws JavaModelException { } public boolean exists() { - + IPackageFragmentRoot root = this.getPackageFragmentRoot(); if (root == null || root == this || !root.isArchive()) { return parentExists() && resourceExists(); } else { return super.exists(); } -} +} /** * Returns true if this element may have an associated source buffer, @@ -344,7 +344,7 @@ protected boolean hasBuffer() { return false; } /** - * @see IParent + * @see IParent */ public boolean hasChildren() throws JavaModelException { return getChildren().length > 0; @@ -353,7 +353,7 @@ public boolean hasChildren() throws JavaModelException { * @see IOpenable */ public boolean hasUnsavedChanges() throws JavaModelException{ - + if (isReadOnly() || !isOpen()) { return false; } @@ -379,7 +379,7 @@ public boolean hasUnsavedChanges() throws JavaModelException{ } } } - + return false; } /** @@ -391,7 +391,7 @@ public boolean isConsistent() throws JavaModelException { return true; } /** - * + * * @see IOpenable */ public boolean isOpen() { @@ -417,10 +417,10 @@ protected boolean isSourceElement() { //} /** * @see IOpenable - */ + */ public void makeConsistent(IProgressMonitor monitor) throws JavaModelException { if (isConsistent()) return; - + // create a new info and make it the current info // (this will remove the info and its children just before storing the new infos) JavaModelManager manager = JavaModelManager.getJavaModelManager(); @@ -481,11 +481,11 @@ protected void openParent(Object childInfo, HashMap newElements, IProgressMonito // */ //protected void openWhenClosed(IProgressMonitor pm) throws JavaModelException { // try { -// +// // if (JavaModelManager.VERBOSE){ // System.out.println("OPENING Element ("+ Thread.currentThread()+"): " + this.toStringWithAncestors()); //$NON-NLS-1$//$NON-NLS-2$ // } -// +// // // 1) Parent must be open - open the parent if necessary // openParent(pm); // @@ -493,14 +493,14 @@ protected void openParent(Object childInfo, HashMap newElements, IProgressMonito // OpenableElementInfo info = createElementInfo(); // if (isSourceElement()) { // this.openBuffer(pm); -// } +// } // // // 3) build the structure of the openable // buildStructure(info, pm); // // // 4) anything special // opening(info); -// +// //// if (JavaModelManager.VERBOSE) { //// System.out.println("-> Package cache size = " + JavaModelManager.getJavaModelManager().cache.pkgSize()); //$NON-NLS-1$ //// System.out.println("-> Openable cache filling ratio = " + JavaModelManager.getJavaModelManager().cache.openableFillingRatio() + "%"); //$NON-NLS-1$//$NON-NLS-2$ @@ -517,10 +517,10 @@ protected void openParent(Object childInfo, HashMap newElements, IProgressMonito /** * Answers true if the parent exists (null parent is answering true) - * + * */ protected boolean parentExists(){ - + IJavaElement parent = this.getParent(); if (parent == null) return true; return parent.exists(); @@ -532,9 +532,9 @@ protected boolean parentExists(){ protected boolean resourceExists() { IWorkspace workspace = ResourcesPlugin.getWorkspace(); if (workspace == null) return false; // workaround for http://bugs.eclipse.org/bugs/show_bug.cgi?id=34069 - return + return JavaModel.getTarget( - workspace.getRoot(), + workspace.getRoot(), this.getPath().makeRelative(), // ensure path is relative (see http://dev.eclipse.org/bugs/show_bug.cgi?id=22517) true) != null; } @@ -543,7 +543,7 @@ protected boolean resourceExists() { * @see IOpenable */ public void save(IProgressMonitor pm, boolean force) throws JavaModelException { - if (isReadOnly() || this.getResource().isReadOnly()) { + if (isReadOnly() || this.getResource().getResourceAttributes().isReadOnly()) { throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.READ_ONLY, this)); } IBuffer buf = getBuffer(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLContextType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLContextType.java index a5ee3d4..82be502 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLContextType.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLContextType.java @@ -7,8 +7,6 @@ package net.sourceforge.phpdt.internal.corext.template.php; //import net.sourceforge.phpdt.core.ICompilationUnit; import net.sourceforge.phpdt.core.ICompilationUnit; -import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitContextType.File; - import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.templates.GlobalTemplateVariables; import org.eclipse.jface.text.templates.TemplateException; @@ -16,7 +14,7 @@ import org.eclipse.jface.text.templates.TemplateVariable; /** * A context type for javadoc. - */ + */ public class HTMLContextType extends CompilationUnitContextType { /** @@ -24,7 +22,7 @@ public class HTMLContextType extends CompilationUnitContextType { */ public HTMLContextType() { super("html"); //$NON-NLS-1$ - + // global addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); @@ -34,15 +32,15 @@ public class HTMLContextType extends CompilationUnitContextType { addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); - + addResolver(new File()); } - + /* * @see ContextType#createContext() - */ + */ public CompilationUnitContext createContext(IDocument document, int offset, int length, ICompilationUnit compilationUnit) { - return new HTMLUnitContext(this, document, offset, length, compilationUnit); + return new HTMLUnitContext(this, document, offset, length, compilationUnit); } /* (non-Javadoc) * @see net.sourceforge.phpdt.internal.corext.template.java.CompilationUnitContextType#createContext(org.eclipse.jface.text.IDocument, int, int, net.sourceforge.phpdt.core.ICompilationUnit) @@ -54,7 +52,7 @@ public class HTMLContextType extends CompilationUnitContextType { * @see net.sourceforge.phpdt.internal.corext.template.ContextType#validateVariables(net.sourceforge.phpdt.internal.corext.template.TemplateVariable[]) */ protected void validateVariables(TemplateVariable[] variables) throws TemplateException { - // check for multiple cursor variables + // check for multiple cursor variables for (int i= 0; i < variables.length; i++) { TemplateVariable var= variables[i]; if (var.getType().equals(GlobalTemplateVariables.Cursor.NAME)) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java index a098975..d3b4949 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/JavaModelUtil.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -36,13 +36,13 @@ import org.eclipse.core.runtime.IPath; * Utility methods for the Java Model. */ public class JavaModelUtil { - - /** + + /** * Finds a type by its qualified type name (dot separated). * @param jproject The java project to search in * @param str The fully qualified name (type name with enclosing type names and package (all separated by dots)) * @return The type found, or null if not existing - */ + */ // public static IType findType(IJavaProject jproject, String fullyQualifiedName) throws JavaModelException { // //workaround for bug 22883 // IType type= jproject.findType(fullyQualifiedName); @@ -54,10 +54,10 @@ public class JavaModelUtil { // type= findType(root, fullyQualifiedName); // if (type != null && type.exists()) // return type; -// } +// } // return null; // } - + /** * Returns true if the given package fragment root is * referenced. This means it is own by a different project but is referenced @@ -73,7 +73,7 @@ public class JavaModelUtil { // } return false; } - + // private static IType findType(IPackageFragmentRoot root, String fullyQualifiedName) throws JavaModelException{ // IJavaElement[] children= root.getChildren(); // for (int i= 0; i < children.length; i++) { @@ -86,10 +86,10 @@ public class JavaModelUtil { // if (type != null && type.exists()) // return type; // } -// } +// } // return null; // } - + // private static IType findType(IPackageFragment pack, String fullyQualifiedName) throws JavaModelException{ // ICompilationUnit[] cus= pack.getCompilationUnits(); // for (int i= 0; i < cus.length; i++) { @@ -101,7 +101,7 @@ public class JavaModelUtil { // } // return null; // } - + // private static IType findType(ICompilationUnit cu, String fullyQualifiedName) throws JavaModelException{ // IType[] types= cu.getAllTypes(); // for (int i= 0; i < types.length; i++) { @@ -111,15 +111,15 @@ public class JavaModelUtil { // } // return null; // } - - /** + + /** * Finds a type by package and type name. * @param jproject the java project to search in * @param pack The package name * @param typeQualifiedName the type qualified name (type name with enclosing type names (separated by dots)) * @return the type found, or null if not existing * @deprecated Use IJavaProject.findType(String, String) instead - */ + */ // public static IType findType(IJavaProject jproject, String pack, String typeQualifiedName) throws JavaModelException { // return jproject.findType(pack, typeQualifiedName); // } @@ -142,18 +142,18 @@ public class JavaModelUtil { // if (!(result instanceof IPackageFragment)) { // result= null; // } -// +// // } // return result; -// } - - /** +// } + + /** * Finds a type in a compilation unit. Typical usage is to find the corresponding * type in a working copy. * @param cu the compilation unit to search in * @param typeQualifiedName the type qualified name (type name with enclosing type names (separated by dots)) * @return the type found, or null if not existing - */ + */ public static IType findTypeInCompilationUnit(ICompilationUnit cu, String typeQualifiedName) throws JavaModelException { IType[] types= cu.getAllTypes(); for (int i= 0; i < types.length; i++) { @@ -164,14 +164,14 @@ public class JavaModelUtil { } return null; } - - /** + + /** * Finds a a member in a compilation unit. Typical usage is to find the corresponding * member in a working copy. * @param cu the compilation unit (eg. working copy) to search in * @param member the member (eg. from the original) * @return the member found, or null if not existing - */ + */ public static IMember findMemberInCompilationUnit(ICompilationUnit cu, IMember member) throws JavaModelException { IJavaElement[] elements= cu.findElements(member); if (elements != null && elements.length > 0) { @@ -179,17 +179,17 @@ public class JavaModelUtil { } return null; } - - - /** + + + /** * Returns the element of the given compilation unit which is "equal" to the * given element. Note that the given element usually has a parent different * from the given compilation unit. - * + * * @param cu the cu to search in * @param element the element to look for * @return an element of the given cu "equal" to the given element - */ + */ public static IJavaElement findInCompilationUnit(ICompilationUnit cu, IJavaElement element) throws JavaModelException { IJavaElement[] elements= cu.findElements(element); if (elements != null && elements.length > 0) { @@ -197,7 +197,7 @@ public class JavaModelUtil { } return null; } - + /** * Returns the qualified type name of the given type using '.' as separators. * This is a replace for IType.getTypeQualifiedName() @@ -207,7 +207,7 @@ public class JavaModelUtil { public static String getTypeQualifiedName(IType type) { return type.getTypeQualifiedName('.'); } - + private static void getTypeQualifiedName(IType type, StringBuffer buf) { IType outerType= type.getDeclaringType(); if (outerType != null) { @@ -215,7 +215,7 @@ public class JavaModelUtil { buf.append('.'); } buf.append(type.getElementName()); - } + } /** * Returns the fully qualified name of the given type using '.' as separators. @@ -226,7 +226,7 @@ public class JavaModelUtil { public static String getFullyQualifiedName(IType type) { return type.getFullyQualifiedName('.'); } - + /** * Returns the fully qualified name of a type's container. (package name or enclosing type name) */ @@ -238,8 +238,8 @@ public class JavaModelUtil { return type.getPackageFragment().getElementName(); } } - - + + /** * Concatenates two names. Uses a dot for separation. * Both strings can be empty or null. @@ -254,10 +254,10 @@ public class JavaModelUtil { buf.append('.'); } buf.append(name2); - } + } return buf.toString(); } - + /** * Concatenates two names. Uses a dot for separation. * Both strings can be empty or null. @@ -272,10 +272,10 @@ public class JavaModelUtil { buf.append('.'); } buf.append(name2); - } + } return buf.toString(); - } - + } + /** * Evaluates if a member (possible from another package) is visible from * elements in a package. @@ -284,17 +284,17 @@ public class JavaModelUtil { */ public static boolean isVisible(IMember member, IPackageFragment pack) throws JavaModelException { int otherflags= member.getFlags(); - + if (Flags.isPublic(otherflags)) { return true; } else if (Flags.isPrivate(otherflags)) { return false; - } - + } + IPackageFragment otherpack= (IPackageFragment) findParentOfKind(member, IJavaElement.PACKAGE_FRAGMENT); return (pack != null && pack.equals(otherpack)); } - + /** * Returns the package fragment root of IJavaElement. If the given * element is already a package fragment root, the element itself is returned. @@ -304,7 +304,7 @@ public class JavaModelUtil { } /** - * Returns the parent of the supplied java element that conforms to the given + * Returns the parent of the supplied java element that conforms to the given * parent type or null, if such a parent doesn't exit. * @deprecated Use element.getParent().getAncestor(kind); */ @@ -314,7 +314,7 @@ public class JavaModelUtil { } return null; } - + /** * Finds a method in a type. * This searches for a method with the same name and signature. Parameter types are only @@ -348,7 +348,7 @@ public class JavaModelUtil { } return null; } - + /** * Finds a method declararion in a type's hierarchy. The search is top down, so this @@ -377,7 +377,7 @@ public class JavaModelUtil { // } // return null; // } - + /** * Finds a method implementation in a type's classhierarchy. The search is bottom-up, so this * returns the nearest overridden method. Does not find methods in interfaces or abstract methods. @@ -402,8 +402,8 @@ public class JavaModelUtil { // } // } // return null; -// } - +// } + /** * Tests if a method equals to the given signature. * Parameter types are only compared by the simple name, no resolving for @@ -432,7 +432,7 @@ public class JavaModelUtil { } return false; } - + /** * Checks whether the given type has a valid main method or not. */ @@ -445,22 +445,22 @@ public class JavaModelUtil { } return false; } - + /** * Checks if the field is boolean. */ public static boolean isBoolean(IField field) throws JavaModelException{ return field.getTypeSignature().equals(Signature.SIG_BOOLEAN); } - + /** * Returns true if the element is on the build path of the given project * @deprecated Use jproject.isOnClasspath(element); - */ + */ // public static boolean isOnBuildPath(IJavaProject jproject, IJavaElement element) throws JavaModelException { // return jproject.isOnClasspath(element); // } - + /** * Tests if the given element is on the class path of its containing project. Handles the case * that the containing project isn't a Java project. @@ -477,7 +477,7 @@ public class JavaModelUtil { * @param refTypeSig the type name in signature notation (for example 'QVector') * this can also be an array type, but dimensions will be ignored. * @param declaringType the context for resolving (type where the reference was made in) - * @return returns the fully qualified type name or build-in-type name. + * @return returns the fully qualified type name or build-in-type name. * if a unresoved type couldn't be resolved null is returned */ public static String getResolvedTypeName(String refTypeSig, IType declaringType) throws JavaModelException { @@ -488,8 +488,8 @@ public class JavaModelUtil { if (semi == -1) { throw new IllegalArgumentException(); } - String name= refTypeSig.substring(arrayCount + 1, semi); - + String name= refTypeSig.substring(arrayCount + 1, semi); + // String[][] resolvedNames= declaringType.resolveType(name); // if (resolvedNames != null && resolvedNames.length > 0) { // return JavaModelUtil.concatenateName(resolvedNames[0][0], resolvedNames[0][1]); @@ -499,7 +499,7 @@ public class JavaModelUtil { return Signature.toString(refTypeSig.substring(arrayCount)); } } - + /** * Returns if a CU can be edited. */ @@ -508,12 +508,12 @@ public class JavaModelUtil { cu= (ICompilationUnit) cu.getOriginalElement(); } IResource resource= cu.getResource(); - return (resource.exists() && !resource.isReadOnly()); + return (resource.exists() && !resource.getResourceAttributes().isReadOnly()); } /** * Finds a qualified import for a type name. - */ + */ // public static IImportDeclaration findImport(ICompilationUnit cu, String simpleName) throws JavaModelException { // IImportDeclaration[] existing= cu.getImports(); // for (int i= 0; i < existing.length; i++) { @@ -524,10 +524,10 @@ public class JavaModelUtil { // return existing[i]; // } // } -// } +// } // return null; // } - + /** * Returns the original if the given member. If the member is already * an original the input is returned. The returned member must not exist @@ -540,7 +540,7 @@ public class JavaModelUtil { return (IMember)cu.getOriginal(member); return member; } - + /* * XXX workaround for bug 18568 * http://bugs.eclipse.org/bugs/show_bug.cgi?id=18568 @@ -551,21 +551,21 @@ public class JavaModelUtil { ICompilationUnit cu= method.getCompilationUnit(); if (cu == null || ! cu.isWorkingCopy()) return method; - //use the workaround only if needed + //use the workaround only if needed if (! method.getElementName().equals(method.getDeclaringType().getElementName())) return (IMethod)cu.getOriginal(method); - + IType originalType = (IType)toOriginal(method.getDeclaringType()); IMethod[] methods = originalType.findMethods(method); boolean isConstructor = method.isConstructor(); for (int i=0; i < methods.length; i++) { - if (methods[i].isConstructor() == isConstructor) + if (methods[i].isConstructor() == isConstructor) return methods[i]; } return null; } catch(JavaModelException e){ return null; - } + } } /** @@ -576,8 +576,8 @@ public class JavaModelUtil { if (cu != null && cu.isWorkingCopy()) return (ICompilationUnit) cu.getOriginal(cu); return cu; - } - + } + /** * Returns the working copy of the given member. If the member is already in a * working copy or the member does not exist in the working copy the input is returned. @@ -600,7 +600,7 @@ public class JavaModelUtil { /** * Returns the working copy CU of the given CU. If the CU is already a * working copy or the CU has no working copy the input CU is returned. - */ + */ public static ICompilationUnit toWorkingCopy(ICompilationUnit cu) { if (!cu.isWorkingCopy()) { ICompilationUnit workingCopy= EditorUtility.getWorkingCopy(cu); @@ -610,10 +610,10 @@ public class JavaModelUtil { } return cu; } - + /* * http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253 - * + * * Reconciling happens in a separate thread. This can cause a situation where the * Java element gets disposed after an exists test has been done. So we should not * log not present exceptions when they happen in working copies. @@ -633,7 +633,7 @@ public class JavaModelUtil { if (!unit.isWorkingCopy()) return true; } - return false; + return false; } // public static IType[] getAllSuperTypes(IType type, IProgressMonitor pm) throws JavaModelException { @@ -641,7 +641,7 @@ public class JavaModelUtil { // try{ // pm.beginTask("", 3); //$NON-NLS-1$ // ITypeHierarchy hierarchy= type.newSupertypeHierarchy(new SubProgressMonitor(pm, 1)); -// +// // IProgressMonitor subPm= new SubProgressMonitor(pm, 2); // List typeList= Arrays.asList(hierarchy.getAllSupertypes(type)); // subPm.beginTask("", typeList.size()); //$NON-NLS-1$ @@ -656,10 +656,10 @@ public class JavaModelUtil { // return (IType[]) types.toArray(new IType[types.size()]); // } finally { // pm.done(); -// } +// } // } - - + + public static boolean isExcludedPath(IPath resourcePath, IPath[] exclusionPatterns) { char[] path = resourcePath.toString().toCharArray(); for (int i = 0, length = exclusionPatterns.length; i < length; i++) { @@ -668,14 +668,14 @@ public class JavaModelUtil { return true; } } - return false; + return false; } /* * Returns whether the given resource path matches one of the exclusion * patterns. - * + * * @see IClasspathEntry#getExclusionPatterns */ public final static boolean isExcluded(IPath resourcePath, char[][] exclusionPatterns) { @@ -685,12 +685,12 @@ public class JavaModelUtil { if (CharOperation.pathMatch(exclusionPatterns[i], path, true, '/')) return true; return false; - } - + } + private static final String ARGUMENTS_DELIMITER = "#"; //$NON-NLS-1$ private static final String EMPTY_ARGUMENT = " "; //$NON-NLS-1$ - + /** * Copied from net.sourceforge.phpdt.internal.core.ProjectPrefUtil; */ @@ -699,7 +699,7 @@ public class JavaModelUtil { int index = argumentsString.indexOf(':'); if(index == -1) return null; - + int length = argumentsString.length(); int numberOfArg; try{ @@ -708,10 +708,10 @@ public class JavaModelUtil { return null; } argumentsString = argumentsString.substring(index + 1, length); - + String[] args = new String[length]; int count = 0; - + StringTokenizer tokenizer = new StringTokenizer(argumentsString, ARGUMENTS_DELIMITER); while(tokenizer.hasMoreTokens()) { String argument = tokenizer.nextToken(); @@ -719,10 +719,10 @@ public class JavaModelUtil { argument = ""; //$NON-NLS-1$ args[count++] = argument; } - + if(count != numberOfArg) return null; - + System.arraycopy(args, 0, args = new String[count], 0, count); return args; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/Resources.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/Resources.java index d555c13..709a80a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/Resources.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/Resources.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -37,7 +37,7 @@ public class Resources { /** * Checks if the given resource is in sync with the underlying file system. - * + * * @param resource the resource to be checked * @return IStatus status describing the check's result. If status. * isOK() returns true then the resource is in sync @@ -45,11 +45,11 @@ public class Resources { public static IStatus checkInSync(IResource resource) { return checkInSync(new IResource[] {resource}); } - + /** * Checks if the given resources are in sync with the underlying file * system. - * + * * @param resources the resources to be checked * @return IStatus status describing the check's result. If status. * isOK() returns true then the resources are in sync @@ -60,58 +60,58 @@ public class Resources { IResource resource= resources[i]; if (!resource.isSynchronized(IResource.DEPTH_INFINITE)) { result= addOutOfSync(result, resource); - } + } } if (result != null) return result; - return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$ + return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$ } /** * Makes the given resource committable. Committable means that it is * writeable and that its content hasn't changed by calling * validateEdit for the given resource on IWorkspace. - * + * * @param resource the resource to be checked - * @param context the context passed to validateEdit + * @param context the context passed to validateEdit * @return status describing the method's result. If status.isOK() returns true then the resources are committable. - * + * * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object) */ public static IStatus makeCommittable(IResource resource, Object context) { return makeCommittable(new IResource[] { resource }, context); } - + /** * Makes the given resources committable. Committable means that all * resources are writeable and that the content of the resources hasn't * changed by calling validateEdit for a given file on * IWorkspace. - * + * * @param resources the resources to be checked - * @param context the context passed to validateEdit + * @param context the context passed to validateEdit * @return IStatus status describing the method's result. If status. * isOK() returns true then the add resources are * committable - * + * * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object) */ public static IStatus makeCommittable(IResource[] resources, Object context) { List readOnlyFiles= new ArrayList(); for (int i= 0; i < resources.length; i++) { IResource resource= resources[i]; - if (resource.getType() == IResource.FILE && resource.isReadOnly()) + if (resource.getType() == IResource.FILE && resource.getResourceAttributes().isReadOnly()) readOnlyFiles.add(resource); } if (readOnlyFiles.size() == 0) return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$ - + Map oldTimeStamps= createModificationStampMap(readOnlyFiles); IStatus status= ResourcesPlugin.getWorkspace().validateEdit( (IFile[]) readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]), context); if (!status.isOK()) return status; - + IStatus modified= null; Map newTimeStamps= createModificationStampMap(readOnlyFiles); for (Iterator iter= oldTimeStamps.keySet().iterator(); iter.hasNext();) { @@ -119,7 +119,7 @@ public class Resources { if (!oldTimeStamps.get(file).equals(newTimeStamps.get(file))) modified= addModified(modified, file); } - if (modified != null) + if (modified != null) return modified; return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$ } @@ -132,11 +132,11 @@ public class Resources { } return map; } - + private static IStatus addModified(IStatus status, IFile file) { IStatus entry= PHPUIStatus.createError( - IJavaStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT, - CorextMessages.getFormattedString("Resources.fileModified", file.getFullPath().toString()), //$NON-NLS-1$ + IJavaStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT, + CorextMessages.getFormattedString("Resources.fileModified", file.getFullPath().toString()), //$NON-NLS-1$ null); if (status == null) { return entry; @@ -146,19 +146,19 @@ public class Resources { } else { MultiStatus result= new MultiStatus(PHPeclipsePlugin.getPluginId(), IJavaStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT, - CorextMessages.getString("Resources.modifiedResources"), null); //$NON-NLS-1$ + CorextMessages.getString("Resources.modifiedResources"), null); //$NON-NLS-1$ result.add(status); result.add(entry); return result; } - } + } private static IStatus addOutOfSync(IStatus status, IResource resource) { IStatus entry= new Status( IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IResourceStatus.OUT_OF_SYNC_LOCAL, - CorextMessages.getFormattedString("Resources.outOfSync", resource.getFullPath().toString()), //$NON-NLS-1$ + CorextMessages.getFormattedString("Resources.outOfSync", resource.getFullPath().toString()), //$NON-NLS-1$ null); if (status == null) { return entry; @@ -169,7 +169,7 @@ public class Resources { MultiStatus result= new MultiStatus( ResourcesPlugin.PI_RESOURCES, IResourceStatus.OUT_OF_SYNC_LOCAL, - CorextMessages.getString("Resources.outOfSyncResources"), null); //$NON-NLS-1$ + CorextMessages.getString("Resources.outOfSyncResources"), null); //$NON-NLS-1$ result.add(status); result.add(entry); return result; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AbstractToggleLinkingAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AbstractToggleLinkingAction.java index 5c9c025..faf7d0d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AbstractToggleLinkingAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AbstractToggleLinkingAction.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -14,17 +14,17 @@ import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds; import net.sourceforge.phpdt.internal.ui.PHPUiImages; import org.eclipse.jface.action.Action; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** * This is an action template for actions that toggle whether * it links its selection to the active editor. - * + * * @since 3.0 */ public abstract class AbstractToggleLinkingAction extends Action { - + /** * Constructs a new action. */ @@ -32,8 +32,8 @@ public abstract class AbstractToggleLinkingAction extends Action { super(ActionMessages.getString("ToggleLinkingAction.label")); //$NON-NLS-1$ setDescription(ActionMessages.getString("ToggleLinkingAction.description")); //$NON-NLS-1$ setToolTipText(ActionMessages.getString("ToggleLinkingAction.tooltip")); //$NON-NLS-1$ - PHPUiImages.setLocalImageDescriptors(this, "synced.gif"); //$NON-NLS-1$ - WorkbenchHelp.setHelp(this, IJavaHelpContextIds.LINK_EDITOR_ACTION); + PHPUiImages.setLocalImageDescriptors(this, "synced.gif"); //$NON-NLS-1$ + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.LINK_EDITOR_ACTION); } /** diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dialogs/CheckedTreeSelectionDialog.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dialogs/CheckedTreeSelectionDialog.java index ba34f1b..08dc378 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dialogs/CheckedTreeSelectionDialog.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dialogs/CheckedTreeSelectionDialog.java @@ -76,7 +76,7 @@ public class CheckedTreeSelectionDialog extends SelectionStatusDialog { } /** - * If set, the checked /gray state of containers (inner nodes) is derived from the checked state of its + * If set, the checked /gray state of containers (inner nodes) is derived from the checked state of its * leaf nodes. * @param containerMode The containerMode to set */ @@ -206,7 +206,7 @@ public class CheckedTreeSelectionDialog extends SelectionStatusDialog { public void create() { super.create(); - List initialSelections = getInitialSelections(); + List initialSelections = getInitialElementSelections(); if (initialSelections != null) { fViewer.setCheckedElements(initialSelections.toArray()); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dialogs/ElementListSelectionDialog.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dialogs/ElementListSelectionDialog.java index 2863cfb..cee2d5c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dialogs/ElementListSelectionDialog.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dialogs/ElementListSelectionDialog.java @@ -12,14 +12,14 @@ import org.eclipse.swt.widgets.Shell; * A class to select elements out of a list of elements. */ public class ElementListSelectionDialog extends AbstractElementListSelectionDialog { - + private Object[] fElements; - + /** * Creates a list selection dialog. * @param parent the parent widget. * @param renderer the label renderer. - */ + */ public ElementListSelectionDialog(Shell parent, ILabelProvider renderer) { super(parent, renderer); } @@ -38,23 +38,23 @@ public class ElementListSelectionDialog extends AbstractElementListSelectionDial protected void computeResult() { setResult(Arrays.asList(getSelectedElements())); } - + /* * @see Dialog#createDialogArea(Composite) */ protected Control createDialogArea(Composite parent) { Composite contents= (Composite) super.createDialogArea(parent); - + createMessageArea(contents); createFilterText(contents); createFilteredList(contents); setListElements(fElements); - List initialSelections= getInitialSelections(); + List initialSelections= getInitialElementSelections(); if (initialSelections != null) setSelection(initialSelections.toArray()); - + return contents; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/CustomFiltersDialog.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/CustomFiltersDialog.java index bef807a..3c20939 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/CustomFiltersDialog.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/filters/CustomFiltersDialog.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -47,8 +47,8 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.SelectionDialog; -import org.eclipse.ui.help.WorkbenchHelp; public class CustomFiltersDialog extends SelectionDialog { @@ -67,10 +67,10 @@ public class CustomFiltersDialog extends SelectionDialog { private Stack fFilterDescriptorChangeHistory; - + /** * Creates a dialog to customize Java element filters. - * + * * @param shell the parent shell * @param viewId the id of the view * @param enablePatterns true if pattern filters are enabled @@ -103,14 +103,14 @@ public class CustomFiltersDialog extends SelectionDialog { setTitle(FilterMessages.getString("CustomFiltersDialog.title")); //$NON-NLS-1$ setMessage(FilterMessages.getString("CustomFiltersDialog.filterList.label")); //$NON-NLS-1$ super.configureShell(shell); - WorkbenchHelp.setHelp(shell, IJavaHelpContextIds.CUSTOM_FILTERS_DIALOG); + PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IJavaHelpContextIds.CUSTOM_FILTERS_DIALOG); } /** * Overrides method in Dialog - * + * * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite) - */ + */ protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent); // create a composite with standard margins and spacing @@ -124,12 +124,12 @@ public class CustomFiltersDialog extends SelectionDialog { composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); Composite group= composite; - + // Checkbox fEnableUserDefinedPatterns= new Button(group, SWT.CHECK); fEnableUserDefinedPatterns.setFocus(); fEnableUserDefinedPatterns.setText(FilterMessages.getString("CustomFiltersDialog.enableUserDefinedPattern")); //$NON-NLS-1$ - + // Pattern field fUserDefinedPatterns= new Text(group, SWT.SINGLE | SWT.BORDER); GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); @@ -159,18 +159,18 @@ public class CustomFiltersDialog extends SelectionDialog { // Filters provided by extension point if (fBuiltInFilters.length > 0) createCheckBoxList(group); - - applyDialogFont(parent); + + applyDialogFont(parent); return parent; } private void createCheckBoxList(Composite parent) { // Filler new Label(parent, SWT.NONE); - + Label info= new Label(parent, SWT.LEFT); info.setText(FilterMessages.getString("CustomFiltersDialog.filterList.label")); //$NON-NLS-1$ - + fCheckBoxList= CheckboxTableViewer.newCheckList(parent, SWT.BORDER); GridData data= new GridData(GridData.FILL_BOTH); data.heightHint= fCheckBoxList.getTable().getItemHeight() * 10; @@ -181,7 +181,7 @@ public class CustomFiltersDialog extends SelectionDialog { fCheckBoxList.setInput(fBuiltInFilters); setInitialSelections(getEnabledFilterDescriptors()); - + List initialSelection= getInitialElementSelections(); if (initialSelection != null && !initialSelection.isEmpty()) checkInitialSelections(); @@ -275,9 +275,9 @@ public class CustomFiltersDialog extends SelectionDialog { } super.okPressed(); } - + private ILabelProvider createLabelPrivder() { - return + return new LabelProvider() { public Image getImage(Object element) { return null; @@ -292,7 +292,7 @@ public class CustomFiltersDialog extends SelectionDialog { } // ---------- result handling ---------- - + protected void setResult(List newResult) { super.setResult(newResult); if (fUserDefinedPatterns.getText().length() > 0) { @@ -301,7 +301,7 @@ public class CustomFiltersDialog extends SelectionDialog { } else { fEnablePatterns= false; fPatterns= new String[0]; - } + } } @@ -329,7 +329,7 @@ public class CustomFiltersDialog extends SelectionDialog { public boolean areUserDefinedPatternsEnabled() { return fEnablePatterns; } - + /** * @return a stack with the filter descriptor check history * @since 3.0 @@ -377,7 +377,7 @@ public class CustomFiltersDialog extends SelectionDialog { } return (String[])result.toArray(new String[result.size()]); } - + private static void addPattern(List list, String pattern) { if (list.isEmpty()) list.add(pattern); @@ -402,7 +402,7 @@ public class CustomFiltersDialog extends SelectionDialog { } return strBuf.toString(); } - + private static String escapeSeparator(String pattern, String separator) { int length= pattern.length(); StringBuffer buf= new StringBuffer(length); @@ -413,6 +413,6 @@ public class CustomFiltersDialog extends SelectionDialog { buf.append(ch); } return buf.toString(); - + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/AbstractConfigurationBlockPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/AbstractConfigurationBlockPreferencePage.java index e2bf8be..a290827 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/AbstractConfigurationBlockPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/AbstractConfigurationBlockPreferencePage.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -19,22 +19,22 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** * Abstract preference page which is used to wrap a * {@link net.sourceforge.phpdt.internal.ui.preferences.IPreferenceConfigurationBlock}. - * + * * @since 3.0 */ public abstract class AbstractConfigurationBlockPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - - + + private IPreferenceConfigurationBlock fConfigurationBlock; private OverlayPreferenceStore fOverlayStore; - + /** * Creates a new preference page. @@ -45,15 +45,15 @@ public abstract class AbstractConfigurationBlockPreferencePage extends Preferenc fOverlayStore= new OverlayPreferenceStore(getPreferenceStore(), new OverlayPreferenceStore.OverlayKey[] {}); fConfigurationBlock= createConfigurationBlock(fOverlayStore); } - + protected abstract IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore); protected abstract String getHelpId(); protected abstract void setDescription(); protected abstract void setPreferenceStore(); - + /* * @see IWorkbenchPreferencePage#init() - */ + */ public void init(IWorkbench workbench) { } @@ -62,66 +62,66 @@ public abstract class AbstractConfigurationBlockPreferencePage extends Preferenc */ public void createControl(Composite parent) { super.createControl(parent); - WorkbenchHelp.setHelp(getControl(), getHelpId()); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), getHelpId()); } - + /* * @see PreferencePage#createContents(Composite) */ protected Control createContents(Composite parent) { - + fOverlayStore.load(); fOverlayStore.start(); - + fConfigurationBlock.createControl(parent); - + initialize(); - + Dialog.applyDialogFont(parent); return parent; } - + private void initialize() { fConfigurationBlock.initialize(); } - + /* * @see PreferencePage#performOk() */ public boolean performOk() { - + fConfigurationBlock.performOk(); fOverlayStore.propagate(); - + PHPeclipsePlugin.getDefault().savePluginPreferences(); - + return true; } - + /* * @see PreferencePage#performDefaults() */ public void performDefaults() { - + fOverlayStore.loadDefaults(); fConfigurationBlock.performDefaults(); super.performDefaults(); } - + /* * @see DialogPage#dispose() */ public void dispose() { - + fConfigurationBlock.dispose(); - + if (fOverlayStore != null) { fOverlayStore.stop(); fOverlayStore= null; } - + super.dispose(); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeTemplatePreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeTemplatePreferencePage.java index 292083a..2c122ff 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeTemplatePreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeTemplatePreferencePage.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -22,7 +22,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /* * The page to configure the code formatter options. @@ -34,16 +34,16 @@ public class CodeTemplatePreferencePage extends PreferencePage implements IWorkb public CodeTemplatePreferencePage() { setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore()); //setDescription(PreferencesMessages.getString("CodeTemplatesPreferencePage.description")); //$NON-NLS-1$ - + // only used when page is shown programatically setTitle(PreferencesMessages.getString("CodeTemplatesPreferencePage.title")); //$NON-NLS-1$ - + fCodeTemplateConfigurationBlock= new CodeTemplateBlock(); } /* * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ + */ public void init(IWorkbench workbench) { } @@ -52,8 +52,8 @@ public class CodeTemplatePreferencePage extends PreferencePage implements IWorkb */ public void createControl(Composite parent) { super.createControl(parent); - WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.CODE_MANIPULATION_PREFERENCE_PAGE); - } + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.CODE_MANIPULATION_PREFERENCE_PAGE); + } /* * @see PreferencePage#createContents(Composite) @@ -70,10 +70,10 @@ public class CodeTemplatePreferencePage extends PreferencePage implements IWorkb public boolean performOk() { if (!fCodeTemplateConfigurationBlock.performOk(true)) { return false; - } + } return super.performOk(); } - + /* * @see PreferencePage#performDefaults() */ @@ -81,13 +81,13 @@ public class CodeTemplatePreferencePage extends PreferencePage implements IWorkb fCodeTemplateConfigurationBlock.performDefaults(); super.performDefaults(); } - + /* (non-Javadoc) * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus) */ public void statusChanged(IStatus status) { setValid(!status.matches(IStatus.ERROR)); - StatusUtil.applyToStatusLine(this, status); + StatusUtil.applyToStatusLine(this, status); } /* (non-Javadoc) @@ -95,7 +95,7 @@ public class CodeTemplatePreferencePage extends PreferencePage implements IWorkb */ public boolean performCancel() { fCodeTemplateConfigurationBlock.performCancel(); - + return super.performCancel(); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPreferencePage.java index 16b4c43..0356e01 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPreferencePage.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -22,7 +22,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /* * The page to configure the compiler options. @@ -34,16 +34,16 @@ public class CompilerPreferencePage extends PreferencePage implements IWorkbench public CompilerPreferencePage() { setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore()); setDescription(PreferencesMessages.getString("CompilerPreferencePage.description")); //$NON-NLS-1$ - + // only used when page is shown programatically setTitle(PreferencesMessages.getString("CompilerPreferencePage.title")); //$NON-NLS-1$ - + fConfigurationBlock= new CompilerConfigurationBlock(this, null); } - + /* * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ + */ public void init(IWorkbench workbench) { } @@ -52,8 +52,9 @@ public class CompilerPreferencePage extends PreferencePage implements IWorkbench */ public void createControl(Composite parent) { super.createControl(parent); - WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.COMPILER_PREFERENCE_PAGE); - } + PlatformUI.getWorkbench().getHelpSystem(). + setHelp(getControl(), IJavaHelpContextIds.COMPILER_PREFERENCE_PAGE); + } /* * @see PreferencePage#createContents(Composite) @@ -70,10 +71,10 @@ public class CompilerPreferencePage extends PreferencePage implements IWorkbench public boolean performOk() { if (!fConfigurationBlock.performOk(true)) { return false; - } + } return super.performOk(); } - + /* * @see PreferencePage#performDefaults() */ @@ -81,13 +82,13 @@ public class CompilerPreferencePage extends PreferencePage implements IWorkbench fConfigurationBlock.performDefaults(); super.performDefaults(); } - + /* (non-Javadoc) * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus) */ public void statusChanged(IStatus status) { setValid(!status.matches(IStatus.ERROR)); - StatusUtil.applyToStatusLine(this, status); + StatusUtil.applyToStatusLine(this, status); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPropertyPage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPropertyPage.java index 032f325..c0cb607 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPropertyPage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerPropertyPage.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -36,8 +36,8 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PropertyPage; -import org.eclipse.ui.help.WorkbenchHelp; /** * Property page used to configure project specific compiler settings @@ -51,18 +51,18 @@ public class CompilerPropertyPage extends PropertyPage { private SelectionButtonDialogField fChangeWorkspaceSettings; private SelectionButtonDialogField fUseProjectSettings; private IStatus fBlockStatus; - + public CompilerPropertyPage() { fBlockStatus= new StatusInfo(); fBlockEnableState= null; - + IDialogFieldListener listener= new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { doDialogFieldChanged(field); } }; - + fUseWorkspaceSettings= new SelectionButtonDialogField(SWT.RADIO); fUseWorkspaceSettings.setDialogFieldListener(listener); fUseWorkspaceSettings.setLabelText(PreferencesMessages.getString("CompilerPropertyPage.useworkspacesettings.label")); //$NON-NLS-1$ @@ -70,7 +70,7 @@ public class CompilerPropertyPage extends PropertyPage { fChangeWorkspaceSettings= new SelectionButtonDialogField(SWT.PUSH); fChangeWorkspaceSettings.setLabelText(PreferencesMessages.getString("CompilerPropertyPage.useworkspacesettings.change")); //$NON-NLS-1$ fChangeWorkspaceSettings.setDialogFieldListener(listener); - + fUseWorkspaceSettings.attachDialogField(fChangeWorkspaceSettings); fUseProjectSettings= new SelectionButtonDialogField(SWT.RADIO); @@ -83,7 +83,7 @@ public class CompilerPropertyPage extends PropertyPage { */ public void createControl(Composite parent) { super.createControl(parent); - WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.COMPILER_PROPERTY_PAGE); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.COMPILER_PROPERTY_PAGE); } /* @@ -95,43 +95,43 @@ public class CompilerPropertyPage extends PropertyPage { fBlockStatus= status; doStatusChanged(); } - }; + }; fConfigurationBlock= new CompilerConfigurationBlock(listener, getProject()); - + Composite composite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 2; composite.setLayout(layout); - + fUseWorkspaceSettings.doFillIntoGrid(composite, 1); LayoutUtil.setHorizontalGrabbing(fUseWorkspaceSettings.getSelectionButton(null)); - + fChangeWorkspaceSettings.doFillIntoGrid(composite, 1); - + fUseProjectSettings.doFillIntoGrid(composite, 2); - + GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL ); data.horizontalSpan= 2; - + fConfigurationBlockControl= fConfigurationBlock.createContents(composite); fConfigurationBlockControl.setLayoutData(data); - + boolean useProjectSettings= fConfigurationBlock.hasProjectSpecificOptions(); - + fUseProjectSettings.setSelection(useProjectSettings); fUseWorkspaceSettings.setSelection(!useProjectSettings); - + updateEnableState(); Dialog.applyDialogFont(composite); return composite; } - + private boolean useProjectSettings() { return fUseProjectSettings.isSelected(); } - + private void doDialogFieldChanged(DialogField field) { if (field == fChangeWorkspaceSettings) { String id= "net.sourceforge.phpdt.ui.preferences.CompilerPreferencePage"; //$NON-NLS-1$ @@ -141,21 +141,21 @@ public class CompilerPropertyPage extends PropertyPage { updateEnableState(); doStatusChanged(); } - } + } /** * Method statusChanged. */ private void doStatusChanged() { updateStatus(useProjectSettings() ? fBlockStatus : new StatusInfo()); } - + /** * Method getProject. */ private IJavaProject getProject() { - return (IJavaProject) getElement().getAdapter(IJavaElement.class); + return (IJavaProject) getElement().getAdapter(IJavaElement.class); } - + private void updateEnableState() { if (useProjectSettings()) { if (fBlockEnableState != null) { @@ -166,9 +166,9 @@ public class CompilerPropertyPage extends PropertyPage { if (fBlockEnableState == null) { fBlockEnableState= ControlEnableState.disable(fConfigurationBlockControl); } - } + } } - + /* * @see org.eclipse.jface.preference.IPreferencePage#performDefaults() */ @@ -187,15 +187,15 @@ public class CompilerPropertyPage extends PropertyPage { public boolean performOk() { return fConfigurationBlock.performOk(useProjectSettings()); } - + private void updateStatus(IStatus status) { setValid(!status.matches(IStatus.ERROR)); StatusUtil.applyToStatusLine(this, status); } - + private boolean showPreferencePage(String id, IPreferencePage page) { final IPreferenceNode targetNode = new PreferenceNode(id, page); - + PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); final PreferenceDialog dialog = new PreferenceDialog(getControl().getShell(), manager); @@ -208,6 +208,6 @@ public class CompilerPropertyPage extends PropertyPage { } }); return result[0]; - } + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/EditTemplateDialog.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/EditTemplateDialog.java index cbd80ba..5bd6980 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/EditTemplateDialog.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/EditTemplateDialog.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -73,7 +73,7 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.ui.texteditor.IUpdate; @@ -83,13 +83,13 @@ import org.eclipse.ui.texteditor.IUpdate; public class EditTemplateDialog extends StatusDialog { private static class TextViewerAction extends Action implements IUpdate { - + private int fOperationCode= -1; private ITextOperationTarget fOperationTarget; - - /** + + /** * Creates a new action. - * + * * @param viewer the viewer * @param operationCode the opcode */ @@ -98,24 +98,24 @@ public class EditTemplateDialog extends StatusDialog { fOperationTarget= viewer.getTextOperationTarget(); update(); } - + /** * Updates the enabled state of the action. * Fires a property change if the enabled state changes. - * + * * @see Action#firePropertyChange(String, Object, Object) */ public void update() { - + boolean wasEnabled= isEnabled(); boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode)); setEnabled(isEnabled); - + if (wasEnabled != isEnabled) { firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE); } } - + /** * @see Action#run() */ @@ -124,30 +124,30 @@ public class EditTemplateDialog extends StatusDialog { fOperationTarget.doOperation(fOperationCode); } } - } + } private final Template fTemplate; - + private Text fNameText; private Text fDescriptionText; private Combo fContextCombo; - private SourceViewer fPatternEditor; + private SourceViewer fPatternEditor; private Button fInsertVariableButton; private boolean fIsNameModifiable; private StatusInfo fValidationStatus; - private boolean fSuppressError= true; // #4354 + private boolean fSuppressError= true; // #4354 private Map fGlobalActions= new HashMap(10); - private List fSelectionActions = new ArrayList(3); + private List fSelectionActions = new ArrayList(3); private String[][] fContextTypes; - - private ContextTypeRegistry fContextTypeRegistry; - + + private ContextTypeRegistry fContextTypeRegistry; + private final TemplateVariableProcessor fTemplateProcessor= new TemplateVariableProcessor(); - + /** * Creates a new dialog. - * + * * @param parent the shell parent of the dialog * @param template the template to edit * @param edit whether this is a new template or an existing being edited @@ -156,9 +156,9 @@ public class EditTemplateDialog extends StatusDialog { */ public EditTemplateDialog(Shell parent, Template template, boolean edit, boolean isNameModifiable, ContextTypeRegistry registry) { super(parent); - + setShellStyle(getShellStyle() | SWT.MAX | SWT.RESIZE); - + String title= edit ? PreferencesMessages.getString("EditTemplateDialog.title.edit") //$NON-NLS-1$ : PreferencesMessages.getString("EditTemplateDialog.title.new"); //$NON-NLS-1$ @@ -166,10 +166,10 @@ public class EditTemplateDialog extends StatusDialog { fTemplate= template; fIsNameModifiable= isNameModifiable; - + // XXX workaround for bug 63313 - disabling prefix until fixed. // String delim= new Document().getLegalLineDelimiters()[0]; - + List contexts= new ArrayList(); for (Iterator it= registry.contextTypes(); it.hasNext();) { TemplateContextType type= (TemplateContextType) it.next(); @@ -179,21 +179,21 @@ public class EditTemplateDialog extends StatusDialog { contexts.add(new String[] { type.getId(), type.getName(), "" }); //$NON-NLS-1$ } fContextTypes= (String[][]) contexts.toArray(new String[contexts.size()][]); - + fValidationStatus= new StatusInfo(); - + fContextTypeRegistry= registry; - + TemplateContextType type= fContextTypeRegistry.getContextType(template.getContextTypeId()); fTemplateProcessor.setContextType(type); } - + /* * @see net.sourceforge.phpdt.internal.ui.dialogs.StatusDialog#create() */ public void create() { super.create(); - // update initial ok button to be disabled for new templates + // update initial ok button to be disabled for new templates boolean valid= fNameText == null || fNameText.getText().trim().length() != 0; if (!valid) { StatusInfo status = new StatusInfo(); @@ -201,7 +201,7 @@ public class EditTemplateDialog extends StatusDialog { updateButtonsEnableState(status); } } - + /* * @see Dialog#createDialogArea(Composite) */ @@ -211,30 +211,30 @@ public class EditTemplateDialog extends StatusDialog { layout.numColumns= 2; parent.setLayout(layout); parent.setLayoutData(new GridData(GridData.FILL_BOTH)); - + ModifyListener listener= new ModifyListener() { public void modifyText(ModifyEvent e) { doTextWidgetChanged(e.widget); } }; - + if (fIsNameModifiable) { - createLabel(parent, PreferencesMessages.getString("EditTemplateDialog.name")); //$NON-NLS-1$ - + createLabel(parent, PreferencesMessages.getString("EditTemplateDialog.name")); //$NON-NLS-1$ + Composite composite= new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - layout= new GridLayout(); + layout= new GridLayout(); layout.numColumns= 3; layout.marginWidth= 0; layout.marginHeight= 0; composite.setLayout(layout); - + fNameText= createText(composite); fNameText.addFocusListener(new FocusListener() { - + public void focusGained(FocusEvent e) { } - + public void focusLost(FocusEvent e) { if (fSuppressError) { fSuppressError= false; @@ -242,46 +242,46 @@ public class EditTemplateDialog extends StatusDialog { } } }); - - createLabel(composite, PreferencesMessages.getString("EditTemplateDialog.context")); //$NON-NLS-1$ + + createLabel(composite, PreferencesMessages.getString("EditTemplateDialog.context")); //$NON-NLS-1$ fContextCombo= new Combo(composite, SWT.READ_ONLY); - + for (int i= 0; i < fContextTypes.length; i++) { fContextCombo.add(fContextTypes[i][1]); } - + fContextCombo.addModifyListener(listener); } - - createLabel(parent, PreferencesMessages.getString("EditTemplateDialog.description")); //$NON-NLS-1$ - + + createLabel(parent, PreferencesMessages.getString("EditTemplateDialog.description")); //$NON-NLS-1$ + int descFlags= fIsNameModifiable ? SWT.BORDER : SWT.BORDER | SWT.READ_ONLY; fDescriptionText= new Text(parent, descFlags ); - fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + fDescriptionText.addModifyListener(listener); Label patternLabel= createLabel(parent, PreferencesMessages.getString("EditTemplateDialog.pattern")); //$NON-NLS-1$ patternLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); fPatternEditor= createEditor(parent); - - Label filler= new Label(parent, SWT.NONE); + + Label filler= new Label(parent, SWT.NONE); filler.setLayoutData(new GridData()); - + Composite composite= new Composite(parent, SWT.NONE); - layout= new GridLayout(); + layout= new GridLayout(); layout.marginWidth= 0; layout.marginHeight= 0; - composite.setLayout(layout); + composite.setLayout(layout); composite.setLayoutData(new GridData()); - + fInsertVariableButton= new Button(composite, SWT.NONE); fInsertVariableButton.setLayoutData(getButtonGridData(fInsertVariableButton)); fInsertVariableButton.setText(PreferencesMessages.getString("EditTemplateDialog.insert.variable")); //$NON-NLS-1$ fInsertVariableButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { fPatternEditor.getTextWidget().setFocus(); - fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); + fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } public void widgetDefaultSelected(SelectionEvent e) {} @@ -300,13 +300,13 @@ public class EditTemplateDialog extends StatusDialog { applyDialogFont(parent); return composite; } - + protected void doTextWidgetChanged(Widget w) { if (w == fNameText) { fSuppressError= false; String name= fNameText.getText(); fTemplate.setName(name); - updateButtons(); + updateButtons(); } else if (w == fContextCombo) { String name= fContextCombo.getText(); String contextId= getContextId(name); @@ -315,16 +315,16 @@ public class EditTemplateDialog extends StatusDialog { } else if (w == fDescriptionText) { String desc= fDescriptionText.getText(); fTemplate.setDescription(desc); - } + } } - + private String getContextId(String name) { if (name == null) return name; - + for (int i= 0; i < fContextTypes.length; i++) { if (name.equals(fContextTypes[i][1])) { - return fContextTypes[i][0]; + return fContextTypes[i][0]; } } return name; @@ -346,12 +346,12 @@ public class EditTemplateDialog extends StatusDialog { updateUndoAction(); updateButtons(); - } + } private static GridData getButtonGridData(Button button) { GridData data= new GridData(GridData.FILL_HORIZONTAL); data.heightHint= SWTUtil.getButtonHeightHint(button); - + return data; } @@ -365,8 +365,8 @@ public class EditTemplateDialog extends StatusDialog { private static Text createText(Composite parent) { Text text= new Text(parent, SWT.BORDER); - text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + return text; } @@ -383,24 +383,24 @@ public class EditTemplateDialog extends StatusDialog { // XXX workaround for bug 63313 - disabling prefix until fixed. // viewer.setDocument(document, prefix.length(), document.getLength() - prefix.length()); viewer.setDocument(document); - + Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); new JavaSourcePreviewerUpdater(viewer, configuration, store); - + int nLines= document.getNumberOfLines(); if (nLines < 5) { nLines= 5; } else if (nLines > 12) { - nLines= 12; + nLines= 12; } - + Control control= viewer.getControl(); GridData data= new GridData(GridData.FILL_BOTH); data.widthHint= convertWidthInCharsToPixels(80); data.heightHint= convertHeightInCharsToPixels(nLines); control.setLayoutData(data); - + viewer.addTextListener(new ITextListener() { public void textChanged(TextEvent event) { if (event .getDocumentEvent() != null) @@ -408,7 +408,7 @@ public class EditTemplateDialog extends StatusDialog { } }); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { + viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateSelectionDependentActions(); } @@ -419,10 +419,10 @@ public class EditTemplateDialog extends StatusDialog { handleVerifyKeyPressed(event); } }); - + return viewer; } - + private String getPrefix() { String prefix; int idx= getIndex(fTemplate.getContextTypeId()); @@ -440,7 +440,7 @@ public class EditTemplateDialog extends StatusDialog { if (event.stateMask != SWT.MOD1) return; - + switch (event.character) { case ' ': fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); @@ -451,7 +451,7 @@ public class EditTemplateDialog extends StatusDialog { case 'z' - 'a' + 1: fPatternEditor.doOperation(ITextOperationTarget.UNDO); event.doit= false; - break; + break; } } @@ -483,7 +483,7 @@ public class EditTemplateDialog extends StatusDialog { fSelectionActions.add(ITextEditorActionConstants.CUT); fSelectionActions.add(ITextEditorActionConstants.COPY); fSelectionActions.add(ITextEditorActionConstants.PASTE); - + // create context menu MenuManager manager= new MenuManager(null, null); manager.setRemoveAllWhenShown(true); @@ -493,7 +493,7 @@ public class EditTemplateDialog extends StatusDialog { } }); - StyledText text= fPatternEditor.getTextWidget(); + StyledText text= fPatternEditor.getTextWidget(); Menu menu= manager.createContextMenu(text); text.setMenu(menu); } @@ -501,8 +501,8 @@ public class EditTemplateDialog extends StatusDialog { private void fillContextMenu(IMenuManager menu) { menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO)); menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO, (IAction) fGlobalActions.get(ITextEditorActionConstants.UNDO)); - - menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT)); + + menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT)); menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, (IAction) fGlobalActions.get(ITextEditorActionConstants.CUT)); menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, (IAction) fGlobalActions.get(ITextEditorActionConstants.COPY)); menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, (IAction) fGlobalActions.get(ITextEditorActionConstants.PASTE)); @@ -515,7 +515,7 @@ public class EditTemplateDialog extends StatusDialog { protected void updateSelectionDependentActions() { Iterator iterator= fSelectionActions.iterator(); while (iterator.hasNext()) - updateAction((String)iterator.next()); + updateAction((String)iterator.next()); } protected void updateUndoAction() { @@ -531,23 +531,23 @@ public class EditTemplateDialog extends StatusDialog { } private int getIndex(String contextid) { - + if (contextid == null) return -1; - + for (int i= 0; i < fContextTypes.length; i++) { if (contextid.equals(fContextTypes[i][0])) { - return i; + return i; } } return -1; } - + protected void okPressed() { super.okPressed(); } - - private void updateButtons() { + + private void updateButtons() { StatusInfo status; boolean valid= fNameText == null || fNameText.getText().trim().length() != 0; @@ -557,7 +557,7 @@ public class EditTemplateDialog extends StatusDialog { status.setError(PreferencesMessages.getString("EditTemplateDialog.error.noname")); //$NON-NLS-1$ } } else { - status= fValidationStatus; + status= fValidationStatus; } updateStatus(status); } @@ -567,7 +567,7 @@ public class EditTemplateDialog extends StatusDialog { */ protected void configureShell(Shell newShell) { super.configureShell(newShell); - WorkbenchHelp.setHelp(newShell, IJavaHelpContextIds.EDIT_TEMPLATE_DIALOG); + PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IJavaHelpContextIds.EDIT_TEMPLATE_DIALOG); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java index c0de54e..be4add7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -75,8 +75,8 @@ import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.editors.text.EditorsUI; -import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.AnnotationPreference; import org.eclipse.ui.texteditor.ChainedPreferenceStore; @@ -504,7 +504,7 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben PreferenceConstants.EDITOR_FORMAT_JAVADOCS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_P_RTRIM_ON_SAVE)); - + overlayKeys .add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_HOME_END)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, @@ -552,7 +552,7 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben */ public void createControl(Composite parent) { super.createControl(parent); - WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE); } private void handleSyntaxColorListSelection() { @@ -1155,7 +1155,7 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben label = PreferencesMessages.getString("JavaEditorPreferencePage.formatJavaDocs"); //$NON-NLS-1$ button = addCheckBox(group, label, PreferenceConstants.EDITOR_FORMAT_JAVADOCS, 1); - + label = PreferencesMessages.getString("JavaEditorPreferencePage.p_rtrim_on_save"); addCheckBox(group, label, PreferenceConstants.EDITOR_P_RTRIM_ON_SAVE, 1); // @@ -1210,14 +1210,14 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben // 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")); @@ -1338,7 +1338,7 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben /** * Computes the state mask for the given modifier string. - * + * * @param modifiers * the string with the modifiers, separated by '+', '-', ';', ',' or '.' * @return the state mask or -1 if the input is invalid @@ -1488,7 +1488,7 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben // fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION); // fCompletionInsertsRadioButton.setSelection(completionInserts); // fCompletionOverwritesRadioButton.setSelection(! completionInserts); - // + // fBrowserLikeLinksKeyModifierText.setEnabled(fBrowserLikeLinksCheckBox.getSelection()); // boolean markOccurrences= // fOverlayStore.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingPreferencePage.java index e4e8b8e..4a25a0d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/SpellingPreferencePage.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -23,11 +23,11 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** * Preference page for spell checking preferences. - * + * * @since 3.0 */ public class SpellingPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IStatusChangeListener { @@ -61,7 +61,7 @@ public class SpellingPreferencePage extends PreferencePage implements IWorkbench */ public void createControl(final Composite parent) { super.createControl(parent); - WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE); } /* diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskInputDialog.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskInputDialog.java index 68477dd..b95f478 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskInputDialog.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskInputDialog.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -29,27 +29,27 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** * Dialog to enter a na new task tag */ public class TodoTaskInputDialog extends StatusDialog { - + private class CompilerTodoTaskInputAdapter implements IDialogFieldListener { public void dialogFieldChanged(DialogField field) { doValidation(); - } + } } - + private StringDialogField fNameDialogField; private ComboDialogField fPriorityDialogField; - + private List fExistingNames; - + public TodoTaskInputDialog(Shell parent, TodoTask task, List existingEntries) { super(parent); - + fExistingNames= new ArrayList(existingEntries.size()); for (int i= 0; i < existingEntries.size(); i++) { TodoTask curr= (TodoTask) existingEntries.get(i); @@ -57,7 +57,7 @@ public class TodoTaskInputDialog extends StatusDialog { fExistingNames.add(curr.name); } } - + if (task == null) { setTitle(PreferencesMessages.getString("TodoTaskInputDialog.new.title")); //$NON-NLS-1$ } else { @@ -69,15 +69,15 @@ public class TodoTaskInputDialog extends StatusDialog { fNameDialogField= new StringDialogField(); fNameDialogField.setLabelText(PreferencesMessages.getString("TodoTaskInputDialog.name.label")); //$NON-NLS-1$ fNameDialogField.setDialogFieldListener(adapter); - + fNameDialogField.setText((task != null) ? task.name : ""); //$NON-NLS-1$ - + String[] items= new String[] { PreferencesMessages.getString("TodoTaskInputDialog.priority.high"), //$NON-NLS-1$ PreferencesMessages.getString("TodoTaskInputDialog.priority.normal"), //$NON-NLS-1$ PreferencesMessages.getString("TodoTaskInputDialog.priority.low") //$NON-NLS-1$ }; - + fPriorityDialogField= new ComboDialogField(SWT.READ_ONLY); fPriorityDialogField.setLabelText(PreferencesMessages.getString("TodoTaskInputDialog.priority.label")); //$NON-NLS-1$ fPriorityDialogField.setItems(items); @@ -93,7 +93,7 @@ public class TodoTaskInputDialog extends StatusDialog { fPriorityDialogField.selectItem(1); } } - + public TodoTask getResult() { TodoTask task= new TodoTask(); task.name= fNameDialogField.getText().trim(); @@ -106,33 +106,33 @@ public class TodoTaskInputDialog extends StatusDialog { break; default : task.priority= JavaCore.COMPILER_TASK_PRIORITY_LOW; - break; + break; } return task; } - + protected Control createDialogArea(Composite parent) { Composite composite= (Composite) super.createDialogArea(parent); - + Composite inner= new Composite(composite, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 2; inner.setLayout(layout); - + fNameDialogField.doFillIntoGrid(inner, 2); fPriorityDialogField.doFillIntoGrid(inner, 2); - + LayoutUtil.setHorizontalGrabbing(fNameDialogField.getTextControl(null)); LayoutUtil.setWidthHint(fNameDialogField.getTextControl(null), convertWidthInCharsToPixels(45)); - + fNameDialogField.postSetFocusOnDialogField(parent.getDisplay()); - - applyDialogFont(composite); + + applyDialogFont(composite); return composite; } - + private void doValidation() { StatusInfo status= new StatusInfo(); String newText= fNameDialogField.getText(); @@ -155,6 +155,6 @@ public class TodoTaskInputDialog extends StatusDialog { */ protected void configureShell(Shell newShell) { super.configureShell(newShell); - WorkbenchHelp.setHelp(newShell, IJavaHelpContextIds.TODO_TASK_INPUT_DIALOG); + PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IJavaHelpContextIds.TODO_TASK_INPUT_DIALOG); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPreferencePage.java index 60b3716..e8f0fe9 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPreferencePage.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -22,7 +22,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /* * The page to configure the compiler options. @@ -36,16 +36,16 @@ public class TodoTaskPreferencePage extends PreferencePage implements IWorkbench public TodoTaskPreferencePage() { setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore()); //setDescription(PreferencesMessages.getString("TodoTaskPreferencePage.description")); //$NON-NLS-1$ - + // only used when page is shown programatically setTitle(PreferencesMessages.getString("TodoTaskPreferencePage.title")); //$NON-NLS-1$ fConfigurationBlock= new TodoTaskConfigurationBlock(this, null); } - + /* * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ + */ public void init(IWorkbench workbench) { } @@ -55,8 +55,8 @@ public class TodoTaskPreferencePage extends PreferencePage implements IWorkbench public void createControl(Composite parent) { // added for 1GEUGE6: ITPJUI:WIN2000 - Help is the same on all preference pages super.createControl(parent); - WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PREFERENCE_PAGE); - } + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PREFERENCE_PAGE); + } /* * @see PreferencePage#createContents(Composite) @@ -73,10 +73,10 @@ public class TodoTaskPreferencePage extends PreferencePage implements IWorkbench public boolean performOk() { if (!fConfigurationBlock.performOk(true)) { return false; - } + } return super.performOk(); } - + /* * @see PreferencePage#performDefaults() */ @@ -90,7 +90,7 @@ public class TodoTaskPreferencePage extends PreferencePage implements IWorkbench */ public void statusChanged(IStatus status) { setValid(!status.matches(IStatus.ERROR)); - StatusUtil.applyToStatusLine(this, status); + StatusUtil.applyToStatusLine(this, status); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPropertyPage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPropertyPage.java index 2de9102..aab8245 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPropertyPage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskPropertyPage.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -36,8 +36,8 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PropertyPage; -import org.eclipse.ui.help.WorkbenchHelp; /** * Property page used to configure project specific task tags settings @@ -51,18 +51,18 @@ public class TodoTaskPropertyPage extends PropertyPage { private SelectionButtonDialogField fChangeWorkspaceSettings; private SelectionButtonDialogField fUseProjectSettings; private IStatus fBlockStatus; - + public TodoTaskPropertyPage() { fBlockStatus= new StatusInfo(); fBlockEnableState= null; - + IDialogFieldListener listener= new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { doDialogFieldChanged(field); } }; - + fUseWorkspaceSettings= new SelectionButtonDialogField(SWT.RADIO); fUseWorkspaceSettings.setDialogFieldListener(listener); fUseWorkspaceSettings.setLabelText(PreferencesMessages.getString("TodoTaskPropertyPage.useworkspacesettings.label")); //$NON-NLS-1$ @@ -70,7 +70,7 @@ public class TodoTaskPropertyPage extends PropertyPage { fChangeWorkspaceSettings= new SelectionButtonDialogField(SWT.PUSH); fChangeWorkspaceSettings.setLabelText(PreferencesMessages.getString("TodoTaskPropertyPage.useworkspacesettings.change")); //$NON-NLS-1$ fChangeWorkspaceSettings.setDialogFieldListener(listener); - + fUseWorkspaceSettings.attachDialogField(fChangeWorkspaceSettings); fUseProjectSettings= new SelectionButtonDialogField(SWT.RADIO); @@ -83,7 +83,7 @@ public class TodoTaskPropertyPage extends PropertyPage { */ public void createControl(Composite parent) { super.createControl(parent); - WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PROPERTY_PAGE); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PROPERTY_PAGE); } /* @@ -95,47 +95,47 @@ public class TodoTaskPropertyPage extends PropertyPage { fBlockStatus= status; doStatusChanged(); } - }; + }; fConfigurationBlock= new TodoTaskConfigurationBlock(listener, getProject()); - + Composite composite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 1; composite.setLayout(layout); - + fUseWorkspaceSettings.doFillIntoGrid(composite, 1); LayoutUtil.setHorizontalGrabbing(fUseWorkspaceSettings.getSelectionButton(null)); - + fChangeWorkspaceSettings.doFillIntoGrid(composite, 1); GridData data= (GridData) fChangeWorkspaceSettings.getSelectionButton(null).getLayoutData(); data.horizontalIndent= convertWidthInCharsToPixels(3); data.horizontalAlignment= GridData.BEGINNING; - + fUseProjectSettings.doFillIntoGrid(composite, 1); - + data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL ); data.horizontalSpan= 1; data.horizontalIndent= convertWidthInCharsToPixels(2); - + fConfigurationBlockControl= fConfigurationBlock.createContents(composite); fConfigurationBlockControl.setLayoutData(data); - + boolean useProjectSettings= fConfigurationBlock.hasProjectSpecificOptions(); - + fUseProjectSettings.setSelection(useProjectSettings); fUseWorkspaceSettings.setSelection(!useProjectSettings); - + updateEnableState(); Dialog.applyDialogFont(composite); return composite; } - + private boolean useProjectSettings() { return fUseProjectSettings.isSelected(); } - + private void doDialogFieldChanged(DialogField field) { if (field == fChangeWorkspaceSettings) { TodoTaskPreferencePage page= new TodoTaskPreferencePage(); @@ -144,21 +144,21 @@ public class TodoTaskPropertyPage extends PropertyPage { updateEnableState(); doStatusChanged(); } - } + } /** * Method statusChanged. */ private void doStatusChanged() { updateStatus(useProjectSettings() ? fBlockStatus : new StatusInfo()); } - + /** * Method getProject. */ private IJavaProject getProject() { - return (IJavaProject) getElement().getAdapter(IJavaElement.class); + return (IJavaProject) getElement().getAdapter(IJavaElement.class); } - + private void updateEnableState() { if (useProjectSettings()) { if (fBlockEnableState != null) { @@ -169,9 +169,9 @@ public class TodoTaskPropertyPage extends PropertyPage { if (fBlockEnableState == null) { fBlockEnableState= ControlEnableState.disable(fConfigurationBlockControl); } - } + } } - + /* * @see org.eclipse.jface.preference.IPreferencePage#performDefaults() */ @@ -190,15 +190,15 @@ public class TodoTaskPropertyPage extends PropertyPage { public boolean performOk() { return fConfigurationBlock.performOk(useProjectSettings()); } - + private void updateStatus(IStatus status) { setValid(!status.matches(IStatus.ERROR)); StatusUtil.applyToStatusLine(this, status); } - + private boolean showPreferencePage(String id, IPreferencePage page) { final IPreferenceNode targetNode = new PreferenceNode(id, page); - + PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); final PreferenceDialog dialog = new PreferenceDialog(getShell(), manager); @@ -211,6 +211,6 @@ public class TodoTaskPropertyPage extends PropertyPage { } }); return result[0]; - } + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaStringAutoIndentStrategyDQ.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaStringAutoIndentStrategyDQ.java index 746691c..1e4ebe5 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaStringAutoIndentStrategyDQ.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaStringAutoIndentStrategyDQ.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -15,7 +15,7 @@ import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DefaultAutoIndentStrategy; +import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; @@ -29,23 +29,23 @@ import org.eclipse.ui.texteditor.ITextEditorExtension3; /** * Auto indent strategy for java strings */ -public class JavaStringAutoIndentStrategyDQ extends DefaultAutoIndentStrategy { - +public class JavaStringAutoIndentStrategyDQ extends DefaultIndentLineAutoEditStrategy { + private String fPartitioning; - + /** * The input string doesn't contain any line delimiter. - * + * * @param inputString the given input string * @return the displayable string. */ private String displayString(String inputString, String indentation, String delimiter) { - + int length = inputString.length(); StringBuffer buffer = new StringBuffer(length); java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(inputString, "\n\r", true); //$NON-NLS-1$ while (tokenizer.hasMoreTokens()){ - + String token = tokenizer.nextToken(); if (token.equals("\r")) { //$NON-NLS-1$ buffer.append("\\r"); //$NON-NLS-1$ @@ -71,10 +71,10 @@ public class JavaStringAutoIndentStrategyDQ extends DefaultAutoIndentStrategy { buffer.append(indentation); buffer.append("\""); //$NON-NLS-1$ continue; - } - + } + StringBuffer tokenBuffer = new StringBuffer(); - for (int i = 0; i < token.length(); i++){ + for (int i = 0; i < token.length(); i++){ char c = token.charAt(i); switch (c) { case '\r' : @@ -113,35 +113,35 @@ public class JavaStringAutoIndentStrategyDQ extends DefaultAutoIndentStrategy { /** * Creates a new Java string auto indent strategy for the given document partitioning. - * + * * @param partitioning the document partitioning */ public JavaStringAutoIndentStrategyDQ(String partitioning) { super(); fPartitioning= partitioning; } - + private boolean isLineDelimiter(IDocument document, String text) { String[] delimiters= document.getLegalLineDelimiters(); if (delimiters != null) return TextUtilities.equals(delimiters, text) > -1; return false; } - + private String getLineIndentation(IDocument document, int offset) throws BadLocationException { // find start of line int adjustedOffset= (offset == document.getLength() ? offset - 1 : offset); IRegion line= document.getLineInformationOfOffset(adjustedOffset); int start= line.getOffset(); - + // find white spaces int end= findEndOfWhiteSpace(document, start, offset); - + return document.get(start, end - start); } - private String getModifiedText(String string, String indentation, String delimiter) throws BadLocationException { + private String getModifiedText(String string, String indentation, String delimiter) throws BadLocationException { return displayString(string, indentation, delimiter); } @@ -156,7 +156,7 @@ public class JavaStringAutoIndentStrategyDQ extends DefaultAutoIndentStrategy { // new JavaAutoIndentStrategy(fPartitioning).customizeDocumentCommand(document, command); return; } - + if (command.offset == offset + length && document.getChar(offset + length - 1) == '\"') return; @@ -167,18 +167,18 @@ public class JavaStringAutoIndentStrategyDQ extends DefaultAutoIndentStrategy { String string= document.get(line.getOffset(), offset - line.getOffset()); if (string.trim().length() != 0) indentation += String.valueOf("\t\t"); //$NON-NLS-1$ - + IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore(); if (isLineDelimiter(document, command.text)) command.text= "\" ." + command.text + indentation + "\""; //$NON-NLS-1$//$NON-NLS-2$ else if (command.text.length() > 1 && preferenceStore.getBoolean(PreferenceConstants.EDITOR_ESCAPE_STRINGS_DQ)) - command.text= getModifiedText(command.text, indentation, delimiter); + command.text= getModifiedText(command.text, indentation, delimiter); } - + private boolean isSmartMode() { IWorkbenchPage page= PHPeclipsePlugin.getActivePage(); if (page != null) { - IEditorPart part= page.getActiveEditor(); + IEditorPart part= page.getActiveEditor(); if (part instanceof ITextEditorExtension3) { ITextEditorExtension3 extension= (ITextEditorExtension3) part; return extension.getInsertMode() == ITextEditorExtension3.SMART_INSERT; @@ -196,10 +196,10 @@ public class JavaStringAutoIndentStrategyDQ extends DefaultAutoIndentStrategy { return; IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore(); - + if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS_DQ) && isSmartMode()) javaStringIndentAfterNewLine(document, command); - + } catch (BadLocationException e) { } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaStringAutoIndentStrategySQ.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaStringAutoIndentStrategySQ.java index 52e4c96..5741824 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaStringAutoIndentStrategySQ.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/JavaStringAutoIndentStrategySQ.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -15,7 +15,7 @@ import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DefaultAutoIndentStrategy; +import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; @@ -29,23 +29,23 @@ import org.eclipse.ui.texteditor.ITextEditorExtension3; /** * Auto indent strategy for java strings */ -public class JavaStringAutoIndentStrategySQ extends DefaultAutoIndentStrategy { - +public class JavaStringAutoIndentStrategySQ extends DefaultIndentLineAutoEditStrategy { + private String fPartitioning; - + /** * The input string doesn't contain any line delimiter. - * + * * @param inputString the given input string * @return the displayable string. */ private String displayString(String inputString, String indentation, String delimiter) { - + int length = inputString.length(); StringBuffer buffer = new StringBuffer(length); java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(inputString, "\n\r", true); //$NON-NLS-1$ while (tokenizer.hasMoreTokens()){ - + String token = tokenizer.nextToken(); if (token.equals("\r")) { //$NON-NLS-1$ buffer.append("\\r"); //$NON-NLS-1$ @@ -71,10 +71,10 @@ public class JavaStringAutoIndentStrategySQ extends DefaultAutoIndentStrategy { buffer.append(indentation); buffer.append("\'"); //$NON-NLS-1$ continue; - } - + } + StringBuffer tokenBuffer = new StringBuffer(); - for (int i = 0; i < token.length(); i++){ + for (int i = 0; i < token.length(); i++){ char c = token.charAt(i); switch (c) { case '\r' : @@ -113,35 +113,35 @@ public class JavaStringAutoIndentStrategySQ extends DefaultAutoIndentStrategy { /** * Creates a new Java string auto indent strategy for the given document partitioning. - * + * * @param partitioning the document partitioning */ public JavaStringAutoIndentStrategySQ(String partitioning) { super(); fPartitioning= partitioning; } - + private boolean isLineDelimiter(IDocument document, String text) { String[] delimiters= document.getLegalLineDelimiters(); if (delimiters != null) return TextUtilities.equals(delimiters, text) > -1; return false; } - + private String getLineIndentation(IDocument document, int offset) throws BadLocationException { // find start of line int adjustedOffset= (offset == document.getLength() ? offset - 1 : offset); IRegion line= document.getLineInformationOfOffset(adjustedOffset); int start= line.getOffset(); - + // find white spaces int end= findEndOfWhiteSpace(document, start, offset); - + return document.get(start, end - start); } - private String getModifiedText(String string, String indentation, String delimiter) throws BadLocationException { + private String getModifiedText(String string, String indentation, String delimiter) throws BadLocationException { return displayString(string, indentation, delimiter); } @@ -156,7 +156,7 @@ public class JavaStringAutoIndentStrategySQ extends DefaultAutoIndentStrategy { // new JavaAutoIndentStrategy(fPartitioning).customizeDocumentCommand(document, command); return; } - + if (command.offset == offset + length && document.getChar(offset + length - 1) == '\'') return; @@ -167,18 +167,18 @@ public class JavaStringAutoIndentStrategySQ extends DefaultAutoIndentStrategy { String string= document.get(line.getOffset(), offset - line.getOffset()); if (string.trim().length() != 0) indentation += String.valueOf("\t\t"); //$NON-NLS-1$ - + IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore(); if (isLineDelimiter(document, command.text)) command.text= "\' ." + command.text + indentation + "\'"; //$NON-NLS-1$//$NON-NLS-2$ else if (command.text.length() > 1 && preferenceStore.getBoolean(PreferenceConstants.EDITOR_ESCAPE_STRINGS_SQ)) - command.text= getModifiedText(command.text, indentation, delimiter); + command.text= getModifiedText(command.text, indentation, delimiter); } - + private boolean isSmartMode() { IWorkbenchPage page= PHPeclipsePlugin.getActivePage(); if (page != null) { - IEditorPart part= page.getActiveEditor(); + IEditorPart part= page.getActiveEditor(); if (part instanceof ITextEditorExtension3) { ITextEditorExtension3 extension= (ITextEditorExtension3) part; return extension.getInsertMode() == ITextEditorExtension3.SMART_INSERT; @@ -196,10 +196,10 @@ public class JavaStringAutoIndentStrategySQ extends DefaultAutoIndentStrategy { return; IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore(); - + if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS_SQ) && isSmartMode()) javaStringIndentAfterNewLine(document, command); - + } catch (BadLocationException e) { } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java index bf483a5..48d0b39 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/link/LinkedPositionUI.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -33,7 +33,7 @@ import org.eclipse.jface.text.ITextListener; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.ITextViewerExtension; import org.eclipse.jface.text.ITextViewerExtension2; -import org.eclipse.jface.text.ITextViewerExtension3; +import org.eclipse.jface.text.ITextViewerExtension5; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.Region; import org.eclipse.jface.text.TextEvent; @@ -71,20 +71,20 @@ public class LinkedPositionUI implements ILinkedPositionListener, public interface ExitListener { void exit(boolean accept); } - + public static class ExitFlags { - public int flags; + public int flags; public boolean doit; public ExitFlags(int flags, boolean doit) { this.flags= flags; this.doit= doit; - } + } } - + public interface ExitPolicy { ExitFlags doExit(LinkedPositionManager manager, VerifyEvent event, int offset, int length); } - + // leave flags private static final int UNINSTALL= 1; // uninstall linked position manager public static final int COMMIT= 2; // commit changes @@ -94,8 +94,8 @@ public class LinkedPositionUI implements ILinkedPositionListener, private static final IPreferenceStore fgStore= PHPeclipsePlugin.getDefault().getPreferenceStore(); private static final String CARET_POSITION_PREFIX= "LinkedPositionUI.caret.position"; //$NON-NLS-1$ private static int fgCounter= 0; - - + + private final ITextViewer fViewer; private final LinkedPositionManager fManager; private final IPositionUpdater fUpdater; @@ -108,39 +108,39 @@ public class LinkedPositionUI implements ILinkedPositionListener, private Position fFramePosition; private int fInitialOffset= -1; private int fCaretOffset; - + private ExitPolicy fExitPolicy; private ExitListener fExitListener; - + private boolean fNeedRedraw; - + private String fContentType; private Position fPreviousPosition; // private ContentAssistant2 fAssistant; - /** + /** * Flag that records the state of this ui object. As there are many different entities that may * call leave or exit, these cannot always be sure whether the linked position infrastructure is - * still active. This is especially true for multithreaded situations. + * still active. This is especially true for multithreaded situations. */ private boolean fIsActive= false; /** * Creates a user interface for LinkedPositionManager. - * + * * @param viewer the text viewer. * @param manager the LinkedPositionManager managing a IDocument of the ITextViewer. */ public LinkedPositionUI(ITextViewer viewer, LinkedPositionManager manager) { Assert.isNotNull(viewer); Assert.isNotNull(manager); - + fViewer= viewer; fManager= manager; - + fPositionCategoryName= CARET_POSITION_PREFIX + (fgCounter++); fUpdater= new DefaultPositionUpdater(fPositionCategoryName); - + fManager.setLinkedPositionListener(this); initializeHighlightColor(viewer); @@ -173,20 +173,20 @@ public class LinkedPositionUI implements ILinkedPositionListener, * Returns null if there is no such information available. */ private Color createColor(IPreferenceStore store, String key, Display display) { - - RGB rgb= null; - + + RGB rgb= null; + if (store.contains(key)) { - + if (store.isDefault(key)) rgb= PreferenceConverter.getDefaultColor(store, key); else rgb= PreferenceConverter.getColor(store, key); - + if (rgb != null) return new Color(display, rgb); } - + return null; } @@ -195,9 +195,9 @@ public class LinkedPositionUI implements ILinkedPositionListener, * @param offset */ public void setInitialOffset(int offset) { - fInitialOffset= offset; + fInitialOffset= offset; } - + /** * Sets the final position of the caret when the linked mode is exited * successfully by leaving the last linked position using TAB. @@ -205,7 +205,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, * LinkedPositionManager. */ public void setFinalCaretOffset(int offset) { - fFinalCaretOffset= offset; + fFinalCaretOffset= offset; } /** @@ -230,7 +230,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, public void setCurrentPosition(Position position, int caretOffset) { if (!fIsActive) ;//JavaPlugin.log(new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, "LinkedPositionUI is not active: "+fPositionCategoryName, new IllegalStateException())); //$NON-NLS-1$ - + if (!fFramePosition.equals(position)) { fNeedRedraw= true; fFramePosition= position; @@ -242,7 +242,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, /** * Enters the linked mode. The linked mode can be left by calling * exit. - * + * * @see #exit(boolean) */ public void enter() { @@ -252,7 +252,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, fIsActive= true; // JavaPlugin.log(new Status(IStatus.INFO, JavaPlugin.getPluginId(), IStatus.OK, "LinkedPositionUI activated: "+fPositionCategoryName, new Exception())); //$NON-NLS-1$ } - + // track final caret IDocument document= fViewer.getDocument(); @@ -274,11 +274,11 @@ public class LinkedPositionUI implements ILinkedPositionListener, fViewer.addTextInputListener(this); fViewer.addTextListener(this); - + ITextViewerExtension extension= (ITextViewerExtension) fViewer; extension.prependVerifyKeyListener(this); - StyledText text= fViewer.getTextWidget(); + StyledText text= fViewer.getTextWidget(); text.addVerifyListener(this); text.addModifyListener(this); text.addPaintListener(this); @@ -286,7 +286,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, Shell shell= text.getShell(); shell.addShellListener(this); - + fFramePosition= (fInitialOffset == -1) ? fManager.getFirstPosition() : fManager.getPosition(fInitialOffset); if (fFramePosition == null) { leave(UNINSTALL | COMMIT | UPDATE_CARET); @@ -335,13 +335,13 @@ public class LinkedPositionUI implements ILinkedPositionListener, public IRegion getSelectedRegion() { if (!fIsActive) ;//JavaPlugin.log(new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, "LinkedPositionUI is not active: "+fPositionCategoryName, new IllegalStateException())); //$NON-NLS-1$ - + if (fFramePosition == null) return new Region(fFinalCaretOffset, 0); else return new Region(fFramePosition.getOffset(), fFramePosition.getLength()); } - + private void leave(int flags) { if (!fIsActive) ;//JavaPlugin.log(new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, "LinkedPositionUI is not active: "+fPositionCategoryName, new IllegalStateException())); //$NON-NLS-1$ @@ -349,33 +349,33 @@ public class LinkedPositionUI implements ILinkedPositionListener, fIsActive= false; //JavaPlugin.log(new Status(IStatus.INFO, JavaPlugin.getPluginId(), IStatus.OK, "LinkedPositionUI deactivated: "+fPositionCategoryName, new Exception())); //$NON-NLS-1$ } - + fInitialOffset= -1; - + if ((flags & UNINSTALL) != 0) fManager.uninstall((flags & COMMIT) != 0); fgStore.removePropertyChangeListener(this); - + if (fFrameColor != null) { fFrameColor.dispose(); fFrameColor= null; - } - + } + StyledText text= fViewer.getTextWidget(); // bail out if the styled text is null, meaning the viewer has been disposed (-> document is null as well) // see pr https://bugs.eclipse.org/bugs/show_bug.cgi?id=46821 if (text == null) return; - + text.removePaintListener(this); text.removeModifyListener(this); text.removeVerifyListener(this); Shell shell= text.getShell(); shell.removeShellListener(this); - + // if (fAssistant != null) { // Display display= text.getDisplay(); // if (display != null && !display.isDisposed()) { @@ -392,7 +392,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, ITextViewerExtension extension= (ITextViewerExtension) fViewer; extension.removeVerifyKeyListener(this); - + IRewriteTarget target= extension.getRewriteTarget(); target.endCompoundChange(); @@ -402,7 +402,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, fViewer.removeTextListener(this); fViewer.removeTextInputListener(this); - + try { IDocument document= fViewer.getDocument(); @@ -412,13 +412,13 @@ public class LinkedPositionUI implements ILinkedPositionListener, { Position[] positions= document.getPositions(fPositionCategoryName); if ((positions != null) && (positions.length != 0)) { - - if (fViewer instanceof ITextViewerExtension3) { - ITextViewerExtension3 extension3= (ITextViewerExtension3) fViewer; + + if (fViewer instanceof ITextViewerExtension5) { + ITextViewerExtension5 extension3= (ITextViewerExtension5) fViewer; int widgetOffset= extension3.modelOffset2WidgetOffset(positions[0].getOffset()); if (widgetOffset >= 0) text.setSelection(widgetOffset, widgetOffset); - + } else { IRegion region= fViewer.getVisibleRegion(); int offset= positions[0].getOffset() - region.getOffset(); @@ -430,7 +430,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, document.removePositionUpdater(fUpdater); document.removePositionCategory(fPositionCategoryName); - + if (fExitListener != null) fExitListener.exit( ((flags & COMMIT) != 0) || @@ -448,9 +448,9 @@ public class LinkedPositionUI implements ILinkedPositionListener, private void next() { if (!fIsActive) ;//JavaPlugin.log(new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, "LinkedPositionUI is not active: "+fPositionCategoryName, new IllegalStateException())); //$NON-NLS-1$ - + redrawRegion(); - + if (fFramePosition == fFinalCaretPosition) fFramePosition= fManager.getFirstPosition(); else @@ -469,13 +469,13 @@ public class LinkedPositionUI implements ILinkedPositionListener, redrawRegion(); } } - + private void previous() { if (!fIsActive) ;//JavaPlugin.log(new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, "LinkedPositionUI is not active: "+fPositionCategoryName, new IllegalStateException())); //$NON-NLS-1$ - + redrawRegion(); - + fFramePosition= fManager.getPreviousPosition(fFramePosition.getOffset()); if (fFramePosition == null) { if (fFinalCaretPosition != null) @@ -495,7 +495,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, /** Trigger content assist on choice positions */ // private void triggerContentAssist() { // if (fFramePosition instanceof ProposalPosition) { -// +// // ProposalPosition pp= (ProposalPosition) fFramePosition; // initializeContentAssistant(); // if (fAssistant == null) @@ -507,7 +507,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, // fAssistant.setCompletions(new ICompletionProposal[0]); // } // } - + /** Lazy initialize content assistant for this linked ui */ // private void initializeContentAssistant() { // if (fAssistant != null) @@ -524,18 +524,18 @@ public class LinkedPositionUI implements ILinkedPositionListener, if (!event.doit || !fIsActive) return; - + Point selection= fViewer.getSelectedRange(); int offset= selection.x; int length= selection.y; - + ExitFlags exitFlags= fExitPolicy == null ? null : fExitPolicy.doExit(fManager, event, offset, length); if (exitFlags != null) { leave(UNINSTALL | exitFlags.flags); event.doit= exitFlags.doit; return; } - + switch (event.character) { // [SHIFT-]TAB = hop between edit boxes case 0x09: @@ -546,12 +546,12 @@ public class LinkedPositionUI implements ILinkedPositionListener, return; } } - + if (event.stateMask == SWT.SHIFT) previous(); - else - next(); - + else + next(); + event.doit= false; break; @@ -564,7 +564,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, // event.doit= false; // break; // } - + // if enter was treated as a document change, would it exceed variable range? if (!LinkedPositionManager.includes(fFramePosition, offset, length) || (fFramePosition == fFinalCaretPosition)) { @@ -572,7 +572,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, return; } } - + leave(UNINSTALL | COMMIT | UPDATE_CARET); event.doit= false; break; @@ -582,65 +582,65 @@ public class LinkedPositionUI implements ILinkedPositionListener, leave(UNINSTALL | COMMIT); event.doit= false; break; - + case ';': leave(UNINSTALL | COMMIT); event.doit= true; break; - + default: if (event.character != 0) { if (!controlUndoBehavior(offset, length) || fFramePosition == fFinalCaretPosition) { leave(UNINSTALL | COMMIT); - break; + break; } } } } - + private boolean controlUndoBehavior(int offset, int length) { - + Position position= fManager.getEmbracingPosition(offset, length); if (position != null) { - + ITextViewerExtension extension= (ITextViewerExtension) fViewer; IRewriteTarget target= extension.getRewriteTarget(); - + if (fPreviousPosition != null && !fPreviousPosition.equals(position)) target.endCompoundChange(); target.beginCompoundChange(); } - + fPreviousPosition= position; return fPreviousPosition != null; } - + /* * @see VerifyListener#verifyText(VerifyEvent) */ public void verifyText(VerifyEvent event) { if (!event.doit) return; - - + + int offset= 0; int length= 0; - - if (fViewer instanceof ITextViewerExtension3) { - ITextViewerExtension3 extension= (ITextViewerExtension3) fViewer; + + if (fViewer instanceof ITextViewerExtension5) { + ITextViewerExtension5 extension= (ITextViewerExtension5) fViewer; IRegion modelRange= extension.widgetRange2ModelRange(new Region(event.start, event.end - event.start)); if (modelRange == null) return; - + offset= modelRange.getOffset(); length= modelRange.getLength(); - + } else { IRegion visibleRegion= fViewer.getVisibleRegion(); offset= event.start + visibleRegion.getOffset(); length= event.end - event.start; } - + // allow changes only within linked positions when coming through UI if (!fManager.anyPositionIncludes(offset, length)) leave(UNINSTALL | COMMIT); @@ -649,10 +649,10 @@ public class LinkedPositionUI implements ILinkedPositionListener, /* * @see PaintListener#paintControl(PaintEvent) */ - public void paintControl(PaintEvent event) { + public void paintControl(PaintEvent event) { if (fFramePosition == null) return; - + IRegion widgetRange= asWidgetRange(fFramePosition); if (widgetRange == null) { leave(UNINSTALL | COMMIT | DOCUMENT_CHANGED); @@ -663,7 +663,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, int length= widgetRange.getLength(); StyledText text= fViewer.getTextWidget(); - + // support for bidi Point minLocation= getMinimumLocation(text, offset, length); Point maxLocation= getMaximumLocation(text, offset, length); @@ -671,25 +671,25 @@ public class LinkedPositionUI implements ILinkedPositionListener, int x1= minLocation.x; int x2= minLocation.x + maxLocation.x - minLocation.x - 1; int y= minLocation.y + text.getLineHeight() - 1; - + GC gc= event.gc; gc.setForeground(fFrameColor); gc.drawLine(x1, y, x2, y); } - + protected IRegion asWidgetRange(Position position) { - if (fViewer instanceof ITextViewerExtension3) { - - ITextViewerExtension3 extension= (ITextViewerExtension3) fViewer; + if (fViewer instanceof ITextViewerExtension5) { + + ITextViewerExtension5 extension= (ITextViewerExtension5) fViewer; return extension.modelRange2WidgetRange(new Region(position.getOffset(), position.getLength())); - + } else { - + IRegion region= fViewer.getVisibleRegion(); if (includes(region, position)) return new Region(position.getOffset() - region.getOffset(), position.getLength()); } - + return null; } @@ -698,13 +698,13 @@ public class LinkedPositionUI implements ILinkedPositionListener, for (int i= 0; i <= length; i++) { Point location= text.getLocationAtOffset(offset + i); - + if (location.x < minLocation.x) - minLocation.x= location.x; + minLocation.x= location.x; if (location.y < minLocation.y) - minLocation.y= location.y; - } - + minLocation.y= location.y; + } + return minLocation; } @@ -713,13 +713,13 @@ public class LinkedPositionUI implements ILinkedPositionListener, for (int i= 0; i <= length; i++) { Point location= text.getLocationAtOffset(offset + i); - + if (location.x > maxLocation.x) - maxLocation.x= location.x; + maxLocation.x= location.x; if (location.y > maxLocation.y) - maxLocation.y= location.y; - } - + maxLocation.y= location.y; + } + return maxLocation; } @@ -727,20 +727,20 @@ public class LinkedPositionUI implements ILinkedPositionListener, IRegion widgetRange= asWidgetRange(fFramePosition); if (widgetRange == null) { leave(UNINSTALL | COMMIT | DOCUMENT_CHANGED); - return; + return; } - + StyledText text= fViewer.getTextWidget(); - if (text != null && !text.isDisposed()) + if (text != null && !text.isDisposed()) text.redrawRange(widgetRange.getOffset(), widgetRange.getLength(), true); } private void selectRegion() { - + IRegion widgetRange= asWidgetRange(fFramePosition); if (widgetRange == null) { leave(UNINSTALL | COMMIT | DOCUMENT_CHANGED); - return; + return; } StyledText text= fViewer.getTextWidget(); @@ -750,15 +750,15 @@ public class LinkedPositionUI implements ILinkedPositionListener, text.setSelection(start, end); } } - + private void updateCaret() { - + IRegion widgetRange= asWidgetRange(fFramePosition); if (widgetRange == null) { leave(UNINSTALL | COMMIT | DOCUMENT_CHANGED); - return; + return; } - + int offset= widgetRange.getOffset() + fCaretOffset; StyledText text= fViewer.getTextWidget(); if (text != null && !text.isDisposed()) @@ -767,7 +767,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, /* * @see ModifyListener#modifyText(ModifyEvent) - */ + */ public void modifyText(ModifyEvent e) { // reposition caret after StyledText redrawRegion(); @@ -813,7 +813,7 @@ public class LinkedPositionUI implements ILinkedPositionListener, public void textChanged(TextEvent event) { if (!fNeedRedraw) return; - + redrawRegion(); fNeedRedraw= false; } @@ -838,25 +838,25 @@ public class LinkedPositionUI implements ILinkedPositionListener, // don't deactivate on focus lost, since the proposal popups may take focus // plus: it doesn't hurt if you can check with another window without losing linked mode // since there is no intrusive popup sticking out. - + // need to check first what happens on reentering based on an open action // Seems to be no problem - + // TODO check whether we can leave it or uncomment it after debugging // PS: why DOCUMENT_CHANGED? We want to trigger a redraw! (Shell deactivated does not mean // it is not visible any longer. // leave(UNINSTALL | COMMIT | DOCUMENT_CHANGED); - + // Better: - // Check with content assistant and only leave if its not the proposal shell that took the + // Check with content assistant and only leave if its not the proposal shell that took the // focus away. - + StyledText text; Display display; -// if (fAssistant == null || fViewer == null || (text= fViewer.getTextWidget()) == null +// if (fAssistant == null || fViewer == null || (text= fViewer.getTextWidget()) == null // || (display= text.getDisplay()) == null || display.isDisposed()) { - if ( fViewer == null || (text= fViewer.getTextWidget()) == null + if ( fViewer == null || (text= fViewer.getTextWidget()) == null || (display= text.getDisplay()) == null || display.isDisposed()) { leave(UNINSTALL | COMMIT); } else { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java index 40f04d2..a8b6374 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java @@ -1,17 +1,17 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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.text.phpdoc; - + import java.text.BreakIterator; import net.sourceforge.phpdt.core.ICompilationUnit; @@ -29,7 +29,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Preferences; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DefaultAutoIndentStrategy; +import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; @@ -46,26 +46,26 @@ import org.eclipse.ui.texteditor.ITextEditorExtension3; /** * Auto indent strategy for java doc comments */ -public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { +public class JavaDocAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy { private String fPartitioning; /** * Creates a new Javadoc auto indent strategy for the given document partitioning. - * + * * @param partitioning the document partitioning */ public JavaDocAutoIndentStrategy(String partitioning) { fPartitioning= partitioning; } - + private static String getLineDelimiter(IDocument document) { try { if (document.getNumberOfLines() > 1) return document.getLineDelimiter(0); } catch (BadLocationException e) { PHPeclipsePlugin.log(e); - } + } return System.getProperty("line.separator"); //$NON-NLS-1$ } @@ -79,19 +79,19 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { * @param c the command to deal with */ private void jdocIndentAfterNewLine(IDocument d, DocumentCommand c) { - + if (c.offset == -1 || d.getLength() == 0) return; - + try { // find start of line int p= (c.offset == d.getLength() ? c.offset - 1 : c.offset); IRegion info= d.getLineInformationOfOffset(p); int start= info.getOffset(); - + // find white spaces int end= findEndOfWhiteSpace(d, start, c.offset); - + StringBuffer buf= new StringBuffer(c.text); if (end >= start) { // 1GEYL1R: ITPJUI:ALL - java doc edit smartness not work for class comments // append to input @@ -104,7 +104,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { if (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS) && isNewComment(d, c.offset, fPartitioning)) { String lineDelimiter= getLineDelimiter(d); - + String endTag= lineDelimiter + indentation + " */"; //$NON-NLS-1$ d.replace(c.offset, 0, endTag); //$NON-NLS-1$ // evaluate method signature @@ -123,14 +123,14 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { // // ignore // } // } - } + } } - } + } } - + c.text= buf.toString(); - + } catch (BadLocationException excp) { // stop work } @@ -145,16 +145,16 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { switch (element.getElementType()) { case IJavaElement.TYPE: - return createTypeTags(document, command, indentation, lineDelimiter, (IType) element); + 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 delimiters. */ @@ -173,12 +173,12 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { // return Strings.changeIndent(comment, 0, CodeFormatterUtil.getTabWidth(), indentation, lineDelimiter); return Strings.changeIndent(comment, 0, getTabWidth(), indentation, lineDelimiter); } - + public static int getTabWidth() { Preferences preferences= PHPeclipsePlugin.getDefault().getPluginPreferences(); return preferences.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); } - + private String createTypeTags(IDocument document, DocumentCommand command, String indentation, String lineDelimiter, IType type) throws CoreException { @@ -188,7 +188,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { } return null; } - + private String createMethodTags(IDocument document, DocumentCommand command, String indentation, String lineDelimiter, IMethod method) throws CoreException, BadLocationException { @@ -196,7 +196,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { ISourceRange sourceRange= method.getSourceRange(); if (sourceRange == null || sourceRange.getOffset() != partition.getOffset()) return null; - + // IMethod inheritedMethod= getInheritedMethod(method); // String comment= CodeGeneration.getMethodComment(method, inheritedMethod, lineDelimiter); // if (comment != null) { @@ -219,7 +219,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { // return JavaModelUtil.findMethodDeclarationInHierarchy(typeHierarchy, declaringType, // method.getElementName(), method.getParameterTypes(), method.isConstructor()); // } - + protected void jdocIndentForCommentEnd(IDocument d, DocumentCommand c) { if (c.offset < 2 || d.getLength() == 0) { return; @@ -229,7 +229,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { // modify document command c.length++; c.offset--; - } + } } catch (BadLocationException excp) { // stop work } @@ -240,36 +240,36 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { * If in doubt, it will assume that the javadoc is new. */ private static boolean isNewComment(IDocument document, int commandOffset, String partitioning) { - + try { int lineIndex= document.getLineOfOffset(commandOffset) + 1; if (lineIndex >= document.getNumberOfLines()) return true; - + IRegion line= document.getLineInformation(lineIndex); ITypedRegion partition= TextUtilities.getPartition(document, partitioning, commandOffset, false); int partitionEnd= partition.getOffset() + partition.getLength(); if (line.getOffset() >= partitionEnd) return false; - + if (document.getLength() == partitionEnd) return true; // partition goes to end of document - probably a new comment - + String comment= document.get(partition.getOffset(), partition.getLength()); if (comment.indexOf("/*", 2) != -1) //$NON-NLS-1$ return true; // enclosed another comment -> probably a new comment - + return false; - + } catch (BadLocationException e) { return false; - } + } } - + private boolean isSmartMode() { IWorkbenchPage page= PHPeclipsePlugin.getActivePage(); if (page != null) { - IEditorPart part= page.getActiveEditor(); + IEditorPart part= page.getActiveEditor(); if (part instanceof ITextEditorExtension3) { ITextEditorExtension3 extension= (ITextEditorExtension3) part; return extension.getInsertMode() == ITextEditorExtension3.SMART_INSERT; @@ -282,12 +282,12 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { * @see IAutoIndentStrategy#customizeDocumentCommand */ public void customizeDocumentCommand(IDocument document, DocumentCommand command) { - + if (!isSmartMode()) return; try { - + if (command.text != null && command.length == 0) { String[] lineDelimiters= document.getLegalLineDelimiters(); int index= TextUtilities.endsWith(lineDelimiters, command.text); @@ -299,7 +299,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { return; } } - + if (command.text != null && command.text.equals("/")) { //$NON-NLS-1$ jdocIndentForCommentEnd(document, command); return; @@ -307,8 +307,8 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { ITypedRegion partition= TextUtilities.getPartition(document, fPartitioning, command.offset, true); int partitionStart= partition.getOffset(); - int partitionEnd= partition.getLength() + partitionStart; - + int partitionEnd= partition.getLength() + partitionStart; + String text= command.text; int offset= command.offset; int length= command.length; @@ -318,11 +318,11 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { final int POSTFIX_LENGTH= "*/".length(); //$NON-NLS-1$ if ((offset < partitionStart + PREFIX_LENGTH || offset + length > partitionEnd - POSTFIX_LENGTH) || text != null && text.length() >= 2 && ((text.indexOf("*/") != -1) || (document.getChar(offset) == '*' && text.startsWith("/")))) //$NON-NLS-1$ //$NON-NLS-2$ - return; + return; if (command.text == null || command.text.length() == 0) jdocHandleBackspaceDelete(document, command); - + else if (command.text != null && command.length == 0 && command.text.length() > 0) jdocWrapParagraphOnInsert(document, command); @@ -335,21 +335,21 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { if (!command.doit) return; - + document.replace(command.offset, command.length, command.text); command.doit= false; if (command.text != null) command.offset += command.text.length(); command.length= 0; - command.text= null; + command.text= null; } protected void jdocWrapParagraphOnInsert(IDocument document, DocumentCommand command) throws BadLocationException { // Assert.isTrue(command.length == 0); // Assert.isTrue(command.text != null && command.text.length() == 1); - + if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_FORMAT_JAVADOCS)) return; @@ -358,13 +358,13 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { int lineOffset= region.getOffset(); int lineLength= region.getLength(); - String lineContents= document.get(lineOffset, lineLength); + String lineContents= document.get(lineOffset, lineLength); StringBuffer buffer= new StringBuffer(lineContents); int start= command.offset - lineOffset; - int end= command.length + start; + int end= command.length + start; buffer.replace(start, end, command.text); - - // handle whitespace + + // handle whitespace if (command.text != null && command.text.length() != 0 && command.text.trim().length() == 0) { String endOfLine= document.get(command.offset, lineOffset + lineLength - command.offset); @@ -374,7 +374,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { // move caret to next line flushCommand(document, command); - if (isLineTooShort(document, line)) { + if (isLineTooShort(document, line)) { int[] caretOffset= {command.offset}; jdocWrapParagraphFromLine(document, line, caretOffset, false); command.offset= caretOffset[0]; @@ -386,13 +386,13 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { String lineDelimiter= document.getLineDelimiter(line); String nextLinePrefix= jdocExtractLinePrefix(document, line + 1); command.offset += lineDelimiter.length() + nextLinePrefix.length(); - } + } return; // inside whitespace at end of line } else if (endOfLine.trim().length() == 0) { // simply insert space - return; + return; } } @@ -401,20 +401,20 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { boolean wrapAlways= command.offset >= lineOffset && command.offset <= lineOffset + prefix.length(); // must insert the text now because it may include whitepace - flushCommand(document, command); + flushCommand(document, command); if (wrapAlways || calculateDisplayedWidth(buffer.toString()) > getMargin() || isLineTooShort(document, line)) { - int[] caretOffset= {command.offset}; + int[] caretOffset= {command.offset}; jdocWrapParagraphFromLine(document, line, caretOffset, wrapAlways); - if (!wrapAlways) + if (!wrapAlways) command.offset= caretOffset[0]; } } /** * Method jdocWrapParagraphFromLine. - * + * * @param document * @param line * @param always @@ -432,7 +432,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { if (!isLineTooLong(document, line) && !isLineTooShort(document, line)) return; } - + boolean caretRelativeToParagraphOffset= false; int caret= caretOffset[0]; @@ -449,7 +449,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { StringBuffer buffer= new StringBuffer(); int currentLine= line; while (line == currentLine || isJavaDocLine(document, currentLine)) { - + if (buffer.length() != 0 && !Character.isWhitespace(buffer.charAt(buffer.length() - 1))) { buffer.append(' '); if (currentLine <= caretLine) { @@ -458,12 +458,12 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { } } - String string= getLineContents(document, currentLine); + String string= getLineContents(document, currentLine); buffer.append(string); currentLine++; } String paragraph= buffer.toString(); - + if (paragraph.trim().length() == 0) return; @@ -477,32 +477,32 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { caretOffset[0]= caretRelativeToParagraphOffset ? caretOffset[0] + beginning : caret + beginning; } - + /** - * Line break iterator to handle whitespaces as first class citizens. + * Line break iterator to handle whitespaces as first class citizens. */ private static class LineBreakIterator { - + private final String fString; private final BreakIterator fIterator= BreakIterator.getLineInstance(); - + private int fStart; private int fEnd; private int fBufferedEnd; - + public LineBreakIterator(String string) { fString= string; fIterator.setText(string); } - + public int first() { fBufferedEnd= -1; fStart= fIterator.first(); - return fStart; + return fStart; } - + public int next() { - + if (fBufferedEnd != -1) { fStart= fEnd; fEnd= fBufferedEnd; @@ -525,16 +525,16 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { final String word= string.trim(); if (word.length() == string.length()) return fEnd; - + // suspected whitespace fBufferedEnd= fEnd; return fStart + word.length(); - } + } } - + /** - * Formats a paragraph, using break iterator. - * + * Formats a paragraph, using break iterator. + * * @param offset an offset within the paragraph, which will be updated with respect to formatting. */ private static String formatParagraph(String paragraph, int[] offset, String prefix, String lineDelimiter, int margin) { @@ -544,7 +544,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { StringBuffer paragraphBuffer= new StringBuffer(); StringBuffer lineBuffer= new StringBuffer(); StringBuffer whiteSpaceBuffer= new StringBuffer(); - + int index= offset[0]; int indexBuffer= -1; @@ -560,7 +560,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { if (word.trim().length() == 0) { whiteSpaceBuffer.append(word); - // first word of line is always appended + // first word of line is always appended } else if (lineBuffer.length() == 0) { lineBuffer.append(prefix); lineBuffer.append(whiteSpaceBuffer.toString()); @@ -568,8 +568,8 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { } else { String line= lineBuffer.toString() + whiteSpaceBuffer.toString() + word.toString(); - - // margin exceeded + + // margin exceeded if (calculateDisplayedWidth(line) > margin) { // flush line buffer and wrap paragraph paragraphBuffer.append(lineBuffer.toString()); @@ -604,23 +604,23 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { } } - // flush line buffer + // flush line buffer paragraphBuffer.append(lineBuffer.toString()); paragraphBuffer.append(lineDelimiter); // flush index buffer - if (indexBuffer != -1) + if (indexBuffer != -1) offset[0]= indexBuffer; // last position is not returned by break iterator else if (offset[0] == paragraph.length()) offset[0]= paragraphBuffer.length() - lineDelimiter.length(); - + return paragraphBuffer.toString(); } private static IPreferenceStore getPreferenceStore() { - return PHPeclipsePlugin.getDefault().getPreferenceStore(); + return PHPeclipsePlugin.getDefault().getPreferenceStore(); } /** @@ -629,7 +629,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { */ private static int calculateDisplayedWidth(String string) { - int tabWidth= getPreferenceStore().getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); + int tabWidth= getPreferenceStore().getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); if (tabWidth<=0) { tabWidth = 2; } @@ -639,7 +639,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { column += tabWidth - (column % tabWidth); else column++; - + return column; } @@ -666,10 +666,10 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { int trim = jdocExtractLinePrefix(d, line).length(); return lineContents.substring(trim); } - + private static String getLine(IDocument document, int line) throws BadLocationException { - IRegion region= document.getLineInformation(line); - return document.get(region.getOffset(), region.getLength()); + IRegion region= document.getLineInformation(line); + return document.get(region.getOffset(), region.getLength()); } /** @@ -702,14 +702,14 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { private static final String[] fgInlineTags= { "", "", "", "", "" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ }; - + private boolean isInlineTag(String string) { for (int i= 0; i < fgInlineTags.length; i++) if (string.startsWith(fgInlineTags[i])) - return true; + return true; return false; } - + /** * returns true if the specified line is part of a paragraph and should be merged with * the previous line. @@ -725,10 +725,10 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { length -= firstChar - offset; String lineContents= document.get(firstChar, length); - String prefix= lineContents.trim(); + String prefix= lineContents.trim(); if (!prefix.startsWith("*") || prefix.startsWith("*/")) //$NON-NLS-1$ //$NON-NLS-2$ return false; - + lineContents= lineContents.substring(1).trim().toLowerCase(); // preserve empty lines @@ -747,10 +747,10 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { } protected void jdocHandleBackspaceDelete(IDocument document, DocumentCommand c) { - + if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_FORMAT_JAVADOCS)) return; - + try { String text= document.get(c.offset, c.length); int line= document.getLineOfOffset(c.offset); @@ -759,7 +759,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { // erase line delimiter String lineDelimiter= document.getLineDelimiter(line); if (lineDelimiter != null && lineDelimiter.equals(text)) { - + String prefix= jdocExtractLinePrefix(document, line + 1); // strip prefix if any @@ -794,7 +794,7 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { } catch (BadLocationException e) { PHPeclipsePlugin.log(e); } - + try { int line= document.getLineOfOffset(c.offset); int lineOffset= document.getLineOffset(line); @@ -818,9 +818,9 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) return null; - + IWorkbenchPage page= window.getActivePage(); - if (page == null) + if (page == null) return null; IEditorPart editor= page.getActiveEditor(); @@ -834,5 +834,5 @@ public class JavaDocAutoIndentStrategy extends DefaultAutoIndentStrategy { return unit; } - + } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java index 61e3ce2..88e7f30 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java @@ -5,10 +5,7 @@ package net.sourceforge.phpdt.internal.ui.util; import java.io.File; -import java.util.ArrayList; import java.util.List; -import java.util.StringTokenizer; - import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil; @@ -17,7 +14,6 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IEditorRegistry; import org.eclipse.ui.IWorkbench; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/JavaElementImageProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/JavaElementImageProvider.java index 61ce116..627a491 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/JavaElementImageProvider.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/JavaElementImageProvider.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -32,6 +32,7 @@ import org.eclipse.jface.util.Assert; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.ide.IDE.SharedImages; import org.eclipse.ui.model.IWorkbenchAdapter; /** @@ -63,8 +64,8 @@ public class JavaElementImageProvider { private static ImageDescriptor DESC_OBJ_FOLDER; { ISharedImages images = PHPeclipsePlugin.getDefault().getWorkbench().getSharedImages(); - DESC_OBJ_PROJECT_CLOSED = images.getImageDescriptor(ISharedImages.IMG_OBJ_PROJECT_CLOSED); - DESC_OBJ_PROJECT = images.getImageDescriptor(ISharedImages.IMG_OBJ_PROJECT); + DESC_OBJ_PROJECT_CLOSED = images.getImageDescriptor(SharedImages.IMG_OBJ_PROJECT_CLOSED); + DESC_OBJ_PROJECT = images.getImageDescriptor(SharedImages.IMG_OBJ_PROJECT); DESC_OBJ_FOLDER = images.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); } @@ -219,7 +220,7 @@ public class JavaElementImageProvider { // } else { // return PHPUiImages.DESC_OBJS_JAR_WSRC; // } - // } + // } // } else { return PHPUiImages.DESC_OBJS_PACKFRAG_ROOT; // } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/MemberFilterAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/MemberFilterAction.java index 30080af..26e8b63 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/MemberFilterAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/viewsupport/MemberFilterAction.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -13,7 +13,7 @@ package net.sourceforge.phpdt.internal.ui.viewsupport; import net.sourceforge.phpdt.ui.actions.MemberFilterActionGroup; import org.eclipse.jface.action.Action; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; /** * Action used to enable / disable method filter properties @@ -22,29 +22,29 @@ public class MemberFilterAction extends Action { private int fFilterProperty; private MemberFilterActionGroup fFilterActionGroup; - + public MemberFilterAction(MemberFilterActionGroup actionGroup, String title, int property, String contextHelpId, boolean initValue) { super(title); fFilterActionGroup= actionGroup; fFilterProperty= property; - - WorkbenchHelp.setHelp(this, contextHelpId); + + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, contextHelpId); setChecked(initValue); } - + /** * Returns this action's filter property. */ public int getFilterProperty() { return fFilterProperty; } - + /* * @see Action#actionPerformed */ - public void run() { + public void run() { fFilterActionGroup.setMemberFilter(fFilterProperty, isChecked()); } - + } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ltk/ui/wizards/RenameLocalVariablePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ltk/ui/wizards/RenameLocalVariablePage.java index 366def6..9a536ce 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ltk/ui/wizards/RenameLocalVariablePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ltk/ui/wizards/RenameLocalVariablePage.java @@ -12,8 +12,6 @@ import org.eclipse.ltk.ui.refactoring.UserInputWizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java index 58bf8da..46d386a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html - * + * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ @@ -29,10 +29,10 @@ import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.actions.ActionGroup; import org.eclipse.ui.actions.AddBookmarkAction; +import org.eclipse.ui.ide.IDEActionFactory; import org.eclipse.ui.part.Page; import org.eclipse.ui.texteditor.ConvertLineDelimitersAction; import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; @@ -41,27 +41,27 @@ import org.eclipse.ui.texteditor.IUpdate; /** * Action group that adds the source and generate actions to a part's context * menu and installs handlers for the corresponding global menu actions. - * + * *

    * This class may be instantiated; it is not intended to be subclassed. *

    - * + * * @since 2.0 */ public class GenerateActionGroup extends ActionGroup { /** * Pop-up menu: id of the source sub menu (value net.sourceforge.phpdt.ui.source.menu). - * + * * @since 3.0 */ public static final String MENU_ID= "net.sourceforge.pheclipse.ui.source.menu"; //$NON-NLS-1$ - + private PHPEditor fEditor; // private boolean fEditorIsOwner; private IWorkbenchSite fSite; private String fGroupName= IContextMenuConstants.GROUP_SOURCE; private List fRegisteredSelectionListeners; - + // private AddImportOnSelectionAction fAddImport; // private OverrideMethodsAction fOverrideMethods; // private AddGetterSetterAction fAddGetterSetter; @@ -72,13 +72,13 @@ public class GenerateActionGroup extends ActionGroup { // private ExternalizeStringsAction fExternalizeStrings; // private FindStringsToExternalizeAction fFindStringsToExternalize; // private SurroundWithTryCatchAction fSurroundWithTryCatch; - + // private OrganizeImportsAction fOrganizeImports; private ConvertLineDelimitersAction fConvertToWindows; private ConvertLineDelimitersAction fConvertToUNIX; private ConvertLineDelimitersAction fConvertToMac; - + /** * Note: This constructor is for internal use only. Clients should not call this constructor. */ @@ -86,7 +86,7 @@ public class GenerateActionGroup extends ActionGroup { fSite= editor.getSite(); fEditor= editor; fGroupName= groupName; - + ISelectionProvider provider= fSite.getSelectionProvider(); ISelection selection= provider.getSelection(); @@ -94,7 +94,7 @@ public class GenerateActionGroup extends ActionGroup { // fAddImport.setActionDefinitionId(IJavaEditorActionDefinitionIds.ADD_IMPORT); // fAddImport.update(); // editor.setAction("AddImport", fAddImport); //$NON-NLS-1$ - + // fOrganizeImports= new OrganizeImportsAction(editor); // fOrganizeImports.setActionDefinitionId(IJavaEditorActionDefinitionIds.ORGANIZE_IMPORTS); // fOrganizeImports.editorStateChanged(); @@ -104,49 +104,49 @@ public class GenerateActionGroup extends ActionGroup { // fOverrideMethods.setActionDefinitionId(IJavaEditorActionDefinitionIds.OVERRIDE_METHODS); // fOverrideMethods.editorStateChanged(); // editor.setAction("OverrideMethods", fOverrideMethods); //$NON-NLS-1$ - + // fAddGetterSetter= new AddGetterSetterAction(editor); // fAddGetterSetter.setActionDefinitionId(IJavaEditorActionDefinitionIds.CREATE_GETTER_SETTER); // fAddGetterSetter.editorStateChanged(); // editor.setAction("AddGetterSetter", fAddGetterSetter); //$NON-NLS-1$ - + // fAddUnimplementedConstructors= new AddUnimplementedConstructorsAction(editor); // fAddUnimplementedConstructors.setActionDefinitionId(IJavaEditorActionDefinitionIds.ADD_UNIMPLEMENTED_CONTRUCTORS); // fAddUnimplementedConstructors.editorStateChanged(); -// editor.setAction("AddUnimplementedConstructors", fAddUnimplementedConstructors); //$NON-NLS-1$ - +// editor.setAction("AddUnimplementedConstructors", fAddUnimplementedConstructors); //$NON-NLS-1$ + // fAddJavaDocStub= new AddJavaDocStubAction(editor); // fAddJavaDocStub.editorStateChanged(); -// +// // fSurroundWithTryCatch= new SurroundWithTryCatchAction(editor); // fSurroundWithTryCatch.setActionDefinitionId(IJavaEditorActionDefinitionIds.SURROUND_WITH_TRY_CATCH); // fSurroundWithTryCatch.update(selection); // provider.addSelectionChangedListener(fSurroundWithTryCatch); -// editor.setAction("SurroundWithTryCatch", fSurroundWithTryCatch); //$NON-NLS-1$ -// +// editor.setAction("SurroundWithTryCatch", fSurroundWithTryCatch); //$NON-NLS-1$ +// // fExternalizeStrings= new ExternalizeStringsAction(editor); // fExternalizeStrings.setActionDefinitionId(IJavaEditorActionDefinitionIds.EXTERNALIZE_STRINGS); // fExternalizeStrings.editorStateChanged(); -// editor.setAction("ExternalizeStrings", fExternalizeStrings); //$NON-NLS-1$ - +// editor.setAction("ExternalizeStrings", fExternalizeStrings); //$NON-NLS-1$ + fConvertToWindows= new ConvertLineDelimitersAction(editor, "\r\n"); //$NON-NLS-1$ fConvertToWindows.setActionDefinitionId( ITextEditorActionDefinitionIds .CONVERT_LINE_DELIMITERS_TO_WINDOWS); - editor.setAction("ConvertLineDelimitersToWindows", fConvertToWindows); //$NON-NLS-1$ - + editor.setAction("ConvertLineDelimitersToWindows", fConvertToWindows); //$NON-NLS-1$ + fConvertToUNIX= new ConvertLineDelimitersAction(editor, "\n"); //$NON-NLS-1$ fConvertToUNIX.setActionDefinitionId( ITextEditorActionDefinitionIds .CONVERT_LINE_DELIMITERS_TO_UNIX); - editor.setAction("ConvertLineDelimitersToUNIX", fConvertToUNIX); //$NON-NLS-1$ + editor.setAction("ConvertLineDelimitersToUNIX", fConvertToUNIX); //$NON-NLS-1$ fConvertToMac= new ConvertLineDelimitersAction(editor, "\r"); //$NON-NLS-1$ fConvertToMac.setActionDefinitionId( ITextEditorActionDefinitionIds .CONVERT_LINE_DELIMITERS_TO_MAC); - editor.setAction("ConvertLineDelimitersToMac", fConvertToMac); //$NON-NLS-1$ + editor.setAction("ConvertLineDelimitersToMac", fConvertToMac); //$NON-NLS-1$ } - + /** - * Creates a new GenerateActionGroup. The group - * requires that the selection provided by the page's selection provider + * Creates a new GenerateActionGroup. The group + * requires that the selection provided by the page's selection provider * is of type org.eclipse.jface.viewers.IStructuredSelection. - * + * * @param page the page that owns this action group */ public GenerateActionGroup(Page page) { @@ -154,21 +154,21 @@ public class GenerateActionGroup extends ActionGroup { } /** - * Creates a new GenerateActionGroup. The group - * requires that the selection provided by the part's selection provider + * Creates a new GenerateActionGroup. The group + * requires that the selection provided by the part's selection provider * is of type org.eclipse.jface.viewers.IStructuredSelection. - * + * * @param part the view part that owns this action group */ public GenerateActionGroup(IViewPart part) { this(part.getSite()); } - + private GenerateActionGroup(IWorkbenchSite site) { fSite= site; ISelectionProvider provider= fSite.getSelectionProvider(); ISelection selection= provider.getSelection(); - + // fOverrideMethods= new OverrideMethodsAction(site); // fAddGetterSetter= new AddGetterSetterAction(site); // fAddUnimplementedConstructors= new AddUnimplementedConstructorsAction(site); @@ -178,10 +178,10 @@ public class GenerateActionGroup extends ActionGroup { // fExternalizeStrings= new ExternalizeStringsAction(site); // fFindStringsToExternalize= new FindStringsToExternalizeAction(site); // fOrganizeImports= new OrganizeImportsAction(site); -// +// // fOverrideMethods.update(selection); // fAddGetterSetter.update(selection); -// fAddUnimplementedConstructors.update(selection); +// fAddUnimplementedConstructors.update(selection); // fAddJavaDocStub.update(selection); // fExternalizeStrings.update(selection); // fFindStringsToExternalize.update(selection); @@ -193,7 +193,7 @@ public class GenerateActionGroup extends ActionGroup { } else { fAddBookmark.setEnabled(false); } - + // registerSelectionListener(provider, fOverrideMethods); // registerSelectionListener(provider, fAddGetterSetter); // registerSelectionListener(provider, fAddUnimplementedConstructors); @@ -204,16 +204,16 @@ public class GenerateActionGroup extends ActionGroup { // registerSelectionListener(provider, fOrganizeImports); registerSelectionListener(provider, fAddTaskAction); } - + private void registerSelectionListener(ISelectionProvider provider, ISelectionChangedListener listener) { if (fRegisteredSelectionListeners == null) fRegisteredSelectionListeners= new ArrayList(12); provider.addSelectionChangedListener(listener); fRegisteredSelectionListeners.add(listener); } - + /* - * The state of the editor owning this action group has changed. + * The state of the editor owning this action group has changed. * This method does nothing if the group's owner isn't an * editor. */ @@ -222,7 +222,7 @@ public class GenerateActionGroup extends ActionGroup { */ public void editorStateChanged() { Assert.isTrue(isEditorOwner()); - + // http://dev.eclipse.org/bugs/show_bug.cgi?id=17709 fConvertToMac.update(); fConvertToUNIX.update(); @@ -236,7 +236,7 @@ public class GenerateActionGroup extends ActionGroup { super.fillActionBars(actionBar); setGlobalActionHandlers(actionBar); } - + /* (non-Javadoc) * Method declared in ActionGroup */ @@ -274,14 +274,14 @@ public class GenerateActionGroup extends ActionGroup { String shortCut= null; //$NON-NLS-1$ // if (fQuickAccessAction != null) { // shortCut= fQuickAccessAction.getShortCutString(); //$NON-NLS-1$ -// } +// } IMenuManager subMenu= new MenuManager( ActionMessages.getString("SourceMenu.label") + (shortCut != null ? "\t" + shortCut : ""), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - MENU_ID); + MENU_ID); int added= 0; if (isEditorOwner()) { added= fillEditorSubMenu(subMenu); - } + } // else { // added= fillViewSubMenu(subMenu); // } @@ -307,7 +307,7 @@ public class GenerateActionGroup extends ActionGroup { // added+= addAction(result, fAddUnimplementedConstructors); // added+= addAction(result, fAddJavaDocStub); // added+= addAction(result, fAddBookmark); -// result.add(new Separator()); +// result.add(new Separator()); // added+= addAction(result, fSurroundWithTryCatch); // added+= addAction(result, fExternalizeStrings); // if (added == 0) @@ -328,7 +328,7 @@ public class GenerateActionGroup extends ActionGroup { fEditor= null; super.dispose(); } - + private void setGlobalActionHandlers(IActionBars actionBar) { // actionBar.setGlobalActionHandler(JdtActionConstants.ADD_IMPORT, fAddImport); // actionBar.setGlobalActionHandler(JdtActionConstants.SURROUND_WITH_TRY_CATCH, fSurroundWithTryCatch); @@ -344,18 +344,18 @@ public class GenerateActionGroup extends ActionGroup { actionBar.setGlobalActionHandler(PHPdtActionConstants.CONVERT_LINE_DELIMITERS_TO_MAC, fConvertToMac); if (!isEditorOwner()) { // editor provides its own implementation of these actions. - actionBar.setGlobalActionHandler(IWorkbenchActionConstants.BOOKMARK, fAddBookmark); - actionBar.setGlobalActionHandler(IWorkbenchActionConstants.ADD_TASK, fAddTaskAction); + actionBar.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), fAddBookmark); + actionBar.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(), fAddTaskAction); } } - + 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()) { @@ -363,8 +363,8 @@ public class GenerateActionGroup extends ActionGroup { return 1; } return 0; - } - + } + private int addEditorAction(IMenuManager menu, String actionID) { if (fEditor == null) return 0; @@ -379,8 +379,8 @@ public class GenerateActionGroup extends ActionGroup { } return 0; } - + private boolean isEditorOwner() { return fEditor != null; - } + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java index e9edc5e..1c69685 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java @@ -17,7 +17,6 @@ import net.sourceforge.phpeclipse.phpeditor.php.PHPPartitionScanner; import net.sourceforge.phpeclipse.phpeditor.php.SmartyCodeScanner; import net.sourceforge.phpeclipse.phpeditor.php.SmartyDocCodeScanner; import net.sourceforge.phpeclipse.xml.ui.XMLPlugin; -import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLPartitionScanner; import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools; import org.eclipse.core.runtime.Preferences; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java index d749720..9973c82 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java @@ -24,7 +24,6 @@ import net.sourceforge.phpdt.internal.ui.text.JavaElementProvider; import net.sourceforge.phpdt.internal.ui.text.JavaOutlineInformationControl; import net.sourceforge.phpdt.internal.ui.text.JavaPresentationReconciler; import net.sourceforge.phpdt.internal.ui.text.JavaReconciler; -import net.sourceforge.phpdt.internal.ui.text.PreferencesAdapter; import net.sourceforge.phpdt.internal.ui.text.java.JavaFormattingStrategy; import net.sourceforge.phpdt.internal.ui.text.java.JavaStringAutoIndentStrategyDQ; import net.sourceforge.phpdt.internal.ui.text.java.JavaStringAutoIndentStrategySQ; @@ -51,9 +50,9 @@ import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.DefaultAutoIndentStrategy; +import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; import org.eclipse.jface.text.DefaultInformationControl; -import org.eclipse.jface.text.IAutoIndentStrategy; +import org.eclipse.jface.text.IAutoEditStrategy; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlCreator; @@ -83,12 +82,9 @@ import org.eclipse.jface.text.rules.Token; import org.eclipse.jface.text.source.IAnnotationHover; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.SourceViewerConfiguration; -import org.eclipse.jface.util.Assert; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.editors.text.EditorsUI; -import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.eclipse.ui.texteditor.ITextEditor; /** @@ -413,7 +409,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration { /* * (non-Javadoc) Method declared on SourceViewerConfiguration */ - public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) { + public IAutoEditStrategy getAutoEditStrategy(ISourceViewer sourceViewer, String contentType) { if (IPHPPartitions.PHP_PHPDOC_COMMENT.equals(contentType) || IPHPPartitions.PHP_MULTILINE_COMMENT.equals(contentType)) return new JavaDocAutoIndentStrategy(getConfiguredDocumentPartitioning(sourceViewer)); @@ -425,7 +421,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration { return (PHPDocumentPartitioner.PHP_TEMPLATE_DATA.equals(contentType) || PHPDocumentPartitioner.PHP_SCRIPT_CODE.equals(contentType) || IDocument.DEFAULT_CONTENT_TYPE.equals(contentType) || IPHPPartitions.PHP_PARTITIONING.equals(contentType) || PHPPartitionScanner.PHP_SCRIPTING_AREA.equals(contentType) ? new PHPAutoIndentStrategy() - : new DefaultAutoIndentStrategy()); + : new DefaultIndentLineAutoEditStrategy()); } /** diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index 622ca18..46e566a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -494,7 +494,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } static IPath getInstallLocation() { - return new Path(getDefault().getDescriptor().getInstallURL().getFile()); + return new Path(getDefault().getBundle().getEntry("/").getFile()); } // public static int getJVM() { @@ -502,7 +502,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // } public static String getPluginId() { - return getDefault().getDescriptor().getUniqueIdentifier(); + return getDefault().getBundle().getSymbolicName() ; } /** @@ -711,10 +711,10 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon InputStream is = getDefault().openStream( new Path("prefs/default_" + operatingSystem + ".properties")); PropertyResourceBundle resourceBundle = new PropertyResourceBundle(is); - Enumeration enum = resourceBundle.getKeys(); + Enumeration e = resourceBundle.getKeys(); String key; - while (enum.hasMoreElements()) { - key = (String)enum.nextElement(); + while (e.hasMoreElements()) { + key = (String)e.nextElement(); store.setDefault(key, resourceBundle.getString( key )); } } catch (Exception e) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/export/ObfuscatorExportWizard.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/export/ObfuscatorExportWizard.java index 5fbd7b8..3e92b98 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/export/ObfuscatorExportWizard.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/export/ObfuscatorExportWizard.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -44,7 +44,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; * dialog.open(); * * During the call to open, the wizard dialog is presented to the - * user. When the user hits Finish, the user-selected workspace resources + * user. When the user hits Finish, the user-selected workspace resources * are exported to the user-specified location in the local file system, * the dialog closes, and the call to open returns. *

    @@ -76,10 +76,10 @@ public void addPages() { * Returns the image descriptor with the given relative path. */ private ImageDescriptor getImageDescriptor(String relativePath) { - String iconPath = "icons/full/";//$NON-NLS-1$ + String iconPath = "icons/full/";//$NON-NLS-1$ try { AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID); - URL installURL = plugin.getDescriptor().getInstallURL(); + URL installURL = plugin.getBundle().getEntry("/"); URL url = new URL(installURL, iconPath + relativePath); return ImageDescriptor.createFromURL(url); } @@ -93,12 +93,12 @@ private ImageDescriptor getImageDescriptor(String relativePath) { */ public void init(IWorkbench workbench, IStructuredSelection currentSelection) { this.workbench = workbench; - - + + //Make it the current selection by default but look it up otherwise - + selection = currentSelection; - + if(currentSelection.isEmpty() && workbench.getActiveWorkbenchWindow() != null){ IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage(); if(page != null){ @@ -121,5 +121,5 @@ public void init(IWorkbench workbench, IStructuredSelection currentSelection) { public boolean performFinish() { return mainPage.finish(); } - + } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/BracketPainter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/BracketPainter.java index 55eea03..e105679 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/BracketPainter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/BracketPainter.java @@ -8,7 +8,7 @@ package net.sourceforge.phpeclipse.phpeditor; import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher; import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITextViewerExtension3; +import org.eclipse.jface.text.ITextViewerExtension5; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.Region; import org.eclipse.jface.text.source.ISourceViewer; @@ -21,38 +21,38 @@ import org.eclipse.swt.graphics.Point; public final class BracketPainter implements IPainter, PaintListener { - + private PHPPairMatcher fMatcher= new PHPPairMatcher(new char[] { '{', '}', '(', ')', '[', ']' }); private Position fBracketPosition= new Position(0, 0); private int fAnchor; - + private boolean fIsActive= false; private ISourceViewer fSourceViewer; private StyledText fTextWidget; private Color fColor; - + private IPositionManager fPositionManager; - - + + public BracketPainter(ISourceViewer sourceViewer) { fSourceViewer= sourceViewer; fTextWidget= sourceViewer.getTextWidget(); } - + public void setHighlightColor(Color color) { fColor= color; } - + public void dispose() { if (fMatcher != null) { fMatcher.dispose(); fMatcher= null; } - + fColor= null; fTextWidget= null; } - + public void deactivate(boolean redraw) { if (fIsActive) { fIsActive= false; @@ -63,57 +63,57 @@ public final class BracketPainter implements IPainter, PaintListener { handleDrawRequest(null); } } - + public void paintControl(PaintEvent event) { if (fTextWidget != null) handleDrawRequest(event.gc); } - + private void handleDrawRequest(GC gc) { - + if (fBracketPosition.isDeleted) return; - + int offset= fBracketPosition.getOffset(); int length= fBracketPosition.getLength(); if (length < 1) return; - - if (fSourceViewer instanceof ITextViewerExtension3) { - ITextViewerExtension3 extension= (ITextViewerExtension3) fSourceViewer; + + if (fSourceViewer instanceof ITextViewerExtension5) { + ITextViewerExtension5 extension= (ITextViewerExtension5) fSourceViewer; IRegion widgetRange= extension.modelRange2WidgetRange(new Region(offset, length)); if (widgetRange == null) return; - + offset= widgetRange.getOffset(); length= widgetRange.getLength(); - + } else { IRegion region= fSourceViewer.getVisibleRegion(); if (region.getOffset() > offset || region.getOffset() + region.getLength() < offset + length) return; offset -= region.getOffset(); } - + if (PHPPairMatcher.RIGHT == fAnchor) draw(gc, offset, 1); - else + else draw(gc, offset + length -1, 1); } - + private void draw(GC gc, int offset, int length) { if (gc != null) { Point left= fTextWidget.getLocationAtOffset(offset); Point right= fTextWidget.getLocationAtOffset(offset + length); - + gc.setForeground(fColor); gc.drawRectangle(left.x, left.y, right.x - left.x - 1, gc.getFontMetrics().getHeight() - 1); - + } else { fTextWidget.redrawRange(offset, length, true); } } - + /* * @see IPainter#paint(int) */ @@ -123,19 +123,19 @@ public final class BracketPainter implements IPainter, PaintListener { deactivate(true); return; } - + IRegion pair= fMatcher.match(fSourceViewer.getDocument(), selection.x); if (pair == null) { deactivate(true); return; } - + if (fIsActive) { // only if different - if (pair.getOffset() != fBracketPosition.getOffset() || - pair.getLength() != fBracketPosition.getLength() || + if (pair.getOffset() != fBracketPosition.getOffset() || + pair.getLength() != fBracketPosition.getLength() || fMatcher.getAnchor() != fAnchor) { - + // remove old highlighting handleDrawRequest(null); // update position @@ -145,23 +145,23 @@ public final class BracketPainter implements IPainter, PaintListener { fAnchor= fMatcher.getAnchor(); // apply new highlighting handleDrawRequest(null); - + } } else { - + fIsActive= true; - + fBracketPosition.isDeleted= false; fBracketPosition.offset= pair.getOffset(); fBracketPosition.length= pair.getLength(); fAnchor= fMatcher.getAnchor(); - + fTextWidget.addPaintListener(this); fPositionManager.addManagedPosition(fBracketPosition); handleDrawRequest(null); } } - + /* * @see IPainter#setPositionManager(IPositionManager) */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/DocumentAdapter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/DocumentAdapter.java index 85dacc1..006503e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/DocumentAdapter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/DocumentAdapter.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -47,12 +47,12 @@ import org.eclipse.swt.widgets.Display; /** * Adapts IDocument to IBuffer. Uses the - * same algorithm as the text widget to determine the buffer's line delimiter. + * same algorithm as the text widget to determine the buffer's line delimiter. * All text inserted into the buffer is converted to this line delimiter. * This class is public for test purposes only. */ public class DocumentAdapter implements IBuffer, IDocumentListener { - + /** * Internal implementation of a NULL instanceof IBuffer. */ @@ -78,38 +78,38 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { public void setContents(char[] contents) {} public void setContents(String contents) {} } - - + + /** NULL implementing IBuffer */ public final static IBuffer NULL= new NullBuffer(); - - + + /** * Executes a document set content call in the ui thread. */ protected class DocumentSetCommand implements Runnable { - + private String fContents; - + public void run() { fDocument.set(fContents); } - + public void set(String contents) { fContents= contents; Display.getDefault().syncExec(this); } } - + /** * Executes a document replace call in the ui thread. */ protected class DocumentReplaceCommand implements Runnable { - + private int fOffset; private int fLength; private String fText; - + public void run() { try { fDocument.replace(fOffset, fLength, fText); @@ -117,7 +117,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { // ignore } } - + public void replace(int offset, int length, String text) { fOffset= offset; fLength= length; @@ -125,34 +125,34 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { Display.getDefault().syncExec(this); } } - + private static final boolean DEBUG_LINE_DELIMITERS= true; - + private IOpenable fOwner; private IFile fFile; private ITextFileBuffer fTextFileBuffer; private IDocument fDocument; - + private DocumentSetCommand fSetCmd= new DocumentSetCommand(); private DocumentReplaceCommand fReplaceCmd= new DocumentReplaceCommand(); - + private Set fLegalLineDelimiters; - + private List fBufferListeners= new ArrayList(3); private IStatus fStatus; - - + + /** * This method is public for test purposes only. */ public DocumentAdapter(IOpenable owner, IFile file) { - + fOwner= owner; fFile= file; - + initialize(); } - + private void initialize() { ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); IPath location= fFile.getFullPath(); @@ -166,7 +166,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { } fDocument.addPrenotifiedDocumentListener(this); } - + /** * Returns the status of this document adapter. */ @@ -177,16 +177,16 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { return fTextFileBuffer.getStatus(); return null; } - + /** * Returns the adapted document. - * + * * @return the adapted document */ public IDocument getDocument() { return fDocument; } - + /* * @see IBuffer#addBufferChangedListener(IBufferChangedListener) */ @@ -195,7 +195,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { if (!fBufferListeners.contains(listener)) fBufferListeners.add(listener); } - + /* * @see IBuffer#removeBufferChangedListener(IBufferChangedListener) */ @@ -203,16 +203,16 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { Assert.isNotNull(listener); fBufferListeners.remove(listener); } - + /* * @see IBuffer#append(char[]) */ public void append(char[] text) { append(new String(text)); } - + /* - * @see IBuffer#append(String) + * @see IBuffer#append(String) */ public void append(String text) { if (DEBUG_LINE_DELIMITERS) { @@ -220,19 +220,19 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { } fReplaceCmd.replace(fDocument.getLength(), 0, text); } - + /* * @see IBuffer#close() */ public void close() { - + if (isClosed()) return; - + IDocument d= fDocument; fDocument= null; d.removePrenotifiedDocumentListener(this); - + if (fTextFileBuffer != null) { ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); try { @@ -242,11 +242,11 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { } fTextFileBuffer= null; } - + fireBufferChanged(new BufferChangedEvent(this, 0, 0, null)); fBufferListeners.clear(); } - + /* * @see IBuffer#getChar(int) */ @@ -257,7 +257,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { throw new ArrayIndexOutOfBoundsException(); } } - + /* * @see IBuffer#getCharacters() */ @@ -265,28 +265,28 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { String content= getContents(); return content == null ? null : content.toCharArray(); } - + /* * @see IBuffer#getContents() */ public String getContents() { return fDocument.get(); } - + /* * @see IBuffer#getLength() */ public int getLength() { return fDocument.getLength(); } - + /* * @see IBuffer#getOwner() */ public IOpenable getOwner() { return fOwner; } - + /* * @see IBuffer#getText(int, int) */ @@ -297,43 +297,43 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { throw new ArrayIndexOutOfBoundsException(); } } - + /* * @see IBuffer#getUnderlyingResource() */ public IResource getUnderlyingResource() { return fFile; } - + /* * @see IBuffer#hasUnsavedChanges() */ public boolean hasUnsavedChanges() { return fTextFileBuffer != null ? fTextFileBuffer.isDirty() : false; } - + /* * @see IBuffer#isClosed() */ public boolean isClosed() { return fDocument == null; } - + /* * @see IBuffer#isReadOnly() */ public boolean isReadOnly() { IResource resource= getUnderlyingResource(); - return resource == null ? true : resource.isReadOnly(); + return resource == null ? true : resource.getResourceAttributes().isReadOnly(); } - + /* * @see IBuffer#replace(int, int, char[]) */ public void replace(int position, int length, char[] text) { replace(position, length, new String(text)); } - + /* * @see IBuffer#replace(int, int, String) */ @@ -343,7 +343,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { } fReplaceCmd.replace(position, length, text); } - + /* * @see IBuffer#save(IProgressMonitor, boolean) */ @@ -355,38 +355,38 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { throw new JavaModelException(e); } } - + /* * @see IBuffer#setContents(char[]) */ public void setContents(char[] contents) { setContents(new String(contents)); } - + /* * @see IBuffer#setContents(String) */ public void setContents(String contents) { int oldLength= fDocument.getLength(); - + if (contents == null) { - + if (oldLength != 0) fSetCmd.set(""); //$NON-NLS-1$ - + } else { - + // set only if different if (DEBUG_LINE_DELIMITERS) { validateLineDelimiters(contents); } - + if (!contents.equals(fDocument.get())) fSetCmd.set(contents); } } - - + + private void validateLineDelimiters(String contents) { if (fLegalLineDelimiters == null) { @@ -407,16 +407,16 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { return; // first insertion of a line delimiter: no test } fLegalLineDelimiters= existingDelimiters; - + } - + DefaultLineTracker tracker= new DefaultLineTracker(); tracker.set(contents); - + int lines= tracker.getNumberOfLines(); if (lines <= 1) return; - + for (int i= 0; i < lines; i++) { try { String curr= tracker.getLineDelimiter(i); @@ -446,7 +446,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { public void documentChanged(DocumentEvent event) { fireBufferChanged(new BufferChangedEvent(this, event.getOffset(), event.getLength(), event.getText())); } - + private void fireBufferChanged(BufferChangedEvent event) { if (fBufferListeners != null && fBufferListeners.size() > 0) { Iterator e= new ArrayList(fBufferListeners).iterator(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/GotoAnnotationAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/GotoAnnotationAction.java index 194a237..f82eb05 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/GotoAnnotationAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/GotoAnnotationAction.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -13,35 +13,35 @@ package net.sourceforge.phpeclipse.phpeditor; import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.TextEditorAction; public class GotoAnnotationAction extends TextEditorAction { - + private boolean fForward; - + public GotoAnnotationAction(String prefix, boolean forward) { super(PHPEditorMessages.getResourceBundle(), prefix, null); fForward= forward; if (forward) - WorkbenchHelp.setHelp(this, IJavaHelpContextIds.GOTO_NEXT_ERROR_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GOTO_NEXT_ERROR_ACTION); else - WorkbenchHelp.setHelp(this, IJavaHelpContextIds.GOTO_PREVIOUS_ERROR_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GOTO_PREVIOUS_ERROR_ACTION); } - + public void run() { PHPEditor e= (PHPEditor) getTextEditor(); e.gotoAnnotation(fForward); } - + public void setEditor(ITextEditor editor) { - if (editor instanceof PHPEditor) + if (editor instanceof PHPEditor) super.setEditor(editor); update(); } - + public void update() { setEnabled(getTextEditor() instanceof PHPEditor); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/GotoErrorAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/GotoErrorAction.java index a4e1010..bbfb96f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/GotoErrorAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/GotoErrorAction.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -13,35 +13,35 @@ package net.sourceforge.phpeclipse.phpeditor; import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.TextEditorAction; public class GotoErrorAction extends TextEditorAction { - + private boolean fForward; - + public GotoErrorAction(String prefix, boolean forward) { super(PHPEditorMessages.getResourceBundle(), prefix, null); fForward= forward; if (forward) - WorkbenchHelp.setHelp(this, IJavaHelpContextIds.GOTO_NEXT_ERROR_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GOTO_NEXT_ERROR_ACTION); else - WorkbenchHelp.setHelp(this, IJavaHelpContextIds.GOTO_PREVIOUS_ERROR_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GOTO_PREVIOUS_ERROR_ACTION); } - + public void run() { PHPEditor e= (PHPEditor) getTextEditor(); e.gotoError(fForward); } - + public void setEditor(ITextEditor editor) { - if (editor instanceof PHPEditor) + if (editor instanceof PHPEditor) super.setEditor(editor); update(); } - + public void update() { setEnabled(getTextEditor() instanceof PHPEditor); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java index 8fcbaf0..c552344 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -90,9 +90,10 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.IActionBars; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.ActionContext; +import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionGroup; -import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.model.IWorkbenchAdapter; import org.eclipse.ui.model.WorkbenchAdapter; import org.eclipse.ui.part.IPageSite; @@ -118,18 +119,18 @@ import org.eclipse.ui.views.navigator.LocalSelectionTransfer; public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdaptable , IPostSelectionProvider { static Object[] NO_CHILDREN= new Object[0]; - + /** * The element change listener of the java outline viewer. * @see IElementChangedListener */ class ElementChangedListener implements IElementChangedListener { - + public void elementChanged(final ElementChangedEvent e) { - + if (getControl() == null) return; - + Display d= getControl().getDisplay(); if (d != null) { d.asyncExec(new Runnable() { @@ -152,7 +153,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt }); } } - + private boolean isPossibleStructuralChange(IJavaElementDelta cuDelta) { if (cuDelta.getKind() != IJavaElementDelta.CHANGED) { return true; // add or remove @@ -163,39 +164,39 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } return (flags & (IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_FINE_GRAINED)) == IJavaElementDelta.F_CONTENT; } - + protected IJavaElementDelta findElement(IJavaElement unit, IJavaElementDelta delta) { - + if (delta == null || unit == null) return null; - + IJavaElement element= delta.getElement(); - + if (unit.equals(element)) { if (isPossibleStructuralChange(delta)) { return delta; } return null; } - - + + if (element.getElementType() > IJavaElement.CLASS_FILE) return null; - + IJavaElementDelta[] children= delta.getAffectedChildren(); if (children == null || children.length == 0) return null; - + for (int i= 0; i < children.length; i++) { IJavaElementDelta d= findElement(unit, children[i]); if (d != null) return d; } - + return null; } } - + static class NoClassElement extends WorkbenchAdapter implements IAdaptable { /* * @see java.lang.Object#toString() @@ -203,7 +204,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt public String toString() { return PHPEditorMessages.getString("JavaOutlinePage.error.NoTopLevelType"); //$NON-NLS-1$ } - + /* * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) */ @@ -213,17 +214,17 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt return null; } } - + /** * Content provider for the children of an ICompilationUnit or * an IClassFile * @see ITreeContentProvider */ class ChildrenProvider implements ITreeContentProvider { - + private Object[] NO_CLASS= new Object[] {new NoClassElement()}; private ElementChangedListener fListener; - + protected boolean matches(IJavaElement element) { if (element.getElementType() == IJavaElement.METHOD) { String name= element.getElementName(); @@ -231,7 +232,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } return false; } - + protected IJavaElement[] filter(IJavaElement[] children) { boolean initializers= false; for (int i= 0; i < children.length; i++) { @@ -240,22 +241,22 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt break; } } - + if (!initializers) return children; - + Vector v= new Vector(); for (int i= 0; i < children.length; i++) { if (matches(children[i])) continue; v.addElement(children[i]); } - + IJavaElement[] result= new IJavaElement[v.size()]; v.copyInto(result); return result; } - + public Object[] getChildren(Object parent) { if (parent instanceof IParent) { IParent c= (IParent) parent; @@ -272,7 +273,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } return NO_CHILDREN; } - + public Object[] getElements(Object parent) { if (fTopLevelTypeOnly) { if (parent instanceof ICompilationUnit) { @@ -282,19 +283,19 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } catch (JavaModelException e) { PHPeclipsePlugin.log(e); } - } + } // else if (parent instanceof IClassFile) { // try { // IType type= getMainType((IClassFile) parent); // return type != null ? type.getChildren() : NO_CLASS; // } catch (JavaModelException e) { // PHPeclipsePlugin.log(e); -// } +// } // } } return getChildren(parent); } - + public Object getParent(Object child) { if (child instanceof IJavaElement) { IJavaElement e= (IJavaElement) child; @@ -302,7 +303,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } return null; } - + public boolean hasChildren(Object parent) { if (parent instanceof IParent) { IParent c= (IParent) parent; @@ -320,24 +321,24 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } return false; } - + public boolean isDeleted(Object o) { return false; } - + public void dispose() { if (fListener != null) { JavaCore.removeElementChangedListener(fListener); fListener= null; - } + } } - + /* * @see IContentProvider#inputChanged(Viewer, Object, Object) */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { boolean isCU= (newInput instanceof ICompilationUnit); - + if (isCU && fListener == null) { fListener= new ElementChangedListener(); JavaCore.addElementChangedListener(fListener); @@ -347,10 +348,10 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } } } - - + + class JavaOutlineViewer extends TreeViewer { - + /** * Indicates an item which has been reused. At the point of * its reuse it has been expanded. This field is used to @@ -360,17 +361,17 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt private Item fReusedExpandedItem; private boolean fReorderedMembers; private boolean fForceFireSelectionChanged; - + public JavaOutlineViewer(Tree tree) { super(tree); setAutoExpandLevel(ALL_LEVELS); setUseHashlookup(true); } - + /** * Investigates the given element change event and if affected * incrementally updates the Java outline. - * + * * @param delta the Java element delta used to reconcile the Java outline */ public void reconcile(IJavaElementDelta delta) { @@ -399,7 +400,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt refresh(true); } } - + /* * @see TreeViewer#internalExpandToLevel */ @@ -418,31 +419,31 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } super.internalExpandToLevel(node, level); } - + protected void reuseTreeItem(Item item, Object element) { - + // remove children Item[] c= getChildren(item); if (c != null && c.length > 0) { - + if (getExpanded(item)) fReusedExpandedItem= item; - + for (int k= 0; k < c.length; k++) { if (c[k].getData() != null) disassociate(c[k]); c[k].dispose(); } } - + updateItem(item, element); updatePlus(item, element); internalExpandToLevel(item, ALL_LEVELS); - + fReusedExpandedItem= null; fForceFireSelectionChanged= true; } - + protected boolean mustUpdateParent(IJavaElementDelta delta, IJavaElement element) { if (element instanceof IMethod) { if ((delta.getKind() & IJavaElementDelta.ADDED) != 0) { @@ -456,7 +457,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } return false; } - + /* * @see org.eclipse.jface.viewers.AbstractTreeViewer#isExpandable(java.lang.Object) */ @@ -466,7 +467,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } return super.isExpandable(element); } - + protected ISourceRange getSourceRange(IJavaElement element) throws JavaModelException { if (element instanceof ISourceReference) return ((ISourceReference) element).getSourceRange(); @@ -474,13 +475,13 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt return ((IMember) element).getNameRange(); return null; } - + protected boolean overlaps(ISourceRange range, int start, int end) { return start <= (range.getOffset() + range.getLength() - 1) && range.getOffset() <= end; } - + protected boolean filtered(IJavaElement parent, IJavaElement child) { - + Object[] result= new Object[] { child }; ViewerFilter[] filters= getFilters(); for (int i= 0; i < filters.length; i++) { @@ -488,23 +489,23 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt if (result.length == 0) return true; } - + return false; } - + protected void update(Widget w, IJavaElementDelta delta) { - + Item item; - + IJavaElement parent= delta.getElement(); IJavaElementDelta[] affected= delta.getAffectedChildren(); Item[] children= getChildren(w); boolean doUpdateParent= false; boolean doUpdateParentsPlus= false; - + Vector deletions= new Vector(); - Vector additions= new Vector(); + Vector additions= new Vector(); for (int i= 0; i < affected.length; i++) { IJavaElementDelta affectedDelta= affected[i]; @@ -516,15 +517,15 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt for (j= 0; j < children.length; j++) if (affectedElement.equals(children[j].getData())) break; - + if (j == children.length) { // remove from collapsed parent if ((status & IJavaElementDelta.REMOVED) != 0) { doUpdateParentsPlus= true; continue; - } + } // addition - if ((status & IJavaElementDelta.CHANGED) != 0 && + if ((status & IJavaElementDelta.CHANGED) != 0 && (affectedDelta.getFlags() & IJavaElementDelta.F_MODIFIERS) != 0 && !filtered(parent, affectedElement)) { @@ -535,34 +536,34 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt item= children[j]; - // removed + // removed if ((status & IJavaElementDelta.REMOVED) != 0) { deletions.addElement(item); doUpdateParent= doUpdateParent || mustUpdateParent(affectedDelta, affectedElement); - // changed + // changed } else if ((status & IJavaElementDelta.CHANGED) != 0) { int change= affectedDelta.getFlags(); doUpdateParent= doUpdateParent || mustUpdateParent(affectedDelta, affectedElement); - + if ((change & IJavaElementDelta.F_MODIFIERS) != 0) { if (filtered(parent, affectedElement)) deletions.addElement(item); else updateItem(item, affectedElement); } - + if ((change & IJavaElementDelta.F_CONTENT) != 0) updateItem(item, affectedElement); - + if ((change & IJavaElementDelta.F_CHILDREN) != 0) - update(item, affectedDelta); - + update(item, affectedDelta); + if ((change & IJavaElementDelta.F_REORDER) != 0) fReorderedMembers= true; } } - + // find all elements to add IJavaElementDelta[] add= delta.getAddedChildren(); if (additions.size() > 0) { @@ -572,16 +573,16 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt tmp[i + add.length]= (IJavaElementDelta) additions.elementAt(i); add= tmp; } - + // add at the right position go2: for (int i= 0; i < add.length; i++) { - + try { - + IJavaElement e= add[i].getElement(); if (filtered(parent, e)) continue go2; - + doUpdateParent= doUpdateParent || mustUpdateParent(add[i], e); ISourceRange rng= getSourceRange(e); int start= rng.getOffset(); @@ -592,32 +593,32 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt if (nameRange != null) nameOffset= nameRange.getOffset(); } - + Item last= null; item= null; children= getChildren(w); - + for (int j= 0; j < children.length; j++) { item= children[j]; IJavaElement r= (IJavaElement) item.getData(); - + if (r == null) { // parent node collapsed and not be opened before -> do nothing continue go2; } - - + + try { rng= getSourceRange(r); - // multi-field declarations always start at + // multi-field declarations always start at // the same offset. They also have the same // end offset if the field sequence is terminated // with a semicolon. If not, the source range // ends behind the identifier / initializer // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=51851 - boolean multiFieldDeclaration= - r.getElementType() == IJavaElement.FIELD + boolean multiFieldDeclaration= + r.getElementType() == IJavaElement.FIELD && e.getElementType() == IJavaElement.FIELD && rng.getOffset() == start; @@ -635,16 +636,16 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } } } - + if (!multiFieldDeclaration && overlaps(rng, start, end)) { - - // be tolerant if the delta is not correct, or if + + // be tolerant if the delta is not correct, or if // the tree has been updated other than by a delta reuseTreeItem(item, e); continue go2; - + } else if (multiFieldOrderBefore || rng.getOffset() > start) { - + if (last != null && deletions.contains(last)) { // reuse item deletions.removeElement(last); @@ -655,14 +656,14 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } continue go2; } - + } catch (JavaModelException x) { // stumbled over deleted element } - + last= item; } - + // add at the end of the list if (last != null && deletions.contains(last)) { // reuse item @@ -672,13 +673,13 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt // nothing to reuse createTreeItem(w, e, -1); } - + } catch (JavaModelException x) { // the element to be added is not present -> don't add it } } - - + + // remove items which haven't been reused Enumeration e= deletions.elements(); while (e.hasMoreElements()) { @@ -686,15 +687,15 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt disassociate(item); item.dispose(); } - + if (doUpdateParent) updateItem(w, delta.getElement()); if (!doUpdateParent && doUpdateParentsPlus && w instanceof Item) updatePlus((Item)w, delta.getElement()); } - - + + /* * @see ContentViewer#handleLabelProviderChanged(LabelProviderChangedEvent) */ @@ -722,43 +723,43 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } super.handleLabelProviderChanged(event); } - + private IResource getUnderlyingResource() { Object input= getInput(); if (input instanceof ICompilationUnit) { ICompilationUnit cu= (ICompilationUnit) input; cu= JavaModelUtil.toOriginal(cu); - return cu.getResource(); - } + return cu.getResource(); + } // else if (input instanceof IClassFile) { // return ((IClassFile) input).getResource(); // } return null; - } - + } + } - + class LexicalSortingAction extends Action { - - private JavaElementSorter fSorter= new JavaElementSorter(); + + private JavaElementSorter fSorter= new JavaElementSorter(); public LexicalSortingAction() { super(); - WorkbenchHelp.setHelp(this, IJavaHelpContextIds.LEXICAL_SORTING_OUTLINE_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.LEXICAL_SORTING_OUTLINE_ACTION); setText(PHPEditorMessages.getString("JavaOutlinePage.Sort.label")); //$NON-NLS-1$ PHPUiImages.setLocalImageDescriptors(this, "alphab_sort_co.gif"); //$NON-NLS-1$ setToolTipText(PHPEditorMessages.getString("JavaOutlinePage.Sort.tooltip")); //$NON-NLS-1$ setDescription(PHPEditorMessages.getString("JavaOutlinePage.Sort.description")); //$NON-NLS-1$ - + boolean checked= PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean("LexicalSortingAction.isChecked"); //$NON-NLS-1$ valueChanged(checked, false); } - + public void run() { valueChanged(isChecked(), true); } - + private void valueChanged(final boolean on, boolean store) { setChecked(on); BusyIndicator.showWhile(fOutlineViewer.getControl().getDisplay(), new Runnable() { @@ -775,7 +776,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt public ClassOnlyAction() { super(); - WorkbenchHelp.setHelp(this, IJavaHelpContextIds.GO_INTO_TOP_LEVEL_TYPE_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GO_INTO_TOP_LEVEL_TYPE_ACTION); setText(PHPEditorMessages.getString("JavaOutlinePage.GoIntoTopLevelType.label")); //$NON-NLS-1$ setToolTipText(PHPEditorMessages.getString("JavaOutlinePage.GoIntoTopLevelType.tooltip")); //$NON-NLS-1$ setDescription(PHPEditorMessages.getString("JavaOutlinePage.GoIntoTopLevelType.description")); //$NON-NLS-1$ @@ -797,8 +798,8 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt fTopLevelTypeOnly= show; setChecked(show); fOutlineViewer.refresh(false); - - IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore(); + + IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore(); preferenceStore.setValue("GoIntoTopLevelTypeAction.isChecked", show); //$NON-NLS-1$ } } @@ -806,16 +807,16 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt /** * This action toggles whether this Java Outline page links * its selection to the active editor. - * + * * @since 3.0 */ public class ToggleLinkingAction extends AbstractToggleLinkingAction { - + JavaOutlinePage fJavaOutlinePage; - + /** * Constructs a new action. - * + * * @param outlinePage the Java outline page */ public ToggleLinkingAction(JavaOutlinePage outlinePage) { @@ -823,7 +824,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt setChecked(isLinkingEnabled); fJavaOutlinePage= outlinePage; } - + /** * Runs the action. */ @@ -832,34 +833,34 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt if (isChecked() && fEditor != null) fEditor.synchronizeOutlinePage(fEditor.computeHighlightRangeSourceReference(), false); } - + } /** A flag to show contents of top level type only */ private boolean fTopLevelTypeOnly; - + private IJavaElement fInput; private String fContextMenuID; private Menu fMenu; private JavaOutlineViewer fOutlineViewer; private PHPEditor fEditor; - + private MemberFilterActionGroup fMemberFilterActionGroup; - + private ListenerList fSelectionChangedListeners= new ListenerList(); private ListenerList fPostSelectionChangedListeners= new ListenerList(); private Hashtable fActions= new Hashtable(); - + private TogglePresentationAction fTogglePresentation; private GotoAnnotationAction fPreviousAnnotation; private GotoAnnotationAction fNextAnnotation; private TextEditorAction fShowJavadoc; private IAction fUndo; private IAction fRedo; - + private ToggleLinkingAction fToggleLinkingAction; - + private CompositeActionGroup fActionGroups; private IPropertyChangeListener fPropertyChangeListener; @@ -868,12 +869,12 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt * @since 3.0 */ private CustomFiltersActionGroup fCustomFiltersActionGroup; - + public JavaOutlinePage(String contextMenuID, PHPEditor editor) { super(); - + Assert.isNotNull(editor); - + fContextMenuID= contextMenuID; fEditor= editor; fTogglePresentation= new TogglePresentationAction(); @@ -882,11 +883,11 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt fShowJavadoc= (TextEditorAction) fEditor.getAction("ShowJavaDoc"); //$NON-NLS-1$ fUndo= fEditor.getAction(ITextEditorActionConstants.UNDO); fRedo= fEditor.getAction(ITextEditorActionConstants.REDO); - + fTogglePresentation.setEditor(editor); fPreviousAnnotation.setEditor(editor); - fNextAnnotation.setEditor(editor); - + fNextAnnotation.setEditor(editor); + fPropertyChangeListener= new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { doPropertyChange(event); @@ -894,20 +895,20 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt }; PHPeclipsePlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener); } - + /** * Returns the primary type of a compilation unit (has the same * name as the compilation unit). - * + * * @param compilationUnit the compilation unit * @return returns the primary type of the compilation unit, or * null if is does not have one */ protected IType getMainType(ICompilationUnit compilationUnit) { - + if (compilationUnit == null) return null; - + String name= compilationUnit.getElementName(); int index= name.indexOf('.'); if (index != -1) @@ -918,7 +919,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt /** * Returns the primary type of a class file. - * + * * @param classFile the class file * @return returns the primary type of the class file, or null * if is does not have one @@ -928,25 +929,25 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt // IType type= classFile.getType(); // return type != null && type.exists() ? type : null; // } catch (JavaModelException e) { -// return null; +// return null; // } // } - + /* (non-Javadoc) * Method declared on Page */ public void init(IPageSite pageSite) { super.init(pageSite); } - + private void doPropertyChange(PropertyChangeEvent event) { if (fOutlineViewer != null) { if (MembersOrderPreferenceCache.isMemberOrderProperty(event.getProperty())) { fOutlineViewer.refresh(false); } } - } - + } + /* * @see ISelectionProvider#addSelectionChangedListener(ISelectionChangedListener) */ @@ -956,7 +957,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt else fSelectionChangedListeners.add(listener); } - + /* * @see ISelectionProvider#removeSelectionChangedListener(ISelectionChangedListener) */ @@ -966,15 +967,15 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt else fSelectionChangedListeners.remove(listener); } - + /* * @see ISelectionProvider#setSelection(ISelection) */ public void setSelection(ISelection selection) { if (fOutlineViewer != null) - fOutlineViewer.setSelection(selection); - } - + fOutlineViewer.setSelection(selection); + } + /* * @see ISelectionProvider#getSelection() */ @@ -983,7 +984,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt return StructuredSelection.EMPTY; return fOutlineViewer.getSelection(); } - + /* * @see org.eclipse.jface.text.IPostSelectionProvider#addPostSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) */ @@ -993,7 +994,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt else fPostSelectionChangedListeners.add(listener); } - + /* * @see org.eclipse.jface.text.IPostSelectionProvider#removePostSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) */ @@ -1001,34 +1002,34 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt if (fOutlineViewer != null) fOutlineViewer.removePostSelectionChangedListener(listener); else - fPostSelectionChangedListeners.remove(listener); + fPostSelectionChangedListeners.remove(listener); } - + private void registerToolbarActions(IActionBars actionBars) { - + IToolBarManager toolBarManager= actionBars.getToolBarManager(); - if (toolBarManager != null) { + if (toolBarManager != null) { toolBarManager.add(new LexicalSortingAction()); - + fMemberFilterActionGroup= new MemberFilterActionGroup(fOutlineViewer, "net.sourceforge.phpeclipse.JavaOutlinePage"); //$NON-NLS-1$ fMemberFilterActionGroup.contributeToToolBar(toolBarManager); fCustomFiltersActionGroup.fillActionBars(actionBars); - + IMenuManager menu= actionBars.getMenuManager(); menu.add(new Separator("EndFilterGroup")); //$NON-NLS-1$ - + fToggleLinkingAction= new ToggleLinkingAction(this); - menu.add(new ClassOnlyAction()); + menu.add(new ClassOnlyAction()); menu.add(fToggleLinkingAction); } } - + /* * @see IPage#createControl */ public void createControl(Composite parent) { - + Tree tree= new Tree(parent, SWT.MULTI); AppearanceAwareLabelProvider lprovider= new AppearanceAwareLabelProvider( @@ -1036,23 +1037,23 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS ); - fOutlineViewer= new JavaOutlineViewer(tree); + fOutlineViewer= new JavaOutlineViewer(tree); initDragAndDrop(); fOutlineViewer.setContentProvider(new ChildrenProvider()); fOutlineViewer.setLabelProvider(new DecoratingJavaLabelProvider(lprovider)); - + Object[] listeners= fSelectionChangedListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { fSelectionChangedListeners.remove(listeners[i]); fOutlineViewer.addSelectionChangedListener((ISelectionChangedListener) listeners[i]); } - + listeners= fPostSelectionChangedListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { fPostSelectionChangedListeners.remove(listeners[i]); fOutlineViewer.addPostSelectionChangedListener((ISelectionChangedListener) listeners[i]); } - + MenuManager manager= new MenuManager(fContextMenuID, fContextMenuID); manager.setRemoveAllWhenShown(true); manager.addMenuListener(new IMenuListener() { @@ -1062,32 +1063,32 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt }); fMenu= manager.createContextMenu(tree); tree.setMenu(fMenu); - + IPageSite site= getSite(); site.registerContextMenu(PHPeclipsePlugin.getPluginId() + ".outline", manager, fOutlineViewer); //$NON-NLS-1$ site.setSelectionProvider(fOutlineViewer); // we must create the groups after we have set the selection provider to the site fActionGroups= new CompositeActionGroup(new ActionGroup[] { -// new OpenViewActionGroup(this), +// new OpenViewActionGroup(this), // new CCPActionGroup(this), new GenerateActionGroup(this)}); -// new RefactorActionGroup(this), +// new RefactorActionGroup(this), // new JavaSearchActionGroup(this)}); - + // register global actions IActionBars bars= site.getActionBars(); - + bars.setGlobalActionHandler(ITextEditorActionConstants.UNDO, fUndo); bars.setGlobalActionHandler(ITextEditorActionConstants.REDO, fRedo); - bars.setGlobalActionHandler(ITextEditorActionConstants.PREVIOUS, fPreviousAnnotation); - bars.setGlobalActionHandler(ITextEditorActionConstants.NEXT, fNextAnnotation); + bars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fPreviousAnnotation); + bars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fNextAnnotation); bars.setGlobalActionHandler(PHPdtActionConstants.SHOW_JAVA_DOC, fShowJavadoc); bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY, fTogglePresentation); bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, fNextAnnotation); bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, fPreviousAnnotation); - - + + fActionGroups.fillActionBars(bars); IStatusLineManager statusLineManager= bars.getStatusLineManager(); @@ -1099,32 +1100,32 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt fCustomFiltersActionGroup= new CustomFiltersActionGroup("net.sourceforge.phpdt.ui.JavaOutlinePage", fOutlineViewer); //$NON-NLS-1$ registerToolbarActions(bars); - - fOutlineViewer.setInput(fInput); + + fOutlineViewer.setInput(fInput); } public void dispose() { - + if (fEditor == null) return; - + if (fMemberFilterActionGroup != null) { fMemberFilterActionGroup.dispose(); fMemberFilterActionGroup= null; } - + if (fCustomFiltersActionGroup != null) { fCustomFiltersActionGroup.dispose(); fCustomFiltersActionGroup= null; } - - + + fEditor.outlinePageClosed(); fEditor= null; fSelectionChangedListeners.clear(); fSelectionChangedListeners= null; - + fPostSelectionChangedListeners.clear(); fPostSelectionChangedListeners= null; @@ -1132,39 +1133,39 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt PHPeclipsePlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener); fPropertyChangeListener= null; } - + if (fMenu != null && !fMenu.isDisposed()) { fMenu.dispose(); fMenu= null; } - + if (fActionGroups != null) fActionGroups.dispose(); - + fTogglePresentation.setEditor(null); fPreviousAnnotation.setEditor(null); - fNextAnnotation.setEditor(null); - + fNextAnnotation.setEditor(null); + fOutlineViewer= null; - + super.dispose(); } - + public Control getControl() { if (fOutlineViewer != null) return fOutlineViewer.getControl(); return null; } - + public void setInput(IJavaElement inputElement) { - fInput= inputElement; + fInput= inputElement; if (fOutlineViewer != null) fOutlineViewer.setInput(fInput); } - + public void select(ISourceReference reference) { if (fOutlineViewer != null) { - + ISelection s= fOutlineViewer.getSelection(); if (s instanceof IStructuredSelection) { IStructuredSelection ss= (IStructuredSelection) s; @@ -1176,7 +1177,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } } } - + public void setAction(String actionID, IAction action) { Assert.isNotNull(actionID); if (action == null) @@ -1184,7 +1185,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt else fActions.put(actionID, action); } - + public IAction getAction(String actionID) { Assert.isNotNull(actionID); return (IAction) fActions.get(actionID); @@ -1215,7 +1216,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt /** * Convenience method to add the action installed under the given actionID to the * specified group of the menu. - * + * * @param menu the menu manager * @param group the group to which to add the action * @param actionID the ID of the new action @@ -1225,7 +1226,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); - + if (action.isEnabled()) { IMenuManager subMenu= menu.findMenuUsingPath(group); if (subMenu != null) @@ -1235,16 +1236,16 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } } } - + protected void contextMenuAboutToShow(IMenuManager menu) { - + PHPeclipsePlugin.createStandardGroups(menu); - + IStructuredSelection selection= (IStructuredSelection)getSelection(); fActionGroups.setContext(new ActionContext(selection)); fActionGroups.fillContextMenu(menu); } - + /* * @see Page#setFocus() */ @@ -1252,15 +1253,15 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt if (fOutlineViewer != null) fOutlineViewer.getControl().setFocus(); } - + /** * Checks whether a given Java element is an inner type. - * + * * @param element the java element * @return true iff the given element is an inner type */ private boolean isInnerType(IJavaElement element) { - + if (element != null && element.getElementType() == IJavaElement.TYPE) { IType type= (IType)element; try { @@ -1273,13 +1274,13 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } } } - - return false; + + return false; } - + /** * Returns the IShowInSource for this view. - * + * * @return the {@link IShowInSource} */ protected IShowInSource getShowInSource() { @@ -1294,7 +1295,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt /** * Returns the IShowInTarget for this view. - * + * * @return the {@link IShowInTarget} */ protected IShowInTarget getShowInTarget() { @@ -1314,19 +1315,19 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt } }; } - + private void initDragAndDrop() { int ops= DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance() }; - + // Drop Adapter // TransferDropTargetListener[] dropListeners= new TransferDropTargetListener[] { // new SelectionTransferDropAdapter(fOutlineViewer) // }; // fOutlineViewer.addDropSupport(ops | DND.DROP_DEFAULT, transfers, new DelegatingDropAdapter(dropListeners)); - + // Drag Adapter // TransferDragSourceListener[] dragListeners= new TransferDragSourceListener[] { // new SelectionTransferDragAdapter(fOutlineViewer) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java index c01b0de..ec3ed89 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -26,7 +26,7 @@ import org.eclipse.jface.text.source.Annotation; import org.eclipse.jface.text.source.IVerticalRulerInfo; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.ITextEditorExtension; @@ -44,9 +44,9 @@ public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction { public JavaSelectMarkerRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler) { super(bundle, prefix, editor, ruler); fTextEditor= editor; - WorkbenchHelp.setHelp(this, IJavaHelpContextIds.JAVA_SELECT_MARKER_RULER_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.JAVA_SELECT_MARKER_RULER_ACTION); } - + public void run() { // if (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)) // return; @@ -63,7 +63,7 @@ public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction { } super.run(); } - + public void update() { // Begin Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20114 if (!(fTextEditor instanceof ITextEditorExtension) || ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly()) { @@ -78,7 +78,7 @@ public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction { else super.update(); } - + private Position getJavaAnnotationPosition() { AbstractMarkerAnnotationModel model= getAnnotationModel(); IDocument document= getDocument(); @@ -88,10 +88,10 @@ public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction { if (cu == null) { return null; } - + // boolean hasAssistLightbulb= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.APPEARANCE_QUICKASSIST_LIGHTBULB); Annotation assistAnnotation= null; - + Iterator iter= model.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= (Annotation) iter.next(); @@ -102,10 +102,10 @@ public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction { // if (includesRulerLine(position, document) && JavaCorrectionProcessor.hasCorrections(javaAnnotation)) // return position; } - } + } // else if (hasAssistLightbulb && annotation instanceof AssistAnnotation) { // // there is only one AssistAnnotation at a time -// assistAnnotation= annotation; +// assistAnnotation= annotation; // } } if (assistAnnotation != null) { @@ -117,7 +117,7 @@ public class JavaSelectMarkerRulerAction extends SelectMarkerRulerAction { } return null; } - + private ICompilationUnit getCompilationUnit() { IEditorInput input= fTextEditor.getEditorInput(); if (input instanceof IFileEditorInput) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction2.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction2.java index 1de298b..78e6932 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction2.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction2.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * 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 *******************************************************************************/ @@ -20,7 +20,7 @@ import org.eclipse.jface.text.source.Annotation; import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.VerticalRulerEvent; import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.ui.texteditor.IUpdate; @@ -38,28 +38,28 @@ public class JavaSelectMarkerRulerAction2 extends SelectAnnotationRulerAction { public JavaSelectMarkerRulerAction2(ResourceBundle bundle, String prefix, ITextEditor editor) { super(bundle, prefix, editor); - WorkbenchHelp.setHelp(this, IJavaHelpContextIds.JAVA_SELECT_MARKER_RULER_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.JAVA_SELECT_MARKER_RULER_ACTION); } - + /* * @see org.eclipse.ui.texteditor.IVerticalRulerListener#annotationDefaultSelected(org.eclipse.ui.texteditor.VerticalRulerEvent) */ public void annotationDefaultSelected(VerticalRulerEvent event) { Annotation annotation= event.getSelectedAnnotation(); IAnnotationModel model= getAnnotationModel(); - + // if (isOverrideIndicator(annotation)) { // ((OverrideIndicatorManager.OverrideIndicator)annotation).open(); // return; // } - + if (isBreakpoint(annotation)) triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK); - + Position position= model.getPosition(annotation); if (position == null) return; - + // if (isQuickFixTarget(annotation)) { // ITextOperationTarget operation= (ITextOperationTarget) getTextEditor().getAdapter(ITextOperationTarget.class); // final int opCode= PHPUnitEditor.CORRECTIONASSIST_PROPOSALS; @@ -69,7 +69,7 @@ public class JavaSelectMarkerRulerAction2 extends SelectAnnotationRulerAction { // return; // } // } - + // default: super.annotationDefaultSelected(event); } @@ -89,9 +89,9 @@ public class JavaSelectMarkerRulerAction2 extends SelectAnnotationRulerAction { * @return */ private boolean isBreakpoint(Annotation annotation) { - return annotation.getType().equals("org.eclipse.debug.core.breakpoint"); + return annotation.getType().equals("org.eclipse.debug.core.breakpoint"); //|| annotation.getType().equals(JavaExpandHover.NO_BREAKPOINT_ANNOTATION); //$NON-NLS-1$ - + } private boolean isQuickFixTarget(Annotation a) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java index 5dcf343..771eea3 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java @@ -37,7 +37,6 @@ import net.sourceforge.phpdt.core.compiler.ITerminalSymbols; import net.sourceforge.phpdt.core.compiler.InvalidInputException; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; import net.sourceforge.phpdt.internal.compiler.parser.SyntaxError; -import net.sourceforge.phpdt.internal.core.CompilationUnit; import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup; import net.sourceforge.phpdt.internal.ui.actions.FoldingActionGroup; import net.sourceforge.phpdt.internal.ui.actions.SelectionConverter; @@ -98,7 +97,6 @@ import org.eclipse.jface.text.ITextPresentationListener; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.ITextViewerExtension2; -import org.eclipse.jface.text.ITextViewerExtension3; import org.eclipse.jface.text.ITextViewerExtension4; import org.eclipse.jface.text.ITextViewerExtension5; import org.eclipse.jface.text.ITypedRegion; @@ -2186,8 +2184,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I try { int widgetLocation = styledText.getOffsetAtLocation(new Point(x, y)); - if (textViewer instanceof ITextViewerExtension3) { - ITextViewerExtension3 extension = (ITextViewerExtension3) textViewer; + if (textViewer instanceof ITextViewerExtension5) { + ITextViewerExtension5 extension = (ITextViewerExtension5) textViewer; return extension.widgetOffset2ModelOffset(widgetLocation); } else { IRegion visibleRegion = textViewer.getVisibleRegion(); @@ -4779,8 +4777,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I int targetOffset = (PHPPairMatcher.RIGHT == anchor) ? offset : offset + length - 1; boolean visible = false; - if (sourceViewer instanceof ITextViewerExtension3) { - ITextViewerExtension3 extension = (ITextViewerExtension3) sourceViewer; + if (sourceViewer instanceof ITextViewerExtension5) { + ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer; visible = (extension.modelOffset2WidgetOffset(targetOffset) > -1); } else { IRegion visibleRegion = sourceViewer.getVisibleRegion(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java index 39cbeae..aacb78d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java @@ -90,11 +90,11 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.ActionContext; import org.eclipse.ui.actions.ActionGroup; import org.eclipse.ui.dialogs.SaveAsDialog; import org.eclipse.ui.editors.text.IStorageDocumentProvider; -import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.ContentAssistAction; @@ -377,23 +377,27 @@ public class PHPUnitEditor extends PHPEditor { //implements } /* - * @see IWidgetTokenOwner#requestWidgetToken(IWidgetTokenKeeper) - */ - public boolean requestWidgetToken(IWidgetTokenKeeper requester) { - if (WorkbenchHelp.isContextHelpDisplayed()) - return false; - return super.requestWidgetToken(requester); - } + * @see IWidgetTokenOwner#requestWidgetToken(IWidgetTokenKeeper) + */ + public boolean requestWidgetToken(IWidgetTokenKeeper requester) { + if (PlatformUI.getWorkbench().getHelpSystem() + .isContextHelpDisplayed()) + return false; + return super.requestWidgetToken(requester); + } /* - * @see IWidgetTokenOwnerExtension#requestWidgetToken(IWidgetTokenKeeper, int) - * @since 3.0 - */ - public boolean requestWidgetToken(IWidgetTokenKeeper requester, int priority) { - if (WorkbenchHelp.isContextHelpDisplayed()) - return false; - return super.requestWidgetToken(requester, priority); - } + * @see IWidgetTokenOwnerExtension#requestWidgetToken(IWidgetTokenKeeper, + * int) + * @since 3.0 + */ + public boolean requestWidgetToken(IWidgetTokenKeeper requester, + int priority) { + if (PlatformUI.getWorkbench().getHelpSystem() + .isContextHelpDisplayed()) + return false; + return super.requestWidgetToken(requester, priority); + } /* * @see org.eclipse.jface.text.source.ISourceViewer#configure(org.eclipse.jface.text.source.SourceViewerConfiguration) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/ProblemPainter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/ProblemPainter.java index d6d208b..15cef95 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/ProblemPainter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/ProblemPainter.java @@ -25,7 +25,7 @@ import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITextViewerExtension3; +import org.eclipse.jface.text.ITextViewerExtension5; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.Region; import org.eclipse.jface.text.source.Annotation; @@ -45,39 +45,39 @@ import org.eclipse.ui.texteditor.ITextEditor; /** * Highlights the temporary problems. */ -public class ProblemPainter implements IPainter, PaintListener, IAnnotationModelListener { - +public class ProblemPainter implements IPainter, PaintListener, IAnnotationModelListener { + private static class ProblemPosition { Position fPosition; Color fColor; boolean fMultiLine; }; - + private boolean fIsActive= false; private boolean fIsPainting= false; private boolean fIsSettingModel= false; - + private ITextEditor fTextEditor; private ISourceViewer fSourceViewer; private StyledText fTextWidget; private IAnnotationModel fModel; private List fProblemPositions= new ArrayList(); - + private Map fColorTable= new HashMap(); private Set fAnnotationSet= new HashSet(); - - + + public ProblemPainter(ITextEditor textEditor, ISourceViewer sourceViewer) { fTextEditor= textEditor; fSourceViewer= sourceViewer; fTextWidget= sourceViewer.getTextWidget(); } - + private boolean hasProblems() { return !fProblemPositions.isEmpty(); - } - + } + private void enablePainting() { if (!fIsPainting && hasProblems()) { fIsPainting= true; @@ -85,7 +85,7 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel handleDrawRequest(null); } } - + private void disablePainting(boolean redraw) { if (fIsPainting) { fIsPainting= false; @@ -94,7 +94,7 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel handleDrawRequest(null); } } - + private void setModel(IAnnotationModel model) { if (fModel != model) { if (fModel != null) @@ -110,22 +110,22 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel } } } - - private void catchupWithModel() { + + private void catchupWithModel() { if (fProblemPositions != null) { fProblemPositions.clear(); if (fModel != null) { - + Iterator e= new ProblemAnnotationIterator(fModel, true); while (e.hasNext()) { IProblemAnnotation pa= (IProblemAnnotation) e.next(); Annotation a= (Annotation) pa; - + Color color= null; AnnotationType type= pa.getAnnotationType(); if (fAnnotationSet.contains(type)) color= (Color) fColorTable.get(type); - + if (color != null) { ProblemPosition pp= new ProblemPosition(); pp.fPosition= fModel.getPosition(a); @@ -137,13 +137,13 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel } } } - + private void updatePainting() { disablePainting(true); - catchupWithModel(); + catchupWithModel(); enablePainting(); } - + /* * @see IAnnotationModelListener#modelChanged(IAnnotationModel) */ @@ -165,38 +165,38 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel } } } - + public void setColor(AnnotationType annotationType, Color color) { if (color != null) fColorTable.put(annotationType, color); else fColorTable.remove(annotationType); } - + public void paintAnnotations(AnnotationType annotationType, boolean paint) { if (paint) fAnnotationSet.add(annotationType); else fAnnotationSet.remove(annotationType); } - + public boolean isPaintingAnnotations() { return !fAnnotationSet.isEmpty(); } - + /* * @see IPainter#dispose() */ public void dispose() { - - if (fColorTable != null) + + if (fColorTable != null) fColorTable.clear(); fColorTable= null; - + if (fAnnotationSet != null) fAnnotationSet.clear(); fAnnotationSet= null; - + fTextWidget= null; fModel= null; fProblemPositions= null; @@ -207,8 +207,8 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel * possibly including partially visible lines. */ private int getInclusiveTopIndexStartOffset() { - - if (fTextWidget != null && !fTextWidget.isDisposed()) { + + if (fTextWidget != null && !fTextWidget.isDisposed()) { int top= fSourceViewer.getTopIndex(); if ((fTextWidget.getTopPixel() % fTextWidget.getLineHeight()) != 0) top--; @@ -218,10 +218,10 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel } catch (BadLocationException ex) { } } - + return -1; } - + /* * @see PaintListener#paintControl(PaintEvent) */ @@ -229,33 +229,33 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel if (fTextWidget != null) handleDrawRequest(event.gc); } - + private void handleDrawRequest(GC gc) { int vOffset= getInclusiveTopIndexStartOffset(); // http://bugs.eclipse.org/bugs/show_bug.cgi?id=17147 - int vLength= fSourceViewer.getBottomIndexEndOffset() + 1; - + int vLength= fSourceViewer.getBottomIndexEndOffset() + 1; + for (Iterator e = fProblemPositions.iterator(); e.hasNext();) { ProblemPosition pp = (ProblemPosition) e.next(); Position p= pp.fPosition; if (p.overlapsWith(vOffset, vLength)) { - + if (!pp.fMultiLine) { - + IRegion widgetRange= getWidgetRange(p); if (widgetRange != null) draw(gc, widgetRange.getOffset(), widgetRange.getLength(), pp.fColor); - + } else { - + IDocument document= fSourceViewer.getDocument(); try { - - int startLine= document.getLineOfOffset(p.getOffset()); + + int startLine= document.getLineOfOffset(p.getOffset()); int lastInclusive= Math.max(p.getOffset(), p.getOffset() + p.getLength() - 1); int endLine= document.getLineOfOffset(lastInclusive); - + for (int i= startLine; i <= endLine; i++) { IRegion line= document.getLineInformation(i); int paintStart= Math.max(line.getOffset(), p.getOffset()); @@ -267,62 +267,61 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel draw(gc, widgetRange.getOffset(), widgetRange.getLength(), pp.fColor); } } - + } catch (BadLocationException x) { } } } } } - + private IRegion getWidgetRange(Position p) { - if (fSourceViewer instanceof ITextViewerExtension3) { - - ITextViewerExtension3 extension= (ITextViewerExtension3) fSourceViewer; + if (fSourceViewer instanceof ITextViewerExtension5) { + ITextViewerExtension5 extension= (ITextViewerExtension5) fSourceViewer; return extension.modelRange2WidgetRange(new Region(p.getOffset(), p.getLength())); - + } else { - + IRegion region= fSourceViewer.getVisibleRegion(); int offset= region.getOffset(); int length= region.getLength(); - + if (p.overlapsWith(offset , length)) { int p1= Math.max(offset, p.getOffset()); int p2= Math.min(offset + length, p.getOffset() + p.getLength()); return new Region(p1 - offset, p2 - p1); } } - + return null; } - + private int[] computePolyline(Point left, Point right, int height) { - + final int WIDTH= 4; // must be even final int HEIGHT= 2; // can be any number // final int MINPEEKS= 2; // minimal number of peeks - + int peeks= (right.x - left.x) / WIDTH; // if (peeks < MINPEEKS) { // int missing= (MINPEEKS - peeks) * WIDTH; // left.x= Math.max(0, left.x - missing/2); // peeks= MINPEEKS; // } - + int leftX= left.x; - + // compute (number of point) * 2 int length= ((2 * peeks) + 1) * 2; if (length < 0) return new int[0]; - + int[] coordinates= new int[length]; - + // cache peeks' y-coordinates int bottom= left.y + height - 1; int top= bottom - HEIGHT; - + // populate array with peek coordinates for (int i= 0; i < peeks; i++) { int index= 4 * i; @@ -331,29 +330,29 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel coordinates[index+2]= coordinates[index] + WIDTH/2; coordinates[index+3]= top; } - + // the last down flank is missing coordinates[length-2]= left.x + (WIDTH * peeks); coordinates[length-1]= bottom; - + return coordinates; } - + private void draw(GC gc, int offset, int length, Color color) { if (gc != null) { - + Point left= fTextWidget.getLocationAtOffset(offset); Point right= fTextWidget.getLocationAtOffset(offset + length); - + gc.setForeground(color); int[] polyline= computePolyline(left, right, gc.getFontMetrics().getHeight()); gc.drawPolyline(polyline); - + } else { fTextWidget.redrawRange(offset, length, true); } } - + /* * @see IPainter#deactivate(boolean) */ @@ -365,7 +364,7 @@ public class ProblemPainter implements IPainter, PaintListener, IAnnotationModel catchupWithModel(); } } - + /* * @see IPainter#paint(int) */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPAutoIndentStrategy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPAutoIndentStrategy.java index 5647b5b..8096bb0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPAutoIndentStrategy.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPAutoIndentStrategy.java @@ -12,29 +12,29 @@ Contributors: package net.sourceforge.phpeclipse.phpeditor.php; import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DefaultAutoIndentStrategy; +import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.IDocument; /** * Auto indent strategy sensitive to brackets. */ -public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { +public class PHPAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy { public PHPAutoIndentStrategy() { } - + /* (non-Javadoc) * Method declared on IAutoIndentStrategy */ public void customizeDocumentCommand(IDocument d, DocumentCommand c) { if (c.length == 0 && c.text != null && endsWithDelimiter(d, c.text)) smartIndentAfterNewLine(d, c); - else if ("}".equals(c.text)) { + else if ("}".equals(c.text)) { smartInsertAfterBracket(d, c); } } - + /** * Returns whether or not the text ends with one of the given search strings. */ @@ -49,7 +49,7 @@ public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { return false; } - + /** * Returns the line number of the next bracket after end. * @returns the line number of the next matching bracket after end @@ -63,7 +63,7 @@ public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { int start= document.getLineOffset(line); int brackcount= getBracketCount(document, start, end, false) - closingBracketIncrease; - // sum up the brackets counts of each line (closing brackets count negative, + // sum up the brackets counts of each line (closing brackets count negative, // opening positive) until we find a line the brings the count to zero while (brackcount < 0) { line--; @@ -76,9 +76,9 @@ public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { } return line; } - + /** - * Returns the bracket value of a section of text. Closing brackets have a value of -1 and + * Returns the bracket value of a section of text. Closing brackets have a value of -1 and * open brackets have a value of 1. * @returns the line number of the next matching bracket after end * @param document - the document being parsed @@ -101,7 +101,7 @@ public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { // a comment starts, advance to the comment end begin= getCommentEnd(document, begin + 1, end); } else if (next == '/') { - // '//'-comment: nothing to do anymore on this line + // '//'-comment: nothing to do anymore on this line begin= end; } } @@ -134,7 +134,7 @@ public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { } return bracketcount; } - + /** * Returns the end position a comment starting at pos. * @returns the end position a comment starting at pos @@ -155,7 +155,7 @@ public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { } return end; } - + /** * Returns the String at line with the leading whitespace removed. * @returns the String at line with the leading whitespace removed. @@ -172,7 +172,7 @@ public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { return ""; //$NON-NLS-1$ } } - + /** * Returns the position of the character in the document after position. * @returns the next location of character. @@ -195,7 +195,7 @@ public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { } return end; } - + /** * Set the indent of a new line based on the command provided in the supplied document. * @param document - the document being parsed @@ -239,7 +239,7 @@ public class PHPAutoIndentStrategy extends DefaultAutoIndentStrategy { System.out.println(PHPEditorMessages.getString("AutoIndent.error.bad_location_1")); //$NON-NLS-1$ } } - + /** * Set the indent of a bracket based on the command provided in the supplied document. * @param document - the document being parsed diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java index 042eb5b..eaa7e44 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java @@ -16,7 +16,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import net.sourceforge.phpdt.internal.compiler.parser.Scanner; import net.sourceforge.phpdt.internal.ui.text.AbstractJavaScanner; import net.sourceforge.phpdt.ui.text.IColorManager; import net.sourceforge.phpeclipse.IPreferenceConstants; @@ -26,7 +25,6 @@ import net.sourceforge.phpeclipse.phpeditor.util.PHPWordDetector; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.Assert; -import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.rules.ICharacterScanner; import org.eclipse.jface.text.rules.IRule; import org.eclipse.jface.text.rules.IToken; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java index 7154b21..2046d7c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java @@ -37,8 +37,6 @@ import net.sourceforge.phpdt.internal.compiler.parser.UnitParser; import net.sourceforge.phpdt.internal.compiler.parser.VariableInfo; import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory; import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter; -import net.sourceforge.phpdt.internal.core.CompilationUnit; -import net.sourceforge.phpdt.internal.core.SourceType; import net.sourceforge.phpdt.internal.corext.template.php.JavaContext; import net.sourceforge.phpdt.internal.corext.template.php.JavaContextType; import net.sourceforge.phpdt.internal.ui.text.PHPCodeReader; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPProjectLibraryPage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPProjectLibraryPage.java index bd918f6..98fe54d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPProjectLibraryPage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPProjectLibraryPage.java @@ -26,8 +26,8 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.ISharedImages; import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.ide.IDE.SharedImages; public class PHPProjectLibraryPage { protected JavaProject workingProject; @@ -87,7 +87,7 @@ public class PHPProjectLibraryPage { ITableLabelProvider labelProvider = new ITableLabelProvider() { public Image getColumnImage(Object element, int columnIndex) { IWorkbench workbench = PHPeclipsePlugin.getDefault().getWorkbench(); - return workbench.getSharedImages().getImage(ISharedImages.IMG_OBJ_PROJECT); + return workbench.getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT); } public String getColumnText(Object element, int columnIndex) { -- 1.7.1