use of org.eclipse.core.resources.IResourceDelta in project che by eclipse.
the class TestModelProvider method getActualChildren.
private static IResourceDelta[] getActualChildren(IResourceDelta delta, IResourceDelta[] expectedChildren) {
List result = new ArrayList();
if (!IS_COPY_TEST) {
IResourceDelta[] children = delta.getAffectedChildren();
for (int i = 0; i < children.length; i++) {
IResourceDelta child = children[i];
IResource resource = child.getResource();
if (resource != null && isIgnorable(resource))
continue;
result.add(child);
}
} else {
IResourceDelta[] candidates = delta.getAffectedChildren();
for (int i = 0; i < candidates.length; i++) {
IResourceDelta candidate = candidates[i];
IResource resource = candidate.getResource();
if (resource != null && isIgnorable(resource))
continue;
if (contains(expectedChildren, candidate)) {
result.add(candidate);
} else {
assertCopySource(candidate);
}
}
}
return (IResourceDelta[]) result.toArray(new IResourceDelta[result.size()]);
}
use of org.eclipse.core.resources.IResourceDelta in project che by eclipse.
the class TestModelProvider method getExpectedChildren.
private static IResourceDelta[] getExpectedChildren(IResourceDelta delta) {
List result = new ArrayList();
IResourceDelta[] children = delta.getAffectedChildren();
for (int i = 0; i < children.length; i++) {
IResourceDelta child = children[i];
IResource resource = child.getResource();
if (resource != null && isIgnorable(resource))
continue;
if (child.getAffectedChildren().length > 0) {
result.add(child);
} else {
int flags = child.getFlags();
if (flags == 0 || (flags & PRE_DELTA_FLAGS) != 0) {
result.add(child);
}
}
}
return (IResourceDelta[]) result.toArray(new IResourceDelta[result.size()]);
}
use of org.eclipse.core.resources.IResourceDelta 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];
}
use of org.eclipse.core.resources.IResourceDelta in project dbeaver by serge-rider.
the class ImageEditorPart method resourceChanged.
@Override
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta = event.getDelta();
if (delta == null) {
return;
}
IEditorInput input = getEditorInput();
IPath localPath = null;
if (input instanceof IPathEditorInput) {
localPath = ((IPathEditorInput) input).getPath();
}
if (localPath == null) {
return;
}
localPath = ContentUtils.convertPathToWorkspacePath(localPath);
delta = delta.findMember(localPath);
if (delta == null) {
return;
}
if (delta.getKind() == IResourceDelta.CHANGED) {
// Refresh editor
DBeaverUI.asyncExec(new Runnable() {
@Override
public void run() {
loadImage();
}
});
}
}
use of org.eclipse.core.resources.IResourceDelta in project dbeaver by serge-rider.
the class ContentEditor method resourceChanged.
@Override
public void resourceChanged(IResourceChangeEvent event) {
if (!partsLoaded || saveInProgress) {
// No content change before all parts are loaded
return;
}
IResourceDelta delta = event.getDelta();
if (delta == null) {
return;
}
delta = delta.findMember(ContentUtils.convertPathToWorkspacePath(getEditorInput().getPath()));
if (delta == null) {
return;
}
if (delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.CONTENT) != 0) {
// Content was changed somehow so mark editor as dirty
dirty = true;
DBeaverUI.asyncExec(new Runnable() {
@Override
public void run() {
firePropertyChange(PROP_DIRTY);
}
});
}
}
Aggregations