]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/PartNameProcedure.java
Use RuntimeEnvironmentRequest2 where applicable
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / PartNameProcedure.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2012 Association for Decentralized Information Management in
3  * Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.browsing.ui.swt;
13
14 import java.util.function.Consumer;
15
16 import org.simantics.db.procedure.Procedure;
17 import org.simantics.utils.ui.ErrorLogger;
18
19 /**
20  * @author Tuukka Lehtonen
21  */
22 public class PartNameProcedure implements Procedure<String> {
23
24     protected final Consumer<String> updateCallback;
25
26     public PartNameProcedure(Consumer<String> updateCallback) {
27         assert updateCallback != null;
28         this.updateCallback = updateCallback;
29     }
30
31     @Override
32     public void execute(String result) {
33         // System.out.println("part name changed: " + result);
34         updateCallback.accept(result);
35     }
36
37     @Override
38     public void exception(Throwable t) {
39         ErrorLogger.defaultLogError(t);
40     }
41
42 }