当前位置: 首页>>代码示例>>Java>>正文


Java IFileState类代码示例

本文整理汇总了Java中org.eclipse.core.resources.IFileState的典型用法代码示例。如果您正苦于以下问题:Java IFileState类的具体用法?Java IFileState怎么用?Java IFileState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IFileState类属于org.eclipse.core.resources包,在下文中一共展示了IFileState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLocalHistory

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
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;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:19,代码来源:ShowLocalHistory.java

示例2: buildEditions

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
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;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:JavaTextBufferNode.java

示例3: buildEditions

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
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;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:JavaHistoryActionImpl.java

示例4: isCurrentEdition

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
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;
}
 
开发者ID:sakim,项目名称:eclipse-utility,代码行数:18,代码来源:LocalHistoryTableProvider.java

示例5: getOldEdk2Module

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
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;
}
 
开发者ID:ffmmjj,项目名称:uefi_edk2_wizards_plugin,代码行数:14,代码来源:Edk2ModuleObservablesManager.java

示例6: handleChangedResource

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
/**
 * 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();
	}
}
 
开发者ID:1Tristan,项目名称:VariantSync,代码行数:35,代码来源:ChangeHandler.java

示例7: setContents

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
@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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:File.java

示例8: getMatchingFileState

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
private IFileState getMatchingFileState(IFileState[] states) {
  for (int i = 0; i < states.length; i++) {
    if (localTimeStamp == states[i].getModificationTime()) {
      return states[i];
    }
  }
  return states[0];
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:FileDescription.java

示例9: getMatchingFileState

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
/**
 * 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];
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:FileUndoState.java

示例10: getModificationDate

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
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;
}
 
开发者ID:sakim,项目名称:eclipse-utility,代码行数:15,代码来源:LocalHistoryTableProvider.java

示例11: getHistory

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
@Override
public IFileState[] getHistory(IProgressMonitor iProgressMonitor) throws CoreException {
  throw new UnsupportedOperationException();
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:File.java

示例12: recordStateFromHistory

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
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();
          }
        };
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:43,代码来源:FileDescription.java

示例13: getHistory

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public IFileState[] getHistory(final IProgressMonitor monitor) throws CoreException {
  return resource().getHistory(monitor);
}
 
开发者ID:sealuzh,项目名称:PerformanceHat,代码行数:8,代码来源:AbstractFileDecorator.java

示例14: setContents

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
/**
 * {@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);
}
 
开发者ID:sealuzh,项目名称:PerformanceHat,代码行数:8,代码来源:AbstractFileDecorator.java

示例15: getHistory

import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
public IFileState[] getHistory(IProgressMonitor arg0) throws CoreException {
        throw new RuntimeException("not implemented"); //$NON-NLS-1$
//        return null;
    }
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:5,代码来源:TestFile.java


注:本文中的org.eclipse.core.resources.IFileState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。