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


Java Project类代码示例

本文整理汇总了Java中org.eclipse.core.internal.resources.Project的典型用法代码示例。如果您正苦于以下问题:Java Project类的具体用法?Java Project怎么用?Java Project使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Project类属于org.eclipse.core.internal.resources包,在下文中一共展示了Project类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateProjectPathDep

import org.eclipse.core.internal.resources.Project; //导入依赖的package包/类
/**
 * 
 * @param selecteProjectPath
 */
private void updateProjectPathDep(String selecteProjectPath) {
	try {
		String[] tokens;
		if (selecteProjectPath.indexOf("/") == -1)
			tokens = selecteProjectPath.split("\\");
		else
			tokens = selecteProjectPath.split("/");

		IProject newProject = ResourcesPlugin.getWorkspace().getRoot()
				.getProject(tokens[1]);
		fillComboWithComponents((Project) newProject);
	} catch (Exception ex) {

	}
}
 
开发者ID:aspose-total,项目名称:Aspose.Total-for-Java,代码行数:20,代码来源:NewFileWizardPage.java

示例2: updateLinkedResources

import org.eclipse.core.internal.resources.Project; //导入依赖的package包/类
private static void updateLinkedResources(final IProject project, final String newName) {
	/*
	 * IProject#getDescription() returns a clone of the ProjectDescription
	 * which is missing some components, such as linked resources.
	 */
	Project projectImpl = ((Project) project);
	Map<IPath, LinkDescription> links = projectImpl.internalGetDescription().getLinks();
	if (links == null) {
		return;
	}

	try {
		for (LinkDescription link : links.values()) {
			String oldLinkLocation = link.getLocationURI().toString();
			String newLinkLocation = oldLinkLocation.replace(project.getName(), newName);
			link.setLocationURI(new URI(newLinkLocation));
		}
	} catch (URISyntaxException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:22,代码来源:RefactoringSupport.java

示例3: getImage

import org.eclipse.core.internal.resources.Project; //导入依赖的package包/类
@Override
public Image getImage(Object element) {
	if(element instanceof Project) {
		Project project = (Project) element;
		
		try {
			if(project.hasNature(Knuddels.NATURE_ID)) {
				return Activator.getImageDescriptor("icons/project_knuddels.png").createImage();
			} else if(project.hasNature(KFramework.NATURE_ID)) {
				return Activator.getImageDescriptor("icons/project_kframework.png").createImage();				
			}
		} catch(Exception e) {
			/* Do Nothing */
		}
	}
	
	return null;
}
 
开发者ID:MyChannel-Apps,项目名称:Extensions,代码行数:19,代码来源:LabelProvider.java

示例4: testCreateModuleStoreRelativePath

import org.eclipse.core.internal.resources.Project; //导入依赖的package包/类
public void testCreateModuleStoreRelativePath() throws IOException, CoreException {
	// Need a per invocation temp directory to avoid writing to the same
	// .project file over and over again.
	final File tempDirectory = createTempDirectory();

	// Create...
	final File specFile = new File(tempDirectory + File.separator + "TestSpecName.tla");
	specFile.createNewFile();
	final Spec spec = Spec.createNewSpec("TestSpecName", specFile.getAbsolutePath(), false,
			new NullProgressMonitor());

	final AddModuleHandler addModuleHandler = new AddModuleHandler();
	final File moduleFileRaw = new File(tempDirectory + File.separator + "TestModuleName.tla");
	moduleFileRaw.createNewFile();
	final IFile moduleFile = addModuleHandler.createModuleFile(spec, "TestModuleName",
			new Path(moduleFileRaw.getAbsolutePath()));

	// ...check
	assertNotNull(moduleFile);
	assertTrue(moduleFile.isAccessible());
	assertTrue(moduleFile.isLinked());

	// could use non-internal alternative
	// project.getWorkspace().loadProjectDescription(path) instead, but then
	// need to known path to .project file
	assertTrue(spec.getProject() instanceof Project);
	final Project project = (Project) spec.getProject();
	final ProjectDescription description = project.internalGetDescription();
	final ProjectDescription pd = (ProjectDescription) description;
	final HashMap<IPath, LinkDescription> links = pd.getLinks();
	assertEquals(2, links.size()); // spec + module
	for (LinkDescription linkDescription : links.values()) {
		final URI uri = linkDescription.getLocationURI();
		assertTrue(uri.toASCIIString().startsWith(ResourceHelper.PARENT_ONE_PROJECT_LOC));
	}
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:37,代码来源:AddModuleHandlerTest.java

示例5: selectWorkspaceDir

import org.eclipse.core.internal.resources.Project; //导入依赖的package包/类
private String selectWorkspaceDir() {

		String result = null;
		ILabelProvider lp = new WorkbenchLabelProvider();
		ITreeContentProvider cp = new WorkbenchContentProvider();

		ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
				getShell(), lp, cp);
		dialog.setValidator(null);
		dialog.setAllowMultiple(false);
		dialog.setTitle("Select base directory to add"); //$NON-NLS-1$
		dialog.setMessage("msg?"); //$NON-NLS-1$
		ViewerFilter filter = new ViewerFilter() {
			public boolean select(Viewer viewer, Object parentElement,
					Object element) {
				boolean ok = (element instanceof Folder)
						|| (element instanceof Project);
				return ok;
			}
		};
		dialog.addFilter(filter);

		dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
		dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

		if (dialog.open() == ElementTreeSelectionDialog.OK) {
			Object[] elements = dialog.getResult();
			if (elements.length == 1) {
				result = ((IResource) elements[0]).getFullPath().toOSString();
			}
		}
		return result;
	}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:34,代码来源:FJExportWizardFilesSelectPage.java

示例6: selectWorkspaceDir

import org.eclipse.core.internal.resources.Project; //导入依赖的package包/类
private String selectWorkspaceDir() {

        String result = null;
        ILabelProvider lp= new WorkbenchLabelProvider();
        ITreeContentProvider cp= new WorkbenchContentProvider();

        ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(
                getShell(), lp, cp);
        dialog.setValidator(null);
        dialog.setAllowMultiple(false);
        dialog.setTitle("Select base directory to add"); //$NON-NLS-1$
        dialog.setMessage("msg?"); //$NON-NLS-1$
        ViewerFilter filter = new ViewerFilter() {
            public boolean select(Viewer viewer, Object parentElement, Object element) {
                boolean ok = (element instanceof Folder) || (element instanceof Project);
                return ok;
            }
        };
        dialog.addFilter(filter);
        
        dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());   
        dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

        if (dialog.open() == ElementTreeSelectionDialog.OK) {
            Object[] elements= dialog.getResult();
            if (elements.length == 1) {
                result = ((IResource)elements[0]).getFullPath().toOSString();
            }
        }
        return result;
    }
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:32,代码来源:FilesSelectPage.java

示例7: fillComboWithComponents

import org.eclipse.core.internal.resources.Project; //导入依赖的package包/类
/**
 * 
 * @param project
 */
private void fillComboWithComponents(Project project) {
	if (null != project) {
		if (AsposeJavaComponents.list.size() == 0) {
			AsposeJavaComponents components = new AsposeJavaComponents();
		}
		componentSelection.removeAll();
		for (AsposeJavaComponent component : AsposeJavaComponents.list
				.values()) {
			if (null != project.findMember("/lib/" + component.get_name())) {
				componentSelection.add(component.get_name());
			}
		}
	}
}
 
开发者ID:aspose-total,项目名称:Aspose.Total-for-Java,代码行数:19,代码来源:NewFileWizardPage.java

示例8: refreshContentTypeMatcher

import org.eclipse.core.internal.resources.Project; //导入依赖的package包/类
private void refreshContentTypeMatcher(IProject project) {
	ProjectInfo info = (ProjectInfo) ((Project) project).getResourceInfo(false, true);
	info.setMatcher(null);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:5,代码来源:SaveAsWizard.java

示例9: selectionChanged

import org.eclipse.core.internal.resources.Project; //导入依赖的package包/类
/**
 * 实现方法
 * 
 * @param action
 *            action
 * @param selection
 *            selection
 */
public void selectionChanged(IAction action, ISelection selection) {
	Object obj = ((IStructuredSelection) selection).getFirstElement();
	if (obj instanceof Project || obj instanceof JavaProject) {
		heaProjectModel = new HeaProjectModel(selection);
	}
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:15,代码来源:UpdateLibsAction.java


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