本文整理汇总了Java中org.eclipse.sirius.viewpoint.DRepresentationDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java DRepresentationDescriptor类的具体用法?Java DRepresentationDescriptor怎么用?Java DRepresentationDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DRepresentationDescriptor类属于org.eclipse.sirius.viewpoint包,在下文中一共展示了DRepresentationDescriptor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRepresentations
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; //导入依赖的package包/类
/**
* Gets the {@link List} of {@link DRepresentation} representing the given instruction.
*
* @param session
* the {@link Session}
* @param instructionURI
* the instruction {@link URI}
* @return the {@link List} of {@link DRepresentation} representing the given instruction
*/
public static List<DRepresentation> getRepresentations(Session session, URI instructionURI) {
final List<DRepresentation> res = new ArrayList<DRepresentation>();
final EObject instruction = session.getTransactionalEditingDomain().getResourceSet().getEObject(
instructionURI, false);
for (DView view : session.getSelectedViews()) {
for (DRepresentationDescriptor rdescriptor : view.getOwnedRepresentationDescriptors()) {
DRepresentation representation = rdescriptor.getRepresentation();
if (representSemanticElement(representation, instruction)) {
res.add(representation);
}
}
}
return res;
}
示例2: getAssociatedRepresentationByName
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; //导入依赖的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;
}
示例3: asImageByRepresentationName
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; //导入依赖的package包/类
@Documentation(
value = "Insert the image of the given representation name.",
params = {
@Param(name = "representationName", value = "the name of the searched representation"),
},
result = "Insert the image of the given representation name",
examples = {
@Example(expression = "'MyEPackage class diagram'.asImageByRepresentationName()", result = "insert the image"),
}
)
// @formatter:on
public MImage asImageByRepresentationName(String representationName) throws SizeTooLargeException, IOException {
final MImage res;
final DRepresentationDescriptor descriptor = SiriusRepresentationUtils
.getAssociatedRepresentationByName(representationName, session);
if (descriptor != null) {
res = asImage(descriptor.getRepresentation());
} else {
res = null;
}
return res;
}
示例4: asTableByRepresentationName
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; //导入依赖的package包/类
@Documentation(
value = "Insert the table of the given representation name.",
params = {
@Param(name = "representationName", value = "the name of the searched representation"),
},
result = "Insert the table of the given representation name",
examples = {
@Example(expression = "'MyEPackage class diagram'.asTableByRepresentationName()", result = "insert the table"),
}
)
// @formatter:on
public MTable asTableByRepresentationName(String representationName) {
final MTable res;
final DRepresentationDescriptor description = SiriusRepresentationUtils
.getAssociatedRepresentationByName(representationName, session);
if (description != null && description.getRepresentation() instanceof DTable) {
res = asTable((DTable) description.getRepresentation());
} else {
res = null;
}
return res;
}
示例5: run
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; //导入依赖的package包/类
/**
* delete the representation.
*/
@Override
public void run() {
final Set<DRepresentationDescriptor> representations = new LinkedHashSet<DRepresentationDescriptor>();
representations.add(representation);
session.getTransactionalEditingDomain().getCommandStack()
.execute(new DeleteRepresentationCommand(session, representations));
}
示例6: getRepresentationByRepresentationDescriptionName
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; //导入依赖的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;
}
示例7: asTableByRepresentationDescriptionName
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; //导入依赖的package包/类
@Documentation(
value = "Gets the Sequence of tables for the tables associated to the given EObject with the given description name.",
params = {
@Param(name = "eObject", value = "Any eObject that is in the session where to search"),
@Param(name = "representationDescriptionName", value = "the name of the searched representation description"),
},
result = "the Sequence of tables for the tables associated to the given EObject with the given description name.",
examples = {
@Example(expression = "ePackage.asTableByRepresentationDescriptionName('dependency table')", result = "Sequence{table1, table2}"),
}
)
// @formatter:on
public List<MTable> asTableByRepresentationDescriptionName(EObject eObj, String descriptionName) {
final List<MTable> res = new ArrayList<>();
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 TableDescription
&& descriptionName.equals(repDesc.getDescription().getName())
&& repDesc.getDescription().eContainer() instanceof Viewpoint) {
Viewpoint vp = (Viewpoint) repDesc.getDescription().eContainer();
if (selectedViewpoints.contains(vp)) {
res.add(asTable((DTable) repDesc.getRepresentation()));
}
}
}
return res;
}
示例8: CleaningAIRDJob
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; //导入依赖的package包/类
/**
* Create a new {@link CleaningAIRDJob} instance given a semantic object a session and a representation.
*
* @param semantic
* the semantic object
* @param session
* the session.
* @param representation
* the representation to delete.
*/
public CleaningAIRDJob(EObject semantic, Session session, DRepresentationDescriptor representation) {
if (semantic == null || session == null || representation == null) {
throw new IllegalArgumentException("a null argument has been passed to the CleaningAIRDJob constructor");
}
this.session = session;
this.representation = representation;
}
示例9: getAssociatedRepresentationByDescriptionAndName
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; //导入依赖的package包/类
/**
* Retrieve all representations whose target is the specified EObject and description the given one.
*
* @param targetRootObject
* Object which is the target of the representations.
* @param representationId
* the diagram description from which we want to retrieve representations.
* @return all representations whose target is the specified EObject
*/
protected List<DRepresentationDescriptor> getAssociatedRepresentationByDescriptionAndName(EObject targetRootObject,
String representationId) {
return getAssociatedRepresentationByDescriptionAndName(targetRootObject, representationId, false);
}