tmf: Move icon and label text into ITmfProjectModelElement
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / project / model / ITmfProjectModelElement.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2014 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.tmf.ui.project.model;
14
15 import java.net.URI;
16 import java.util.List;
17
18 import org.eclipse.core.resources.IResource;
19 import org.eclipse.core.runtime.IPath;
20 import org.eclipse.swt.graphics.Image;
21
22 /**
23 * The TMF project model interface.
24 *
25 * The TMF tracing project is integrated in the Common Navigator framework.
26 * Each tracing tree element has to implement this interface to be visible in the
27 * Project Explorer.
28 *
29 * @version 1.0
30 * @author Francois Chouinard
31 */
32 public interface ITmfProjectModelElement {
33
34 /**
35 * Returns the name of the project model element.
36 *
37 * @return the name of the project element.
38 */
39 String getName();
40
41 /**
42 * Returns the resource associated with the project model element.
43 *
44 * @return the model resource.
45 */
46 IResource getResource();
47
48 /**
49 * Returns the path of the project model resource.
50 *
51 * @return the resource path.
52 */
53 IPath getPath();
54
55 /**
56 * Returns the URI (location) of the resource.
57 *
58 * @return the resource URI.
59 */
60 URI getLocation();
61
62 /**
63 * Returns the project model element.
64 *
65 * @return the project model element.
66 */
67 TmfProjectElement getProject();
68
69 /**
70 * Returns the parent of this model element.
71 *
72 * @return the parent of this model element.
73 */
74 ITmfProjectModelElement getParent();
75
76 /**
77 * Returns a list of children model elements.
78 *
79 * @return a list of children model elements.
80 */
81 List<ITmfProjectModelElement> getChildren();
82
83 /**
84 * Method to request to refresh the project.
85 */
86 void refresh();
87
88 /**
89 * Returns the icon of this element.
90 *
91 * @return The icon
92 * @since 2.0
93 */
94 Image getIcon();
95
96 /**
97 * Returns the text of the label of this element.
98 *
99 * @return The label text
100 * @since 2.0
101 */
102 default String getLabelText() {
103 return getName();
104 }
105
106 /**
107 * Returns whether this model element has children or not.
108 *
109 * @return <code>true</code> if this model element has children else
110 * <code>false</code>
111 */
112 default boolean hasChildren() {
113 return !getChildren().isEmpty();
114 }
115 }
This page took 0.032947 seconds and 5 git commands to generate.