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


Java CoreUtility.createFolder方法代码示例

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


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

示例1: addClassFolder

import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入方法依赖的package包/类
/**
 * Creates and adds a class folder to the class path.
 *
 * @param jproject The parent project
 * @param containerName
 * @param sourceAttachPath The source attachment path
 * @param sourceAttachRoot The source attachment root path
 * @return The handle of the created root
 * @throws CoreException
 */
public static IPackageFragmentRoot addClassFolder(
    IJavaProject jproject, String containerName, IPath sourceAttachPath, IPath sourceAttachRoot)
    throws CoreException {
  IProject project = jproject.getProject();
  IContainer container = null;
  if (containerName == null || containerName.length() == 0) {
    container = project;
  } else {
    IFolder folder = project.getFolder(containerName);
    if (!folder.exists()) {
      CoreUtility.createFolder(folder, false, true, null);
    }
    container = folder;
  }
  IClasspathEntry cpe =
      JavaCore.newLibraryEntry(container.getFullPath(), sourceAttachPath, sourceAttachRoot);
  addToClasspath(jproject, cpe);
  return jproject.getPackageFragmentRoot(container);
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:JavaProjectHelper.java

示例2: addClassFolder

import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入方法依赖的package包/类
/**
 * Creates and adds a class folder to the class path.
 * 
 * @param jproject
 *            The parent project
 * @param containerName
 * @param sourceAttachPath
 *            The source attachment path
 * @param sourceAttachRoot
 *            The source attachment root path
 * @return The handle of the created root
 * @throws CoreException
 */
public static IPackageFragmentRoot addClassFolder(IJavaProject jproject, String containerName, IPath sourceAttachPath,
        IPath sourceAttachRoot) throws CoreException {
    IProject project = jproject.getProject();
    IContainer container = null;
    if (containerName == null || containerName.length() == 0) {
        container = project;
    } else {
        IFolder folder = project.getFolder(containerName);
        if (!folder.exists()) {
            CoreUtility.createFolder(folder, false, true, null);
        }
        container = folder;
    }
    IClasspathEntry cpe = JavaCore.newLibraryEntry(container.getFullPath(), sourceAttachPath, sourceAttachRoot);
    addToClasspath(jproject, cpe);
    return jproject.getPackageFragmentRoot(container);
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:31,代码来源:JavaProjectHelper.java

示例3: testPackageRenameWithResource3

import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入方法依赖的package包/类
@Test
@Ignore
public void testPackageRenameWithResource3() throws Exception {
  // regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=108019
  fIsPreDeltaTest = true;

  fQualifiedNamesFilePatterns = "*.txt";
  String textFileName = "Textfile.txt";

  String textfileContent =
      getFileContents(
          getTestPath() + name.getMethodName() + TEST_INPUT_INFIX + "my/pack/" + textFileName);
  IFolder myPackFolder =
      getRoot().getJavaProject().getProject().getFolder("my").getFolder("pack");
  CoreUtility.createFolder(myPackFolder, true, true, null);
  IFile textfile = myPackFolder.getFile(textFileName);
  textfile.create(new ByteArrayInputStream(textfileContent.getBytes()), true, null);

  helper2(new String[] {"my.pack", "my"}, new String[][] {{}, {}}, "my");

  InputStreamReader reader = new InputStreamReader(textfile.getContents(true));
  StringBuffer newContent = new StringBuffer();
  try {
    int ch;
    while ((ch = reader.read()) != -1) newContent.append((char) ch);
  } finally {
    reader.close();
  }
  String definedContent =
      getFileContents(
          getTestPath() + name.getMethodName() + TEST_OUTPUT_INFIX + "my/" + textFileName);
  assertEqualLines("invalid updating", definedContent, newContent.toString());
}
 
开发者ID:eclipse,项目名称:che,代码行数:34,代码来源:RenamePackageTest.java

示例4: createPackageFragmentRoot

import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入方法依赖的package包/类
private void createPackageFragmentRoot(IPackageFragmentRoot root) throws CoreException {
  final IJavaProject project = root.getJavaProject();
  if (!project.exists()) createJavaProject(project.getProject());
  final IFolder folder = project.getProject().getFolder(root.getElementName());
  if (!folder.exists()) CoreUtility.createFolder(folder, true, true, new NullProgressMonitor());
  final List<IClasspathEntry> list = Arrays.asList(project.getRawClasspath());
  list.add(JavaCore.newSourceEntry(folder.getFullPath()));
  project.setRawClasspath(
      list.toArray(new IClasspathEntry[list.size()]), new NullProgressMonitor());
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:LoggedCreateTargetQueries.java

示例5: createPackageFragmentRoot

import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入方法依赖的package包/类
private void createPackageFragmentRoot(IPackageFragmentRoot root) throws CoreException {
	final IJavaProject project= root.getJavaProject();
	if (!project.exists())
		createJavaProject(project.getProject());
	final IFolder folder= project.getProject().getFolder(root.getElementName());
	if (!folder.exists())
		CoreUtility.createFolder(folder, true, true, new NullProgressMonitor());
	final List<IClasspathEntry> list= Arrays.asList(project.getRawClasspath());
	list.add(JavaCore.newSourceEntry(folder.getFullPath()));
	project.setRawClasspath(list.toArray(new IClasspathEntry[list.size()]), new NullProgressMonitor());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:LoggedCreateTargetQueries.java

示例6: createPackageFragmentRoot

import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入方法依赖的package包/类
public void createPackageFragmentRoot(IProgressMonitor monitor) throws CoreException, InterruptedException {
	if (monitor == null) {
		monitor= new NullProgressMonitor();
	}
	monitor.beginTask(NewWizardMessages.NewSourceFolderWizardPage_operation, 3);
	try {
		IPath projPath= fCurrJProject.getProject().getFullPath();
		if (fOutputLocation.equals(projPath) && !fNewOutputLocation.equals(projPath)) {
			if (BuildPathsBlock.hasClassfiles(fCurrJProject.getProject())) {
				if (BuildPathsBlock.getRemoveOldBinariesQuery(getShell()).doQuery(false, projPath)) {
					BuildPathsBlock.removeOldClassfiles(fCurrJProject.getProject());
				}
			}
		}

		String relPath= fRootDialogField.getText();

		IFolder folder= fCurrJProject.getProject().getFolder(relPath);
		if (!folder.exists()) {
			CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 1));
		}
		if (monitor.isCanceled()) {
			throw new InterruptedException();
		}

		fCurrJProject.setRawClasspath(fNewEntries, fNewOutputLocation, new SubProgressMonitor(monitor, 2));

		fCreatedRoot= fCurrJProject.getPackageFragmentRoot(folder);
	} finally {
		monitor.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:33,代码来源:NewSourceFolderWizardPage.java

示例7: createJavaProject

import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入方法依赖的package包/类
/**
 * Creates a IJavaProject.
 * 
 * @param projectName
 *            The name of the project
 * @param binFolderName
 *            Name of the output folder
 * @return Returns the Java project handle
 * @throws CoreException
 *             Project creation failed
 */
public static IJavaProject createJavaProject(String projectName, String binFolderName) throws CoreException {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IProject project = root.getProject(projectName);
    if (!project.exists()) {
        project.create(null);
    } else {
        project.refreshLocal(IResource.DEPTH_INFINITE, null);
    }

    if (!project.isOpen()) {
        project.open(null);
    }

    IPath outputLocation;
    if (binFolderName != null && binFolderName.length() > 0) {
        IFolder binFolder = project.getFolder(binFolderName);
        if (!binFolder.exists()) {
            CoreUtility.createFolder(binFolder, false, true, null);
        }
        outputLocation = binFolder.getFullPath();
    } else {
        outputLocation = project.getFullPath();
    }

    if (!project.hasNature(JavaCore.NATURE_ID)) {
        addNatureToProject(project, JavaCore.NATURE_ID, null);
    }

    IJavaProject jproject = JavaCore.create(project);

    jproject.setOutputLocation(outputLocation, null);
    jproject.setRawClasspath(new IClasspathEntry[0], null);

    return jproject;
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:47,代码来源:JavaProjectHelper.java

示例8: createJavaProject

import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入方法依赖的package包/类
/**
 * Creates a IJavaProject.
 *
 * @param projectName The name of the project
 * @param binFolderName Name of the output folder
 * @return Returns the Java project handle
 * @throws CoreException Project creation failed
 */
public static IJavaProject createJavaProject(String projectName, String binFolderName)
    throws CoreException {
  IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
  IProject project = root.getProject(projectName);
  if (!project.exists()) {
    project.create(null);
  } else {
    project.refreshLocal(IResource.DEPTH_INFINITE, null);
  }

  if (!project.isOpen()) {
    project.open(null);
  }

  IPath outputLocation;
  if (binFolderName != null && binFolderName.length() > 0) {
    IFolder binFolder = project.getFolder(binFolderName);
    if (!binFolder.exists()) {
      CoreUtility.createFolder(binFolder, false, true, null);
    }
    outputLocation = binFolder.getFullPath();
  } else {
    outputLocation = project.getFullPath();
  }

  IFolder codenvyFolder = project.getFolder(".che");
  if (!codenvyFolder.exists()) {
    CoreUtility.createFolder(codenvyFolder, false, true, null);
  }

  //		if (!project.hasNature(JavaCore.NATURE_ID)) {
  //			addNatureToProject(project, JavaCore.NATURE_ID, null);
  //		}

  IJavaProject jproject = JavaCore.create(project);
  //		jproject.setOutputLocation(outputLocation, null);
  jproject.setRawClasspath(new IClasspathEntry[0], null);
  IFolder folder = project.getFolder(JavaProject.INNER_DIR);
  CoreUtility.createFolder(folder, true, true, null);

  return jproject;
}
 
开发者ID:eclipse,项目名称:che,代码行数:51,代码来源:JavaProjectHelper.java


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