-/*******************************************************************************\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
-package org.simantics.ui.workbench;\r
-\r
-import java.util.function.Consumer;\r
-import java.util.function.Supplier;\r
-\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.core.runtime.Status;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.simantics.db.procedure.Listener;\r
-import org.simantics.ui.internal.Activator;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class TitleUpdater implements Listener<String> {\r
-\r
- private final Display display;\r
- private final Consumer<String> callback;\r
- private final Supplier<Boolean> disposed;\r
-\r
- public TitleUpdater(Display display, Consumer<String> titleChangedCallback, Supplier<Boolean> disposed) {\r
- this.display = display;\r
- this.callback = titleChangedCallback;\r
- this.disposed = disposed;\r
- }\r
-\r
- @Override\r
- public void execute(final String result) {\r
- display.asyncExec(new Runnable() {\r
- @Override\r
- public void run() {\r
- if (!isDisposed())\r
- callback.accept(result);\r
- }\r
- });\r
- }\r
-\r
- @Override\r
- public boolean isDisposed() {\r
- return disposed.get();\r
- }\r
-\r
- @Override\r
- public void exception(Throwable t) {\r
- Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Title update failed.", t));\r
- }\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
+ *******************************************************************************/
+package org.simantics.ui.workbench;
+
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.widgets.Display;
+import org.simantics.db.procedure.Listener;
+import org.simantics.ui.internal.Activator;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class TitleUpdater implements Listener<String> {
+
+ private final Display display;
+ private final Consumer<String> callback;
+ private final Supplier<Boolean> disposed;
+
+ public TitleUpdater(Display display, Consumer<String> titleChangedCallback, Supplier<Boolean> disposed) {
+ this.display = display;
+ this.callback = titleChangedCallback;
+ this.disposed = disposed;
+ }
+
+ @Override
+ public void execute(final String result) {
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (!isDisposed())
+ callback.accept(result);
+ }
+ });
+ }
+
+ @Override
+ public boolean isDisposed() {
+ return disposed.get();
+ }
+
+ @Override
+ public void exception(Throwable t) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Title update failed.", t));
+ }
+
+}