org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider类的一些代码示例,展示了ZipFileStructureProvider类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipFileStructureProvider类的具体详情如下:
包路径:org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider
类名称:ZipFileStructureProvider

ZipFileStructureProvider介绍

[英]This class provides information regarding the context structure and content of specified zip file entry objects.
[中]此类提供有关指定zip文件条目对象的上下文结构和内容的信息。

代码示例

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(srcZipFile);
    ImportOperation op = new ImportOperation(destPath, structureProvider.getRoot(), structureProvider, query);
    op.run(monitor);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public String getText(Object element) {
    if (element == fProvider.getRoot()) {
      return fProvider.getZipFile().getName();
    }
    return fProvider.getLabel(element);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public Object findElement(IPath path) {
  String[] segments= path.segments();
  
  Object elem= fProvider.getRoot();
  for (int i= 0; i < segments.length && elem != null; i++) {
    List list= fProvider.getChildren(elem);
    String name= segments[i];
    elem= null;
    for (int k= 0; k < list.size(); k++) {
      Object curr= list.get(k);
      if (fProvider.isFolder(curr) && name.equals(fProvider.getLabel(curr))) {
        elem= curr;
        break;
      }
    }
  }
  return elem;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public boolean hasChildren(Object element) {
  List<?> list= fProvider.getChildren(element);
  if (list != null) {
    for (int i= 0; i < list.size(); i++) {
      if (fProvider.isFolder(list.get(i))) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
public Image getImage(Object element) {
  if (element == fProvider.getRoot()) {
    return IMG_JAR;
  } else {
    return IMG_FOLDER;
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
public Object getParent(Object element) {
  if (element.equals(fProvider.getRoot())) {
    return null;
  }
  IPath path= new Path(fProvider.getFullPath(element));
  if (path.segmentCount() > 0) {
    return findElement(path.removeLastSegments(1));
  }
  return fProvider.getRoot();
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

ZipFileStructureProvider provider= new ZipFileStructureProvider(zipFile);
  String name= provider.getFullPath(dialog.getFirstResult());
  return new Path(name).removeTrailingSeparator().toString();

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

/**
 * Returns a structure provider for the specified zip file.
 */
protected ZipFileStructureProvider getStructureProvider(ZipFile targetZip) {
  if (providerCache == null)
    providerCache = new ZipFileStructureProvider(targetZip);
  else if (!providerCache.getZipFile().getName().equals(targetZip.getName())) {
    clearProviderCache(); // ie.- new value, so finalize&remove old value
    providerCache = new ZipFileStructureProvider(targetZip);
  } else if (!providerCache.getZipFile().equals(targetZip))
    closeZipFile(targetZip); // ie.- duplicate handle to same .zip
  return providerCache;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

List<?> children = provider.getChildren(element);
if (children != null && !children.isEmpty()) {
  for (int i = 0; i < children.size(); i++) {
    Object curr = children.get(i);
    if (provider.isFolder(curr)) {
        if (provider.getLabel(curr).equals(currentPath.segment(0))) {
          if (currentPath.segmentCount() > 1) {
    } else if (!provider.getLabel(curr).endsWith(".class")) { //$NON-NLS-1$
      collected.add(curr);

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private Object recursiveFind(Object element, String name) {
  if (name.equals(fProvider.getLabel(element))) {
    return element;
  }
  List list= fProvider.getChildren(element);
  if (list != null) {
    for (int k= 0; k < list.size(); k++) {
      Object res= recursiveFind(list.get(k), name);
      if (res != null) {
        return res;
      }
    }                
  }
  return null;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

/**
 * Clears the cached structure provider after first finalizing it properly.
 */
protected void clearProviderCache() {
  if (providerCache != null) {
    closeZipFile(providerCache.getZipFile());
    providerCache = null;
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public Image getImage(Object element) {
  if (element == fProvider.getRoot()) {
    return IMG_JAR;
  } else {
    return IMG_FOLDER;
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public boolean hasChildren(Object element) {
  List list= fProvider.getChildren(element);
  if (list != null) {
    for (int i= 0; i < list.size(); i++) {
      if (fProvider.isFolder(list.get(i))) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public Object getParent(Object element) {
  if (element.equals(fProvider.getRoot())) {
    return null;
  }
  IPath path= new Path(fProvider.getFullPath(element));
  if (path.segmentCount() > 0) {
    return findElement(path.removeLastSegments(1));
  }
  return fProvider.getRoot();
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

ZipFileStructureProvider provider= new ZipFileStructureProvider(zipFile);
  String name= provider.getFullPath(dialog.getFirstResult());
  return new Path(name).removeTrailingSeparator().toString();

代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui

/**
 * Returns a structure provider for the specified zip file.
 */
private ZipFileStructureProvider getStructureProvider(ZipFile targetZip) {
  if (providerCache == null) {
    providerCache = new ZipFileStructureProvider(targetZip);
  } else if (!providerCache.getZipFile().getName().equals(targetZip.getName())) {
    clearProviderCache();
    // ie.- new value, so finalize & remove old value
    providerCache = new ZipFileStructureProvider(targetZip);
  } else if (!providerCache.getZipFile().equals(targetZip)) {
    closeZipFile(targetZip); // ie.- duplicate handle to same .zip
  }
  return providerCache;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

/**
 * Recursively searches through the zip files searching for files inside of
 * the specified folder.  The files found will be added to the given list.
 * @param provider zip provider
 * @param element element of the zip currently being looked at
 * @param folderPath location of the folder to get resources from
 * @param collected list of files found
 * @since 3.4
 */
private static void collectResourcesFromFolder(ZipFileStructureProvider provider, Object element, IPath folderPath, ArrayList<Object> collected) {
  List<?> children = provider.getChildren(element);
  if (children != null && !children.isEmpty()) {
    for (int i = 0; i < children.size(); i++) {
      Object curr = children.get(i);
      if (provider.isFolder(curr)) {
        if (provider.getLabel(curr).equals(folderPath.segment(0))) {
          if (folderPath.segmentCount() > 1) {
            collectResourcesFromFolder(provider, curr, folderPath.removeFirstSegments(1), collected);
          } else {
            collectResources(provider, curr, collected);
          }
        }
      }
    }
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui

/**
 * Clears the cached structure provider after first finalizing it properly.
 */
private void clearProviderCache() {
  if (providerCache != null) {
    closeZipFile(providerCache.getZipFile());
    providerCache = null;
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

public Object findElement(IPath path) {
  String[] segments= path.segments();
  Object elem= fProvider.getRoot();
  for (int i= 0; i < segments.length && elem != null; i++) {
    List<?> list= fProvider.getChildren(elem);
    String name= segments[i];
    elem= null;
    for (int k= 0; k < list.size(); k++) {
      Object curr= list.get(k);
      if (fProvider.isFolder(curr) && name.equals(fProvider.getLabel(curr))) {
        elem= curr;
        break;
      }
    }
  }
  return elem;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.ui

private void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(srcZipFile);
  ImportOperation op = new ImportOperation(destPath, structureProvider.getRoot(), structureProvider, overwriteQuery);
  op.run(monitor);
}

相关文章