Skip to main content
summaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorAlain Magloire2004-02-19 23:34:28 -0500
committerAlain Magloire2004-02-19 23:34:28 -0500
commit92b0174888700d3a035416ac1763e9ca07787eea (patch)
tree4d6af3f3a9a6e401beb8c440d6e37699bb0c6895 /launch
parent9579ebb09c442bc77eaaad8a12e3258cf9d0cc77 (diff)
downloadorg.eclipse.cdt-92b0174888700d3a035416ac1763e9ca07787eea.tar.gz
org.eclipse.cdt-92b0174888700d3a035416ac1763e9ca07787eea.tar.xz
org.eclipse.cdt-92b0174888700d3a035416ac1763e9ca07787eea.zip
filterClass contribution attribute to use the "Run"
launch ShortCut.
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.launch/ChangeLog9
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java40
2 files changed, 32 insertions, 17 deletions
diff --git a/launch/org.eclipse.cdt.launch/ChangeLog b/launch/org.eclipse.cdt.launch/ChangeLog
index 1c4741f066..9d09fc73ec 100644
--- a/launch/org.eclipse.cdt.launch/ChangeLog
+++ b/launch/org.eclipse.cdt.launch/ChangeLog
@@ -1,6 +1,13 @@
2004-02-18 Alain Magloire
- Remove dprecated Eclipse-2.0 calls;
+ filterClass contribution to be able to use
+ the "Run" context menu shortcut.
+
+ * src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
+
+2004-02-18 Alain Magloire
+
+ Remove deprecated Eclipse-2.0 calls;
* src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
index 33443777a6..74bd70f338 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
@@ -93,7 +93,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut, ILaunchFilte
String programName = AbstractCLaunchDelegate.getProgramName(config);
String projectName = AbstractCLaunchDelegate.getProjectName(config);
String name = bin.getResource().getProjectRelativePath().toString();
- if (projectName != null && programName.equals(name)) {
+ if (programName != null && programName.equals(name)) {
if (projectName != null && projectName.equals(bin.getCProject().getProject().getName())) {
candidateConfigs.add(config);
}
@@ -332,9 +332,12 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut, ILaunchFilte
* @param mode
*/
private void searchAndLaunch(final Object[] elements, String mode) {
- final List results = new ArrayList();
if (elements != null && elements.length > 0) {
- try {
+ IBinary bin = null;
+ if (elements.length == 1 && elements[0] instanceof IBinary) {
+ bin = (IBinary)elements[0];
+ } else {
+ final List results = new ArrayList();
ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor pm) throws InterruptedException {
@@ -368,20 +371,25 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut, ILaunchFilte
}
}
};
- dialog.run(true, true, runnable);
- } catch (InterruptedException e) {
- return;
- } catch (InvocationTargetException e) {
- MessageDialog.openError(getShell(), "Application Launcher", e.getMessage());
- return;
- }
- if (results.size() == 0) {
- MessageDialog.openError(getShell(), "Application Launcher", "Launch failed no binaries");
- } else {
- IBinary bin = chooseBinary(results, mode);
- if (bin != null) {
- launch(bin, mode);
+ try {
+ dialog.run(true, true, runnable);
+ } catch (InterruptedException e) {
+ return;
+ } catch (InvocationTargetException e) {
+ MessageDialog.openError(getShell(), "Application Launcher", e.getMessage());
+ return;
}
+ int count = results.size();
+ if (count == 0) {
+ MessageDialog.openError(getShell(), "Application Launcher", "Launch failed no binaries");
+ } else if (count > 1) {
+ bin = chooseBinary(results, mode);
+ } else {
+ bin = (IBinary)results.get(0);
+ }
+ }
+ if (bin != null) {
+ launch(bin, mode);
}
} else {
MessageDialog.openError(getShell(), "Application Launcher", "Launch failed no project selected");

Back to the top