Java 类org.eclipse.core.resources.IFileState 实例源码

项目:gama    文件:ShowLocalHistory.java   
protected IFileState[] getLocalHistory() {
    final IFile file = ResourceManager.getFile(getSelection().getFirstElement());
    IFileState states[] = null;
    try {
        if (file != null)
            states = file.getHistory(null);
    } catch (final CoreException ex) {
        MessageDialog.openError(WorkbenchHelper.getShell(), getPromptTitle(), ex.getMessage());
        return null;
    }

    if (states == null || states.length <= 0) {
        MessageDialog.openInformation(WorkbenchHelper.getShell(), getPromptTitle(),
                TeamUIMessages.ShowLocalHistory_0);
        return states;
    }
    return states;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaTextBufferNode.java   
static final ITypedElement[] buildEditions(ITypedElement target, IFile file) {

        // setup array of editions
        IFileState[] states= null;
        // add available editions
        try {
            states= file.getHistory(null);
        } catch (CoreException ex) {
            JavaPlugin.log(ex);
        }

        int count= 1;
        if (states != null)
            count+= states.length;

        ITypedElement[] editions= new ITypedElement[count];
        editions[0]= new ResourceNode(file);
        if (states != null)
            for (int i= 0; i < states.length; i++)
                editions[i+1]= new HistoryItem(target, states[i]);
        return editions;
    }
项目:Eclipse-Postfix-Code-Completion    文件:JavaHistoryActionImpl.java   
final ITypedElement[] buildEditions(ITypedElement target, IFile file) {

        // setup array of editions
        IFileState[] states= null;
        // add available editions
        try {
            states= file.getHistory(null);
        } catch (CoreException ex) {
            JavaPlugin.log(ex);
        }

        int count= 1;
        if (states != null)
            count+= states.length;

        ITypedElement[] editions= new ITypedElement[count];
        editions[0]= new ResourceNode(file);
        if (states != null)
            for (int i= 0; i < states.length; i++)
                editions[i+1]= new HistoryItem(target, states[i]);
        return editions;
    }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaTextBufferNode.java   
static final ITypedElement[] buildEditions(ITypedElement target, IFile file) {

        // setup array of editions
        IFileState[] states= null;
        // add available editions
        try {
            states= file.getHistory(null);
        } catch (CoreException ex) {
            JavaPlugin.log(ex);
        }

        int count= 1;
        if (states != null)
            count+= states.length;

        ITypedElement[] editions= new ITypedElement[count];
        editions[0]= new ResourceNode(file);
        if (states != null)
            for (int i= 0; i < states.length; i++)
                editions[i+1]= new HistoryItem(target, states[i]);
        return editions;
    }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaHistoryActionImpl.java   
final ITypedElement[] buildEditions(ITypedElement target, IFile file) {

        // setup array of editions
        IFileState[] states= null;
        // add available editions
        try {
            states= file.getHistory(null);
        } catch (CoreException ex) {
            JavaPlugin.log(ex);
        }

        int count= 1;
        if (states != null)
            count+= states.length;

        ITypedElement[] editions= new ITypedElement[count];
        editions[0]= new ResourceNode(file);
        if (states != null)
            for (int i= 0; i < states.length; i++)
                editions[i+1]= new HistoryItem(target, states[i]);
        return editions;
    }
项目:eclipse-utility    文件:LocalHistoryTableProvider.java   
protected boolean isCurrentEdition(Object element) {
    if (element instanceof IFile) {
        return true;
    }
    if (element instanceof IFileState) {
        return false;
    }
    if (element instanceof LocalFileRevision) {
        LocalFileRevision revision = (LocalFileRevision) element;

        // only current revision has a "real" current file
        if (revision.getFile() != null)
            return true;
    }

    return false;
}
项目:uefi_edk2_wizards_plugin    文件:Edk2ModuleObservablesManager.java   
private static Edk2Module getOldEdk2Module(IResource resource, String workspacePath)
        throws CoreException, FileNotFoundException, IOException {
    Edk2Module oldModule = null;
    IFile infFile = (IFile) resource;
    IFileState[] states = infFile.getHistory(null);

    if(states != null && states.length > 0) {
        IFileState lastState = states[0];
        oldModule = new Edk2Module(resource.getLocation().toString(), workspacePath, lastState.getContents());
    }

    return oldModule;
}
项目:VariantSync    文件:ChangeHandler.java   
/**
 * 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();
    }
}
项目:che    文件:File.java   
@Override
public void setContents(
    IFileState source, boolean force, boolean keepHistory, IProgressMonitor monitor)
    throws CoreException {
  // funnel all operations to central method
  int updateFlags = force ? IResource.FORCE : IResource.NONE;
  updateFlags |= keepHistory ? IResource.KEEP_HISTORY : IResource.NONE;
  setContents(source.getContents(), updateFlags, monitor);
}
项目:che    文件:FileDescription.java   
private IFileState getMatchingFileState(IFileState[] states) {
  for (int i = 0; i < states.length; i++) {
    if (localTimeStamp == states[i].getModificationTime()) {
      return states[i];
    }
  }
  return states[0];
}
项目:che    文件:FileUndoState.java   
/**
 * Get the file state that matches this file description. The local time stamp is used to try to
 * find a matching file state. If none can be found, the most recent copy of the file state is
 * used.
 *
 * @param states file states
 * @return best guess state
 */
private IFileState getMatchingFileState(IFileState[] states) {
  for (int i = 0; i < states.length; i++) {
    if (localTimeStamp == states[i].getModificationTime()) {
      return states[i];
    }
  }
  return states[0];
}
项目:eclipse-utility    文件:LocalHistoryTableProvider.java   
protected long getModificationDate(Object element) {
    IModificationDate md = (IModificationDate)Utils.getAdapter(element, IModificationDate.class);
    if (md != null)
        return md.getModificationDate();
    if (element instanceof IFileState) {
        IFileState fs = (IFileState) element;
        return fs.getModificationTime();
    }
    if (element instanceof IFile) {
        IFile f = (IFile) element;
        return f.getLocalTimeStamp();
    }
    return -1;
}
项目:che    文件:File.java   
@Override
public IFileState[] getHistory(IProgressMonitor iProgressMonitor) throws CoreException {
  throw new UnsupportedOperationException();
}
项目:che    文件:File.java   
@Override
public void setContents(IFileState content, int updateFlags, IProgressMonitor monitor)
    throws CoreException {
  setContents(content.getContents(), updateFlags, monitor);
}
项目:che    文件:FileDescription.java   
public void recordStateFromHistory(IResource resource, IProgressMonitor monitor)
    throws CoreException {
  Assert.isLegal(resource.getType() == IResource.FILE);

  if (location != null) {
    // file is linked, no need to record any history
    return;
  }
  IFileState[] states = ((IFile) resource).getHistory(monitor);
  if (states.length > 0) {
    final IFileState state = getMatchingFileState(states);
    this.fileContentDescription =
        new IFileContentDescription() {
          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.internal.ide.undo.IFileContentDescription#exists()
           */
          public boolean exists() {
            return state.exists();
          }

          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.internal.ide.undo.IFileContentDescription#getContents()
           */
          public InputStream getContents() throws CoreException {
            return state.getContents();
          }

          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.internal.ide.undo.IFileContentDescription#getCharset()
           */
          public String getCharset() throws CoreException {
            return state.getCharset();
          }
        };
  }
}
项目:che    文件:FileUndoState.java   
public void recordStateFromHistory(IResource resource, IProgressMonitor monitor)
    throws CoreException {
  Assert.isLegal(resource.getType() == IResource.FILE);

  if (location != null) {
    // file is linked, no need to record any history
    return;
  }
  IFileState[] states = ((IFile) resource).getHistory(monitor);
  if (states.length > 0) {
    final IFileState state = getMatchingFileState(states);
    this.fileContentDescription =
        new IFileContentDescription() {
          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.internal.ide.undo.IFileContentDescription#exists()
           */
          public boolean exists() {
            return state.exists();
          }

          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.internal.ide.undo.IFileContentDescription#getContents()
           */
          public InputStream getContents() throws CoreException {
            return state.getContents();
          }

          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.internal.ide.undo.IFileContentDescription#getCharset()
           */
          public String getCharset() throws CoreException {
            return state.getCharset();
          }
        };
  }
}
项目:PerformanceHat    文件:AbstractFileDecorator.java   
/**
 * {@inheritDoc}
 */
@Override
public IFileState[] getHistory(final IProgressMonitor monitor) throws CoreException {
  return resource().getHistory(monitor);
}
项目:PerformanceHat    文件:AbstractFileDecorator.java   
/**
 * {@inheritDoc}
 */
@Override
public void setContents(final IFileState source, final boolean force, final boolean keepHistory, final IProgressMonitor monitor) throws CoreException {
  resource().setContents(source, force, keepHistory, monitor);
}
项目:PerformanceHat    文件:AbstractFileDecorator.java   
/**
 * {@inheritDoc}
 */
@Override
public void setContents(final IFileState source, final int updateFlags, final IProgressMonitor monitor) throws CoreException {
  resource().setContents(source, updateFlags, monitor);
}
项目:XPagesExtensionLibrary    文件:TestFile.java   
public IFileState[] getHistory(IProgressMonitor arg0) throws CoreException {
        throw new RuntimeException("not implemented"); //$NON-NLS-1$
//        return null;
    }
项目:XPagesExtensionLibrary    文件:TestFile.java   
public void setContents(IFileState arg0, int arg1, IProgressMonitor arg2) throws CoreException {
    throw new RuntimeException("not implemented"); //$NON-NLS-1$
}
项目:XPagesExtensionLibrary    文件:TestFile.java   
public void setContents(IFileState arg0, boolean arg1, boolean arg2, IProgressMonitor arg3) throws CoreException {
    throw new RuntimeException("not implemented"); //$NON-NLS-1$
}
项目:Pydev    文件:AbstractIFileStub.java   
@Override
public IFileState[] getHistory(IProgressMonitor monitor) throws CoreException {
    throw new RuntimeException("Not implemented");
}
项目:Pydev    文件:AbstractIFileStub.java   
@Override
public void setContents(IFileState source, boolean force, boolean keepHistory, IProgressMonitor monitor)
        throws CoreException {
    throw new RuntimeException("Not implemented");
}
项目:Pydev    文件:AbstractIFileStub.java   
@Override
public void setContents(IFileState source, int updateFlags, IProgressMonitor monitor) throws CoreException {
    throw new RuntimeException("Not implemented");
}