blob: 2a8ace954d8fde82d40f735abf7cbd99bf3b9913 (
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
|
/*******************************************************************************
* Copyright (c) 2006 IBM Corporation.
* 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:
* IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
*******************************************************************************/
package org.eclipse.linuxtools.internal.systemtap.ui.ide.views;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.IDEPlugin;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.FunctionBrowserAction;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.TapsetLibrary;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ISingleTypedNode;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.tparsers.FunctionParser;
import org.eclipse.linuxtools.systemtap.structures.TreeNode;
import org.eclipse.swt.graphics.Image;
/**
* This class is the Function Tapset Browser, which provides a list of all of the functions
* defined in the tapset library for the user to browse through.
* @author Ryan Morse
* @author Henry Hughes
*/
public class FunctionBrowserView extends TapsetBrowserView {
public static final String ID = "org.eclipse.linuxtools.internal.systemtap.ui.ide.views.FunctionBrowserView"; //$NON-NLS-1$
public FunctionBrowserView() {
super(FunctionParser.getInstance());
}
@Override
protected Image getEntryImage(TreeNode treeObj) {
if (!(treeObj.getData() instanceof ISingleTypedNode)) {
return IDEPlugin.getImageDescriptor("icons/vars/var_unk.gif").createImage(); //$NON-NLS-1$
}
String type = ((ISingleTypedNode) treeObj.getData()).getType();
if (type == null) {
return IDEPlugin.getImageDescriptor("icons/vars/var_void.gif").createImage(); //$NON-NLS-1$
} else if (type.equals("long")) {//$NON-NLS-1$
return IDEPlugin.getImageDescriptor("icons/vars/var_long.gif").createImage(); //$NON-NLS-1$
} else if (type.equals("string")) {//$NON-NLS-1$
return IDEPlugin.getImageDescriptor("icons/vars/var_str.gif").createImage(); //$NON-NLS-1$
} else {
return IDEPlugin.getImageDescriptor("icons/vars/var_unk.gif").createImage(); //$NON-NLS-1$
}
}
@Override
protected void displayContents() {
setViewerInput(TapsetLibrary.getFunctions());
setRefreshable(true);
}
@Override
protected void makeActions() {
doubleClickAction = new FunctionBrowserAction(getSite().getWorkbenchWindow(), this);
viewer.addDoubleClickListener(doubleClickAction);
registerContextMenu("functionPopup"); //$NON-NLS-1$
}
}
|