KickJava   Java API By Example, From Geeks To Geeks.

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


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.IJavaElement;
7 import org.terracotta.dso.ConfigurationHelper;
8
9 /**
10  * Mark the currently selected IMethod as being autolocked.
11  *
12  * @see org.terracotta.dso.ConfigurationHelper.isAutolocked
13  * @see org.terracotta.dso.ConfigurationHelper.ensureAutolocked
14  * @see org.terracotta.dso.ConfigurationHelper.ensureNotAutolocked
15  */

16
17 public class AutolockAction extends BaseAction {
18   public AutolockAction() {
19     super("Autolock", AS_CHECK_BOX);
20   }
21   
22   public void setJavaElement(IJavaElement element) {
23     super.setJavaElement(element);
24     setChecked(getConfigHelper().isAutolocked(element));
25   }
26   
27   public void performAction() {
28     ConfigurationHelper helper = getConfigHelper();
29     
30     if(isChecked()) {
31       helper.ensureAutolocked(m_element);
32     }
33     else {
34       helper.ensureNotAutolocked(m_element);
35     }
36
37     inspectCompilationUnit();
38   }
39 }
40
Popular Tags