@OpenApiAll
public class ProjectUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXPORTER_DESCRIPTION
Property for XmiExporterDescription
|
protected static java.util.Map<IProject,XmiExporterDescription> |
mExporterDescriptions |
protected static java.lang.String |
REMOTE_ID_ENCODING |
Constructor and Description |
---|
ProjectUtilities() |
Modifier and Type | Method and Description |
---|---|
protected static void |
addToCache(IProject project,
XmiExporterDescription xmiExporterDescription) |
protected static void |
addToCacheLoaded(IProject project,
XmiExporterDescription xmiExporterDescription)
Adds to cache just loaded modules/projects
|
static int |
compareVersionNumber(java.lang.String versionNumber1,
java.lang.String versionNumber2)
Compare given version numbers.
|
static int |
compareVersions(IVersionDescriptor versionDescriptor1,
IVersionDescriptor versionDescriptor2)
Compare given versions descriptors.
|
static ProjectAttachmentConfiguration |
createDefaultProjectAttachmentConfiguration(org.eclipse.emf.common.util.URI uri)
Create default project attachment configuration with default settings.
|
static java.lang.String |
decodeTeamworkRemoteId(java.lang.String remoteId)
Decodes Teamwork remote ID
|
static java.lang.String |
encodeTeamworkRemoteId(java.lang.String remoteId)
Encodes Teamwork remote ID
|
static IAttachedProject |
findAttachedProjectByID(IProject project,
java.lang.String moduleID,
boolean recursively)
Find attached project by given id in a given project
|
static IAttachedProject |
findAttachedProjectByID(Project project,
java.lang.String moduleID)
Find attached project by given id in a given project.
|
static IAttachedProject |
findAttachedProjectByID(Project project,
java.lang.String moduleID,
boolean recursively)
Find attached project by given id in a given project
|
static IAttachedProject |
findAttachedProjectByName(Project project,
java.lang.String name)
Find attached project by given name in a given project.
|
static IAttachedProject |
findAttachedProjectByName(Project project,
java.lang.String name,
boolean recursively)
Find attached project by given name in a given project
|
static IAttachedProject |
findAttachedProjectByProjectID(IProject project,
java.lang.String projectID,
boolean recursively)
Find attached project by given project id
|
static IProject |
findProjectByResourceID(IPrimaryProject primaryProject,
java.lang.String resourceId)
Search for project with given resource ID
|
static java.util.Collection<IAttachedProject> |
getAllAttachedProjects(java.util.Collection<IAttachedProject> projects)
Returns projects those are attached directly or indirectly to a given project.
|
static java.util.Collection<IAttachedProject> |
getAllAttachedProjects(IProject project)
Returns projects those are attached directly or indirectly to a given project.
|
static java.util.Collection<IAttachedProject> |
getAllAttachedProjects(Project project)
Return all modules in a given project
|
static java.util.Collection<IProject> |
getAllAttachedProjectsIncludingPrimary(IProject project)
Returns projects those are attached directly or indirectly to a given project including primary project.
|
static java.util.Set<com.nomagic.ci.persistence.mounting.IMountPoint> |
getAllMountPoints(IPrimaryProject project)
Deprecated.
|
static java.util.Collection<IProject> |
getAllProjects(Project project)
Return all modules and primary project in a given project
|
(package private) static java.util.Collection<Package> |
getAllShareRoots1(IProject project,
java.util.ArrayList<IProject> checked,
boolean recursively) |
static IAttachedProject |
getAttachedProject(org.eclipse.emf.ecore.EObject element)
Find attached project (module) for a given element
|
static IAttachedProject |
getAttachedProject(IProject project,
org.eclipse.emf.common.util.URI uri)
Look for direct or not direct attached project in a primary project of a given project.
|
static java.util.Collection<IAttachedProject> |
getAttachedProjects(IProject project)
Returns projects those are attached directly to a given project.
|
static java.util.Collection<IProject> |
getAttachedProjectsIncludingPrimary(IProject project)
Returns projects those are attached directly to a given project.Primary attached project can be included also.
|
static IProject |
getAttachingProject(IProject project)
Return first project where given project is attached.
|
static java.util.Collection<IProject> |
getAttachingProjects(IProject project)
Return all projects where given project is attached.
|
static AbstractProjectAttachmentConfiguration |
getAttachment(IProject parent,
IProject child)
Return configuration which is used to attach one project to another
|
static AutoLoadKind |
getAutoLoadKind(AbstractProjectAttachmentConfiguration attachment)
Return load kind of module from given attachment
|
static AutoLoadKind |
getAutoLoadKind(IProject owner,
IProject project)
Return load kind of given module in a given project
|
static AutoLoadKind |
getAutoLoadKind(ProjectAttachmentConfiguration attachment)
Deprecated.
use public static @Nonnull AutoLoadKind getAutoLoadKind(@Nonnull AbstractProjectAttachmentConfiguration attachment )
|
static java.lang.String |
getCompatibleVersion(IProject project)
Get compatible version of the project
|
static Element |
getElementFor(BaseElement element)
Return element for a given base element.
|
static org.eclipse.emf.common.util.URI |
getEMFURI(java.net.URI uri)
Convert java net URI to emf uri
|
static java.lang.String |
getESIRemoteId(IProject project)
Gets ESI remote ID for given project
|
static java.lang.String |
getESIRemoteId(org.eclipse.emf.common.util.URI uri)
Gets ESI remote ID
|
static XmiExporterDescription |
getExporterDescription(IProject project)
Provide information about project version and required resources/plugins for that project.
|
static java.lang.String |
getInternalVersion(IProject project)
Get internal version of project
|
static java.util.Set<Element> |
getModifiedElements(Project project)
Get modified elements.
|
static com.nomagic.ci.persistence.mounting.IMountPoint |
getMountPoint(java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint> points,
Package element)
Deprecated.
|
static java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint> |
getMountPoints(IProject project)
Gets all mount points in given project.
|
static java.util.Set<com.nomagic.ci.persistence.mounting.IMountPoint> |
getMountPointsFor(IProject owner,
IProject attachedProject)
Gets mount points for given project, i.e.
|
static IProject |
getOwner(IProject project)
Deprecated.
|
static java.util.Collection<IProject> |
getOwners(IProject project)
Deprecated.
|
static IProject |
getProject(org.eclipse.emf.ecore.EObject object)
Return project in which object resists.
|
static Project |
getProject(IProject iProject)
Returns MagicDraw project for primary or attached project.
|
static IProject |
getProject(org.eclipse.emf.ecore.resource.Resource resource)
Return project for a resource.
|
static IProject |
getProjectFor(BaseElement element)
Find IProject for a given element
|
static java.lang.String |
getRemoteID(IProject project)
Return remote id for a given project
|
static java.lang.String |
getRemoteId(org.eclipse.emf.common.util.URI uri)
Retrieves project remote id from given uri.
|
static java.lang.String |
getRemoteID(org.eclipse.emf.common.util.URI uri)
Extract remote project id from a given uri.
|
static java.lang.String |
getResourceID(IProject project)
Gets simplified resource id for given project.
|
static java.lang.String |
getResourceID(ProjectDescriptor pd)
Gets simplified resource id for given project descriptor.
|
static java.lang.String |
getResourceID(org.eclipse.emf.common.util.URI uri)
Gets simplified resource id for given project location URI.
|
static java.util.Collection<Package> |
getSharedPackages(IProject project)
Return shared packages of a given project.
|
static java.util.Collection<Package> |
getSharedPackagesIncludingReshared(IProject project)
Return shared packages of a given project.
|
static java.util.Collection<Package> |
getSharedPackagesIncludingResharedRecursively(IProject project)
Return shared packages of a given project.
|
static com.nomagic.ci.persistence.sharing.ISharePoint |
getSharePoint(com.nomagic.ci.persistence.mounting.IMountPoint point)
Deprecated.
|
static java.lang.String |
getTeamworkRemoteId(IProject project)
Get teamwork project remote id.
|
static java.lang.String |
getTeamworkRemoteId(org.eclipse.emf.common.util.URI uri)
Get teamwork project id.
|
static java.net.URI |
getURI(org.eclipse.emf.common.util.URI emfUFI)
Convert EMF uri to java.net.URI
|
static IVersionDescriptor |
getVersion(IProject project)
Return version of given project.
|
static java.util.List<java.lang.String> |
getVersionTags(IProject project)
Return a list of version tags.
|
static java.lang.String |
getVisibleURI(java.net.URI uri)
Creates uri that can be shown in UI components
|
static java.lang.String |
getVisibleURI(org.eclipse.emf.common.util.URI uri)
Creates uri that can be shown in UI components
|
static boolean |
isAttachedProjectRoot(Element element)
Check if given element is a root of some module.
|
static boolean |
isAttachedProjectRoot(Element element,
IAttachedProject project)
Check if given element is a root of given module.
|
static boolean |
isElementInAttachedProject(Element element)
Check if given element belongs to some module
|
static boolean |
isElementProxy(BaseElement element)
Checks if given element is proxy or orphan proxy.
|
static boolean |
isESIUri(org.eclipse.emf.common.util.URI uri)
Checks if given
URI is ESI project
URI |
static boolean |
isESIUri(java.net.URI uri)
Checks if given
URI is ESI project URI |
static boolean |
isFromEsiServer(IProject project)
Check if given project is from ESI.
|
static boolean |
isFromStandardProfile(Element element)
Checks, if the given element is a part of the Standard Profile
|
static boolean |
isFromStandardProfile(org.eclipse.emf.ecore.EObject element)
Checks if element comes from standard profile
|
static boolean |
isFromTeamworkServer(IProject project)
Check if given project is from teamwork server.
|
static boolean |
isLoaded(IProject project)
Checks if given project loaded.
|
static boolean |
isLoadedOrLoading(IProject project) |
static boolean |
isLoadIndex(AbstractProjectAttachmentConfiguration configuration)
Check if to load index.
|
static boolean |
isLoadIndex(ProjectAttachmentConfiguration configuration)
Deprecated.
use public static boolean isLoadIndex(@Nonnull AbstractProjectAttachmentConfiguration configuration)
|
static boolean |
isModule(DecompositionDescriptor r)
Deprecated.
|
static boolean |
isModuleUsageNew(IProject attProj)
Check if attached project usage from primary project is new (not yet committed to server).
|
static boolean |
isMountedPackage(Package pck)
Check if given package is a mounted(or is a shared root from some module)
|
static boolean |
isRemote(IProject project)
Check if given project is remote - from teamwork server or ESI.
|
static boolean |
isRemote(org.eclipse.emf.common.util.URI uri)
Check if given URI is remote project uri.
|
static boolean |
isSharedElement(IProject project,
Element element)
Check if given element belongs to some shared (or reshared) package in a given project
|
static boolean |
isStandardSystemProfile(DecompositionDescriptor project)
Deprecated.
|
static boolean |
isStandardSystemProfile(IProject project)
Check if given project is a standard system profile
|
static boolean |
isTeamworkUri(org.eclipse.emf.common.util.URI uri)
Check if given URI is teamwork project URI.
|
static void |
setLoadIndex(AbstractProjectAttachmentConfiguration configuration,
boolean loadIndex)
Set if to load index.
|
static void |
updateConfigurationWithDefaultValues(ProjectAttachmentConfiguration configuration)
Updates attachment configuration with default values
|
static int |
versionToInt(java.lang.String version)
Utility method to convert string representation of version into int
|
static java.lang.String |
versionToString(int version)
Utility method to convert int representation of version into string
|
protected static java.util.Map<IProject,XmiExporterDescription> mExporterDescriptions
public static final java.lang.String EXPORTER_DESCRIPTION
protected static final java.lang.String REMOTE_ID_ENCODING
public static ProjectAttachmentConfiguration createDefaultProjectAttachmentConfiguration(@Nonnull org.eclipse.emf.common.util.URI uri)
uri
- uripublic static void updateConfigurationWithDefaultValues(ProjectAttachmentConfiguration configuration)
configuration
- the configuration to update@Deprecated public static boolean isLoadIndex(@Nonnull ProjectAttachmentConfiguration configuration)
configuration
- attachment configuration.public static boolean isLoadIndex(@Nonnull AbstractProjectAttachmentConfiguration configuration)
configuration
- attachment configuration.public static void setLoadIndex(@Nonnull AbstractProjectAttachmentConfiguration configuration, boolean loadIndex)
configuration
- attachment configuration.loadIndex
- load index.@CheckReturnValue @CheckForNull public static IAttachedProject getAttachedProject(@CheckForNull org.eclipse.emf.ecore.EObject element)
element
- element for which attached project will be returned@CheckForNull public static IProject getProjectFor(@Nonnull BaseElement element)
element
- element for which attached project will be returned@CheckForNull public static IAttachedProject findAttachedProjectByID(@Nonnull Project project, @Nonnull java.lang.String moduleID, boolean recursively)
project
- project to search inmoduleID
- module idrecursively
- search in primary project only or recursively in whole project@CheckForNull public static IAttachedProject findAttachedProjectByID(@Nonnull IProject project, @Nonnull java.lang.String moduleID, boolean recursively)
project
- project to search inmoduleID
- module idrecursively
- search in primary project only or recursively in whole project@CheckForNull public static IAttachedProject findAttachedProjectByProjectID(@Nonnull IProject project, @Nonnull java.lang.String projectID, boolean recursively)
project
- project to search inprojectID
- module idrecursively
- search in primary project only or recursively in whole project@CheckForNull public static IProject findProjectByResourceID(@Nonnull IPrimaryProject primaryProject, @Nonnull java.lang.String resourceId)
primaryProject
- scope of searchingresourceId
- resource ID.@CheckForNull public static IAttachedProject findAttachedProjectByName(@Nonnull Project project, @Nonnull java.lang.String name, boolean recursively)
project
- project to search inname
- module namerecursively
- search in primary project only or recursively in whole project@CheckForNull public static IAttachedProject findAttachedProjectByName(@Nonnull Project project, @Nonnull java.lang.String name)
project
- project to search inname
- module name@CheckForNull public static IAttachedProject findAttachedProjectByID(@Nonnull Project project, @Nonnull java.lang.String moduleID)
project
- project to search inmoduleID
- module idpublic static boolean isAttachedProjectRoot(@CheckForNull Element element)
element
- elementpublic static boolean isAttachedProjectRoot(@CheckForNull Element element, IAttachedProject project)
element
- elementproject
- module@Nonnull public static java.util.Collection<Package> getSharedPackages(@Nonnull IProject project)
project
- project@Nonnull public static java.util.Collection<Package> getSharedPackagesIncludingReshared(@Nonnull IProject project)
project
- project@Nonnull public static java.util.Collection<Package> getSharedPackagesIncludingResharedRecursively(@Nonnull IProject project)
project
- projectstatic java.util.Collection<Package> getAllShareRoots1(IProject project, java.util.ArrayList<IProject> checked, boolean recursively)
public static boolean isElementInAttachedProject(@Nonnull Element element)
element
- element@Nonnull public static java.util.Collection<IAttachedProject> getAllAttachedProjects(@Nonnull Project project)
project
- project@Nonnull public static java.util.Collection<IProject> getAllProjects(@Nonnull Project project)
project
- projectpublic static boolean isSharedElement(@Nonnull IProject project, @Nonnull Element element)
project
- projectelement
- element@CheckForNull public static java.lang.String getRemoteID(@Nonnull org.eclipse.emf.common.util.URI uri)
uri
- uri@CheckForNull public static java.lang.String getRemoteID(@Nonnull IProject project)
project
- projectpublic static int versionToInt(@CheckForNull java.lang.String version)
version
- version@CheckForNull public static java.lang.String versionToString(int version)
version
- version@Nonnull public static java.lang.String getResourceID(@Nonnull IProject project)
project
- project descriptor@Nonnull public static java.lang.String getResourceID(@Nonnull ProjectDescriptor pd)
pd
- project descriptor@Nonnull public static java.lang.String getResourceID(@Nonnull org.eclipse.emf.common.util.URI uri)
uri
- project location.@Nonnull public static java.util.Collection<IAttachedProject> getAttachedProjects(@Nonnull IProject project)
project
- project@Nonnull public static java.util.Collection<IAttachedProject> getAllAttachedProjects(@Nonnull IProject project)
project
- project@Nonnull public static java.util.Collection<IProject> getAllAttachedProjectsIncludingPrimary(@Nonnull IProject project)
project
- projectpublic static java.util.Collection<IAttachedProject> getAllAttachedProjects(java.util.Collection<IAttachedProject> projects)
projects
- project projects@Nonnull public static java.util.Collection<IProject> getAttachedProjectsIncludingPrimary(@Nonnull IProject project)
project
- project@Nonnull public static AutoLoadKind getAutoLoadKind(@Nonnull IProject owner, @Nonnull IProject project)
owner
- projectproject
- module@Deprecated @Nonnull public static AutoLoadKind getAutoLoadKind(@Nonnull ProjectAttachmentConfiguration attachment)
attachment
- attachment@Nonnull public static AutoLoadKind getAutoLoadKind(@Nonnull AbstractProjectAttachmentConfiguration attachment)
attachment
- attachment@CheckForNull public static IProject getAttachingProject(@Nonnull IProject project)
project
- given projectpublic static java.util.Collection<IProject> getAttachingProjects(@Nonnull IProject project)
project
- given project.@CheckForNull @Deprecated public static IProject getOwner(@Nonnull IProject project)
getAttachingProject(com.nomagic.ci.persistence.IProject)
@Deprecated public static java.util.Collection<IProject> getOwners(@Nonnull IProject project)
getAttachingProjects(com.nomagic.ci.persistence.IProject)
@Nonnull public static org.eclipse.emf.common.util.URI getEMFURI(@Nonnull java.net.URI uri)
uri
- net uri@CheckForNull public static AbstractProjectAttachmentConfiguration getAttachment(@Nonnull IProject parent, @Nonnull IProject child)
parent
- project which uses another project (directly)child
- used directly projectProjectAttachmentConfiguration
(for local and teamwork projects) or
EsiProjectAttachmentConfiguration
(for CEDW projects) or null if such not found.@Nonnull public static java.net.URI getURI(@Nonnull org.eclipse.emf.common.util.URI emfUFI)
emfUFI
- emf uri@CheckForNull public static IVersionDescriptor getVersion(@Nonnull IProject project)
project
- project@CheckForNull public static java.util.List<java.lang.String> getVersionTags(@Nonnull IProject project)
project
- projectpublic static boolean isFromTeamworkServer(@Nonnull IProject project)
project
- projectpublic static boolean isFromEsiServer(@Nonnull IProject project)
project
- projectpublic static boolean isRemote(@Nonnull IProject project)
project
- projectpublic static boolean isFromStandardProfile(@Nonnull Element element)
element
- element to check@CheckForNull public static Project getProject(@CheckForNull IProject iProject)
iProject
- primary or attached projectProject
@Deprecated @CheckForNull public static com.nomagic.ci.persistence.mounting.IMountPoint getMountPoint(@Nonnull java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint> points, @Nonnull Package element)
points
- mount pointselement
- package@Deprecated @CheckForNull public static com.nomagic.ci.persistence.sharing.ISharePoint getSharePoint(@Nonnull com.nomagic.ci.persistence.mounting.IMountPoint point)
point
- mount point@CheckForNull public static java.lang.String getTeamworkRemoteId(@Nonnull IProject project)
project
- project.@CheckForNull public static java.lang.String getTeamworkRemoteId(@Nonnull org.eclipse.emf.common.util.URI uri)
uri
- uri.public static java.lang.String encodeTeamworkRemoteId(@Nonnull java.lang.String remoteId)
remoteId
- the raw (not encoded) remote IDpublic static java.lang.String decodeTeamworkRemoteId(@Nonnull java.lang.String remoteId)
remoteId
- the encoded remote IDpublic static boolean isTeamworkUri(@Nonnull org.eclipse.emf.common.util.URI uri)
uri
- uri to check.public static boolean isESIUri(@Nonnull org.eclipse.emf.common.util.URI uri)
URI
is ESI project
URI
uri
- the URI
to checktrue
if given URI
is ESI,
false
otherwisepublic static boolean isESIUri(@Nonnull java.net.URI uri)
URI
is ESI project URI
uri
- the URI
to checktrue
if given URI
is ESI,
false
otherwisepublic static boolean isElementProxy(@Nonnull BaseElement element)
element
- the element to checktrue
if given element is proxy or orphan proxy, otherwise - false
@CheckForNull public static java.lang.String getESIRemoteId(@Nonnull org.eclipse.emf.common.util.URI uri)
uri
- the URI
to get remote ID
for@CheckForNull public static java.lang.String getESIRemoteId(@Nonnull IProject project)
project
- the projectpublic static boolean isRemote(@Nonnull org.eclipse.emf.common.util.URI uri)
uri
- uri to check.@CheckReturnValue @CheckForNull public static java.lang.String getRemoteId(@Nonnull org.eclipse.emf.common.util.URI uri)
uri
- remote project uri to check.@Nonnull public static java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint> getMountPoints(@Nonnull IProject project)
project
- projectnull
set of all mount points
@Nonnull public static java.util.Set<com.nomagic.ci.persistence.mounting.IMountPoint> getMountPointsFor(@Nonnull IProject owner, @Nonnull IProject attachedProject)
owner
- ownerattachedProject
- the project to get mount points fornull
set of mount points
for specific project@Deprecated @Nonnull public static java.util.Set<com.nomagic.ci.persistence.mounting.IMountPoint> getAllMountPoints(@Nonnull IPrimaryProject project)
project
- project@CheckForNull public static IProject getProject(@CheckForNull org.eclipse.emf.ecore.EObject object)
object
- object@CheckForNull public static IProject getProject(@CheckForNull org.eclipse.emf.ecore.resource.Resource resource)
resource
- resourcepublic static int compareVersions(@CheckForNull IVersionDescriptor versionDescriptor1, @CheckForNull IVersionDescriptor versionDescriptor2)
versionDescriptor1
- first version descriptor (can be null).versionDescriptor2
- second version descriptor (can be null).public static int compareVersionNumber(@CheckForNull java.lang.String versionNumber1, @CheckForNull java.lang.String versionNumber2)
versionNumber1
- first version number.versionNumber2
- second version number.@CheckForNull public static IAttachedProject getAttachedProject(@Nonnull IProject project, @Nonnull org.eclipse.emf.common.util.URI uri)
project
- projecturi
- uri@CheckForNull public static Element getElementFor(@CheckForNull BaseElement element)
element
- base elementpublic static boolean isMountedPackage(Package pck)
pck
- package@CheckForNull public static java.lang.String getInternalVersion(@Nonnull IProject project)
project
- project@CheckForNull public static java.lang.String getCompatibleVersion(@Nonnull IProject project)
project
- projectpublic static boolean isStandardSystemProfile(@Nonnull IProject project)
project
- project@Deprecated public static boolean isStandardSystemProfile(@Nonnull DecompositionDescriptor project)
project
- projectpublic static boolean isLoaded(@Nonnull IProject project)
project
- projectpublic static boolean isLoadedOrLoading(IProject project)
@Deprecated public static boolean isModule(DecompositionDescriptor r)
r
- project descriptor to evaluatepublic static boolean isFromStandardProfile(@CheckForNull org.eclipse.emf.ecore.EObject element)
element
- element to be checkedpublic static java.util.Set<Element> getModifiedElements(Project project)
project
- project to get elements of.@CheckForNull public static XmiExporterDescription getExporterDescription(@Nonnull IProject project)
project
- projectprotected static void addToCacheLoaded(IProject project, XmiExporterDescription xmiExporterDescription)
project
- project/modulexmiExporterDescription
- project/module descriptorprotected static void addToCache(IProject project, @CheckForNull XmiExporterDescription xmiExporterDescription)
public static boolean isModuleUsageNew(IProject attProj)
false
in that case.attProj
- the IProject
of attached projecttrue
if the provided project is attached project and it is a Teamwork Cloud Project
and if the usage from primary project to attached project exists and if it is new (as defined above).
Return false
otherwisepublic static java.lang.String getVisibleURI(java.net.URI uri)
uri
- project location uripublic static java.lang.String getVisibleURI(org.eclipse.emf.common.util.URI uri)
uri
- project location uri