protected Button fOpenDBGSessionInBrowserCheckBox;
+ protected Button fOpenDBGSessionInExternalBrowserCheckBox;
+
protected Button fPathMapRemoveButton;
protected Button fPathMapAddButton;
setRemoteTabEnableState();
} else if (source == fRemoteDebugTranslate) {
setRemoteTabEnableState();
+ } else if (source == fOpenDBGSessionInBrowserCheckBox) {
+ setRemoteTabEnableState();
} else {
updateLaunchConfigurationDialog();
}
makeupTargetFile();
-
}
}
private static final boolean DEFAULT_OPEN_DBGSESSION_IN_BROWSER = true;
+ private static final boolean DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER = false;
+
static String[] columnTitles = {
PHPDebugUiMessages
.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.local"),
GridData.HORIZONTAL_ALIGN_BEGINNING));
fOpenDBGSessionInBrowserCheckBox.addSelectionListener(fListener);
+ // addendum
+ fOpenDBGSessionInExternalBrowserCheckBox = new Button(comp, SWT.CHECK);
+ fOpenDBGSessionInExternalBrowserCheckBox
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInExternalBrowserCheckBox.label"));
+ fOpenDBGSessionInExternalBrowserCheckBox.setLayoutData(new GridData(
+ SWT.BEGINNING));
+ ((GridData) fOpenDBGSessionInExternalBrowserCheckBox.getLayoutData()).horizontalIndent = 16;
+ fOpenDBGSessionInExternalBrowserCheckBox
+ .addSelectionListener(fListener);
+ // addendum
+
label = new Label(comp, SWT.NONE);
label
.setText(PHPDebugUiMessages
fPathMapRemoveButton.setEnabled(false);
fPathMapAddButton.setEnabled(false);
fOpenDBGSessionInBrowserCheckBox.setEnabled(false);
+ fOpenDBGSessionInExternalBrowserCheckBox.setEnabled(false);
} else {
setPathMapButtonsEnableState();
}
//
if (fRemoteDebugCheckBox.getSelection()) {
fOpenDBGSessionInBrowserCheckBox.setEnabled(true);
+ fOpenDBGSessionInExternalBrowserCheckBox
+ .setEnabled(fOpenDBGSessionInBrowserCheckBox.getSelection());
fRemoteDebugTranslate.setEnabled(true);
int selectCount = this.fRemoteDebugPathMapTable
.getSelectionIndices().length;
} catch (CoreException ce) {
fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG);
}
+ if (fRemoteDebugCheckBox.getSelection()) {
+ tabFolder.setSelection(0);
+ }
try {
fRemoteDebugTranslate.setSelection(configuration.getAttribute(
PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE,
fOpenDBGSessionInBrowserCheckBox
.setSelection(DEFAULT_OPEN_DBGSESSION_IN_BROWSER);
}
+ try {
+ fOpenDBGSessionInExternalBrowserCheckBox
+ .setSelection(configuration
+ .getAttribute(
+ PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_EXTERNAL_BROWSER,
+ DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER));
+ } catch (CoreException ce) {
+ fOpenDBGSessionInExternalBrowserCheckBox
+ .setSelection(DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER);
+ }
+
setRemoteTabEnableState();
+
try {
fRemoteSourcePath.setText(configuration.getAttribute(
PHPLaunchConfigurationAttribute.REMOTE_PATH, ""));
configuration.setAttribute(
PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER,
fOpenDBGSessionInBrowserCheckBox.getSelection());
+ configuration
+ .setAttribute(
+ PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_EXTERNAL_BROWSER,
+ fOpenDBGSessionInExternalBrowserCheckBox.getSelection());
}
protected Composite createPageRoot(Composite parent) {
package net.sourceforge.phpeclipse.ui.editor;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import net.sourceforge.phpeclipse.ui.IPreferenceConstants;
import net.sourceforge.phpeclipse.ui.WebUI;
import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWebBrowser;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
import org.eclipse.ui.internal.Perspective;
import org.eclipse.ui.internal.WorkbenchPage;
import org.eclipse.ui.part.IShowInTarget;
}
}
+ private static final String BROWSER_ID = "net.sourceforge.phpeclipse.browser";
+
+ /**
+ * convenient method to show browser as Editor
+ *
+ */
+ public static void showBrowserAsEditor(IFile file, String queryString) {
+ showBrowser(IWorkbenchBrowserSupport.AS_EDITOR, file, queryString);
+ }
+
+ /**
+ * convenient method to show browser as External Web Browser
+ *
+ */
+ public static void showBrowserAsExternal(IFile file, String queryString) {
+ showBrowser(IWorkbenchBrowserSupport.AS_EXTERNAL, file, queryString);
+ }
+
+ /**
+ * convenient method to show browser as View
+ *
+ */
+ public static void showBrowserAsView(IFile file, String queryString) {
+ showBrowser(IWorkbenchBrowserSupport.AS_VIEW, file, queryString);
+ }
+
+ /**
+ * Show browser according to General settings
+ *
+ * See IWorkbenchBrowserSupport and DefaultWorkbenchBrowserSupport.
+ */
+ public static void showBrowser(int style, IFile file, String queryString) {
+ ShowInContextBrowser context = getShowInContext(file, true, queryString);
+ String url = context.getLocalhostUrl();
+ String id = BROWSER_ID;
+ switch (style) {
+ case IWorkbenchBrowserSupport.AS_EXTERNAL:
+ id += ".x";
+ break;
+ case IWorkbenchBrowserSupport.AS_EDITOR:
+ id += ".e";
+ break;
+ case IWorkbenchBrowserSupport.AS_VIEW:
+ id += ".v";
+ break;
+ }
+ style |= IWorkbenchBrowserSupport.LOCATION_BAR
+ | IWorkbenchBrowserSupport.NAVIGATION_BAR
+ | IWorkbenchBrowserSupport.STATUS;
+ try {
+ IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport()
+ .createBrowser(style, id, null, url);
+ browser.openURL(new URL(url));
+
+ } catch (PartInitException e) {
+ WebUI.log(e);
+ } catch (MalformedURLException e) {
+ WebUI.log(e);
+ }
+ }
+
}