當前位置: 首頁>>代碼示例>>Java>>正文


Java IProject.getFullPath方法代碼示例

本文整理匯總了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;
}
 
開發者ID:Nielko,項目名稱:MBSE-Vacation-Manager,代碼行數:25,代碼來源:ExportHandler.java

示例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;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:36,代碼來源:ProjectUtils.java

示例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();
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:42,代碼來源:ProjectImport.java


注:本文中的org.eclipse.core.resources.IProject.getFullPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。