Package com.nomagic.magicdraw.core
Class ProjectUtilities
- java.lang.Object
-
- com.nomagic.magicdraw.core.ProjectUtilities
-
@OpenApiAll public class ProjectUtilities extends java.lang.ObjectProject decomposition related utility class.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXPORTER_DESCRIPTIONProperty for XmiExporterDescriptionprotected static java.util.Map<IProject,XmiExporterDescription>mExporterDescriptionsprotected static java.lang.StringREMOTE_ID_ENCODING
-
Constructor Summary
Constructors Constructor Description ProjectUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static voidaddToCache(IProject project, XmiExporterDescription xmiExporterDescription)protected static voidaddToCacheLoaded(IProject project, XmiExporterDescription xmiExporterDescription)Adds to cache just loaded modules/projects(package private) static voidcollectSharedPackagesIncludingReshared(IProject project, java.util.Set<Package> result, java.util.Set<IProject> checked, boolean recursively)static intcompareVersionNumber(java.lang.String versionNumber1, java.lang.String versionNumber2)Compare given version numbers.static intcompareVersions(IVersionDescriptor versionDescriptor1, IVersionDescriptor versionDescriptor2)Compare given versions descriptors.static ProjectAttachmentConfigurationcreateDefaultProjectAttachmentConfiguration(org.eclipse.emf.common.util.URI uri)Create default project attachment configuration with default settings.static java.lang.StringdecodeTeamworkRemoteId(java.lang.String remoteId)Decodes Teamwork remote IDstatic java.lang.StringencodeTeamworkRemoteId(java.lang.String remoteId)Encodes Teamwork remote IDstatic IAttachedProjectfindAttachedProjectByID(IProject project, java.lang.String moduleID, boolean recursively)Find attached project by given id in a given projectstatic IAttachedProjectfindAttachedProjectByID(Project project, java.lang.String moduleID)Find attached project by given id in a given project.static IAttachedProjectfindAttachedProjectByID(Project project, java.lang.String moduleID, boolean recursively)Find attached project by given id in a given projectstatic IAttachedProjectfindAttachedProjectByName(Project project, java.lang.String name)Find attached project by given name in a given project.static IAttachedProjectfindAttachedProjectByName(Project project, java.lang.String name, boolean recursively)Find attached project by given name in a given projectprivate static IAttachedProjectfindAttachedProjectByName(Project project, java.util.Collection<java.lang.String> names, boolean recursively)Find attached project by given names in a given project.static IAttachedProjectfindAttachedProjectByProjectID(IProject project, java.lang.String projectID, boolean recursively)Find attached project by given project idstatic IProjectfindProjectByResourceID(IPrimaryProject primaryProject, java.lang.String resourceId)Search for project with given resource IDstatic 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 projectstatic 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<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.IMountPoint is not exposed into Open APIstatic java.util.Collection<IProject>getAllProjects(Project project)Return all modules and primary project in a given projectstatic IAttachedProjectgetAttachedProject(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 IAttachedProjectgetAttachedProject(org.eclipse.emf.ecore.EObject element)Find attached project (module) for a given elementstatic 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 IProjectgetAttachingProject(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 AbstractProjectAttachmentConfigurationgetAttachment(IProject parent, IProject child)Return configuration which is used to attach one project to anotherstatic AutoLoadKindgetAutoLoadKind(ProjectAttachmentConfiguration attachment)Deprecated.use public static AutoLoadKind getAutoLoadKind( AbstractProjectAttachmentConfiguration attachment )static AutoLoadKindgetAutoLoadKind(IProject owner, IProject project)Return load kind of given module in a given projectstatic AutoLoadKindgetAutoLoadKind(AbstractProjectAttachmentConfiguration attachment)Return load kind of module from given attachmentstatic java.lang.StringgetCompatibleVersion(IProject project)Get compatible version of the projectstatic ElementgetElementFor(BaseElement element)Return element for a given base element.static org.eclipse.emf.common.util.URIgetEMFURI(java.net.URI uri)Convert java net URI to emf uristatic java.lang.StringgetESIRemoteId(IProject project)Gets ESI remote ID for given projectstatic java.lang.StringgetESIRemoteId(org.eclipse.emf.common.util.URI uri)Gets ESI remote IDstatic XmiExporterDescriptiongetExporterDescription(IProject project)Provide information about project version and required resources/plugins for that project.private static <K,V>
VgetFromCache(com.nomagic.utils.DisableableCacheMap<K,V> map, K key1)static java.lang.StringgetInternalVersion(IProject project)Get internal version of projectstatic java.util.Set<Element>getModifiedElements(Project project)Get modified elements.static com.nomagic.ci.persistence.mounting.IMountPointgetMountPoint(java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint> points, Package element)Deprecated.com.nomagic.ci.persistence.mounting.IMountPoint is not exposed into Open APIstatic 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 IProjectgetOwner(IProject project)Deprecated.static java.util.Collection<IProject>getOwners(IProject project)Deprecated.static ProjectgetProject(IProject iProject)Returns MagicDraw project for primary or attached project.static IProjectgetProject(org.eclipse.emf.ecore.EObject object)Return project in which object resists.static IProjectgetProject(org.eclipse.emf.ecore.resource.Resource resource)Return project for a resource.static IProjectgetProjectFor(BaseElement element)Find IProject for a given elementstatic java.lang.StringgetRemoteId(org.eclipse.emf.common.util.URI uri)Retrieves project remote id from given uri.static java.lang.StringgetRemoteID(IProject project)Return remote id for a given projectstatic java.lang.StringgetRemoteID(org.eclipse.emf.common.util.URI uri)Extract remote project id from a given uri.static java.lang.StringgetResourceID(IProject project)Gets simplified resource id for given project.static java.lang.StringgetResourceID(ProjectDescriptor pd)Gets simplified resource id for given project descriptor.static java.lang.StringgetResourceID(org.eclipse.emf.common.util.URI uri)Gets simplified resource id for given project location URI.static java.lang.StringgetSaveID(IProject project)Gets current save/commit id for given project.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.ISharePointgetSharePoint(com.nomagic.ci.persistence.mounting.IMountPoint point)Deprecated.com.nomagic.ci.persistence.mounting.ISharePoint is not exposed into Open APIstatic java.net.URIgetURI(org.eclipse.emf.common.util.URI emfUFI)Convert EMF uri to java.net.URIstatic IVersionDescriptorgetVersion(IProject project)Return version of given project.static java.lang.StringgetVisibleURI(java.net.URI uri)Creates uri that can be shown in UI componentsstatic java.lang.StringgetVisibleURI(org.eclipse.emf.common.util.URI uri)Creates uri that can be shown in UI componentsstatic booleanisAttachedProjectRoot(Element element)Check if given element is a root of some module.static booleanisAttachedProjectRoot(Element element, IAttachedProject project)Check if given element is a root of given module.static booleanisElementInAttachedProject(Element element)Check if given element belongs to some modulestatic booleanisElementProxy(BaseElement element)Checks if given element is proxy or orphan proxy.static booleanisESIUri(java.net.URI uri)Checks if givenURIis ESI projectURIstatic booleanisESIUri(org.eclipse.emf.common.util.URI uri)Checks if givenURIis ESI projectURIstatic booleanisFromEsiServer(IProject project)Check if given project is from ESI.static booleanisFromStandardProfile(Element element)Checks, if the given element is a part of the Standard Profilestatic booleanisFromStandardProfile(org.eclipse.emf.ecore.EObject element)Checks if element comes from standard profilestatic booleanisFromTeamworkServer()Check if given project is from teamwork server.static booleanisLoaded(IProject project)Checks if given project loaded.static booleanisLoadedOrLoading(IProject project)static booleanisLoadIndex(AbstractProjectAttachmentConfiguration configuration)Check if to load index.static booleanisModule(DecompositionDescriptor r)Deprecated.DecompositionDescriptor is not exposed into Open APIprotected static booleanisModuleRoot(IAttachedProject iProject, Element element)static booleanisModuleUsageNew(IProject attachedProject)Check if attached project usage from primary project is new (not yet committed to server).static booleanisMountedPackage(Package pck)Check if given package is a mounted(or is a shared root from some module)static booleanisProjectNameValid(java.lang.String projectName)Checks if given project name is valid.static booleanisRemote(IProject project)Check if given project is remote - from teamwork server or ESI.static booleanisSharedElement(IProject project, Element element)Check if given element belongs to some shared (or reshared) package in a given projectstatic booleanisStandardSystemProfile(DecompositionDescriptor project)Deprecated.DecompositionDescriptor is not exposed into Open APIstatic booleanisStandardSystemProfile(IProject project)Check if given project is a standard system profileprivate static <K,V>
voidputToCache(com.nomagic.utils.DisableableCacheMap<K,V> map, K key1, V result)static voidsetLoadIndex(AbstractProjectAttachmentConfiguration configuration, boolean loadIndex)Set if to load index.static voidupdateConfigurationWithDefaultValues(ProjectAttachmentConfiguration configuration)Updates attachment configuration with default valuesstatic intversionToInt(java.lang.String version)Utility method to convert string representation of version into intprivate static longversionToLong(java.lang.String version, long latestVersionValue)Utility method to convert string representation of version into longstatic java.lang.StringversionToString(int version)Utility method to convert int representation of version into string
-
-
-
Field Detail
-
mExporterDescriptions
protected static java.util.Map<IProject,XmiExporterDescription> mExporterDescriptions
-
EXPORTER_DESCRIPTION
public static final java.lang.String EXPORTER_DESCRIPTION
Property for XmiExporterDescription- See Also:
- Constant Field Values
-
REMOTE_ID_ENCODING
protected static final java.lang.String REMOTE_ID_ENCODING
- See Also:
- Constant Field Values
-
-
Method Detail
-
createDefaultProjectAttachmentConfiguration
public static ProjectAttachmentConfiguration createDefaultProjectAttachmentConfiguration(org.eclipse.emf.common.util.URI uri)
Create default project attachment configuration with default settings.- Parameters:
uri- uri- Returns:
- attachment configuration
-
updateConfigurationWithDefaultValues
public static void updateConfigurationWithDefaultValues(ProjectAttachmentConfiguration configuration)
Updates attachment configuration with default values- Parameters:
configuration- the configuration to update
-
isLoadIndex
public static boolean isLoadIndex(AbstractProjectAttachmentConfiguration configuration)
Check if to load index.- Parameters:
configuration- attachment configuration.- Returns:
- true if option is set to load index.
-
setLoadIndex
public static void setLoadIndex(AbstractProjectAttachmentConfiguration configuration, boolean loadIndex)
Set if to load index.- Parameters:
configuration- attachment configuration.loadIndex- load index.
-
getAttachedProject
@CheckReturnValue @CheckForNull public static IAttachedProject getAttachedProject(@CheckForNull org.eclipse.emf.ecore.EObject element)
Find attached project (module) for a given element- Parameters:
element- element for which attached project will be returned- Returns:
- project or null if element does not belong to any module
-
getFromCache
@CheckForNull private static <K,V> V getFromCache(com.nomagic.utils.DisableableCacheMap<K,V> map, K key1)
-
putToCache
private static <K,V> void putToCache(com.nomagic.utils.DisableableCacheMap<K,V> map, K key1, V result)
-
getProjectFor
@CheckForNull public static IProject getProjectFor(@CheckForNull BaseElement element)
Find IProject for a given element- Parameters:
element- element for which attached project will be returned- Returns:
- project
-
findAttachedProjectByID
@CheckForNull public static IAttachedProject findAttachedProjectByID(Project project, java.lang.String moduleID, boolean recursively)
Find attached project by given id in a given project- Parameters:
project- project to search inmoduleID- module idrecursively- search in primary project only or recursively in whole project- Returns:
- found module
-
findAttachedProjectByID
@CheckForNull public static IAttachedProject findAttachedProjectByID(IProject project, java.lang.String moduleID, boolean recursively)
Find attached project by given id in a given project- Parameters:
project- project to search inmoduleID- module idrecursively- search in primary project only or recursively in whole project- Returns:
- found module
-
findAttachedProjectByProjectID
@CheckForNull public static IAttachedProject findAttachedProjectByProjectID(IProject project, java.lang.String projectID, boolean recursively)
Find attached project by given project id- Parameters:
project- project to search inprojectID- module idrecursively- search in primary project only or recursively in whole project- Returns:
- found module
-
findProjectByResourceID
@CheckForNull public static IProject findProjectByResourceID(IPrimaryProject primaryProject, java.lang.String resourceId)
Search for project with given resource ID- Parameters:
primaryProject- scope of searchingresourceId- resource ID.- Returns:
- found project or null.
-
findAttachedProjectByName
@CheckForNull public static IAttachedProject findAttachedProjectByName(Project project, java.lang.String name, boolean recursively)
Find attached project by given name in a given project- Parameters:
project- project to search inname- module namerecursively- search in primary project only or recursively in whole project- Returns:
- found module
-
findAttachedProjectByName
@CheckForNull private static IAttachedProject findAttachedProjectByName(Project project, java.util.Collection<java.lang.String> names, boolean recursively)
Find attached project by given names in a given project.- Parameters:
project- project to search innames- possible module namesrecursively- search in primary project only or recursively in whole project- Returns:
- found module
-
findAttachedProjectByName
@CheckForNull public static IAttachedProject findAttachedProjectByName(Project project, java.lang.String name)
Find attached project by given name in a given project. Does recursive search.- Parameters:
project- project to search inname- module name- Returns:
- found module
-
findAttachedProjectByID
@CheckForNull public static IAttachedProject findAttachedProjectByID(Project project, java.lang.String moduleID)
Find attached project by given id in a given project. Does recursive search.- Parameters:
project- project to search inmoduleID- module id- Returns:
- found module
-
isAttachedProjectRoot
public static boolean isAttachedProjectRoot(@CheckForNull Element element)Check if given element is a root of some module.- Parameters:
element- element- Returns:
- true if given element is root for module.
-
isAttachedProjectRoot
public static boolean isAttachedProjectRoot(@CheckForNull Element element, IAttachedProject project)Check if given element is a root of given module.- Parameters:
element- elementproject- module- Returns:
- true if given element is root for module
-
getSharedPackages
public static java.util.Collection<Package> getSharedPackages(IProject project)
Return shared packages of a given project. Does not include re-shared packages.- Parameters:
project- project- Returns:
- shared packages.
-
getSharedPackagesIncludingReshared
public static java.util.Collection<Package> getSharedPackagesIncludingReshared(IProject project)
Return shared packages of a given project. Include also re-shared packages- Parameters:
project- project- Returns:
- shared packages
-
getSharedPackagesIncludingResharedRecursively
public static java.util.Collection<Package> getSharedPackagesIncludingResharedRecursively(IProject project)
Return shared packages of a given project. Include also re-shared packages. Takes direct packages and also from attached modules recursively of a given project. For ESI project returns module model.- Parameters:
project- project- Returns:
- shared packages
-
collectSharedPackagesIncludingReshared
static void collectSharedPackagesIncludingReshared(IProject project, java.util.Set<Package> result, java.util.Set<IProject> checked, boolean recursively)
-
isElementInAttachedProject
public static boolean isElementInAttachedProject(Element element)
Check if given element belongs to some module- Parameters:
element- element- Returns:
- true if element belongs to some module
-
getAllAttachedProjects
public static java.util.Collection<IAttachedProject> getAllAttachedProjects(Project project)
Return all modules in a given project- Parameters:
project- project- Returns:
- all modules in the Project
-
getAllProjects
public static java.util.Collection<IProject> getAllProjects(Project project)
Return all modules and primary project in a given project- Parameters:
project- project- Returns:
- all modules in the Project, collection is not modifiable
-
isSharedElement
public static boolean isSharedElement(IProject project, Element element)
Check if given element belongs to some shared (or reshared) package in a given project- Parameters:
project- projectelement- element- Returns:
- true if element belongs to shared package
-
getRemoteID
@CheckForNull public static java.lang.String getRemoteID(org.eclipse.emf.common.util.URI uri)
Extract remote project id from a given uri.- Parameters:
uri- uri- Returns:
- remote if or null
-
getRemoteID
@CheckForNull public static java.lang.String getRemoteID(IProject project)
Return remote id for a given project- Parameters:
project- project- Returns:
- remote id
-
versionToInt
public static int versionToInt(@CheckForNull java.lang.String version)Utility method to convert string representation of version into int- Parameters:
version- version- Returns:
- version as int
-
versionToLong
private static long versionToLong(@CheckForNull java.lang.String version, long latestVersionValue)Utility method to convert string representation of version into long- Parameters:
version- versionlatestVersionValue- latest version- Returns:
- version as long. return latest version if given version is null or empty
-
versionToString
@CheckForNull public static java.lang.String versionToString(int version)
Utility method to convert int representation of version into string- Parameters:
version- version- Returns:
- version as string
-
getResourceID
public static java.lang.String getResourceID(IProject project)
Gets simplified resource id for given project. For remote project it returns project id, for local filename.- Parameters:
project- project descriptor- Returns:
- filename or project id.
-
getResourceID
public static java.lang.String getResourceID(ProjectDescriptor pd)
Gets simplified resource id for given project descriptor. For remote project it returns project id, for local filename.- Parameters:
pd- project descriptor- Returns:
- filename or project id.
-
getResourceID
public static java.lang.String getResourceID(org.eclipse.emf.common.util.URI uri)
Gets simplified resource id for given project location URI. For remote project it returns project id, for local filename.- Parameters:
uri- project location.- Returns:
- filename or project id.
-
getAttachedProjects
public static java.util.Collection<IAttachedProject> getAttachedProjects(IProject project)
Returns projects those are attached directly to a given project. Primary attached project is ignored.- Parameters:
project- project- Returns:
- collection of attached projects
-
getAllAttachedProjects
public static java.util.Collection<IAttachedProject> getAllAttachedProjects(IProject project)
Returns projects those are attached directly or indirectly to a given project. Primary attached project is ignored.- Parameters:
project- project- Returns:
- collection of attached projects
-
getAllAttachedProjectsIncludingPrimary
public static java.util.Collection<IProject> getAllAttachedProjectsIncludingPrimary(IProject project)
Returns projects those are attached directly or indirectly to a given project including primary project.- Parameters:
project- project- Returns:
- collection of attached projects
-
getAllAttachedProjects
public static java.util.Collection<IAttachedProject> getAllAttachedProjects(java.util.Collection<IAttachedProject> projects)
Returns projects those are attached directly or indirectly to a given project. Primary attached project is ignored.- Parameters:
projects- project projects- Returns:
- collection of attached projects
-
getAttachedProjectsIncludingPrimary
public 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.- Parameters:
project- project- Returns:
- collection of attached projects
-
getAutoLoadKind
public static AutoLoadKind getAutoLoadKind(IProject owner, IProject project)
Return load kind of given module in a given project- Parameters:
owner- projectproject- module- Returns:
- load kind
-
getAutoLoadKind
@Deprecated public static AutoLoadKind getAutoLoadKind(ProjectAttachmentConfiguration attachment)
Deprecated.use public static AutoLoadKind getAutoLoadKind( AbstractProjectAttachmentConfiguration attachment )Return load kind of module from given attachment- Parameters:
attachment- attachment- Returns:
- load kind
-
getAutoLoadKind
public static AutoLoadKind getAutoLoadKind(AbstractProjectAttachmentConfiguration attachment)
Return load kind of module from given attachment- Parameters:
attachment- attachment- Returns:
- load kind
-
getAttachingProject
@CheckForNull public static IProject getAttachingProject(IProject project)
Return first project where given project is attached. Primary project has always priority.- Parameters:
project- given project- Returns:
- first project where given module is attached.
-
getAttachingProjects
public static java.util.Collection<IProject> getAttachingProjects(IProject project)
Return all projects where given project is attached.- Parameters:
project- given project.- Returns:
- all projects where given module is attached.
-
getOwners
@Deprecated public static java.util.Collection<IProject> getOwners(IProject project)
Deprecated.
-
getEMFURI
public static org.eclipse.emf.common.util.URI getEMFURI(java.net.URI uri)
Convert java net URI to emf uri- Parameters:
uri- net uri- Returns:
- emf uri
-
getAttachment
@CheckForNull public static AbstractProjectAttachmentConfiguration getAttachment(IProject parent, IProject child)
Return configuration which is used to attach one project to another- Parameters:
parent- project which uses another project (directly)child- used directly project- Returns:
- found
ProjectAttachmentConfiguration(for local and teamwork projects) orEsiProjectAttachmentConfiguration(for Teamwork Cloud projects) or null if such not found.
-
getURI
public static java.net.URI getURI(org.eclipse.emf.common.util.URI emfUFI)
Convert EMF uri to java.net.URI- Parameters:
emfUFI- emf uri- Returns:
- java net uri
-
getVersion
@CheckForNull public static IVersionDescriptor getVersion(IProject project)
Return version of given project.- Parameters:
project- project- Returns:
- version or null if project has no version
-
isFromTeamworkServer
public static boolean isFromTeamworkServer()
Check if given project is from teamwork server.- Returns:
- true if project is from server
-
isFromEsiServer
public static boolean isFromEsiServer(@CheckForNull IProject project)Check if given project is from ESI.- Parameters:
project- project- Returns:
- true if project is from ESI
-
isRemote
public static boolean isRemote(@CheckForNull IProject project)Check if given project is remote - from teamwork server or ESI.- Parameters:
project- project- Returns:
- true if project is from server
-
isFromStandardProfile
public static boolean isFromStandardProfile(Element element)
Checks, if the given element is a part of the Standard Profile- Parameters:
element- element to check- Returns:
- true, if the given element is a part of the Standard Profile
-
getProject
@CheckForNull public static Project getProject(@CheckForNull IProject iProject)
Returns MagicDraw project for primary or attached project.- Parameters:
iProject- primary or attached project- Returns:
Project
-
getMountPoint
@Deprecated @CheckForNull public static com.nomagic.ci.persistence.mounting.IMountPoint getMountPoint(java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint> points, Package element)Deprecated.com.nomagic.ci.persistence.mounting.IMountPoint is not exposed into Open APIFind mount point in a given collection which mounts a given package.- Parameters:
points- mount pointselement- package- Returns:
- found mount point
-
getSharePoint
@Deprecated @CheckForNull public static com.nomagic.ci.persistence.sharing.ISharePoint getSharePoint(com.nomagic.ci.persistence.mounting.IMountPoint point)
Deprecated.com.nomagic.ci.persistence.mounting.ISharePoint is not exposed into Open APIFind share point corresponding given mount point- Parameters:
point- mount point- Returns:
- share point
-
encodeTeamworkRemoteId
public static java.lang.String encodeTeamworkRemoteId(java.lang.String remoteId)
Encodes Teamwork remote ID- Parameters:
remoteId- the raw (not encoded) remote ID- Returns:
- encoded ID
-
decodeTeamworkRemoteId
public static java.lang.String decodeTeamworkRemoteId(java.lang.String remoteId)
Decodes Teamwork remote ID- Parameters:
remoteId- the encoded remote ID- Returns:
- decoded (raw) remote ID
-
isESIUri
public static boolean isESIUri(org.eclipse.emf.common.util.URI uri)
Checks if givenURIis ESI projectURI- Parameters:
uri- theURIto check- Returns:
trueif givenURIis ESI,falseotherwise
-
isESIUri
public static boolean isESIUri(java.net.URI uri)
Checks if givenURIis ESI projectURI- Parameters:
uri- theURIto check- Returns:
trueif givenURIis ESI,falseotherwise
-
isElementProxy
public static boolean isElementProxy(BaseElement element)
Checks if given element is proxy or orphan proxy.- Parameters:
element- the element to check- Returns:
trueif given element is proxy or orphan proxy, otherwise -false
-
getESIRemoteId
@CheckForNull public static java.lang.String getESIRemoteId(org.eclipse.emf.common.util.URI uri)
Gets ESI remote ID- Parameters:
uri- theURIto get remote ID for- Returns:
- the remote ID
-
getESIRemoteId
@CheckForNull public static java.lang.String getESIRemoteId(IProject project)
Gets ESI remote ID for given project- Parameters:
project- the project- Returns:
- the remote ID
-
getRemoteId
@CheckReturnValue @CheckForNull public static java.lang.String getRemoteId(org.eclipse.emf.common.util.URI uri)
Retrieves project remote id from given uri.- Parameters:
uri- remote project uri to check.- Returns:
- remote project id from project uri.
-
getMountPoints
public static java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint> getMountPoints(IProject project)
Gets all mount points in given project. Returns empty set if there are no mount points- Parameters:
project- project- Returns:
- non-
nullset of allmount points
-
getMountPointsFor
public static java.util.Set<com.nomagic.ci.persistence.mounting.IMountPoint> getMountPointsFor(IProject owner, IProject attachedProject)
Gets mount points for given project, i.e. returns all mount points that are mounted share points of given project. Returns empty set if there are no mount points to return.- Parameters:
owner- ownerattachedProject- the project to get mount points for- Returns:
- non-
nullset ofmount pointsfor specific project
-
getAllMountPoints
@Deprecated public static java.util.Set<com.nomagic.ci.persistence.mounting.IMountPoint> getAllMountPoints(IPrimaryProject project)
Deprecated.IMountPoint is not exposed into Open APIReturn all mount points existing in given primary project (direct and not direct).- Parameters:
project- project- Returns:
- all mount points from given project and from all attached
-
getProject
@CheckForNull public static IProject getProject(@CheckForNull org.eclipse.emf.ecore.EObject object)
Return project in which object resists.- Parameters:
object- object- Returns:
- found project or null
-
getProject
@CheckForNull public static IProject getProject(@CheckForNull org.eclipse.emf.ecore.resource.Resource resource)
Return project for a resource.- Parameters:
resource- resource- Returns:
- found project or null
-
compareVersions
public static int compareVersions(@CheckForNull IVersionDescriptor versionDescriptor1, @CheckForNull IVersionDescriptor versionDescriptor2)Compare given versions descriptors. The null descriptor is larger than not null.- Parameters:
versionDescriptor1- first version descriptor (can be null).versionDescriptor2- second version descriptor (can be null).- Returns:
- the value 0 if versions are equal; a value less than 0 if first version is less then second; and a value greater than 0 if first version is greater then second.
-
compareVersionNumber
public static int compareVersionNumber(@CheckForNull java.lang.String versionNumber1, @CheckForNull java.lang.String versionNumber2)Compare given version numbers.- Parameters:
versionNumber1- first version number.versionNumber2- second version number.- Returns:
- the value 0 if versions are equal; a value less than 0 if first version is less then second; and a value greater than 0 if first version is greater then second.
-
getAttachedProject
@CheckForNull public 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.- Parameters:
project- projecturi- uri- Returns:
- found module
-
getElementFor
@CheckForNull public static Element getElementFor(@CheckForNull BaseElement element)
Return element for a given base element. Returned element can be passed into other utility methods as EObject if needed.- Parameters:
element- base element- Returns:
- model element
-
isMountedPackage
public static boolean isMountedPackage(Package pck)
Check if given package is a mounted(or is a shared root from some module)- Parameters:
pck- package- Returns:
- true if package is mounted
-
isModuleRoot
protected static boolean isModuleRoot(IAttachedProject iProject, Element element)
-
getInternalVersion
@CheckForNull public static java.lang.String getInternalVersion(IProject project)
Get internal version of project- Parameters:
project- project- Returns:
- version
-
getCompatibleVersion
@CheckForNull public static java.lang.String getCompatibleVersion(IProject project)
Get compatible version of the project- Parameters:
project- project- Returns:
- compatible version
-
isStandardSystemProfile
public static boolean isStandardSystemProfile(IProject project)
Check if given project is a standard system profile- Parameters:
project- project- Returns:
- true if given project is a standard system profile
-
isStandardSystemProfile
@Deprecated public static boolean isStandardSystemProfile(DecompositionDescriptor project)
Deprecated.DecompositionDescriptor is not exposed into Open APICheck if given project is a standard system profile- Parameters:
project- project- Returns:
- true if given project is a standard system profile
-
isLoaded
public static boolean isLoaded(IProject project)
Checks if given project loaded.- Parameters:
project- project- Returns:
- true if given project is loaded
-
isLoadedOrLoading
public static boolean isLoadedOrLoading(IProject project)
-
isModule
@Deprecated public static boolean isModule(DecompositionDescriptor r)
Deprecated.DecompositionDescriptor is not exposed into Open APIReturns true if given project has shared points.- Parameters:
r- project descriptor to evaluate- Returns:
- true if given project descriptor represents a module.
-
isFromStandardProfile
public static boolean isFromStandardProfile(@CheckForNull org.eclipse.emf.ecore.EObject element)Checks if element comes from standard profile- Parameters:
element- element to be checked- Returns:
- true if element comes from standard profile.
-
getModifiedElements
public static java.util.Set<Element> getModifiedElements(Project project)
Get modified elements.- Parameters:
project- project to get elements of.- Returns:
- modified elements.
-
getExporterDescription
@CheckForNull public static XmiExporterDescription getExporterDescription(IProject project)
Provide information about project version and required resources/plugins for that project.- Parameters:
project- project- Returns:
- description of project
-
getSaveID
@CheckForNull public static java.lang.String getSaveID(IProject project)
Gets current save/commit id for given project. The value of the Save ID is a randomly generated unique UUID.- Parameters:
project- project- Returns:
- save id
-
addToCacheLoaded
protected static void addToCacheLoaded(IProject project, XmiExporterDescription xmiExporterDescription)
Adds to cache just loaded modules/projects- Parameters:
project- project/modulexmiExporterDescription- project/module descriptor
-
addToCache
protected static void addToCache(IProject project, @CheckForNull XmiExporterDescription xmiExporterDescription)
-
isModuleUsageNew
public static boolean isModuleUsageNew(IProject attachedProject)
Check if attached project usage from primary project is new (not yet committed to server). This method does not support checking if the usage is new for Teamwork Server Project therefore it always returnsfalsein that case.- Parameters:
attachedProject- theIProjectof attached project- Returns:
trueif 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). Returnfalseotherwise
-
getVisibleURI
public static java.lang.String getVisibleURI(java.net.URI uri)
Creates uri that can be shown in UI components- Parameters:
uri- project location uri- Returns:
- visible uri
-
getVisibleURI
public static java.lang.String getVisibleURI(org.eclipse.emf.common.util.URI uri)
Creates uri that can be shown in UI components- Parameters:
uri- project location uri- Returns:
- visible uri
-
isProjectNameValid
public static boolean isProjectNameValid(java.lang.String projectName)
Checks if given project name is valid. Checks if either the given project name is reserved or has invalid characters- Parameters:
projectName- the project name to check- Returns:
trueif project name is valid,falseotherwise
-
-