]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/labelers/LabelerStub.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.browsing.ui.common / src / org / simantics / browsing / ui / common / labelers / LabelerStub.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.browsing.ui.common.labelers;
13
14 import java.util.Map;
15
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.swt.widgets.Event;
18 import org.simantics.browsing.ui.GraphExplorer.ModificationContext;
19 import org.simantics.browsing.ui.NodeContext;
20 import org.simantics.browsing.ui.content.Labeler;
21
22 /**
23  * A stub implementation of Labeler.
24  * 
25  * @author Tuukka Lehtonen
26  */
27 /**
28  * @author Jani Simomaa
29  *
30  */
31 public class LabelerStub implements Labeler {
32
33     protected LabelerContent content = LabelerContent.NO_CONTENT;
34
35     public LabelerStub() {
36     }
37
38     public LabelerStub(LabelerContent content) {
39         if (content == null)
40             throw new NullPointerException(this + " tried to initialize with null content");
41         this.content = content;
42     }
43
44     public void setContent(LabelerContent content) {
45         if (content == null)
46             throw new NullPointerException(this + " tried to set null content");
47         this.content = content;
48     }
49
50     @Override
51     public Map<String, String> getLabels() {
52         return content.labels;
53     }
54
55     @Override
56     public Map<String, String> getRuntimeLabels() {
57         return null;
58     }
59
60     @Override
61     public int getCategory() {
62         return content.category;
63     }
64
65     @Override
66     public Modifier getModifier(ModificationContext context, String key) {
67         return null;
68     }
69
70     @Override
71     public void setListener(LabelerListener listener) {
72     }
73
74     /**
75      * @param event
76      * @param parent
77      * @param nodeContext
78      * @return
79      */
80     public Composite createToolTipContentArea(Event event, Composite parent, NodeContext nodeContext) {
81         return null;
82     }
83
84     /**
85      * @param event
86      * @param nodeContext
87      * @return
88      */
89     public boolean shouldCreateToolTip(Event event, NodeContext nodeContext) {
90         return false;
91     }
92     
93 }