Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: bb497f719bf2685dd72d700cf059b938f8c9fef3 (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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/*******************************************************************************
 * Copyright (c) 2012 Wind River Systems, Inc. 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:
 * Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.te.launch.core.lm.interfaces;

import org.eclipse.core.runtime.IAdaptable;

/**
 * The launch specification interface describes a common API to handle launch configuration
 * attributes in a generic way. This allow to write compact generic launch configuration handling
 * code without the need to know what exact type of launch configuration it is.
 */
public interface ILaunchSpecification extends IAdaptable {

	/**
	 * Returns the unique launch configuration type id for the launch configuration described by
	 * this launch specification.
	 *
	 * @return The unique launch configuration type id.
	 */
	public String getLaunchConfigurationTypeId();

	/**
	 * Returns the launch mode. @see <code>org.eclipse.debug.core.ILaunchManager</code> for valid id's.
	 *
	 * @return The launch mode.
	 */
	public String getLaunchMode();

	/**
	 * Returns the name proposal for a new generated launch configuration. The name doesn't need to
	 * be unique! Can return <code>null</code>.
	 */
	public String getLaunchConfigName();

	/**
	 * Set the name for a new generated launch configuration.
	 *
	 * @param launchConfigName The name for a new generated launch configuration or <code>null</code>.
	 */
	public void setLaunchConfigName(String launchConfigName);

	/**
	 * Returns the label proposal for the launch action that uses this launch specification. The
	 * label should _NEVER_ start with the launch mode (Run/Debug <label>). Can return <code>null</code>.
	 */
	public String getLaunchActionLabel();

	/**
	 * Set the label for the launch action that uses this launch specification.
	 *
	 * @param launchActionLabel The label for the launch action. Can be <code>null</code>.
	 */
	public void setLaunchActionLabel(String launchActionLabel);

	/**
	 * Add the specified launch configuration attribute value to this specification using the
	 * specified launch configuration attribute key. If the launch specification has been locked,
	 * the method will do nothing. If the specified value is <code>
	 * null</code>, this method has the same effect as <code>removeAttribute(key)</code>.
	 *
	 * @param key The launch configuration attribute key. Must not be <code>null</code>!
	 * @param value The launch configuration attribute value or <code>null</code>.
	 * @param createOnly <code>true</code> if this attribute should only be used for create.
	 */
	public void addAttribute(String key, Object value, boolean createOnly);

	/**
	 * Add the specified launch configuration attribute value to this specification using the
	 * specified launch configuration attribute key. If the launch specification has been locked,
	 * the method will do nothing. If the specified value is <code>
	 * null</code>, this method has the same effect as <code>removeAttribute(key)</code>.
	 *
	 * @param key The launch configuration attribute key. Must not be <code>null</code>!
	 * @param value The launch configuration attribute value or <code>null</code>.
	 */
	public void addAttribute(String key, Object value);

	/**
	 * Checks if the launch configuration attribute with the specified key is known to this launch
	 * specification.
	 *
	 * @param key The launch configuration attribute key. Must not be <code>null</code>!
	 * @return <code>true</code> if the attribute is known, <code>false</code> otherwise.
	 */
	public boolean hasAttribute(String key);

	/**
	 * Removes the launch configuration attribute with the specified key. If the launch
	 * specification has been locked, the method will do nothing
	 *
	 * @param key The launch configuration attribute key. Must not be <code>null</code>!
	 * @return The attribute value stored for the specified key or <code>null</code>.
	 */
	public Object removeAttribute(String key);

	/**
	 * Returns the attribute value for the given attribute key. If the key is not known or the value
	 * is not set, the specified default value will be returned instead.
	 *
	 * @param key The launch configuration attribute key. Must not be <code>null</code>!
	 * @param defaultValue The default value.
	 * @return The launch configuration attribute value or the default value.
	 */
	public Object getAttribute(String key, Object defaultValue);

	/**
	 * Returns the launch attribute the given attribute key. If the key is not known or the value is
	 * not set, <code>null</code> will be returned.
	 *
	 * @param key The launch configuration attribute key. Must not be <code>null</code>!
	 * @return The launch configuration attribute or <code>null</code>.
	 */
	public ILaunchAttribute getAttribute(String key);

	/**
	 * Returns <code>true</code> if the attribute is set and the <code>createOnly</code> flag of the
	 * attribute key is set.
	 *
	 * @param key The launch configuration attribute key. Must not be <code>null</code>!
	 * @return The <code>createOnly</code> flag of the attribute key.
	 */
	public boolean isCreateOnlyAttribute(String key);

	/**
	 * Locks or unlocks the launch specification for modification. If the read only state is set to
	 * <code>true</code>, every modifying method call will return immediately and change nothing!
	 *
	 * @param readOnly <code>true</code> to lock the launch specification, <code>false</code> to unlock.
	 */
	public void setReadOnly(boolean readOnly);

	/**
	 * Returns the current lock state of the launch specification.
	 *
	 * @return <code>true</code> if launch specification is locked, <code>false</code> otherwise.
	 */
	public boolean isReadOnly();

	/**
	 * Remove all known launch attributes from this launch specification. If the launch
	 * specification has been locked, the method will do nothing.
	 */
	public void clear();

	/**
	 * Returns the number of launch attributes known to this launch specification.
	 */
	public int size();

	/**
	 * Returns <code>true</code> if this launch specification does not contain any attribute.
	 */
	public boolean isEmpty();

	/**
	 * Returns an array containing all launch configuration attributes known to this launch
	 * specification.
	 *
	 * @return An array with elements of type <code>ILaunchAttribute</code>. The returned array may
	 *         empty but never <code>null</code>.
	 */
	public ILaunchAttribute[] getAllAttributes();

	/**
	 * Returns <code>true</code> if this launch spec is valid.
	 */
	public boolean isValid();

	/**
	 * Sets the result of a validation. Validation is normally made through launch manager
	 * delegates.
	 *
	 * @param valid <code>true</code> if this launch spec is valid.
	 */
	public void setIsValid(boolean valid);

	/**
	 * Returns the error message when not valid, otherwise <code>null</code>.
	 */
	public String getErrorMessage();

	/**
	 * Sets the error message after validation fails.
	 *
	 * @param errorMessage The error message.
	 */
	public void setErrorMessage(String errorMessage);
}

Back to the top