本文整理匯總了Java中org.eclipse.core.resources.IResourceDelta類的典型用法代碼示例。如果您正苦於以下問題:Java IResourceDelta類的具體用法?Java IResourceDelta怎麽用?Java IResourceDelta使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IResourceDelta類屬於org.eclipse.core.resources包,在下文中一共展示了IResourceDelta類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: tryValidateManifest
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
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();
}
}
}
示例2: tryValidateManifestInEditor
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
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;
}
}
}
}
});
}
}
示例3: handleResourceDelta
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
/**
* 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;
}
示例4: build
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
@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;
}
示例5: visit
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
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;
}
示例6: breakpointChanged
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
/**
* {@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, entry.getKey(),
(Serializable)markerValue));
}
}
}
} catch (CoreException e) {
Activator.getDefault().error(e);
}
}
}
示例7: isMarkerChangeForThisEditor
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
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;
}
示例8: handleResource
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
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;
}
示例9: handleFileDelta
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
@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);
}
}
示例10: visit
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
@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;
}
示例11: visit
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
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;
}
示例12: build
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, 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;
}
示例13: handleChangeProject
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
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);
}
}
示例14: buildIncrement
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
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);
}
示例15: visit
import org.eclipse.core.resources.IResourceDelta; //導入依賴的package包/類
@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;
}