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.IField;
07: import org.terracotta.dso.ConfigurationHelper;
08:
09: /**
10: * Marks the currently selected field as being a transient field, that is,
11: * one that is not allowed to be part of a shared root hierarchy.
12: *
13: * @see org.eclipse.jdt.core.IField
14: * @see BaseAction
15: * @see org.terracotta.dso.ConfigurationHelper.isTransient
16: * @see org.terracotta.dso.ConfigurationHelper.ensureTransient
17: * @see org.terracotta.dso.ConfigurationHelper.ensureNotTransient
18: */
19:
20: public class TransientFieldAction extends BaseAction {
21: private IField m_field;
22:
23: public TransientFieldAction() {
24: super ("Transient field", AS_CHECK_BOX);
25: }
26:
27: public void setField(IField field) {
28: setJavaElement(m_field = field);
29: setChecked(getConfigHelper().isTransient(m_field));
30: }
31:
32: public void performAction() {
33: ConfigurationHelper helper = getConfigHelper();
34:
35: if (isChecked()) {
36: helper.ensureTransient(m_field);
37: } else {
38: helper.ensureNotTransient(m_field);
39: }
40:
41: inspectCompilationUnit();
42: }
43: }
|