Java Code Examples for org.eclipse.core.resources.IFileState

The following examples show how to use org.eclipse.core.resources.IFileState. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: gama   Source File: ShowLocalHistory.java    License: 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
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
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 Project: xds-ide   Source File: HistoryFs.java    License: 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 Project: xds-ide   Source File: HistoryFs.java    License: 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 Project: xtext-xtend   Source File: KeepLocalHistoryTest.java    License: 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 Project: ice   Source File: ClientTester.java    License: 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 Project: ice   Source File: FakeIFile.java    License: 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 Project: xds-ide   Source File: HistoryFileStore.java    License: Eclipse Public License 1.0 4 votes vote down vote up
public HistoryFileStore(URI uri, IFileState fileState) {
	this.fileState = fileState;
	this.uri = uri;
}
 
Example 10
Source Project: XPagesExtensionLibrary   Source File: TestFile.java    License: 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;
    }
 
Example 11
Source Project: XPagesExtensionLibrary   Source File: TestFile.java    License: 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 12
Source Project: XPagesExtensionLibrary   Source File: TestFile.java    License: 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 13
Source Project: ice   Source File: ClientTester.java    License: 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 Project: ice   Source File: ClientTester.java    License: 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 Project: ice   Source File: FakeIFile.java    License: 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 Project: ice   Source File: FakeIFile.java    License: 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 Project: Pydev   Source File: AbstractIFileStub.java    License: 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 18
Source Project: Pydev   Source File: AbstractIFileStub.java    License: 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 19
Source Project: Pydev   Source File: AbstractIFileStub.java    License: 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");
}