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=2d2faa8fa89c174e70dc5bd63fb5d56acc1925c1;hp=5f5d26b3ab8a32b7b8d636ba2d42f94d062d9ae0;hpb=86e91ef31d25e4d5950cae130754846d15119c61;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