01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso.actions;
05:
06: import org.eclipse.jdt.core.IJavaElement;
07: import org.eclipse.jdt.core.IType;
08: import org.terracotta.dso.ConfigurationHelper;
09: import org.terracotta.dso.TcPlugin;
10:
11: /**
12: * Marks the currently selected IType as being excluded from instrumentation.
13: *
14: * @see org.eclipse.jdt.core.IType
15: * @see org.terracotta.dso.ConfigurationHelper.isExcluded
16: * @see org.terracotta.dso.ConfigurationHelper.ensureExcluded
17: * @see org.terracotta.dso.ConfigurationHelper.ensureNotExcluded
18: */
19:
20: public class ExcludedTypeAction extends BaseAction {
21: public ExcludedTypeAction() {
22: super ("Excluded", AS_CHECK_BOX);
23: }
24:
25: public void setJavaElement(IJavaElement element) {
26: super .setJavaElement(element);
27:
28: if (element instanceof IType) {
29: IType type = (IType) element;
30: boolean isBootClass = TcPlugin.getDefault().isBootClass(
31: type);
32:
33: setEnabled(!isBootClass);
34: setChecked(!isBootClass
35: && getConfigHelper().isExcluded(type));
36: } else {
37: setChecked(getConfigHelper().isExcluded(element));
38: }
39: }
40:
41: public void performAction() {
42: ConfigurationHelper helper = getConfigHelper();
43:
44: if (isChecked()) {
45: helper.ensureExcluded(m_element);
46: } else {
47: helper.ensureNotExcluded(m_element);
48: }
49:
50: inspectCompilationUnit();
51: }
52: }
|