X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fsymbolcontribution%2FAbstractSymbolProvider.java;h=257768a04629c74916e73b9d39d14544d4a20d84;hb=refs%2Fchanges%2F38%2F238%2F2;hp=efe766a56ac071a187e374e845fc19e13802d1d9;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/AbstractSymbolProvider.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/AbstractSymbolProvider.java index efe766a56..257768a04 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/AbstractSymbolProvider.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/AbstractSymbolProvider.java @@ -1,77 +1,77 @@ -/******************************************************************************* - * 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.symbolcontribution; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.simantics.diagram.symbollibrary.ISymbolGroup; - -public abstract class AbstractSymbolProvider implements ISymbolProvider { - protected volatile boolean disposed = false; - protected Runnable listener; - protected Collection groups = Collections.emptyList(); - private Set groupSet = null; - - public Collection getSymbolGroups() { - return groups; - } - - public void setListener(Runnable listener) { - this.listener = listener; - } - - public void dispose() { - disposed = true; - } - - void setSymbolGroup(Collection groups) { - if (groups == null) - throw new NullPointerException("null groups"); - this.groups = groups; - } - - protected Set getSymbolGroupSet() { - synchronized (this) { - if (groupSet != null) - return groupSet; - groupSet = new HashSet(getSymbolGroups()); - return groupSet; - } - } - - void lockGroups() { - groups = Collections.unmodifiableCollection(groups); - groupSet = null; - getSymbolGroupSet(); - } - - @Override - public int hashCode() { - return getSymbolGroupSet().hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof AbstractSymbolProvider)) - return false; - AbstractSymbolProvider other = (AbstractSymbolProvider) obj; - return getSymbolGroupSet().equals( other.getSymbolGroupSet() ); - } - -} +/******************************************************************************* + * 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.symbolcontribution; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.simantics.diagram.symbollibrary.ISymbolGroup; + +public abstract class AbstractSymbolProvider implements ISymbolProvider { + protected volatile boolean disposed = false; + protected Runnable listener; + protected Collection groups = Collections.emptyList(); + private Set groupSet = null; + + public Collection getSymbolGroups() { + return groups; + } + + public void setListener(Runnable listener) { + this.listener = listener; + } + + public void dispose() { + disposed = true; + } + + void setSymbolGroup(Collection groups) { + if (groups == null) + throw new NullPointerException("null groups"); + this.groups = groups; + } + + protected Set getSymbolGroupSet() { + synchronized (this) { + if (groupSet != null) + return groupSet; + groupSet = new HashSet(getSymbolGroups()); + return groupSet; + } + } + + void lockGroups() { + groups = Collections.unmodifiableCollection(groups); + groupSet = null; + getSymbolGroupSet(); + } + + @Override + public int hashCode() { + return getSymbolGroupSet().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof AbstractSymbolProvider)) + return false; + AbstractSymbolProvider other = (AbstractSymbolProvider) obj; + return getSymbolGroupSet().equals( other.getSymbolGroupSet() ); + } + +}