當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。