1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-05 08:05:24 +02:00

Implement updateMessage for Launch Config Tab

Also cleans up the description for the dialog to make it more clear
it's editing a configuration.

Change-Id: Ic871582d56cb1253383adfced238cf5ecedb416e
This commit is contained in:
Doug Schaefer 2017-01-27 16:31:23 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent 573a55c8ba
commit 3a921fdd83
2 changed files with 65 additions and 3 deletions

View file

@ -9,6 +9,7 @@ import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPre
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.operation.ModalContext;
@ -27,6 +28,7 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
@ -203,10 +205,70 @@ public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILau
}
}
private String getTabsErrorMessage() {
ILaunchConfigurationTab activeTab = getActiveTab();
if (activeTab != null) {
String message = activeTab.getErrorMessage();
if (message != null) {
return message;
}
}
for (ILaunchConfigurationTab tab : getTabs()) {
if (tab != activeTab) {
String message = tab.getErrorMessage();
if (message != null) {
return message;
}
}
}
return null;
}
private String getTabsMessage() {
ILaunchConfigurationTab activeTab = getActiveTab();
if (activeTab != null) {
String message = activeTab.getMessage();
if (message != null) {
return message;
}
}
for (ILaunchConfigurationTab tab : getTabs()) {
if (tab != activeTab) {
String message = tab.getMessage();
if (message != null) {
return message;
}
}
}
return null;
}
@Override
public void updateMessage() {
// TODO Auto-generated method stub
if (initing) {
return;
}
for (ILaunchConfigurationTab tab : getTabs()) {
tab.isValid(workingCopy);
}
Button okButton = getButton(IDialogConstants.OK_ID);
String message = getTabsErrorMessage();
if (message != null) {
setMessage(message, IMessageProvider.ERROR);
okButton.setEnabled(false);
return;
}
message = getTabsMessage();
setMessage(message);
okButton.setEnabled(true);
}
@Override

View file

@ -34,8 +34,8 @@ NoLaunchConfigType=No launch configuration type matches selected launch descript
CannotEditLaunchConfiguration=Cannot edit this configuration.
NoLaunchModeSelected=No launch mode selected.
NoLaunchGroupSelected=No launch group found for the current selection.
LaunchBarLaunchConfigDialog_Edit1=Edit %s for %s
LaunchBarLaunchConfigDialog_Edit2=Edit %s for %s on %s
LaunchBarLaunchConfigDialog_Edit1=Edit configuration %s for %s
LaunchBarLaunchConfigDialog_Edit2=Edit configuration %s for %s on %s
LaunchBarLaunchConfigDialog_EditConfiguration=Edit Configuration
LaunchBarLaunchConfigDialog_SetParameters=Set parameters for the configuration.
LaunchConfigurationNotFound=Launch Configuration Not Found