use of org.eclipse.jdt.core.IRegion in project che by eclipse.
the class RippleMethodFinder2 method createHierarchyOfDeclarations.
private void createHierarchyOfDeclarations(IProgressMonitor pm, WorkingCopyOwner owner) throws JavaModelException {
IRegion region = JavaCore.newRegion();
for (Iterator<IMethod> iter = fDeclarations.iterator(); iter.hasNext(); ) {
IType declaringType = iter.next().getDeclaringType();
region.add(declaringType);
}
fHierarchy = JavaCore.newTypeHierarchy(region, owner, pm);
}
use of org.eclipse.jdt.core.IRegion in project jop by jop-devel.
the class JOPizer method build.
@Override
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
IProject project = getProject();
if (project == null || !project.isAccessible()) {
return new IProject[0];
}
currentProject = JavaCore.create(project);
// Determine if the Quartus project has changed
String pluginQuartusProject = JOPUIPlugin.getDefault().getPreferenceStore().getString(IJOPLaunchConfigurationConstants.ATTR_QUARTUS_PROJECT);
if (quartusProjectPath == null || !quartusProjectPath.equalsIgnoreCase(pluginQuartusProject)) {
kind = FULL_BUILD;
quartusProjectPath = pluginQuartusProject;
}
String[] buildTypes = new String[] { "0", "1", "2", "3", "4", "5", "FULL_BUILD", "7", "8", "AUTO_BUILD", "INCREMENTAL_BUILD", "11", "12", "13", "14", "CLEAN_BUILD" };
System.err.printf("Build kind: %s%n" + "Args: %s%n", buildTypes[kind], args);
//
if (kind == FULL_BUILD) {
// Build tools-chain
buildToolChain(monitor);
}
Set<IResource> filesToJOPize = new HashSet<IResource>();
IResourceDelta delta = getDelta(getProject());
System.err.printf("Delta: '%s'%n", delta);
if (delta == null) {
IRegion projectRegion = JavaCore.newRegion();
projectRegion.add(currentProject);
filesToJOPize.addAll(Arrays.asList(JavaCore.getGeneratedResources(projectRegion, false)));
} else {
System.err.printf("Affected children: '%s'%n", Arrays.toString(delta.getAffectedChildren()));
IPath outputLocation = currentProject.getOutputLocation();
IPath binLocation = outputLocation.removeFirstSegments(1);
IResourceDelta outputDelta = delta.findMember(binLocation);
// Gather .class files to JOPize
ClassFileVisitor classFileVisitor = new ClassFileVisitor();
outputDelta.accept(classFileVisitor);
Map<Integer, Set<IResource>> updatedClassFiles = classFileVisitor.getClassFiles();
System.err.printf("All: %s%n", updatedClassFiles);
System.err.printf("Changed: %s%n", updatedClassFiles.get(IResourceDelta.CHANGED));
System.err.printf("Added : %s%n", updatedClassFiles.get(IResourceDelta.ADDED));
System.err.printf("Removed: %s%n", updatedClassFiles.get(IResourceDelta.REMOVED));
for (int kindKey : updatedClassFiles.keySet()) {
if (kindKey != IResourceDelta.REMOVED) {
filesToJOPize.addAll(updatedClassFiles.get(kindKey));
}
}
}
if (!filesToJOPize.isEmpty()) {
Iterator<IResource> it = filesToJOPize.iterator();
StringBuilder jopizeArgs = new StringBuilder();
jopizeArgs.append(it.next().getLocation().toOSString());
while (it.hasNext()) {
jopizeArgs.append(' ');
jopizeArgs.append(it.next().getLocation().toOSString());
}
IPath outputDir = currentProject.getOutputLocation();
ILaunchConfiguration jopizeLaunchConfig = createJOPizeLaunchConfiguration("-cp " + getClassesClasspathEntry().getPath().toOSString() + " -o " + "c:\\temp\\test.jop" + " " + jopizeArgs.toString());
System.err.printf(">> %s%n", jopizeLaunchConfig);
System.err.printf(">> %s%n", jopizeLaunchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "---"));
DebugUITools.launch(jopizeLaunchConfig, ILaunchManager.RUN_MODE);
System.err.println("launch");
return new IProject[] { getProject() };
}
return new IProject[0];
}
Aggregations