diff options
author | Sarika Sinha | 2018-08-14 13:34:11 +0000 |
---|---|---|
committer | Sarika Sinha | 2018-08-14 13:34:11 +0000 |
commit | bb6e6c7b711a11d6d56af8a1b309f77a1f4a2901 (patch) | |
tree | 2824e1b84bf4ed2e905c5b4e11fc4af16a4e03db | |
parent | 697ccec4bd0017586f9221ba90c3017f09804a29 (diff) | |
download | eclipse.platform.debug-bb6e6c7b711a11d6d56af8a1b309f77a1f4a2901.tar.gz eclipse.platform.debug-bb6e6c7b711a11d6d56af8a1b309f77a1f4a2901.tar.xz eclipse.platform.debug-bb6e6c7b711a11d6d56af8a1b309f77a1f4a2901.zip |
Bug 537525 - Follow up of Bug 312397 - Run Configuration Command Line toI20180819-2000I20180819-0800I20180818-1500I20180818-0800I20180817-2000I20180816-2000
Clipboard
Change-Id: Idfb989cb7ff3d47c4162becea5227a7c04e975cc
4 files changed, 57 insertions, 4 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java index 3c8104b38..4a2c5008d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java @@ -47,6 +47,7 @@ import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.resource.ColorRegistry; import org.eclipse.jface.resource.JFaceResources; @@ -1554,9 +1555,48 @@ public class LaunchConfigurationTabGroupViewer { * Dialog to Show the Command line */ protected void handleShowCommandLinePressed() { - ShowCommandLineDialog dialog = new ShowCommandLineDialog(getShell(), getLaunchConfigurationDialog().getMode(), - fOriginal); - dialog.open(); + boolean showCommandLineDialog = true; + if (isDirty()) { + int returnVal = showSaveChangesDialog(); + if (returnVal == IDialogConstants.YES_ID) { + handleApplyPressed(); + } else if (returnVal == IDialogConstants.NO_ID) { + handleRevertPressed(); + } else { + showCommandLineDialog = false; + } + } + if (showCommandLineDialog) { + ShowCommandLineDialog dialog = new ShowCommandLineDialog(getShell(), + getLaunchConfigurationDialog().getMode(), + fWorkingCopy); + dialog.open(); + } + } + + private int showSaveChangesDialog() { + String message = MessageFormat.format( + LaunchConfigurationsMessages.LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Question, + new Object[] { getWorkingCopy().getName() }); + MessageDialog dialog = new MessageDialog(getShell(), + LaunchConfigurationsMessages.LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Title, null, + message, + MessageDialog.QUESTION, + new String[] { + LaunchConfigurationsMessages.LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Apply, + LaunchConfigurationsMessages.LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Revert, + LaunchConfigurationsMessages.LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Cancel }, + 0); + int ret = dialog.open(); + int val = IDialogConstants.CANCEL_ID; + if (ret == 0 || ret == 1) { + if (ret == 0) { + val = IDialogConstants.YES_ID; + } else { + val = IDialogConstants.NO_ID; + } + } + return val; } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java index edaf3c963..cdab75d93 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java @@ -107,7 +107,13 @@ public class LaunchConfigurationsMessages extends NLS { public static String LaunchConfigurationDialog_ShowCommandLine; public static String LaunchConfigurationDialog_ShowCommandLine_Title; public static String LaunchConfigurationDialog_ShowCommandLine_Copy; + public static String LaunchConfigurationDialog_ShowCommandLine_Close; public static String LaunchConfigurationDialog_ShowCommandLine_Default; + public static String LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Title; + public static String LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Question; + public static String LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Apply; + public static String LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Revert; + public static String LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Cancel; public static String LaunchConfigurationSelectionDialog_0; public static String LaunchConfigurationSelectionDialog_1; public static String LaunchConfigurationSelectionDialog_deleteButtonLabel; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties index 2fd2bd86e..4315df280 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties @@ -118,7 +118,13 @@ LaunchConfigurationsDialog_Information_3=Information LaunchConfigurationDialog_ShowCommandLine=Sho&w Command Line LaunchConfigurationDialog_ShowCommandLine_Title=Command Line LaunchConfigurationDialog_ShowCommandLine_Copy=C&opy && Close +LaunchConfigurationDialog_ShowCommandLine_Close=&Close LaunchConfigurationDialog_ShowCommandLine_Default=Command Line could not be retrieved. +LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Title=Apply Changes +LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Question=The configuration "{0}" has unsaved changes. Do you wish to apply the changes before showing command line? +LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Apply=&Apply +LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Revert=&Revert +LaunchConfigurationDialog_ShowCommandLine_Apply_Revert_Cancel=&Close LaunchConfigurationsDialog_0=New launch configuration LaunchConfigurationsDialog_1=Delete selected launch configuration(s) LaunchConfigurationsDialog_2=New launch configuration prototype diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java index 6a4f541c4..542eae5a0 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java @@ -73,7 +73,8 @@ public class ShowCommandLineDialog extends Dialog { protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, LaunchConfigurationsMessages.LaunchConfigurationDialog_ShowCommandLine_Copy, true); - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + createButton(parent, IDialogConstants.CANCEL_ID, + LaunchConfigurationsMessages.LaunchConfigurationDialog_ShowCommandLine_Close, false); } private LaunchManager getLaunchManager() { |