本文整理匯總了Java中org.eclipse.core.resources.IWorkspace.newProjectDescription方法的典型用法代碼示例。如果您正苦於以下問題:Java IWorkspace.newProjectDescription方法的具體用法?Java IWorkspace.newProjectDescription怎麽用?Java IWorkspace.newProjectDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.resources.IWorkspace
的用法示例。
在下文中一共展示了IWorkspace.newProjectDescription方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createProjectPluginResource
import org.eclipse.core.resources.IWorkspace; //導入方法依賴的package包/類
public IProject createProjectPluginResource(String projectName, IProgressMonitor monitor) throws CoreException {
IWorkspace myWorkspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot myWorkspaceRoot = myWorkspace.getRoot();
IProject resourceProject = myWorkspaceRoot.getProject(projectName);
if (!resourceProject.exists()) {
if(myWorkspaceRoot.getLocation().toFile().equals(new Path(Engine.PROJECTS_PATH).toFile())){
logDebug("createProjectPluginResource : project is in the workspace folder");
resourceProject.create(monitor);
}else{
logDebug("createProjectPluginResource: project isn't in the workspace folder");
IPath projectPath = new Path(Engine.PROJECTS_PATH + "/" + projectName).makeAbsolute();
IProjectDescription description = myWorkspace.newProjectDescription(projectName);
description.setLocation(projectPath);
resourceProject.create(description, monitor);
}
}
return resourceProject;
}
示例2: createLinkedProject
import org.eclipse.core.resources.IWorkspace; //導入方法依賴的package包/類
public IProject createLinkedProject(String projectName, Plugin plugin, IPath linkPath) throws CoreException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = workspace.getRoot().getProject(projectName);
IProjectDescription desc = workspace.newProjectDescription(projectName);
File file = getFileInPlugin(plugin, linkPath);
IPath projectLocation = new Path(file.getAbsolutePath());
if (Platform.getLocation().equals(projectLocation))
projectLocation = null;
desc.setLocation(projectLocation);
project.create(desc, NULL_MONITOR);
if (!project.isOpen())
project.open(NULL_MONITOR);
return project;
}
示例3: importProject
import org.eclipse.core.resources.IWorkspace; //導入方法依賴的package包/類
private static IProject importProject(File probandsFolder, String projectName, boolean prepareDotProject)
throws Exception {
File projectSourceFolder = new File(probandsFolder, projectName);
if (!projectSourceFolder.exists()) {
throw new IllegalArgumentException("proband not found in " + projectSourceFolder);
}
if (prepareDotProject) {
prepareDotProject(projectSourceFolder);
}
IProgressMonitor monitor = new NullProgressMonitor();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProjectDescription newProjectDescription = workspace.newProjectDescription(projectName);
IProject project = workspace.getRoot().getProject(projectName);
project.create(newProjectDescription, monitor);
project.open(monitor);
if (!project.getLocation().toFile().exists()) {
throw new IllegalArgumentException("test project correctly created in " + project.getLocation());
}
IOverwriteQuery overwriteQuery = new IOverwriteQuery() {
@Override
public String queryOverwrite(String file) {
return ALL;
}
};
ImportOperation importOperation = new ImportOperation(project.getFullPath(), projectSourceFolder,
FileSystemStructureProvider.INSTANCE, overwriteQuery);
importOperation.setCreateContainerStructure(false);
importOperation.run(monitor);
return project;
}
示例4: performFinish
import org.eclipse.core.resources.IWorkspace; //導入方法依賴的package包/類
@Override
public boolean performFinish() {
try {
createdProject = _askProjectNamePage.getProjectHandle();
final String languageName = _askLanguageNamePage.getLanguageName();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
final IProjectDescription description = workspace.newProjectDescription(createdProject.getName());
if (!_askProjectNamePage.getLocationPath().equals(workspace.getRoot().getLocation()))
description.setLocation(_askProjectNamePage.getLocationPath());
//description.setLocationURI(_askProjectNamePage.getLocationURI());
IWorkspaceRunnable operation = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
createdProject.create(description, monitor);
createdProject.open(monitor);
initializeProject(createdProject, languageName);
createdProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
createdProject.touch(new NullProgressMonitor()); // [FT] One touch to force eclipse to serialize the project properties that will update accordingly the gemoc actions in the menu.
//createdProject.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
}
};
ResourcesPlugin.getWorkspace().run(operation, null);
} catch (CoreException exception) {
Activator.error(exception.getMessage(), exception);
return false;
}
return true;
}
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:31,代碼來源:AbstractCreateNewGemocLanguageProject.java
示例5: moveProjectPluginResource
import org.eclipse.core.resources.IWorkspace; //導入方法依賴的package包/類
public void moveProjectPluginResource(String projectName, String newName) throws CoreException {
cacheIProject.remove(projectName);
IWorkspace myWorkspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot myWorkspaceRoot = myWorkspace.getRoot();
IProject resourceProject = myWorkspaceRoot.getProject(projectName);
if (resourceProject.exists()) {
IPath newProjectPath = new Path(Engine.PROJECTS_PATH + "/" + newName).makeAbsolute();
IProjectDescription description = myWorkspace.newProjectDescription(newName);
description.setLocation(newProjectPath);
resourceProject.move(description, false, null);
}
}
示例6: EclipseProjectInfo
import org.eclipse.core.resources.IWorkspace; //導入方法依賴的package包/類
public EclipseProjectInfo(final File projectDescriptionFile, final IWorkspace workspace) {
Check.notNull(projectDescriptionFile, "projectDescriptionFile"); //$NON-NLS-1$
Check.notNull(workspace, "workspace"); //$NON-NLS-1$
this.projectDescriptionFilePath = LocalPath.canonicalize(projectDescriptionFile.getPath());
this.projectFolderPath = LocalPath.getParent(projectDescriptionFilePath);
this.workspace = workspace;
if (projectDescriptionFile.exists()) {
if (isTopLevelFolder()) {
// if the project is inside of the Eclipse workspace use its
// folder
// name as the project name
projectName = LocalPath.getFileName(projectFolderPath);
description = workspace.newProjectDescription(projectName);
} else {
try {
final IPath path = new Path(projectDescriptionFilePath);
description = workspace.loadProjectDescription(path);
projectName = description.getName();
} catch (final CoreException e) {
description = null;
damaged = true;
projectName = LocalPath.getFileName(projectFolderPath);
}
}
} else {
this.description = null;
this.projectName = LocalPath.getFileName(this.projectFolderPath);
}
}
示例7: execute
import org.eclipse.core.resources.IWorkspace; //導入方法依賴的package包/類
@Override
public void execute(IProgressMonitor monitor) throws InvocationTargetException, CoreException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject newProject = config.getProject();
URI location = config.getEclipseProjectLocationUri();
String name = newProject.getName();
IProjectDescription description = workspace.newProjectDescription(name);
description.setLocationURI(location);
String operationLabel = getDescription();
SubMonitor subMonitor = SubMonitor.convert(monitor, operationLabel, 120);
CreateProjectOperation operation = new CreateProjectOperation(description, operationLabel);
try {
operation.execute(subMonitor.newChild(10), uiInfoAdapter);
mostImportant = createAndConfigureProjectContent(newProject, config, subMonitor.newChild(80));
} catch (ExecutionException ex) {
throw new InvocationTargetException(ex);
}
IFacetedProject facetedProject = ProjectFacetsManager.create(
newProject, true /* convertIfNecessary */, subMonitor.newChild(5));
addAppEngineFacet(facetedProject, subMonitor.newChild(6));
addAdditionalDependencies(newProject, config, subMonitor.newChild(20));
fixTestSourceDirectorySettings(newProject, subMonitor.newChild(5));
}
示例8: run
import org.eclipse.core.resources.IWorkspace; //導入方法依賴的package包/類
@Override
public void run(String[] params, ICheatSheetManager manager) {
if (params == null || params[0] == null) {
return;
}
IWorkspace workspace = ResourcesPlugin.getWorkspace();
String projectName = params[0];
String zipName = params[1];
IProjectDescription newProjectDescription = workspace.newProjectDescription(projectName);
IProject newProject = workspace.getRoot().getProject(projectName);
try {
newProject.create(newProjectDescription, null);
newProject.open(null);
URL url = this.getClass().getClassLoader().getResource(zipName);
File f = new File(FileLocator.toFileURL(url).getPath());
IOverwriteQuery overwriteQuery = new IOverwriteQuery() {
public String queryOverwrite(String file) {
System.out.println(file);
return ALL;
}
};
FileSystemStructureProvider provider = FileSystemStructureProvider.INSTANCE;
File root = createTempDirectory();
unzip(f.getAbsolutePath(), root.getAbsolutePath());
List<File> files = readFiles(root.getAbsolutePath());
ImportOperation importOperation = new ImportOperation(newProject.getFullPath(), root, provider,
overwriteQuery, files);
importOperation.setCreateContainerStructure(false);
importOperation.run(new NullProgressMonitor());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}