X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FPartNameListener.java;h=38b05b193037f639eece9effc4b8865af0e7afa4;hb=HEAD;hp=23c5f7b56e6d3f6c1fe438b5e911e62650bb3df7;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/PartNameListener.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/PartNameListener.java index 23c5f7b56..38b05b193 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/PartNameListener.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/PartNameListener.java @@ -1,75 +1,75 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 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.browsing.ui.swt; - - -import java.util.function.Consumer; - -import org.simantics.db.common.procedure.adapter.ListenerSupport; -import org.simantics.db.procedure.Listener; -import org.simantics.utils.ObjectUtils; - -/** - * @author Tuukka Lehtonen - */ -public class PartNameListener extends PartNameProcedure implements Listener { - - private boolean disposed = false; - private ListenerSupport support; - - public PartNameListener(Consumer updateCallback) { - super(updateCallback); - support = null; - } - - public PartNameListener(Consumer updateCallback, ListenerSupport support) { - super(updateCallback); - this.support = support; - } - - @Override - public void exception(Throwable t) { - if (support != null) - support.exception(t); - else - super.exception(t); - } - - public void dispose() { - disposed = true; - } - - @Override - public boolean isDisposed() { - boolean d = disposed || (support != null && support.isDisposed()); - return d; - } - - @Override - public int hashCode() { - return ObjectUtils.hashCode(support) + 31 * ObjectUtils.hashCode(updateCallback); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - PartNameListener other = (PartNameListener) obj; - return ObjectUtils.objectEquals(support, other.support) - && ObjectUtils.objectEquals(updateCallback, other.updateCallback); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2012 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.browsing.ui.swt; + + +import java.util.function.Consumer; + +import org.simantics.db.common.procedure.adapter.ListenerSupport; +import org.simantics.db.procedure.Listener; +import org.simantics.utils.ObjectUtils; + +/** + * @author Tuukka Lehtonen + */ +public class PartNameListener extends PartNameProcedure implements Listener { + + private boolean disposed = false; + private ListenerSupport support; + + public PartNameListener(Consumer updateCallback) { + super(updateCallback); + support = null; + } + + public PartNameListener(Consumer updateCallback, ListenerSupport support) { + super(updateCallback); + this.support = support; + } + + @Override + public void exception(Throwable t) { + if (support != null) + support.exception(t); + else + super.exception(t); + } + + public void dispose() { + disposed = true; + } + + @Override + public boolean isDisposed() { + boolean d = disposed || (support != null && support.isDisposed()); + return d; + } + + @Override + public int hashCode() { + return ObjectUtils.hashCode(support) + 31 * ObjectUtils.hashCode(updateCallback); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PartNameListener other = (PartNameListener) obj; + return ObjectUtils.objectEquals(support, other.support) + && ObjectUtils.objectEquals(updateCallback, other.updateCallback); + } + +}