-/*******************************************************************************\r
- * Copyright (c) 2012 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics;\r
-\r
-import org.eclipse.core.runtime.jobs.IJobManager;\r
-import org.eclipse.core.runtime.jobs.Job;\r
-\r
-/**\r
- * An Eclipse job that inherently belongs to the\r
- * {@link Simantics#DATABASE_JOB_FAMILY} job family.\r
- * \r
- * <p>\r
- * Use {@link #inProgress()} to check whether there are currently any\r
- * {@link DatabaseJob}s running in the platform's job manager. Checks should be\r
- * performed if any synchronous database requests must be initiated in the UI\r
- * thread but it is not 100% necessary to return an accurate result right at\r
- * that moment. Performing too much synchronous requests in the UI thread will\r
- * currently inevitably get the UI completely stuck and therefore offloading\r
- * database work to database job worker threads is highly recommended.\r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-public abstract class DatabaseJob extends Job {\r
-\r
- public static final String DATABASE_JOB_FAMILY = "org.simantics.db.inDatabaseJob";\r
-\r
- public DatabaseJob(String name) {\r
- super(name);\r
- }\r
-\r
- @Override\r
- public boolean belongsTo(Object family) {\r
- if (DATABASE_JOB_FAMILY.equals(family))\r
- return true;\r
- return super.belongsTo(family);\r
- }\r
-\r
- public static boolean inProgress() {\r
- IJobManager manager = Job.getJobManager();\r
- Job[] jobs = manager.find(DATABASE_JOB_FAMILY);\r
- for (Job job : jobs)\r
- if (job.getState() == Job.RUNNING)\r
- return true;\r
- return false;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics;
+
+import org.eclipse.core.runtime.jobs.IJobManager;
+import org.eclipse.core.runtime.jobs.Job;
+
+/**
+ * An Eclipse job that inherently belongs to the
+ * {@link Simantics#DATABASE_JOB_FAMILY} job family.
+ *
+ * <p>
+ * Use {@link #inProgress()} to check whether there are currently any
+ * {@link DatabaseJob}s running in the platform's job manager. Checks should be
+ * performed if any synchronous database requests must be initiated in the UI
+ * thread but it is not 100% necessary to return an accurate result right at
+ * that moment. Performing too much synchronous requests in the UI thread will
+ * currently inevitably get the UI completely stuck and therefore offloading
+ * database work to database job worker threads is highly recommended.
+ *
+ * @author Tuukka Lehtonen
+ */
+public abstract class DatabaseJob extends Job {
+
+ public static final String DATABASE_JOB_FAMILY = "org.simantics.db.inDatabaseJob";
+
+ public DatabaseJob(String name) {
+ super(name);
+ }
+
+ @Override
+ public boolean belongsTo(Object family) {
+ if (DATABASE_JOB_FAMILY.equals(family))
+ return true;
+ return super.belongsTo(family);
+ }
+
+ public static boolean inProgress() {
+ IJobManager manager = Job.getJobManager();
+ Job[] jobs = manager.find(DATABASE_JOB_FAMILY);
+ for (Job job : jobs)
+ if (job.getState() == Job.RUNNING)
+ return true;
+ return false;
+ }
+
+}