/** * Constructs an {@link IApiTypeContainer} rooted at the location. * * @param parent the {@link IApiElement} parent for this container * @param container folder in the workspace */ public ProjectTypeContainer(IApiElement parent, IContainer container) { super(parent, IApiElement.API_TYPE_CONTAINER, container.getName()); this.fRoot = container; }
/** * Return the full pathname of a container. * * @param container org.eclipse.core.resources.Container * @return java.lang.String */ public static String getContainerText(IContainer container) { String name = container.getName(); while (container != null && !(container instanceof IProject)) { container = container.getParent(); name = container.getName() + "/" + name; } return name; }
public String toString() { int packageLength = this.getClass().getPackage().getName().length() + 1; StringBuffer buffer = new StringBuffer(this.getClass().getName().substring(packageLength)); buffer.append(", Source Container: "); //$NON-NLS-1$ buffer.append(sourceContainer.getName()); return buffer.toString(); }
public String getParentName() { if (resource != null) { return resource.getParent().getName(); } else { return file.getParentFile().getName(); } }
@Override public String getName() { return getContainer().getName(); }
public String getContainerName() { if (resource != null) { if (resource.getType() == IResource.FILE) { return resource.getParent().getName(); } else { return resource.getName(); } } else { if (file.isFile()) { return file.getParentFile().getName(); } else { return file.getName(); } } }
/** * Initialize page. */ void initializePage() { String temp = ""; temp = insd.getMainComponentId(); if (temp == null || temp.trim().length() == 0) compID = currentContainer.getName(); else compID = temp; temp = insd.getMainComponentDesc(); compDescriptorPath = temp == null ? "" : removeMacros(temp); }
@Override public String getMemento(ISourceContainer container) throws CoreException { ProjectSourceContainer project = (ProjectSourceContainer) container; Document document = newDocument(); Element element = document.createElement("project"); //$NON-NLS-1$ element.setAttribute("name", project.getContainer().getName()); //$NON-NLS-1$ String referenced = "false"; //$NON-NLS-1$ if (project.isSearchReferencedProjects()) { referenced = "true"; //$NON-NLS-1$ } element.setAttribute("referencedProjects", referenced); //$NON-NLS-1$ document.appendChild(element); return serializeDocument(document); }
private static IJavaProject getJavaProject(final IContainer container) { if (container != null) { if (container instanceof IProject) { final IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); return model.getJavaProject(container.getName()); } return getJavaProject(container.getParent()); } return null; }
public String getName() { return Messages.format(RefactoringCoreMessages.CopyResourceString_copy, new String[]{getResource().getFullPath().toString(), getDestination().getName()}); } }
public static IModule getAutomaticModule(ClasspathLocation location) { if (location instanceof ClasspathJar) { ClasspathJar classpathJar = (ClasspathJar) location; return IModule.createAutomatic(classpathJar.zipFilename, true, classpathJar.getManifest()); } if (location instanceof ClasspathDirectory) { return IModule.createAutomatic(((ClasspathDirectory) location).binaryFolder.getName(), false, null); } return null; } private void initModule(ClasspathLocation location) {
public static IModule getAutomaticModule(ClasspathLocation location) { if (location instanceof ClasspathJar) { ClasspathJar classpathJar = (ClasspathJar) location; return IModule.createAutomatic(classpathJar.zipFilename, true, classpathJar.getManifest()); } if (location instanceof ClasspathDirectory) { return IModule.createAutomatic(((ClasspathDirectory) location).binaryFolder.getName(), false, null); } return null; } private void initModule(ClasspathLocation location) {
public String getName() { return Messages.format(RefactoringCoreMessages.MoveResourceChange_move, new String[]{getResource().getFullPath().toString(), getDestination().getName()}); } }
@Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { if (getProject() != null) { configuration.setAttribute(DotnetRunDelegate.PROJECT_FOLDER, getProject().getName()); } String programArgs = programArgsText.getText(); configuration.setAttribute(DotnetRunDelegate.PROJECT_ARGUMENTS, programArgs); }
public int compare(Viewer viewer, Object o1, Object o2) { if (o1 instanceof FullPathSyncInfoElement && o2 instanceof FullPathSyncInfoElement) { IResource r1 = ((FullPathSyncInfoElement)o1).getResource(); IResource r2 = ((FullPathSyncInfoElement)o2).getResource(); if(resourceCriteria == NAME) return compareNames(r1.getName(), r2.getName()); else if(resourceCriteria == PATH) return compareNames(r1.getFullPath().toString(), r2.getFullPath().toString()); else if(resourceCriteria == PARENT_NAME) return compareNames(r1.getParent().getName(), r2.getParent().getName()); else return 0; } else if (o1 instanceof ISynchronizeModelElement) return 1; else if (o2 instanceof ISynchronizeModelElement) return -1; return 0; }
protected IFile getFile(IResource resource, String containingFolderName, String fileName) throws CoreException { if (resource == null || !resource.exists()) { return null; } if (resource instanceof IFile && resource.getName().equals(fileName) && resource.getParent() != null && resource.getParent().getName().equals(containingFolderName)) { return (IFile) resource; } else if (resource instanceof IContainer) { IContainer container = (IContainer) resource; IResource[] children = container.members(); if (children != null) { for (IResource child : children) { IFile file = getFile(child, containingFolderName, fileName); if (file != null) { return file; } } } } return null; } }
@Override public int compare(Viewer viewer, Object o1, Object o2) { if (o1 instanceof FullPathSyncInfoElement && o2 instanceof FullPathSyncInfoElement) { IResource r1 = ((FullPathSyncInfoElement)o1).getResource(); IResource r2 = ((FullPathSyncInfoElement)o2).getResource(); if(resourceCriteria == NAME) return compareNames(r1.getName(), r2.getName()); else if(resourceCriteria == PATH) return compareNames(r1.getFullPath().toString(), r2.getFullPath().toString()); else if(resourceCriteria == PARENT_NAME) return compareNames(r1.getParent().getName(), r2.getParent().getName()); else return 0; } else if (o1 instanceof ISynchronizeModelElement) return 1; else if (o2 instanceof ISynchronizeModelElement) return -1; return 0; }
public boolean visit(IResourceProxy proxy) throws CoreException { boolean visitMembers = true; if (proxy.getType() == IResource.FILE) { if (proxy.getName().endsWith(".tld")) { //$NON-NLS-1$ updateTLD(proxy.requestResource(), ITaglibIndexDelta.ADDED); } else if (proxy.getName().endsWith(".jar")) { //$NON-NLS-1$ updateJAR(proxy.requestResource(), ITaglibIndexDelta.ADDED); } else if (proxy.getName().endsWith(".tag") || proxy.getName().endsWith(".tagx")) { //$NON-NLS-1$ //$NON-NLS-2$ updateTagDir(proxy.requestResource().getParent(), ITaglibIndexDelta.ADDED); // any folder with these files will create a record for // that folder in one pass visitMembers = false; } else if (proxy.getName().equals(WEB_XML) && proxy.requestResource().getParent().getName().equals(WEB_INF)) { updateWebXML(proxy.requestResource(), ITaglibIndexDelta.ADDED); } } String name = proxy.getName(); return name.length() != 0 && name.charAt(0) != '.' && visitMembers; } }
private void addMainClass(IProgressMonitor monitor, IDataModel model, IProject project) { try { IDataModel mainClassDataModel = DataModelFactory.createDataModel(NewJavaClassDataModelProvider.class); mainClassDataModel.setProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME, project.getName()); mainClassDataModel.setProperty(INewJavaClassDataModelProperties.CLASS_NAME, "Main"); //$NON-NLS-1$ mainClassDataModel.setBooleanProperty(INewJavaClassDataModelProperties.MAIN_METHOD, true); IContainer container = J2EEProjectUtilities.getSourceFolderOrFirst(project, null); if( container != null ){ String projRelativeSourcePath = IPath.SEPARATOR + project.getName() + IPath.SEPARATOR + container.getName(); mainClassDataModel.setProperty(INewJavaClassDataModelProperties.SOURCE_FOLDER, projRelativeSourcePath); mainClassDataModel.getDefaultOperation().execute(monitor, null); createManifestEntryForMainClass(monitor, model, project); } } catch (Exception e) { e.printStackTrace(); } }
protected ClasspathElement createElement(IVirtualComponent referencingArchive, IVirtualReference referencedArchive, String cpEntry) { ClasspathElement element = new ClasspathElement(referencingArchive); element.setValid(true); String uriString = referencedArchive.getArchiveName(); element.setText(uriString); element.setTargetComponent(referencedArchive.getReferencedComponent()); element.setEarProject(earProject); if( earComponent != null ){ IContainer earConentFolder = earComponent.getRootFolder().getUnderlyingFolder(); if( earConentFolder.getType() == IResource.FOLDER ){ element.setEarContentFolder( earConentFolder.getName()); }else { element.setEarContentFolder( "" ); } } setProjectValues(element, referencedArchive); if (cpEntry != null) element.setValuesSelected(cpEntry); setType(element, referencedArchive); return element; }