• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PackageImport类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: doExecute

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
/**
 * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
 */
@Override
protected void doExecute() {
    if (importPackage) {
        element.createPackageImport(importingPackage);
    } else {
        PackageImport deletingCandidate = null;

        for (org.eclipse.uml2.uml.PackageImport packageImport : element.getPackageImports()) {
            if (packageImport != null) {
                if (packageImport.getImportedPackage().equals(importingPackage)) {
                    deletingCandidate = packageImport;
                    break;
                }
            }
        }

        if (deletingCandidate != null) {
            element.getPackageImports().remove(deletingCandidate);
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:HandleImportedPackageCommand.java


示例2: getPackageImportText

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
private static Optional<String> getPackageImportText(
        de.cooperateproject.modeling.textual.common.metamodel.textualCommons.PackageImport pkgImport) {

    Object result = pkgImport.eGet(TextualCommonsPackage.Literals.UML_REFERENCING_ELEMENT__REFERENCED_ELEMENT,
            false);

    List<INode> nodes = NodeModelUtils.findNodesForFeature(pkgImport,
            TextualCommonsPackage.Literals.UML_REFERENCING_ELEMENT__REFERENCED_ELEMENT);
    if (result != null) {
        Package umlPackage = ((PackageImport) result).getImportedPackage();
        if (umlPackage != null)
            // TODO use qualified name provider for this operation
            return Optional.of(umlPackage.getQualifiedName().replace(umlPackage.separator(), "."));

    }

    if (!nodes.isEmpty()) {// TODO: should alway return absolut import path, so we should resolve that text with the
                           // parent
        return Optional.fromNullable(NodeModelUtils.getTokenText(nodes.get(0)));
    }
    return Optional.absent();
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:23,代码来源:ClsCooperateSimpleScopeProvider.java


示例3: searchAllImportedComponents

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
public static List<Component> searchAllImportedComponents(Package pack) {
	List<Component> components = new ArrayList<Component>();
	List<PackageImport> packageImports = pack.getPackageImports();
	for (PackageImport packageImport : packageImports) {
		Package importedPackage = packageImport.getImportedPackage();
		if (importedPackage != null) {
			List<PackageableElement> packagedElements = importedPackage.getPackagedElements();
			for (PackageableElement packageableElement : packagedElements) {
				if (packageableElement instanceof Component) {
					components.add((Component)packageableElement);
				}
			}
			components.addAll(searchAllImportedComponents(importedPackage));
		}
	}
	return components;
}
 
开发者ID:hmarchadour,项目名称:2uml,代码行数:18,代码来源:Utils.java


示例4: execute

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
@Override
public void execute() {

	// Get its resource
	Resource umlResource = UmlUtils.getUmlModel(modelSet).getResource();

	// Select the root element to add the wanted imports
	root = (org.eclipse.uml2.uml.Package) umlResource.getContents().get(0);
		
	URI templatelibraryURI = URI.createURI(EXAMPLE_PATH).appendFragment(EXAMPLE_ROOT_ID);
	libraryPackage = (org.eclipse.uml2.uml.Package) modelSet.getEObject(templatelibraryURI, true);

	// Creates the import packages at the root of the model (elements of type packageImport)
	this.getCommandStack(modelSet).execute(new RecordingCommand(modelSet.getTransactionalEditingDomain()) {

		@Override
		protected void doExecute() {
			PackageImport importPrimitivePack = root.createPackageImport(libraryPackage);
			if (!root.getPackageImports().contains(importPrimitivePack)) {
				root.getPackageImports().add(importPrimitivePack);
			}

			try {
				root.eResource().save(Collections.emptyMap());
			} catch (IOException e) {
				//TODO : log error
			}
		}
	});

}
 
开发者ID:bmaggi,项目名称:library-training,代码行数:32,代码来源:ImportLibraryTemplateInModel.java


示例5: getContributorId

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
/**
 * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId()
 */
public String getContributorId() {
    if (eobj instanceof PackageImport) {
        return UICoreConstant.PROJECT_CONSTANTS__CONTRIBUTOR_ID;
    } else {
        return CONTRIBUTOR_ID;
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:11,代码来源:UMLTreeNode.java


示例6: renderObject

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
public boolean renderObject(Package package_, IndentedPrintWriter pw, IRenderingSession context) {
    renderPrologue(package_, pw, context);
    pw.println();

    List<ProfileApplication> profileApplications = package_.getProfileApplications();
    if (!profileApplications.isEmpty()) {
        RenderingUtils.renderAll(context, profileApplications);
        pw.println();
    }

    List<PackageImport> packageImports = package_.getPackageImports();
    if (!packageImports.isEmpty()) {
        RenderingUtils.renderAll(context, packageImports);
        pw.println();
    }

    List<ElementImport> elementImports = package_.getElementImports();
    if (!elementImports.isEmpty()) {
        RenderingUtils.renderAll(context, elementImports);
        pw.println();
    }

    final Collection<Classifier> subPackages = EcoreUtil.getObjectsByType(package_.getOwnedElements(),
            UMLPackage.Literals.PACKAGE);
    RenderingUtils.renderAll(context, subPackages);

    final Collection<Classifier> classifiers = EcoreUtil.getObjectsByType(package_.getOwnedElements(),
            UMLPackage.Literals.CLASSIFIER);
    RenderingUtils.renderAll(context, classifiers);

    renderEpilogue(package_, pw, context);
    return true;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:34,代码来源:PackageRenderer.java


示例7: getAllImportedPackages

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
protected static List<Package> getAllImportedPackages(Package package_, List<Package> allImportedPackages) {
    for (PackageImport packageImport : package_.getPackageImports())
        if (packageImport.getVisibility() == VisibilityKind.PUBLIC_LITERAL) {
            Package importedPackage = packageImport.getImportedPackage();
            if (importedPackage != null && !allImportedPackages.contains(importedPackage)) {
            	allImportedPackages.add(importedPackage);
                getAllImportedPackages(importedPackage, allImportedPackages);
            }
        }
    return allImportedPackages;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:12,代码来源:Repository.java


示例8: addSystemPackage

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
private void addSystemPackage(Package systemPackage) {
    if (!systemResources.add(systemPackage.eResource()))
        // already added
        return;
    for (PackageImport current : systemPackage.getPackageImports())
        addSystemPackage(current.getImportedPackage());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:8,代码来源:Repository.java


示例9: renderObject

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
public boolean renderObject(PackageImport element, IndentedPrintWriter out, IRenderingSession context) {
    out.println("import " + qualifiedName(element.getImportedPackage()) + ";");
    return true;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:5,代码来源:PackageImportRenderer.java


示例10: caseAImportDecl

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
@Override
public void caseAImportDecl(final AImportDecl node) {
    final Package currentPackageSnapshot = namespaceTracker.currentPackage();
    modifierProcessor.collectModifierToken(node.getOptionalImportModifier());
    final Set<Modifier> tmpModifiers = modifierProcessor.getModifiers(true);
    final VisibilityKind importVisibility = tmpModifiers.isEmpty() ? VisibilityKind.PUBLIC_LITERAL : getVisibility(
            tmpModifiers.iterator().next(), VisibilityKind.PUBLIC_LITERAL);
    String qualifiedIdentifier = TextUMLCore.getSourceMiner().getQualifiedIdentifier(node.getQualifiedIdentifier());
    final String alias;
    if (node.getOptionalAlias() instanceof AOptionalAlias) {
        AOptionalAlias optionalAlias = (AOptionalAlias) node.getOptionalAlias();
        alias = Util.stripEscaping(optionalAlias.getIdentifier().getText());
    } else
        alias = null;
    getRefTracker().add(
            new DeferredReference<NamedElement>(qualifiedIdentifier, IRepository.PACKAGE.getNamedElement(),
                    namespaceTracker.currentPackage()) {
                @Override
                protected void onBind(NamedElement element) {
                    if (element == null) {
                        problemBuilder.addProblem(new UnresolvedSymbol(getSymbolName()),
                                node.getQualifiedIdentifier());
                        return;
                    }
                    if (element instanceof Package) {
                        if (alias != null) {
                            problemBuilder.addError("Imported packages cannot be aliased",
                                    node.getQualifiedIdentifier());
                            return;
                        }
                        Package importedPackage = (Package) element;
                        if (currentPackageSnapshot.getImportedPackages().contains(importedPackage))
                            // just ignore
                            return;
                        PackageImport created = currentPackageSnapshot.createPackageImport(importedPackage);
                        created.setVisibility(importVisibility);
                    } else {
                        PackageableElement packageableElement = (PackageableElement) element;
                        ElementImport elementImport = currentPackageSnapshot.createElementImport(packageableElement);
                        elementImport.setVisibility(importVisibility);
                        if (alias != null)
                            elementImport.setAlias(alias);
                    }
                }
            }, IReferenceTracker.Step.PACKAGE_IMPORTS);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:47,代码来源:StructureGenerator.java


示例11: internalFindNamedElement

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
private <T extends NamedElement> T internalFindNamedElement(String name, EClass class_, Namespace namespace,
        boolean deep, Set<Namespace> visited) {
    Assert.isNotNull(name);
    if (namespace != null && !visited.add(namespace))
        // already visited, avoid infinite recursion
        return null;
    // tries to resolve the name regardless the contextual namespace
    NamedElement element = internalFindNamedElement(name, class_);
    if (element != null && (namespace == null || isVisible(namespace, element, MDDUtil.isQualifiedName(name))))
        // element found or is fully qualified, no need to look further
        return (T) element;
    // no contextual namespace provided, there is nothing else we can do
    if (namespace == null) {
        if (MDDUtil.isQualifiedName(name)) {
            namespace = loadPackage(MDDUtil.getFirstSegment(name));
            return (T) ((namespace == null) ? null : findNamedElement(MDDUtil.removeFirstSegment(name), class_,
                    namespace));
        } else
            return null;
    }
    if (namespace instanceof TemplateableElement) {
        TemplateableElement asTemplate = (TemplateableElement) namespace;
        if (asTemplate.isTemplate()) {
            TemplateSignature signature = asTemplate.getOwnedTemplateSignature();
            // TODO a template may not have a signature (descendant)
            if (signature != null)
                for (TemplateParameter parameter : signature.getParameters()) {
                    final ParameterableElement parameteredElement = parameter.getParameteredElement();
                    if (parameteredElement instanceof NamedElement
                            && name.equals(((NamedElement) parameteredElement).getName()))
                        return (T) parameteredElement;
                }

        }
    }
    // uses the contextual namespace to derive a qualified name (assuming
    // 'name' is not fully qualified)
    if (namespace.getQualifiedName() != null) {
        final String fullyQualifiedName = MDDUtil.appendSegment(namespace.getQualifiedName(), name);
        element = internalFindNamedElement(fullyQualifiedName, class_);
        if (element != null && isVisible(namespace, element, MDDUtil.isQualifiedName(name)))
            // element found, no need to look further
            return (T) element;
        for (ElementImport elementImport : namespace.getElementImports())
            if (elementImport.getName().equals(name))
                return (T) elementImport.getImportedElement();
        if (deep) {
            // check imported packages now
            List<PackageImport> imports = namespace.getPackageImports();
            for (PackageImport packageImport : imports) {
                final Package importedPackage = packageImport.getImportedPackage();
                element = internalFindNamedElement(name, class_, importedPackage,
                        packageImport.getVisibility() != VisibilityKind.PRIVATE_LITERAL, visited);
                if ((element != null && isVisible(namespace, element, false)))
                    return (T) element;
            }
        }
    }
    // search the parent now
    if (namespace.getOwner() == null)
        return null;
    return (T) internalFindNamedElement(name, class_, (Namespace) namespace.getOwner(), deep, visited);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:64,代码来源:Repository.java


示例12: importPackage

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
public static PackageImport importPackage(Package importer, Package imported) {
	return importer.getPackageImport(imported, true);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:4,代码来源:PackageUtils.java


示例13: qualifiedName

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
/**
 * Converts a UML package import to a qualified name object. The result is
 * not the qualified name of the package import but the imported package.
 * 
 * @param packageImport
 *            The package import to be converted.
 * @return The qualified name.
 */
protected QualifiedName qualifiedName(PackageImport packageImport) {
    Package importedPackage = packageImport.getImportedPackage();
    return QualifiedName.create(importedPackage.getQualifiedName().split(importedPackage.separator()));
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:13,代码来源:CooperateQualifiedNameProvider.java


示例14: setReferencedElement

import org.eclipse.uml2.uml.PackageImport; //导入依赖的package包/类
/**
    * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
    * This is specialized for the more specific type known in this context.
    * @generated
    */
@Override
public void setReferencedElement(PackageImport newReferencedElement) {
       super.setReferencedElement(newReferencedElement);
   }
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:11,代码来源:PackageImportImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DockerException类代码示例发布时间:2022-05-22
下一篇:
Java ReadOnlySnapshottable类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap