summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2009-02-02 08:27:55 (EST)
committerCarsten Drossel2009-02-02 08:27:55 (EST)
commit68282ac1e3eba1732fcbbad3b3e6bf4e881ccadf (patch)
treebeca9f558afa00d2eaa3a1dca67f31a408cf025a
parentf8100dead3b94116cf3bcaf8268cdeb1c23c7f31 (diff)
downloadorg.eclipse.riena-68282ac1e3eba1732fcbbad3b3e6bf4e881ccadf.zip
org.eclipse.riena-68282ac1e3eba1732fcbbad3b3e6bf4e881ccadf.tar.gz
org.eclipse.riena-68282ac1e3eba1732fcbbad3b3e6bf4e881ccadf.tar.bz2
additional exception handling: viewId is not a String
-rw-r--r--org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtViewProvider.java36
1 files changed, 16 insertions, 20 deletions
diff --git a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtViewProvider.java b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtViewProvider.java
index 3dde73d..ea93a23 100644
--- a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtViewProvider.java
+++ b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtViewProvider.java
@@ -58,17 +58,8 @@ public class SwtViewProvider {
private SwtViewId createAndRegisterSwtViewId(INavigationNode<?> node) {
SwtViewId swtViewId = null;
- String viewId = null;
IWorkareaDefinition def = WorkareaManager.getInstance().getDefinition(node);
- if (def != null) {
- viewId = (String) def.getViewId();
- } else {
- throw new RuntimeException("no work area definition for node " + node.getNodeId()); //$NON-NLS-1$
- }
-
- if (viewId == null) {
- throw new RuntimeException("viewId is null for nodeId " + node.getNodeId()); //$NON-NLS-1$
- }
+ String viewId = getViewId(node, def);
swtViewId = new SwtViewId(viewId, getNextSecondaryId(viewId));
views.put(node, swtViewId);
@@ -79,17 +70,8 @@ public class SwtViewProvider {
private SwtViewId createAndRegisterSwtViewId(ISubModuleNode submodule) {
SwtViewId swtViewId = null;
- String viewId = null;
IWorkareaDefinition def = WorkareaManager.getInstance().getDefinition(submodule);
- if (def != null) {
- viewId = (String) def.getViewId();
- } else {
- throw new RuntimeException("no work area definition for node " + submodule.getNodeId()); //$NON-NLS-1$
- }
-
- if (viewId == null) {
- throw new RuntimeException("viewId is null for nodeId " + submodule.getNodeId()); //$NON-NLS-1$
- }
+ String viewId = getViewId(submodule, def);
if (viewShared.get(viewId) != null) {
if (def.isViewShared() != viewShared.get(viewId)) {
@@ -124,6 +106,20 @@ public class SwtViewProvider {
return swtViewId;
}
+ private String getViewId(INavigationNode<?> node, IWorkareaDefinition def) {
+ if (def == null) {
+ throw new ApplicationModelFailure("no work area definition for node " + node.getNodeId()); //$NON-NLS-1$
+ }
+ Object viewId = def.getViewId();
+ if (viewId == null) {
+ throw new ApplicationModelFailure("viewId is null for nodeId " + node.getNodeId()); //$NON-NLS-1$
+ }
+ if (!(viewId instanceof String)) {
+ throw new ApplicationModelFailure("viewId is not a String for nodeId " + node.getNodeId()); //$NON-NLS-1$
+ }
+ return (String) viewId;
+ }
+
private String getNextSecondaryId(String pViewId) {
if (viewCounter.get(pViewId) == null) {
viewCounter.put(pViewId, 0);