本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}