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


Java Session.getSelectedViewpoints方法代码示例

本文整理汇总了Java中org.eclipse.sirius.business.api.session.Session.getSelectedViewpoints方法的典型用法代码示例。如果您正苦于以下问题:Java Session.getSelectedViewpoints方法的具体用法?Java Session.getSelectedViewpoints怎么用?Java Session.getSelectedViewpoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.sirius.business.api.session.Session的用法示例。


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

示例1: getAssociatedRepresentationByName

import org.eclipse.sirius.business.api.session.Session; //导入方法依赖的package包/类
/**
 * Retrieve all representations whose target is the specified EObject.
 * 
 * @param representationName
 *            the name of the representation from which we want to create an image.
 * @param session
 *            the Sirius session from which we want to find the representation with the given name.
 * @return the corresponding representation.
 */
public static DRepresentationDescriptor getAssociatedRepresentationByName(String representationName,
        Session session) {
    if (representationName != null) {
        Collection<DRepresentationDescriptor> representations = DialectManager.INSTANCE
                .getAllRepresentationDescriptors(session);

        // Filter representations to keep only those in a selected viewpoint
        Collection<Viewpoint> selectedViewpoints = session.getSelectedViewpoints(false);

        for (DRepresentationDescriptor representation : representations) {
            boolean isDangling = new DRepresentationDescriptorQuery(representation).isDangling();
            if (!isDangling && representation != null && representationName.equals(representation.getName())
                && representation.getDescription().eContainer() instanceof Viewpoint) {
                Viewpoint vp = (Viewpoint) representation.getDescription().eContainer();
                if (selectedViewpoints.contains(vp)) {
                    return representation;
                }
            }
        }
    }

    return null;
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:33,代码来源:SiriusRepresentationUtils.java

示例2: getDescription

import org.eclipse.sirius.business.api.session.Session; //导入方法依赖的package包/类
public RepresentationDescription getDescription(Session session, String descriptionId) {
  Collection<Viewpoint> viewpoints = session.getSelectedViewpoints(true);
  for (Viewpoint viewpoint : viewpoints) {
    for (RepresentationDescription description : viewpoint.getOwnedRepresentations()) {
      if (descriptionId.equals(description.getName())) {
        return description;
      }
    }
  }
  return null;
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:12,代码来源:DiagramHelper.java

示例3: findDescription

import org.eclipse.sirius.business.api.session.Session; //导入方法依赖的package包/类
/**
 * Gets the {@link RepresentationDescription} with the given {@link RepresentationDescription#getName() description name}.
 * 
 * @param session
 *            the {@link Session}
 * @param descriptionName
 *            the {@link RepresentationDescription#getName() description name}
 * @return the {@link RepresentationDescription} with the given {@link RepresentationDescription#getName() description name} if
 *         any found, <code>null</code> otherwise
 * @throws ProviderException
 *             if the specified representation doesn't exist.
 */
public static RepresentationDescription findDescription(Session session, String descriptionName) {
    Collection<Viewpoint> selectedViewpoints = session.getSelectedViewpoints(false);
    for (Viewpoint viewpoint : selectedViewpoints) {
        EList<RepresentationDescription> ownedRepresentations = viewpoint.getOwnedRepresentations();
        for (RepresentationDescription representationDescription : ownedRepresentations) {
            if (descriptionName.equals(representationDescription.getName())) {
                return representationDescription;
            }
        }
    }
    return null;
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:25,代码来源:SiriusRepresentationUtils.java

示例4: getRepresentationByRepresentationDescriptionName

import org.eclipse.sirius.business.api.session.Session; //导入方法依赖的package包/类
/**
 * Gets the {@link List} of {@link DRepresentation} with the given {@link RepresentationDescription#getName() description name} for the
 * given {@link EObject}.
 * 
 * @param session
 *            the {@link Session}
 * @param eObj
 *            the {@link EObject}
 * @param descriptionName
 *            the {@link RepresentationDescription#getName() description name}
 * @return the {@link List} of {@link DRepresentation} with the given description name for the given {@link EObject}
 */
public static List<DRepresentation> getRepresentationByRepresentationDescriptionName(Session session, EObject eObj,
        String descriptionName) {
    final List<DRepresentation> res = new ArrayList<DRepresentation>();

    final Collection<DRepresentationDescriptor> repDescs = DialectManager.INSTANCE
            .getRepresentationDescriptors(eObj, session);
    // Filter representations to keep only those in a selected viewpoint
    final Collection<Viewpoint> selectedViewpoints = session.getSelectedViewpoints(false);

    for (DRepresentationDescriptor repDesc : repDescs) {
        boolean isDangling = new DRepresentationDescriptorQuery(repDesc).isDangling();
        if (!isDangling && repDesc.getDescription() instanceof DiagramDescription
            && descriptionName.equals(repDesc.getDescription().getName())
            && repDesc.getDescription().eContainer() instanceof Viewpoint) {
            Viewpoint vp = (Viewpoint) repDesc.getDescription().eContainer();
            if (selectedViewpoints.contains(vp)) {
                res.add(repDesc.getRepresentation());
            }
        }
    }

    return res;
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:36,代码来源:SiriusRepresentationUtils.java


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