blob: e9ffa77b507e8e224c791d38f9d1ffb6e20e88a7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
/*****************************************************************************
* Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
*
*
* 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:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus (CEA LIST) - Consolidate all hyperlink helper contributions into one tab
* Christian W. Damus - bug 488965
*
*****************************************************************************/
package org.eclipse.papyrus.infra.hyperlink.ui;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.hyperlink.helper.AbstractHyperLinkHelper;
import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
import org.eclipse.swt.widgets.TabFolder;
/**
*
* Each new tab should extends this class
*
*/
public abstract class AbstractHyperLinkTab {
/**
* The id of the tab
*/
private String tabId;
/**
* The HyperLinkHelper for this tab
*/
private AbstractHyperLinkHelper hyperLinkHelper;
/**
* The hyperlink object
*/
private List<HyperLinkObject> hyperlinkObjects;
/**
* The edited element
*/
private EObject element;
/**
*
* Constructor.
*
* @param tabId
* the id of the tab
* @param helper
* the helper for this tab
*/
public AbstractHyperLinkTab(final String tabId, final AbstractHyperLinkHelper helper) {
this.tabId = tabId;
this.hyperLinkHelper = helper;
}
/**
*
* Constructor.
*
*/
public AbstractHyperLinkTab() {
// nothing to do
// used to create the tab from the extension point
}
/**
* Getter for {@link #tabId}
*
* @return
* this{@link #tabId}
*/
public final String getTabId() {
return this.tabId;
}
/**
*
* @param hyperLinkObjectList
*/
public abstract void setInput(final List<HyperLinkObject> hyperLinkObjectList);
/**
*
* @param tabId
* the id of the tab. This parameter can be set only one time!
*/
public void setTabId(String tabId) {
if (this.tabId == null) {
this.tabId = tabId;
}
}
/**
* This method allows to init the parameter of the tab. These parameter can be set only one time!
*
* @param tabFolder
* the TabFolder for this tab
* @param hyperlinkObjects
* the hyperlink objects
* @param element
* the edited element
* @since 2.0
*/
public void init(final TabFolder tabFolder, List<HyperLinkObject> hyperlinkObjects, final EObject element/* , final IHyperLinkShell shell */) {
this.hyperlinkObjects = new ArrayList<>(hyperlinkObjects);
this.element = element;
}
/**
* Getter for {@link #hyperlinkObjects}
*
* @return
* this{@link #hyperlinkObjects}
*/
public List<HyperLinkObject> getHyperlinkObjects() {
return this.hyperlinkObjects;
}
/**
* @since 2.0
*/
protected AbstractHyperLinkHelper getHyperLinkHelper() {
return hyperLinkHelper;
}
/**
* @since 2.0
*/
protected EObject getElement() {
return element;
}
}
|