KickJava   Java API By Example, From Geeks To Geeks.

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


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 shared root.
11  * Creates a default root name based on the simple name of the
12  * field.
13  *
14  * @see org.eclipse.jdt.core.IField
15  * @see BaseAction
16  * @see org.terracotta.dso.ConfigurationHelper.isRoot
17  * @see org.terracotta.dso.ConfigurationHelper.ensureRoot
18  * @see org.terracotta.dso.ConfigurationHelper.ensureNotRoot
19  */

20
21 public class RootFieldAction extends BaseAction {
22   private IField m_field;
23   
24   public RootFieldAction() {
25     super("Shared root", AS_CHECK_BOX);
26   }
27   
28   public void setField(IField field) {
29     setJavaElement(m_field = field);
30     setChecked(getConfigHelper().isRoot(m_field));
31   }
32   
33   public void performAction() {
34     ConfigurationHelper helper = getConfigHelper();
35           
36     if(isChecked()) {
37       helper.ensureRoot(m_field);
38     }
39     else {
40       helper.ensureNotRoot(m_field);
41     }
42
43     inspectCompilationUnit();
44   }
45 }
46
Popular Tags