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


Java IFileInfo.isDirectory方法代码示例

本文整理汇总了Java中org.eclipse.core.filesystem.IFileInfo.isDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java IFileInfo.isDirectory方法的具体用法?Java IFileInfo.isDirectory怎么用?Java IFileInfo.isDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.filesystem.IFileInfo的用法示例。


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

示例1: rememberExisitingFolders

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
private void rememberExisitingFolders(URI projectLocation) {
	fOrginalFolders= new HashSet<IFileStore>();

	try {
		IFileStore[] children= EFS.getStore(projectLocation).childStores(EFS.NONE, null);
		for (int i= 0; i < children.length; i++) {
			IFileStore child= children[i];
			IFileInfo info= child.fetchInfo();
			if (info.isDirectory() && info.exists() && !fOrginalFolders.contains(child.getName())) {
				fOrginalFolders.add(child);
			}
		}
	} catch (CoreException e) {
		JavaPlugin.log(e);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:NewJavaProjectWizardPageTwo.java

示例2: getEditorInput

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
private static IEditorInput getEditorInput(final String path) {
    final IFile file = Resources.getFileForLocation(path);
    if (file != null) {
        return new FileEditorInput(file);
    } else {
        // file is outside of workbench
        final IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(path));
        final IFileInfo fetchInfo = fileStore.fetchInfo();
        if (fetchInfo.isDirectory() || !fetchInfo.exists()) {
            return null; // ensure the file exists
        }
        return new FileStoreEditorInput(fileStore);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:15,代码来源:EclipseFileViewer.java

示例3: openEditor

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
private IEditorPart openEditor(IWorkbenchWindow window, IPath filePath) {
	IFileStore fileStore = EFS.getLocalFileSystem().getStore(filePath);
	IFileInfo fetchInfo = fileStore.fetchInfo();
	if (fetchInfo.isDirectory() || !fetchInfo.exists()) {
		return null;
	}
	IWorkbenchPage page = window.getActivePage();
	try {
		IEditorPart editorPart = IDE.openEditorOnFileStore(page, fileStore);
		return editorPart;
	} catch (PartInitException e) {
		return null;
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:15,代码来源:GotoExternalFileBookmark.java

示例4: copy

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
/**
 * The default implementation of {@link IFileStore#copy(IFileStore, int, IProgressMonitor)}. This
 * implementation performs a copy by using other primitive methods. Subclasses may override this
 * method.
 */
public void copy(IFileStore destination, int options, IProgressMonitor monitor)
    throws CoreException {
  monitor = Policy.monitorFor(monitor);
  Policy.checkCanceled(monitor);
  final IFileInfo sourceInfo = fetchInfo(EFS.NONE, null);
  if (sourceInfo.isDirectory()) copyDirectory(sourceInfo, destination, options, monitor);
  else copyFile(sourceInfo, destination, options, monitor);
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:FileStore.java

示例5: matches

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
@Override
public boolean matches( IContainer parent, IFileInfo fileInfo ) {
  if( !fileInfo.isDirectory() || recursionGuard.isInUse( project )) {
    return false;
  }
  recursionGuard.enter( project );
  try {
    return findContainer( parent, fileInfo.getName() )
      .stream()
      .anyMatch( container -> container.getType() == PROJECT && !container.equals( project ) );
  } finally {
    recursionGuard.leave( project );
  }
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:15,代码来源:NestedProjectFilter.java

示例6: createEditorInput

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
public IEditorInput createEditorInput( Object file )
{
	if (file instanceof File)
	{
		File handle = (File)file;
		String fileName = handle.getAbsolutePath( );
		
		IWorkspace space = ResourcesPlugin.getWorkspace( );
		IWorkspaceRoot root = space.getRoot( );
		try
		{
			//IFile[] resources = root.findFilesForLocationURI( new URL("file:///" + fileName ).toURI( ) ); //$NON-NLS-1$
			IFile[] resources = root.findFilesForLocationURI(new File( fileName ).toURI( ) ); //$NON-NLS-1$
			if (resources != null && resources.length > 0)
			{
				IEditorInput input = new FileEditorInput(resources[0]);
				return input;
			}
			else
			{
				IFileStore fileStore =  EFS.getLocalFileSystem().getStore(new Path(fileName));
				IFileInfo fetchInfo = fileStore.fetchInfo();
				if (!fetchInfo.isDirectory() && fetchInfo.exists())
				{
					return new FileStoreEditorInput(fileStore);
				}
			}
		}
		catch(Exception e)
		{
			return null;
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:36,代码来源:IDEEditputProvider.java

示例7: removeIndexTree

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
/**
 * Removes the refactoring history index tree spanned by the specified file store.
 *
 * @param store the file store spanning the history index tree
 * @param monitor the progress monitor to use
 * @param task the task label to use
 * @throws CoreException if an error occurs while removing the index tree
 */
private static void removeIndexTree(
    final IFileStore store, final IProgressMonitor monitor, final String task)
    throws CoreException {
  try {
    monitor.beginTask(task, 16);
    final IFileInfo info =
        store.fetchInfo(
            EFS.NONE,
            new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
    if (info.isDirectory()) {
      if (info.getName().equalsIgnoreCase(RefactoringHistoryService.NAME_HISTORY_FOLDER)) return;
      final IFileStore[] stores =
          store.childStores(
              EFS.NONE,
              new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
      final IProgressMonitor subMonitor =
          new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL);
      try {
        subMonitor.beginTask(
            RefactoringCoreMessages.RefactoringHistoryService_updating_history, stores.length);
        for (int index = 0; index < stores.length; index++) {
          final IFileInfo current =
              stores[index].fetchInfo(
                  EFS.NONE,
                  new SubProgressMonitor(
                      subMonitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
          if (current.isDirectory()) {
            final char[] characters = stores[index].getName().toCharArray();
            for (int offset = 0; offset < characters.length; offset++) {
              if (Character.isDigit(characters[offset])) return;
              else continue;
            }
          }
        }
      } finally {
        subMonitor.done();
      }
    }
    final IFileStore parent = store.getParent();
    store.delete(
        0, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
    removeIndexTree(
        parent,
        new SubProgressMonitor(monitor, 12, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL),
        task);
  } finally {
    monitor.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:58,代码来源:RefactoringHistoryManager.java

示例8: openFiles

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
public void openFiles() {
		
		if (filesToOpen.isEmpty())
			return;

		String[] filePaths = filesToOpen
				.toArray(new String[filesToOpen.size()]);
		filesToOpen.clear();

		
		for (String path : filePaths)
		{
			System.out.println("Processing " + path);
			if (path.toLowerCase().endsWith(".jrxml"))
			{
				
				java.io.File file = new java.io.File(path);
				if (!file.exists()) continue;
				
					IFileStore fileStore =  EFS.getLocalFileSystem().getStore(new Path(file.getParent()));
					fileStore =  fileStore.getChild(file.getName());
					IFileInfo fetchInfo = fileStore.fetchInfo();
					if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
						
						IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
						IWorkbenchPage page = window.getActivePage();
						
						
						try {
							IDE.openEditorOnFileStore(page, fileStore);
						} catch (PartInitException e) {
							
						}
					}				
				
//				IFile fileToBeOpened = (IFile) EFS.getLocalFileSystem().getStore(new Path(path));
//				IEditorInput editorInput = new FileEditorInput(fileToBeOpened);
//				
//				try {
//					IDE.openEditor(page, fileToBeOpened);
//					
//					IEditorPart  part = page.openEditor(editorInput, "com.jaspersoft.studio.editor.JrxmlEditor");
//					System.out.println(part);
//					
//				} catch (PartInitException e) {
//					// TODO Auto-generated catch block
//					e.printStackTrace();
//				}
			}
		}
	}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:52,代码来源:OpenDocumentEventProcessor.java

示例9: handleRequest

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
private void handleRequest(HttpRequest request, HttpResponse response, boolean head) throws HttpException,
		IOException, CoreException, URISyntaxException
{
	String target = URLDecoder.decode(request.getRequestLine().getUri(), IOUtil.UTF_8);
	URI uri = URIUtil.fromString(target);
	IFileStore fileStore = uriMapper.resolve(uri);
	IFileInfo fileInfo = fileStore.fetchInfo();
	if (fileInfo.isDirectory())
	{
		fileInfo = getIndex(fileStore);
		if (fileInfo.exists())
		{
			fileStore = fileStore.getChild(fileInfo.getName());
		}
	}
	if (!fileInfo.exists())
	{
		response.setStatusCode(HttpStatus.SC_NOT_FOUND);
		response.setEntity(createTextEntity(MessageFormat.format(
				Messages.LocalWebServerHttpRequestHandler_FILE_NOT_FOUND, uri.getPath())));
	}
	else if (fileInfo.isDirectory())
	{
		response.setStatusCode(HttpStatus.SC_FORBIDDEN);
		response.setEntity(createTextEntity(Messages.LocalWebServerHttpRequestHandler_FORBIDDEN));
	}
	else
	{
		response.setStatusCode(HttpStatus.SC_OK);
		if (head)
		{
			response.setEntity(null);
		}
		else
		{
			File file = fileStore.toLocalFile(EFS.NONE, new NullProgressMonitor());
			final File temporaryFile = (file == null) ? fileStore.toLocalFile(EFS.CACHE, new NullProgressMonitor())
					: null;
			response.setEntity(new NFileEntity((file != null) ? file : temporaryFile, getMimeType(fileStore
					.getName()))
			{
				@Override
				public void close() throws IOException
				{
					try
					{
						super.close();
					}
					finally
					{
						if (temporaryFile != null && !temporaryFile.delete())
						{
							temporaryFile.deleteOnExit();
						}
					}
				}
			});
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:61,代码来源:LocalWebServerHttpRequestHandler.java

示例10: suggestChildrenOfFileStore

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的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;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:58,代码来源:HTMLContentAssistProcessor.java

示例11: isUMLFile

import org.eclipse.core.filesystem.IFileInfo; //导入方法依赖的package包/类
private boolean isUMLFile(IFileStore toCheck) {
    IFileInfo info = toCheck.fetchInfo();
    return info.exists() && !info.isDirectory() && toCheck.getName().endsWith('.' + UMLResource.FILE_EXTENSION);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:5,代码来源:CompilationDirector.java


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