Thread: [Pydev-cvs] org.python.pydev.debug/src/org/python/pydev/debug/ui/blocks MainModuleBlock.java, 1.4,
Brought to you by:
fabioz
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/blocks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20604/src/org/python/pydev/debug/ui/blocks Modified Files: MainModuleBlock.java VMArgumentsBlock.java WorkingDirectoryBlock.java ProgramArgumentsBlock.java PythonPathBlock.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: MainModuleBlock.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/blocks/MainModuleBlock.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MainModuleBlock.java 17 Aug 2008 00:26:56 -0000 1.4 --- MainModuleBlock.java 27 Sep 2008 19:59:13 -0000 1.5 *************** *** 40,75 **** public class MainModuleBlock extends AbstractLaunchConfigurationTab { ! private Text fMainModuleText; ! private Button fMainModuleBrowseButton; ! private String fProjectName; ! private ModifyListener fProjectModifyListener; ! /* (non-Javadoc) ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) ! */ ! public void createControl(Composite parent) { ! Font font = parent.getFont(); ! Group group = new Group(parent, SWT.NONE); ! setControl(group); ! GridLayout topLayout = new GridLayout(); ! topLayout.numColumns = 2; ! group.setLayout(topLayout); ! GridData gd = new GridData(GridData.FILL_HORIZONTAL); ! group.setLayoutData(gd); ! group.setFont(font); ! group.setText("Main Module"); ! ! fMainModuleText = new Text(group, SWT.SINGLE | SWT.BORDER); ! gd = new GridData(GridData.FILL_HORIZONTAL); ! fMainModuleText.setLayoutData(gd); ! fMainModuleText.setFont(font); ! fMainModuleText.addModifyListener(new ModifyListener() { ! public void modifyText(ModifyEvent evt) { ! updateLaunchConfigurationDialog(); ! } ! }); ! final Composite lParent = parent; fMainModuleBrowseButton = createPushButton(group, "Browse...", null); fMainModuleBrowseButton.setText("Browse"); --- 40,75 ---- public class MainModuleBlock extends AbstractLaunchConfigurationTab { ! private Text fMainModuleText; ! private Button fMainModuleBrowseButton; ! private String fProjectName; ! private ModifyListener fProjectModifyListener; ! /* (non-Javadoc) ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) ! */ ! public void createControl(Composite parent) { ! Font font = parent.getFont(); ! Group group = new Group(parent, SWT.NONE); ! setControl(group); ! GridLayout topLayout = new GridLayout(); ! topLayout.numColumns = 2; ! group.setLayout(topLayout); ! GridData gd = new GridData(GridData.FILL_HORIZONTAL); ! group.setLayoutData(gd); ! group.setFont(font); ! group.setText("Main Module"); ! ! fMainModuleText = new Text(group, SWT.SINGLE | SWT.BORDER); ! gd = new GridData(GridData.FILL_HORIZONTAL); ! fMainModuleText.setLayoutData(gd); ! fMainModuleText.setFont(font); ! fMainModuleText.addModifyListener(new ModifyListener() { ! public void modifyText(ModifyEvent evt) { ! updateLaunchConfigurationDialog(); ! } ! }); ! final Composite lParent = parent; fMainModuleBrowseButton = createPushButton(group, "Browse...", null); fMainModuleBrowseButton.setText("Browse"); *************** *** 77,201 **** // On button click, this displays the python module picker dialog. fMainModuleBrowseButton.addSelectionListener(new SelectionAdapter() { ! public void widgetSelected(SelectionEvent e) { ! IWorkspace workspace = ResourcesPlugin.getWorkspace(); ! IFile currentFile = getMainModuleFile(); ! IResource resource = workspace.getRoot().findMember(fProjectName); ! if (resource instanceof IProject) { ! IProject project = (IProject) resource; ! PythonModulePickerDialog dialog = new PythonModulePickerDialog( ! lParent.getShell(), ! "Main Module", ! "Choose Python module which starts execution", ! project); ! ! // Fixed request 1407469: main module browse button forgets path ! dialog.setInitialSelection(currentFile); ! int result = dialog.open(); ! if (result == PythonModulePickerDialog.OK) { ! Object results[] = dialog.getResult(); ! if ( (results != null) ! && (results.length > 0) ! && (results[0] instanceof IFile)) { ! IFile file = (IFile) results[0]; ! IPath path = file.getFullPath(); ! String containerName = path.makeRelative().toString(); ! fMainModuleText.setText("${workspace_loc:" + containerName + "}"); ! } ! } ! } ! } ! }); // Create a ModifyListener, used to listen for project modifications in the ProjectBlock. // This assumes that the Project is in a Text control... fProjectModifyListener = new ModifyListener() { ! public void modifyText(ModifyEvent e) { ! Widget widget = e.widget; ! if (widget instanceof Text) { ! Text text = (Text) widget; ! fProjectName = text.getText(); ! IWorkspace workspace = ResourcesPlugin.getWorkspace(); ! IResource resource = workspace.getRoot().findMember(fProjectName); ! boolean enabled = false; ! if ( (resource != null) ! && (resource instanceof IProject)) { ! IProject project = (IProject) resource; ! PythonNature nature = PythonNature.getPythonNature(project); ! enabled = (nature != null); ! } ! ! fMainModuleBrowseButton.setEnabled(enabled); ! } ! } }; ! } ! /* ! * (non-Javadoc) ! * ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() ! */ ! public String getName() { ! return "Main module"; ! } ! /* ! * (non-Javadoc) ! * ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) ! */ ! public void initializeFrom(ILaunchConfiguration configuration) { ! ! // Initialize the location field ! String location = ""; ! try { ! location = configuration.getAttribute(Constants.ATTR_LOCATION, ""); } catch(CoreException e) { } ! fMainModuleText.setText(location); ! ! // Obtain a copy of the project name (not displayed) ! String projectName = ""; ! try { ! projectName = configuration.getAttribute(Constants.ATTR_PROJECT, ""); } catch(CoreException e) { } ! fProjectName = projectName; ! } ! /* ! * (non-Javadoc) ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) ! */ ! public void performApply(ILaunchConfigurationWorkingCopy configuration) { String value = fMainModuleText.getText().trim(); setAttribute(configuration, Constants.ATTR_LOCATION, value); configuration.setMappedResources(new IResource[]{getMainModuleFile()}); ! } ! /* ! * (non-Javadoc) ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) ! */ ! public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { //no defaults to set ! } ! /** ! * Obtains an IFile that targets the current main module. ! * ! * This is used for initializing the module selection dialog. ! * ! * @return The main module file. ! */ ! private IFile getMainModuleFile() { ! String path = fMainModuleText.getText(); ! IFile file = null; ! if (path.length() > 0) { ! IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); ! if (path.startsWith("${workspace_loc:")) { //$NON-NLS-1$ ! IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); ! try { path = manager.performStringSubstitution(path, false); IFile[] files = root.findFilesForLocation(new Path(path)); --- 77,201 ---- // On button click, this displays the python module picker dialog. fMainModuleBrowseButton.addSelectionListener(new SelectionAdapter() { ! public void widgetSelected(SelectionEvent e) { ! IWorkspace workspace = ResourcesPlugin.getWorkspace(); ! IFile currentFile = getMainModuleFile(); ! IResource resource = workspace.getRoot().findMember(fProjectName); ! if (resource instanceof IProject) { ! IProject project = (IProject) resource; ! PythonModulePickerDialog dialog = new PythonModulePickerDialog( ! lParent.getShell(), ! "Main Module", ! "Choose Python module which starts execution", ! project); ! ! // Fixed request 1407469: main module browse button forgets path ! dialog.setInitialSelection(currentFile); ! int result = dialog.open(); ! if (result == PythonModulePickerDialog.OK) { ! Object results[] = dialog.getResult(); ! if ( (results != null) ! && (results.length > 0) ! && (results[0] instanceof IFile)) { ! IFile file = (IFile) results[0]; ! IPath path = file.getFullPath(); ! String containerName = path.makeRelative().toString(); ! fMainModuleText.setText("${workspace_loc:" + containerName + "}"); ! } ! } ! } ! } ! }); // Create a ModifyListener, used to listen for project modifications in the ProjectBlock. // This assumes that the Project is in a Text control... fProjectModifyListener = new ModifyListener() { ! public void modifyText(ModifyEvent e) { ! Widget widget = e.widget; ! if (widget instanceof Text) { ! Text text = (Text) widget; ! fProjectName = text.getText(); ! IWorkspace workspace = ResourcesPlugin.getWorkspace(); ! IResource resource = workspace.getRoot().findMember(fProjectName); ! boolean enabled = false; ! if ( (resource != null) ! && (resource instanceof IProject)) { ! IProject project = (IProject) resource; ! PythonNature nature = PythonNature.getPythonNature(project); ! enabled = (nature != null); ! } ! ! fMainModuleBrowseButton.setEnabled(enabled); ! } ! } }; ! } ! /* ! * (non-Javadoc) ! * ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() ! */ ! public String getName() { ! return "Main module"; ! } ! /* ! * (non-Javadoc) ! * ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) ! */ ! public void initializeFrom(ILaunchConfiguration configuration) { ! ! // Initialize the location field ! String location = ""; ! try { ! location = configuration.getAttribute(Constants.ATTR_LOCATION, ""); } catch(CoreException e) { } ! fMainModuleText.setText(location); ! ! // Obtain a copy of the project name (not displayed) ! String projectName = ""; ! try { ! projectName = configuration.getAttribute(Constants.ATTR_PROJECT, ""); } catch(CoreException e) { } ! fProjectName = projectName; ! } ! /* ! * (non-Javadoc) ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) ! */ ! public void performApply(ILaunchConfigurationWorkingCopy configuration) { String value = fMainModuleText.getText().trim(); setAttribute(configuration, Constants.ATTR_LOCATION, value); configuration.setMappedResources(new IResource[]{getMainModuleFile()}); ! } ! /* ! * (non-Javadoc) ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) ! */ ! public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { //no defaults to set ! } ! /** ! * Obtains an IFile that targets the current main module. ! * ! * This is used for initializing the module selection dialog. ! * ! * @return The main module file. ! */ ! private IFile getMainModuleFile() { ! String path = fMainModuleText.getText(); ! IFile file = null; ! if (path.length() > 0) { ! IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); ! if (path.startsWith("${workspace_loc:")) { //$NON-NLS-1$ ! IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); ! try { path = manager.performStringSubstitution(path, false); IFile[] files = root.findFilesForLocation(new Path(path)); *************** *** 204,218 **** } } ! catch (CoreException e) {} ! } ! else { IFile[] files = root.findFilesForLocation(new Path(path)); if (files.length > 0) { file = files[0]; } ! } ! } ! return file; ! } /** --- 204,218 ---- } } ! catch (CoreException e) {} ! } ! else { IFile[] files = root.findFilesForLocation(new Path(path)); if (files.length > 0) { file = files[0]; } ! } ! } ! return file; ! } /** *************** *** 237,285 **** @Override public boolean isValid(ILaunchConfiguration launchConfig) { ! boolean result = super.isValid(launchConfig); ! ! if (result) { ! setMessage(null); ! setErrorMessage(null); ! IStringVariableManager stringVariableManager = VariablesPlugin.getDefault().getStringVariableManager(); ! String location = fMainModuleText.getText(); ! try { ! ! String identifier = launchConfig.getType().getIdentifier(); ! if(identifier.equals(Constants.ID_PYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE) || ! identifier.equals(Constants.ID_JYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE) || ! identifier.equals(Constants.ID_PYTHON_COVERAGE_LAUNCH_CONFIGURATION_TYPE)){ ! ! //may have multiple files selected for the run for unitest and code-coverage ! for(String loc:StringUtils.split(location, '|')){ ! String expandedLocation = stringVariableManager.performStringSubstitution(loc); ! File file = new File(expandedLocation); ! if(!file.exists()){ ! setErrorMessage(StringUtils.format("The file \"%s\" does not exist.", file)); ! result = false; ! break; ! } ! ! } ! }else{ ! String expandedLocation = stringVariableManager.performStringSubstitution(location); ! File file = new File(expandedLocation); ! if(!file.exists()){ ! setErrorMessage(StringUtils.format("The file \"%s\" does not exist.", file)); ! result = false; ! ! }else if(!file.isFile()) { ! setErrorMessage(StringUtils.format("The file \"%s\" does not actually map to a file.", file)); ! result = false; ! } ! } ! ! } catch (CoreException e) { ! setErrorMessage("Unable to resolve location"); ! result = false; ! } ! } ! return result; } --- 237,285 ---- @Override public boolean isValid(ILaunchConfiguration launchConfig) { ! boolean result = super.isValid(launchConfig); ! ! if (result) { ! setMessage(null); ! setErrorMessage(null); ! IStringVariableManager stringVariableManager = VariablesPlugin.getDefault().getStringVariableManager(); ! String location = fMainModuleText.getText(); ! try { ! ! String identifier = launchConfig.getType().getIdentifier(); ! if(identifier.equals(Constants.ID_PYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE) || ! identifier.equals(Constants.ID_JYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE) || ! identifier.equals(Constants.ID_PYTHON_COVERAGE_LAUNCH_CONFIGURATION_TYPE)){ ! ! //may have multiple files selected for the run for unitest and code-coverage ! for(String loc:StringUtils.split(location, '|')){ ! String expandedLocation = stringVariableManager.performStringSubstitution(loc); ! File file = new File(expandedLocation); ! if(!file.exists()){ ! setErrorMessage(StringUtils.format("The file \"%s\" does not exist.", file)); ! result = false; ! break; ! } ! ! } ! }else{ ! String expandedLocation = stringVariableManager.performStringSubstitution(location); ! File file = new File(expandedLocation); ! if(!file.exists()){ ! setErrorMessage(StringUtils.format("The file \"%s\" does not exist.", file)); ! result = false; ! ! }else if(!file.isFile()) { ! setErrorMessage(StringUtils.format("The file \"%s\" does not actually map to a file.", file)); ! result = false; ! } ! } ! ! } catch (CoreException e) { ! setErrorMessage("Unable to resolve location"); ! result = false; ! } ! } ! return result; } *************** *** 292,296 **** */ public ModifyListener getProjectModifyListener() { ! return fProjectModifyListener; } } --- 292,296 ---- */ public ModifyListener getProjectModifyListener() { ! return fProjectModifyListener; } } Index: WorkingDirectoryBlock.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/blocks/WorkingDirectoryBlock.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WorkingDirectoryBlock.java 9 Mar 2008 14:27:59 -0000 1.2 --- WorkingDirectoryBlock.java 27 Sep 2008 19:59:13 -0000 1.3 *************** *** 40,68 **** */ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab { ! ! private static final String DEFAULT_WORKING_DIRECTORY_TEXT = "${project_loc}"; ! // Local directory ! private Button fWorkspaceButton; ! private Button fFileSystemButton; ! private Button fVariablesButton; ! ! //bug 29565 fix ! private Button fUseDefaultDirButton = null; ! private Button fUseOtherDirButton = null; ! private Text fOtherWorkingText = null; ! private Text fWorkingDirText; ! ! /** ! * The last launch config this tab was initialized from ! */ ! private ILaunchConfiguration fLaunchConfiguration; ! ! /** ! * A listener to update for text changes and widget selection ! */ ! private class WidgetListener extends SelectionAdapter implements ModifyListener { ! public void modifyText(ModifyEvent e) { if(e.getSource() == fOtherWorkingText){ ! File file = new File(fOtherWorkingText.getText()); if(!file.exists()){ --- 40,68 ---- */ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab { ! ! private static final String DEFAULT_WORKING_DIRECTORY_TEXT = "${project_loc}"; ! // Local directory ! private Button fWorkspaceButton; ! private Button fFileSystemButton; ! private Button fVariablesButton; ! ! //bug 29565 fix ! private Button fUseDefaultDirButton = null; ! private Button fUseOtherDirButton = null; ! private Text fOtherWorkingText = null; ! private Text fWorkingDirText; ! ! /** ! * The last launch config this tab was initialized from ! */ ! private ILaunchConfiguration fLaunchConfiguration; ! ! /** ! * A listener to update for text changes and widget selection ! */ ! private class WidgetListener extends SelectionAdapter implements ModifyListener { ! public void modifyText(ModifyEvent e) { if(e.getSource() == fOtherWorkingText){ ! File file = new File(fOtherWorkingText.getText()); if(!file.exists()){ *************** *** 72,189 **** setErrorMessage("The directory in the location is not actually a directory."); } ! } ! updateLaunchConfigurationDialog(); ! } ! public void widgetSelected(SelectionEvent e) { ! Object source= e.getSource(); ! if (source == fWorkspaceButton) { ! handleWorkspaceDirBrowseButtonSelected(); ! } ! else if (source == fFileSystemButton) { ! handleWorkingDirBrowseButtonSelected(); ! } ! else if (source == fVariablesButton) { ! handleWorkingDirVariablesButtonSelected(); ! } ! else if(source == fUseDefaultDirButton) { ! //only perform the action if this is the button that was selected ! if(fUseDefaultDirButton.getSelection()) { ! setDefaultWorkingDir(); ! } ! } ! else if(source == fUseOtherDirButton) { ! //only perform the action if this is the button that was selected ! if(fUseOtherDirButton.getSelection()) { ! handleUseOtherWorkingDirButtonSelected(); ! } ! } ! } ! } ! ! private WidgetListener fListener = new WidgetListener(); ! ! /* (non-Javadoc) ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) ! */ ! public void createControl(Composite parent) { ! Font font = parent.getFont(); ! Group group = createGroup(parent, "Working directory:", 2, 1, GridData.FILL_HORIZONTAL); ! setControl(group); ! // PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJavaDebugHelpContextIds.WORKING_DIRECTORY_BLOCK); ! //default choice ! Composite comp = createComposite(group, font, 2, 2, GridData.FILL_BOTH, 0, 0); ! fUseDefaultDirButton = createRadioButton(comp, "Default:"); ! fUseDefaultDirButton.addSelectionListener(fListener); ! fWorkingDirText = createSingleText(comp, 1); ! fWorkingDirText.addModifyListener(fListener); ! fWorkingDirText.setEnabled(false); ! //user enter choice ! fUseOtherDirButton = createRadioButton(comp, "Other:"); ! fUseOtherDirButton.addSelectionListener(fListener); ! fOtherWorkingText = createSingleText(comp, 1); ! fOtherWorkingText.addModifyListener(fListener); ! //buttons ! Composite buttonComp = createComposite(comp, font, 3, 2, GridData.HORIZONTAL_ALIGN_END); ! GridLayout ld = (GridLayout)buttonComp.getLayout(); ! ld.marginHeight = 1; ! ld.marginWidth = 0; ! fWorkspaceButton = createPushButton(buttonComp, "Workspace...", null); ! fWorkspaceButton.addSelectionListener(fListener); ! fFileSystemButton = createPushButton(buttonComp, "File System...", null); ! fFileSystemButton.addSelectionListener(fListener); ! fVariablesButton = createPushButton(buttonComp, "Variables...", null); ! fVariablesButton.addSelectionListener(fListener); ! } ! ! /** ! * Show a dialog that lets the user select a working directory ! */ ! private void handleWorkingDirBrowseButtonSelected() { ! DirectoryDialog dialog = new DirectoryDialog(getShell()); ! dialog.setMessage("Select a working directory for the launch configuration:"); ! String currentWorkingDir = getWorkingDirectoryText(); ! if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$ ! File path = new File(currentWorkingDir); ! if (path.exists()) { ! dialog.setFilterPath(currentWorkingDir); ! } ! } ! String selectedDirectory = dialog.open(); ! if (selectedDirectory != null) { ! fOtherWorkingText.setText(selectedDirectory); ! } ! } ! /** ! * Show a dialog that lets the user select a working directory from ! * the workspace ! */ ! private void handleWorkspaceDirBrowseButtonSelected() { ! IContainer currentContainer= getContainer(); ! if (currentContainer == null) { ! currentContainer = ResourcesPlugin.getWorkspace().getRoot(); ! } ! ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false, "Select a workspace relative working directory"); ! dialog.showClosedProjects(false); ! dialog.open(); ! Object[] results = dialog.getResult(); ! if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) { ! IPath path = (IPath)results[0]; ! String containerName = path.makeRelative().toString(); ! setOtherWorkingDirectoryText("${workspace_loc:" + containerName + "}"); //$NON-NLS-1$ //$NON-NLS-2$ ! } ! } ! ! /** ! * Returns the selected workspace container,or <code>null</code> ! */ ! protected IContainer getContainer() { ! String path = getWorkingDirectoryText(); ! if (path.length() > 0) { ! IResource res = null; ! IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); ! if (path.startsWith("${workspace_loc:")) { //$NON-NLS-1$ ! IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); ! try { path = manager.performStringSubstitution(path, false); IContainer[] containers = root.findContainersForLocation(new Path(path)); --- 72,189 ---- setErrorMessage("The directory in the location is not actually a directory."); } ! } ! updateLaunchConfigurationDialog(); ! } ! public void widgetSelected(SelectionEvent e) { ! Object source= e.getSource(); ! if (source == fWorkspaceButton) { ! handleWorkspaceDirBrowseButtonSelected(); ! } ! else if (source == fFileSystemButton) { ! handleWorkingDirBrowseButtonSelected(); ! } ! else if (source == fVariablesButton) { ! handleWorkingDirVariablesButtonSelected(); ! } ! else if(source == fUseDefaultDirButton) { ! //only perform the action if this is the button that was selected ! if(fUseDefaultDirButton.getSelection()) { ! setDefaultWorkingDir(); ! } ! } ! else if(source == fUseOtherDirButton) { ! //only perform the action if this is the button that was selected ! if(fUseOtherDirButton.getSelection()) { ! handleUseOtherWorkingDirButtonSelected(); ! } ! } ! } ! } ! ! private WidgetListener fListener = new WidgetListener(); ! ! /* (non-Javadoc) ! * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) ! */ ! public void createControl(Composite parent) { ! Font font = parent.getFont(); ! Group group = createGroup(parent, "Working directory:", 2, 1, GridData.FILL_HORIZONTAL); ! setControl(group); ! // PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJavaDebugHelpContextIds.WORKING_DIRECTORY_BLOCK); ! //default choice ! Composite comp = createComposite(group, font, 2, 2, GridData.FILL_BOTH, 0, 0); ! fUseDefaultDirButton = createRadioButton(comp, "Default:"); ! fUseDefaultDirButton.addSelectionListener(fListener); ! fWorkingDirText = createSingleText(comp, 1); ! fWorkingDirText.addModifyListener(fListener); ! fWorkingDirText.setEnabled(false); ! //user enter choice ! fUseOtherDirButton = createRadioButton(comp, "Other:"); ! fUseOtherDirButton.addSelectionLi... [truncated message content] |