diff options
Diffstat (limited to 'org.eclipse.ui.externaltools/External Tools Base/org')
11 files changed, 490 insertions, 490 deletions
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java index c9afb5626..33c9f94af 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java @@ -73,32 +73,32 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { protected IWorkingSet workingSet; protected ILaunchConfiguration fConfiguration; - private boolean fCreateBuildScheduleComponent= true; - - // Console Output widgets - private Button fConsoleOutput; - private Button fFileOutput; - private Button fFileBrowse; - private Text fFileText; - private Button fVariables; - private Button fAppend; - private Button fWorkspaceBrowse; - - /** - * Constructor - */ - public ExternalToolsBuilderTab() { - setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB); - } - - /** - * Constructor - * @param createBuildScheduleComponent - */ - public ExternalToolsBuilderTab(boolean createBuildScheduleComponent) { - fCreateBuildScheduleComponent= createBuildScheduleComponent; - setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB); - } + private boolean fCreateBuildScheduleComponent= true; + + // Console Output widgets + private Button fConsoleOutput; + private Button fFileOutput; + private Button fFileBrowse; + private Text fFileText; + private Button fVariables; + private Button fAppend; + private Button fWorkspaceBrowse; + + /** + * Constructor + */ + public ExternalToolsBuilderTab() { + setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB); + } + + /** + * Constructor + * @param createBuildScheduleComponent + */ + public ExternalToolsBuilderTab(boolean createBuildScheduleComponent) { + fCreateBuildScheduleComponent= createBuildScheduleComponent; + setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB); + } protected SelectionListener selectionListener= new SelectionAdapter() { @Override @@ -124,7 +124,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { mainComposite.setLayout(layout); mainComposite.setLayoutData(gridData); mainComposite.setFont(parent.getFont()); - createOutputCaptureComponent(mainComposite); + createOutputCaptureComponent(mainComposite); createLaunchInBackgroundComposite(mainComposite); createBuildScheduleComponent(mainComposite); } @@ -149,17 +149,17 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { } protected void createBuildScheduleComponent(Composite parent) { - if (fCreateBuildScheduleComponent) { - Label label= new Label(parent, SWT.NONE); - label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Run_this_builder_for__1); - label.setFont(parent.getFont()); - afterClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Full_builds_2, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Full, 2); - manualBuild= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Incremental_builds_4, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Inc, 2); - autoBuildButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Auto_builds__Not_recommended__6, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Auto, 2); - fDuringClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_0, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_1, 2); - - createVerticalSpacer(parent, 2); - } + if (fCreateBuildScheduleComponent) { + Label label= new Label(parent, SWT.NONE); + label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Run_this_builder_for__1); + label.setFont(parent.getFont()); + afterClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Full_builds_2, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Full, 2); + manualBuild= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Incremental_builds_4, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Inc, 2); + autoBuildButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Auto_builds__Not_recommended__6, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Auto, 2); + fDuringClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_0, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_1, 2); + + createVerticalSpacer(parent, 2); + } workingSetButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_workingSet_label, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_workingSet_tooltip, 1); specifyResources= createPushButton(parent, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_13, null); @@ -171,130 +171,130 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { selectResources(); } }); - Label label= new Label(parent, SWT.NONE); - label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_2); - label.setFont(parent.getFont()); + Label label= new Label(parent, SWT.NONE); + label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_2); + label.setFont(parent.getFont()); } - private void createOutputCaptureComponent(Composite parent) { - Group group = new Group(parent, SWT.NONE); - group.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_17); - GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); - gd.horizontalSpan = 2; - group.setLayoutData(gd); - GridLayout layout = new GridLayout(5, false); - group.setLayout(layout); - group.setFont(parent.getFont()); - - fConsoleOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_18); - gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false); - gd.horizontalSpan = 5; - fConsoleOutput.setLayoutData(gd); - - fConsoleOutput.addSelectionListener(new SelectionAdapter() { - @Override + private void createOutputCaptureComponent(Composite parent) { + Group group = new Group(parent, SWT.NONE); + group.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_17); + GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); + gd.horizontalSpan = 2; + group.setLayoutData(gd); + GridLayout layout = new GridLayout(5, false); + group.setLayout(layout); + group.setFont(parent.getFont()); + + fConsoleOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_18); + gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false); + gd.horizontalSpan = 5; + fConsoleOutput.setLayoutData(gd); + + fConsoleOutput.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { - updateLaunchConfigurationDialog(); - } - }); - - fFileOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_19); - fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false)); - - fFileText = new Text(group, SWT.SINGLE | SWT.BORDER); - gd = new GridData(SWT.FILL, SWT.NORMAL, true, false); - gd.horizontalSpan = 4; - fFileText.setLayoutData(gd); - fFileText.setFont(parent.getFont()); - - Label spacer = new Label(group,SWT.NONE); - gd = new GridData(SWT.FILL, SWT.NORMAL, true, false); - gd.horizontalSpan=2; - spacer.setLayoutData(gd); - fWorkspaceBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_20, null); - fFileBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_21, null); - fVariables = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_22, null); - - spacer = new Label(group,SWT.NONE); - spacer.setLayoutData(new GridData(SWT.FILL, SWT.NORMAL, false, false)); - fAppend = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_23); - gd = new GridData(SWT.LEFT, SWT.TOP, true, false); - gd.horizontalSpan = 4; - fAppend.setLayoutData(gd); - - fFileOutput.addSelectionListener(new SelectionAdapter() { - @Override + updateLaunchConfigurationDialog(); + } + }); + + fFileOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_19); + fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false)); + + fFileText = new Text(group, SWT.SINGLE | SWT.BORDER); + gd = new GridData(SWT.FILL, SWT.NORMAL, true, false); + gd.horizontalSpan = 4; + fFileText.setLayoutData(gd); + fFileText.setFont(parent.getFont()); + + Label spacer = new Label(group,SWT.NONE); + gd = new GridData(SWT.FILL, SWT.NORMAL, true, false); + gd.horizontalSpan=2; + spacer.setLayoutData(gd); + fWorkspaceBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_20, null); + fFileBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_21, null); + fVariables = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_22, null); + + spacer = new Label(group,SWT.NONE); + spacer.setLayoutData(new GridData(SWT.FILL, SWT.NORMAL, false, false)); + fAppend = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_23); + gd = new GridData(SWT.LEFT, SWT.TOP, true, false); + gd.horizontalSpan = 4; + fAppend.setLayoutData(gd); + + fFileOutput.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { - boolean enabled = fFileOutput.getSelection(); - fFileText.setEnabled(enabled); - fFileBrowse.setEnabled(enabled); - fWorkspaceBrowse.setEnabled(enabled); - fVariables.setEnabled(enabled); - fAppend.setEnabled(enabled); - updateLaunchConfigurationDialog(); - } - }); - - fAppend.addSelectionListener(new SelectionAdapter() { - @Override + boolean enabled = fFileOutput.getSelection(); + fFileText.setEnabled(enabled); + fFileBrowse.setEnabled(enabled); + fWorkspaceBrowse.setEnabled(enabled); + fVariables.setEnabled(enabled); + fAppend.setEnabled(enabled); + updateLaunchConfigurationDialog(); + } + }); + + fAppend.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { - updateLaunchConfigurationDialog(); - } - }); + updateLaunchConfigurationDialog(); + } + }); - fWorkspaceBrowse.addSelectionListener(new SelectionAdapter() { - @Override + fWorkspaceBrowse.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { - ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); - dialog.setTitle(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_24); - dialog.setMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_25); - dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); - dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); - int buttonId = dialog.open(); - if (buttonId == IDialogConstants.OK_ID) { - IResource resource = (IResource) dialog.getFirstResult(); - String arg = resource.getFullPath().toString(); - String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$ - fFileText.setText(fileLoc); - } - } - }); - - fFileBrowse.addSelectionListener(new SelectionAdapter() { - @Override + ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); + dialog.setTitle(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_24); + dialog.setMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_25); + dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); + dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); + int buttonId = dialog.open(); + if (buttonId == IDialogConstants.OK_ID) { + IResource resource = (IResource) dialog.getFirstResult(); + String arg = resource.getFullPath().toString(); + String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$ + fFileText.setText(fileLoc); + } + } + }); + + fFileBrowse.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { - String filePath = fFileText.getText(); + String filePath = fFileText.getText(); FileDialog dialog = new FileDialog(getShell(), SWT.SAVE | SWT.SHEET); - filePath = dialog.open(); - if (filePath != null) { - fFileText.setText(filePath); - } - } - }); + filePath = dialog.open(); + if (filePath != null) { + fFileText.setText(filePath); + } + } + }); - fFileText.addModifyListener(new ModifyListener() { - @Override + fFileText.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { - updateLaunchConfigurationDialog(); - } - }); + updateLaunchConfigurationDialog(); + } + }); - fVariables.addSelectionListener(new SelectionListener() { - @Override + fVariables.addSelectionListener(new SelectionListener() { + @Override public void widgetSelected(SelectionEvent e) { - StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); - dialog.open(); - String variable = dialog.getVariableExpression(); - if (variable != null) { - fFileText.insert(variable); - } - } - @Override + StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); + dialog.open(); + String variable = dialog.getVariableExpression(); + if (variable != null) { + fFileText.insert(variable); + } + } + @Override public void widgetDefaultSelected(SelectionEvent e) { - } - }); - } + } + }); + } /* * Creates a check button in the given composite with the given text @@ -303,7 +303,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { Button button= createCheckButton(parent, text); button.setToolTipText(tooltipText); button.addSelectionListener(listener); - GridData gd= new GridData(GridData.FILL_HORIZONTAL); + GridData gd= new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = columns; button.setLayoutData(gd); return button; @@ -323,12 +323,12 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { @Override public void initializeFrom(ILaunchConfiguration configuration) { fConfiguration= configuration; - if (fCreateBuildScheduleComponent) { - afterClean.setSelection(false); - manualBuild.setSelection(false); - autoBuildButton.setSelection(false); - fDuringClean.setSelection(false); - } + if (fCreateBuildScheduleComponent) { + afterClean.setSelection(false); + manualBuild.setSelection(false); + autoBuildButton.setSelection(false); + fDuringClean.setSelection(false); + } String buildKindString= null; String buildScope= null; @@ -345,27 +345,27 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { workingSet = RefreshTab.getWorkingSet(buildScope); } - if (fCreateBuildScheduleComponent) { - int buildTypes[]= BuilderUtils.buildTypesToArray(buildKindString); - for (int i = 0; i < buildTypes.length; i++) { - switch (buildTypes[i]) { - case IncrementalProjectBuilder.FULL_BUILD: - afterClean.setSelection(true); - break; - case IncrementalProjectBuilder.INCREMENTAL_BUILD: - manualBuild.setSelection(true); - break; - case IncrementalProjectBuilder.AUTO_BUILD: - autoBuildButton.setSelection(true); - break; - case IncrementalProjectBuilder.CLEAN_BUILD: - fDuringClean.setSelection(true); - break; + if (fCreateBuildScheduleComponent) { + int buildTypes[]= BuilderUtils.buildTypesToArray(buildKindString); + for (int i = 0; i < buildTypes.length; i++) { + switch (buildTypes[i]) { + case IncrementalProjectBuilder.FULL_BUILD: + afterClean.setSelection(true); + break; + case IncrementalProjectBuilder.INCREMENTAL_BUILD: + manualBuild.setSelection(true); + break; + case IncrementalProjectBuilder.AUTO_BUILD: + autoBuildButton.setSelection(true); + break; + case IncrementalProjectBuilder.CLEAN_BUILD: + fDuringClean.setSelection(true); + break; default: break; - } - } - } + } + } + } boolean enabled= true; if (fCreateBuildScheduleComponent) { @@ -374,58 +374,58 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { workingSetButton.setEnabled(enabled); specifyResources.setEnabled(enabled && workingSetButton.getSelection()); updateRunInBackground(configuration); - updateConsoleOutput(configuration); + updateConsoleOutput(configuration); } protected void updateRunInBackground(ILaunchConfiguration configuration) { fLaunchInBackgroundButton.setSelection(ExternalToolsCoreUtil.isAsynchronousBuild(configuration)); } - private void updateConsoleOutput(ILaunchConfiguration configuration) { - boolean outputToConsole = true; - String outputFile = null; - boolean append = false; - - try { - outputToConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true); - outputFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null); - append = configuration.getAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, false); - } catch (CoreException e) { - } - - fConsoleOutput.setSelection(outputToConsole); - fAppend.setSelection(append); - boolean haveOutputFile= outputFile != null; - if (haveOutputFile) { - fFileText.setText(outputFile); - } - fFileOutput.setSelection(haveOutputFile); - fFileText.setEnabled(haveOutputFile); - fFileBrowse.setEnabled(haveOutputFile); - fWorkspaceBrowse.setEnabled(haveOutputFile); - fVariables.setEnabled(haveOutputFile); - fAppend.setEnabled(haveOutputFile); - } + private void updateConsoleOutput(ILaunchConfiguration configuration) { + boolean outputToConsole = true; + String outputFile = null; + boolean append = false; + + try { + outputToConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true); + outputFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null); + append = configuration.getAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, false); + } catch (CoreException e) { + } + + fConsoleOutput.setSelection(outputToConsole); + fAppend.setSelection(append); + boolean haveOutputFile= outputFile != null; + if (haveOutputFile) { + fFileText.setText(outputFile); + } + fFileOutput.setSelection(haveOutputFile); + fFileText.setEnabled(haveOutputFile); + fFileBrowse.setEnabled(haveOutputFile); + fWorkspaceBrowse.setEnabled(haveOutputFile); + fVariables.setEnabled(haveOutputFile); + fAppend.setEnabled(haveOutputFile); + } @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { - if (fCreateBuildScheduleComponent) { - StringBuilder buffer= new StringBuilder(); - if (afterClean.getSelection()) { - buffer.append(IExternalToolConstants.BUILD_TYPE_FULL).append(','); - } - if (manualBuild.getSelection()){ - buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(','); - } - if (autoBuildButton.getSelection()) { - buffer.append(IExternalToolConstants.BUILD_TYPE_AUTO).append(','); - } - - if (fDuringClean.getSelection()) { - buffer.append(IExternalToolConstants.BUILD_TYPE_CLEAN); - } - configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString()); - } + if (fCreateBuildScheduleComponent) { + StringBuilder buffer= new StringBuilder(); + if (afterClean.getSelection()) { + buffer.append(IExternalToolConstants.BUILD_TYPE_FULL).append(','); + } + if (manualBuild.getSelection()){ + buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(','); + } + if (autoBuildButton.getSelection()) { + buffer.append(IExternalToolConstants.BUILD_TYPE_AUTO).append(','); + } + + if (fDuringClean.getSelection()) { + buffer.append(IExternalToolConstants.BUILD_TYPE_CLEAN); + } + configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString()); + } if (workingSetButton.getSelection()) { String scope = RefreshTab.getRefreshAttribute(workingSet); configuration.setAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, scope); @@ -434,31 +434,31 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { } configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, fLaunchInBackgroundButton.getSelection()); - boolean captureOutput = false; - if (fConsoleOutput.getSelection()) { - captureOutput = true; - configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, (String)null); - } else { - configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false); - } - if (fFileOutput.getSelection()) { - captureOutput = true; - String file = fFileText.getText(); - configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, file); - if(fAppend.getSelection()) { - configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, true); - } else { - configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, (String)null); - } - } else { - configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null); - } - - if (!captureOutput) { - configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false); - } else { - configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, (String)null); - } + boolean captureOutput = false; + if (fConsoleOutput.getSelection()) { + captureOutput = true; + configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, (String)null); + } else { + configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false); + } + if (fFileOutput.getSelection()) { + captureOutput = true; + String file = fFileText.getText(); + configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, file); + if(fAppend.getSelection()) { + configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, true); + } else { + configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, (String)null); + } + } else { + configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null); + } + + if (!captureOutput) { + configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false); + } else { + configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, (String)null); + } } @Override @@ -476,15 +476,15 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { setErrorMessage(null); setMessage(null); if (fCreateBuildScheduleComponent) { - boolean buildKindSelected= afterClean.getSelection() || manualBuild.getSelection() || autoBuildButton.getSelection() || fDuringClean.getSelection(); - if (!buildKindSelected) { - setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_buildKindError); - return false; - } - } + boolean buildKindSelected= afterClean.getSelection() || manualBuild.getSelection() || autoBuildButton.getSelection() || fDuringClean.getSelection(); + if (!buildKindSelected) { + setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_buildKindError); + return false; + } + } if (workingSetButton.getSelection() && (workingSet == null || workingSet.getElements().length == 0)) { setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_16); - return false; + return false; } return validateRedirectFile(); @@ -525,14 +525,14 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { // do nothing on deactivation } - private boolean validateRedirectFile() { - if(fFileOutput.getSelection()) { - int len = fFileText.getText().trim().length(); - if (len == 0) { - setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_26); - return false; - } - } - return true; - } + private boolean validateRedirectFile() { + if(fFileOutput.getSelection()) { + int len = fFileText.getText().trim().length(); + if (len == 0) { + setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_26); + return false; + } + } + return true; + } }
\ No newline at end of file diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java index 5b09df9dd..e1237be42 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java @@ -82,23 +82,23 @@ public class ExternalToolsLaunchConfigurationMessages extends NLS { NLS.initializeMessages(BUNDLE_NAME, ExternalToolsLaunchConfigurationMessages.class); } - public static String ExternalToolsBuilderTab_17; + public static String ExternalToolsBuilderTab_17; - public static String ExternalToolsBuilderTab_18; + public static String ExternalToolsBuilderTab_18; - public static String ExternalToolsBuilderTab_19; + public static String ExternalToolsBuilderTab_19; - public static String ExternalToolsBuilderTab_20; + public static String ExternalToolsBuilderTab_20; - public static String ExternalToolsBuilderTab_21; + public static String ExternalToolsBuilderTab_21; - public static String ExternalToolsBuilderTab_22; + public static String ExternalToolsBuilderTab_22; - public static String ExternalToolsBuilderTab_23; + public static String ExternalToolsBuilderTab_23; - public static String ExternalToolsBuilderTab_24; + public static String ExternalToolsBuilderTab_24; - public static String ExternalToolsBuilderTab_25; + public static String ExternalToolsBuilderTab_25; - public static String ExternalToolsBuilderTab_26; + public static String ExternalToolsBuilderTab_26; }
\ No newline at end of file diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java index 520c4db2b..7c050f866 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java @@ -161,7 +161,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa Composite buttonComposite = new Composite(group, SWT.NONE); layout = new GridLayout(); layout.marginHeight = 0; - layout.marginWidth = 0; + layout.marginWidth = 0; layout.numColumns = 3; gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); buttonComposite.setLayout(layout); @@ -213,8 +213,8 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa Composite buttonComposite = new Composite(group, SWT.NONE); layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; + layout.marginWidth = 0; + layout.marginHeight = 0; layout.numColumns = 3; gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); buttonComposite.setLayout(layout); @@ -257,7 +257,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa GridData gridData = new GridData(GridData.FILL_BOTH); group.setLayout(layout); group.setLayoutData(gridData); - group.setFont(parent.getFont()); + group.setFont(parent.getFont()); argumentField = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL); argumentField.addTraverseListener(new TraverseListener() { @@ -279,8 +279,8 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa Composite composite = new Composite(group, SWT.NONE); layout = new GridLayout(); layout.numColumns= 1; - layout.marginHeight= 0; - layout.marginWidth= 0; + layout.marginHeight= 0; + layout.marginWidth= 0; gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); composite.setLayout(layout); composite.setLayoutData(gridData); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java index 1b38bff61..45cadaf63 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java @@ -72,7 +72,7 @@ public class ExternalToolsUtil { * @throws CoreException if unable to access the associated attribute */ public static boolean getCaptureOutput(ILaunchConfiguration configuration) throws CoreException { - return ExternalToolsCoreUtil.getCaptureOutput(configuration); + return ExternalToolsCoreUtil.getCaptureOutput(configuration); } /** diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java index 90fe1f02f..c9daf48ec 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java @@ -175,14 +175,14 @@ public class BuilderUtils { return BuilderCoreUtils.migrateBuilderConfiguration(project, workingCopy); } - /** - * Converts the build types string into an array of - * build kinds. - * - * @param buildTypes the string of built types to convert - * @return the array of build kinds. - */ - public static int[] buildTypesToArray(String buildTypes) { - return BuilderCoreUtils.buildTypesToArray(buildTypes); - } + /** + * Converts the build types string into an array of + * build kinds. + * + * @param buildTypes the string of built types to convert + * @return the array of build kinds. + */ + public static int[] buildTypesToArray(String buildTypes) { + return BuilderCoreUtils.buildTypesToArray(buildTypes); + } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java index 6fb547796..767bb0f96 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java @@ -110,7 +110,7 @@ public class ExternalToolsImages { * This may mean the same package directory as the package holding this class. * The images are declared using this.getClass() to ensure they are looked up via * this plugin class. - * @see org.eclipse.jface.resource.ImageRegistry + * @see org.eclipse.jface.resource.ImageRegistry */ public static ImageRegistry initializeImageRegistry() { imageRegistry= new ImageRegistry(ExternalToolsPlugin.getStandardDisplay()); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java index cd9c3224e..369ccf6b4 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java @@ -162,10 +162,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta if (oldConfig == null) { return; } - //Replace the movedFrom config in the list of newly created configs - if (newConfigList.remove(oldConfig)) { - newConfigList.add(configuration); - } + //Replace the movedFrom config in the list of newly created configs + if (newConfigList.remove(oldConfig)) { + newConfigList.add(configuration); + } Display.getDefault().asyncExec(() -> { TableItem[] items = viewer.getTable().getItems(); @@ -212,7 +212,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta commands = project.getDescription().getBuildSpec(); } catch (CoreException e) { handleException(e); - return; + return; } boolean projectNeedsMigration= false; @@ -227,10 +227,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta Object element= null; if (config != null) { if (!config.isWorkingCopy() && !config.exists()) { - Shell shell= getShell(); - if (shell == null) { - return; - } + Shell shell= getShell(); + if (shell == null) { + return; + } IStatus status = new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, 0, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_Exists, new String[]{config.getName()}), null); ErrorDialog.openError(getShell(), ExternalToolsUIMessages.BuilderPropertyPage_errorTitle, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_External_Tool_Builder__0__Not_Added_2, new String[]{config.getName()}), @@ -258,10 +258,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta boolean prompt= store.getBoolean(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION); boolean proceed= true; if (prompt) { - Shell shell= getShell(); - if (shell == null) { - return; - } + Shell shell= getShell(); + if (shell == null) { + return; + } MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(shell, ExternalToolsUIMessages.BuilderPropertyPage_0, ExternalToolsUIMessages.BuilderPropertyPage_1, ExternalToolsUIMessages.BuilderPropertyPage_2, false, null, null); proceed= dialog.getReturnCode() == IDialogConstants.YES_ID; store.setValue(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION, !dialog.getToggleState()); @@ -416,9 +416,9 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } else if (button == downButton) { moveSelectionDown(); } - if (getControl().isDisposed()) { - return; - } + if (getControl().isDisposed()) { + return; + } handleTableSelectionChanged(); viewer.getTable().setFocus(); } @@ -430,25 +430,25 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta if (element instanceof ILaunchConfiguration) { enableLaunchConfiguration((ILaunchConfiguration) element, checked); } else if (element instanceof ICommand) { - Shell shell= getShell(); - if (shell == null) { - return; - } - if (checked) { - enableCommand((ICommand)element, checked); - return; - } else if (!fWarned) { - if(MessageDialog.openConfirm(shell, ExternalToolsUIMessages.BuilderPropertyPage_6, ExternalToolsUIMessages.BuilderPropertyPage_7)) { - fWarned = true; - } + Shell shell= getShell(); + if (shell == null) { + return; + } + if (checked) { + enableCommand((ICommand)element, checked); + return; + } else if (!fWarned) { + if(MessageDialog.openConfirm(shell, ExternalToolsUIMessages.BuilderPropertyPage_6, ExternalToolsUIMessages.BuilderPropertyPage_7)) { + fWarned = true; + } + } + if(fWarned) { + enableCommand((ICommand)element, checked); } - if(fWarned) { - enableCommand((ICommand)element, checked); - } - else { - viewer.removeCheckStateListener(this); - viewer.setChecked(element, true); - viewer.addCheckStateListener(this); + else { + viewer.removeCheckStateListener(this); + viewer.setChecked(element, true); + viewer.addCheckStateListener(this); } } @@ -509,10 +509,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } catch (CoreException e) { } } - Shell shell= getShell(); - if (shell == null) { - return; - } + Shell shell= getShell(); + if (shell == null) { + return; + } ElementListSelectionDialog dialog= new ElementListSelectionDialog(shell, new BuilderLabelProvider()); dialog.setTitle(ExternalToolsUIMessages.BuilderPropertyPage_4); dialog.setMessage(ExternalToolsUIMessages.BuilderPropertyPage_5); @@ -632,10 +632,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta private int editConfiguration(ILaunchConfiguration config) { ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager(); manager.addLaunchConfigurationListener(configurationListener); - Shell shell= getShell(); - if (shell == null) { - return Window.CANCEL; - } + Shell shell= getShell(); + if (shell == null) { + return Window.CANCEL; + } int code= DebugUITools.openLaunchConfigurationPropertiesDialog(shell, config, org.eclipse.ui.externaltools.internal.model.IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_GROUP); manager.removeLaunchConfigurationListener(configurationListener); return code; @@ -651,10 +651,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta */ private ILaunchConfigurationType promptForConfigurationType() { List<ILaunchConfigurationType> externalToolTypes = getConfigurationTypes(IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY); - Shell shell= getShell(); - if (shell == null) { - return null; - } + Shell shell= getShell(); + if (shell == null) { + return null; + } ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new BuilderLabelProvider()); dialog.setElements(externalToolTypes.toArray()); dialog.setMultipleSelection(false); @@ -752,10 +752,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta // User has asked not to be prompted return true; } - Shell shell= getShell(); - if (shell == null) { - return false; - } + Shell shell= getShell(); + if (shell == null) { + return false; + } // Warn the user that editing an old config will cause storage migration. MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(getShell(), ExternalToolsUIMessages.BuilderPropertyPage_Migrate_project_builder_10, @@ -781,7 +781,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta Shell shell = getShell(); if (shell != null) { ErrorDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_errorTitle, ExternalToolsUIMessages.BuilderPropertyPage_errorMessage, status[0]); - } + } }); } @@ -1003,10 +1003,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta try { workingCopy.doSave(); } catch (CoreException e) { - Shell shell= getShell(); - if (shell != null) { - MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_39, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_40, new String[] {workingCopy.getName()})); - } + Shell shell= getShell(); + if (shell != null) { + MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_39, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_40, new String[] {workingCopy.getName()})); + } } } } @@ -1029,7 +1029,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta project.setDescription(desc, IResource.FORCE, monitor); } catch (CoreException e) { handleException(e); - performCancel(); + performCancel(); } } @@ -1070,10 +1070,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta configsToBeDeleted.add(config); return newCommand; } catch (CoreException exception) { - Shell shell= getShell(); - if (shell != null) { - MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_13, ExternalToolsUIMessages.BuilderPropertyPage_error); - } + Shell shell= getShell(); + if (shell != null) { + MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_13, ExternalToolsUIMessages.BuilderPropertyPage_error); + } return null; } } @@ -1220,11 +1220,11 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta return super.performCancel(); } - @Override + @Override public Shell getShell() { - if (getControl().isDisposed()) { + if (getControl().isDisposed()) { return null; - } - return super.getShell(); - } + } + return super.getShell(); + } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java index 849eccc32..dc927a575 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java @@ -61,7 +61,7 @@ public class FileSelectionDialog extends MessageDialog { private boolean allowMultiselection= false; - private Pattern fPattern; + private Pattern fPattern; /** * Creates a resource selection dialog rooted at the given element. * @@ -94,15 +94,15 @@ public class FileSelectionDialog extends MessageDialog { * this argument is ignored. */ public void setFileFilter(String pattern, boolean ignoreCase) { - if (pattern != null) { - if (ignoreCase) { - fPattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); - } else { - fPattern = Pattern.compile(pattern); - } - } else { - fPattern = null; - } + if (pattern != null) { + if (ignoreCase) { + fPattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); + } else { + fPattern = Pattern.compile(pattern); + } + } else { + fPattern = null; + } } @Override diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java index 947154ccb..b52e78a0a 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java @@ -206,7 +206,7 @@ public class TreeAndListGroup implements ISelectionChangedListener { treeViewer = new TreeViewer(tree); treeViewer.setContentProvider(treeContentProvider); treeViewer.setLabelProvider(treeLabelProvider); - treeViewer.setComparator(new ResourceComparator(ResourceComparator.NAME)); + treeViewer.setComparator(new ResourceComparator(ResourceComparator.NAME)); treeViewer.addSelectionChangedListener(this); } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java index 2ed9f6c61..a3ca6a1fd 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java @@ -27,116 +27,116 @@ import org.eclipse.core.variables.IDynamicVariableResolver; public class BuildFilesResolver implements IDynamicVariableResolver { - private static final char ARG_REMOVED = 'r'; - private static final char ARG_CHANGED = 'c'; - private static final char ARG_ADDED = 'a'; - private static final char ARG_DIRS = 'd'; - private static final char ARG_FILES = 'f'; + private static final char ARG_REMOVED = 'r'; + private static final char ARG_CHANGED = 'c'; + private static final char ARG_ADDED = 'a'; + private static final char ARG_DIRS = 'd'; + private static final char ARG_FILES = 'f'; - // Use a space as a separator as this is a more natural fit for sending a - // list of files to a unix command - private static final String FILE_LIST_SEPARATOR = " "; //$NON-NLS-1$ + // Use a space as a separator as this is a more natural fit for sending a + // list of files to a unix command + private static final String FILE_LIST_SEPARATOR = " "; //$NON-NLS-1$ @Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException - { - String result = null; + { + String result = null; - IResourceDelta buildDelta = ExternalToolBuilder.getBuildDelta(); - if (buildDelta != null) - { - final StringBuffer fileList = new StringBuffer(); + IResourceDelta buildDelta = ExternalToolBuilder.getBuildDelta(); + if (buildDelta != null) + { + final StringBuffer fileList = new StringBuffer(); final Set<String> changedResources = new LinkedHashSet<>(); - // Use the argument to determine which deltas to visit - if none, - // then defaults to all - int deltas = 0; - boolean dirs = false, files = false; - if (argument != null) - { - // Check delta kinds - if (argument.indexOf(ARG_ADDED) > -1) - { - deltas |= IResourceDelta.ADDED; - } - if (argument.indexOf(ARG_CHANGED) > -1) - { - deltas |= IResourceDelta.CHANGED; - } - if (argument.indexOf(ARG_REMOVED) > -1) - { - deltas |= IResourceDelta.REMOVED; - } + // Use the argument to determine which deltas to visit - if none, + // then defaults to all + int deltas = 0; + boolean dirs = false, files = false; + if (argument != null) + { + // Check delta kinds + if (argument.indexOf(ARG_ADDED) > -1) + { + deltas |= IResourceDelta.ADDED; + } + if (argument.indexOf(ARG_CHANGED) > -1) + { + deltas |= IResourceDelta.CHANGED; + } + if (argument.indexOf(ARG_REMOVED) > -1) + { + deltas |= IResourceDelta.REMOVED; + } - // Check wether to include files and/or directories - if (argument.indexOf(ARG_DIRS) > -1) - { - dirs = true; - } - if (argument.indexOf(ARG_FILES) > -1) - { - files = true; - } + // Check wether to include files and/or directories + if (argument.indexOf(ARG_DIRS) > -1) + { + dirs = true; + } + if (argument.indexOf(ARG_FILES) > -1) + { + files = true; + } - } - if (deltas == 0) - { - deltas = IResourceDelta.ADDED | IResourceDelta.CHANGED | IResourceDelta.REMOVED; - } - if (!dirs && !files) - { - dirs = true; - files = true; - } - final int trackDeltas = deltas; - final boolean trackDirs = dirs; - final boolean trackFiles = files; + } + if (deltas == 0) + { + deltas = IResourceDelta.ADDED | IResourceDelta.CHANGED | IResourceDelta.REMOVED; + } + if (!dirs && !files) + { + dirs = true; + files = true; + } + final int trackDeltas = deltas; + final boolean trackDirs = dirs; + final boolean trackFiles = files; - buildDelta.accept(new IResourceDeltaVisitor() - { - @Override + buildDelta.accept(new IResourceDeltaVisitor() + { + @Override public boolean visit(IResourceDelta delta) throws CoreException - { - IResource resource = delta.getResource(); + { + IResource resource = delta.getResource(); - // Only track files with the right kind of delta - boolean isTracked = (delta.getKind() & trackDeltas) > 0; - if (isTracked) - { - // Only track dirs if desired - isTracked = trackDirs && resource.getType() != IResource.FILE; - // Only track files if desired - isTracked |= trackFiles && resource.getType() == IResource.FILE; - } + // Only track files with the right kind of delta + boolean isTracked = (delta.getKind() & trackDeltas) > 0; + if (isTracked) + { + // Only track dirs if desired + isTracked = trackDirs && resource.getType() != IResource.FILE; + // Only track files if desired + isTracked |= trackFiles && resource.getType() == IResource.FILE; + } - // If tracking a change, then add it to the change set for inclusion in the variable's output - if (isTracked) - { - String osPath = resource.getLocation().toOSString(); - if (changedResources.add(osPath)) - { - if (fileList.length() > 0) - { - fileList.append(FILE_LIST_SEPARATOR); - } + // If tracking a change, then add it to the change set for inclusion in the variable's output + if (isTracked) + { + String osPath = resource.getLocation().toOSString(); + if (changedResources.add(osPath)) + { + if (fileList.length() > 0) + { + fileList.append(FILE_LIST_SEPARATOR); + } - // Since space is our separator, we need to add quotes - // around each file to handle filenames with embedded - // spaces. We also need to escape out embedded quotes in - // the filename so they don't conflict with these - // special quotes. - // - osPath = osPath.replaceAll("\"", "\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$ - fileList.append("\"" + osPath + "\""); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return true; - } - }, deltas); - result = fileList.toString(); - } + // Since space is our separator, we need to add quotes + // around each file to handle filenames with embedded + // spaces. We also need to escape out embedded quotes in + // the filename so they don't conflict with these + // special quotes. + // + osPath = osPath.replaceAll("\"", "\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$ + fileList.append("\"" + osPath + "\""); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + return true; + } + }, deltas); + result = fileList.toString(); + } - return result; - } + return result; + } }
\ No newline at end of file diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java index d435cb745..9b3aaad59 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java @@ -31,38 +31,38 @@ public class SystemPathResolver implements IDynamicVariableResolver { @Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { - if (argument == null) { - throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, VariableMessages.SystemPathResolver_0, null)); - } + if (argument == null) { + throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, VariableMessages.SystemPathResolver_0, null)); + } Map<String, String> map = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment(); - String path= map.get("PATH"); //$NON-NLS-1$ - if (path == null) { - return argument; - } - // On MS Windows the PATHEXT environment variable defines which file extensions - // mark files that are executable (e.g. .EXE, .COM, .BAT) - String pathext = map.get("PATHEXT"); //$NON-NLS-1$ - StringTokenizer tokenizer= new StringTokenizer(path, File.pathSeparator); - while (tokenizer.hasMoreTokens()) { - String pathElement= tokenizer.nextToken(); - File pathElementFile= new File(pathElement); - if (pathElementFile.isDirectory()) { - File toolFile= new File(pathElementFile, argument); - if (toolFile.exists()) { - return toolFile.getAbsolutePath(); - } - if ( pathext != null ) { - StringTokenizer pathextTokenizer = new StringTokenizer(pathext, File.pathSeparator); - while (pathextTokenizer.hasMoreTokens()) { - String pathextElement = pathextTokenizer.nextToken(); - toolFile = new File(pathElementFile, argument + pathextElement); - if (toolFile.exists()) { - return toolFile.getAbsolutePath(); - } - } - } - } - } - return argument; + String path= map.get("PATH"); //$NON-NLS-1$ + if (path == null) { + return argument; + } + // On MS Windows the PATHEXT environment variable defines which file extensions + // mark files that are executable (e.g. .EXE, .COM, .BAT) + String pathext = map.get("PATHEXT"); //$NON-NLS-1$ + StringTokenizer tokenizer= new StringTokenizer(path, File.pathSeparator); + while (tokenizer.hasMoreTokens()) { + String pathElement= tokenizer.nextToken(); + File pathElementFile= new File(pathElement); + if (pathElementFile.isDirectory()) { + File toolFile= new File(pathElementFile, argument); + if (toolFile.exists()) { + return toolFile.getAbsolutePath(); + } + if ( pathext != null ) { + StringTokenizer pathextTokenizer = new StringTokenizer(pathext, File.pathSeparator); + while (pathextTokenizer.hasMoreTokens()) { + String pathextElement = pathextTokenizer.nextToken(); + toolFile = new File(pathElementFile, argument + pathextElement); + if (toolFile.exists()) { + return toolFile.getAbsolutePath(); + } + } + } + } + } + return argument; } } |