Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-04-19 20:06:27 -0400
committerAlain Magloire2004-04-19 20:06:27 -0400
commit7ef1a6ed7ebb08bad965eb900f349ce3d431e3d9 (patch)
tree4160920c3773843770ecb634a86c94624eda9c81 /launch/org.eclipse.cdt.launch
parente2983ad1f85b8b3ba80a73a8b0453ef6828d31ca (diff)
downloadorg.eclipse.cdt-7ef1a6ed7ebb08bad965eb900f349ce3d431e3d9.tar.gz
org.eclipse.cdt-7ef1a6ed7ebb08bad965eb900f349ce3d431e3d9.tar.xz
org.eclipse.cdt-7ef1a6ed7ebb08bad965eb900f349ce3d431e3d9.zip
Change The Core Model interfaces to throw CModelException when
the fail abnormally. This forces a lot of try{} catch(){} bloks and rethrow to be added in the code.
Diffstat (limited to 'launch/org.eclipse.cdt.launch')
-rw-r--r--launch/org.eclipse.cdt.launch/ChangeLog6
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java12
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java42
3 files changed, 39 insertions, 21 deletions
diff --git a/launch/org.eclipse.cdt.launch/ChangeLog b/launch/org.eclipse.cdt.launch/ChangeLog
index 7e4f2a29b3d..e47b6b5fc48 100644
--- a/launch/org.eclipse.cdt.launch/ChangeLog
+++ b/launch/org.eclipse.cdt.launch/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-19 Alain Magloire
+ Core Model interface throws Exception
+
+ * src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
+ * sr/org/eclipse/cdt/launch/ui/CMaintab.java
+
2004-04-06 Mikhail Khodjaiants
Do not remove debugger process from launch.
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 3392740f738..0d09717465e 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
@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
@@ -351,12 +352,15 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut, ILaunchFilte
if (r != null) {
ICProject cproject = CoreModel.getDefault().create(r.getProject());
if (cproject != null) {
- IBinary[] bins = cproject.getBinaryContainer().getBinaries();
+ try {
+ IBinary[] bins = cproject.getBinaryContainer().getBinaries();
- for (int j = 0; j < bins.length; j++) {
- if (bins[j].isExecutable()) {
- results.add(bins[j]);
+ for (int j = 0; j < bins.length; j++) {
+ if (bins[j].isExecutable()) {
+ results.add(bins[j]);
+ }
}
+ } catch (CModelException e) {
}
}
}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
index 1540de42fc1..89da97dfb0a 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
@@ -9,6 +9,7 @@ import java.util.ArrayList;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
@@ -360,7 +361,11 @@ public class CMainTab extends CLaunchConfigurationTab {
final Object[] ret = new Object[1];
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
- ret[0] = cproject.getBinaryContainer().getBinaries();
+ try {
+ ret[0] = cproject.getBinaryContainer().getBinaries();
+ } catch (CModelException e) {
+ LaunchUIPlugin.errorDialog("Launch UI internal error", e); //$NON-NLS-1$
+ }
}
});
@@ -387,21 +392,24 @@ public class CMainTab extends CLaunchConfigurationTab {
* or null if there was none.
*/
protected ICProject chooseCProject() {
- ICProject[] projects;
- projects = getCProjects();
-
- ILabelProvider labelProvider = new CElementLabelProvider();
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
- dialog.setTitle(LaunchUIPlugin.getResourceString("CMainTab.Project_Selection")); //$NON-NLS-1$
- dialog.setMessage(LaunchUIPlugin.getResourceString("CMainTab.Choose_project_to_constrain_search_for_program")); //$NON-NLS-1$
- dialog.setElements(projects);
-
- ICProject cProject = getCProject();
- if (cProject != null) {
- dialog.setInitialSelections(new Object[] { cProject });
- }
- if (dialog.open() == ElementListSelectionDialog.OK) {
- return (ICProject) dialog.getFirstResult();
+ try {
+ ICProject[] projects = getCProjects();
+
+ ILabelProvider labelProvider = new CElementLabelProvider();
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
+ dialog.setTitle(LaunchUIPlugin.getResourceString("CMainTab.Project_Selection")); //$NON-NLS-1$
+ dialog.setMessage(LaunchUIPlugin.getResourceString("CMainTab.Choose_project_to_constrain_search_for_program")); //$NON-NLS-1$
+ dialog.setElements(projects);
+
+ ICProject cProject = getCProject();
+ if (cProject != null) {
+ dialog.setInitialSelections(new Object[] { cProject });
+ }
+ if (dialog.open() == ElementListSelectionDialog.OK) {
+ return (ICProject) dialog.getFirstResult();
+ }
+ } catch (CModelException e) {
+ LaunchUIPlugin.errorDialog("Launch UI internal error", e); //$NON-NLS-1$
}
return null;
}
@@ -410,7 +418,7 @@ public class CMainTab extends CLaunchConfigurationTab {
* Return an array a ICProject whose platform match that of the runtime env.
**/
- protected ICProject[] getCProjects() {
+ protected ICProject[] getCProjects() throws CModelException {
ICProject cproject[] = CoreModel.getDefault().getCModel().getCProjects();
ArrayList list = new ArrayList(cproject.length);
boolean isNative = filterPlatform.equals(BootLoader.getOS());

Back to the top