Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-10-19 08:03:57 +0000
committerEike Stepper2010-10-19 08:03:57 +0000
commit5a45851de7b4d9b87cb209036a46f59efd8fd937 (patch)
tree88436c208ccc38ea8b4d220c80cb7c1cadef82d6 /plugins/org.eclipse.net4j.util.ui
parent6aeb7a63a7ef0a3f48fb7c643e49314ee03c6005 (diff)
downloadcdo-5a45851de7b4d9b87cb209036a46f59efd8fd937.tar.gz
cdo-5a45851de7b4d9b87cb209036a46f59efd8fd937.tar.xz
cdo-5a45851de7b4d9b87cb209036a46f59efd8fd937.zip
[327405] Provide an offline CDOWorkspace with Checkout/Update/Commit workflows
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327405
Diffstat (limited to 'plugins/org.eclipse.net4j.util.ui')
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java16
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java36
2 files changed, 43 insertions, 9 deletions
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
index 0a3c299931..c2d8a4c44f 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
@@ -238,6 +238,16 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
/**
* @since 3.1
*/
+ protected void executeLazyRunnable(Runnable runnable)
+ {
+ Thread thread = new Thread(runnable);
+ thread.setDaemon(true);
+ thread.start();
+ }
+
+ /**
+ * @since 3.1
+ */
protected boolean isSlow(IContainer<Object> container)
{
return container instanceof ISlow;
@@ -473,9 +483,8 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
final LazyElement lazyElement = new LazyElement(container);
addChild(children, lazyElement);
- Thread thread = new Thread()
+ Runnable runnable = new Runnable()
{
- @Override
public void run()
{
try
@@ -496,8 +505,7 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
}
};
- thread.setDaemon(true);
- thread.start();
+ executeLazyRunnable(runnable);
}
else
{
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java
index d8254c4b90..d8cca0525f 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java
@@ -200,15 +200,24 @@ public abstract class ContainerView extends ViewPart implements ISelectionProvid
protected Control createUI(Composite parent)
{
- itemProvider = createContainerItemProvider();
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ initViewer();
+
+ viewer.addSelectionChangedListener(selectionListener);
+ getSite().setSelectionProvider(this);
+ return viewer.getControl();
+ }
+
+ /**
+ * @since 3.1
+ */
+ protected void initViewer()
+ {
+ itemProvider = createContainerItemProvider();
viewer.setContentProvider(createContentProvider());
viewer.setLabelProvider(createLabelProvider());
viewer.setSorter(new ContainerNameSorter());
resetInput();
- viewer.addSelectionChangedListener(selectionListener);
- getSite().setSelectionProvider(this);
- return viewer.getControl();
}
/**
@@ -429,6 +438,15 @@ public abstract class ContainerView extends ViewPart implements ISelectionProvid
}
}
+ /**
+ * @since 3.1
+ */
+ protected void refreshPressed()
+ {
+ itemProvider.dispose();
+ initViewer();
+ }
+
protected void closeView()
{
try
@@ -485,6 +503,14 @@ public abstract class ContainerView extends ViewPart implements ISelectionProvid
}
}
+ /**
+ * @since 3.1
+ */
+ protected Action getRefreshAction()
+ {
+ return refreshAction;
+ }
+
protected Display getDisplay()
{
Display display = viewer.getControl().getDisplay();
@@ -610,7 +636,7 @@ public abstract class ContainerView extends ViewPart implements ISelectionProvid
@Override
protected void safeRun() throws Exception
{
- viewer.refresh(false);
+ refreshPressed();
}
}

Back to the top