Java Code Examples for org.eclipse.core.resources.IResourceChangeEvent#POST_BUILD

The following examples show how to use org.eclipse.core.resources.IResourceChangeEvent#POST_BUILD . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaHotCodeReplaceProvider.java    From java-debug with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void resourceChanged(IResourceChangeEvent event) {
    if (event.getType() == IResourceChangeEvent.POST_BUILD) {
        ChangedClassFilesVisitor visitor = getChangedClassFiles(event);
        if (visitor != null) {
            List<IResource> resources = visitor.getChangedClassFiles();
            List<String> classNames = visitor.getQualifiedNamesList();
            synchronized (this) {
                deltaResources.addAll(resources);
                deltaClassNames.addAll(classNames);
            }
            publishEvent(HotCodeReplaceEvent.EventType.BUILD_COMPLETE, "Build completed.");
        }
    }
}
 
Example 2
Source File: JavaHotCodeReplaceProvider.java    From java-debug with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns the class file visitor after visiting the resource change. The
 * visitor contains the changed class files and qualified type names. Returns
 * <code>null</code> if the visitor encounters an exception, or the delta is not
 * a POST_BUILD.
 */
private ChangedClassFilesVisitor getChangedClassFiles(IResourceChangeEvent event) {
    IResourceDelta delta = event.getDelta();
    if (event.getType() != IResourceChangeEvent.POST_BUILD || delta == null) {
        return null;
    }
    classFilesVisitor.reset();
    try {
        delta.accept(classFilesVisitor);
    } catch (CoreException e) {
        return null; // quiet failure
    }
    return classFilesVisitor;
}
 
Example 3
Source File: DotGraphView.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void resourceChanged(final IResourceChangeEvent event) {
	if (event.getType() != IResourceChangeEvent.POST_BUILD && event
			.getType() != IResourceChangeEvent.POST_CHANGE) {
		return;
	}
	IResourceDelta rootDelta = event.getDelta();
	try {
		rootDelta.accept(resourceVisitor);
	} catch (CoreException e) {
		DotActivatorEx.logError(e);
	}
}
 
Example 4
Source File: SyncGraphvizExportHandler.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void resourceChanged(IResourceChangeEvent event) {
	if (event.getType() != IResourceChangeEvent.POST_BUILD
			&& event.getType() != IResourceChangeEvent.POST_CHANGE) {
		return;
	}
	IResourceDelta rootDelta = event.getDelta();
	try {
		rootDelta.accept(resourceDeltaVisitor);
	} catch (CoreException e) {
		DotActivatorEx.logError(e);
	}
}
 
Example 5
Source File: ResourceChangeListener.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void resourceChanged(IResourceChangeEvent event) {

    boolean postBuild = event.getType() == IResourceChangeEvent.POST_BUILD;
    boolean accepted = false;

    /*
     * gather all marker changes from the delta. be sure to do this in the
     * calling thread, as the delta is destroyed when this method returns
     */
    IMarkerDelta[] markerDeltas = event.findMarkerDeltas(FindBugsMarker.NAME, true);
    for (IMarkerDelta mdelta : markerDeltas) {
        IMarker marker = mdelta.getMarker();
        if (marker == null) {
            continue;
        }
        DeltaInfo deltaInfo = new DeltaInfo(marker, mdelta.getKind());
        if (BugContentProvider.DEBUG) {
            System.out.println("resource change for: " + deltaInfo);
        }

        accepted |= refreshJob.addToQueue(deltaInfo);
    }

    if (!accepted) {
        return;
    }

    if (postBuild) {
        scheduleRefreshJob(SHORT_DELAY);
    } else {
        // After some time do updates anyways
        scheduleRefreshJob(LONG_DELAY);
    }
}
 
Example 6
Source File: FindBugs2Eclipse.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
public FindBugs2Eclipse(IProject project, boolean cacheClassData, Reporter bugReporter) {
    super();
    this.project = project;
    this.cacheClassData = cacheClassData;
    if (cacheClassData) {
        int eventMask = IResourceChangeEvent.POST_BUILD | IResourceChangeEvent.PRE_CLOSE;
        ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceListener, eventMask);
    }
    reporter = bugReporter;
}