本文整理匯總了Java中org.eclipse.core.resources.IProject.getFullPath方法的典型用法代碼示例。如果您正苦於以下問題:Java IProject.getFullPath方法的具體用法?Java IProject.getFullPath怎麽用?Java IProject.getFullPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.resources.IProject
的用法示例。
在下文中一共展示了IProject.getFullPath方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
/*MessageDialog.openInformation(
window.getShell(),
"Plugin",
"Hello, Eclipse world");*/
// Pfad vom Projekt
if (window != null)
{
IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection();
Object firstElement = selection.getFirstElement();
if (firstElement instanceof IAdaptable)
{
IProject project = (IProject)((IAdaptable)firstElement).getAdapter(IProject.class);
IPath path = project.getFullPath();
System.out.println("Projekt: "+path);
StartEGL.start(""+path);
}
}
return null;
}
示例2: importProject
import org.eclipse.core.resources.IProject; //導入方法依賴的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;
}
示例3: run
import org.eclipse.core.resources.IProject; //導入方法依賴的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();
}
}