blob: 229ab753dcd9e12222ee56246b1f51db57f2d253 (
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
|
package org.eclipse.debug.internal.ui;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILauncher;
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
* Stores information required to re-launch a
* previous launch.
*/
public class LaunchHistoryElement {
/**
* The identifier of the launcher used
*/
protected String fLauncherIdentifier= null;
/**
* The memento of the launched element
*/
protected String fMemento= null;
/**
* The launch mode
*/
protected String fMode=null;
/**
* The label of the launch
*/
protected String fLabel=null;
public LaunchHistoryElement(String launcherId, String elementMemento, String mode, String label) {
fLauncherIdentifier = launcherId;
fMemento = elementMemento;
fMode = mode;
fLabel = label;
}
/**
* Returns the identifier of the launcher that was
* invoked.
*/
public String getLauncherIdentifier() {
return fLauncherIdentifier;
}
/**
* Returns the memento of the element that was
* launched.
*/
public String getElementMemento() {
return fMemento;
}
/**
* Returns the mode of the lanuch.
*/
public String getMode() {
return fMode;
}
/**
* Returns the label of the launch
*/
public String getLabel() {
return fLabel;
}
public boolean equals(Object o) {
if (o instanceof LaunchHistoryElement) {
LaunchHistoryElement e= (LaunchHistoryElement)o;
return
getLauncherIdentifier().equals(e.getLauncherIdentifier()) &&
getElementMemento().equals(e.getElementMemento()) &&
getMode().equals(getMode());
}
return false;
}
public ILauncher getLauncher() {
ILauncher[] launchers = DebugPlugin.getDefault().getLaunchManager().getLaunchers();
for (int i = 0; i < launchers.length; i++) {
if (launchers[i].getIdentifier().equals(getLauncherIdentifier())) {
return launchers[i];
}
}
return null;
}
public Object getLaunchElement() {
ILauncher launcher = getLauncher();
if (launcher != null) {
return launcher.getDelegate().getLaunchObject(getElementMemento());
}
return null;
}
}
|