X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FImageLoaderJob.java;h=86edc928cffcaf075f18ff1b767b6f55cb3af339;hb=27486a61ad5a2df27c62edaff098926363a025b1;hp=5f5d26b3ab8a32b7b8d636ba2d42f94d062d9ae0;hpb=75785e1454fbc60973848c72e2ed698d2cda5ce7;p=simantics%2Fplatform.git
diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ImageLoaderJob.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ImageLoaderJob.java
index 5f5d26b3a..86edc928c 100644
--- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ImageLoaderJob.java
+++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ImageLoaderJob.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * Copyright (c) 2013 Association for Decentralized Information Management
- * in Industry THTH ry.
- * 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:
- * Semantum Oy - initial API and implementation
- *******************************************************************************/
-package org.simantics.browsing.ui.swt;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.ui.progress.IProgressConstants;
-import org.simantics.DatabaseJob;
-
-/**
- * @author Tuukka Lehtonen
- */
-public class ImageLoaderJob extends DatabaseJob {
-
- private GraphExplorerImplBase ge;
- private AtomicBoolean isScheduled = new AtomicBoolean();
-
- public ImageLoaderJob(GraphExplorerImplBase ge) {
- super("Image Loader");
- this.ge = ge;
- setSystem(true);
- setUser(false);
- setPriority(Job.DECORATE);
- setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
- }
-
- /**
- * Schedules the job with {@link Job#schedule()} if necessary, i.e. if
- * not already scheduled. This method avoids some unnecessary overhead
- * caused by repeatedly invoking {@link Job#schedule()}.
- *
- * @return true
if scheduled, false
otherwise
- */
- public boolean scheduleIfNecessary(long delay) {
- if (isScheduled.compareAndSet(false, true)) {
- schedule(delay);
- return true;
- }
- return false;
- }
-
- @Override
- public boolean shouldRun() {
- return ge != null;
- }
-
- @Override
- public boolean shouldSchedule() {
- return ge != null;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- isScheduled.set(false);
- GraphExplorerImplBase ge = this.ge;
- return (ge != null) ? ge.setPendingImages(monitor) : Status.CANCEL_STATUS;
- } finally {
- monitor.done();
- }
- }
-
- public void dispose() {
- ge = null;
- }
+/*******************************************************************************
+ * Copyright (c) 2013 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * 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:
+ * Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.browsing.ui.swt;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.progress.IProgressConstants;
+import org.simantics.DatabaseJob;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class ImageLoaderJob extends DatabaseJob {
+
+ private GraphExplorerImplBase ge;
+ private AtomicBoolean isScheduled = new AtomicBoolean();
+
+ public ImageLoaderJob(GraphExplorerImplBase ge) {
+ super("Image Loader");
+ this.ge = ge;
+ setSystem(true);
+ setUser(false);
+ setPriority(Job.DECORATE);
+ setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
+ }
+
+ /**
+ * Schedules the job with {@link Job#schedule()} if necessary, i.e. if
+ * not already scheduled. This method avoids some unnecessary overhead
+ * caused by repeatedly invoking {@link Job#schedule()}.
+ *
+ * @return true
if scheduled, false
otherwise
+ */
+ public boolean scheduleIfNecessary(long delay) {
+ if (isScheduled.compareAndSet(false, true)) {
+ schedule(delay);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRun() {
+ return ge != null;
+ }
+
+ @Override
+ public boolean shouldSchedule() {
+ return ge != null;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ isScheduled.set(false);
+ GraphExplorerImplBase ge = this.ge;
+ return (ge != null) ? ge.setPendingImages(monitor) : Status.CANCEL_STATUS;
+ } finally {
+ monitor.done();
+ }
+ }
+
+ public void dispose() {
+ ge = null;
+ }
}
\ No newline at end of file