1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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.diagram.symbollibrary;
14 import org.eclipse.core.runtime.IAdaptable;
15 import org.simantics.db.procedure.Listener;
16 import org.simantics.g2d.element.ElementClass;
17 import org.simantics.g2d.element.handler.StaticSymbol;
18 import org.simantics.utils.datastructures.cache.ProvisionException;
19 import org.simantics.utils.datastructures.hints.IHintContext.Key;
20 import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;
21 import org.simantics.utils.datastructures.hints.IHintObservable;
24 * Represents a single symbol group element.
27 * Implementations must override equals/hashCode.
30 * @author Tuukka Lehtonen
32 public interface ISymbolItem extends IAdaptable {
35 * @return get the symbol group which this symbol item is a part of
37 ISymbolGroup getGroup();
40 * @return the name of this symbol item to be shown to the user
45 * @return a more verbose description of the item, for tooltips etc.
47 String getDescription();
50 * @param hints external hints for element class loading or
51 * <code>null</code> if no hints need to be provided
52 * @return an {@link ElementClass} that must contain at least a
53 * {@link StaticSymbol} handler
54 * @throws ProvisionException if the {@link ElementClass} cannot be
55 * retrieved for some reason
57 ElementClass getElementClass(IHintObservable hints) throws ProvisionException;
60 * Pass a database listener in {@link #getElementClass(IHintObservable)}
61 * hint observable argument using this key to start listening to the changes
62 * in the element class result.
64 public static final Key KEY_ELEMENT_CLASS_LISTENER = new KeyOf(Listener.class, "ELEMENT_CLASS_LISTENER");