summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-08-08 09:52:42 (EDT)
committerCarsten Drossel2008-08-08 09:52:42 (EDT)
commit7f522f953b3605b4a38980f7f93797f7ccf2f568 (patch)
treeac2ae214d089933b629bc5784bd07624ad313e9d
parenteb0cb10f316f54304db66888934b3318822c4d37 (diff)
downloadorg.eclipse.riena-7f522f953b3605b4a38980f7f93797f7ccf2f568.zip
org.eclipse.riena-7f522f953b3605b4a38980f7f93797f7ccf2f568.tar.gz
org.eclipse.riena-7f522f953b3605b4a38980f7f93797f7ccf2f568.tar.bz2
merged the new approach creating the SwtViewId using the extension points with the way shared views were handled - now it works but will have to be reviewed :-)
-rw-r--r--org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java49
1 files changed, 40 insertions, 9 deletions
diff --git a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java
index 8dcd98f..bc0fde0 100644
--- a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java
+++ b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java
@@ -54,14 +54,32 @@ public class SwtPresentationManager {
INavigationNodeId nodeId = pNode.getNodeId();
if (nodeId != null) {
String viewId = (String) getPresentationProviderService().provideView(nodeId);
- String secondaryId = null;
- if (getPresentationProviderService().isViewShared(nodeId)) {
- secondaryId = "shared"; //$NON-NLS-1$
+ boolean isViewShared = getPresentationProviderService().isViewShared(nodeId);
+ viewShared.put(viewId, isViewShared);
+ if (isViewShared && pNode instanceof ISubModuleNode) {
+ ISubModuleNode subModuleNode = (ISubModuleNode) pNode;
+ activated.put(subModuleNode, subModuleNode.isActivated());
+ subModuleNode.addListener(subModuleNodeObserver);
+ if (views.get(pNode) == null) {
+ viewCounter.put(viewId, new Integer(0));
+ }
+ SwtViewId id = null;
+ if (viewCounter.get(viewId) == 0) {
+ // first node with this view
+ id = new SwtViewId(viewId, "shared"); //$NON-NLS-1$
+ views.put(pNode, id);
+ viewCounter.put(viewId, 1);
+ } else {
+ // view has been referenced already
+ id = views.get(getNavigationNode(viewId, null, ISubModuleNode.class, true));
+ views.put(pNode, id);
+ }
+ return id;
+
} else {
- secondaryId = getNextSecondaryId(viewId);
+ swtViewId = new SwtViewId(viewId, getNextSecondaryId(viewId));
+ views.put(pNode, swtViewId);
}
- swtViewId = new SwtViewId(viewId, secondaryId);
- views.put(pNode, swtViewId);
}
}
@@ -72,10 +90,10 @@ public class SwtPresentationManager {
@Override
public void activated(ISubModuleNode source) {
- markActivated(source);
+ markActivated(source, true);
}
- private void markActivated(ISubModuleNode source) {
+ private void markActivated(ISubModuleNode source, boolean active) {
SwtViewId sourceId = views.get(source);
for (INavigationNode<?> node : views.keySet()) {
if (views.get(node) == sourceId) {
@@ -86,6 +104,19 @@ public class SwtPresentationManager {
}
}
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.riena.navigation.listener.NavigationNodeListener#deactivated
+ * (org.eclipse.riena.navigation.INavigationNode)
+ */
+ @Override
+ public void deactivated(ISubModuleNode source) {
+ super.deactivated(source);
+ markActivated(source, false);
+ }
}
public void present(INavigationNode<?> pNode, String pViewId) {
@@ -170,7 +201,7 @@ public class SwtPresentationManager {
SwtViewId nextViewId = views.get(next);
if (nextViewId.getId().equals(pId) && //
(secondary == null || secondary.equals(nextViewId.getSecondary()))) {
- if (ignoreSharedState || !isViewShared(pId) || activated.get(next)) {
+ if (ignoreSharedState || !isViewShared(pId) || next.isActivated()) {
return next.getTypecastedAdapter(pClass);
}
}