當前位置: 首頁>>代碼示例>>Java>>正文


Java IResourceDelta.OPEN屬性代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IResourceDelta.OPEN屬性的典型用法代碼示例。如果您正苦於以下問題:Java IResourceDelta.OPEN屬性的具體用法?Java IResourceDelta.OPEN怎麽用?Java IResourceDelta.OPEN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.eclipse.core.resources.IResourceDelta的用法示例。


在下文中一共展示了IResourceDelta.OPEN屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleResourceDelta

/**
 * 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;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:25,代碼來源:WorkspaceRepositoriesProvider.java

示例2: processChangedDelta

/**
 * 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());
		}
	}
}
 
開發者ID:ModelWriter,項目名稱:Source,代碼行數:23,代碼來源:WorkspaceMappingBaseListener.java

示例3: isRelevantResourceChange

/**
 * Given a resource delta, indicate whether or the delta contains a type of
 * resource change that GWT generally cares about.
 */
public static boolean isRelevantResourceChange(IResourceDelta delta) {

  if (delta == null) {
    return false;
  }

  int relevantChanges = IResourceDelta.CONTENT | IResourceDelta.DESCRIPTION
      | IRESOURCEDELTA_LOCAL_CHANGED | IResourceDelta.OPEN
      | IResourceDelta.REPLACED | IResourceDelta.TYPE;
  // Either added or removed (through != CHANGED), or changed in some
  // relevant way (through (.. & relevantChanges) != 0)
  if (delta.getKind() != IResourceDelta.CHANGED
      || (delta.getFlags() & relevantChanges) != 0) {
    return true;
  }

  return false;
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:22,代碼來源:ResourceUtils.java

示例4: resourceChanged

/**
 * Handles a resource changed event by updating the enablement if one of the selected projects is opened or closed.
 */
@Override
public void resourceChanged(final IResourceChangeEvent event) {
	// Warning: code duplicated in CloseResourceAction
	final List<?> sel = getSelectedResources();
	// don't bother looking at delta if selection not applicable
	if (selectionIsOfType(IResource.PROJECT)) {
		final IResourceDelta delta = event.getDelta();
		if (delta != null) {
			final IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
			for (int i = 0; i < projDeltas.length; ++i) {
				final IResourceDelta projDelta = projDeltas[i];
				if ((projDelta.getFlags() & IResourceDelta.OPEN) != 0) {
					if (sel.contains(projDelta.getResource())) {
						selectionChanged(getStructuredSelection());
						return;
					}
				}
			}
		}
	}
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:24,代碼來源:OpenResourceAction.java

示例5: resourceChanged

/**
 * Handles a resource changed event by updating the enablement if one of the selected projects is opened or closed.
 */
@Override
public synchronized void resourceChanged(final IResourceChangeEvent event) {
	// Warning: code duplicated in OpenResourceAction
	final List<? extends IResource> sel = getSelectedResources();
	// don't bother looking at delta if selection not applicable
	if (selectionIsOfType(IResource.PROJECT)) {
		final IResourceDelta delta = event.getDelta();
		if (delta != null) {
			final IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
			for (final IResourceDelta projDelta : projDeltas) {
				if ((projDelta.getFlags() & IResourceDelta.OPEN) != 0) {
					if (sel.contains(projDelta.getResource())) {
						selectionChanged(getStructuredSelection());
						return;
					}
				}
			}
		}
	}
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:23,代碼來源:CloseResourceAction.java

示例6: visit

@Override
public boolean visit(IResourceDelta delta) {
	if (delta == null) {
		return false;
	}
	if (0 != (delta.getFlags() & IResourceDelta.OPEN) && 0 == (delta.getFlags() & IResourceDelta.MOVED_FROM)) {
		handleProjectResourceOpenStateChange(delta.getResource());
		return false;
	}
	return true;
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:11,代碼來源:JimpleBreakpointManager.java

示例7: processChangedDelta

/**
 * 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}
 * @param base
 *            the current {@link IBase}
 */
private void processChangedDelta(IResourceDelta delta, IBase base) {
	if ((delta.getFlags() & IResourceDelta.OPEN) != 0) {
		if (delta.getResource().isAccessible()) {
			updateLocation(base, delta.getResource());
		} else {
			// we can't track changes but the location is still valid for the moment
		}
	} else if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
		// nothing to do here
	} else if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) {
		updateLocation(base, delta.getResource());
	}
}
 
開發者ID:ModelWriter,項目名稱:Source,代碼行數:23,代碼來源:ResourceLocationListener.java

示例8: assertTrue

private static boolean assertTrue(IResourceDelta expected, IResourceDelta actual) {
  assertEqual(expected.getResource(), actual.getResource());
  int actualKind = actual.getKind();
  int actualFlags = actual.getFlags();
  // The real delta can't combine kinds so we remove it from the received one as well.
  if ((actualKind & (IResourceDelta.ADDED | IResourceDelta.REMOVED)) != 0) {
    actualKind = actualKind & ~IResourceDelta.CHANGED;
  }

  // The expected delta doesn't support copy from flag. So remove it
  actualFlags = actualFlags & ~IResourceDelta.COPIED_FROM;

  int expectKind = expected.getKind();
  int expectedFlags = expected.getFlags() & PRE_DELTA_FLAGS;
  if ((expectKind & IResourceDelta.ADDED) != 0
      && (expectedFlags & IResourceDelta.MOVED_FROM) != 0) {
    expectedFlags = expectedFlags & ~IResourceDelta.OPEN;
  }
  if (expectKind != actualKind || expectedFlags != actualFlags) {
    return false;
  }
  IResourceDelta[] expectedChildren = getExpectedChildren(expected);
  IResourceDelta[] actualChildren = getActualChildren(actual, expectedChildren);
  if (expectedChildren.length != actualChildren.length) {
    return false;
  }
  Arrays.sort(expectedChildren, COMPARATOR);
  Arrays.sort(actualChildren, COMPARATOR);
  for (int i = 0; i < expectedChildren.length; i++) {
    boolean res = assertTrue(expectedChildren[i], actualChildren[i]);
    if (!res) {
      Assert.assertEquals(printDelta(expected), printDelta(actual));
    }
  }
  return true;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:36,代碼來源:TestModelProvider.java

示例9: handleRemoved

private void handleRemoved(IResourceDelta delta) {
  if ((delta.getFlags() & IResourceDelta.OPEN) != 0) {
    closedProjects.add(delta.getResource());
  } else if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
    handleMove(delta);
  } else {
    ensureResourceCovered(delta.getResource(), removedRoots);
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:9,代碼來源:ChangeDescription.java

示例10: visit

@Override
public boolean visit(final IResourceDelta delta) {
	final IResource res = delta.getResource();
	boolean update = false;
	switch (delta.getKind()) {
		case IResourceDelta.OPEN:
			if (res.isAccessible())
				update = projectOpened((IProject) res);
			else
				update = projectClosed((IProject) res);
			break;
		case IResourceDelta.ADDED:
			update = processAddition(res);
			break;
		case IResourceDelta.REMOVED:
			update = processRemoval(res);
			break;
		case IResourceDelta.CHANGED:
			final int flags = delta.getFlags();
			if ((flags & IResourceDelta.MARKERS) != 0) {
				update = processMarkersChanged(res);
			} else if ((flags & IResourceDelta.TYPE) != 0) {
				if (DEBUG)
					DEBUG("Resource type changed: " + res);
			} else if ((flags & IResourceDelta.CONTENT) != 0) {
				if (DEBUG)
					DEBUG("Resource contents changed: " + res);
			} else if ((flags & IResourceDelta.SYNC) != 0) {
				if (DEBUG)
					DEBUG("Resource sync info changed: " + res);
			}
			break;
	}
	if (update) {
		updateResource(res);
	}
	return true; // visit the children
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:38,代碼來源:ResourceManager.java

示例11: isRelevantForClean

private static boolean isRelevantForClean(IResourceDelta delta) {
    if ((delta.getResource().getType() & IResource.PROJECT) != 0 && (delta.getFlags() & IResourceDelta.OPEN) != 0) {
        IProject project = delta.getResource().getAdapter(IProject.class);
        return project.isAccessible();
    }

    return false;
}
 
開發者ID:Cooperate-Project,項目名稱:CooperateModelingEnvironment,代碼行數:8,代碼來源:ProjectOpenedListener.java

示例12: isAffectingContainerState

@Override
protected boolean isAffectingContainerState(IResourceDelta delta) {
	if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.REMOVED) {
		String fileExtension = delta.getFullPath().getFileExtension();
		if (null != fileExtension && fileExtensionTypeHelper.isTypable(fileExtension)) {
			return true;
		}
		if (IN4JSProject.N4MF_MANIFEST.equals(delta.getFullPath().lastSegment())) {
			clearManifestCache();
			return true;
		}
		if (IN4JSArchive.NFAR_FILE_EXTENSION.equals(fileExtension)) {
			clearManifestCache(delta);
			return true;
		}
		if (delta.getResource() instanceof IProject) {
			clearManifestCache();
			return true;
		}
		if (delta.getResource() instanceof IFolder) {
			if (isSourceContainerModification(delta)) {
				tryValidateManifest(delta);
				tryValidateManifestInEditor(delta);
				clearManifestCache(delta);
				return true;
			}
		}
		return false;
	} else if (delta.getKind() == IResourceDelta.CHANGED && delta.getResource() instanceof IProject) {
		if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
			return true;
		}
		if ((delta.getFlags() & IResourceDelta.OPEN) != 0) {
			clearManifestCache();
			return true;
		}
		return false;
	}
	if (n4mfFileHasBeenChanged(delta) || nfarHasBeenChanged(delta)) {
		clearManifestCache(delta);
		return true;
	}
	return false;

}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:45,代碼來源:N4JSAllContainersState.java

示例13: visit

@Override
public boolean visit(IResourceDelta delta) throws CoreException
{
	if( delta != null )
	{

		final IResource resource = delta.getResource();
		if( !resource.isDerived() )
		{
			switch( resource.getType() )
			{

			case IResource.ROOT:
				return true;
			case IResource.PROJECT: {
				IProject project = (IProject) resource;
				int kind = delta.getKind();
				int flags = delta.getFlags();
				if( isInterestingProject(project)
					&& (kind == IResourceDelta.ADDED || (flags & IResourceDelta.OPEN) != 0 || (kind == IResourceDelta.CHANGED
						&& (flags & IResourceDelta.DESCRIPTION) != 0 && !isProjectKnown(project))) )
				{
					createModel(project, true);
					return false;
				}
				else if( kind == IResourceDelta.REMOVED )
				{
					removeModel(project);
					return false;
				}
				return true;
			}
			case IResource.FOLDER:
				return isInterestingFolder((IFolder) resource);
			case IResource.FILE:
				// do not process
				if( isContentChange(delta) )
				{
					handleFileDelta(delta);
					return false;
				}
			}
		}
	}
	return false;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:46,代碼來源:WorkspaceModelManager.java

示例14: visit

@Override
public boolean visit(IResourceDelta delta) throws CoreException {
	IResource resource = delta.getResource();
	if (resource == null) {
		return false;
	}
	switch (resource.getType()) {
	case IResource.ROOT:
		return true;
	case IResource.PROJECT:
		IProject project = (IProject) resource;
		if (project.isOpen() && delta.getKind() == IResourceDelta.CHANGED
                   && ((delta.getFlags() & IResourceDelta.OPEN) != 0)) {
			// System.err.println("Open");
		}
		// Continue if project has defined file listeners.
		return fileListeners.containsKey(resource);
	case IResource.FOLDER:
		return true;
	case IResource.FILE:
		IFile file = (IFile) resource;
		synchronized (fileListeners) {
			Map<String, List<IFileWatcherListener>> listenersForFilename = fileListeners.get(file.getProject());
			List<IFileWatcherListener> listeners = listenersForFilename.get(file.getName());
			if (listeners != null) {
				for (IFileWatcherListener listener : listeners) {
					switch (delta.getKind()) {
					case IResourceDelta.ADDED:							
						// handle added resource
						listener.onAdded(file);
						break;
					case IResourceDelta.REMOVED:
						// handle removed resource
						listener.onDeleted(file);
						break;
					default:
						listener.onChanged(file);
					}
				}
			}
		}
		return false;
	}
	return false;
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:45,代碼來源:ResourcesWatcher.java

示例15: visit

/**
 * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
 */
public boolean visit(IResourceDelta delta) throws CoreException {

    IResource source = delta.getResource();
    switch (source.getType()) {
        case IResource.ROOT:
            return true;
        case IResource.PROJECT:
            IProject project = (IProject) source;
            break;
    }

    IResource resource = delta.getResource();
    switch (delta.getKind()) {
        case IResourceDelta.ADDED:
            // handle added resource
            checkXML(resource);
            break;
        case IResourceDelta.REMOVED:
            // handle removed resource
            // 삭제된 경우 상위 폴더 refresh
            if (resource instanceof IFile) {
                final IFile file = (IFile) resource;
                
                if ((UICoreConstant.PROJECT_CONSTANTS__FILE_EXTENSION.equals(file.getFileExtension()) || UICoreConstant.PROJECT_CONSTANTS__FRAGMENT_EXTENSION.equals(file.getFileExtension()))) {
                    Display.getDefault().asyncExec(new Runnable() {
                        /**
                         * @see java.lang.Runnable#run()
                         */
                        public void run() {
                            try {
                                CommonViewer commonViewer = ViewerRegistry.getViewer();
                                ISelection selection = commonViewer.getSelection();
                                if (commonViewer.getControl().isDisposed()) {
                                    return;
                                }
                                TreePath[] expanedTreePaths = TreeItemUtil.getExpandTreePaths(commonViewer.getTree()).clone();

                                if(file != null && file.getParent() != null ) {
                                	commonViewer.refresh(file.getParent());
                                }
                                TreeItemUtil.expandTreePath(expanedTreePaths, selection);
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    });

                    Map<String, ITreeNode> treeNodes = ProjectRegistry.UMLTreeNodeRegistry.getTreeNodes();
                    List<Object> removeTarget = new ArrayList<Object>();
                    for (Iterator<String> iterator = treeNodes.keySet().iterator(); iterator.hasNext();) {
                        String type = (String) iterator.next();
                        URI uri = URI.createURI(file.getFullPath().toString());
                        if (type.indexOf(uri.toString()) > -1) {
                            removeTarget.add(type);
                        }
                    }

                    // ProjectRegistry.UMLTreeNodeRegistry.getTreeNodes()
                    // 에서 관련된 키 삭제
                    for (Object o : removeTarget) {
                        ProjectRegistry.UMLTreeNodeRegistry.removeTreeNode(o);
                    }
                }
            }
            break;
        case IResourceDelta.CHANGED:
            // handle changed resource
            checkXML(resource);
            break;
        case IResourceDelta.OPEN:
            // TODO 닫혀있는 프로젝트를 열었을때 리소스 load 처리( 로그인 했을때와 동일)
            break;
    }
    // return true to continue visiting children.
    return true;
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:79,代碼來源:UMLBuilder.java


注:本文中的org.eclipse.core.resources.IResourceDelta.OPEN屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。