mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Updates to improve usabilty with projects which contain
multiple binaries and to improve extensibility of quick launcher.
This commit is contained in:
parent
e2482f2bc6
commit
c017fa06af
3 changed files with 99 additions and 29 deletions
|
@ -1,3 +1,12 @@
|
|||
2004-02-02 Thomas Fletcher
|
||||
|
||||
Improve the previous fix to use a TwoElementPane dialog to properly differentiate between
|
||||
elements by target architecture and path.
|
||||
Enhanced the ability to extend this short-cut with OEM specific labelling.
|
||||
|
||||
* src/org/eclipse/cdt/launch/ui/CMainTab.java
|
||||
* src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
|
||||
|
||||
2004-01-07 Alain Magloire
|
||||
|
||||
Fix # 49652
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.jface.viewers.LabelProvider;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
|
||||
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -211,12 +212,8 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
|||
};
|
||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), provider);
|
||||
dialog.setElements(debugConfigs);
|
||||
dialog.setTitle("Launch Debug Configuration Selection"); //$NON-NLS-1$
|
||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||
dialog.setMessage("Choose a debug configuration to debug"); //$NON-NLS-1$
|
||||
} else {
|
||||
dialog.setMessage("Choose a configuration to run"); //$NON-NLS-1$
|
||||
}
|
||||
dialog.setTitle(getDebugConfigDialogTitleString(debugConfigs, mode));
|
||||
dialog.setMessage(getDebugConfigDialogMessageString(debugConfigs, mode));
|
||||
dialog.setMultipleSelection(false);
|
||||
int result = dialog.open();
|
||||
provider.dispose();
|
||||
|
@ -226,6 +223,19 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected String getDebugConfigDialogTitleString(ICDebugConfiguration [] configList, String mode) {
|
||||
return "Launch Debug Configuration Selection"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected String getDebugConfigDialogMessageString(ICDebugConfiguration [] configList, String mode) {
|
||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||
return "Choose a debug configuration to debug"; //$NON-NLS-1$
|
||||
} else {
|
||||
return "Choose a configuration to run"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show a selection dialog that allows the user to choose one of the specified
|
||||
* launch configurations. Return the chosen config, or <code>null</code> if the
|
||||
|
@ -235,12 +245,8 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
|||
IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
|
||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
|
||||
dialog.setElements(configList.toArray());
|
||||
dialog.setTitle("Launch Configuration Selection"); //$NON-NLS-1$
|
||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||
dialog.setMessage("Choose a launch configuration to debug"); //$NON-NLS-1$
|
||||
} else {
|
||||
dialog.setMessage("Choose a launch configuration to run"); //$NON-NLS-1$
|
||||
}
|
||||
dialog.setTitle(getLaunchSelectionDialogTitleString(configList, mode));
|
||||
dialog.setMessage(getLaunchSelectionDialogMessageString(configList, mode));
|
||||
dialog.setMultipleSelection(false);
|
||||
int result = dialog.open();
|
||||
labelProvider.dispose();
|
||||
|
@ -250,39 +256,75 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected String getLaunchSelectionDialogTitleString(List configList, String mode) {
|
||||
return "Launch Configuration Selection"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected String getLaunchSelectionDialogMessageString(List binList, String mode) {
|
||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||
return "Choose a launch configuration to debug"; //$NON-NLS-1$
|
||||
} else {
|
||||
return "Choose a launch configuration to run"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompts the user to select a binary
|
||||
*
|
||||
* @return the selected binary or <code>null</code> if none.
|
||||
*/
|
||||
protected IBinary chooseBinary(List binList, String mode) {
|
||||
ILabelProvider provider = new CElementLabelProvider() {
|
||||
ILabelProvider programLabelProvider = new CElementLabelProvider() {
|
||||
public String getText(Object element) {
|
||||
if (element instanceof IBinary) {
|
||||
IBinary bin = (IBinary)element;
|
||||
StringBuffer name = new StringBuffer();
|
||||
name.append(bin.getPath().toString());
|
||||
name.append(" - [" + bin.getCPU() + (bin.isLittleEndian() ? "le" : "be") + "]");
|
||||
name.append(bin.getPath().lastSegment());
|
||||
return name.toString();
|
||||
}
|
||||
return super.getText(element);
|
||||
}
|
||||
};
|
||||
|
||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), provider);
|
||||
ILabelProvider qualifierLabelProvider = new CElementLabelProvider() {
|
||||
public String getText(Object element) {
|
||||
if (element instanceof IBinary) {
|
||||
IBinary bin = (IBinary)element;
|
||||
StringBuffer name = new StringBuffer();
|
||||
name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be"));
|
||||
name.append(" - ");
|
||||
name.append(bin.getPath().toString());
|
||||
return name.toString();
|
||||
}
|
||||
return super.getText(element);
|
||||
}
|
||||
};
|
||||
|
||||
TwoPaneElementSelector dialog = new TwoPaneElementSelector(getShell(), programLabelProvider, qualifierLabelProvider);
|
||||
dialog.setElements(binList.toArray());
|
||||
dialog.setTitle("C Local Application"); //$NON-NLS-1$
|
||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||
dialog.setMessage("Choose a local application to debug"); //$NON-NLS-1$
|
||||
} else {
|
||||
dialog.setMessage("Choose a local application to run"); //$NON-NLS-1$
|
||||
}
|
||||
dialog.setTitle(getBinarySelectionDialogTitleString(binList, mode)); //$NON-NLS-1$
|
||||
dialog.setMessage(getBinarySelectionDialogMessageString(binList, mode)); //$NON-NLS-1$
|
||||
dialog.setUpperListLabel("Binaries:");
|
||||
dialog.setLowerListLabel("Qualifier:");
|
||||
dialog.setMultipleSelection(false);
|
||||
if (dialog.open() == ElementListSelectionDialog.OK) {
|
||||
return (IBinary) dialog.getFirstResult();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String getBinarySelectionDialogTitleString(List binList, String mode) {
|
||||
return "C Local Application"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected String getBinarySelectionDialogMessageString(List binList, String mode) {
|
||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||
return "Choose a local application to debug"; //$NON-NLS-1$
|
||||
} else {
|
||||
return "Choose a local application to run"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method searchAndLaunch.
|
||||
|
@ -330,11 +372,11 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
|||
} catch (InterruptedException e) {
|
||||
return;
|
||||
} catch (InvocationTargetException e) {
|
||||
MessageDialog.openError(getShell(), "C Local Application Launcher", e.getMessage());
|
||||
MessageDialog.openError(getShell(), "Application Launcher", e.getMessage());
|
||||
return;
|
||||
}
|
||||
if (results.size() == 0) {
|
||||
MessageDialog.openError(getShell(), "C Local Application Launcher", "Launch failed no binaries");
|
||||
MessageDialog.openError(getShell(), "Application Launcher", "Launch failed no binaries");
|
||||
} else {
|
||||
IBinary bin = chooseBinary(results, mode);
|
||||
if (bin != null) {
|
||||
|
@ -342,7 +384,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
MessageDialog.openError(getShell(), "C Local Application Launcher", "Launch failed no project selected");
|
||||
MessageDialog.openError(getShell(), "Application Launcher", "Launch failed no project selected");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.swt.widgets.Display;
|
|||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
|
||||
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
|
||||
import org.eclipse.ui.help.WorkbenchHelp;
|
||||
|
||||
/**
|
||||
|
@ -198,27 +199,45 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
"Project must first be entered before searching for a program");
|
||||
return;
|
||||
}
|
||||
ILabelProvider labelProvider = new CElementLabelProvider() {
|
||||
|
||||
ILabelProvider programLabelProvider = new CElementLabelProvider() {
|
||||
public String getText(Object element) {
|
||||
if (element instanceof IBinary) {
|
||||
IBinary bin = (IBinary)element;
|
||||
StringBuffer name = new StringBuffer();
|
||||
name.append(bin.getPath().lastSegment());
|
||||
return name.toString();
|
||||
}
|
||||
return super.getText(element);
|
||||
}
|
||||
};
|
||||
|
||||
ILabelProvider qualifierLabelProvider = new CElementLabelProvider() {
|
||||
public String getText(Object element) {
|
||||
if (element instanceof IBinary) {
|
||||
IBinary bin = (IBinary)element;
|
||||
StringBuffer name = new StringBuffer();
|
||||
name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be"));
|
||||
name.append(" - ");
|
||||
name.append(bin.getPath().toString());
|
||||
name.append(" - [" + bin.getCPU() + (bin.isLittleEndian() ? "le" : "be") + "]");
|
||||
return name.toString();
|
||||
}
|
||||
return super.getText(element);
|
||||
}
|
||||
};
|
||||
|
||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
|
||||
TwoPaneElementSelector dialog = new TwoPaneElementSelector(getShell(), programLabelProvider, qualifierLabelProvider);
|
||||
dialog.setElements(getBinaryFiles(getCProject()));
|
||||
dialog.setMessage("Choose a &program to run");
|
||||
dialog.setMessage("Choose a &program to run:");
|
||||
dialog.setTitle("Program Selection");
|
||||
dialog.setUpperListLabel("Binaries:");
|
||||
dialog.setLowerListLabel("Qualifier:");
|
||||
dialog.setMultipleSelection(false);
|
||||
if (dialog.open() == ElementListSelectionDialog.OK) {
|
||||
IBinary binary = (IBinary) dialog.getFirstResult();
|
||||
fProgText.setText(binary.getResource().getProjectRelativePath().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue