-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in 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
-/*\r
- *\r
- * @author Toni Kalajainen\r
- */\r
-package org.simantics.utils.threads;\r
-\r
-import java.util.concurrent.Executor;\r
-\r
-\r
-/**\r
- * No thread switching\r
- * \r
- * @Todo Rename to InvokerWorks\r
- */\r
-public class CurrentThread implements IThreadWorkQueue, Executor {\r
-\r
- static CurrentThread INSTANCE = new CurrentThread();\r
- \r
- public static IThreadWorkQueue getThreadAccess()\r
- {\r
- return INSTANCE;\r
- }\r
- \r
- CurrentThread() {}\r
- \r
- @Override\r
- public Thread asyncExec(Runnable runnable) {\r
- runnable.run();\r
- return Thread.currentThread();\r
- }\r
-\r
- @Override\r
- public boolean syncExec(Runnable runnable) {\r
- runnable.run();\r
- return true;\r
- }\r
-\r
- @Override\r
- public boolean currentThreadAccess() {\r
- return true;\r
- }\r
-\r
- @Override\r
- public Thread getThread() {\r
- return Thread.currentThread();\r
- }\r
- \r
- @Override\r
- public String toString() {\r
- return "Current thread";\r
- }\r
-\r
- @Override\r
- public void execute(Runnable command) {\r
- command.run();\r
- }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 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
+ *******************************************************************************/
+/*
+ *
+ * @author Toni Kalajainen
+ */
+package org.simantics.utils.threads;
+
+import java.util.concurrent.Executor;
+
+
+/**
+ * No thread switching
+ *
+ * @Todo Rename to InvokerWorks
+ */
+public class CurrentThread implements IThreadWorkQueue, Executor {
+
+ static CurrentThread INSTANCE = new CurrentThread();
+
+ public static IThreadWorkQueue getThreadAccess()
+ {
+ return INSTANCE;
+ }
+
+ CurrentThread() {}
+
+ @Override
+ public Thread asyncExec(Runnable runnable) {
+ runnable.run();
+ return Thread.currentThread();
+ }
+
+ @Override
+ public boolean syncExec(Runnable runnable) {
+ runnable.run();
+ return true;
+ }
+
+ @Override
+ public boolean currentThreadAccess() {
+ return true;
+ }
+
+ @Override
+ public Thread getThread() {
+ return Thread.currentThread();
+ }
+
+ @Override
+ public String toString() {
+ return "Current thread";
+ }
+
+ @Override
+ public void execute(Runnable command) {
+ command.run();
+ }
+}