public class SelectionUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
JAR_FILE |
static int |
POM_FILE |
static int |
PROJECT_WITH_NATURE |
static int |
PROJECT_WITHOUT_NATURE |
static int |
UNSUPPORTED |
static int |
WORKING_SET |
Constructor and Description |
---|
SelectionUtil() |
Modifier and Type | Method and Description |
---|---|
static ArtifactKey |
getArtifactKey(Object element) |
static int |
getElementType(Object element)
Checks which type the given element belongs to.
|
static org.apache.maven.project.MavenProject |
getMavenProject(org.eclipse.ui.IEditorInput editorInput,
org.eclipse.core.runtime.IProgressMonitor monitor) |
static org.eclipse.core.resources.IFile |
getPomFileFromPomEditorOrViewSelection(org.eclipse.jface.viewers.ISelection selection)
Finds the pom.xml from the given selection or the current active pom editor.
|
static org.eclipse.core.resources.IProject[] |
getProjects(org.eclipse.jface.viewers.ISelection selection,
boolean includeAll)
Returns all the Maven projects found in the given selection.
|
static org.eclipse.core.runtime.IPath |
getSelectedLocation(org.eclipse.jface.viewers.IStructuredSelection selection) |
static org.eclipse.ui.IWorkingSet |
getSelectedWorkingSet(org.eclipse.jface.viewers.IStructuredSelection selection) |
static int |
getSelectionType(org.eclipse.jface.viewers.IStructuredSelection selection)
Checks which type the given selection belongs to.
|
static <T> T |
getType(Object element,
Class<T> type)
Checks if the object belongs to a given type and returns it or a suitable adapter.
|
public static final int UNSUPPORTED
public static final int PROJECT_WITH_NATURE
public static final int PROJECT_WITHOUT_NATURE
public static final int POM_FILE
public static final int JAR_FILE
public static final int WORKING_SET
public static int getSelectionType(org.eclipse.jface.viewers.IStructuredSelection selection)
public static int getElementType(Object element)
public static <T> T getType(Object element, Class<T> type)
public static org.eclipse.core.runtime.IPath getSelectedLocation(org.eclipse.jface.viewers.IStructuredSelection selection)
public static org.eclipse.ui.IWorkingSet getSelectedWorkingSet(org.eclipse.jface.viewers.IStructuredSelection selection)
public static ArtifactKey getArtifactKey(Object element) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
public static org.apache.maven.project.MavenProject getMavenProject(org.eclipse.ui.IEditorInput editorInput, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
public static org.eclipse.core.resources.IFile getPomFileFromPomEditorOrViewSelection(org.eclipse.jface.viewers.ISelection selection)
selection
- null if no pom was found.
public static org.eclipse.core.resources.IProject[] getProjects(org.eclipse.jface.viewers.ISelection selection, boolean includeAll)
includeAll
is true, all workspace projects are returned.selection
- includeAll
- flag to return all workspace projects if selection doesn't contain any Maven projects.IProject
containing all the Maven projects found in the given selection, or all the
workspace projects if no Maven project was found and includeAll
is true.Copyright © 2005–2015 Sonatype, Inc.. All rights reserved.