本文整理汇总了Java中org.eclipse.core.filesystem.IFileStore.getName方法的典型用法代码示例。如果您正苦于以下问题:Java IFileStore.getName方法的具体用法?Java IFileStore.getName怎么用?Java IFileStore.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.filesystem.IFileStore
的用法示例。
在下文中一共展示了IFileStore.getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGraphName
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
* Gets the graph name.
*
* @param outPutFile the out put file
* @param externalOutputFile the external output file
* @return the graph name
*/
private String getGraphName(IFile outPutFile, IFileStore externalOutputFile) {
if (outPutFile != null && StringUtils.isNotBlank(outPutFile.getName()))
return outPutFile.getName();
else if (externalOutputFile != null && StringUtils.isNotBlank(externalOutputFile.getName()))
return externalOutputFile.getName();
else
return "Temp.xml";
}
示例2: isFileCloaked
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
* @param fileStore
* the file store to be checked
* @return true if the file should be cloaked, false otherwise
*/
public static boolean isFileCloaked(IFileStore fileStore) {
String filename = fileStore.getName();
String filepath = fileStore.toString();
String[] expressions = getCloakedExpressions();
for (String expression : expressions) {
if (filename.matches(expression) || filepath.matches(expression)) {
return true;
}
}
return false;
}
示例3: getFileInfo
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
@Override
public IFileInfo getFileInfo(IFileStore store) {
IFileInfo result = infoMap.get(store);
if (result != null) {
return result;
}
return new FileInfo(store.getName());
}
示例4: resolveFileFromInputStream
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
* Returns an {@link IFile} for the file backing an input stream. This method
* is tailored to work with
* {@link org.eclipse.core.runtime.content.IContentDescriber}, using it
* elsewhere will likely not work.
*
* @return the filename, or null if it could not be determined
*/
public static IFile resolveFileFromInputStream(
InputStream contentInputStream) {
try {
if (!(contentInputStream instanceof LazyInputStream)) {
return null;
}
Class<?> c = contentInputStream.getClass();
Field in = c.getDeclaredField("in");
in.setAccessible(true);
Object lazyFileInputStreamObj = in.get(contentInputStream);
if (lazyFileInputStreamObj == null) {
return null;
}
if (!Class.forName(
"org.eclipse.core.internal.resources.ContentDescriptionManager$LazyFileInputStream").isAssignableFrom(
lazyFileInputStreamObj.getClass())) {
return null;
}
Field target = lazyFileInputStreamObj.getClass().getDeclaredField(
"target");
target.setAccessible(true);
Object fileStoreObj = target.get(lazyFileInputStreamObj);
if (fileStoreObj == null) {
return null;
}
if (!(fileStoreObj instanceof IFileStore)) {
return null;
}
IFileStore fileStore = (IFileStore) fileStoreObj;
String name = fileStore.getName();
if (name == null || name.length() == 0) {
return null;
}
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(
fileStore.toURI());
return files.length > 0 ? files[0] : null;
} catch (Throwable e) {
// Ignore on purpose
}
return null;
}
示例5: suggestChildrenOfFileStore
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
* @param offset
* @param valuePrefix
* @param editorStoreURI
* The URI of the current file. We use this to eliminate it from list of possible completions.
* @param parent
* The parent we're grabbing children for.
* @return
* @throws CoreException
*/
protected List<ICompletionProposal> suggestChildrenOfFileStore(int offset, String valuePrefix, URI editorStoreURI,
IFileStore parent) throws CoreException
{
IFileStore[] children = parent.childStores(EFS.NONE, new NullProgressMonitor());
if (children == null || children.length == 0)
{
return Collections.emptyList();
}
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
Image[] userAgentIcons = this.getAllUserAgentIcons();
for (IFileStore f : children)
{
String name = f.getName();
// Don't include the current file in the list
// FIXME this is a possible perf issue. We really only need to check for editor store on local URIs
if (name.charAt(0) == '.' || f.toURI().equals(editorStoreURI))
{
continue;
}
if (valuePrefix != null && valuePrefix.length() > 0 && !name.startsWith(valuePrefix))
{
continue;
}
IFileInfo info = f.fetchInfo();
boolean isDir = false;
if (info.isDirectory())
{
isDir = true;
}
// build proposal
int replaceOffset = offset;
int replaceLength = 0;
if (this._replaceRange != null)
{
replaceOffset = this._replaceRange.getStartingOffset();
replaceLength = this._replaceRange.getLength();
}
CommonCompletionProposal proposal = new URIPathProposal(name, replaceOffset, replaceLength, isDir,
userAgentIcons);
proposals.add(proposal);
}
return proposals;
}