KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > terracotta > dso > correction > InstrumentDeclaringTypeResolution


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.correction;
5
6 import org.eclipse.core.resources.IMarker;
7 import org.eclipse.core.resources.IProject;
8 import org.eclipse.core.runtime.CoreException;
9 import org.eclipse.core.runtime.IProgressMonitor;
10 import org.eclipse.jdt.core.IJavaElement;
11 import org.eclipse.jdt.core.IType;
12
13 import org.terracotta.dso.ConfigurationHelper;
14 import org.terracotta.dso.TcPlugin;
15
16 public class InstrumentDeclaringTypeResolution extends BaseMarkerResolution {
17   public InstrumentDeclaringTypeResolution(IJavaElement element) {
18     super(element);
19   }
20   
21   public String JavaDoc getLabel() {
22     return "Instrument declaring type";
23   }
24
25   public void run(IProgressMonitor monitor) throws CoreException {
26     IType declaringType = (IType)m_element.getAncestor(IJavaElement.TYPE);
27     IProject project = declaringType.getJavaProject().getProject();
28     ConfigurationHelper configHelper = TcPlugin.getDefault().getConfigurationHelper(project);
29     
30     configHelper.ensureAdaptable(declaringType);
31     m_marker.setAttribute(IMarker.MESSAGE, "Declaring type instrumented");
32     inspectCompilationUnit();
33   }
34 }
35
36
Popular Tags