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


Java IFileInfo类代码示例

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


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

示例1: checkLocationDeleted

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
void checkLocationDeleted(final IProject project) throws CoreException {
	if (!project.exists()) { return; }
	final IFileInfo location = IDEResourceInfoUtils.getFileInfo(project.getLocationURI());
	if (!location.exists()) {
		final String message = NLS.bind(IDEWorkbenchMessages.RefreshAction_locationDeletedMessage,
				project.getName(), location.toString());

		final MessageDialog dialog = new MessageDialog(WorkbenchHelper.getShell(),
				IDEWorkbenchMessages.RefreshAction_dialogTitle, null, message, MessageDialog.QUESTION,
				new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) {
			@Override
			protected int getShellStyle() {
				return super.getShellStyle() | SWT.SHEET;
			}
		};
		WorkbenchHelper.run(() -> dialog.open());

		// Do the deletion back in the operation thread
		if (dialog.getReturnCode() == 0) { // yes was chosen
			project.delete(true, true, null);
		}
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:24,代码来源:RefreshHandler.java

示例2: checkLocationDeleted

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
/**
 * Checks whether the given project's location has been deleted. If so, prompts the user with whether to delete the
 * project or not.
 */
void checkLocationDeleted(final IProject project) throws CoreException {
	if (!project.exists()) { return; }
	final IFileInfo location = IDEResourceInfoUtils.getFileInfo(project.getLocationURI());
	if (!location.exists()) {
		final String message = NLS.bind(IDEWorkbenchMessages.RefreshAction_locationDeletedMessage,
				project.getName(), location.toString());

		final MessageDialog dialog = new MessageDialog(WorkbenchHelper.getShell(),
				IDEWorkbenchMessages.RefreshAction_dialogTitle, null, message, MessageDialog.QUESTION,
				new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) {
			@Override
			protected int getShellStyle() {
				return super.getShellStyle() | SWT.SHEET;
			}
		};
		WorkbenchHelper.run(() -> dialog.open());

		// Do the deletion back in the operation thread
		if (dialog.getReturnCode() == 0) { // yes was chosen
			project.delete(true, true, null);
		}
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:28,代码来源:RefreshAction.java

示例3: putInfo

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
void putInfo(IPath path, IFileInfo info, int options) throws CoreException {
  CommonNode node = find(path);
  if (node == null) {
    throw newCoreException("The store does not exist: " + path, null); //$NON-NLS-1$
  } else {
    if ((options & EFS.SET_ATTRIBUTES) != 0) {
      copyAttribute(info, node.info, EFS.ATTRIBUTE_ARCHIVE);
      copyAttribute(info, node.info, EFS.ATTRIBUTE_EXECUTABLE);
      copyAttribute(info, node.info, EFS.ATTRIBUTE_HIDDEN);
      copyAttribute(info, node.info, EFS.ATTRIBUTE_LINK_TARGET);
      copyAttribute(info, node.info, EFS.ATTRIBUTE_READ_ONLY);
    }
    if ((options & EFS.SET_LAST_MODIFIED) != 0) {
      node.info.setLastModified(info.getLastModified());
    }
  }
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:18,代码来源:ChromiumScriptStorage.java

示例4: fetchInfo

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
/**
 * Get file info for this directory.
 */
/* Override */
public IFileInfo fetchInfo( int options, IProgressMonitor monitor )
   throws CoreException
{
   updateZXTM();
   
   FileInfo info = new FileInfo( name );
   
   if( zxtm == null ) {         
      info.setExists( false );
      info.setDirectory( true );
      info.setLength( EFS.NONE );
      info.setLastModified( EFS.NONE );
   } else {                
      info.setExists( true );
      info.setDirectory( true );
      info.setLength( EFS.NONE );
      info.setLastModified( EFS.NONE );
      info.setAttribute( EFS.ATTRIBUTE_READ_ONLY, false );
   }
      
   return info;
}
 
开发者ID:brocade,项目名称:vTM-eclipse,代码行数:27,代码来源:RuleDirectoryFileStore.java

示例5: isValid

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
@Override
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException {
	RefactoringStatus result= new RefactoringStatus();
	IFile file= ResourcesPlugin.getWorkspace().getRoot().getFile(fPath);

	URI location= file.getLocationURI();
	if (location == null) {
		result.addFatalError(Messages.format(
			NLSChangesMessages.CreateFileChange_error_unknownLocation,
			BasicElementLabels.getPathLabel(file.getFullPath(), false)));
		return result;
	}

	IFileInfo jFile= EFS.getStore(location).fetchInfo();
	if (jFile.exists()) {
		result.addFatalError(Messages.format(
			NLSChangesMessages.CreateFileChange_error_exists,
			BasicElementLabels.getPathLabel(file.getFullPath(), false)));
		return result;
	}
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:CreateFileChange.java

示例6: 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

示例7: 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

示例8: 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

示例9: fetchInfo

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
@Override
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
	FileInfo fileInfo = new FileInfo(getName());
	fileInfo.setExists(true);
	fileInfo.setAttribute(EFS.ATTRIBUTE_OWNER_WRITE, true);
	
	return fileInfo;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:9,代码来源:CouchDBFileStore.java

示例10: create

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
public void create(IFileStore fileStore, IProgressMonitor monitor) throws CoreException {
  IFileInfo info = fileStore.fetchInfo();
  fFileStore = fileStore;
  if (fLocation == null) fLocation = URIUtil.toPath(fileStore.toURI());

  initializeFileBufferContent(monitor);
  if (info.exists()) fSynchronizationStamp = info.getLastModified();

  addFileBufferContentListeners();
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:FileStoreFileBuffer.java

示例11: 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

示例12: copyDirectory

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
/**
 * Recursively copies a directory as specified by {@link IFileStore#copy(IFileStore, int,
 * IProgressMonitor)}.
 *
 * @param sourceInfo The current file information for the source of the move
 * @param destination The destination of the copy.
 * @param options bit-wise or of option flag constants ( {@link EFS#OVERWRITE} or {@link
 *     EFS#SHALLOW}).
 * @param monitor a progress monitor, or <code>null</code> if progress reporting and cancellation
 *     are not desired
 * @exception CoreException if this method fails. Reasons include:
 *     <ul>
 *       <li>This store does not exist.
 *       <li>A file of the same name already exists at the copy destination.
 *     </ul>
 */
protected void copyDirectory(
    IFileInfo sourceInfo, IFileStore destination, int options, IProgressMonitor monitor)
    throws CoreException {
  try {
    IFileStore[] children = null;
    int opWork = 1;
    if ((options & EFS.SHALLOW) == 0) {
      children = childStores(EFS.NONE, null);
      opWork += children.length;
    }
    monitor.beginTask("", opWork); // $NON-NLS-1$
    monitor.subTask(NLS.bind(Messages.copying, toString()));
    // create directory
    destination.mkdir(EFS.NONE, Policy.subMonitorFor(monitor, 1));
    // copy attributes
    transferAttributes(sourceInfo, destination);

    if (children == null) return;
    // copy children
    for (int i = 0; i < children.length; i++)
      children[i].copy(
          destination.getChild(children[i].getName()), options, Policy.subMonitorFor(monitor, 1));
  } finally {
    monitor.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:43,代码来源:FileStore.java

示例13: copyFile

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
/**
 * Copies a file as specified by {@link IFileStore#copy(IFileStore, int, IProgressMonitor)}.
 *
 * @param sourceInfo The current file information for the source of the move
 * @param destination The destination of the copy.
 * @param options bit-wise or of option flag constants ( {@link EFS#OVERWRITE} or {@link
 *     EFS#SHALLOW}).
 * @param monitor a progress monitor, or <code>null</code> if progress reporting and cancellation
 *     are not desired
 * @exception CoreException if this method fails. Reasons include:
 *     <ul>
 *       <li>This store does not exist.
 *       <li>The <code>OVERWRITE</code> flag is not specified and a file of the same name already
 *           exists at the copy destination.
 *       <li>A directory of the same name already exists at the copy destination.
 *     </ul>
 */
protected void copyFile(
    IFileInfo sourceInfo, IFileStore destination, int options, IProgressMonitor monitor)
    throws CoreException {
  try {
    if ((options & EFS.OVERWRITE) == 0 && destination.fetchInfo().exists())
      Policy.error(EFS.ERROR_EXISTS, NLS.bind(Messages.fileExists, destination));
    long length = sourceInfo.getLength();
    int totalWork;
    if (length == -1) totalWork = IProgressMonitor.UNKNOWN;
    else totalWork = 1 + (int) (length / buffer.length);
    String sourcePath = toString();
    monitor.beginTask(NLS.bind(Messages.copying, sourcePath), totalWork);
    InputStream in = null;
    OutputStream out = null;
    try {
      in = openInputStream(EFS.NONE, Policy.subMonitorFor(monitor, 0));
      out = destination.openOutputStream(EFS.NONE, Policy.subMonitorFor(monitor, 0));
      transferStreams(in, out, sourcePath, monitor);
      transferAttributes(sourceInfo, destination);
    } catch (CoreException e) {
      Policy.safeClose(in);
      Policy.safeClose(out);
      // if we failed to write, try to cleanup the half written file
      if (!destination.fetchInfo(0, null).exists()) destination.delete(EFS.NONE, null);
      throw e;
    }
  } finally {
    monitor.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:48,代码来源:FileStore.java

示例14: fetchInfo

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
/**
 * The default implementation of {@link IFileStore#fetchInfo()}. This implementation forwards to
 * {@link IFileStore#fetchInfo(int, IProgressMonitor)}. Subclasses may override this method.
 */
public IFileInfo fetchInfo() {
  try {
    return fetchInfo(EFS.NONE, null);
  } catch (CoreException e) {
    // there was an error contacting the file system, so treat it as non-existent file
    FileInfo result = new FileInfo(getName());
    result.setExists(false);
    return result;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:FileStore.java

示例15: fetchInfo

import org.eclipse.core.filesystem.IFileInfo; //导入依赖的package包/类
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) {
  //		if (LocalFileNativesManager.isUsingNatives()) {
  //			FileInfo info = LocalFileNativesManager.fetchFileInfo(filePath);
  //			//natives don't set the file name on all platforms
  //			if (info.getName().length() == 0) {
  //				String name = file.getName();
  //				//Bug 294429: make sure that substring baggage is removed
  //				info.setName(new String(name.toCharArray()));
  //			}
  //			return info;
  //		}
  // in-lined non-native implementation
  FileInfo info = new FileInfo(file.getName());
  final long lastModified = file.lastModified();
  if (lastModified <= 0) {
    // if the file doesn't exist, all other attributes should be default values
    info.setExists(false);
    return info;
  }
  info.setLastModified(lastModified);
  info.setExists(true);
  info.setLength(file.length());
  info.setDirectory(file.isDirectory());
  info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, file.exists() && !file.canWrite());
  info.setAttribute(EFS.ATTRIBUTE_HIDDEN, file.isHidden());
  return info;
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:LocalFile.java


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