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.AuditView;
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 clear the log.
12: *
13: * @author <a href="mailto:kris_verlaenen@hotmail.com">kris verlaenen </a>
14: */
15: public class DeleteLogAction extends Action {
16:
17: private AuditView view;
18:
19: public DeleteLogAction(AuditView view) {
20: super (null, IAction.AS_PUSH_BUTTON);
21: this .view = view;
22: setToolTipText("Clear Log");
23: setImageDescriptor(DroolsPluginImages
24: .getImageDescriptor(DroolsPluginImages.DELETE_LOG));
25: setDisabledImageDescriptor(DroolsPluginImages
26: .getImageDescriptor(DroolsPluginImages.DELETE_LOG_DISABLED));
27: setId(DroolsEclipsePlugin.getUniqueIdentifier()
28: + ".ClearLogAction");
29: }
30:
31: public void run() {
32: if (!view.isAvailable()) {
33: return;
34: }
35: view.deleteLog();
36: BusyIndicator.showWhile(view.getViewer().getControl()
37: .getDisplay(), new Runnable() {
38: public void run() {
39: view.getViewer().refresh();
40: }
41: });
42: }
43: }
|