1 /*******************************************************************************
2 * Copyright (c) 2007, 2012 Association for Decentralized Information Management in
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.browsing.ui.swt;
15 import java.util.function.Consumer;
17 import org.simantics.db.common.procedure.adapter.ListenerSupport;
18 import org.simantics.db.procedure.Listener;
19 import org.simantics.utils.ObjectUtils;
22 * @author Tuukka Lehtonen
24 public class PartNameListener extends PartNameProcedure implements Listener<String> {
26 private boolean disposed = false;
27 private ListenerSupport support;
29 public PartNameListener(Consumer<String> updateCallback) {
30 super(updateCallback);
34 public PartNameListener(Consumer<String> updateCallback, ListenerSupport support) {
35 super(updateCallback);
36 this.support = support;
40 public void exception(Throwable t) {
47 public void dispose() {
52 public boolean isDisposed() {
53 boolean d = disposed || (support != null && support.isDisposed());
58 public int hashCode() {
59 return ObjectUtils.hashCode(support) + 31 * ObjectUtils.hashCode(updateCallback);
63 public boolean equals(Object obj) {
68 if (getClass() != obj.getClass())
70 PartNameListener other = (PartNameListener) obj;
71 return ObjectUtils.objectEquals(support, other.support)
72 && ObjectUtils.objectEquals(updateCallback, other.updateCallback);