1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

filterClass contribution attribute to use the "Run"

launch ShortCut.
This commit is contained in:
Alain Magloire 2004-02-20 04:34:28 +00:00
parent 9579ebb09c
commit 92b0174888
2 changed files with 32 additions and 17 deletions

View file

@ -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

View file

@ -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");