1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.diagram.symbollibrary;
\r
14 import org.eclipse.core.runtime.IAdaptable;
\r
15 import org.simantics.db.procedure.Listener;
\r
16 import org.simantics.g2d.element.ElementClass;
\r
17 import org.simantics.g2d.element.handler.StaticSymbol;
\r
18 import org.simantics.utils.datastructures.cache.ProvisionException;
\r
19 import org.simantics.utils.datastructures.hints.IHintContext.Key;
\r
20 import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;
\r
21 import org.simantics.utils.datastructures.hints.IHintObservable;
\r
24 * Represents a single symbol group element.
\r
27 * Implementations must override equals/hashCode.
\r
30 * @author Tuukka Lehtonen
\r
32 public interface ISymbolItem extends IAdaptable {
\r
35 * @return get the symbol group which this symbol item is a part of
\r
37 ISymbolGroup getGroup();
\r
40 * @return the name of this symbol item to be shown to the user
\r
45 * @return a more verbose description of the item, for tooltips etc.
\r
47 String getDescription();
\r
50 * @param hints external hints for element class loading or
\r
51 * <code>null</code> if no hints need to be provided
\r
52 * @return an {@link ElementClass} that must contain at least a
\r
53 * {@link StaticSymbol} handler
\r
54 * @throws ProvisionException if the {@link ElementClass} cannot be
\r
55 * retrieved for some reason
\r
57 ElementClass getElementClass(IHintObservable hints) throws ProvisionException;
\r
60 * Pass a database listener in {@link #getElementClass(IHintObservable)}
\r
61 * hint observable argument using this key to start listening to the changes
\r
62 * in the element class result.
\r
64 public static final Key KEY_ELEMENT_CLASS_LISTENER = new KeyOf(Listener.class, "ELEMENT_CLASS_LISTENER");
\r