blob: 21c73cdb17de6ad4d4bd540950e6ffb67d88f130 (
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
|
/*******************************************************************************
* 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.bindings.internal;
import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.te.launch.core.bindings.interfaces.IOverwritableLaunchBinding;
/**
* Overwritable launch configuration type binding element implementation.
*/
public class OverwritableLaunchBinding extends LaunchBinding implements IOverwritableLaunchBinding {
private String[] overwrites;
/**
* Constructor.
*
* @param id The launch binding id. Must not be <code>null</code>.
* @param overwrites The overwritten launch binding id's or <code>null</code>.
* @param modes The launch modes or <code>null</code>
*/
public OverwritableLaunchBinding(String id, String overwrites, String modes) {
super(id, modes);
if (overwrites != null) {
this.overwrites = overwrites.trim().split("( )*,( )*"); //$NON-NLS-1$
}
else {
this.overwrites = new String[0];
}
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.launch.core.bindings.interfaces.IOverwritableLaunchBinding#overwrites(java.lang.String)
*/
@Override
public boolean overwrites(String id) {
Assert.isNotNull(id);
for (String overwrite : overwrites) {
if (id.equals(overwrite)) {
return true;
}
}
return overwrites.length == 0;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuffer toString = new StringBuffer();
toString.append("OverwriteableLaunchBinding("); //$NON-NLS-1$
toString.append(getId());
toString.append(", launchModes"); //$NON-NLS-1$
toString.append(toString(getModes()));
toString.append(", overwrites"); //$NON-NLS-1$
toString.append(toString(overwrites));
toString.append(")"); //$NON-NLS-1$
return toString.toString();
}
}
|