From: bananeweizen Date: Thu, 26 Jan 2006 22:25:56 +0000 (+0000) Subject: fill all necessary default values for DBG in launch configuration X-Git-Url: http://git.phpeclipse.com fill all necessary default values for DBG in launch configuration --- diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPArgumentsTab.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPArgumentsTab.java index d96b9f6..26ff6c7 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPArgumentsTab.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPArgumentsTab.java @@ -59,8 +59,6 @@ public class PHPArgumentsTab extends AbstractLaunchConfigurationTab { new Label(defaultWorkingDirectoryComposite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.working_dir_use_default_message")); defaultWorkingDirectoryComposite.pack(); - Label verticalSpacer = new Label(composite, SWT.NONE); - new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.interpreter_args_box_title")); interpreterArgsText = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); interpreterArgsText.setLayoutData(new GridData(GridData.FILL_BOTH)); @@ -79,7 +77,6 @@ public class PHPArgumentsTab extends AbstractLaunchConfigurationTab { } public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - //setUseDefaultWorkingDirectory(true); configuration.setAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, PHPDebugUiConstants.DEFAULT_WORKING_DIRECTORY); // set hidden attribute configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "net.sourceforge.phpdt.debug.ui.PHPSourceLocator") ; @@ -139,7 +136,7 @@ public class PHPArgumentsTab extends AbstractLaunchConfigurationTab { setErrorMessage(null); return true; } - + protected void log(Throwable t) { PHPDebugUiPlugin.log(t); } diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEntryPointTab.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEntryPointTab.java index b233034..37007fb 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEntryPointTab.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEntryPointTab.java @@ -8,7 +8,6 @@ import net.sourceforge.phpdt.internal.ui.util.PHPFileSelector; import net.sourceforge.phpdt.internal.ui.util.PHPProjectSelector; import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Path; @@ -65,7 +64,7 @@ public class PHPEntryPointTab extends AbstractLaunchConfigurationTab { }); } - protected IProject getContext() { + protected IResource getContext() { IWorkbenchPage page = PHPDebugUiPlugin.getActivePage(); if (page != null) { ISelection selection = page.getSelection(); @@ -74,7 +73,7 @@ public class PHPEntryPointTab extends AbstractLaunchConfigurationTab { if (!ss.isEmpty()) { Object obj = ss.getFirstElement(); if (obj instanceof IResource) - return ((IResource) obj).getProject(); + return ((IResource) obj); } } IEditorPart part = page.getActiveEditor(); @@ -82,7 +81,7 @@ public class PHPEntryPointTab extends AbstractLaunchConfigurationTab { IEditorInput input = part.getEditorInput(); IResource file = (IResource) input.getAdapter(IResource.class); if (file != null) { - return file.getProject(); + return file; } } } @@ -90,9 +89,11 @@ public class PHPEntryPointTab extends AbstractLaunchConfigurationTab { } public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - IProject project = getContext(); - if (project != null) - configuration.setAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, project.getName()); + IResource file = getContext(); + if (file != null) { + configuration.setAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, file.getProject().getName()); + configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_NAME,file.getProjectRelativePath().toOSString()); + } } public void initializeFrom(ILaunchConfiguration configuration) { 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 a40d0c0..7146d15 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 @@ -15,7 +15,11 @@ import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute; import net.sourceforge.phpdt.internal.launching.PHPRuntime; import net.sourceforge.phpdt.internal.ui.PHPUiImages; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; @@ -71,40 +75,40 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { private class RemoteDebugTabListener extends SelectionAdapter implements ModifyListener { - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) - */ - public void modifyText(ModifyEvent e) { - updateLaunchConfigurationDialog(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) { - Object source = e.getSource(); - if (source == fRemoteDebugPathMapTable) { - setPathMapButtonsEnableState(); - } else if (source == fPathMapAddButton) { - handlePathMapAddButtonSelected(); - } else if (source == fPathMapEditButton) { - handlePathMapEditButtonSelected(); - } else if (source == fPathMapRemoveButton) { - handlePathMapRemoveButtonSelected(); - } else if (source == fRemoteDebugCheckBox) { - setRemoteTabEnableState(); - } else if (source == fRemoteDebugTranslate) { - setRemoteTabEnableState(); - } else { - updateLaunchConfigurationDialog(); - ; - } - - } + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) + */ + public void modifyText(ModifyEvent e) { + updateLaunchConfigurationDialog(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + public void widgetSelected(SelectionEvent e) { + Object source = e.getSource(); + if (source == fRemoteDebugPathMapTable) { + setPathMapButtonsEnableState(); + } else if (source == fPathMapAddButton) { + handlePathMapAddButtonSelected(); + } else if (source == fPathMapEditButton) { + handlePathMapEditButtonSelected(); + } else if (source == fPathMapRemoveButton) { + handlePathMapRemoveButtonSelected(); + } else if (source == fRemoteDebugCheckBox) { + setRemoteTabEnableState(); + } else if (source == fRemoteDebugTranslate) { + setRemoteTabEnableState(); + } else { + updateLaunchConfigurationDialog(); + ; + } + + } } @@ -119,203 +123,203 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { private static final boolean DEFAULT_OPEN_DBGSESSION_IN_BROWSER = true; static String[] columnTitles = { - PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.local"), - PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.remote") }; + PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.local"), + PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.remote") }; public PHPEnvironmentTab() { - super(); + super(); } public void createControl(Composite parent) { - Composite composite = createPageRoot(parent); + Composite composite = createPageRoot(parent); - tabFolder = new TabFolder(composite, SWT.NONE); - GridData gridData = new GridData(GridData.FILL_BOTH); - tabFolder.setLayoutData(gridData); + tabFolder = new TabFolder(composite, SWT.NONE); + GridData gridData = new GridData(GridData.FILL_BOTH); + tabFolder.setLayoutData(gridData); - // addLoadPathTab(tabFolder); - addInterpreterTab(tabFolder); - addRemoteDebugTab(tabFolder); + // addLoadPathTab(tabFolder); + addInterpreterTab(tabFolder); + addRemoteDebugTab(tabFolder); } protected void addRemoteDebugTab(TabFolder tabFolder) { - Label label; - - TabItem remoteDebugTab = new TabItem(tabFolder, SWT.NONE, 0); - remoteDebugTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.label")); - - Composite comp = new Composite(tabFolder, SWT.NONE); - comp.setLayout(new GridLayout()); - remoteDebugTab.setControl(comp); - GridData gd; - - fRemoteDebugCheckBox = new Button(comp, SWT.CHECK); - fRemoteDebugCheckBox.setText(PHPDebugUiMessages - .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteCheckBox.label")); - fRemoteDebugCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - fRemoteDebugCheckBox.addSelectionListener(fListener); - - fRemoteDebugTranslate = new Button(comp, SWT.CHECK); - fRemoteDebugTranslate.setText(PHPDebugUiMessages - .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteTranslate.label")); - fRemoteDebugTranslate.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - fRemoteDebugTranslate.addSelectionListener(fListener); - - fOpenDBGSessionInBrowserCheckBox = new Button(comp, SWT.CHECK); - fOpenDBGSessionInBrowserCheckBox.setText(PHPDebugUiMessages - .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInBrowserCheckBox.label")); - fOpenDBGSessionInBrowserCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - fOpenDBGSessionInBrowserCheckBox.addSelectionListener(fListener); - - label = new Label(comp, SWT.NONE); - label.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteSourcePath.label")); - fRemoteSourcePath = new Text(comp, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - fRemoteSourcePath.setLayoutData(gd); - fRemoteSourcePath.addModifyListener(fListener); - - createVerticalSpacer(comp, 1); - - Composite pathMapComp = new Composite(comp, SWT.NONE); - gd = new GridData(GridData.FILL_BOTH); - pathMapComp.setLayoutData(gd); - GridLayout parametersLayout = new GridLayout(); - parametersLayout.numColumns = 2; - parametersLayout.marginHeight = 0; - parametersLayout.marginWidth = 0; - pathMapComp.setLayout(parametersLayout); - - Label pathMapLabel = new Label(pathMapComp, SWT.NONE); - pathMapLabel.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.label")); - gd = new GridData(); - gd.horizontalSpan = 2; - pathMapLabel.setLayoutData(gd); - - fRemoteDebugPathMapTable = new Table(pathMapComp, SWT.BORDER | SWT.MULTI); - TableLayout tableLayout = new TableLayout(); - fRemoteDebugPathMapTable.setLayout(tableLayout); - - gd = new GridData(GridData.FILL_BOTH); - fRemoteDebugPathMapTable.setLayoutData(gd); - TableColumn column1 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE); - column1.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.local")); //$NON-NLS-1$ - TableColumn column2 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE); - column2 - .setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.remote")); //$NON-NLS-1$ - tableLayout.addColumnData(new ColumnWeightData(100)); - tableLayout.addColumnData(new ColumnWeightData(100)); - fRemoteDebugPathMapTable.setHeaderVisible(true); - fRemoteDebugPathMapTable.setLinesVisible(true); - fRemoteDebugPathMapTable.addSelectionListener(fListener); - fRemoteDebugPathMapTable.addMouseListener(new MouseAdapter() { - public void mouseDoubleClick(MouseEvent e) { - setPathMapButtonsEnableState(); - if (fPathMapEditButton.isEnabled()) { - handlePathMapEditButtonSelected(); - } - } - }); - // fRemoteDebugPathMapTable.setEnabled(false); - - Composite envButtonComp = new Composite(pathMapComp, SWT.NONE); - GridLayout envButtonLayout = new GridLayout(); - envButtonLayout.marginHeight = 0; - envButtonLayout.marginWidth = 0; - envButtonComp.setLayout(envButtonLayout); - gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); - envButtonComp.setLayoutData(gd); - - fPathMapAddButton = createPushButton(envButtonComp, PHPDebugUiMessages - .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Add.label"), null); //$NON-NLS-1$ - fPathMapAddButton.addSelectionListener(fListener); - // fPathMapAddButton.setEnabled(false); - - fPathMapEditButton = createPushButton(envButtonComp, PHPDebugUiMessages - .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Edit.label"), null); //$NON-NLS-1$ - fPathMapEditButton.addSelectionListener(fListener); - // fPathMapEditButton.setEnabled(false); - - fPathMapRemoveButton = createPushButton(envButtonComp, PHPDebugUiMessages - .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Remove.label"), null); //$NON-NLS-1$ - fPathMapRemoveButton.addSelectionListener(fListener); - // fPathMapRemoveButton.setEnabled(false); + Label label; + + TabItem remoteDebugTab = new TabItem(tabFolder, SWT.NONE, 0); + remoteDebugTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.label")); + + Composite comp = new Composite(tabFolder, SWT.NONE); + comp.setLayout(new GridLayout()); + remoteDebugTab.setControl(comp); + GridData gd; + + fRemoteDebugCheckBox = new Button(comp, SWT.CHECK); + fRemoteDebugCheckBox.setText(PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteCheckBox.label")); + fRemoteDebugCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + fRemoteDebugCheckBox.addSelectionListener(fListener); + + fRemoteDebugTranslate = new Button(comp, SWT.CHECK); + fRemoteDebugTranslate.setText(PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteTranslate.label")); + fRemoteDebugTranslate.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + fRemoteDebugTranslate.addSelectionListener(fListener); + + fOpenDBGSessionInBrowserCheckBox = new Button(comp, SWT.CHECK); + fOpenDBGSessionInBrowserCheckBox.setText(PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInBrowserCheckBox.label")); + fOpenDBGSessionInBrowserCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + fOpenDBGSessionInBrowserCheckBox.addSelectionListener(fListener); + + label = new Label(comp, SWT.NONE); + label.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteSourcePath.label")); + fRemoteSourcePath = new Text(comp, SWT.BORDER | SWT.SINGLE); + gd = new GridData(GridData.FILL_HORIZONTAL); + fRemoteSourcePath.setLayoutData(gd); + fRemoteSourcePath.addModifyListener(fListener); + + createVerticalSpacer(comp, 1); + + Composite pathMapComp = new Composite(comp, SWT.NONE); + gd = new GridData(GridData.FILL_BOTH); + pathMapComp.setLayoutData(gd); + GridLayout parametersLayout = new GridLayout(); + parametersLayout.numColumns = 2; + parametersLayout.marginHeight = 0; + parametersLayout.marginWidth = 0; + pathMapComp.setLayout(parametersLayout); + + Label pathMapLabel = new Label(pathMapComp, SWT.NONE); + pathMapLabel.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.label")); + gd = new GridData(); + gd.horizontalSpan = 2; + pathMapLabel.setLayoutData(gd); + + fRemoteDebugPathMapTable = new Table(pathMapComp, SWT.BORDER | SWT.MULTI); + TableLayout tableLayout = new TableLayout(); + fRemoteDebugPathMapTable.setLayout(tableLayout); + + gd = new GridData(GridData.FILL_BOTH); + fRemoteDebugPathMapTable.setLayoutData(gd); + TableColumn column1 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE); + column1.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.local")); //$NON-NLS-1$ + TableColumn column2 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE); + column2 + .setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.remote")); //$NON-NLS-1$ + tableLayout.addColumnData(new ColumnWeightData(100)); + tableLayout.addColumnData(new ColumnWeightData(100)); + fRemoteDebugPathMapTable.setHeaderVisible(true); + fRemoteDebugPathMapTable.setLinesVisible(true); + fRemoteDebugPathMapTable.addSelectionListener(fListener); + fRemoteDebugPathMapTable.addMouseListener(new MouseAdapter() { + public void mouseDoubleClick(MouseEvent e) { + setPathMapButtonsEnableState(); + if (fPathMapEditButton.isEnabled()) { + handlePathMapEditButtonSelected(); + } + } + }); + // fRemoteDebugPathMapTable.setEnabled(false); + + Composite envButtonComp = new Composite(pathMapComp, SWT.NONE); + GridLayout envButtonLayout = new GridLayout(); + envButtonLayout.marginHeight = 0; + envButtonLayout.marginWidth = 0; + envButtonComp.setLayout(envButtonLayout); + gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); + envButtonComp.setLayoutData(gd); + + fPathMapAddButton = createPushButton(envButtonComp, PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Add.label"), null); //$NON-NLS-1$ + fPathMapAddButton.addSelectionListener(fListener); + // fPathMapAddButton.setEnabled(false); + + fPathMapEditButton = createPushButton(envButtonComp, PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Edit.label"), null); //$NON-NLS-1$ + fPathMapEditButton.addSelectionListener(fListener); + // fPathMapEditButton.setEnabled(false); + + fPathMapRemoveButton = createPushButton(envButtonComp, PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Remove.label"), null); //$NON-NLS-1$ + fPathMapRemoveButton.addSelectionListener(fListener); + // fPathMapRemoveButton.setEnabled(false); } void handlePathMapAddButtonSelected() { - EditPathMapDialog dialog = new EditPathMapDialog(getShell(), "Edit File Map", new String[] { EMPTY_STRING, EMPTY_STRING }); - openNewPathMapDialog(dialog, null); - // dialog.create(); - // if (dialog.open()==EditPathMapDialog.OK) - // { - // TableItem item = new TableItem (fRemoteDebugPathMapTable, SWT.NONE); - // item.setText(0,dialog.getLocalPath()); - // item.setText(1,dialog.getRemotePath()); - // updateLaunchConfigurationDialog(); - // } - // updateLaunchConfigurationDialog(); - setPathMapButtonsEnableState(); + EditPathMapDialog dialog = new EditPathMapDialog(getShell(), "Edit File Map", new String[] { EMPTY_STRING, EMPTY_STRING }); + openNewPathMapDialog(dialog, null); + // dialog.create(); + // if (dialog.open()==EditPathMapDialog.OK) + // { + // TableItem item = new TableItem (fRemoteDebugPathMapTable, SWT.NONE); + // item.setText(0,dialog.getLocalPath()); + // item.setText(1,dialog.getRemotePath()); + // updateLaunchConfigurationDialog(); + // } + // updateLaunchConfigurationDialog(); + setPathMapButtonsEnableState(); } void handlePathMapRemoveButtonSelected() { - int[] selectedIndices = this.fRemoteDebugPathMapTable.getSelectionIndices(); - this.fRemoteDebugPathMapTable.remove(selectedIndices); - setPathMapButtonsEnableState(); - updateLaunchConfigurationDialog(); + int[] selectedIndices = this.fRemoteDebugPathMapTable.getSelectionIndices(); + this.fRemoteDebugPathMapTable.remove(selectedIndices); + setPathMapButtonsEnableState(); + updateLaunchConfigurationDialog(); } void handlePathMapEditButtonSelected() { - TableItem selectedItem = this.fRemoteDebugPathMapTable.getSelection()[0]; - String local = selectedItem.getText(0); - String remote = selectedItem.getText(1); - EditPathMapDialog dialog = new EditPathMapDialog(getShell(), "Edit File Map", new String[] { local, remote }); - openNewPathMapDialog(dialog, selectedItem); + TableItem selectedItem = this.fRemoteDebugPathMapTable.getSelection()[0]; + String local = selectedItem.getText(0); + String remote = selectedItem.getText(1); + EditPathMapDialog dialog = new EditPathMapDialog(getShell(), "Edit File Map", new String[] { local, remote }); + openNewPathMapDialog(dialog, selectedItem); } /** * Set the enabled state of whole tab. */ private void setRemoteTabEnableState() { - boolean state = fRemoteDebugCheckBox.getSelection(); - fRemoteSourcePath.setEnabled(state); - fRemoteDebugTranslate.setEnabled(state); - - fRemoteDebugPathMapTable.setEnabled(state); - if (!state) { - fPathMapEditButton.setEnabled(false); - fPathMapRemoveButton.setEnabled(false); - fPathMapAddButton.setEnabled(false); - fOpenDBGSessionInBrowserCheckBox.setEnabled(false); - } else { - setPathMapButtonsEnableState(); - } - - updateLaunchConfigurationDialog(); + boolean state = fRemoteDebugCheckBox.getSelection(); + fRemoteSourcePath.setEnabled(state); + fRemoteDebugTranslate.setEnabled(state); + + fRemoteDebugPathMapTable.setEnabled(state); + if (!state) { + fPathMapEditButton.setEnabled(false); + fPathMapRemoveButton.setEnabled(false); + fPathMapAddButton.setEnabled(false); + fOpenDBGSessionInBrowserCheckBox.setEnabled(false); + } else { + setPathMapButtonsEnableState(); + } + + updateLaunchConfigurationDialog(); } /** * Set the enabled state of the three environment variable-related buttons based on the selection in the PathMapTable widget. */ private void setPathMapButtonsEnableState() { - // just do nothing for now - // - if (fRemoteDebugCheckBox.getSelection()) { - fOpenDBGSessionInBrowserCheckBox.setEnabled(true); - fRemoteDebugTranslate.setEnabled(true); - int selectCount = this.fRemoteDebugPathMapTable.getSelectionIndices().length; - if (selectCount < 1) { - fPathMapEditButton.setEnabled(false); - fPathMapRemoveButton.setEnabled(false); - } else { - fPathMapRemoveButton.setEnabled(true); - if (selectCount == 1) { - fPathMapEditButton.setEnabled(true); - } else { - fPathMapEditButton.setEnabled(false); - } - } - fPathMapAddButton.setEnabled(true); - } + // just do nothing for now + // + if (fRemoteDebugCheckBox.getSelection()) { + fOpenDBGSessionInBrowserCheckBox.setEnabled(true); + fRemoteDebugTranslate.setEnabled(true); + int selectCount = this.fRemoteDebugPathMapTable.getSelectionIndices().length; + if (selectCount < 1) { + fPathMapEditButton.setEnabled(false); + fPathMapRemoveButton.setEnabled(false); + } else { + fPathMapRemoveButton.setEnabled(true); + if (selectCount == 1) { + fPathMapEditButton.setEnabled(true); + } else { + fPathMapEditButton.setEnabled(false); + } + } + fPathMapAddButton.setEnabled(true); + } } /** @@ -325,34 +329,34 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { * the item to update, or null if adding a new item */ private void openNewPathMapDialog(EditPathMapDialog dialog, TableItem updateItem) { - if (dialog.open() != EditPathMapDialog.OK) { - return; - } - String[] pathPair = dialog.getPathPair(); - TableItem tableItem = updateItem; - if (tableItem == null) { - tableItem = getTableItemForName(pathPair[0]); - if (tableItem == null) { - tableItem = new TableItem(this.fRemoteDebugPathMapTable, SWT.NONE); - } - } - tableItem.setText(pathPair); - this.fRemoteDebugPathMapTable.setSelection(new TableItem[] { tableItem }); - updateLaunchConfigurationDialog(); + if (dialog.open() != EditPathMapDialog.OK) { + return; + } + String[] pathPair = dialog.getPathPair(); + TableItem tableItem = updateItem; + if (tableItem == null) { + tableItem = getTableItemForName(pathPair[0]); + if (tableItem == null) { + tableItem = new TableItem(this.fRemoteDebugPathMapTable, SWT.NONE); + } + } + tableItem.setText(pathPair); + this.fRemoteDebugPathMapTable.setSelection(new TableItem[] { tableItem }); + updateLaunchConfigurationDialog(); } /** * Helper method that indicates whether the specified parameter name is already present in the parameters table. */ private TableItem getTableItemForName(String candidateName) { - TableItem[] items = this.fRemoteDebugPathMapTable.getItems(); - for (int i = 0; i < items.length; i++) { - String name = items[i].getText(0); - if (name.equals(candidateName)) { - return items[i]; - } - } - return null; + TableItem[] items = this.fRemoteDebugPathMapTable.getItems(); + for (int i = 0; i < items.length; i++) { + String name = items[i].getText(0); + if (name.equals(candidateName)) { + return items[i]; + } + } + return null; } // protected void addLoadPathTab(TabFolder tabFolder) { @@ -378,139 +382,163 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { // } protected SelectionListener getLoadPathSelectionListener() { - return new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - System.out.println("Loadpath list selection occurred: " + e.getSource()); - } - }; + return new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + System.out.println("Loadpath list selection occurred: " + e.getSource()); + } + }; } protected SelectionListener getLoadPathDefaultButtonSelectionListener() { - return new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - setUseLoadPathDefaults(((Button) e.getSource()).getSelection()); - } - }; + return new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + setUseLoadPathDefaults(((Button) e.getSource()).getSelection()); + } + }; } protected void addInterpreterTab(TabFolder tabFolder) { - Composite interpreterComposite = new Composite(tabFolder, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginHeight = 0; - layout.marginWidth = 0; - interpreterComposite.setLayout(layout); - interpreterComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - createVerticalSpacer(interpreterComposite, 2); - - interpreterCombo = new Combo(interpreterComposite, SWT.READ_ONLY); - interpreterCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - initializeInterpreterCombo(interpreterCombo); - interpreterCombo.addModifyListener(getInterpreterComboModifyListener()); - - Button interpreterAddButton = new Button(interpreterComposite, SWT.PUSH); - interpreterAddButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterAddButton.label")); - interpreterAddButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - PHPInterpreter newInterpreter = new PHPInterpreter(null); - File phpRuntime = PHPInterpreterPreferencePage.getFile(getShell(), null); - if (phpRuntime != null) { - newInterpreter.setInstallLocation(phpRuntime); - PHPRuntime.getDefault().addInstalledInterpreter(newInterpreter); - interpreterCombo.add(newInterpreter.getInstallLocation().toString()); - interpreterCombo.select(interpreterCombo.indexOf(newInterpreter.getInstallLocation().toString())); - } - } - }); - - TabItem interpreterTab = new TabItem(tabFolder, SWT.NONE); - interpreterTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterTab.label")); - interpreterTab.setControl(interpreterComposite); + Composite interpreterComposite = new Composite(tabFolder, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.marginHeight = 0; + layout.marginWidth = 0; + interpreterComposite.setLayout(layout); + interpreterComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + createVerticalSpacer(interpreterComposite, 2); + + interpreterCombo = new Combo(interpreterComposite, SWT.READ_ONLY); + interpreterCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + initializeInterpreterCombo(interpreterCombo); + interpreterCombo.addModifyListener(getInterpreterComboModifyListener()); + + Button interpreterAddButton = new Button(interpreterComposite, SWT.PUSH); + interpreterAddButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterAddButton.label")); + interpreterAddButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent evt) { + PHPInterpreter newInterpreter = new PHPInterpreter(null); + File phpRuntime = PHPInterpreterPreferencePage.getFile(getShell(), null); + if (phpRuntime != null) { + newInterpreter.setInstallLocation(phpRuntime); + PHPRuntime.getDefault().addInstalledInterpreter(newInterpreter); + interpreterCombo.add(newInterpreter.getInstallLocation().toString()); + interpreterCombo.select(interpreterCombo.indexOf(newInterpreter.getInstallLocation().toString())); + } + } + }); + + TabItem interpreterTab = new TabItem(tabFolder, SWT.NONE); + interpreterTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterTab.label")); + interpreterTab.setControl(interpreterComposite); } protected ModifyListener getInterpreterComboModifyListener() { - return new ModifyListener() { - public void modifyText(ModifyEvent evt) { - updateLaunchConfigurationDialog(); - } - }; + return new ModifyListener() { + public void modifyText(ModifyEvent evt) { + updateLaunchConfigurationDialog(); + } + }; } protected void createVerticalSpacer(Composite comp, int colSpan) { - Label label = new Label(comp, SWT.NONE); - GridData gd = new GridData(); - gd.horizontalSpan = colSpan; - label.setLayoutData(gd); + Label label = new Label(comp, SWT.NONE); + GridData gd = new GridData(); + gd.horizontalSpan = colSpan; + label.setLayoutData(gd); } public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - } + PHPInterpreter selectedInterpreter = PHPRuntime.getDefault() + .getSelectedInterpreter(); + if (selectedInterpreter != null) { + String interpreterLocation = selectedInterpreter + .getInstallLocation().toString(); + configuration.setAttribute( + PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, + interpreterLocation); + } + try { + String projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME,""); + if (projectName!="") { + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + if (project!=null) { + IPath remotePath = project.getLocation(); + String fileName=configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_NAME,""); + if (fileName!="") { + Path filePath = new Path(fileName); + remotePath=remotePath.append(filePath.removeLastSegments(1)); + } + configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, remotePath.toOSString()); + } + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } public void initializeFrom(ILaunchConfiguration configuration) { - // initializeLoadPath(configuration); - initializeInterpreterSelection(configuration); - initializeRemoteDebug(configuration); + // initializeLoadPath(configuration); + initializeInterpreterSelection(configuration); + initializeRemoteDebug(configuration); } protected void initializeRemoteDebug(ILaunchConfiguration configuration) { - String s[]; - int startIdx = 0; - int idx; - try { - fRemoteDebugCheckBox.setSelection(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, - DEFAULT_REMOTE_DEBUG)); - } catch (CoreException ce) { - fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG); - } - try { - fRemoteDebugTranslate.setSelection(configuration.getAttribute( - PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, DEFAULT_REMOTE_DEBUG_TRANSLATE)); - } catch (CoreException ce) { - fRemoteDebugTranslate.setSelection(DEFAULT_REMOTE_DEBUG_TRANSLATE); - } - try { - fOpenDBGSessionInBrowserCheckBox.setSelection(configuration.getAttribute( - PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, DEFAULT_OPEN_DBGSESSION_IN_BROWSER)); - } catch (CoreException ce) { - fOpenDBGSessionInBrowserCheckBox.setSelection(DEFAULT_OPEN_DBGSESSION_IN_BROWSER); - } - setRemoteTabEnableState(); - try { - fRemoteSourcePath.setText(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, "")); - } catch (CoreException ce) { - fRemoteSourcePath.setText(""); - } - - updatePathMapFromConfig(configuration); + try { + fRemoteDebugCheckBox.setSelection(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, + DEFAULT_REMOTE_DEBUG)); + } catch (CoreException ce) { + fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG); + } + try { + fRemoteDebugTranslate.setSelection(configuration.getAttribute( + PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, DEFAULT_REMOTE_DEBUG_TRANSLATE)); + } catch (CoreException ce) { + fRemoteDebugTranslate.setSelection(DEFAULT_REMOTE_DEBUG_TRANSLATE); + } + try { + fOpenDBGSessionInBrowserCheckBox.setSelection(configuration.getAttribute( + PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, DEFAULT_OPEN_DBGSESSION_IN_BROWSER)); + } catch (CoreException ce) { + fOpenDBGSessionInBrowserCheckBox.setSelection(DEFAULT_OPEN_DBGSESSION_IN_BROWSER); + } + setRemoteTabEnableState(); + try { + fRemoteSourcePath.setText(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, "")); + } catch (CoreException ce) { + fRemoteSourcePath.setText(""); + } + + updatePathMapFromConfig(configuration); } private void updatePathMapFromConfig(ILaunchConfiguration config) { - Map envVars = null; - try { - if (config != null) { - envVars = config.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map) null); - } - updatePathMapTable(envVars, this.fRemoteDebugPathMapTable); - setPathMapButtonsEnableState(); - } catch (CoreException ce) { - log(ce); - } + Map envVars = null; + try { + if (config != null) { + envVars = config.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map) null); + } + updatePathMapTable(envVars, this.fRemoteDebugPathMapTable); + setPathMapButtonsEnableState(); + } catch (CoreException ce) { + log(ce); + } } private void updatePathMapTable(Map map, Table tableWidget) { - tableWidget.removeAll(); - if (map == null) { - return; - } - Iterator iterator = map.keySet().iterator(); - while (iterator.hasNext()) { - String key = (String) iterator.next(); - String value = (String) map.get(key); - TableItem tableItem = new TableItem(tableWidget, SWT.NONE); - tableItem.setText(new String[] { key, value }); - } + tableWidget.removeAll(); + if (map == null) { + return; + } + Iterator iterator = map.keySet().iterator(); + while (iterator.hasNext()) { + String key = (String) iterator.next(); + String value = (String) map.get(key); + TableItem tableItem = new TableItem(tableWidget, SWT.NONE); + tableItem.setText(new String[] { key, value }); + } } // protected void initializeLoadPath(ILaunchConfiguration configuration) { @@ -536,114 +564,114 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { // } protected void setUseLoadPathDefaults(boolean useDefaults) { - loadPathListViewer.getList().setEnabled(!useDefaults); - // loadPathDefaultButton.setSelection(useDefaults); + loadPathListViewer.getList().setEnabled(!useDefaults); + // loadPathDefaultButton.setSelection(useDefaults); } protected void initializeInterpreterSelection(ILaunchConfiguration configuration) { - String interpreterName = null; - try { - interpreterName = configuration.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, ""); - } catch (CoreException e) { - log(e); - } - if (interpreterName != null && !interpreterName.equals("")) - interpreterCombo.select(interpreterCombo.indexOf(interpreterName)); + String interpreterName = null; + try { + interpreterName = configuration.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, ""); + } catch (CoreException e) { + log(e); + } + if (interpreterName != null && !interpreterName.equals("")) + interpreterCombo.select(interpreterCombo.indexOf(interpreterName)); } protected void initializeInterpreterCombo(Combo interpreterCombo) { - installedInterpretersWorkingCopy = new ArrayList(); - installedInterpretersWorkingCopy.addAll(PHPRuntime.getDefault().getInstalledInterpreters()); - - String[] interpreterNames = new String[installedInterpretersWorkingCopy.size()]; - for (int interpreterIndex = 0; interpreterIndex < installedInterpretersWorkingCopy.size(); interpreterIndex++) { - PHPInterpreter interpreter = (PHPInterpreter) installedInterpretersWorkingCopy.get(interpreterIndex); - interpreterNames[interpreterIndex] = interpreter.getInstallLocation().toString(); - } - interpreterCombo.setItems(interpreterNames); - - PHPInterpreter selectedInterpreter = PHPRuntime.getDefault().getSelectedInterpreter(); - if (selectedInterpreter != null) - interpreterCombo.select(interpreterCombo.indexOf(selectedInterpreter.getInstallLocation().toString())); + installedInterpretersWorkingCopy = new ArrayList(); + installedInterpretersWorkingCopy.addAll(PHPRuntime.getDefault().getInstalledInterpreters()); + + String[] interpreterNames = new String[installedInterpretersWorkingCopy.size()]; + for (int interpreterIndex = 0; interpreterIndex < installedInterpretersWorkingCopy.size(); interpreterIndex++) { + PHPInterpreter interpreter = (PHPInterpreter) installedInterpretersWorkingCopy.get(interpreterIndex); + interpreterNames[interpreterIndex] = interpreter.getInstallLocation().toString(); + } + interpreterCombo.setItems(interpreterNames); + + PHPInterpreter selectedInterpreter = PHPRuntime.getDefault().getSelectedInterpreter(); + if (selectedInterpreter != null) + interpreterCombo.select(interpreterCombo.indexOf(selectedInterpreter.getInstallLocation().toString())); } public void performApply(ILaunchConfigurationWorkingCopy configuration) { - int selectionIndex = interpreterCombo.getSelectionIndex(); - if (selectionIndex >= 0) - configuration.setAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, interpreterCombo.getItem(selectionIndex)); - - // configuration.setAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, loadPathDefaultButton.getSelection()); - - // if (!loadPathDefaultButton.getSelection()) { - // List loadPathEntries = (List) loadPathListViewer.getInput(); - // List loadPathStrings = new ArrayList(); - // for (Iterator iterator = loadPathEntries.iterator(); iterator.hasNext();) { - // LoadPathEntry entry = (LoadPathEntry) iterator.next(); - // loadPathStrings.add(entry.getPath().toString()); - // } - // configuration.setAttribute(PHPLaunchConfigurationAttribute.CUSTOM_LOAD_PATH, loadPathStrings); - // } - - configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, fRemoteDebugCheckBox.getSelection()); - configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, fRemoteDebugTranslate.getSelection()); - configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, getMapFromPathMapTable()); - configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, fRemoteSourcePath.getText()); - configuration.setAttribute(PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, fOpenDBGSessionInBrowserCheckBox - .getSelection()); + int selectionIndex = interpreterCombo.getSelectionIndex(); + if (selectionIndex >= 0) + configuration.setAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, interpreterCombo.getItem(selectionIndex)); + + // configuration.setAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, loadPathDefaultButton.getSelection()); + + // if (!loadPathDefaultButton.getSelection()) { + // List loadPathEntries = (List) loadPathListViewer.getInput(); + // List loadPathStrings = new ArrayList(); + // for (Iterator iterator = loadPathEntries.iterator(); iterator.hasNext();) { + // LoadPathEntry entry = (LoadPathEntry) iterator.next(); + // loadPathStrings.add(entry.getPath().toString()); + // } + // configuration.setAttribute(PHPLaunchConfigurationAttribute.CUSTOM_LOAD_PATH, loadPathStrings); + // } + + configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, fRemoteDebugCheckBox.getSelection()); + configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, fRemoteDebugTranslate.getSelection()); + configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, getMapFromPathMapTable()); + configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, fRemoteSourcePath.getText()); + configuration.setAttribute(PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, fOpenDBGSessionInBrowserCheckBox + .getSelection()); } protected Composite createPageRoot(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - composite.setLayout(layout); - createVerticalSpacer(composite, 2); - setControl(composite); - - return composite; + Composite composite = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); + createVerticalSpacer(composite, 2); + setControl(composite); + + return composite; } private Map getMapFromPathMapTable() { - TableItem[] items = fRemoteDebugPathMapTable.getItems(); - if (items.length == 0) { - return null; - } - Map map = new HashMap(items.length); - for (int i = 0; i < items.length; i++) { - TableItem item = items[i]; - String key = item.getText(0); - String value = item.getText(1); - map.put(key, value); - } - return map; + TableItem[] items = fRemoteDebugPathMapTable.getItems(); + if (items.length == 0) { + return null; + } + Map map = new HashMap(items.length); + for (int i = 0; i < items.length; i++) { + TableItem item = items[i]; + String key = item.getText(0); + String value = item.getText(1); + map.put(key, value); + } + return map; } public String getName() { - return PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.name"); + return PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.name"); } public boolean isValid(ILaunchConfiguration launchConfig) { - try { - String selectedInterpreter = launchConfig.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, ""); - if (selectedInterpreter.length() == 0) { - setErrorMessage(PHPDebugUiMessages - .getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message")); - return false; - } - } catch (CoreException e) { - log(e); - } - - setErrorMessage(null); - return true; + try { + String selectedInterpreter = launchConfig.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, ""); + if (selectedInterpreter.length() == 0) { + setErrorMessage(PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message")); + return false; + } + } catch (CoreException e) { + log(e); + } + + setErrorMessage(null); + return true; } protected void log(Throwable t) { - PHPDebugUiPlugin.log(t); + PHPDebugUiPlugin.log(t); } public Image getImage() { - return PHPUiImages.get(PHPUiImages.IMG_CTOOLS_PHP); + return PHPUiImages.get(PHPUiImages.IMG_CTOOLS_PHP); } } \ No newline at end of file