当前位置: 首页>>代码示例>>Java>>正文


Java Namespace类代码示例

本文整理汇总了Java中org.eclipse.uml2.uml.Namespace的典型用法代码示例。如果您正苦于以下问题:Java Namespace类的具体用法?Java Namespace怎么用?Java Namespace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Namespace类属于org.eclipse.uml2.uml包,在下文中一共展示了Namespace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCopiedUniqueName

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
/**
 * 요소 이름이 중복될 경우 유일한 이름을 가져오는 메소드
 * 
 * @param element
 * @param parent
 * @param name
 * @return
 */
private static String getCopiedUniqueName(NamedElement element, Namespace parent, String name) {
    int index = 1;
    String newName = null;

    while (true) {
        newName = UMLMessage.getMessage(UMLMessage.LABEL_COPYOF) + Integer.toString(index++)
            + ManagerConstant.UNDER_BAR + name;
        if (null == parent.getOwnedMember(newName)) {
            return newName;
        }

        if (10000 <= index) {
            return name + Integer.toString(UMLManager.NAME_INDEX++);
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:SemanticModelHandlerUtil.java

示例2: getCopiedUniqueName

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
/**
 * 부모가 같고 이름이 같은 요소를 붙여넣었을 때 '사본_#_이름'의 형태로 만들어준다.
 * 
 * @param eobject
 *            void
 * @param parent
 */
public static String getCopiedUniqueName(NamedElement element, Namespace parent, String name) {

    int index = 1;
    String newName;
    while (true) {
        newName = UMLMessage.getMessage(UMLMessage.LABEL_COPYOF) + Integer.toString(index++)
            + UICoreConstant.PROJECT_CONSTANTS__UNDER_BAR + name;
        if (null == parent.getOwnedMember(newName)) {
            return newName;
        }

        if (10000 <= index) {
            return name + Integer.toString(UMLManager.NAME_INDEX++);
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:24,代码来源:ProjectUtil.java

示例3: getDiagramList

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
/**
 * getDiagramList
 *  
 * @param namespace
 * @param type
 * @return List<Diagram>
 */
public static List<Diagram> getDiagramList(Namespace namespace, DiagramType type) {
    List<Diagram> diagramModelList = new ArrayList<Diagram>();

    if (DiagramType.SEQUENCE_DIAGRAM.equals(type)) {
        diagramModelList.addAll(ModelManager.getAllDiagramList(namespace, type));

    } else {
        EAnnotation annotation = namespace.getEAnnotation(UICoreConstant.PROJECT_CONSTANTS__DIAGRAM);
        if (annotation != null) {
            Diagram diagram;
            for (EObject eobj : annotation.getContents()) {
                if (eobj.eClass() == UMLDiagramPackage.Literals.DIAGRAM) {
                    diagram = (Diagram) eobj;

                    if (type == diagram.getType()) {
                        diagramModelList.add(diagram);
                    }
                }
            }
        }
    }
    return ModelManager.sortDiagramList(diagramModelList);

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:32,代码来源:UMLManipulation.java

示例4: createOperation

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
/**
 * Lifeline의 Type에 새 Operation을 생성. (생성된 operation을 Type에 붙이는 것은 transaction
 * 때문에 execute()에서 처리) void
 * 
 * @param type
 */
public static Operation createOperation(Type pType) {

    Operation operation = null;
    CreateOperationDialog dialog = new CreateOperationDialog(RealizationPlugin.getShell(), pType);
    if (dialog.open() == Window.OK) {

        String operationName = dialog.getOperationName();
        Type type = dialog.getSelectedType();

        operation = UMLHelper.createOperation();
        if (operationName.equals(UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING)) {
            NamedElement namedElement = (NamedElement) operation;
            namedElement.setName(UMLManager.getPackagedUniqueName((Namespace) type, namedElement.getName()));
        } else {
            operation.setName(operationName);
        }
    }
    return operation;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:26,代码来源:SequenceUtil.java

示例5: createClass

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
/**
 * Lifeline의 Type에 새 클래스 생성. (생성된 클래스를 Type에 붙이는 것은 transaction 때문에
 * execute()에서 처리) void
 * 
 * @param parentNodeModel
 */
public static org.eclipse.uml2.uml.Class createClass(AbstractNode parentNodeModel) {

    PackageableElement parentElement = UMLManager.getParentPackage(parentNodeModel);
    org.eclipse.uml2.uml.Class umlClass = null;
    CreateClassDialog dialog = new CreateClassDialog(RealizationPlugin.getShell());
    if (dialog.open() == Window.OK) {

        String className = dialog.getClassName();

        umlClass = UMLHelper.createClass();
        if (className.equals(UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING)) {
            umlClass.setName(UMLManager.getPackagedUniqueName((Namespace) parentElement, umlClass.getName()));
        } else {
            umlClass.setName(className);
        }
    }
    return umlClass;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:SequenceUtil.java

示例6: checkUniqueNamedElementInItsUMLNamespace

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
@Check
private void checkUniqueNamedElementInItsUMLNamespace(NamedElement element) {
    if (StringUtils.isEmpty(element.getName())) {
        return;
    }

    Optional<UMLReferencingElement<Element>> referencedUMLElement = Optional.ofNullable(element)
            .filter(UMLReferencingElement.class::isInstance).map(UMLReferencingElement.class::cast);
    Optional<Namespace> relevantUMLNamespace = referencedUMLElement
            .map(UMLReferencingElement::getUMLParentNamespace);
    if (!relevantUMLNamespace.isPresent()) {
        return;
    }

    if (relevantUMLNamespace.get().getMembers().stream().filter(org.eclipse.uml2.uml.NamedElement.class::isInstance)
            .map(org.eclipse.uml2.uml.NamedElement.class::cast)
            .filter(o -> o != referencedUMLElement.get().getReferencedElement())
            .anyMatch(elementToTest -> Objects.equals(element.getName(), elementToTest.getName()))) {
        error("\"" + element.getName() + "\"" + " no duplicates!",
                TextualCommonsPackage.Literals.NAMED_ELEMENT__NAME, NAME_TAKEN);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:23,代码来源:ClsValidator.java

示例7: createWildcardType

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
public static Class createWildcardType(Namespace context, String name) {
	Class wildcardType = ClassifierUtils.createClassifier(context, null, Literals.CLASS);
	if (context.getNearestPackage() != context) {
		ElementImport elementImport = context.createElementImport(wildcardType);
		elementImport.setAlias(name);
	}
	Stereotype constraintStereotype = StereotypeUtils.findStereotype(WILDCARD_TYPE_STEREOTYPE);
	wildcardType.applyStereotype(constraintStereotype);
	wildcardType.setValue(constraintStereotype, WILDCARD_TYPE_CONTEXT, context);

	Stereotype contextStereotype = StereotypeUtils.findStereotype(WILDCARD_TYPE_CONTEXT_STEREOTYPE);
	List<Type> newTypes;
	if (!context.isStereotypeApplied(contextStereotype)) {
		context.applyStereotype(contextStereotype);
		newTypes = new ArrayList<Type>();
	} else
		newTypes = new ArrayList<Type>(
				(List<Type>) context.getValue(contextStereotype, WILDCARD_TYPE_CONTEXT_TYPES));
	newTypes.add(wildcardType);
	context.setValue(contextStereotype, WILDCARD_TYPE_CONTEXT_TYPES, newTypes);
	return wildcardType;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:23,代码来源:MDDExtensionUtils.java

示例8: createBinding

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
/**
 * Creates a template binding for the given template and parameters.
 * 
 * @param template
 * @param actualParam
 * @return the created bound element
 */
@SuppressWarnings("unchecked")
public static <TE extends TemplateableElement & NamedElement, PE extends ParameterableElement> TE createBinding(
        Namespace namespace, TE template, List<PE> actualParams) {
    TemplateSignature signature = template.getOwnedTemplateSignature();
    List<TemplateParameter> formalParameters = signature.getParameters();
    Assert.isTrue(formalParameters.size() == actualParams.size());
    TE result;
    if (template instanceof Classifier) {
        result = (TE) namespace.getNearestPackage().createOwnedType(null, template.eClass());
        result.setName(generateTemplateInstanceName(template, actualParams));
    } else if (template instanceof Operation)
        result = (TE) FeatureUtils.createOperation((Classifier) namespace, template.getName());
    else
        throw new IllegalArgumentException(template.eClass().getName());
    TemplateBinding binding = result.createTemplateBinding(signature);
    for (int i = 0; i < formalParameters.size(); i++) {
        TemplateParameterSubstitution substitution = binding.createParameterSubstitution();
        substitution.setFormal(signature.getOwnedParameters().get(i));
        UML2Compatibility.setActualParameter(substitution, actualParams.get(i));
    }
    return result;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:30,代码来源:TemplateUtils.java

示例9: mapEquivalents

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
public static Collection<Element> mapEquivalents(final Collection<EObject> referenceLibraryElements,
        final Package inThePIM) {
    final Collection<Element> pimEquivalents = new ArrayList<>();

    Namespace theCurrentOwner = null;
    Namespace theEquivalentOwnerInThePIM = null;
    for (final EObject visibleElement : referenceLibraryElements) {
        final Namespace theOwner = getOwner(visibleElement);
        if (theOwner != theCurrentOwner) {
            theCurrentOwner = theOwner;
            theEquivalentOwnerInThePIM = findEquivalent(theOwner, inThePIM);
        }
        if (theEquivalentOwnerInThePIM == null) {
            continue;
        }
        final NamedElement theElement = theEquivalentOwnerInThePIM.getMember(getName(visibleElement), false,
                getEClass(visibleElement));
        if (theElement != null) {
            pimEquivalents.add(theElement);
        }
    }

    return pimEquivalents;
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:25,代码来源:NamespaceMergeUtil.java

示例10: copyContainment

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
@Override
protected void copyContainment(final EReference eReference, final EObject eObject, final EObject copyEObject) {
    if (UMLPackage.Literals.CLASSIFIER.isInstance(eObject) && eObject.eIsSet(eReference) && eReference.isMany()
            && !((Collection<?>) eObject.eGet(eReference)).isEmpty()) {
        @SuppressWarnings("unchecked")
        final EList<EObject> source = (EList<EObject>) eObject.eGet(eReference);
        @SuppressWarnings("unchecked")
        final EList<EObject> target = (EList<EObject>) copyEObject.eGet(getTarget(eReference));
        target.addAll(copyAll(source));
        final Namespace original = (Namespace) eObject;
        ECollections.sort(target, new Comparator<EObject>() {
            @Override
            public int compare(final EObject left, final EObject right) {
                return Integer.compare(indexOf(source, original.getOwnedMember(getName(left)), 0),
                        indexOf(source, original.getOwnedMember(getName(right)), 0));
            }
        });
    } else {
        super.copyContainment(eReference, eObject, copyEObject);
    }
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:22,代码来源:NamespaceMerger.java

示例11: collectExistingItems

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
private Collection<TreeItem> collectExistingItems(final Iterable<TreeItem> items) {
    final Collection<TreeItem> existingItems = new ArrayList<>();
    Namespace theCurrentOwner = null;
    Namespace theEquivalentOwnerInThePIM = null;
    for (final TreeItem item : items) {
        final Object o = item.getData();
        final Element visibleElement = (Element) o;
        final Namespace theOwner = getOwner(visibleElement);
        if (theOwner != theCurrentOwner) {
            theCurrentOwner = theOwner;
            theEquivalentOwnerInThePIM = findEquivalent(theOwner, thePIM);
        }
        if (theEquivalentOwnerInThePIM == null) {
            continue;
        }
        if (theEquivalentOwnerInThePIM.getMember(getName(visibleElement), false, getEClass(visibleElement)) != null) {
            existingItems.add(item);
        }
    }
    return existingItems;
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:22,代码来源:NiemReferencesSelectionDialog.java

示例12: collectExistingItems

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
private Collection<TreeItem> collectExistingItems(final Iterable<TreeItem> items) {
    final Collection<TreeItem> existingItems = new ArrayList<>();
    Namespace theCurrentOwner = null;
    Namespace theEquivalentOwnerInThePIM = null;
    for (final TreeItem item : items) {
        final Object o = item.getData();
        final Element visibleElement = (Element) o;
        final Namespace theOwner = getOwner(visibleElement);
        if (theOwner != theCurrentOwner) {
            theCurrentOwner = theOwner;
            theEquivalentOwnerInThePIM = findEquivalent(theOwner, thePIM);
        }
        if (theEquivalentOwnerInThePIM == null) {
            continue;
        }
        if (findMatching(visibleElement, theEquivalentOwnerInThePIM) != null) {
            existingItems.add(item);
        }
    }
    return existingItems;
}
 
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:22,代码来源:NiemReferencesSelectionDialog.java

示例13: searchComponentInModels

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
public static Component searchComponentInModels(Namespace namespace, String componentName) {
	Component result = null;

	List<EObject> contents = namespace.eResource().getContents();
	List<Component> components = new ArrayList<Component>();
	for (EObject content : contents) {
		if (content instanceof Package) {
			Package rootPackage = (Package)content;
			List<PackageableElement> packagedElements = rootPackage.getPackagedElements();
			for (PackageableElement packageableElement : packagedElements) {
				if (packageableElement instanceof Component) {
					components.add((Component)packageableElement);
				}
			}
			components.addAll(searchAllImportedComponents(rootPackage));
		}
	}
	for (Component component : components) {
		if (componentName.equals(component.getName())) {
			result = component;
			break;
		}
	}
	return result;
}
 
开发者ID:hmarchadour,项目名称:2uml,代码行数:26,代码来源:Utils.java

示例14: searchClassifierInModels

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
public static Classifier searchClassifierInModels(Namespace namespace, String qualifiedName) {
	Classifier result = null;

	result = searchClassifierInModel(namespace, qualifiedName);
	if (result == null) {
		// search in imported packages
		Resource eResource = namespace.eResource();
		if (eResource != null) {
			List<EObject> contents = eResource.getContents();
			List<Component> components = new ArrayList<Component>();
			for (EObject content : contents) {
				if (content instanceof Package) {
					Package rootPackage = (Package)content;
					components.addAll(searchAllImportedComponents(rootPackage));
				}
			}
			result = searchClassifierInComponents(components, qualifiedName);
		} else {
			throw new IllegalStateException("Should not appended");
		}
	}
	return result;
}
 
开发者ID:hmarchadour,项目名称:2uml,代码行数:24,代码来源:Utils.java

示例15: getCopiedUniqueName

import org.eclipse.uml2.uml.Namespace; //导入依赖的package包/类
/**
 * getCopiedUniqueName
 *  
 * @param element
 * @param parent
 * @param name
 * @return String
 */
public static String getCopiedUniqueName(NamedElement element, Namespace parent, String name) {

    int index = 1;
    String newName;
    while (true) {
        newName = UMLMessage.getMessage(UMLMessage.LABEL_COPYOF) + Integer.toString(index++)
            + UICoreConstant.PROJECT_CONSTANTS__UNDER_BAR + name;
        boolean isUnique = true;
        for (Element child : parent.getOwnedElements()) {
            if (child instanceof NamedElement) {
                if (((NamedElement) child).getName() != null) {
                    if (((NamedElement) child).getName().equals(newName)) {
                        isUnique = false;
                    }
                }
            }
        }
        if (isUnique) {
            return newName;
        }
        // if (null == parent.getOwnedMember(newName)) {
        // return newName;
        // }

        if (10000 <= index) {
            return name + Integer.toString(UMLManager.NAME_INDEX++);
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:38,代码来源:PasteDiagramNodeAction.java


注:本文中的org.eclipse.uml2.uml.Namespace类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。