gpt4 book ai didi

org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 08:54:49 26 4
gpt4 key购买 nike

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

ZipFileStructureProvider.<init>介绍

[英]Creates a ZipFileStructureProvider, which will operate on the passed zip file.
[中]创建一个ZipFileStructureProvider,它将对传递的zip文件进行操作。

代码示例

代码示例来源: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.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

private void importJar(File jar, IResource destination, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
  try (ZipFile input = new ZipFile(jar);) {
    ZipFileStructureProvider provider = new ZipFileStructureProvider(input);
    ImportOperation op = new ImportOperation(destination.getFullPath(), provider.getRoot(), provider,
        pathString -> IOverwriteQuery.ALL);
    op.run(monitor);
  } catch (IOException e) {
    throw new CoreException(new Status(IStatus.ERROR, IPDEUIConstants.PLUGIN_ID, IStatus.OK,
        NLS.bind(PDEUIMessages.NewProjectCreationOperation_errorImportingJar, jar), e));
  }
}

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

public static String[] getTopLevelResources(File file) {
  ArrayList<String> result = new ArrayList<>();
  try (ZipFile zipFile = new ZipFile(file)) {
    ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile);
    List<?> children = provider.getChildren(provider.getRoot());
    if (children != null && !children.isEmpty()) {
      for (int i = 0; i < children.size(); i++) {
        Object curr = children.get(i);
        if (provider.isFolder(curr)) {
          if (!isClassFolder(provider, curr))
            result.add(provider.getLabel(curr) + "/"); //$NON-NLS-1$
          else {
            if (!result.contains(".")) //$NON-NLS-1$
              result.add("."); //$NON-NLS-1$
          }
        } else {
          result.add(provider.getLabel(curr));
        }
      }
    }
  } catch (IOException e) {
  }
  return result.toArray(new String[result.size()]);
}

代码示例来源: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);
}

代码示例来源: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.pde/org.eclipse.pde.ui

/**
 * Searches the given archive file for java source folders.  Imports the files in the
 * source folders to the specified destination unless the folder is in the list of
 * folders to exclude.
 * @param file archive file to search for source in
 * @param excludeFolders list of IPaths describing folders to ignore while searching
 * @param dstPath full path to destination to put the extracted source
 * @param collectedPackages will be updated with the set of packages the extracted source belongs to, if <code>null</code> this step will be skipped
 * @param monitor progress monitor
 * @throws CoreException if there is a problem extracting source from the zip
 */
public static void extractJavaSourceFromArchive(File file, List<IPath> excludeFolders, IPath dstPath, Set<IPath> collectedPackages, IProgressMonitor monitor) throws CoreException {
  try (ZipFile zipFile = new ZipFile(file);) {
    ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile);
    ArrayList<Object> collected = new ArrayList<>();
    collectJavaSourceFromRoot(provider, excludeFolders, collected);
    if (collectedPackages != null) {
      collectJavaPackages(provider, collected, null, collectedPackages);
    }
    importContent(provider.getRoot(), dstPath, provider, collected, monitor);
  } catch (IOException e) {
    IStatus status = new Status(IStatus.ERROR, PDEPlugin.getPluginId(), IStatus.ERROR, e.getMessage(), e);
    throw new CoreException(status);
  }
}

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

/**
 * Extracts all of the files and subfolders from a single folder within an archive file.
 * @param file archive file to search for files
 * @param folderPath path to the folder to extract from
 * @param dstPath destination to import content to
 * @param collectedPackages will be updated with the set of packages the extracted source belongs to, if <code>null</code> this step will be skipped
 * @param monitor progress monitor
 * @throws CoreException if a problem occurs while extracting
 * @since 3.4
 */
public static void extractFolderFromArchive(File file, IPath folderPath, IPath dstPath, Set<IPath> collectedPackages, IProgressMonitor monitor) throws CoreException {
  try (ZipFile zipFile = new ZipFile(file)) {
    ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile);
    ArrayList<Object> collected = new ArrayList<>();
    collectResourcesFromFolder(provider, provider.getRoot(), folderPath, collected);
    if (collectedPackages != null) {
      collectJavaPackages(provider, collected, folderPath, collectedPackages);
    }
    importContent(provider.getRoot(), dstPath, provider, collected, monitor);
  } catch (IOException e) {
    IStatus status = new Status(IStatus.ERROR, PDEPlugin.getPluginId(), IStatus.ERROR, e.getMessage(), e);
    throw new CoreException(status);
  }
}

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

/**
 * Extracts the contents of the specified zip file to the specified destination
 * @param file
 * @param dstPath
 * @param collectedPackages will be updated with the set of packages the extracted source belongs to, if <code>null</code> this step will be skipped
 * @param monitor
 * @throws CoreException
 */
public static void extractArchive(File file, IPath dstPath, Set<IPath> collectedPackages, IProgressMonitor monitor) throws CoreException {
  try (ZipFile zipFile = new ZipFile(file)) {
    ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile);
    // If the caller wants to have package names collected, scan the zip file for package structures
    if (collectedPackages != null) {
      ArrayList<Object> collected = new ArrayList<>();
      collectResources(provider, provider.getRoot(), collected);
      collectJavaPackages(provider, collected, null, collectedPackages);
    }
    importContent(provider.getRoot(), dstPath, provider, null, monitor);
  } catch (IOException e) {
    IStatus status = new Status(IStatus.ERROR, PDEPlugin.getPluginId(), IStatus.ERROR, e.getMessage(), e);
    throw new CoreException(status);
  }
}

代码示例来源:origin: wala/WALA

public static void importZipfile(String projectName, ZipFile zipFile, IProgressMonitor monitor) {
 ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile);
 importProject(provider, monitor, projectName, provider.getRoot());
 try {
  zipFile.close();
 } catch (IOException e) {
  e.printStackTrace();
 }
}

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

if (isJARd(model)) {
  zip = new ZipFile(new File(model.getInstallLocation()));
  provider = new ZipFileStructureProvider(zip);
  root = ((ZipFileStructureProvider) provider).getRoot();
  prefixPath = defaultSourcePath;

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

if (isJARd(model)) {
  zip = new ZipFile(new File(model.getInstallLocation()));
  provider = new ZipFileStructureProvider(zip);
  root = ((ZipFileStructureProvider) provider).getRoot();
} else {

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

try {
  zip = new ZipFile(new File(model.getInstallLocation()));
  ZipFileStructureProvider provider = new ZipFileStructureProvider(zip);
  ArrayList<Object> collected = new ArrayList<>();
  PluginImportHelper.collectRequiredBundleFiles(provider, provider.getRoot(), collected);

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

try {
  zip = new ZipFile(sourceLocation);
  ZipFileStructureProvider provider = new ZipFileStructureProvider(zip);
  ArrayList<Object> collected = new ArrayList<>();
  PluginImportHelper.collectNonJavaNonBuildFiles(provider, provider.getRoot(), collected);

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

SubMonitor iterationMonitor = subMonitor.split(1);
try (ZipFile zip = new ZipFile(new File(model.getInstallLocation()))) {
  ZipFileStructureProvider provider = new ZipFileStructureProvider(zip);
  Map<IPath, List<Object>> collected = new HashMap<>();
  PluginImportHelper.collectBinaryFiles(provider, provider.getRoot(), packageLocations, collected);

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

ZipFileStructureProvider provider= new ZipFileStructureProvider(zipFile);

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

ZipFileStructureProvider provider= new ZipFileStructureProvider(zipFile);

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

ZipFileStructureProvider provider= new ZipFileStructureProvider(zipFile);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com