IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); 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(path); } }
public RemoveFolderFromIndex(IPath folderPath, char[][] inclusionPatterns, char[][] exclusionPatterns, IProject project, IndexManager manager) { super(project.getFullPath(), manager); this.folderPath = folderPath; this.inclusionPatterns = inclusionPatterns; this.exclusionPatterns = exclusionPatterns; } @Override
public IndexAllProject(IProject project, IndexManager manager) { super(project.getFullPath(), manager); this.project = project; } @Override
/** * @see IJavaElement */ @Override public IPath getPath() { return this.project.getFullPath(); }
public IndexAllProject(IProject project, IndexManager manager) { super(project.getFullPath(), manager); this.project = project; } public boolean equals(Object o) {
public AddFolderToIndex(IPath folderPath, IProject project, char[][] inclusionPatterns, char[][] exclusionPatterns, IndexManager manager) { super(project.getFullPath(), manager); this.folderPath = folderPath; this.project = project; this.inclusionPatterns = inclusionPatterns; this.exclusionPatterns = exclusionPatterns; } @Override
/** * Returns a default class path. * This is the root of the project */ protected IClasspathEntry[] defaultClasspath() { return new IClasspathEntry[] { JavaCore.newSourceEntry(this.project.getFullPath())}; }
/** * Returns a default output location. * This is the project bin folder */ protected IPath defaultOutputLocation() { return this.project.getFullPath().append("bin"); //$NON-NLS-1$ }
/** * Removes index file for the given project. */ private void removeIndex(IProject project) { File indexFile = new File(computeIndexLocation(project.getFullPath())); if (indexFile.exists()) { indexFile.delete(); } }
@Override public int hashCode() { return super.hashCode() * 31 + project.getFullPath().hashCode(); } }
/** * The project is being deleted. Delete all meta-data associated with the * project. */ public void delete(IProject target) throws CoreException { IPath path = locationFor(target); if (!Workspace.clear(path.toFile()) && path.toFile().exists()) { String message = NLS.bind(Messages.resources_deleteMeta, target.getFullPath()); throw new ResourceException(IResourceStatus.FAILED_DELETE_METADATA, target.getFullPath(), message, null); } }
/** * The project is being deleted. Delete all meta-data associated with the * project. */ public void delete(IProject target) throws CoreException { IPath path = locationFor(target); if (!Workspace.clear(path.toFile()) && path.toFile().exists()) { String message = NLS.bind(Messages.resources_deleteMeta, target.getFullPath()); throw new ResourceException(IResourceStatus.FAILED_DELETE_METADATA, target.getFullPath(), message, null); } }
/** * Encodes the workspace location of the given Eclipse project as a variable expression. * * @param project the project name to encode, must not be null * @return the project reference as a variable expression, never null */ public static String encodeWorkspaceLocation(IProject project) { return getStringVariableManager().generateVariableExpression(WORKSPACE_LOC_VARIABLE, project.getFullPath().toString()); }
private SourceFolderUpdater(IJavaProject project, List<EclipseSourceDirectory> sourceDirectories) { this.project = Preconditions.checkNotNull(project); this.sourceFoldersByPath = Maps.newLinkedHashMap(); for (EclipseSourceDirectory sourceFolder : sourceDirectories) { IPath fullPath = project.getProject().getFullPath().append(sourceFolder.getPath()); this.sourceFoldersByPath.put(fullPath, sourceFolder); } }
private IResource getFile() { String value = text.getText(); if (value.length() == 0) return null; IPath path = getProject().getFullPath().append(value); return getProject().getWorkspace().getRoot().findMember(path); }
private static void indexCompilationUnitSync(ICompilationUnit icu) { IJavaProject jp = icu.getJavaProject(); IndexManager im = JavaModelManager.getIndexManager(); IPath containerPath = jp.getProject().getFullPath(); SourceElementParser parser = im.getSourceElementParser(jp, null/*requestor will be set by indexer*/); im.addSource((IFile) icu.getResource(), containerPath, parser); AbstractJob.waitForJobFamily(containerPath.toString()); }
private IPath getOutputLocation(IJavaProject javaProject) { try { return javaProject.getOutputLocation(); } catch (CoreException e) { IProject project= javaProject.getProject(); IPath projPath= project.getFullPath(); return projPath.append(PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.SRCBIN_BINNAME)); } }
public static class ClasspathResolutionBreakpointListener { public void breakpoint(int bp) { // override in listener implementation } }
private IResource getUnderlyingDirectory(EclipseSourceDirectory directory) { IProject project = this.project.getProject(); IPath path = project.getFullPath().append(directory.getPath()); if (path.segmentCount() == 1) { return project; } return project.getFolder(path.removeFirstSegments(1)); }
private CPListElement[] openNewClassFolderDialog(CPListElement existing) { String title= (existing == null) ? NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_new_title : NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_edit_title; IProject currProject= fCurrJProject.getProject(); NewContainerDialog dialog= new NewContainerDialog(getShell(), title, currProject, getUsedContainers(existing), existing); IPath projpath= currProject.getFullPath(); dialog.setMessage(Messages.format(NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_description, BasicElementLabels.getPathLabel(projpath, false))); if (dialog.open() == Window.OK) { IFolder folder= dialog.getFolder(); return new CPListElement[] { newCPLibraryElement(folder) }; } return null; }