org.eclipse.core.resources.IFileState Java Examples

The following examples show how to use org.eclipse.core.resources.IFileState. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShowLocalHistory.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: JavaTextBufferNode.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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;
	}
 
Example #3
Source File: JavaHistoryActionImpl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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;
	}
 
Example #4
Source File: HistoryFs.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IFileStore getStore(URI uri) {
	IFile f = ResourceUtils.getWorkspaceRoot().getFile(new Path(uri.getPath()));
	long time = getTime(uri.getQuery());
	IFileState[] history = null;
	try {
		history = f.getHistory(new NullProgressMonitor());
	} catch (CoreException e) {
		LogHelper.logError(e);
	}
	IFileState fileState = findFileState(history, time);
	HistoryFileStore s = new HistoryFileStore(uri, fileState);
	return s;
}
 
Example #5
Source File: HistoryFs.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private IFileState findFileState(IFileState[] history, long time) {
	for (IFileState s : history) {
		if (s.getModificationTime() == time) {
			return s;
		}
	}
	return null;
}
 
Example #6
Source File: KeepLocalHistoryTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public void assertFileLocalHistory(final String it, final int expectedLocalHistorySize) {
  try {
    Assert.assertEquals(expectedLocalHistorySize, ((List<IFileState>)Conversions.doWrapArray(this.workbenchTestHelper.getFile(it).getHistory(null))).size());
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example #7
Source File: ClientTester.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setContents(IFileState source, boolean force,
		boolean keepHistory, IProgressMonitor monitor)
				throws CoreException {
	// TODO Auto-generated method stub

}
 
Example #8
Source File: FakeIFile.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setContents(IFileState source, boolean force,
		boolean keepHistory, IProgressMonitor monitor)
				throws CoreException {
	// TODO Auto-generated method stub

}
 
Example #9
Source File: AbstractIFileStub.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setContents(IFileState source, int updateFlags, IProgressMonitor monitor) throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
Example #10
Source File: HistoryFileStore.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public HistoryFileStore(URI uri, IFileState fileState) {
	this.fileState = fileState;
	this.uri = uri;
}
 
Example #11
Source File: AbstractIFileStub.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setContents(IFileState source, boolean force, boolean keepHistory, IProgressMonitor monitor)
        throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
Example #12
Source File: AbstractIFileStub.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IFileState[] getHistory(IProgressMonitor monitor) throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
Example #13
Source File: FakeIFile.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setContents(IFileState source, int updateFlags,
		IProgressMonitor monitor) throws CoreException {
	// TODO Auto-generated method stub

}
 
Example #14
Source File: FakeIFile.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IFileState[] getHistory(IProgressMonitor monitor)
		throws CoreException {
	// TODO Auto-generated method stub
	return null;
}
 
Example #15
Source File: ClientTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IFileState[] getHistory(IProgressMonitor monitor)
		throws CoreException {
	// TODO Auto-generated method stub
	return null;
}
 
Example #16
Source File: ClientTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setContents(IFileState source, int updateFlags,
		IProgressMonitor monitor) throws CoreException {
	// TODO Auto-generated method stub

}
 
Example #17
Source File: TestFile.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
public void setContents(IFileState arg0, boolean arg1, boolean arg2, IProgressMonitor arg3) throws CoreException {
    throw new RuntimeException("not implemented"); //$NON-NLS-1$
}
 
Example #18
Source File: TestFile.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
public void setContents(IFileState arg0, int arg1, IProgressMonitor arg2) throws CoreException {
    throw new RuntimeException("not implemented"); //$NON-NLS-1$
}
 
Example #19
Source File: TestFile.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
public IFileState[] getHistory(IProgressMonitor arg0) throws CoreException {
        throw new RuntimeException("not implemented"); //$NON-NLS-1$
//        return null;
    }