01: package org.drools.eclipse.debug.actions;
02:
03: import org.drools.eclipse.DroolsEclipsePlugin;
04: import org.drools.eclipse.DroolsPluginImages;
05: import org.drools.eclipse.debug.DroolsDebugEventHandlerView;
06: import org.eclipse.jface.action.Action;
07: import org.eclipse.jface.action.IAction;
08: import org.eclipse.swt.custom.BusyIndicator;
09:
10: /**
11: * Action to toggle the display of the logical structure of variables
12: * that are shown in the tree.
13: *
14: * @author <a href="mailto:kris_verlaenen@hotmail.com">kris verlaenen </a>
15: */
16: public class ShowLogicalStructureAction extends Action {
17:
18: private DroolsDebugEventHandlerView view;
19:
20: public ShowLogicalStructureAction(DroolsDebugEventHandlerView view) {
21: super (null, IAction.AS_CHECK_BOX);
22: this .view = view;
23: setToolTipText("Show Logical Structure");
24: setImageDescriptor(DroolsPluginImages
25: .getImageDescriptor(DroolsPluginImages.IMG_LOGICAL));
26: setDisabledImageDescriptor(DroolsPluginImages
27: .getImageDescriptor(DroolsPluginImages.IMG_LOGICAL_DISABLED));
28: setId(DroolsEclipsePlugin.getUniqueIdentifier()
29: + ".ShowLogicalStructureAction");
30: }
31:
32: public void run() {
33: valueChanged(isChecked());
34: }
35:
36: private void valueChanged(boolean on) {
37: if (!view.isAvailable()) {
38: return;
39: }
40: view.setShowLogicalStructure(on);
41: BusyIndicator.showWhile(view.getViewer().getControl()
42: .getDisplay(), new Runnable() {
43: public void run() {
44: view.getViewer().refresh();
45: }
46: });
47: }
48: }
|