X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fsynchronization%2FThreadingModificationProxy.java;h=74a5b619d60894454a52ba1a0e325d87f466977a;hb=006602e856bbc3e222789cfe00a923b863e3e91b;hp=e047181664599d5a1cdc1a4e311334b48eab9d70;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ThreadingModificationProxy.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ThreadingModificationProxy.java index e04718166..74a5b619d 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ThreadingModificationProxy.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ThreadingModificationProxy.java @@ -1,73 +1,73 @@ -/******************************************************************************* - * 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 - *******************************************************************************/ -package org.simantics.diagram.synchronization; - -import org.simantics.db.WriteGraph; -import org.simantics.utils.threads.IThreadWorkQueue; -import org.simantics.utils.threads.ThreadUtils; - -/** - * @author Tuukka Lehtonen - */ -public class ThreadingModificationProxy extends ModificationAdapter { - private final IModification m; - private final IThreadWorkQueue completionThread; - private final boolean syncCompletion; - - public ThreadingModificationProxy(IModification m, IThreadWorkQueue completionThread, boolean syncCompletion) { - super(m.getPriority()); - this.m = m; - this.completionThread = completionThread; - this.syncCompletion = syncCompletion; - } - @Override - public void completed() { - if (completionThread != null) { - Runnable r = new Runnable() { - @Override - public void run() { - m.completed(); - } - }; - if (syncCompletion) - ThreadUtils.syncExec(completionThread, r); - else - ThreadUtils.asyncExec(completionThread, r); - } else { - m.completed(); - } - } - @Override - public boolean isComplete() { - return m.isComplete(); - } - @Override - public void markComplete() { - m.markComplete(); - } - @Override - public void perform(WriteGraph g) throws Exception { - m.perform(g); - } - @Override - public Throwable getException() { - return m.getException(); - } - @Override - public void setException(Throwable t) { - m.setException(t); - } - @Override - public String toString() { - return getClass().getSimpleName() + "[" + m + "]"; - } +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.simantics.diagram.synchronization; + +import org.simantics.db.WriteGraph; +import org.simantics.utils.threads.IThreadWorkQueue; +import org.simantics.utils.threads.ThreadUtils; + +/** + * @author Tuukka Lehtonen + */ +public class ThreadingModificationProxy extends ModificationAdapter { + private final IModification m; + private final IThreadWorkQueue completionThread; + private final boolean syncCompletion; + + public ThreadingModificationProxy(IModification m, IThreadWorkQueue completionThread, boolean syncCompletion) { + super(m.getPriority()); + this.m = m; + this.completionThread = completionThread; + this.syncCompletion = syncCompletion; + } + @Override + public void completed() { + if (completionThread != null) { + Runnable r = new Runnable() { + @Override + public void run() { + m.completed(); + } + }; + if (syncCompletion) + ThreadUtils.syncExec(completionThread, r); + else + ThreadUtils.asyncExec(completionThread, r); + } else { + m.completed(); + } + } + @Override + public boolean isComplete() { + return m.isComplete(); + } + @Override + public void markComplete() { + m.markComplete(); + } + @Override + public void perform(WriteGraph g) throws Exception { + m.perform(g); + } + @Override + public Throwable getException() { + return m.getException(); + } + @Override + public void setException(Throwable t) { + m.setException(t); + } + @Override + public String toString() { + return getClass().getSimpleName() + "[" + m + "]"; + } } \ No newline at end of file