mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52: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
|
2004-01-07 Alain Magloire
|
||||||
|
|
||||||
Fix # 49652
|
Fix # 49652
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.IEditorPart;
|
import org.eclipse.ui.IEditorPart;
|
||||||
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
|
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);
|
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), provider);
|
||||||
dialog.setElements(debugConfigs);
|
dialog.setElements(debugConfigs);
|
||||||
dialog.setTitle("Launch Debug Configuration Selection"); //$NON-NLS-1$
|
dialog.setTitle(getDebugConfigDialogTitleString(debugConfigs, mode));
|
||||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
dialog.setMessage(getDebugConfigDialogMessageString(debugConfigs, mode));
|
||||||
dialog.setMessage("Choose a debug configuration to debug"); //$NON-NLS-1$
|
|
||||||
} else {
|
|
||||||
dialog.setMessage("Choose a configuration to run"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
dialog.setMultipleSelection(false);
|
dialog.setMultipleSelection(false);
|
||||||
int result = dialog.open();
|
int result = dialog.open();
|
||||||
provider.dispose();
|
provider.dispose();
|
||||||
|
@ -226,6 +223,19 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
||||||
return null;
|
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
|
* 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
|
* 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();
|
IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
|
||||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
|
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
|
||||||
dialog.setElements(configList.toArray());
|
dialog.setElements(configList.toArray());
|
||||||
dialog.setTitle("Launch Configuration Selection"); //$NON-NLS-1$
|
dialog.setTitle(getLaunchSelectionDialogTitleString(configList, mode));
|
||||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
dialog.setMessage(getLaunchSelectionDialogMessageString(configList, 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.setMultipleSelection(false);
|
dialog.setMultipleSelection(false);
|
||||||
int result = dialog.open();
|
int result = dialog.open();
|
||||||
labelProvider.dispose();
|
labelProvider.dispose();
|
||||||
|
@ -250,40 +256,76 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
||||||
return null;
|
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
|
* Prompts the user to select a binary
|
||||||
*
|
*
|
||||||
* @return the selected binary or <code>null</code> if none.
|
* @return the selected binary or <code>null</code> if none.
|
||||||
*/
|
*/
|
||||||
protected IBinary chooseBinary(List binList, String mode) {
|
protected IBinary chooseBinary(List binList, String mode) {
|
||||||
ILabelProvider provider = new CElementLabelProvider() {
|
ILabelProvider programLabelProvider = new CElementLabelProvider() {
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
if (element instanceof IBinary) {
|
if (element instanceof IBinary) {
|
||||||
IBinary bin = (IBinary)element;
|
IBinary bin = (IBinary)element;
|
||||||
StringBuffer name = new StringBuffer();
|
StringBuffer name = new StringBuffer();
|
||||||
name.append(bin.getPath().toString());
|
name.append(bin.getPath().lastSegment());
|
||||||
name.append(" - [" + bin.getCPU() + (bin.isLittleEndian() ? "le" : "be") + "]");
|
|
||||||
return name.toString();
|
return name.toString();
|
||||||
}
|
}
|
||||||
return super.getText(element);
|
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.setElements(binList.toArray());
|
||||||
dialog.setTitle("C Local Application"); //$NON-NLS-1$
|
dialog.setTitle(getBinarySelectionDialogTitleString(binList, mode)); //$NON-NLS-1$
|
||||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
dialog.setMessage(getBinarySelectionDialogMessageString(binList, mode)); //$NON-NLS-1$
|
||||||
dialog.setMessage("Choose a local application to debug"); //$NON-NLS-1$
|
dialog.setUpperListLabel("Binaries:");
|
||||||
} else {
|
dialog.setLowerListLabel("Qualifier:");
|
||||||
dialog.setMessage("Choose a local application to run"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
dialog.setMultipleSelection(false);
|
dialog.setMultipleSelection(false);
|
||||||
if (dialog.open() == ElementListSelectionDialog.OK) {
|
if (dialog.open() == ElementListSelectionDialog.OK) {
|
||||||
return (IBinary) dialog.getFirstResult();
|
return (IBinary) dialog.getFirstResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
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.
|
* Method searchAndLaunch.
|
||||||
* @param objects
|
* @param objects
|
||||||
|
@ -330,11 +372,11 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
return;
|
return;
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
MessageDialog.openError(getShell(), "C Local Application Launcher", e.getMessage());
|
MessageDialog.openError(getShell(), "Application Launcher", e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (results.size() == 0) {
|
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 {
|
} else {
|
||||||
IBinary bin = chooseBinary(results, mode);
|
IBinary bin = chooseBinary(results, mode);
|
||||||
if (bin != null) {
|
if (bin != null) {
|
||||||
|
@ -342,7 +384,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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.Label;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
|
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
|
||||||
|
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
|
||||||
import org.eclipse.ui.help.WorkbenchHelp;
|
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");
|
"Project must first be entered before searching for a program");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ILabelProvider labelProvider = new CElementLabelProvider() {
|
|
||||||
|
ILabelProvider programLabelProvider = new CElementLabelProvider() {
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
if (element instanceof IBinary) {
|
if (element instanceof IBinary) {
|
||||||
IBinary bin = (IBinary)element;
|
IBinary bin = (IBinary)element;
|
||||||
StringBuffer name = new StringBuffer();
|
StringBuffer name = new StringBuffer();
|
||||||
name.append(bin.getPath().toString());
|
name.append(bin.getPath().lastSegment());
|
||||||
name.append(" - [" + bin.getCPU() + (bin.isLittleEndian() ? "le" : "be") + "]");
|
|
||||||
return name.toString();
|
return name.toString();
|
||||||
}
|
}
|
||||||
return super.getText(element);
|
return super.getText(element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
|
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(getBinaryFiles(getCProject()));
|
dialog.setElements(getBinaryFiles(getCProject()));
|
||||||
dialog.setMessage("Choose a &program to run");
|
dialog.setMessage("Choose a &program to run:");
|
||||||
dialog.setTitle("Program Selection");
|
dialog.setTitle("Program Selection");
|
||||||
|
dialog.setUpperListLabel("Binaries:");
|
||||||
|
dialog.setLowerListLabel("Qualifier:");
|
||||||
|
dialog.setMultipleSelection(false);
|
||||||
if (dialog.open() == ElementListSelectionDialog.OK) {
|
if (dialog.open() == ElementListSelectionDialog.OK) {
|
||||||
IBinary binary = (IBinary) dialog.getFirstResult();
|
IBinary binary = (IBinary) dialog.getFirstResult();
|
||||||
fProgText.setText(binary.getResource().getProjectRelativePath().toString());
|
fProgText.setText(binary.getResource().getProjectRelativePath().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue