summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2009-01-21 10:44:52 (EST)
committerCarsten Drossel2009-01-21 10:44:52 (EST)
commit5924bdb99ece82fc5a4d7582128aa2f86111313f (patch)
tree03dff091602ee296d9293c3c21d28c29a2f1d9f8
parented714d965418dbbad66d2bfb9590796d2e024a85 (diff)
downloadorg.eclipse.riena-5924bdb99ece82fc5a4d7582128aa2f86111313f.zip
org.eclipse.riena-5924bdb99ece82fc5a4d7582128aa2f86111313f.tar.gz
org.eclipse.riena-5924bdb99ece82fc5a4d7582128aa2f86111313f.tar.bz2
handling TODOs, disabled code for asynchronous navigation - see eclipse bug 261832
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/NavigationArgument.java32
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java166
2 files changed, 96 insertions, 102 deletions
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/NavigationArgument.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/NavigationArgument.java
index 66dfb76..e228605 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/NavigationArgument.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/NavigationArgument.java
@@ -26,22 +26,24 @@ public class NavigationArgument {
private Object parameter;
private NavigationNodeId parentNodeId;
private INavigationArgumentListener argumentListener;
- private boolean navigateAsync = false;
- /**
- * @return the navigateAsync
- */
- public boolean isNavigateAsync() {
- return navigateAsync;
- }
-
- /**
- * @param navigateAsync
- * the navigateAsync to set
- */
- public void setNavigateAsync(boolean navigateAsync) {
- this.navigateAsync = navigateAsync;
- }
+ // TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=261832
+ //private boolean navigateAsync = false;
+ //
+ // /**
+ // * @return the navigateAsync
+ // */
+ // public boolean isNavigateAsync() {
+ // return navigateAsync;
+ // }
+ //
+ // /**
+ // * @param navigateAsync
+ // * the navigateAsync to set
+ // */
+ // public void setNavigateAsync(boolean navigateAsync) {
+ // this.navigateAsync = navigateAsync;
+ // }
/**
* @param parameter
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java
index 3875c26..ba1741b 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java
@@ -13,7 +13,6 @@ package org.eclipse.riena.navigation.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.EmptyStackException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -21,7 +20,6 @@ import java.util.Map;
import java.util.Stack;
import java.util.Vector;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.core.marker.IMarker;
import org.eclipse.riena.internal.navigation.Activator;
@@ -38,8 +36,6 @@ import org.eclipse.riena.navigation.NavigationArgument;
import org.eclipse.riena.navigation.NavigationNodeId;
import org.eclipse.riena.ui.core.marker.DisabledMarker;
import org.eclipse.riena.ui.core.marker.HiddenMarker;
-import org.eclipse.riena.ui.core.uiprocess.UIProcess;
-import org.osgi.service.log.LogService;
/**
* Default implementation for the navigation processor
@@ -231,11 +227,12 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
*/
public void navigate(final INavigationNode<?> sourceNode, final NavigationNodeId targetId,
final NavigationArgument navigation) {
- if (navigation != null && navigation.isNavigateAsync()) {
- navigateAsync(sourceNode, targetId, navigation);
- } else {
- navigateSync(sourceNode, targetId, navigation);
- }
+ // TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=261832
+ // if (navigation != null && navigation.isNavigateAsync()) {
+ // navigateAsync(sourceNode, targetId, navigation);
+ // } else {
+ navigateSync(sourceNode, targetId, navigation);
+ // }
}
/**
@@ -266,74 +263,74 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
* org.eclipse.riena.navigation.NavigationArgument)
*/
- private void navigateAsync(final INavigationNode<?> sourceNode, final NavigationNodeId targetId,
-
- final NavigationArgument navigation) {
-
- final boolean debug = LOGGER.isLoggable(LogService.LOG_DEBUG);
-
- if (debug) {
- LOGGER.log(LogService.LOG_DEBUG, "async navigation to " + targetId + " started..."); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- UIProcess p = new UIProcess("navigate", true, sourceNode) { //$NON-NLS-1$
- private INavigationNode<?> targetNode;
- private final long startTime = System.currentTimeMillis();
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.riena.ui.core.uiprocess.UIProcess#runJob(org.eclipse
- * .core.runtime.IProgressMonitor)
- */
- @Override
- public boolean runJob(IProgressMonitor monitor) {
-
- targetNode = provideNode(sourceNode, targetId, navigation);
-
- return true;
- }
-
- private void activateOrFlash(INavigationNode<?> activationNode) {
-
- if (System.currentTimeMillis() - startTime < 200) {
- activationNode.activate();
- } else {
- // TODO FLASHING but no activation
- }
- }
-
- @Override
- public void finalUpdateUI() {
-
- if (targetNode != null) {
- INavigationNode<?> activateNode = targetNode.findNode(targetId);
- if (activateNode == null) {
- activateNode = targetNode;
- }
-
- navigationMap.put(activateNode, sourceNode);
- activateOrFlash(activateNode);
- }
-
- if (debug) {
- LOGGER.log(LogService.LOG_DEBUG, "async navigation to " + targetId + " completed"); //$NON-NLS-1$//$NON-NLS-2$
- }
- }
-
- @Override
- protected int getTotalWork() {
- return 10;
- }
- };
-
- // TODO must be set?
- p.setNote("sample uiProcess note"); //$NON-NLS-1$
- p.setTitle("sample uiProcess title"); //$NON-NLS-1$
- p.start();
- }
-
+ // TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=261832
+ // private void navigateAsync(final INavigationNode<?> sourceNode, final NavigationNodeId targetId,
+ //
+ // final NavigationArgument navigation) {
+ //
+ // final boolean debug = LOGGER.isLoggable(LogService.LOG_DEBUG);
+ //
+ // if (debug) {
+ // LOGGER.log(LogService.LOG_DEBUG, "async navigation to " + targetId + " started..."); //$NON-NLS-1$ //$NON-NLS-2$
+ // }
+ //
+ // UIProcess p = new UIProcess("navigate", true, sourceNode) { //$NON-NLS-1$
+ // private INavigationNode<?> targetNode;
+ // private final long startTime = System.currentTimeMillis();
+ //
+ // /*
+ // * (non-Javadoc)
+ // *
+ // * @see
+ // * org.eclipse.riena.ui.core.uiprocess.UIProcess#runJob(org.eclipse
+ // * .core.runtime.IProgressMonitor)
+ // */
+ // @Override
+ // public boolean runJob(IProgressMonitor monitor) {
+ //
+ // targetNode = provideNode(sourceNode, targetId, navigation);
+ //
+ // return true;
+ // }
+ //
+ // private void activateOrFlash(INavigationNode<?> activationNode) {
+ //
+ // if (System.currentTimeMillis() - startTime < 200) {
+ // activationNode.activate();
+ // } else {
+ // // TODO FLASHING but no activation
+ // }
+ // }
+ //
+ // @Override
+ // public void finalUpdateUI() {
+ //
+ // if (targetNode != null) {
+ // INavigationNode<?> activateNode = targetNode.findNode(targetId);
+ // if (activateNode == null) {
+ // activateNode = targetNode;
+ // }
+ //
+ // navigationMap.put(activateNode, sourceNode);
+ // activateOrFlash(activateNode);
+ // }
+ //
+ // if (debug) {
+ // LOGGER.log(LogService.LOG_DEBUG, "async navigation to " + targetId + " completed"); //$NON-NLS-1$//$NON-NLS-2$
+ // }
+ // }
+ //
+ // @Override
+ // protected int getTotalWork() {
+ // return 10;
+ // }
+ // };
+ //
+ // // TODO must be set?
+ // p.setNote("sample uiProcess note"); //$NON-NLS-1$
+ // p.setTitle("sample uiProcess title"); //$NON-NLS-1$
+ // p.start();
+ // }
private INavigationNode<?> provideNode(INavigationNode<?> sourceNode, NavigationNodeId targetId,
NavigationArgument argument) {
@@ -341,7 +338,6 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
}
protected INavigationNodeProvider getNavigationNodeProvider() {
- // TODO: handling if no service found ???
return NavigationNodeProviderAccessor.current().getNavigationNodeProvider();
}
@@ -864,10 +860,7 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
* @see org.eclipse.riena.navigation.INavigationNode#navigateHistoryBack()
*/
public void historyBack() {
- try {
- if (getHistoryBackSize() == 0) {
- return;
- }
+ if (getHistoryBackSize() > 0) {
INavigationNode<?> current = histBack.pop();// skip self
fireBackHistoryChangedEvent();
histForward.push(current);
@@ -879,8 +872,6 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
if (node != null) {
activate(node);
}
- } catch (EmptyStackException ex) {
- // TODO: should we throw exception here?
}
}
@@ -903,16 +894,17 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
* @see org.eclipse.riena.navigation.INavigationNode#navigateHistoryBack()
*/
public void historyForward() {
- try {
+ if (getHistoryForwardSize() > 0) {
INavigationNode<?> current = histForward.pop();
fireForewardHistoryChangedEvent();
if (current != null) {
histBack.push(current);
+ if (histBack.size() > maxStacksize) {
+ histBack.remove(histBack.firstElement());
+ }
activate(current);
fireBackHistoryChangedEvent();
}
- } catch (EmptyStackException ex) {
- // TODO: should we throw exception here?
}
}