From: khartlage Date: Fri, 4 Jun 2004 16:47:16 +0000 (+0000) Subject: 3.x RC1 compatibility X-Git-Url: http://secure.phpeclipse.com 3.x RC1 compatibility --- diff --git a/net.sourceforge.phpeclipse.debug.core/.project b/net.sourceforge.phpeclipse.debug.core/.project index 375b066..656ea67 100644 --- a/net.sourceforge.phpeclipse.debug.core/.project +++ b/net.sourceforge.phpeclipse.debug.core/.project @@ -4,6 +4,7 @@ net.sourceforge.phpeclipse + net.sourceforge.phpeclipse.quantum.sql diff --git a/net.sourceforge.phpeclipse.debug.core/plugin.xml b/net.sourceforge.phpeclipse.debug.core/plugin.xml index 46e6b66..3319866 100644 --- a/net.sourceforge.phpeclipse.debug.core/plugin.xml +++ b/net.sourceforge.phpeclipse.debug.core/plugin.xml @@ -3,8 +3,8 @@ @@ -12,7 +12,7 @@ - + diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.java index 845a4be..45455ff 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.java @@ -46,9 +46,9 @@ public class PHPDebugModel { * * @return plugin identifier */ - public static String getPluginIdentifier() { - return PHPDebugCorePlugin.getUniqueIdentifier(); - } +// public static String getPluginIdentifier() { +// return PHPDebugCorePlugin.getUniqueIdentifier(); +// } /** * Creates and returns a line breakpoint in the type with @@ -85,11 +85,11 @@ public class PHPDebugModel { new PHPLineBreakpoint(resource, lineNumber, charStart, charEnd, hitCount, true, attributes); } - public static void createLineBreakpoint(IResource resource, int lineNumber, int hitCount, boolean register, Map attributes) throws CoreException { + public static PHPLineBreakpoint createLineBreakpoint(IResource resource, int lineNumber, int hitCount, boolean register, Map attributes) throws CoreException { if (attributes == null) { attributes = new HashMap(10); } - new PHPLineBreakpoint(resource, lineNumber, hitCount, true, attributes); + return new PHPLineBreakpoint(resource, lineNumber, hitCount, true, attributes); } @@ -105,7 +105,7 @@ public class PHPDebugModel { * @exception CoreException If this method fails. */ public static PHPLineBreakpoint lineBreakpointExists(int lineNumber) throws CoreException { - String modelId= getPluginIdentifier(); + String modelId= PHPDebugCorePlugin.PLUGIN_ID; // getPluginIdentifier(); String markerType= PHPLineBreakpoint.getMarkerType(); IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager(); IBreakpoint[] breakpoints= manager.getBreakpoints(modelId); diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java index 038c3d4..0e6f79f 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java @@ -7,6 +7,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.*; +import org.osgi.framework.BundleContext; /** * The main plugin class to be used in the desktop. @@ -54,15 +55,15 @@ public class PHPDebugCorePlugin extends Plugin { /** * Convenience method which returns the unique identifier of this plugin. */ - public static String getUniqueIdentifier() { - if (getDefault() == null) { - // If the default instance is not yet initialized, - // return a static identifier. This identifier must - // match the plugin id defined in plugin.xml - return PLUGIN_ID; - } - return getDefault().getDescriptor().getUniqueIdentifier(); - } +// public static String getUniqueIdentifier() { +// if (getDefault() == null) { +// // If the default instance is not yet initialized, +// // return a static identifier. This identifier must +// // match the plugin id defined in plugin.xml +// return PLUGIN_ID; +// } +// return getDefault().getDescriptor().getUniqueIdentifier(); +// } /** * @see Plugin#shutdown() @@ -71,4 +72,17 @@ public class PHPDebugCorePlugin extends Plugin { plugin = null; super.shutdown(); } + /** + * This method is called upon plug-in activation + */ + public void start(BundleContext context) throws Exception { + super.start(context); + } + + /** + * This method is called when the plug-in is stopped + */ + public void stop(BundleContext context) throws Exception { + super.stop(context); + } } diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugTarget.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugTarget.java index 52f2cd5..9e5dfb8 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugTarget.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugTarget.java @@ -100,7 +100,7 @@ public class PHPDebugTarget implements IPHPDebugTarget, ILaunchListener, IDebugE } public String getModelIdentifier() { - return PHPDebugCorePlugin.getUniqueIdentifier(); + return PHPDebugCorePlugin.PLUGIN_ID; } public IDebugTarget getDebugTarget() { diff --git a/net.sourceforge.phpeclipse.debug.ui/.project b/net.sourceforge.phpeclipse.debug.ui/.project index ad08fc7..f01f1a2 100644 --- a/net.sourceforge.phpeclipse.debug.ui/.project +++ b/net.sourceforge.phpeclipse.debug.ui/.project @@ -6,6 +6,7 @@ net.sourceforge.phpeclipse net.sourceforge.phpeclipse.debug.core net.sourceforge.phpeclipse.launching + net.sourceforge.phpeclipse.quantum.sql diff --git a/net.sourceforge.phpeclipse.debug.ui/plugin.xml b/net.sourceforge.phpeclipse.debug.ui/plugin.xml index deb23ed..87202ca 100644 --- a/net.sourceforge.phpeclipse.debug.ui/plugin.xml +++ b/net.sourceforge.phpeclipse.debug.ui/plugin.xml @@ -3,8 +3,8 @@ @@ -86,7 +86,7 @@ id="net.sourceforge.phpdt.debug.ui.LaunchConfigurationTabGroupPHPApplication"> - - + --> @@ -151,5 +151,27 @@ id="net.sourceforge.phpdt.ui.DebugHover"> - + + + + + + + + + + + + + diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java index 9b41956..8510396 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java @@ -12,20 +12,18 @@ package net.sourceforge.phpdt.internal.debug.ui; +import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame; +import net.sourceforge.phpdt.internal.debug.core.model.PHPValue; +import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter; +import net.sourceforge.phpdt.internal.ui.text.JavaWordFinder; +import net.sourceforge.phpdt.ui.PreferenceConstants; +import net.sourceforge.phpdt.ui.text.java.hover.IJavaEditorTextHover; + import org.eclipse.core.runtime.IAdaptable; -//import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IVariable; import org.eclipse.debug.ui.IDebugUIConstants; -//import org.eclipse.jdt.debug.core.IJavaStackFrame; -//import org.eclipse.jdt.debug.core.IJavaThread; -//import org.eclipse.jdt.debug.core.IJavaType; -//import org.eclipse.jdt.debug.core.IJavaValue; -import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter; -//import org.eclipse.jdt.ui.PreferenceConstants; -//import org.eclipse.jdt.ui.text.java.hover.IJavaEditorTextHover; -import net.sourceforge.phpdt.ui.text.java.hover.IJavaEditorTextHover; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.DefaultInformationControl; import org.eclipse.jface.text.IDocument; @@ -44,10 +42,6 @@ import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; -import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame; -import net.sourceforge.phpdt.internal.debug.core.model.PHPValue; -import net.sourceforge.phpdt.internal.ui.text.JavaWordFinder; - public class PHPDebugHover implements IJavaEditorTextHover, ITextHoverExtension, ISelectionListener, IPartListener { @@ -237,4 +231,20 @@ public class PHPDebugHover implements IJavaEditorTextHover, ITextHoverExtension, // } // return null; } + + /* (non-Javadoc) + * @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator() + */ + public IInformationControlCreator getHoverControlCreator() { + if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE)) { //$NON-NLS-1$ + return new IInformationControlCreator() { + public IInformationControl createInformationControl(Shell parent) { + return new DefaultInformationControl(parent, SWT.NONE, + new HTMLTextPresenter(true), + PHPDebugUiMessages.getString("PHPDebugHover.16")); //$NON-NLS-1$ + } + }; + } + return null; + } } diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.properties b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.properties index 088a270..915a45a 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.properties +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.properties @@ -70,3 +70,5 @@ EditPathMapDialog.Browse=Browse... EditPathMapDialog.Remote_Path=Remote Path: EditPathMapDialog.Select_the_directory_to_map=Select the directory to map EditPathDialog.Local_Path=Local Path: + +PHPDebugHover.16=Press F2 for focus. \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java index 16f59ce..79f91cb 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java @@ -6,12 +6,13 @@ import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.swt.widgets.Display; +import org.osgi.framework.BundleContext; public class PHPDebugUiPlugin extends AbstractUIPlugin { public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.ui"; //$NON-NLS-1$ @@ -41,17 +42,17 @@ public class PHPDebugUiPlugin extends AbstractUIPlugin { /** * Convenience method which returns the unique identifier of this plugin. */ - public static String getUniqueIdentifier() - { - if ( getDefault() == null ) - { - // If the default instance is not yet initialized, - // return a static identifier. This identifier must - // match the plugin id defined in plugin.xml - return PLUGIN_ID; - } - return getDefault().getDescriptor().getUniqueIdentifier(); - } +// public static String getUniqueIdentifier() +// { +// if ( getDefault() == null ) +// { +// // If the default instance is not yet initialized, +// // return a static identifier. This identifier must +// // match the plugin id defined in plugin.xml +// return PLUGIN_ID; +// } +// return getDefault().getDescriptor().getUniqueIdentifier(); +// } /** * Returns the standard display to be used. The method first checks, if @@ -95,7 +96,7 @@ public class PHPDebugUiPlugin extends AbstractUIPlugin { Shell shell = getActiveWorkbenchShell(); if ( shell != null ) { - IStatus status = new Status( IStatus.ERROR, getUniqueIdentifier(), /*ICDebugUIConstants.INTERNAL_ERROR*/ 150, t.getMessage(), null ); //$NON-NLS-1$ + IStatus status = new Status( IStatus.ERROR, PLUGIN_ID, /*ICDebugUIConstants.INTERNAL_ERROR*/ 150, t.getMessage(), null ); //$NON-NLS-1$ ErrorDialog.openError( shell, "Error", message, status ); } } @@ -108,6 +109,20 @@ public class PHPDebugUiPlugin extends AbstractUIPlugin { log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, PHPDebugUiMessages.getString("RdtDebugUiPlugin.internalErrorOccurred"), e)); //$NON-NLS-1$ } + /** + * This method is called upon plug-in activation + */ + public void start(BundleContext context) throws Exception { + super.start(context); + } + + /** + * This method is called when the plug-in is stopped + */ + public void stop(BundleContext context) throws Exception { + super.stop(context); + } + // protected void initializeDefaultPreferences(IPreferenceStore store) { // super.initializeDefaultPreferences(store); // diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPSourceLocator.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPSourceLocator.java index c00a9ad..aaba834 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPSourceLocator.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPSourceLocator.java @@ -14,7 +14,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; -import org.eclipse.core.boot.BootLoader; +import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.model.IPersistableSourceLocator; import org.eclipse.debug.core.model.IStackFrame; @@ -64,7 +64,7 @@ public class PHPSourceLocator implements IPersistableSourceLocator, ISourcePrese this.pathMap = configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map)null); this.projectName =configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, ""); - if (BootLoader.getOS().equals(BootLoader.OS_WIN32)) + if (Platform.getOS().equals(Platform.OS_WIN32)) this.remoteSourcePath= new Path((configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, "")).toLowerCase()); else this.remoteSourcePath= new Path(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, "")); diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.java new file mode 100644 index 0000000..090d847 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.ui.actions; + + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class ActionMessages { + + private static final String BUNDLE_NAME = + "org.eclipse.jdt.internal.debug.ui.actions.ActionMessages";//$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = + ResourceBundle.getBundle(BUNDLE_NAME); + + private ActionMessages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + public static ResourceBundle getResourceBundle() { + return RESOURCE_BUNDLE; + } +} diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.properties b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.properties new file mode 100644 index 0000000..801f0c5 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.properties @@ -0,0 +1,143 @@ +############################################################################### +# Copyright (c) 2000, 2004 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Common Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/cpl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + +ManageBreakpointActionDelegate.error.message1=Exceptions occurred attempting to manage breakpoint +ManageBreakpointActionDelegate.error.title1=Manage Breakpoint + +BreakpointAction.Breakpoint_configuration_1=Breakpoint configuration +BreakpointAction.Exceptions_occurred_attempting_to_modify_breakpoint._2=Exceptions occurred attempting to modify breakpoint. + +BreakpointHitCountAction.&Enter_the_new_hit_count_for_the_breakpoint__3=&Enter the new hit count for the breakpoint: +BreakpointHitCountAction.Enable_Hit_Count_1=Enable &Hit Count +BreakpointHitCountAction.Exception_occurred_attempting_to_set_hit_count_1=Exception occurred attempting to set hit count +BreakpointHitCountAction.Set_Breakpoint_Hit_Count_2=Set Breakpoint Hit Count +BreakpointHitCountAction.Value_must_be_positive_integer=Hit count must be a positive integer + +BreakpointSuspendPolicy.Suspend_&Thread_2=&Suspend Thread +BreakpointSuspendPolicy.Suspend_&VM_1=&Suspend VM + +DisplayAction.no_result_value=(No explicit return value) +DisplayAction.result_pattern={0} {1} +DisplayAction.type_name_pattern=\ ({0}) + +DropToFrameAction.Drop_to_Frame_1=Drop to Frame +DropToFrameAction.Exceptions_occurred_attempting_to_drop_to_frame._2=Exceptions occurred attempting to drop to frame. + +EnableDisableBreakpointRulerAction.&Disable_Breakpoint_4=&Disable Breakpoint +EnableDisableBreakpointRulerAction.&Enable_Breakpoint_1=&Enable Breakpoint +EnableDisableBreakpointRulerAction.&Enable_Breakpoint_5=&Enable Breakpoint +EnableDisableBreakpointRulerAction.Enabling/disabling_breakpoints_2=Enabling/disabling breakpoints +EnableDisableBreakpointRulerAction.Exceptions_occurred_enabling_disabling_the_breakpoint_3=Exceptions occurred enabling disabling the breakpoint + +Evaluate.error.message.direct_exception=An exception occurred: {0} +Evaluate.error.message.exception.pattern={0} - {1} +Evaluate.error.message.src_context=The selected stack frame must be associated with a Java project in the workspace to perform an evaluation. +Evaluate.error.message.stack_frame_context=A stack frame must be selected to provide a context for an evaluation. +Evaluate.error.message.wrapped_exception=An exception occurred: {0} +Evaluate.error.problem_append_pattern={0}\n{1} +Evaluate.error.title.eval_problems=Error Evaluating +EvaluateAction.Cannot_open_Display_view=Cannot open Display View +EvaluateAction.(evaluation_failed)_1=(evaluation failed) +EvaluateAction.(evaluation_failed)_Reason=Evaluation failed. Reason(s):\n{0} +EvaluateAction.Thread_not_suspended_-_unable_to_perform_evaluation._1=Thread not suspended - unable to perform evaluation. +EvaluateAction.Cannot_perform_nested_evaluations._1=Cannot perform nested evaluations. + +InspectAction.Exception_occurred_inspecting_variable=Exception occurred inspecting variable. + +JavaBreakpointPropertiesRulerAction.Breakpoint_&Properties_1=Breakpoint &Properties... + +ManageBreakpointRulerAction.label=Toggle &Breakpoint +ManageBreakpointRulerAction.error.adding.message1=Cannot add breakpoint + +ManageMethodBreakpointActionDelegate.CantAdd=Method breakpoints can only be added to concrete methods. + +ManageWatchpointActionDelegate.CantAdd=Watchpoints can only be added to field members. +OpenTypeAction.2=Unable to open type + +MoveDownAction.M&ove_Down_1=&Down +MoveUpAction.Move_U&p_1=U&p +RemoveAction.&Remove_1=&Remove + +AddProjectAction.Add_Project_1=Add Project&s... +AddProjectAction.Project_Selection_2=Project Selection +AddProjectAction.Choose_&project(s)_to_add__3=Choose &project(s) to add: +AddProjectAction.One_or_more_exceptions_occurred_while_adding_projects._1=One or more exceptions occurred while adding projects. + +ProjectSelectionDialog.Add_exported_entries_of_selected_projects._1=&Add exported entries of selected projects. +ProjectSelectionDialog.Add_required_projects_of_selected_projects._2=Add &required projects of selected projects. + +AddJarAction.Add_&JARs_1=Add &JARs... +AddJarAction.JAR_Selection_7=JAR Selection +AddJarAction.Choose_jars_to_add__8=&Choose jars and zips to add: + +AddExternalJar.Add_E&xternal_JARs_1=Add E&xternal JARs... +AddExternalJar.Jar_Selection_3=Jar Selection + +AddFolderAction.Add_&Folders_1=Add F&olders +AddFolderAction.Selection_must_be_a_folder_2=Selection must be a folder +AddFolderAction.Folder_Selection_4=Folder Selection +AddFolderAction.Choose_folders_to_add__5=&Choose folders to add: +AddFolderAction.Classpath_already_includes_selected_folder(s)._1=Classpath already includes selected folder(s). + +AddExternalFolderAction.Add_External_Folder_1=Add &External Folder +AddExternalFolderAction.Folder_Selection_3=Folder Selection + +AddVariableAction.Add_Variables_1=Add Classpath Var&iables + +AttachSourceAction.2=Attac&h Source +AttachSourceAction.3=Attac&h Source... + +AddAdvancedAction.Ad&vanced..._1=&Advanced... + +TerminateEvaluationActionTerminate_Evaluation_1=Terminate Evaluation +TerminateEvaluationActionAttempts_to_terminate_an_evaluation_can_only_stop_a_series_of_statements._The_currently_executing_statement_(such_as_a_method_invocation)_cannot_be_interrupted._2=Attempts to terminate an evaluation can only stop a series of statements. The currently executing statement (such as a method invocation) cannot be interrupted. +TerminateEvaluationActionAn_exception_occurred_while_terminating_the_evaluation_3=An exception occurred while terminating the evaluation + +InstanceFiltersAction.1=&Restrict selected breakpoint(s) to object \"{0}": +InstanceFiltersAction.2=Instance Filter Breakpoint Selection +InstanceFiltersAction.3=Breakpoint: {0}\nis already restricted to an other object.\nDo you want to set the restriction to object \"{1}\"? +InstanceFiltersAction.Yes_2=Yes +InstanceFiltersAction.Cancel_3=Cancel + +RestoreDefaultEntriesAction.0=R&estore Default Entries + +StepIntoSelectionHandler.Execution_did_not_enter___{0}___before_the_current_method_returned._1=Execution did not enter \"{0}\" before the current method returned. + +StepIntoSelectionActionDelegate.No_Method=Current text selection does not resolve to a Java method + +PrimitiveOptionsDialog.Primitive_Type_Display_Options_1=Primitive Type Display Options + +StepIntoSelectionActionDelegate.Step_into_selection_only_available_for_types_in_Java_projects._1=Step into selection only available for types in Java projects. +StepIntoSelectionActionDelegate.Step_into_selection_only_available_in_top_stack_frame._3=Step into selection only available in top stack frame. +StepIntoSelectionActionDelegate.Step_into_selection_only_available_in_Java_editor._4=Step into selection only available in Java editor. +StepIntoSelectionActionDelegate.4=An exception occurred attempting to run to the selected line. + +ObjectActionDelegate.Unable_to_display_type_hierarchy._The_selected_source_element_is_not_contained_in_the_workspace._1=Unable to display type hierarchy. The selected source element is not contained in the workspace. +ManageBreakpointRulerAction.Breakpoints_can_only_be_created_within_the_type_associated_with_the_editor__{0}._1=Breakpoints can only be created within the type associated with the editor: {0}. +BreakpointLocationVerifierJob.breakpoint_location=Breakpoint location validation +BreakpointLocationVerifierJob.not_valid_location=Breakpoint cannot be set at the given position +BreakpointLocationVerifierJob.breakpoint_set=Breakpoint set +ManageMethodBreakpointActionDelegate.methodNonAvailable=Cannot create method breakpoint, method signature not available. +BreakpointLocationVerifierJob.breakpointRemoved=Breakpoint removed. +BreakpointLocationVerifierJob.breakpointMovedToValidPosition=The breakpoint has been moved to a valid position. +BreakpointLocationVerifierJob.breakpointSetToRightType=The breakpoint has been set to the right type. +PopupDisplayAction.2=Move to Display View + +RunToLineAdapter.0=Empty editor +RunToLineAdapter.1=Missing document +RunToLineAdapter.2=Unable to locate debug target +RunToLineAdapter.3=Selected line is not a valid location to run to +RunToLineAdapter.4=Cursor position is not a valid location to run to +ToggleBreakpointAdapter.9=Selection does not contain a method +ToggleBreakpointAdapter.10=Selection does not contain a field +StepIntoSelectionHandler.1=Step into selection +StepIntoSelectionHandler.2=OK +AddLibraryAction.0=Add &Library diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ManageBreakpointActionDelegate.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ManageBreakpointActionDelegate.java index d6cadcd..979daa8 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ManageBreakpointActionDelegate.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ManageBreakpointActionDelegate.java @@ -114,7 +114,7 @@ public class ManageBreakpointActionDelegate implements IWorkbenchWindowActionDel if (breakpoint==null) PHPDebugModel.createLineBreakpoint(getFile(), lineNumber, 0, true, null); else - DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );; + DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); } catch( CoreException ce ) { PHPDebugUiPlugin.errorDialog( "Cannot add breakpoint", ce ); diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java new file mode 100644 index 0000000..06d27a7 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.ui.actions; + +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.debug.ui.actions.IRunToLineTarget; +import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; + +/** + * Creates adapters for retargettable actions in debug platform. + * Contributed via org.eclipse.core.runtime.adapters + * extension point. + * + * @since 3.0 + */ +public class RetargettableActionAdapterFactory implements IAdapterFactory { + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) + */ + public Object getAdapter(Object adaptableObject, Class adapterType) { +// if (adapterType == IRunToLineTarget.class) { +// return new RunToLineAdapter(); +// } + if (adapterType == IToggleBreakpointsTarget.class) { + return new ToggleBreakpointAdapter(); + } + return null; + } + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() + */ + public Class[] getAdapterList() { + return new Class[]{IRunToLineTarget.class, IToggleBreakpointsTarget.class}; + } +} 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 new file mode 100644 index 0000000..45c59bc --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java @@ -0,0 +1,727 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.ui.actions; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.sourceforge.phpdt.core.Flags; +import net.sourceforge.phpdt.core.ICompilationUnit; +import net.sourceforge.phpdt.core.IField; +import net.sourceforge.phpdt.core.IJavaElement; +import net.sourceforge.phpdt.core.IJavaProject; +import net.sourceforge.phpdt.core.IMember; +import net.sourceforge.phpdt.core.IMethod; +import net.sourceforge.phpdt.core.ISourceRange; +import net.sourceforge.phpdt.core.IType; +import net.sourceforge.phpdt.core.JavaCore; +import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.Signature; +import net.sourceforge.phpdt.core.dom.CompilationUnit; +import net.sourceforge.phpdt.core.search.IJavaSearchConstants; +import net.sourceforge.phpdt.core.search.ITypeNameRequestor; +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 net.sourceforge.phpdt.ui.IWorkingCopyManager; +import net.sourceforge.phpdt.ui.JavaUI; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.IBreakpointManager; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.internal.ui.actions.ActionMessages; +import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.ITextSelection; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.texteditor.IEditorStatusLine; +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) { + if (message != null) { + statusLine.setMessage(true, message, null); + } 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; +// if (member instanceof IType) { +// type = (IType)member; +// } else if (member != null) { +// type= member.getDeclaringType(); +// } +// // bug 52385: we don't want local and anonymous types from compilation unit, +// // we are getting 'not-always-correct' names for them. +// try { +// while (type != null && !type.isBinary() && type.isLocal()) { +// type= type.getDeclaringType(); +// } +// } catch (JavaModelException e) { +// PHPDebugUiPlugin.log(e); +// } +// return type; +// } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(IWorkbenchPart, ISelection) + */ + public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException { + if (selection instanceof ITextSelection) { + report(null, part); + IEditorPart editorPart = (IEditorPart)part; + ITextSelection textSelection = (ITextSelection)selection; +// IType type = getType(textSelection); + IEditorInput editorInput = editorPart.getEditorInput(); + IDocument document= ((ITextEditor)editorPart).getDocumentProvider().getDocument(editorInput); + int lineNumber= textSelection.getStartLine() + 1; + int offset= textSelection.getOffset(); + try { +// if (type == null) { +// IClassFile classFile= (IClassFile)editorInput.getAdapter(IClassFile.class); +// if (classFile != null) { +// type= classFile.getType(); +// // bug 34856 - if this is an inner type, ensure the breakpoint is not +// // being added to the outer type +// if (type.getDeclaringType() != null) { +// ISourceRange sourceRange= type.getSourceRange(); +// int start= sourceRange.getOffset(); +// int end= start + sourceRange.getLength(); +// if (offset < start || offset > end) { +// // not in the inner type +// IStatusLineManager statusLine = editorPart.getEditorSite().getActionBars().getStatusLineManager(); +// statusLine .setErrorMessage(MessageFormat.format(ActionMessages.getString("ManageBreakpointRulerAction.Breakpoints_can_only_be_created_within_the_type_associated_with_the_editor__{0}._1"), new String[] { type.getTypeQualifiedName()})); //$NON-NLS-1$ +// Display.getCurrent().beep(); +// return; +// } +// } +// } +// } + +// String typeName= null; + IResource resource; + PHPLineBreakpoint breakpoint= null; +// if (type == null) { + if (editorInput instanceof IFileEditorInput) { + resource= ((IFileEditorInput)editorInput).getFile(); + } else { + resource= ResourcesPlugin.getWorkspace().getRoot(); + } +// } else { +// typeName= type.getFullyQualifiedName(); +// PHPLineBreakpoint breakpoint=PHPDebugModel.lineBreakpointExists(lineNumber); +// if (breakpoint==null) +// PHPDebugModel.createLineBreakpoint(getFile(), lineNumber, 0, true, null); +// else +// DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); +// + PHPLineBreakpoint existingBreakpoint= PHPDebugModel.lineBreakpointExists(lineNumber); //typeName, lineNumber); + if (existingBreakpoint != null) { + DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(existingBreakpoint, true); + return; + } else { + breakpoint = PHPDebugModel.createLineBreakpoint(resource, lineNumber, 0, true, null); + } + // } +// new BreakpointLocationVerifierJob(document, breakpoint, lineNumber, typeName, type, resource, (IEditorStatusLine) editorPart.getAdapter(IEditorStatusLine.class)).schedule(); + } catch (CoreException ce) { + ExceptionHandler.handle(ce, ActionMessages.getString("ManageBreakpointActionDelegate.error.title1"), ActionMessages.getString("ManageBreakpointActionDelegate.error.message1")); //$NON-NLS-1$ //$NON-NLS-2$ + return; + } + } + } + /*(non-Javadoc) + * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(IWorkbenchPart, ISelection) + */ + public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) { + return selection instanceof ITextSelection; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) + */ + public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException { +// report(null, part); +// selection = translateToMembers(part, selection); +// if (selection instanceof ITextSelection) { +// ITextSelection textSelection = (ITextSelection) selection; +// if (selection != null) { +// CompilationUnit compilationUnit= parseCompilationUnit((ITextEditor)part); +// if (compilationUnit != null) { +// BreakpointMethodLocator locator= new BreakpointMethodLocator(textSelection.getOffset()); +// compilationUnit.accept(locator); +// String methodName= locator.getMethodName(); +// if (methodName == null) { +// report(ActionMessages.getString("ManageMethodBreakpointActionDelegate.CantAdd"), part); //$NON-NLS-1$ +// return; +// } +// String typeName= locator.getTypeName(); +// String methodSignature= locator.getMethodSignature(); +// if (methodSignature == null) { +// report(ActionMessages.getString("ManageMethodBreakpointActionDelegate.methodNonAvailable"), part); //$NON-NLS-1$ +// return; +// } +// // check if this method breakpoint already exist. If yes, remove it. +// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); +// IBreakpoint[] breakpoints= breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier()); +// for (int i= 0; i < breakpoints.length; i++) { +// IBreakpoint breakpoint= breakpoints[i]; +// if (breakpoint instanceof IJavaMethodBreakpoint) { +// IJavaMethodBreakpoint methodBreakpoint= (IJavaMethodBreakpoint)breakpoint; +// if (typeName.equals(methodBreakpoint.getTypeName()) +// && methodName.equals(methodBreakpoint.getMethodName()) +// && methodSignature.equals(methodBreakpoint.getMethodSignature())) { +// breakpointManager.removeBreakpoint(methodBreakpoint, true); +// return; +// } +// } +// } +// // add the breakpoint +// JDIDebugModel.createMethodBreakpoint(getResource((IEditorPart)part), typeName, methodName, methodSignature, true, false, false, -1, -1, -1, 0, true, new HashMap(10)); +// } +// } +// } else if (selection instanceof IStructuredSelection) { +// IMethod[] members= getMethods((IStructuredSelection)selection); +// if (members.length == 0) { +// report(ActionMessages.getString("ToggleBreakpointAdapter.9"), part); //$NON-NLS-1$ +// return; +// } +// // add or remove the breakpoint +// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); +// for (int i= 0, length= members.length; i < length; i++) { +// IMethod method= members[i]; +// IJavaBreakpoint breakpoint= getBreakpoint(method); +// if (breakpoint == null) { +// // add breakpoint +// int start = -1; +// int end = -1; +// ISourceRange range = method.getNameRange(); +// if (range != null) { +// start = range.getOffset(); +// end = start + range.getLength(); +// } +// Map attributes = new HashMap(10); +// BreakpointUtils.addJavaBreakpointAttributes(attributes, method); +// String methodName = method.getElementName(); +// if (method.isConstructor()) { +// methodName = ""; //$NON-NLS-1$ +// } +// IType type= method.getDeclaringType(); +// String methodSignature= method.getSignature(); +// if (!type.isBinary()) { +// //resolve the type names +// methodSignature= resolveMethodSignature(type, methodSignature); +// if (methodSignature == null) { +// IStatus status = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Source method signature could not be resolved", null); //$NON-NLS-1$ +// throw new CoreException(status); +// } +// } +// JDIDebugModel.createMethodBreakpoint(BreakpointUtils.getBreakpointResource(method), type.getFullyQualifiedName(), methodName, methodSignature, true, false, false, -1, start, end, 0, true, attributes); +// } else { +// // remove breakpoint +// breakpointManager.removeBreakpoint(breakpoint, true); +// } +// } +// } + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) + */ + public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) { + if (selection instanceof IStructuredSelection) { + IStructuredSelection ss = (IStructuredSelection) selection; + return getMethods(ss).length > 0; + } else { + return selection instanceof ITextSelection; + } + } + + protected IMethod[] getMethods(IStructuredSelection selection) { + if (selection.isEmpty()) { + return new IMethod[0]; + } else { + List methods = new ArrayList(selection.size()); + Iterator iterator = selection.iterator(); + while (iterator.hasNext()) { + Object thing = iterator.next(); + try { + if (thing instanceof IMethod && !Flags.isAbstract(((IMethod)thing).getFlags())) { + methods.add(thing); + } + } catch (JavaModelException e) { + } + } + return (IMethod[]) methods.toArray(new IMethod[methods.size()]); + } + } + +// protected IField[] getFields(IStructuredSelection selection) { +// if (selection.isEmpty()) { +// return new IField[0]; +// } else { +// List fields = new ArrayList(selection.size()); +// Iterator iterator = selection.iterator(); +// while (iterator.hasNext()) { +// Object thing = iterator.next(); +// if (thing instanceof IField) { +// fields.add(thing); +// } else if (thing instanceof IJavaFieldVariable) { +// IField field= getField((IJavaFieldVariable) thing); +// if (field != null) { +// fields.add(field); +// } +// } +// } +// 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) + */ + public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException { +// report(null, part); +// selection = translateToMembers(part, selection); +// if (selection instanceof ITextSelection) { +// ITextSelection textSelection= (ITextSelection) selection; +// CompilationUnit compilationUnit= parseCompilationUnit((ITextEditor)part); +// if (compilationUnit != null) { +// BreakpointFieldLocator locator= new BreakpointFieldLocator(textSelection.getOffset()); +// compilationUnit.accept(locator); +// String fieldName= locator.getFieldName(); +// if (fieldName == null) { +// report(ActionMessages.getString("ManageWatchpointActionDelegate.CantAdd"), part); //$NON-NLS-1$ +// return; +// } +// String typeName= locator.getTypeName(); +// // check if the watchpoint already exists. If yes, remove it +// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); +// IBreakpoint[] breakpoints= breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier()); +// for (int i= 0; i < breakpoints.length; i++) { +// IBreakpoint breakpoint= breakpoints[i]; +// if (breakpoint instanceof IJavaWatchpoint) { +// IJavaWatchpoint watchpoint= (IJavaWatchpoint)breakpoint; +// if (typeName.equals(watchpoint.getTypeName()) && fieldName.equals(watchpoint.getFieldName())) { +// breakpointManager.removeBreakpoint(watchpoint, true); +// return; +// } +// } +// } +// // add the watchpoint +// JDIDebugModel.createWatchpoint(getResource((IEditorPart)part), typeName, fieldName, -1, -1, -1, 0, true, new HashMap(10)); +// } +// } else if (selection instanceof IStructuredSelection) { +// IField[] members = getFields((IStructuredSelection)selection); +// if (members.length == 0) { +// report(ActionMessages.getString("ToggleBreakpointAdapter.10"), part); //$NON-NLS-1$ +// return; +// } +// // add or remove watchpoint +// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); +// for (int i= 0, length= members.length; i < length; i++) { +// IField element= members[i]; +// IJavaBreakpoint breakpoint= getBreakpoint(element); +// if (breakpoint == null) { +// IType type = element.getDeclaringType(); +// int start = -1; +// int end = -1; +// ISourceRange range = element.getNameRange(); +// if (range != null) { +// start = range.getOffset(); +// end = start + range.getLength(); +// } +// Map attributes = new HashMap(10); +// BreakpointUtils.addJavaBreakpointAttributes(attributes, element); +// JDIDebugModel.createWatchpoint(BreakpointUtils.getBreakpointResource(type), type.getFullyQualifiedName(), element.getElementName(), -1, start, end, 0, true, attributes); +// } else { +// // remove breakpoint +// breakpointManager.removeBreakpoint(breakpoint, true); +// } +// } +// } + } + + 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); +// if (elementTypeSignature.length() == 1) { +// // no need to resolve primitive types +// return typeSignature; +// } +// String elementTypeName= Signature.toString(elementTypeSignature); +// String[][] resolvedElementTypeNames= type.resolveType(elementTypeName); +// if (resolvedElementTypeNames == null || resolvedElementTypeNames.length != 1) { +// // the type name cannot be resolved +// return null; +// } +// String resolvedElementTypeName= Signature.toQualifiedName(resolvedElementTypeNames[0]); +// 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(); + if (editorInput instanceof IFileEditorInput) { + resource= ((IFileEditorInput)editorInput).getFile(); + } else { + resource= ResourcesPlugin.getWorkspace().getRoot(); + } + return resource; + } + + /** + * Returns a handle to the specified method or null if none. + * + * @param editorPart the editor containing the method + * @param typeName + * @param methodName + * @param signature + * @return handle or null + */ + protected IMethod getMethodHandle(IEditorPart editorPart, String typeName, String methodName, String signature) throws CoreException { + IJavaElement element = (IJavaElement) editorPart.getEditorInput().getAdapter(IJavaElement.class); + IType type = null; + if (element instanceof ICompilationUnit) { + IType[] types = ((ICompilationUnit)element).getAllTypes(); + for (int i = 0; i < types.length; i++) { + if (types[i].getFullyQualifiedName().equals(typeName)) { + type = types[i]; + break; + } + } + } +// else if (element instanceof IClassFile) { +// type = ((IClassFile)element).getType(); +// } + if (type != null) { + String[] sigs = Signature.getParameterTypes(signature); + return type.getMethod(methodName, sigs); + } + return null; + } + +// protected IJavaBreakpoint getBreakpoint(IMember element) { +// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); +// IBreakpoint[] breakpoints= breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier()); +// if (element instanceof IMethod) { +// IMethod method= (IMethod)element; +// for (int i= 0; i < breakpoints.length; i++) { +// IBreakpoint breakpoint= breakpoints[i]; +// if (breakpoint instanceof IJavaMethodBreakpoint) { +// IJavaMethodBreakpoint methodBreakpoint= (IJavaMethodBreakpoint)breakpoint; +// IMember container = null; +// try { +// container= BreakpointUtils.getMember(methodBreakpoint); +// } catch (CoreException e) { +// JDIDebugUIPlugin.log(e); +// return null; +// } +// if (container == null) { +// try { +// if (method.getDeclaringType().getFullyQualifiedName().equals(methodBreakpoint.getTypeName()) +// && method.getElementName().equals(methodBreakpoint.getMethodName()) +// && method.getSignature().equals(methodBreakpoint.getMethodSignature())) { +// return methodBreakpoint; +// } +// } catch (CoreException e) { +// JDIDebugUIPlugin.log(e); +// } +// } else { +// if (container instanceof IMethod) { +// if (method.getDeclaringType().getFullyQualifiedName().equals(container.getDeclaringType().getFullyQualifiedName())) { +// if (method.isSimilar((IMethod)container)) { +// return methodBreakpoint; +// } +// } +// } +// } +// } +// } +// } else if (element instanceof IField) { +// for (int i= 0; i < breakpoints.length; i++) { +// IBreakpoint breakpoint= breakpoints[i]; +// if (breakpoint instanceof IJavaWatchpoint) { +// try { +// if (equalFields(element, (IJavaWatchpoint)breakpoint)) +// return (IJavaBreakpoint)breakpoint; +// } catch (CoreException e) { +// JDIDebugUIPlugin.log(e); +// } +// } +// } +// } +// return null; +// } + + /** + * Compare two fields. The default equals() + * method for IField doesn't give the comparison desired. + */ +// private boolean equalFields(IMember breakpointField, IJavaWatchpoint watchpoint) throws CoreException { +// 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); +// ASTParser parser = ASTParser.newParser(AST.JLS2); +// 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) + */ + public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) { +// if (selection instanceof IStructuredSelection) { +// IStructuredSelection ss = (IStructuredSelection) selection; +// return getFields(ss).length > 0; +// } else { +// return selection instanceof ITextSelection; +// } + 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, + * or the original selection if none + * @exception CoreException if an exceptoin occurrs + */ +// protected ISelection translateToMembers(IWorkbenchPart part, ISelection selection) throws CoreException { +// if (selection instanceof ITextSelection && part instanceof IEditorPart) { +// ITextSelection textSelection = (ITextSelection)selection; +// IEditorPart editorPart = (IEditorPart) part; +// IEditorInput editorInput = editorPart.getEditorInput(); +// IMember m= null; +// IClassFile classFile= (IClassFile)editorInput.getAdapter(IClassFile.class); +// if (classFile != null) { +// IJavaElement e= classFile.getElementAt(textSelection.getOffset()); +// if (e instanceof IMember) { +// m= (IMember)e; +// } +// } else { +// IWorkingCopyManager manager= JavaUI.getWorkingCopyManager(); +// ICompilationUnit unit= manager.getWorkingCopy(editorInput); +// if (unit != null) { +// synchronized (unit) { +// unit.reconcile(ICompilationUnit.NO_AST /*don't create ast*/, false/*don't force problem detection*/, null/*use primary owner*/, null/*no progress monitor*/); +// } +// IJavaElement e = unit.getElementAt(textSelection.getOffset()); +// if (e instanceof IMember) { +// m= (IMember)e; +// } +// } +// } +// if (m != null) { +// return new StructuredSelection(m); +// } +// } +// return selection; +// } + + /** + * 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) { +// List types= new ArrayList(); +// ILaunch launch = variable.getDebugTarget().getLaunch(); +// if (launch == null) { +// return types; +// } +// +// ILaunchConfiguration configuration= launch.getLaunchConfiguration(); +// IJavaProject[] javaProjects = null; +// IWorkspace workspace= ResourcesPlugin.getWorkspace(); +// if (configuration != null) { +// // Launch configuration support +// try { +// String projectName= configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$ +// if (projectName.length() != 0) { +// javaProjects= new IJavaProject[] {JavaCore.create(workspace.getRoot().getProject(projectName))}; +// } else { +// IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects(); +// IProject project; +// List projectList= new ArrayList(); +// for (int i= 0, numProjects= projects.length; i < numProjects; i++) { +// project= projects[i]; +// if (project.isAccessible() && project.hasNature(JavaCore.NATURE_ID)) { +// projectList.add(JavaCore.create(project)); +// } +// } +// javaProjects= new IJavaProject[projectList.size()]; +// projectList.toArray(javaProjects); +// } +// } catch (CoreException e) { +// JDIDebugUIPlugin.log(e); +// } +// } +// if (javaProjects == null) { +// return types; +// } +// +// SearchEngine engine= new SearchEngine(); +// IJavaSearchScope scope= SearchEngine.createJavaSearchScope(javaProjects, true); +// String declaringType= null; +// try { +// declaringType= variable.getDeclaringType().getName(); +// } catch (DebugException x) { +// JDIDebugUIPlugin.log(x); +// return types; +// } +// 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, +// IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, +// null); +// } catch (JavaModelException x) { +// JDIDebugUIPlugin.log(x); +// return types; +// } +// Iterator iter= typeRefsFound.iterator(); +// TypeInfo typeInfo= null; +// while (iter.hasNext()) { +// typeInfo= (TypeInfo)iter.next(); +// try { +// types.add(typeInfo.resolveType(scope)); +// } catch (JavaModelException jme) { +// JDIDebugUIPlugin.log(jme); +// } +// } +// 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 + * type name. + */ +// protected static char[] getPackage(String fullyQualifiedName) { +// int index= fullyQualifiedName.lastIndexOf('.'); +// if (index == -1) { +// return new char[0]; +// } +// 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 +// * fullyQualifiedName not containing a '.' or '$' +// */ +// protected static char[] getTypeName(String fullyQualifiedName) { +// int index= fullyQualifiedName.lastIndexOf('.'); +// String typeName= fullyQualifiedName.substring(index + 1); +// int lastInnerClass= typeName.lastIndexOf('$'); +// if (lastInnerClass != -1) { +// typeName= typeName.substring(lastInnerClass + 1); +// } +// return typeName.toCharArray(); +// } +// +// /** +// * Return the associated IField (Java model) for the given +// * IJavaFieldVariable (JDI model) +// */ +// private IField getField(IJavaFieldVariable variable) { +// String varName= null; +// try { +// varName= variable.getName(); +// } catch (DebugException x) { +// JDIDebugUIPlugin.log(x); +// return null; +// } +// IField field; +// List types= searchForDeclaringType(variable); +// Iterator iter= types.iterator(); +// while (iter.hasNext()) { +// IType type= (IType)iter.next(); +// field= type.getField(varName); +// if (field.exists()) { +// return field; +// } +// } +// return null; +// } +} diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java index 754118d..4536b17 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java @@ -1,11 +1,13 @@ package net.sourceforge.phpdt.internal.debug.ui.launcher; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.HashMap; import java.util.Map; +import net.sourceforge.phpdt.core.JavaCore; +import net.sourceforge.phpdt.internal.core.JavaProject; import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages; import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin; import net.sourceforge.phpdt.internal.debug.ui.preferences.EditInterpreterDialog; @@ -14,27 +16,25 @@ import net.sourceforge.phpdt.internal.launching.PHPInterpreter; import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute; import net.sourceforge.phpdt.internal.launching.PHPRuntime; import net.sourceforge.phpdt.internal.ui.PHPUiImages; -import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpeclipse.LoadPathEntry; -import net.sourceforge.phpeclipse.resourcesview.PHPProject; import net.sourceforge.phpeclipse.PHPeclipsePlugin; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; +import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.swt.SWT; -import org.eclipse.core.resources.IProject; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -45,9 +45,9 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.TableColumn; import org.eclipse.ui.internal.dialogs.ListContentProvider; public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { @@ -499,7 +499,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { if (projectName != "") { IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName); if ((aProject != null) && JavaCore.isPHPProject(aProject)) { - PHPProject thePHPProject = new PHPProject(); + JavaProject thePHPProject = new JavaProject(); thePHPProject.setProject(aProject); List loadPathEntries = thePHPProject.getLoadPathEntries(); loadPathListViewer.setInput(loadPathEntries); diff --git a/net.sourceforge.phpeclipse.launching/.project b/net.sourceforge.phpeclipse.launching/.project index f147bcf..25ad69f 100644 --- a/net.sourceforge.phpeclipse.launching/.project +++ b/net.sourceforge.phpeclipse.launching/.project @@ -5,6 +5,7 @@ net.sourceforge.phpeclipse net.sourceforge.phpeclipse.debug.core + net.sourceforge.phpeclipse.quantum.sql diff --git a/net.sourceforge.phpeclipse.launching/plugin.xml b/net.sourceforge.phpeclipse.launching/plugin.xml index da280ef..75e7983 100644 --- a/net.sourceforge.phpeclipse.launching/plugin.xml +++ b/net.sourceforge.phpeclipse.launching/plugin.xml @@ -3,8 +3,8 @@ @@ -24,7 +24,6 @@ - diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java index 01e4f6c..6003721 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java @@ -14,15 +14,17 @@ package net.sourceforge.phpdt.internal.launching; import java.util.Iterator; +import net.sourceforge.phpdt.internal.core.JavaProject; +import net.sourceforge.phpdt.internal.debug.core.Environment; +import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy; +import net.sourceforge.phpdt.internal.debug.core.model.PHPDebugTarget; + import org.eclipse.core.resources.IProject; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IProcess; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -import net.sourceforge.phpdt.internal.debug.core.model.PHPDebugTarget; -import net.sourceforge.phpdt.internal.debug.core.Environment; -import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy; -import net.sourceforge.phpeclipse.resourcesview.PHPProject; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.model.IProcess; +//import net.sourceforge.phpeclipse.resourcesview.PHPProject; public class DebuggerRunner extends InterpreterRunner { @@ -104,7 +106,7 @@ public class DebuggerRunner extends InterpreterRunner { protected String renderLoadPath(InterpreterRunnerConfiguration configuration) { StringBuffer loadPath = new StringBuffer(); - PHPProject project = configuration.getProject(); + JavaProject project = configuration.getProject(); addToLoadPath(loadPath, project.getProject()); Iterator referencedProjects = project.getReferencedProjects().iterator(); 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 b32752f..cae1655 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 @@ -4,14 +4,14 @@ import java.io.File; import java.io.IOException; import java.util.Iterator; -import org.eclipse.core.boot.BootLoader; +import net.sourceforge.phpdt.internal.core.JavaProject; + import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IProcess; -import net.sourceforge.phpeclipse.resourcesview.PHPProject; - public class InterpreterRunner { public InterpreterRunner() { @@ -63,7 +63,7 @@ public class InterpreterRunner { protected String renderLoadPath(InterpreterRunnerConfiguration configuration) { StringBuffer loadPath = new StringBuffer(); - PHPProject project = configuration.getProject(); + JavaProject project = configuration.getProject(); addToLoadPath(loadPath, project.getProject()); Iterator referencedProjects = project.getReferencedProjects().iterator(); @@ -78,7 +78,7 @@ public class InterpreterRunner { } protected String osDependentPath(String aPath) { - if (BootLoader.getOS().equals(BootLoader.OS_WIN32)) + if (Platform.getOS().equals(Platform.OS_WIN32)) aPath = "\"" + aPath + "\""; return aPath; diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java index 8cec3f2..8d45c41 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java @@ -2,7 +2,7 @@ package net.sourceforge.phpdt.internal.launching; import java.io.File; -import net.sourceforge.phpeclipse.resourcesview.PHPProject; +import net.sourceforge.phpdt.internal.core.JavaProject; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; @@ -32,9 +32,9 @@ public class InterpreterRunnerConfiguration { } catch(CoreException e) {} return fileName.replace('\\', '/'); - } + } - public PHPProject getProject() { + public JavaProject getProject() { String projectName = ""; try { @@ -45,7 +45,7 @@ public class InterpreterRunnerConfiguration { IProject project = PHPLaunchingPlugin.getWorkspace().getRoot().getProject(projectName); - PHPProject phpProject = new PHPProject(); + JavaProject phpProject = new JavaProject(); phpProject.setProject(project); return phpProject; } diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchingPlugin.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchingPlugin.java index f5f6f10..7d55467 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchingPlugin.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchingPlugin.java @@ -5,10 +5,11 @@ import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Status; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; -public class PHPLaunchingPlugin extends Plugin { +public class PHPLaunchingPlugin extends AbstractUIPlugin { public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.launching"; //$NON-NLS-1$ protected static PHPLaunchingPlugin plugin; @@ -33,4 +34,17 @@ public class PHPLaunchingPlugin extends Plugin { public static void log(Throwable e) { log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, PHPLaunchingMessages.getString("PHPLaunchingPlugin.internalErrorOccurred"), e)); //$NON-NLS-1$ } + /** + * This method is called upon plug-in activation + */ + public void start(BundleContext context) throws Exception { + super.start(context); + } + + /** + * This method is called when the plug-in is stopped + */ + public void stop(BundleContext context) throws Exception { + super.stop(context); + } } 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 56c6101..f454e62 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 @@ -103,17 +103,20 @@ public class PHPRuntime { protected void loadRuntimeConfiguration() { installedInterpreters = new ArrayList(); try { - XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); - reader.setContentHandler(getRuntimeConfigurationContentHandler()); - reader.parse(new InputSource(getRuntimeConfigurationReader())); + File file = getRuntimeConfigurationFile(); + if (file.exists()) { + XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); + reader.setContentHandler(getRuntimeConfigurationContentHandler()); + reader.parse(new InputSource(getRuntimeConfigurationReader(file))); + } } catch(Exception e) { PHPLaunchingPlugin.log(e); } } - protected Reader getRuntimeConfigurationReader() { + protected Reader getRuntimeConfigurationReader(File file) { try { - return new FileReader(getRuntimeConfigurationFile()); + return new FileReader(file); } catch(FileNotFoundException e) {} return new StringReader(""); }