本文整理汇总了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) {
}
}
示例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);
}
}
示例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;
}
示例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));
}
}
示例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;
}
示例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;
}
示例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());
}
}
}
}
示例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);
}
示例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);
}
}