KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > terracotta > dso > actions > TransientFieldAction


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package org.terracotta.dso.actions;
5
6 import org.eclipse.jdt.core.IField;
7 import org.terracotta.dso.ConfigurationHelper;
8
9 /**
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     }
38     else {
39       helper.ensureNotTransient(m_field);
40     }
41
42     inspectCompilationUnit();
43   }
44 }
45
Popular Tags