Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/navigator/deferred/ClearPlaceHolderJob.java')
-rw-r--r--bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/navigator/deferred/ClearPlaceHolderJob.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/navigator/deferred/ClearPlaceHolderJob.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/navigator/deferred/ClearPlaceHolderJob.java
new file mode 100644
index 00000000..80611b87
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/navigator/deferred/ClearPlaceHolderJob.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.jsdt.internal.ui.navigator.deferred;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.ui.progress.UIJob;
+import org.eclipse.wst.jsdt.internal.ui.packageview.PackagesMessages;
+
+public class ClearPlaceHolderJob extends UIJob {
+
+ private AbstractTreeViewer viewer;
+ private LoadingModelNode placeHolder;
+ private Object[] children;
+ private Object parent;
+
+ public ClearPlaceHolderJob(AbstractTreeViewer viewer, LoadingModelNode placeHolder, Object parent, Object[] children) {
+ super(PackagesMessages.UpdatingViewer);
+ this.viewer = viewer;
+ this.placeHolder = placeHolder;
+ this.parent = parent;
+ this.children = children;
+ setRule(new NonConflictingRule());
+ }
+
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (!viewer.getControl().isDisposed()) {
+ try {
+ viewer.getControl().setRedraw(false);
+ viewer.add(parent, children);
+ viewer.remove(placeHolder);
+ }
+ finally {
+ viewer.getControl().setRedraw(true);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file

Back to the top