private void tryValidateManifest(final IResourceDelta delta) {
final String fullPath = delta.getFullPath().toString();
final URI folderUri = URI.createPlatformResourceURI(fullPath,true);
final IN4JSProject project = core.findProject(folderUri).orNull();
if (null != project && project.exists()) {
final URI manifestLocation = project.getManifestLocation().orNull();
if (null != manifestLocation) {
final IFile manifest = delta.getResource().getProject().getFile(N4MF_MANIFEST);
final ResourceSet resourceSet = core.createResourceSet(Optional.of(project));
final Resource resource = resourceSet.getResource(manifestLocation,true);
final Job job = Job.create("",monitor -> {
validatorExtension.updateValidationMarkers(manifest,resource,ALL,monitor);
return OK_STATUS;
});
job.setPriority(INteraCTIVE);
job.schedule();
}
}
}
private void tryValidateManifestInEditor(final IResourceDelta delta) {
if (isWorkbenchRunning()) {
display.getDefault().asyncExec(() -> {
final IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
if (null != window) {
final IWorkbenchPage page = window.getActivePage();
for (final IEditorReference editorRef : page.getEditorReferences()) {
if (isEditorForResource(editorRef,delta.getResource())) {
final IWorkbenchPart part = editorRef.getPart(true);
if (part instanceof XtextEditor) {
editorCallback.afterSave((XtextEditor) part);
return;
}
}
}
}
});
}
}
项目:n4js
文件:WorkspaceRepositoriesProvider.java
/**
* Handles the given resource delta.
*
* Fires workspace repository changed event if a project was opened/closed or a project was added/removed.
*/
private boolean handleResourceDelta(IResourceDelta delta) {
IResource affectedResource = delta.getResource();
if (affectedResource instanceof IProject) {
// check if kind is CHANGED
if ((delta.getKind() & IResourceDelta.CHANGED) == IResourceDelta.CHANGED) {
// if project was opened/closed
if ((delta.getFlags() & IResourceDelta.OPEN) == IResourceDelta.OPEN) {
fireWorkspaceRepositoriesChanged();
return false;
}
}
// check if kind is ADDED or REMOVED
else if ((delta.getKind() & IResourceDelta.ADDED | IResourceDelta.REMOVED) != 0) {
fireWorkspaceRepositoriesChanged();
return false;
}
}
return true;
}
项目:EclipseMinifyBuilder
文件:MinifyBuilder.java
@Override
protected IProject[] build(int kind,@SuppressWarnings("rawtypes") Map args,IProgressMonitor monitor) throws CoreException {
ProjectScope projectScope = new ProjectScope(getProject());
IEclipsePreferences prefs = projectScope.getNode(BUILDER_ID);
if (kind == FULL_BUILD) {
fullBuild(prefs,monitor);
} else {
IResourceDelta delta = getDelta(getProject());
if (delta == null) {
fullBuild(prefs,monitor);
} else {
incrementalBuild(delta,prefs,monitor);
}
}
return null;
}
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
switch (delta.getKind()) {
case IResourceDelta.ADDED:
updateProjectPluginConfiguration(resource);
checkConsistency(resource);
break;
case IResourceDelta.REMOVED:
updateProjectPluginConfiguration(resource);
checkConsistency(resource);
break;
case IResourceDelta.CHANGED:
updateProjectPluginConfiguration(resource);
checkConsistency(resource);
break;
}
//return true to continue visiting children.
return true;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint,* org.eclipse.core.resources.IMarkerDelta)
*/
public void breakpointChanged(IBreakpoint breakpoint,IMarkerDelta delta) {
if (supportsBreakpoint(breakpoint)) {
try {
final URI uri = ((DSLBreakpoint)breakpoint).getURI();
final IMarker marker = breakpoint.getMarker();
for (Entry<String,Object> entry : delta.getAttributes().entrySet()) {
final Object markerValue = marker.getAttribute(entry.getKey());
final Object deltaValue = entry.getValue();
if ((markerValue != null && !markerValue.equals(deltaValue)) || (deltaValue != null
&& !deltaValue.equals(markerValue))) {
if (delta.getKind() == IResourceDelta.ADDED) {
factory.getDebugger().handleEvent(new ChangeBreakPointRequest(uri,entry.getKey(),(Serializable)deltaValue));
} else {
factory.getDebugger().handleEvent(new ChangeBreakPointRequest(uri,(Serializable)markerValue));
}
}
}
} catch (CoreException e) {
Activator.getDefault().error(e);
}
}
}
项目:eclipse-batch-editor
文件:BatchEditor.java
private boolean isMarkerChangeForThisEditor(IResourceChangeEvent event) {
IResource resource = ResourceUtil.getResource(getEditorinput());
if (resource == null) {
return false;
}
IPath path = resource.getFullPath();
if (path == null) {
return false;
}
IResourceDelta eventDelta = event.getDelta();
if (eventDelta == null) {
return false;
}
IResourceDelta delta = eventDelta.findMember(path);
if (delta == null) {
return false;
}
boolean isMarkerChangeForThisResource = (delta.getFlags() & IResourceDelta.MARKERS) != 0;
return isMarkerChangeForThisResource;
}
项目:neoscada
文件:PreviewEditorImpl.java
protected boolean handleResource ( final IResourceDelta delta )
{
if ( delta.getResource ().getType () != IResource.FILE )
{
return true;
}
if ( delta.getFlags () == IResourceDelta.MARKERS )
{
return false;
}
final URI uri = URI.createPlatformResourceURI ( delta.getFullPath ().toString (),true );
if ( !this.loadedUris.contains ( uri ) )
{
return true;
}
fireResourceChange ();
return true;
}
项目:eclipse-bash-editor
文件:BashEditor.java
private boolean isMarkerChangeForThisEditor(IResourceChangeEvent event) {
IResource resource = ResourceUtil.getResource(getEditorinput());
if (resource == null) {
return false;
}
IPath path = resource.getFullPath();
if (path == null) {
return false;
}
IResourceDelta eventDelta = event.getDelta();
if (eventDelta == null) {
return false;
}
IResourceDelta delta = eventDelta.findMember(path);
if (delta == null) {
return false;
}
boolean isMarkerChangeForThisResource = (delta.getFlags() & IResourceDelta.MARKERS) != 0;
return isMarkerChangeForThisResource;
}
项目:Equella
文件:WorkspaceJarModelManager.java
@Override
protected void handleFileDelta(IResourceDelta delta)
{
IFile file = (IFile) delta.getResource();
JarPluginModelImpl existing = jarModels.get(file);
if( delta.getKind() == IResourceDelta.REMOVED && existing != null )
{
removeJar(existing);
}
else if( delta.getKind() == IResourceDelta.ADDED )
{
if( isPluginJar(file) )
{
addJarModel(fModels.get(file.getProject()),file,true);
}
}
else if( delta.getKind() == IResourceDelta.CHANGED && existing != null )
{
existing.reload();
addChange(existing,IModelProviderEvent.MODELS_CHANGED);
}
}
项目:Equella
文件:JPFManifestBuilder.java
@Override
public boolean visit(IResourceDelta delta) throws CoreException
{
IResource resource = delta.getResource();
if( resource.isDerived() )
{
return false;
}
if( resource.getType() == IResource.FILE )
{
IFile file = (IFile) resource;
IProject project = resource.getProject();
if( file.equals(JPFProject.getManifest(project)) )
{
manifestChanged = true;
return false;
}
}
return true;
}
项目:gw4e.project
文件:GW4EBuilder.java
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
if (!PreferenceManager.isBuildEnabled(resource.getProject().getName())) {
if (resource instanceof IFile) {
deleteMarkers((IFile)resource);
}
return true;
}
switch (delta.getKind()) {
case IResourceDelta.ADDED:
checkResource(resource);
break;
case IResourceDelta.REMOVED:
checkRemovedResource(resource);
break;
case IResourceDelta.CHANGED:
checkResource(resource);
break;
}
// return true to continue visiting children.
return true;
}
项目:gw4e.project
文件:GW4EBuilder.java
protected IProject[] build(int kind,IProgressMonitor monitor)
throws CoreException {
ResourceManager.logInfo(getProject().getName(),"Build requested " );
if (kind == FULL_BUILD) {
fullBuild(monitor);
} else {
IResourceDelta delta = getDelta(getProject());
if (delta == null) {
fullBuild(monitor);
} else {
incrementalBuild(delta,monitor);
}
}
return null;
}
项目:pgcodekeeper
文件:ProjectEditorDiffer.java
private void handleChangeProject(IResourceDelta rootDelta) {
final boolean[] schemaChanged = new boolean[1];
try {
rootDelta.accept(delta -> {
if (schemaChanged[0]) {
return false;
}
// something other than just markers has changed
// check that it's our resource
if (delta.getFlags() != IResourceDelta.MARKERS &&
PgUIDumpLoader.isInProject(delta) &&
delta.getResource().getType() == IResource.FILE &&
delta.getResource().getProject().equals(proj.getProject())) {
schemaChanged[0] = true;
return false;
}
return true;
});
} catch (CoreException ex) {
Log.log(ex);
}
if (schemaChanged[0]) {
Uisync.exec(parent,this::notifyProjectChanged);
}
}
项目:pgcodekeeper
文件:ProjectBuilder.java
private void buildIncrement(IResourceDelta delta,PgDbParser parser,IProgressMonitor monitor)
throws CoreException,InterruptedException,IOException {
List<IFile> files = new ArrayList<>();
delta.accept(d -> {
if (PgUIDumpLoader.isInProject(d)) {
IResource res = d.getResource();
if (res.getType() == IResource.FILE) {
switch (d.getKind()) {
case IResourceDelta.REMOVED:
case IResourceDelta.REMOVED_PHANTOM:
parser.removePathFromrefs(res.getLocation().toOsstring());
break;
default:
files.add((IFile) res);
break;
}
}
}
return true;
});
parser.getobjFromProjFiles(files,monitor);
}
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
if (resource == null) {
return false;
}
switch (resource.getType()) {
case IResource.ROOT:
case IResource.PROJECT:
case IResource.FOLDER:
return true;
case IResource.FILE:
IFile file = (IFile) resource;
if (EditorConfigConstants.EDITORCONfig.equals(file.getName())
&& delta.getKind() == IResourceDelta.CHANGED) {
entries.remove(new FileResource(file));
}
}
return false;
}
@Override
public void resourceChanged(IResourceChangeEvent event) {
if ((event.getDelta().getFlags() ^ IResourceDelta.MARKERS) != 0) {
try {
event.getDelta().accept(delta -> {
if (delta.getResource().equals(this.resource)) {
viewer.getControl().getdisplay().asyncExec(() -> {
if (viewer instanceof StructuredViewer) {
viewer.refresh(true);
}
});
}
return delta.getResource().getFullPath().isPrefixOf(this.resource.getFullPath());
});
} catch (CoreException e) {
// LanguageServerPlugin.logError(e);
}
}
}
项目:visuflow-plugin
文件:JimpleBuilder.java
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
if (resource.getFileExtension() != null){
switch (delta.getKind()) {
case IResourceDelta.ADDED:
if(resource.getFileExtension().equals("java")){
executeBuild = true;
return false;
}
break;
case IResourceDelta.REMOVED:
if(resource.getFileExtension().equals("java")){
executeBuild = true;
return false;
}
break;
case IResourceDelta.CHANGED:
if( resource.getFileExtension().equals("java")){
executeBuild = true;
return false;
}
break;
}
}
return true;
}
项目:visuflow-plugin
文件:JimpleBuilder.java
@Override
protected IProject[] build(int kind,Map<String,String> args,IProgressMonitor monitor) throws CoreException {
executeBuild = false;
if(getProject() != null && getProject().getName().equals(GlobalSettings.get("AnalysisProject"))){
if (kind == FULL_BUILD) {
fullBuild(monitor);
} else {
IResourceDelta delta = getDelta(getProject());
if (delta == null) {
fullBuild(monitor);
} else {
checkForBuild(delta,monitor);
}
}
}
return null;
}
项目:egradle
文件:AbstractGroovyBasedEditor.java
private boolean isMarkerChangeForThisEditor(IResourceChangeEvent event) {
IResource resource = ResourceUtil.getResource(getEditorinput());
if (resource == null) {
return false;
}
IPath path = resource.getFullPath();
if (path == null) {
return false;
}
IResourceDelta eventDelta = event.getDelta();
if (eventDelta == null) {
return false;
}
IResourceDelta delta = eventDelta.findMember(path);
if (delta == null) {
return false;
}
boolean isMarkerChangeForThisResource = (delta.getFlags() & IResourceDelta.MARKERS) != 0;
return isMarkerChangeForThisResource;
}
项目:egradle
文件:VirtualRootNewFilesToRealRootProjectBuilder.java
@Override
protected IProject[] build(int kind,IProgressMonitor monitor) throws CoreException {
IProject project = getProject();
if (!project.isopen()) {
return null;
}
if (!(project.hasNature(VirtualRootProjectNature.NATURE_ID))) {
return null;
}
File projectOnRealFileSystem = project.getLocation().toFile();
File rootProjectFolder = projectOnRealFileSystem.getParentFile();
if (kind == FULL_BUILD) {
fullBuild(rootProjectFolder,monitor);
} else {
IResourceDelta delta = getDelta(project);
if (delta == null) {
fullBuild(rootProjectFolder,monitor);
} else {
incrementalBuild(rootProjectFolder,delta,monitor);
}
}
return null;
}
public static void incrementalBuild(IProject project,IResourceDelta delta,IProgressMonitor monitor) throws CoreException,IOException {
asciidocConfiguration configuration = asciidocConfiguration.getConfiguration(project);
if (delta == null) {
fullBuild(project,monitor);
return;
}
IFolder resourcesFolder = project.getFolder(new Path(configuration.getResourcesPath()));
IFolder sourcesFolder = project.getFolder(new Path(configuration.getSourcesPath()));
IFolder targetFolder = project.getFolder(new Path(configuration.getTargetPath()));
monitor.subTask("Locating resources to process...");
asciidocResourceVisitor visitor = new asciidocResourceVisitor(sourcesFolder,resourcesFolder);
delta.accept(visitor);
copy(resourcesFolder,visitor.getResourceFiles(),targetFolder,monitor);
generate(sourcesFolder,visitor.getSourceFiles(),configuration,monitor);
monitor.subTask("Refreshing target folder...");
}
@Override
protected IProject[] build(int kind,IProgressMonitor monitor) throws CoreException {
if (kind == IncrementalProjectBuilder.FULL_BUILD) {
fullBuild(monitor);
} else {
IResourceDelta delta = getDelta(getProject());
if (delta == null) {
fullBuild(monitor);
} else {
incrementalBuild(delta,monitor);
}
}
return null;
}
项目:team-explorer-everywhere
文件:ImportLocalPathStrategy.java
@Override
public void resourceChanged(final IResourceChangeEvent event) {
try {
event.getDelta().accept(new IResourceDeltaVisitor() {
@Override
public boolean visit(final IResourceDelta delta) throws CoreException {
if (delta.getKind() == IResourceDelta.ADDED) {
final IResource resource = delta.getResource();
if (resource.getType() == IResource.PROJECT) {
newProject = (IProject) resource;
} else if (resource.getType() == IResource.FILE
&& PluginResourceFilters.STANDARD_FILTER.filter(
resource) == ResourceFilterResult.ACCEPT) {
filepaths.add(resource.getLocation().toOsstring());
}
}
return true;
}
});
} catch (final CoreException e) {
throw new RuntimeException(e);
}
}
项目:subclipse
文件:StatusCacheManager.java
public void resourceChanged(IResourceChangeEvent event) {
flushCache = false;
try {
event.getDelta().accept(new IResourceDeltaVisitor() {
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
if (resource.getType()==IResource.PROJECT) {
IProject project = (IProject)resource;
if (!project.isAccessible()) {
return false; // i.e.,closed project
}
if (SVNWorkspaceRoot.isManagedBySubclipse(project)) {
flushCache = true;
}
return false; // No need to check deeper than project.
}
return true;
}
});
} catch (CoreException e) {
SVNProviderPlugin.log(e.getStatus());
}
if (flushCache) {
statusCache.flushPendingStatuses();
}
}
项目:subclipse
文件:SyncFilechangelistener.java
protected void handleSVNDir(IContainer svnDir,int kind) {
if((kind & IResourceDelta.ALL_WITH_PHANTOMS)!=0) {
if(kind==IResourceDelta.ADDED) {
// should this dir be made team-private? If it contains Entries then yes!
IFile entriesFile = svnDir.getFile(new Path(SVNConstants.SVN_ENTRIES));
if (entriesFile.exists() && !svnDir.isTeamPrivateMember()) {
try {
svnDir.setTeamPrivateMember(true);
if(Policy.DEBUG_MetaFILE_CHANGES) {
System.out.println("[svn] found a new SVN Meta folder,marking as team-private: " + svnDir.getFullPath()); //$NON-NLS-1$
}
} catch(CoreException e) {
SVNProviderPlugin.log(SVNException.wrapException(svnDir,Policy.bind("SyncFilechangelistener.errorSettingTeamPrivateFlag"),e)); //$NON-NLS-1$
}
}
}
}
}
项目:Vitruv
文件:VitruviusEmfBuilder.java
@Override
public boolean visit(final IResourceDelta delta) throws CoreException {
final IResource iResource = delta.getResource();
final String fileExtension = iResource.getFileExtension();
final boolean isMonitoredResource = VitruviusEmfBuilder.this.getMonitoredFileTypes().contains(fileExtension);
if (isMonitoredResource) {
switch (delta.getKind()) {
case IResourceDelta.ADDED:
LOGGER.debug("Importing to Vitruvius: " + iResource);
VitruviusEmfBuilder.this.importToVitruvius(iResource);
break;
case IResourceDelta.REMOVED:
LOGGER.debug("Removing from Vitruvius: " + iResource);
VitruviusEmfBuilder.this.removeFromVitruvius(iResource);
break;
case IResourceDelta.CHANGED:
// LOGGER.debug("Resource changed: " + iResource);
VitruviusEmfBuilder.this.triggerSynchronisation(iResource);
break;
default:
LOGGER.debug("No action for change kind: '" + delta.getKind() + "' executed.");
}
}
// return true to continue visiting children.
return true;
}
项目:Vitruv
文件:VitruviusEmfBuilder.java
@Override
protected IProject[] build(final int kind,final Map<String,final IProgressMonitor monitor)
throws CoreException {
super.build(kind,args,monitor);
if (kind == FULL_BUILD) {
this.fullBuild(monitor);
} else {
final IResourceDelta delta = this.resourceDeltaProviding.getDelta(this.projectProviding.getProject());
if (delta == null) {
this.fullBuild(monitor);
} else {
this.incrementalBuild(delta,monitor);
}
}
return null;
}
项目:hybris-commerce-eclipse-plugin
文件:TsvBuilder.java
@Override
protected IProject[] build(int kind,IProgressMonitor monitor)
throws CoreException {
//Todo find referenced extensions and their eclipse projects and return them
if (kind == CLEAN_BUILD) {
clean(monitor);
}
else if (kind == FULL_BUILD) {
fullBuild(monitor);
} else {
IResourceDelta delta = getDelta(getProject());
if (delta == null) {
fullBuild(monitor);
} else {
incrementalBuild(delta,monitor);
}
}
return null;
}
项目:hybris-commerce-eclipse-plugin
文件:PlatformHolder.java
void workspaceChanged(IResourceChangeEvent event) {
try {
if (event.getType() == IResourceChangeEvent.PRE_DELETE || event.getType() == IResourceChangeEvent.PRE_CLOSE) {
if (Platform.isPlatformProject((IProject)event.getResource())) {
clear();
}
}
else if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
event.getDelta().accept(new IResourceDeltaVisitor() {
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
if (delta.getKind() == IResourceDelta.ADDED
&& delta.getResource().getType() == IResource.PROJECT) {
projectAdded((IProject) delta.getResource());
}
return delta.getResource().getType() == IResource.ROOT;
}
});
}
} catch (CoreException e) {
log.log(new Status(Status.ERROR,log.getBundle().getSymbolicName(),"Error when handling IResourceChangedEvent",e));
}
}
项目:abaplint-eclipse
文件:AbaplintBuilder.java
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
switch (delta.getKind()) {
case IResourceDelta.ADDED:
checkABAP(resource);
break;
case IResourceDelta.REMOVED:
break;
case IResourceDelta.CHANGED:
checkABAP(resource);
break;
default: // do nothing
break;
}
return true;
}
项目:mytourbook
文件:Builder.java
/**
* @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
*/
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
switch (delta.getKind()) {
case IResourceDelta.ADDED:
// handle added resource
System.out.println("RBE DELTA added");
checkBundleResource(resource);
break;
case IResourceDelta.REMOVED:
System.out.println("RBE DELTA Removed"); //$NON-NLS-1$
// handle removed resource
break;
case IResourceDelta.CHANGED:
System.out.println("RBE DELTA changed");
// handle changed resource
checkBundleResource(resource);
break;
}
//return true to continue visiting children.
return true;
}
private void handleResourceChanged(IResourceChangeEvent event) {
IResourceDelta delta = event.getDelta();
if (delta == null) {
return;
}
// Find resourced whose problems changed and report them to listeners
Set<IResource> changedResources = new HashSet<>();
try {
delta.accept(new ProblemmarkerDeltaVisitor(changedResources));
} catch (CoreException e) {
TypeScriptCorePlugin.logError(e);
}
if (!changedResources.isEmpty()) {
notifyListeners(Collections.unmodifiableSet(changedResources));
}
}
项目:typescript.java
文件:TypeScriptBuilder.java
@Override
protected IProject[] build(int kind,final IProgressMonitor monitor)
throws CoreException {
IProject project = this.getProject();
if (!TypeScriptResourceUtil.isTypeScriptProject(project)) {
return null;
}
IIDETypeScriptProject tsProject = TypeScriptResourceUtil.getTypeScriptProject(project);
if (kind == FULL_BUILD) {
fullBuild(tsProject,monitor);
} else {
IResourceDelta delta = getDelta(getProject());
if (delta == null) {
fullBuild(tsProject,monitor);
} else {
incrementalBuild(tsProject,monitor);
}
}
return null;
}
项目:jsbuild-eclipse
文件:NavigatorJSBuildFileContentProvider.java
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
if (resource == null) {
return false;
}
switch (resource.getType()) {
case IResource.ROOT:
case IResource.PROJECT:
case IResource.FOLDER:
return true;
case IResource.FILE:
IFile file = (IFile) delta.getResource();
if (fViewer != null
&& JSBuildFileFactoryManager.findFactoryId(file) != null) {
// refresh the tasks for the Build file (Gruntfile.js,// gulpfile.js) inside the Project Explorer
if (!fViewer.isBusy()) {
fViewer.refresh(file);
}
}
return false;
}
return false;
}
项目:cmake-eclipse-helper
文件:DerivedDeltaVisitor.java
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
switch(resource.getType()) {
case IResource.FOLDER:
case IResource.ROOT:
return true;
case IResource.PROJECT:
return CMakeNature.isCMakeProject((IProject)resource);
default:
break;
}
if(delta.getKind() != IResourceDelta.ADDED) {
return false;
}
IResource parent = resource.getParent();
while(parent.getType() != IResource.PROJECT) {
if(parent.isDerived()) {
listToDerive.add(resource);
return false;
}
}
return false;
}
项目:gama
文件:ImageViewer.java
@Override
public void resourceChanged(final IResourceChangeEvent event) {
final IResourceDelta delta = event.getDelta().findMember(imageFile.getFullPath());
if (delta != null) {
// file deleted -- close the editor
if (delta.getKind() == IResourceDelta.REMOVED) {
final Runnable r = () -> getSite().getPage().closeEditor(ImageViewer.this,false);
getSite().getShell().getdisplay().asyncExec(r);
}
// file changed -- reload image
else if (delta.getKind() == IResourceDelta.CHANGED) {
final int flags = delta.getFlags();
if ((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.LOCAL_CHANGED) != 0) {
startimageLoad();
}
}
}
}
protected void handleSVNDir(IContainer svnDir,e)); //$NON-NLS-1$
}
}
}
}
}
项目:Source
文件:SemanticBaseListener.java
/**
* Process {@link IResourceDelta} with {@link IResourceDelta#CHANGED changed}
* {@link IResourceDelta#getKind() kind}.
*
* @param delta
* the {@link IResourceDelta} with {@link IResourceDelta#CHANGED changed}
* {@link IResourceDelta#getKind() kind}
*/
private void processChangedDelta(IResourceDelta delta) {
if ((delta.getFlags() & IResourceDelta.OPEN) != 0) {
if (delta.getResource().isAccessible()) {
register((IFile)delta.getResource());
} else {
unregister((IFile)delta.getResource());
}
} else if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
// nothing to do here
} else if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) {
if (resourcetoBase.get(delta.getResource()) == null) {
register((IFile)delta.getResource());
}
}
}
项目:che
文件:ResourceChangeChecker.java
IFile[] getChangedFiles() throws CoreException {
IResourceDelta root = fDeltaFactory.getDelta();
final List result = new ArrayList();
root.accept(
new IResourceDeltaVisitor() {
public boolean visit(IResourceDelta delta) throws CoreException {
final IResource resource = delta.getResource();
if (resource.getType() == IResource.FILE) {
final int kind = delta.getKind();
if (isSet(kind,IResourceDelta.CHANGED)) {
result.add(resource);
} else if (isSet(kind,IResourceDelta.ADDED)
&& isSet(delta.getFlags(),IResourceDelta.CONTENT | IResourceDelta.MOVED_FROM)) {
final IFile movedFrom =
resource.getWorkspace().getRoot().getFile(delta.getMovedFromPath());
result.add(movedFrom);
}
}
return true;
}
});
return (IFile[]) result.toArray(new IFile[result.size()]);
}