本文整理汇总了Java中org.eclipse.jdt.internal.ui.util.CoreUtility类的典型用法代码示例。如果您正苦于以下问题:Java CoreUtility类的具体用法?Java CoreUtility怎么用?Java CoreUtility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CoreUtility类属于org.eclipse.jdt.internal.ui.util包,在下文中一共展示了CoreUtility类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: performFinish
import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入依赖的package包/类
/**
* Called from the wizard on finish.
*
* @param monitor the progress monitor
* @throws CoreException thrown when the project creation or configuration failed
* @throws InterruptedException thrown when the user cancelled the project creation
*/
public void performFinish(IProgressMonitor monitor) throws CoreException, InterruptedException {
try {
monitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_operation_create, 3);
if (fCurrProject == null) {
updateProject(new SubProgressMonitor(monitor, 1));
}
String newProjectCompliance= fKeepContent ? null : fFirstPage.getCompilerCompliance();
configureJavaProject(newProjectCompliance, new SubProgressMonitor(monitor, 2));
} finally {
monitor.done();
fCurrProject= null;
if (fIsAutobuild != null) {
CoreUtility.setAutoBuilding(fIsAutobuild.booleanValue());
fIsAutobuild= null;
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:NewJavaProjectWizardPageTwo.java
示例3: getPage
import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入依赖的package包/类
private JavadocExportWizardPage getPage() {
if (fPage == null) {
try {
Object elem= CoreUtility.createExtension(fConfigElement, ATT_PAGE_CLASS);
if (elem instanceof JavadocExportWizardPage) {
fPage= (JavadocExportWizardPage) elem;
fPage.setContainer(this);
statusUpdated();
return fPage;
}
} catch (CoreException e) {
JavaPlugin.log(e);
}
fPage= new ErrorJavadocExportWizardPage();
}
return fPage;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:ContributedJavadocWizardPage.java
示例4: 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
示例5: 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
示例6: 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
示例7: setOutputLocationToWebInfClasses
import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入依赖的package包/类
/**
* Sets the project's default output directory to the WAR output directory's
* WEB-INF/classes folder. If the WAR output directory does not have a WEB-INF
* directory, this method returns without doing anything.
*
* @throws CoreException if there's a problem setting the output directory
*/
public static void setOutputLocationToWebInfClasses(IJavaProject javaProject,
IProgressMonitor monitor) throws CoreException {
IProject project = javaProject.getProject();
IFolder webInfOut = getWebInfOut(project);
if (!webInfOut.exists()) {
// If the project has no output <WAR>/WEB-INF directory, don't touch the
// output location
return;
}
IPath oldOutputPath = javaProject.getOutputLocation();
IPath outputPath = webInfOut.getFullPath().append("classes");
if (!outputPath.equals(oldOutputPath)) {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
// Remove old output location and contents
IFolder oldOutputFolder = workspaceRoot.getFolder(oldOutputPath);
if (oldOutputFolder.exists()) {
try {
removeOldClassfiles(oldOutputFolder);
} catch (Exception e) {
CorePluginLog.logError(e);
}
}
// Create the new output location if necessary
IFolder outputFolder = workspaceRoot.getFolder(outputPath);
if (!outputFolder.exists()) {
// TODO: Could move recreate this in a utilities class
CoreUtility.createDerivedFolder(outputFolder, true, true, null);
}
javaProject.setOutputLocation(outputPath, monitor);
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:45,代码来源:WebAppUtilities.java
示例8: 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
示例9: doRemoveProject
import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入依赖的package包/类
private final void doRemoveProject(IProgressMonitor monitor) throws InvocationTargetException {
final boolean noProgressMonitor= (fCurrProjectLocation == null); // inside workspace
if (monitor == null || noProgressMonitor) {
monitor= new NullProgressMonitor();
}
monitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_operation_remove, 3);
try {
try {
URI projLoc= fCurrProject.getLocationURI();
boolean removeContent= !fKeepContent && fCurrProject.isSynchronized(IResource.DEPTH_INFINITE);
if (!removeContent) {
restoreExistingFolders(projLoc);
}
fCurrProject.delete(removeContent, false, new SubProgressMonitor(monitor, 2));
restoreExistingFiles(projLoc, new SubProgressMonitor(monitor, 1));
} finally {
CoreUtility.setAutoBuilding(fIsAutobuild.booleanValue()); // fIsAutobuild must be set
fIsAutobuild= null;
}
} catch (CoreException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
fCurrProject= null;
fKeepContent= false;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:NewJavaProjectWizardPageTwo.java
示例10: 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
示例11: getInstance
import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入依赖的package包/类
public ClasspathAttributeConfiguration getInstance() throws CoreException {
if (fInstance == null) {
Object elem= CoreUtility.createExtension(fConfigElement, ATT_CLASS);
if (elem instanceof ClasspathAttributeConfiguration) {
fInstance= (ClasspathAttributeConfiguration) elem;
} else {
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, 0, "Invalid extension (page not of type IClasspathContainerPage): " + getKey(), null)); //$NON-NLS-1$
}
}
return fInstance;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:ClasspathAttributeConfigurationDescriptors.java
示例12: 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
示例13: 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
示例14: aboutToPerformHistory
import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected RefactoringStatus aboutToPerformHistory(final IProgressMonitor monitor) {
final RefactoringStatus status= new RefactoringStatus();
try {
fJavaProject= null;
fSourceFolder= null;
fProcessedFragments.clear();
monitor.beginTask(JarImportMessages.JarImportWizard_prepare_import, 520);
status.merge(super.aboutToPerformHistory(new SubProgressMonitor(monitor, 10, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
if (!status.hasFatalError()) {
final IPackageFragmentRoot root= getPackageFragmentRoot();
if (root != null) {
status.merge(checkPackageFragmentRoots(root, new SubProgressMonitor(monitor, 90, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
if (!status.hasFatalError()) {
status.merge(checkSourceAttachmentRefactorings(new SubProgressMonitor(monitor, 20, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
if (!status.hasFatalError()) {
final IJavaProject project= root.getJavaProject();
if (project != null) {
final IFolder folder= project.getProject().getFolder(SOURCE_FOLDER + String.valueOf(System.currentTimeMillis()));
try {
fAutoBuild= CoreUtility.setAutoBuilding(false);
final RefactoringHistory history= getRefactoringHistory();
if (history != null && !history.isEmpty())
configureClasspath(project, root, folder, new SubProgressMonitor(monitor, 300, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
} catch (CoreException exception) {
status.merge(RefactoringStatus.createFatalErrorStatus(exception.getLocalizedMessage()));
try {
project.setRawClasspath(project.readRawClasspath(), false, new SubProgressMonitor(monitor, 100, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
} catch (CoreException throwable) {
JavaPlugin.log(throwable);
}
} finally {
if (!status.hasFatalError()) {
fJavaProject= project;
fSourceFolder= folder;
}
}
}
}
}
}
}
} finally {
monitor.done();
}
return status;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:51,代码来源:BinaryRefactoringHistoryWizard.java
示例15: run
import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入依赖的package包/类
public void run(IProgressMonitor monitor) throws CoreException {
boolean needsBuild= updateJRE(monitor);
if (needsBuild) {
fUpdateJob= CoreUtility.getBuildJob(fChangeOnWorkspace ? null : fProject.getProject());
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:ReorgCorrectionsSubProcessor.java
示例16: processChanges
import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入依赖的package包/类
protected boolean processChanges(IWorkbenchPreferenceContainer container) {
IScopeContext currContext= fLookupOrder[0];
List<Key> changedOptions= new ArrayList<Key>();
boolean needsBuild= getChanges(currContext, changedOptions);
if (changedOptions.isEmpty()) {
return true;
}
if (needsBuild) {
int count= getRebuildCount();
if (count > fRebuildCount) {
needsBuild= false; // build already requested
fRebuildCount= count;
}
}
boolean doBuild= false;
if (needsBuild) {
String[] strings= getFullBuildDialogStrings(fProject == null);
if (strings != null) {
if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length == 0) {
doBuild= true; // don't bother the user
} else {
MessageDialog dialog= new MessageDialog(getShell(), strings[0], null, strings[1], MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2);
int res= dialog.open();
if (res == 0) {
doBuild= true;
} else if (res != 1) {
return false; // cancel pressed
}
}
}
}
if (container != null) {
// no need to apply the changes to the original store: will be done by the page container
if (doBuild) { // post build
incrementRebuildCount();
container.registerUpdateJob(CoreUtility.getBuildJob(fProject));
}
} else {
// apply changes right away
try {
fManager.applyChanges();
} catch (BackingStoreException e) {
JavaPlugin.log(e);
return false;
}
if (doBuild) {
CoreUtility.getBuildJob(fProject).schedule();
}
}
return true;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:56,代码来源:OptionsConfigurationBlock.java
示例17: createWizard
import org.eclipse.jdt.internal.ui.util.CoreUtility; //导入依赖的package包/类
@Override
protected INewWizard createWizard() throws CoreException {
return (INewWizard) CoreUtility.createExtension(fConfigurationElement, ATT_CLASS);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:NewTypeDropDownAction.java
注:本文中的org.eclipse.jdt.internal.ui.util.CoreUtility类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论