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.IMethod;
07: import org.terracotta.dso.ConfigurationHelper;
08:
09: /**
10: * Marks the currently selected IMethod as being a distribute method.
11: *
12: * @see org.eclipse.jdt.core.IMethod
13: * @see org.terracotta.dso.ConfigurationHelper.isDistributedMethod
14: * @see org.terracotta.dso.ConfigurationHelper.ensureDistributedMethod
15: * @see org.terracotta.dso.ConfigurationHelper.ensureNotDistributedMethod
16: */
17:
18: public class DistributedMethodAction extends BaseAction {
19: private IMethod m_method;
20:
21: public DistributedMethodAction() {
22: super ("Distributed method", AS_CHECK_BOX);
23: }
24:
25: public void setMethod(IMethod method) {
26: setJavaElement(m_method = method);
27: setChecked(getConfigHelper().isDistributedMethod(method));
28: }
29:
30: public void performAction() {
31: ConfigurationHelper helper = getConfigHelper();
32:
33: if (isChecked()) {
34: helper.ensureDistributedMethod(m_method);
35: } else {
36: helper.ensureLocalMethod(m_method);
37: }
38:
39: inspectCompilationUnit();
40: }
41: }
|