本文整理匯總了Java中org.eclipse.core.resources.IResourceDelta.CONTENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java IResourceDelta.CONTENT屬性的具體用法?Java IResourceDelta.CONTENT怎麽用?Java IResourceDelta.CONTENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.core.resources.IResourceDelta
的用法示例。
在下文中一共展示了IResourceDelta.CONTENT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleChangeDelta
/**
* Update the view for the given resource delta. The delta is a resource
* delta for the given build file in the view
*
* @param delta
* a delta for a build file in the view
* @param project
* the project node that has changed
*/
private void handleChangeDelta(IResourceDelta delta,
final IJSBuildFile project) {
IResource resource = delta.getResource();
if (resource.getType() != IResource.FILE) {
return;
}
if (delta.getKind() == IResourceDelta.REMOVED) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
removeProject(project);
}
});
} else if (delta.getKind() == IResourceDelta.CHANGED
&& (delta.getFlags() & IResourceDelta.CONTENT) != 0) {
handleBuildFileChanged(project);
}
}
示例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());
}
}
}
示例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;
}
示例4: handleFileDelta
@Override
protected void handleFileDelta(IResourceDelta delta) {
IFile file = (IFile) delta.getResource();
IProject project = file.getProject();
if (ProductSupport.isProductFile(file)) {
Object model = getSingleModel(file);
int kind = delta.getKind();
if (kind == IResourceDelta.REMOVED && model != null) {
removeSingleModel(project, model);
} else if (kind == IResourceDelta.ADDED && model == null) {
createSingleModel(project, file, true);
} else if (kind == IResourceDelta.CHANGED && (IResourceDelta.CONTENT & delta.getFlags()) != 0) {
loadModel((IProductModel) model, true);
addChange(model, IModelProviderEvent.MODELS_CHANGED);
}
}
}
示例5: visit
public boolean visit(IResourceDelta delta) throws CoreException
{
IResource resource = delta.getResource();
if (resource instanceof IFile)
{
if (delta.getKind() == IResourceDelta.ADDED
|| (delta.getKind() == IResourceDelta.CHANGED && ((delta.getFlags() & (IResourceDelta.CONTENT | IResourceDelta.ENCODING)) != 0)))
{
updatedFiles.add((IFile) resource);
}
else if (delta.getKind() == IResourceDelta.REMOVED)
{
removedFiles.add((IFile) resource);
}
}
return true;
}
示例6: handleBundleManifestDelta
private void handleBundleManifestDelta(IFile file, IResourceDelta delta)
{
int kind = delta.getKind();
IProject project = file.getProject();
IPluginModel model = getPluginModel(project);
if( kind == IResourceDelta.REMOVED && model != null )
{
removeModel(project);
// switch to legacy plugin structure, if applicable
createModel(project, true);
}
else if( kind == IResourceDelta.ADDED || model == null )
{
createModel(project, true);
}
else if( kind == IResourceDelta.CHANGED && (IResourceDelta.CONTENT & delta.getFlags()) != 0 )
{
boolean wasFragment = model.isFragmentModel();
model.reload();
// Fragment-Host header was added or removed
if( wasFragment != model.isFragmentModel() )
{
removeModel(project);
createModel(project, true);
}
else
{
addChange(model, IModelProviderEvent.MODELS_CHANGED);
}
}
}
示例7: resourceChanged
@Override
public void resourceChanged(IResourceChangeEvent event) {
if (event.getType() != IResourceChangeEvent.POST_CHANGE) {
return;
}
IEditorInput editorInput = this.getEditorInput();
if (!(editorInput instanceof FileEditorInput)) {
return;
}
FileEditorInput fileInput = (FileEditorInput) editorInput;
IFile file = fileInput.getFile();
IResourceDelta candidate = event.getDelta().findMember(file.getFullPath());
if (candidate == null) {
return;
}
/* Changement de contenu. */
if ((candidate.getFlags() & IResourceDelta.CONTENT) == 0) {
return;
}
switch (candidate.getKind()) {
case IResourceDelta.ADDED:
case IResourceDelta.CHANGED:
checkKsp(file);
break;
case IResourceDelta.REMOVED:
default:
break;
}
}
示例8: 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());
}
}
示例9: visit
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) {
if (resource.getType() == IResource.FILE) {
IFile file = (IFile) resource;
changedFiles.add(file);
}
}
return true;
}
示例10: handleChangedResource
/**
* Creates patch for changed resource.
*
* @param res
* changed resource
* @param delta
* resource delta
*/
private void handleChangedResource(IResource res, IResourceDelta delta) {
if (res.getType() == IResource.FILE
&& (delta.getFlags() & IResourceDelta.CONTENT) != 0) {
IFile file = (IFile) res;
IFileState[] states = null;
try {
states = file.getHistory(null);
if (states.length > 0) {
long t = states[0].getModificationTime();
Date d = new Date(t);
LogOperations.logInfo(DateFormat.getDateTimeInstance(
DateFormat.SHORT, DateFormat.SHORT).format(d)
+ "");
deltaOperations.createPatch(res);
update();
}
} catch (CoreException e) {
LogOperations
.logError("File states could not be retrieved.", e);
}
VariantSyncPlugin.getDefault().logMessage(
RESOURCE + res.getFullPath() + " has changed "
+ getFlagTxt(delta.getFlags()));
update();
}
}
示例11: resourceChanged
@Override
public void resourceChanged(IResourceChangeEvent event) {
this.propertyChanged = false;
IResourceDelta fileDelta = event.getDelta().findMember(this.target.getFullPath());
if (fileDelta != null) {
boolean contentChanged = ((fileDelta.getFlags() & IResourceDelta.CONTENT) != 0);
if (fileDelta.getKind() == IResourceDelta.CHANGED && contentChanged) {
this.setChanged(true);
try {
if (DbgActivator.getDefault().getPreferenceStore().getBoolean(PreferenceInitializer.ENABLE_HOT_CODE_REPLACEMENT)) {
char[] newProgram = BfDebugTarget.this.getProcess().getContentsAsString(this.target).toCharArray();
BfDebugTarget.this.getProcess().getInterpreter().replaceProgam(newProgram);
this.setOutofSync(false);
}
else {
this.setOutofSync(true);
}
}
catch (CoreException ex) {
DbgActivator.getDefault().logError("File could not be replaced", ex);
this.setOutofSync(true);
}
}
}
if (this.propertyChanged) {
BfDebugTarget.this.fireChangeEvent(DebugEvent.CONTENT);
}
}
示例12: visit
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
boolean added = false;
switch (delta.getKind()) {
case IResourceDelta.ADDED:
added = true;
case IResourceDelta.CHANGED:
int flags = delta.getFlags();
if (added || (flags & IResourceDelta.CONTENT) != 0) {
IResource res = delta.getResource();
if (!(res instanceof IFile) || res.isDerived()) {
return true;
}
IFile file = (IFile) res;
if (!isMavenProject(file.getProject())) {
return false;
}
if (isAtRoot(file) &&
isPolyglotPom(file)) {
poms.add(file);
}
return false;
}
return true;
default:
break;
}
return false; // visit the children
}
示例13: visit
public boolean visit(IResourceDelta delta) {
if (delta == null || delta.getResource() == null || part == null || part.getEditorInput() == null
|| (((IFileEditorInput) part.getEditorInput()).getFile()) == null)
return true;
if (!delta.getResource().equals((((IFileEditorInput) part.getEditorInput()).getFile())))
return true;
switch (delta.getKind()) {
case IResourceDelta.ADDED:
break;
case IResourceDelta.REMOVED:
if ((IResourceDelta.MOVED_TO & delta.getFlags()) == 0) {
// file removed
UIUtils.getDisplay().asyncExec(new Runnable() {
public void run() {
part.getSite().getPage().closeEditor(part, false);
}
});
} else
changeInput(delta.getMovedToPath());
break;
case IResourceDelta.CHANGED:
if ((delta.getFlags() & IResourceDelta.CONTENT) != 0 || (delta.getFlags() & IResourceDelta.SYNC) != 0
|| (delta.getFlags() & IResourceDelta.REPLACED) != 0)
changeInput(delta.getFullPath());
break;
}
return true;
}
示例14: visit
@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;
}
IFile file = (IFile)resource;
if(".project".equals(file.getName())) {
// we have a project file
if(file.getParent().getType() != IResource.PROJECT) {
// it is a project file not positioned at project level
switch (delta.getFlags()) {
case IResourceDelta.CONTENT:
case IResourceDelta.REPLACED:
launcher.scheduleCopyProjectFiles(file.getProject());
return false;
}
}
}
return true;
}
開發者ID:USESystemEngineeringBV,項目名稱:cmake-eclipse-helper,代碼行數:28,代碼來源:DotProjectFileChangedDeltaVisitor.java
示例15: resourceChanged
/**
* Closes all project files on project close.
*
* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
*/
@Override
public void resourceChanged(final IResourceChangeEvent event) {
if (event.getType() == IResourceChangeEvent.PRE_CLOSE || event.getType() == IResourceChangeEvent.PRE_DELETE) {
WorkbenchHelper.asyncRun(() -> {
final IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
for (final IWorkbenchPage page : pages) {
if (((FileEditorInput) editor.getEditorInput()).getFile().getProject()
.equals(event.getResource())) {
final IEditorPart editorPart = page.findEditor(editor.getEditorInput());
page.closeEditor(editorPart, true);
}
}
});
} else {
final IResourceDelta delta = event.getDelta().findMember(getFileFor(getEditorInput()).getFullPath());
if (delta != null) {
// file deleted -- close the editor
if (delta.getKind() == IResourceDelta.REMOVED) {
final Runnable r = () -> getSite().getPage().closeEditor(MultiPageCSVEditor.this, false);
getSite().getShell().getDisplay().asyncExec(r);
}
// file changed -- reload
else if (delta.getKind() == IResourceDelta.CHANGED) {
final int flags = delta.getFlags();
if ((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.LOCAL_CHANGED) != 0) {
MultiPageCSVEditor.this.updateTableFromTextEditor();
}
}
}
}
}