当前位置: 首页>>代码示例>>Java>>正文


Java IResourceDeltaVisitor类代码示例

本文整理汇总了Java中org.eclipse.core.resources.IResourceDeltaVisitor的典型用法代码示例。如果您正苦于以下问题:Java IResourceDeltaVisitor类的具体用法?Java IResourceDeltaVisitor怎么用?Java IResourceDeltaVisitor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IResourceDeltaVisitor类属于org.eclipse.core.resources包,在下文中一共展示了IResourceDeltaVisitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resourceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:24,代码来源:ImportLocalPathStrategy.java

示例2: resourceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
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();
	}
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:27,代码来源:StatusCacheManager.java

示例3: workspaceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
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));
	}
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:26,代码来源:PlatformHolder.java

示例4: getRootResources

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
private IResource[] getRootResources(IResourceDelta root) {
  final ChangeDescription changeDescription = new ChangeDescription();
  try {
    root.accept(
        new IResourceDeltaVisitor() {
          public boolean visit(IResourceDelta delta) {
            return changeDescription.recordChange(delta);
          }
        });
  } catch (CoreException e) {
    // Shouldn't happen since the ProposedResourceDelta accept doesn't throw an
    // exception and our visitor doesn't either
    Policy.log(IStatus.ERROR, "Internal error", e); // $NON-NLS-1$
  }
  return changeDescription.getRootResources();
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ResourceChangeValidator.java

示例5: getChangedFiles

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
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()]);
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:ResourceChangeChecker.java

示例6: resourceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
public void resourceChanged(IResourceChangeEvent event) {
try {
    event.getDelta().accept(new IResourceDeltaVisitor() {
	public boolean visit(IResourceDelta delta) throws CoreException {
	    if ((delta.getKind() == IResourceDelta.ADDED) && (delta.getResource() instanceof IFile)) {
		IFile mediaFile = (IFile) delta.getResource();
		IFolder resource = MediaRootNode.this.getResource();
		if (mediaFile.getParent().getFullPath().toString().compareTo(resource.getFullPath().toString()) == 0) {
		    addNewMedia(mediaFile);
		}
	    } else if ((delta.getKind() == IResourceDelta.REMOVED) && (delta.getResource() == MediaRootNode.this.getResource())) {
		MediaRootNode.this.getParent().deleteChildren(new INode[] { MediaRootNode.this });
	    }
	    return true;
	}
    });
} catch (CoreException ex) {
    IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex);
    logger.log(status);
}
   }
 
开发者ID:synergynet,项目名称:synergyview,代码行数:22,代码来源:MediaRootNode.java

示例7: resourceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
public void resourceChanged(IResourceChangeEvent event) {
try {
    event.getDelta().accept(new IResourceDeltaVisitor() {
	public boolean visit(IResourceDelta delta) throws CoreException {
	    // IResource affectedResource = delta.getResource();
	    // if (delta.getKind() == IResourceDelta.REMOVED &&
	    // affectedResource instanceof IFile) {
	    // if
	    // (affectedResource.getFullPath().toString().compareTo(MediaNode.this.resource.getFullPath().toString())==0)
	    // {
	    // MediaNode.this.getParent().deleteChildren(new INode[]
	    // {MediaNode.this});
	    // }
	    // }
	    return true;
	}
    });
} catch (CoreException ex) {
    IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex);
    logger.log(status);
}

   }
 
开发者ID:synergynet,项目名称:synergyview,代码行数:24,代码来源:MediaNode.java

示例8: getAddedProjects

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
/**
 * Returns a list of newly added projects.
 * @param resourceDelta
 * @return List of newly added projects.
 */
private List<IProject> getAddedProjects(IResourceDelta resourceDelta){
	final List<IProject> projects = new ArrayList<IProject>();
	try {
		resourceDelta.accept(new IResourceDeltaVisitor() {
			public boolean visit(IResourceDelta delta) throws CoreException {
				if (delta.getKind() == IResourceDelta.ADDED && delta.getResource().getType() == IResource.PROJECT) {
					IProject project = (IProject) delta.getResource();
					projects.add(project);
					return false;
				}
				return delta.getResource().getType() == IResource.ROOT;
			}
		});
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return projects;
}
 
开发者ID:sebastiangoetz,项目名称:slr-toolkit,代码行数:24,代码来源:BibtexEntryView.java

示例9: resourceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
@Override
public void resourceChanged(IResourceChangeEvent event) {
	try {
		IResourceDelta delta = event.getDelta();
		
		CMakeTouchDeltaVisitor touchVisitor = new CMakeTouchDeltaVisitor();
		
		delta.accept(touchVisitor);
		touchVisitor.postProcess();
		
		for(IResourceDeltaVisitor visitor : reusableVisitors) {
			delta.accept(visitor);
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
}
 
开发者ID:USESystemEngineeringBV,项目名称:cmake-eclipse-helper,代码行数:18,代码来源:CMakeProjectResourceChangeListener.java

示例10: resourceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
@Override
public void resourceChanged(@Nullable IResourceChangeEvent event) {
	Preconditions.checkNotNull(event);
	if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
		IResourceDelta delta = event.getDelta();
		
		
		IResourceDeltaVisitor visitor = delta1 -> {
			resources.add(delta1.getResource());
			return true;
		};
		try {
			synchronized (this) {
				visitor.visit(delta);
			}
		} catch (CoreException e) {
			e.printStackTrace();
		}
		Display.getDefault().asyncExec(new Runnable() {
			@Override
			public void run() {
				fireLabelChangedEvent();
			}
		});
	}
}
 
开发者ID:peq,项目名称:rustyeclipse,代码行数:27,代码来源:Decorators.java

示例11: resourceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
@Override
public void resourceChanged(IResourceChangeEvent event) {
    if (event == null || event.getDelta() == null) {
        return;
    }

    try {
        event.getDelta().accept(new IResourceDeltaVisitor() {
            public boolean visit(final IResourceDelta delta) throws CoreException {
                IResource resource = delta.getResource();                    
                if ((resource.getType() & IResource.PROJECT) != 0) {
                    IProject project = (IProject) resource;                        
                    if (project.isOpen()) {                            
                        projectChanged(project);
                        return false;
                    }
                }
                return true;
            }                
        });

    } catch (Throwable t) {
        RoboVMPlugin.log(t);
    }
}
 
开发者ID:robovm,项目名称:robovm-eclipse,代码行数:26,代码来源:RoboVMProjectObserver.java

示例12: handleDelta

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
private void handleDelta(IResourceDelta d) {
    try {
        d.accept(new IResourceDeltaVisitor() {
            @Override
            public boolean visit(IResourceDelta delta) throws CoreException {
                switch (delta.getKind()) {
                    case IResourceDelta.ADDED:
                        return false;
                    case IResourceDelta.REMOVED:
                        IResource res = delta.getResource();
                        if (res instanceof IFile) {
                            Match[] matches = fResult.getMatches(res);
                            fResult.removeMatches(matches);
                        }
                        break;
                    case IResourceDelta.CHANGED:
                        // handle changed resource (remove existing matches and redo search in file).
                        break;
                }
                return true;
            }
        });
    } catch (CoreException e) {
        Log.log(e);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:27,代码来源:SearchResultUpdater.java

示例13: handleDelta

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
private void handleDelta(IResourceDelta d) {
    try {
        d.accept(new IResourceDeltaVisitor() {
            @Override
            public boolean visit(IResourceDelta delta) throws CoreException {
                switch (delta.getKind()) {
                    case IResourceDelta.ADDED:
                        return false;
                    case IResourceDelta.REMOVED:
                        IResource res = delta.getResource();
                        if (res instanceof IFile) {
                            Match[] matches = fResult.getMatches(res);
                            fResult.removeMatches(matches);
                        }
                        break;
                    case IResourceDelta.CHANGED:
                        // handle changed resource
                        break;
                }
                return true;
            }
        });
    } catch (CoreException e) {
        Log.log(e);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:27,代码来源:SearchResultUpdater.java

示例14: resourceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
public void resourceChanged(final IResourceChangeEvent event) {
	try {
		// under special circumstances (e.g. renaming a project) the
		// event.getDelta() can be null. Avoid NPE.
		if (event.getDelta() == null)
			return;

		// collect changed projects. only ecore files and jars in the
		// classpath are relevant
		final Set<IProject> changedProjects = new HashSet<IProject>();
		event.getDelta().accept(new IResourceDeltaVisitor() {
			public boolean visit(final IResourceDelta delta) throws CoreException {
				if ((isEcoreFile(delta.getResource()) || isJarFile(delta.getResource()))
						&& JavaCore.create(delta.getResource().getProject()).isOnClasspath(delta.getResource())) {
					changedProjects.add(delta.getResource().getProject());
				}
				return true;
			}
		});

		analyzeAndRebuildProjects(changedProjects);
	}
	catch (final CoreException e) {
		EmfToolsLog.logError(e);
	}
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:27,代码来源:EmfToolsPlugin.java

示例15: resourceChanged

import org.eclipse.core.resources.IResourceDeltaVisitor; //导入依赖的package包/类
public void resourceChanged(IResourceChangeEvent event) {
	IResourceDeltaVisitor visitor = new IResourceDeltaVisitor() {
       	public boolean visit(IResourceDelta delta) {
       		IResource affected = delta.getResource();
           	if (affected.getType() != IResource.PROJECT) {
           		return true;
           	}
           	if ((delta.getKind() == IResourceDelta.OPEN)|(delta.getKind() == IResourceDelta.REMOVED)) {
           		IProject project = (IProject) affected;
           		models.remove(project.getName());
           	}
              return true;
           }
        };

        try {
		event.getDelta().accept(visitor);
	} catch (CoreException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chrisGerken,项目名称:transformAuthoring,代码行数:22,代码来源:XformAccess.java


注:本文中的org.eclipse.core.resources.IResourceDeltaVisitor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。