本文整理汇总了Java中org.eclipse.uml2.uml.Profile类的典型用法代码示例。如果您正苦于以下问题:Java Profile类的具体用法?Java Profile怎么用?Java Profile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Profile类属于org.eclipse.uml2.uml包,在下文中一共展示了Profile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAllowed
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
*
* @see org.eclipse.papyrus.infra.nattable.tester.ITableTester#isAllowed(java.lang.Object)
*
* @param context
* @return
*/
@Override
public IStatus isAllowed(Object context) {
if (context instanceof Element) {
Element el = (Element) context;
ISpecializationType type = (ISpecializationType) ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.training.library.profile.extlibrary.Book");
IElementMatcher matcher = type.getMatcher();
if (context instanceof Package || matcher.matches(el)) {
Profile profile = UMLUtil.getProfile(LibraryPackage.eINSTANCE, el);
if (profile != null){
final String packageQN = profile.getQualifiedName();
if (el.getNearestPackage().getAppliedProfile(packageQN, true) != null) {
return new Status(IStatus.OK, Activator.PLUGIN_ID, "The context allowed to create a Book Table"); //$NON-NLS-1$
} else {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The profile "+packageQN+" is not applied on the model"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
}
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The context is not an UML Element"); //$NON-NLS-1$
}
示例2: getValidLifelineTypes
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
* Class/Component/Interface 등 라이프라인의 타입이 될 수 있는 데이터의 리스트를 반환한다.
* @param ruleSet
* @param profile
* @return
*/
public static List<SourceStructureTransformationData> getValidLifelineTypes(RuleSet ruleSet, Profile profile) {
List<SourceStructureTransformationData> elementList = new ArrayList<SourceStructureTransformationData>();
String stereotypeName = null;
for (SourceStructureTransformationData data : ruleSet.getStructureRules()) {
stereotypeName = data.getSourceType().getSourceName();
Stereotype stereotype = (Stereotype) profile.getPackagedElement(stereotypeName);
String[] baseNames = MDADesignerTransformationUtil.getApplicableElementName(stereotype).split(MDDCoreConstant.COMMA);
// String[] baseNames = StringUtil.split(MDADesignerTransformationUtil.getApplicableElementName(stereotype),
// MDDCoreConstant.COMMA);
for (String base : baseNames) {
if( MDDCoreConstant.UML_CLASS_LITERAL.equals(base) || MDDCoreConstant.UML_INTERFACE_LITERAL.equals(base)
|| MDDCoreConstant.UML_COMPONENT_LITERAL.equals(base)) {
elementList.add(data);
}
}
}
return elementList;
}
示例3: getApplicableStereotypes
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
* find applicable stereotypes for meta class
*
* @param profile
* @param metaClassName
* @return
*/
public static List<Stereotype> getApplicableStereotypes(Profile profile, String metaClassName) {
if (profile == null || metaClassName == null)
return null;
List<Stereotype> applicableStereotypes = new ArrayList<Stereotype>();
for (Iterator<Stereotype> iter = profile.getOwnedStereotypes().iterator(); iter.hasNext();) {
Stereotype stereotype = (Stereotype) iter.next();
EList<Class> extendedMetaClasses = stereotype.getExtendedMetaclasses();
for (int clazzCount = 0; clazzCount < extendedMetaClasses.size(); clazzCount++) {
Class clazz = extendedMetaClasses.get(clazzCount);
if (clazz.getName().equals(metaClassName))
applicableStereotypes.add(stereotype);
}
}
return applicableStereotypes;
}
示例4: getRMProfile
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
* RM 프로파일 반환
*
* @return Profile
*/
public static Profile getRMProfile() {
Resource resource = null;
URI profileURI = null;
Profile profile = null;
// RM 프로파일 로딩
profileURI = URI.createURI(ManagerConstant.NEXCORE_UML_PROFILES_PATHMAP + ManagerConstant.RM_PROFILE_NAME
+ ManagerConstant.DOT + UMLResource.PROFILE_FILE_EXTENSION);
if (domainModelHandler != null) {
resource = domainModelHandler.getResourceSet().getResource(profileURI, true);
} else {
resource = getHandlerInstance().getResourceSet().getResource(profileURI, true);
}
if (!resource.isLoaded()) {
try {
resource.load(getLoadOptions());
} catch (IOException e) {}
}
profile = getUMLProfileRoot(resource);
return profile;
}
示例5: getStyledText
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
* @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
*/
public StyledString getStyledText(Object element) {
if (element instanceof ClosedTreeNode) {
return new StyledString(getText(element), StyledString.createColorRegistryStyler("QUALIFIER_COLOR", null));// gray color
} else if (element instanceof ITreeNode) {
EObject eobject = ((ITreeNode) element).getEObject();
if (eobject instanceof ProfileApplication) {
ProfileApplication profileApplication = (ProfileApplication) eobject;
Profile profile = profileApplication.getAppliedProfile();
if (profile.eIsProxy()) {
String text = String.format("'%s' does not exist.", getText(element));
return new StyledString(text, StyledString.createColorRegistryStyler("ERROR_COLOR", null));// red color
}
}
}
return new StyledString(getText(element));
}
示例6: setModel
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
* @param model
* the model to set
*/
public void setModel(Model model) {
this.model = model;
if (model.getAllProfileApplications().size() > 0) {
this.applyingProfileList = new ArrayList<Profile>();
for (ProfileApplication profileApplication : model.getProfileApplications()) {
if (profileApplication.getAppliedProfile() != null) {
this.applyingProfileList.add(profileApplication.getAppliedProfile());
}
}
} else {
this.applyingProfileList = new ArrayList<Profile>();
}
}
示例7: isProfile
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
public boolean isProfile(EPackage pkg) {
// Papyrus custom metamodels have versioning annotations
final boolean isPapyrusProfile = pkg.getEAnnotation("PapyrusVersion") != null;
if (isPapyrusProfile) {
return true;
}
// The standard profile is a regular Ecore generated EPackage
final boolean isStandardProfile = pkg instanceof StandardPackage;
if (isStandardProfile) {
return true;
}
// UML and Ecore profiles are .profile.uml files with annotations, but not the Papyrus ones
for (EObject parent = pkg.eContainer(); parent != null; parent = parent.eContainer()) {
if (parent instanceof Profile) {
return true;
}
}
return false;
}
示例8: setUpUMLFile
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
* Copies the content of the sourceUMLPath to the umlFile
* The referenced Profile files will be also copied
* @param sourceUMLPath - The path of the source .uml File
*/
private void setUpUMLFile(String sourceUMLPath){
copyFile(sourceUMLPath, umlFile);
Model m = getUmlModel();
EList<Profile> profiles = m.getAllAppliedProfiles();
for(Profile profile : profiles){
String filestring = ((BasicEObjectImpl) profile).eProxyURI().toPlatformString(false);
Path profileFilepath = new Path(filestring);
String oldFolder = new Path(new Path(sourceUMLPath).toFile().getParent().toString()).toString();
String oldFileName = oldFolder+Path.SEPARATOR+profileFilepath.toFile().getName();
int index = umlFilePath.lastIndexOf(Path.SEPARATOR);
String newFileName = umlFilePath.substring(0, index)+Path.SEPARATOR+profileFilepath.toFile().getName();
IFile newFile = fileFromPath(newFileName);
copyFile(oldFileName, newFile);
}
}
示例9: loadProfiles
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
private HashMap<String, Profile> loadProfiles(ATLModel atlModel, GlobalNamespace mm) {
ResourceSet rs = new ResourceSetImpl();
List<String> profileTags = ATLUtils.findCommaTags(atlModel.getModule(), "profile");
HashMap<String, Profile> profiles = new HashMap<String, Profile>();
for (String tagValue : profileTags) {
String[] elems = tagValue.split("=");
if ( elems.length == 0 || elems.length > 2)
continue;
Profile p = null;
String name = elems[0].trim();
MetamodelNamespace ns = mm.getNamespace(name);
if ( elems.length == 1 ) {
p = loadInMemoryProfile(rs, ns);
} else if ( elems.length == 2 ) {
p = loadFileProfile(rs, elems[1].trim());
}
profiles.put(name, p);
}
return profiles;
}
示例10: addTopLevelPackage
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
@Override
public void addTopLevelPackage(Package newPackage, String packageName, URI packageURI) {
if (packageURI == null)
packageURI = computePackageURI(packageName);
Resource resource = resourceSet.createResource(packageURI);
addPackage(resource, newPackage);
MDDUtil.markGenerated(newPackage);
newPackage.setName(packageName);
newPackage.setURI(getBaseURI().lastSegment() + '/' + packageName);
if (Boolean.parseBoolean(getProperties().getProperty(ENABLE_EXTENSIONS,
System.getProperty(ENABLE_EXTENSIONS, Boolean.FALSE.toString())))) {
Profile extensions = (Profile) findPackage(EXTENSIONS_NAMESPACE, Literals.PROFILE);
if (extensions != null && extensions.isDefined())
StereotypeUtils.safeApplyProfile(newPackage, extensions);
}
if (getWeaver() != null)
getWeaver().packageCreated(this, newPackage);
}
示例11: applyProfiles
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
private void applyProfiles() {
for (NameReference profileName : this.profilesApplied)
new ReferenceSetter<Profile>(profileName, getParentProduct(), getContext(),
IReferenceTracker.Step.PROFILE_APPLICATIONS) {
@Override
protected void link(Profile profile) {
if (!profile.isDefined())
getContext().getProblemTracker().add(
new InternalProblem("Profile '" + profile.getName() + "' not defined"));
else {
if (!getProduct().getAppliedProfiles().contains(profile))
getProduct().applyProfile(profile);
if (!getProduct().getImportedPackages().contains(profile))
getProduct().createPackageImport(profile, VisibilityKind.PRIVATE_LITERAL);
}
}
};
}
示例12: getNIEMGraProfiles
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.QUERY)
public static List<Profile> getNIEMGraProfiles(final Model self) {
List<Profile> existingProfiles=new Vector<Profile>();
TreeIterator<EObject> tree=self.eAllContents();//eResource().getAllContents();
boolean foundNiem=false;
while(tree.hasNext()){
EObject test=tree.next();
if(test instanceof ProfileApplication){
ProfileApplication profileApplication=(ProfileApplication)test;
Profile profile=profileApplication.getAppliedProfile();
existingProfiles.add(profile);
if("NIEM_PIM_Profile".equals(profile.getName()))foundNiem=true;
}
}
if(foundNiem)return existingProfiles;
return new ArrayList<>(EcoreUtil.<Profile> getObjectsByType(
((Package) getNiemUmlProfile(self.eResource().getResourceSet()).getContents().get(0)).getNestedPackages(),
UMLPackage.Literals.PROFILE));
}
示例13: initializeModel
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
* A standard Library model should have :
* - the Library profile applied
*
* @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#initializeModel(org.eclipse.emf.ecore.EObject)
*
* @param owner
*/
@Override
protected void initializeModel(EObject owner) {
super.initializeModel(owner);
Package packageOwner = (Package) owner;
// Retrieve Library profile and apply it
Profile trainingLibraryProfile = (Profile) PackageUtil.loadPackage(URI.createURI(TrainingLibraryResources.PROFILE_PATH), owner.eResource().getResourceSet());
if (trainingLibraryProfile != null) {
PackageUtil.applyProfile(packageOwner, trainingLibraryProfile, true);
}
}
示例14: getUMLProfileRoot
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
* 인자로 넘어온 리소스의 UML 프로파일 최상위 객체 반환
*
* @param resource
* @return Profile
*/
public static Profile getUMLProfileRoot(Resource resource) {
Profile profile = (org.eclipse.uml2.uml.Profile) EcoreUtil.getObjectByType(resource.getContents(),
UMLPackage.Literals.PROFILE);
return profile;
}
示例15: loadUMLCoreProfile
import org.eclipse.uml2.uml.Profile; //导入依赖的package包/类
/**
* UML Core 프로파일 적재하는 메소드 void
*/
private void loadUMLCoreProfile() {
Resource resource = null;
URI profileURI = null;
Profile profile = null;
if (umlCoreProfileList == null) {
umlCoreProfileList = new ArrayList<Object>();
} else {
umlCoreProfileList.clear();
}
// UML 프로파일 로딩
for (int profileNameIdx = 0; profileNameIdx < ManagerConstant.UML_PROFILES_NAMES.length; profileNameIdx++) {
profileURI = URI.createURI(ManagerConstant.NEXCORE_UML_PROFILES_PATHMAP
+ ManagerConstant.UML_PROFILES_NAMES[profileNameIdx] + ManagerConstant.DOT
+ UMLResource.PROFILE_FILE_EXTENSION);
resource = DomainRegistry.getEditingDomain().getResourceSet().getResource(profileURI, true);
if (!resource.isLoaded()) {
try {
resource.load(DomainUtil.getLoadOptions());
} catch (IOException e) {}
}
profile = DomainUtil.getUMLProfileRoot(resource);
umlCoreProfileList.add(profile);
}
}