Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsgibly2006-07-16 10:39:29 -0400
committersgibly2006-07-16 10:39:29 -0400
commit8533d87cbe5facd18de30d40eb0d715c3d48164f (patch)
tree36a0d0cc54466fd6421727c20dacd7cf91c458ff
parent51704b409165c9fb8ce9ae70d1db5f1a6e4f43d7 (diff)
downloadorg.eclipse.pdt-8533d87cbe5facd18de30d40eb0d715c3d48164f.tar.gz
org.eclipse.pdt-8533d87cbe5facd18de30d40eb0d715c3d48164f.tar.xz
org.eclipse.pdt-8533d87cbe5facd18de30d40eb0d715c3d48164f.zip
Added 'Open in Browser' option to the web server launch configuration dialog.
This addition opens a browser (internal / external) with the debug URL already entered. By that, a debug session starts.
-rw-r--r--plugins/org.eclipse.php.debug.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/IPHPConstants.java3
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/PHPDebugPlugin.java6
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/communication/DebugConnectionThread.java2
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/debugger/PHPWebServerDebuggerInitializer.java29
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/launching/PHPExecutableLaunchDelegate.java2
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceInitializer.java1
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceNames.java1
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIMessages.java2
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIPluginResources.properties3
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/console/PHPConsoleColorProvider.java6
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExeLaunchShortcut.java2
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExecutableLaunchTab.java4
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerLaunchShortcut.java14
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerTab.java62
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/preferences/PHPDebugPreferencesWorkspaceAddon.java7
16 files changed, 99 insertions, 48 deletions
diff --git a/plugins/org.eclipse.php.debug.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.php.debug.core/META-INF/MANIFEST.MF
index d1f29356a..86c014d0e 100644
--- a/plugins/org.eclipse.php.debug.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.php.debug.core/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jface,
org.eclipse.wst.sse.ui,
org.eclipse.php.debug.daemon,
- org.eclipse.php.ui
+ org.eclipse.php.ui,
+ org.eclipse.ui.workbench
Eclipse-LazyStart: true
Export-Package: org.eclipse.php.debug.core,
org.eclipse.php.debug.core.communication,
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/IPHPConstants.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/IPHPConstants.java
index 0fa89633d..77a3cc6c8 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/IPHPConstants.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/IPHPConstants.java
@@ -28,7 +28,8 @@ public interface IPHPConstants {
public static final String ConditionEnabled = ID_PHP_DEBUG_CORE + ".ConditionEnabled";
public static final String Condition = ID_PHP_DEBUG_CORE + ".Condition";
public static final String PHPProcessType = ID_PHP_DEBUG_CORE + ".launching.PHPProcess";
- public static final String RunWithDebugInfo = ID_PHP_DEBUG_CORE + ".RunWithDebugInfo";
+ public static final String RUN_WITH_DEBUG_INFO = ID_PHP_DEBUG_CORE + ".RunWithDebugInfo";
+ public static final String OPEN_IN_BROWSER = ID_PHP_DEBUG_CORE + ".OpenInBrowser";
public static final String Include_Storage = ID_PHP_DEBUG_CORE + ".Include_Storage";
public static final String Include_Storage_type = ID_PHP_DEBUG_CORE + ".Include_Storage_Type";
public static final String Include_Storage_zip = ID_PHP_DEBUG_CORE + ".zip";
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/PHPDebugPlugin.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/PHPDebugPlugin.java
index a984adef1..ab00d0779 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/PHPDebugPlugin.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/PHPDebugPlugin.java
@@ -91,6 +91,12 @@ public class PHPDebugPlugin extends Plugin {
}
+ public static boolean getOpenInBrowserOption() {
+ Preferences prefs = getDefault().getPluginPreferences();
+ return prefs.getBoolean(PHPDebugCorePreferenceNames.OPEN_IN_BROWSER);
+
+ }
+
public static boolean getAutoSaveDirtyOption() {
Preferences prefs = getDefault().getPluginPreferences();
return prefs.getBoolean(PHPDebugCorePreferenceNames.AUTO_SAVE_DIRTY);
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/communication/DebugConnectionThread.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/communication/DebugConnectionThread.java
index 55fd58b99..c457812f3 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/communication/DebugConnectionThread.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/communication/DebugConnectionThread.java
@@ -485,7 +485,7 @@ public class DebugConnectionThread implements Runnable {
inputManager.setTransferEncoding(launchConfiguration.getAttribute(IDebugParametersKeys.TRANSFER_ENCODING, ""));
String phpExeString = launchConfiguration.getAttribute(PHPCoreConstants.ATTR_LOCATION, (String) null);
String fileNameString = launchConfiguration.getAttribute(PHPCoreConstants.ATTR_FILE, (String) null);
- boolean runWithDebugInfo = launchConfiguration.getAttribute(IPHPConstants.RunWithDebugInfo, true);
+ boolean runWithDebugInfo = launchConfiguration.getAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, true);
String projectString = launchConfiguration.getAttribute(PHPCoreConstants.ATTR_WORKING_DIRECTORY, (String) null);
if (launch.getLaunchMode().equals(ILaunchManager.DEBUG_MODE)) {
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/debugger/PHPWebServerDebuggerInitializer.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/debugger/PHPWebServerDebuggerInitializer.java
index a07678369..0aefa4e37 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/debugger/PHPWebServerDebuggerInitializer.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/debugger/PHPWebServerDebuggerInitializer.java
@@ -28,6 +28,7 @@ import org.eclipse.php.debug.core.PHPDebugCoreMessages;
import org.eclipse.php.debug.core.PHPDebugPlugin;
import org.eclipse.php.debug.core.debugger.parameters.IDebugParametersInitializer;
import org.eclipse.php.debug.core.debugger.parameters.IDebugParametersKeys;
+import org.eclipse.ui.PlatformUI;
public class PHPWebServerDebuggerInitializer {
@@ -40,12 +41,30 @@ public class PHPWebServerDebuggerInitializer {
public void debug() throws DebugException {
IDebugParametersInitializer parametersInitializer = DebugParametersInitializersRegistry.getBestMatchDebugParametersInitializer(launch.getLaunchMode());
String debugQuery = launch.getAttribute(IDebugParametersKeys.ORIGINAL_URL) + "?" + parametersInitializer.generateQuery(launch);
+ boolean openInBrowser = false;
try {
- connect(new URL(debugQuery), Integer.parseInt(launch.getAttribute(IDebugParametersKeys.PORT)), false);
- } catch (java.net.MalformedURLException e) {
- Logger.logException("Malformed URL Exception " + debugQuery, e); //Debugger_Unexpected_Error
- String errorMessage = PHPDebugCoreMessages.Debugger_Unexpected_Error_1;
- throw new DebugException(new Status(IStatus.ERROR, PHPDebugPlugin.getID(), IPHPConstants.INTERNAL_ERROR, errorMessage, e));
+ openInBrowser = launch.getLaunchConfiguration().getAttribute(IPHPConstants.OPEN_IN_BROWSER, false);
+ } catch (Throwable t) {
+ Logger.logException("Error obtaining the 'openInBrowser' configuration.", t);
+ }
+ if (openInBrowser) {
+ // Start the debug session by openning a browser that will actually trigger the URL connection
+ // to the debug server.
+ try {
+ PlatformUI.getWorkbench().getBrowserSupport().createBrowser(null).openURL(new URL(debugQuery));
+ } catch (Throwable t) {
+ Logger.logException("Error initializing the web browser.", t);
+ String errorMessage = PHPDebugCoreMessages.Debugger_Unexpected_Error_1;
+ throw new DebugException(new Status(IStatus.ERROR, PHPDebugPlugin.getID(), IPHPConstants.INTERNAL_ERROR, errorMessage, t));
+ }
+ } else {
+ try {
+ connect(new URL(debugQuery), Integer.parseInt(launch.getAttribute(IDebugParametersKeys.PORT)), false);
+ } catch (java.net.MalformedURLException e) {
+ Logger.logException("Malformed URL Exception " + debugQuery, e); //Debugger_Unexpected_Error
+ String errorMessage = PHPDebugCoreMessages.Debugger_Unexpected_Error_1;
+ throw new DebugException(new Status(IStatus.ERROR, PHPDebugPlugin.getID(), IPHPConstants.INTERNAL_ERROR, errorMessage, e));
+ }
}
}
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/launching/PHPExecutableLaunchDelegate.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/launching/PHPExecutableLaunchDelegate.java
index 46942ee0f..61cd662cc 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/launching/PHPExecutableLaunchDelegate.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/launching/PHPExecutableLaunchDelegate.java
@@ -63,7 +63,7 @@ public class PHPExecutableLaunchDelegate extends LaunchConfigurationDelegate {
String phpExeString = configuration.getAttribute(PHPCoreConstants.ATTR_LOCATION, (String) null);
String projectName = configuration.getAttribute(PHPCoreConstants.ATTR_WORKING_DIRECTORY, (String) null);
String fileNameString = configuration.getAttribute(PHPCoreConstants.ATTR_FILE, (String) null);
- boolean runWithDebugInfo = configuration.getAttribute(IPHPConstants.RunWithDebugInfo, true);
+ boolean runWithDebugInfo = configuration.getAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, true);
if (monitor.isCanceled()) {
return;
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceInitializer.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceInitializer.java
index 59893eebe..788b5975e 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceInitializer.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceInitializer.java
@@ -28,6 +28,7 @@ public class PHPDebugCorePreferenceInitializer extends AbstractPreferenceInitial
node.putBoolean(PHPDebugCorePreferenceNames.STOP_AT_FIRST_LINE, false);
node.putBoolean(PHPDebugCorePreferenceNames.USE_PHP_DEBUG_PERSPECTIVE, true);
node.putBoolean(PHPDebugCorePreferenceNames.RUN_WITH_DEBUG_INFO, true);
+ node.putBoolean(PHPDebugCorePreferenceNames.OPEN_IN_BROWSER, false);
node.putBoolean(PHPDebugCorePreferenceNames.AUTO_SAVE_DIRTY, false);
node.putBoolean(PHPDebugCorePreferenceNames.OPEN_DEBUG_VIEWS, true);
node.putInt(PHPDebugCorePreferenceNames.DEBUG_PORT, 10000);
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceNames.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceNames.java
index 14d91fd20..fc39528d5 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceNames.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/debug/core/preferences/PHPDebugCorePreferenceNames.java
@@ -34,6 +34,7 @@ public class PHPDebugCorePreferenceNames {
public static final String DIALOG_COLUMN_WIDTH = Debug_ID + "phpdebug.dialog.columnwidth";//$NON-NLS-1$
public static final String RUN_WITH_DEBUG_INFO = Debug_ID + "run_with_debug_info";//$NON-NLS-1$
+ public static final String OPEN_IN_BROWSER = Debug_ID + "open_in_browser";//$NON-NLS-1$
public static final String AUTO_SAVE_DIRTY = Debug_ID + "auto_save_dirty";//$NON-NLS-1$
public static final String OPEN_DEBUG_VIEWS = Debug_ID + "open_debug_views";//$NON-NLS-1$
public static final String DEDAULT_URL = Debug_ID + "default_url";//$NON-NLS-1$
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIMessages.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIMessages.java
index c66d5d5b4..d7440340e 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIMessages.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIMessages.java
@@ -87,6 +87,7 @@ public class PHPDebugUIMessages extends NLS {
public static String PHPexe_executable_was_not_found_1;
public static String PHPexe_ok_2;
public static String PHPexe_Run_With_Debug_Info;
+ public static String PHPdebug_open_in_browser;
public static String addPHPexeDialog_browse1;
public static String addPHPexeDialog_duplicateName;
@@ -126,6 +127,7 @@ public class PHPDebugUIMessages extends NLS {
public static String PhpDebugPreferencePage_8;
public static String PhpDebugPreferencePage_9;
public static String PhpDebugPreferencePage_10;
+ public static String PhpDebugPreferencePage_11;
public static String PHPsComboBlock_NoPHPsTitle;
public static String PHPsComboBlock_noPHPsMessage;
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIPluginResources.properties b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIPluginResources.properties
index c51240f10..7c08476f7 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIPluginResources.properties
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/PHPDebugUIPluginResources.properties
@@ -77,6 +77,8 @@ InstalledPHPsBlock_16=PHP executable
PHPexe_executable_was_not_found_1=Target is not a PHP Root. PHP executable was not found
PHPexe_ok_2=ok
PHPexe_Run_With_Debug_Info=Run With Debug Info
+PHPdebug_open_in_browser=Open in Browser
+PHPdebug
addPHPexeDialog_browse1=&Browse...
addPHPexeDialog_duplicateName=The name is already used.
@@ -106,6 +108,7 @@ PhpDebugPreferencePage_7=Open PHP Debug Views
PhpDebugPreferencePage_8=PHP Debug
PhpDebugPreferencePage_9=Default Server URL
PhpDebugPreferencePage_10=Auto-save edited files
+PhpDebugPreferencePage_11=Open in Browser
PHPsComboBlock_noPHPsMessage=No PHP executables locations are defined. Define a PHP executable location before continuing
launch_failure_no_target=launch target not found
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/console/PHPConsoleColorProvider.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/console/PHPConsoleColorProvider.java
index 699db7c07..4f735fab4 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/console/PHPConsoleColorProvider.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/console/PHPConsoleColorProvider.java
@@ -71,7 +71,11 @@ public class PHPConsoleColorProvider extends ConsoleColorProvider {
}
fLaunch = process.getLaunch();
- PHPDebugTarget target = (PHPDebugTarget) fLaunch.getDebugTarget();
+
+ PHPDebugTarget target = null;
+ if (fLaunch.getDebugTarget() instanceof PHPDebugTarget) {
+ target = (PHPDebugTarget) fLaunch.getDebugTarget();
+ }
if (target != null)
target.addConsoleEventListener(new PHPConsoleListener(debugMonitor, fConsole, fLaunch, fPHPHyperLink));
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExeLaunchShortcut.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExeLaunchShortcut.java
index 89dd7fe2a..e81bdeab4 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExeLaunchShortcut.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExeLaunchShortcut.java
@@ -177,7 +177,7 @@ public class PHPExeLaunchShortcut implements ILaunchShortcut {
wc.setAttribute(PHPCoreConstants.ATTR_FILE, phpPathString);
wc.setAttribute(PHPCoreConstants.ATTR_LOCATION, phpExeName);
- wc.setAttribute(IPHPConstants.RunWithDebugInfo, PHPDebugPlugin.getDebugInfoOption());
+ wc.setAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, PHPDebugPlugin.getDebugInfoOption());
config = wc.doSave();
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExecutableLaunchTab.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExecutableLaunchTab.java
index 2c3bd7cb5..4ce4ec9e3 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExecutableLaunchTab.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPExecutableLaunchTab.java
@@ -350,7 +350,7 @@ public class PHPExecutableLaunchTab extends AbstractLaunchConfigurationTab {
boolean runOption = PHPDebugPlugin.getDebugInfoOption();
try {
- runOption = configuration.getAttribute(IPHPConstants.RunWithDebugInfo, runOption);
+ runOption = configuration.getAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, runOption);
} catch (CoreException e) {
Logger.log(Logger.ERROR, "Error reading configuration", e); //$NON-NLS-1$
}
@@ -376,7 +376,7 @@ public class PHPExecutableLaunchTab extends AbstractLaunchConfigurationTab {
configuration.setAttribute(PHPCoreConstants.ATTR_FILE, arguments);
}
boolean debugInfo = enableDebugInfoOption ? runWithDebugInfo.getSelection() : true;
- configuration.setAttribute(IPHPConstants.RunWithDebugInfo, debugInfo);
+ configuration.setAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, debugInfo);
}
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerLaunchShortcut.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerLaunchShortcut.java
index e3a7c7be1..51a74f0bf 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerLaunchShortcut.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerLaunchShortcut.java
@@ -12,8 +12,6 @@ package org.eclipse.php.debug.ui.launching;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.debug.core.*;
@@ -22,15 +20,12 @@ import org.eclipse.debug.ui.ILaunchShortcut;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.php.core.PHPCoreConstants;
import org.eclipse.php.core.documentModel.provisional.contenttype.ContentTypeIdForPHP;
import org.eclipse.php.core.phpModel.PHPModelUtil;
import org.eclipse.php.core.phpModel.phpElementData.PHPCodeData;
import org.eclipse.php.core.util.FileUtils;
import org.eclipse.php.debug.core.IPHPConstants;
import org.eclipse.php.debug.core.PHPDebugPlugin;
-import org.eclipse.php.debug.core.preferences.PHPexeItem;
-import org.eclipse.php.debug.core.preferences.PHPexes;
import org.eclipse.php.debug.ui.PHPDebugUIMessages;
import org.eclipse.php.debug.ui.PHPDebugUIPlugin;
import org.eclipse.php.server.core.Server;
@@ -59,7 +54,7 @@ public class PHPServerLaunchShortcut implements ILaunchShortcut {
ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
return lm.getLaunchConfigurationType(IPHPConstants.PHPServerLaunchType);
}
-
+
public static void searchAndLaunch(Object[] search, String mode, ILaunchConfigurationType configType) {
int entries = search == null ? 0 : search.length;
for (int i = 0; i < entries; i++) {
@@ -151,7 +146,7 @@ public class PHPServerLaunchShortcut implements ILaunchShortcut {
*/
static ILaunchConfiguration createConfiguration(IProject project, String fileName, Server server, ILaunchConfigurationType configType) throws CoreException {
ILaunchConfiguration config = null;
- if(!FileUtils.fileExists(fileName)) {
+ if (!FileUtils.fileExists(fileName)) {
return null;
}
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, DebugPlugin.getDefault().getLaunchManager().generateUniqueLaunchConfigurationNameFrom("New_configuration"));
@@ -159,8 +154,9 @@ public class PHPServerLaunchShortcut implements ILaunchShortcut {
wc.setAttribute(Server.NAME, server.getName());
wc.setAttribute(Server.FILE_NAME, fileName);
wc.setAttribute(Server.CONTEXT_ROOT, project.getName());
- wc.setAttribute(Server.BASE_URL,server.getBaseURL() + '/' + project.getName() + '/' + new Path(fileName).lastSegment());
- wc.setAttribute(IPHPConstants.RunWithDebugInfo, PHPDebugPlugin.getDebugInfoOption());
+ wc.setAttribute(Server.BASE_URL, server.getBaseURL() + '/' + project.getName() + '/' + new Path(fileName).lastSegment());
+ wc.setAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, PHPDebugPlugin.getDebugInfoOption());
+ wc.setAttribute(IPHPConstants.OPEN_IN_BROWSER, PHPDebugPlugin.getOpenInBrowserOption());
if (server.canPublish()) {
wc.setAttribute(Server.PUBLISH, true);
}
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerTab.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerTab.java
index 358e0a7f6..a97c0fec0 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerTab.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/launching/PHPServerTab.java
@@ -33,10 +33,10 @@ import org.eclipse.swt.widgets.Composite;
public class PHPServerTab extends ServerTab {
- public static final String RUN_WITH_DEBUG = "run_with_debug";
-
protected Button runWithDebugger;
- protected boolean isChecked = false;
+ protected Button openBrowser;
+ protected boolean isRunWithDebugInfo;
+ protected boolean isOpenInBrowser;
private String mode;
public PHPServerTab() {
@@ -44,28 +44,40 @@ public class PHPServerTab extends ServerTab {
}
public void createExtensionControls(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 5;
+ layout.marginHeight = 5;
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+ composite.setLayoutData(data);
+
+ // Add the 'Open in Browser' checkbox.
+ openBrowser = new Button(composite, SWT.CHECK);
+ openBrowser.setText(PHPDebugUIMessages.PHPdebug_open_in_browser);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ openBrowser.setLayoutData(gd);
+ openBrowser.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ Button b = (Button) se.getSource();
+ isOpenInBrowser = b.getSelection();
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ // Add the 'Run With Debug Info' checkbox in case we are in a 'Run' launch mode.
mode = getLaunchConfigurationDialog().getMode();
if (ILaunchManager.RUN_MODE.equals(mode)) {
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 5;
- layout.marginHeight = 5;
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(data);
-
runWithDebugger = new Button(composite, SWT.CHECK);
runWithDebugger.setText(PHPDebugUIMessages.PHPexe_Run_With_Debug_Info);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
runWithDebugger.setLayoutData(gd);
runWithDebugger.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
Button b = (Button) se.getSource();
- isChecked = b.getSelection();
+ isRunWithDebugInfo = b.getSelection();
updateLaunchConfigurationDialog();
}
});
@@ -73,23 +85,23 @@ public class PHPServerTab extends ServerTab {
}
protected void initializeExtensionControls(ILaunchConfiguration configuration) {
- if (runWithDebugger == null) {
- return;
- }
try {
- boolean checked = configuration.getAttribute(RUN_WITH_DEBUG, PHPDebugPlugin.getDebugInfoOption());
- runWithDebugger.setSelection(checked);
+ isOpenInBrowser = configuration.getAttribute(IPHPConstants.OPEN_IN_BROWSER, PHPDebugPlugin.getOpenInBrowserOption());
+ openBrowser.setSelection(isOpenInBrowser);
+ if (runWithDebugger != null) {
+ isRunWithDebugInfo = configuration.getAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, PHPDebugPlugin.getDebugInfoOption());
+ runWithDebugger.setSelection(isRunWithDebugInfo);
+ }
} catch (Exception e) {
Logger.log(Logger.ERROR, "Error reading configuration", e); //$NON-NLS-1$
}
}
protected void applyExtension(ILaunchConfigurationWorkingCopy configuration) {
- if (runWithDebugger == null) {
- return;
+ configuration.setAttribute(IPHPConstants.OPEN_IN_BROWSER, isOpenInBrowser);
+ if (runWithDebugger != null) {
+ configuration.setAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, isRunWithDebugInfo);
}
- boolean checked = runWithDebugger.getSelection();
- configuration.setAttribute(RUN_WITH_DEBUG, checked);
}
protected boolean isValidExtension(ILaunchConfiguration launchConfig) {
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/preferences/PHPDebugPreferencesWorkspaceAddon.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/preferences/PHPDebugPreferencesWorkspaceAddon.java
index be582c615..b489f1978 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/preferences/PHPDebugPreferencesWorkspaceAddon.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/debug/ui/preferences/PHPDebugPreferencesWorkspaceAddon.java
@@ -29,6 +29,7 @@ public class PHPDebugPreferencesWorkspaceAddon extends AbstractDebugPreferencesP
private Button fUsePHPDebugPerspective;
private Button fRunWithDebugInfo;
+ private Button fOpenInBrowser;
private Button fOpenDebugViews;
private Button fAutoSaveDirty;
@@ -42,6 +43,7 @@ public class PHPDebugPreferencesWorkspaceAddon extends AbstractDebugPreferencesP
fUsePHPDebugPerspective.setSelection(prefs.getBoolean(PHPDebugCorePreferenceNames.USE_PHP_DEBUG_PERSPECTIVE));
fOpenDebugViews.setSelection(prefs.getBoolean(PHPDebugCorePreferenceNames.OPEN_DEBUG_VIEWS));
fRunWithDebugInfo.setSelection(prefs.getBoolean(PHPDebugCorePreferenceNames.RUN_WITH_DEBUG_INFO));
+ fOpenInBrowser.setSelection(prefs.getBoolean(PHPDebugCorePreferenceNames.OPEN_IN_BROWSER));
fAutoSaveDirty.setSelection(prefs.getBoolean(PHPDebugCorePreferenceNames.AUTO_SAVE_DIRTY));
}
@@ -63,6 +65,7 @@ public class PHPDebugPreferencesWorkspaceAddon extends AbstractDebugPreferencesP
Preferences prefs = PHPProjectPreferences.getModelPreferences();
fUsePHPDebugPerspective.setSelection(prefs.getDefaultBoolean(PHPDebugCorePreferenceNames.USE_PHP_DEBUG_PERSPECTIVE));
fRunWithDebugInfo.setSelection(prefs.getDefaultBoolean(PHPDebugCorePreferenceNames.RUN_WITH_DEBUG_INFO));
+ fOpenInBrowser.setSelection(prefs.getDefaultBoolean(PHPDebugCorePreferenceNames.OPEN_IN_BROWSER));
fOpenDebugViews.setSelection(prefs.getDefaultBoolean(PHPDebugCorePreferenceNames.OPEN_DEBUG_VIEWS));
fAutoSaveDirty.setSelection(prefs.getDefaultBoolean(PHPDebugCorePreferenceNames.AUTO_SAVE_DIRTY));
}
@@ -70,14 +73,16 @@ public class PHPDebugPreferencesWorkspaceAddon extends AbstractDebugPreferencesP
private void addWorkspacePreferenceSubsection(Composite composite) {
fUsePHPDebugPerspective = addCheckBox(composite, PHPDebugUIMessages.PhpDebugPreferencePage_2, PHPDebugCorePreferenceNames.USE_PHP_DEBUG_PERSPECTIVE, 0);
fRunWithDebugInfo = addCheckBox(composite, PHPDebugUIMessages.PhpDebugPreferencePage_5, PHPDebugCorePreferenceNames.RUN_WITH_DEBUG_INFO, 0);
+ fOpenInBrowser = addCheckBox(composite, PHPDebugUIMessages.PhpDebugPreferencePage_11, PHPDebugCorePreferenceNames.OPEN_IN_BROWSER, 0);
fOpenDebugViews = addCheckBox(composite, PHPDebugUIMessages.PhpDebugPreferencePage_7, PHPDebugCorePreferenceNames.OPEN_DEBUG_VIEWS, 0);
- fAutoSaveDirty = addCheckBox(composite, PHPDebugUIMessages.PhpDebugPreferencePage_10, PHPDebugCorePreferenceNames.OPEN_DEBUG_VIEWS, 0);
+ fAutoSaveDirty = addCheckBox(composite, PHPDebugUIMessages.PhpDebugPreferencePage_10, PHPDebugCorePreferenceNames.AUTO_SAVE_DIRTY, 0);
}
private void savePreferences() {
Preferences prefs = PHPProjectPreferences.getModelPreferences();
prefs.setValue(PHPDebugCorePreferenceNames.USE_PHP_DEBUG_PERSPECTIVE, fUsePHPDebugPerspective.getSelection());
prefs.setValue(PHPDebugCorePreferenceNames.RUN_WITH_DEBUG_INFO, fRunWithDebugInfo.getSelection());
+ prefs.setValue(PHPDebugCorePreferenceNames.OPEN_IN_BROWSER, fOpenInBrowser.getSelection());
prefs.setValue(PHPDebugCorePreferenceNames.OPEN_DEBUG_VIEWS, fOpenDebugViews.getSelection());
prefs.setValue(PHPDebugCorePreferenceNames.AUTO_SAVE_DIRTY, fAutoSaveDirty.getSelection());
PHPDebugPlugin.getDefault().savePluginPreferences();

Back to the top