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


Java DialectManager类代码示例

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


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

示例1: doExecute

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
 */
@Override
protected void doExecute() {
    if (this.layers.isEmpty() && this.representation instanceof DDiagram) {
        this.exportedDiagram = (DDiagram) this.representation;
        if (!isRepresentationOpened && refreshRepresentations) {
            // Force a refresh of the representation
            DialectManager.INSTANCE.refresh(exportedDiagram, new NullProgressMonitor());
        }
    } else {
        // copy representation
        this.exportedDiagram = (DDiagram) DialectManager.INSTANCE.copyRepresentation(this.representation,
                this.representation.getName() + SUFFIXE_COPY, session, MONITOR);
        // activate layers list.
        Command compoundCmd = activateLayers(this.exportedDiagram);
        if (!isRepresentationOpened) {
            new GMFDiagramUpdater(session, (DDiagram) representation);
        }
        session.getTransactionalEditingDomain().getCommandStack().execute(compoundCmd);
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:26,代码来源:PrepareDiagramCommand.java

示例2: getAssociatedRepresentationByName

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的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

示例3: getRepresentationsToRefresh

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的package包/类
/**
 * Gets the {@link List} of {@link DRepresentation} to refresh in the given {@link IEditingSession}.
 * 
 * @param toRefresh
 *            the representation names and layers to refresh
 * @param session
 *            the {@link IEditingSession}
 * @return the {@link List} of {@link DRepresentation} to refresh in the given {@link IEditingSession}
 */
private List<DRepresentation> getRepresentationsToRefresh(Map<String, Set<String>> toRefresh,
		IEditingSession session) {
	final List<DRepresentation> representations = new ArrayList<DRepresentation>();
	for (DialectEditor editor : session.getEditors()) {
		final DRepresentation representation = editor.getRepresentation();
		if (representation == null) {
			System.out.println("Dammit");
		} else {
			final RepresentationDescription description = DialectManager.INSTANCE.getDescription(
					representation);
			if (description != null) {
				final String representationId = description.getName();
				final Set<String> layerIDs = toRefresh.get(representationId);
				if (layerIDs == ANY_LAYER) {
					representations.add(representation);
				} else if (layerIDs != null && representation instanceof DDiagram && isActiveLayer(
						(DDiagram)representation, layerIDs)) {
					representations.add(representation);
				}
			}
		}
	}
	return representations;
}
 
开发者ID:SiriusLab,项目名称:ModelDebugging,代码行数:34,代码来源:AbstractDSLDebuggerServices.java

示例4: getRepresentationsToRefresh

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的package包/类
/**Gets the {@link List} of {@link DRepresentation} to refresh in the given {@link IEditingSession}.
 * @param toRefresh the representation names and layers to refresh
 * @param session the {@link IEditingSession}
 * @return the {@link List} of {@link DRepresentation} to refresh in the given {@link IEditingSession}
 */
private List<DRepresentation> getRepresentationsToRefresh(
		final Map<String, Set<String>> toRefresh,
		IEditingSession session) {
	final List<DRepresentation> representations = new ArrayList<DRepresentation>();
	for (DialectEditor editor : session.getEditors()) {
		final DRepresentation representation = editor
				.getRepresentation();
		if (representation != null) {
			final RepresentationDescription description = DialectManager.INSTANCE
					.getDescription(representation);
			if (description != null) {
				final String representationId = description.getName();
				final Set<String> layerIDs = toRefresh
						.get(representationId);
				if (layerIDs == ANY_LAYER) {
					representations.add(representation);
				} else if (layerIDs != null
						&& representation instanceof DDiagram
						&& isActiveLayer((DDiagram) representation,
								layerIDs)) {
					representations.add(representation);
				}
			}
		}
	}
	return representations;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:33,代码来源:AbstractGemocAnimatorServices.java

示例5: getRepresentationDescription

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的package包/类
/**
 * Get a representation description.
 *
 * @param eObject
 *            Semantic object
 * @param session
 *            Session
 * @param representationDescriptionId
 *            Representation description id
 * @return Representation description
 */
public static RepresentationDescription getRepresentationDescription(EObject eObject, Session session,
		String representationDescriptionId) {
	final Collection<RepresentationDescription> representationDescriptions = DialectManager.INSTANCE
			.getAvailableRepresentationDescriptions(session.getSelectedViewpoints(true), eObject);
	for (final RepresentationDescription representationDescription : representationDescriptions) {
		if (representationDescriptionId.equals(representationDescription.getName())) {
			return representationDescription;
		}
	}
	return null;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:23,代码来源:WizardUtils.java

示例6: openDiagram

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的package包/类
/**
 * The current perspective must be modeling.
 */
public static void openDiagram(final IProgressMonitor monitor, IProject project, final String diagramName,
		final String diagramInstanceName, final EObject rootObject) {
	// Init the representation
	final Option<ModelingProject> optionalModelingProject = ModelingProject.asModelingProject(project);
	if (optionalModelingProject.some()) {
		final Session session = optionalModelingProject.get().getSession();

		final RepresentationDescription representationDescription = WizardUtils
				.getRepresentationDescription(rootObject, session, diagramName);

		RecordingCommand createcommand = new RecordingCommand(session.getTransactionalEditingDomain()) {

			@Override
			protected void doExecute() {
				DRepresentation representation = DialectManager.INSTANCE.createRepresentation(diagramInstanceName,
						rootObject, representationDescription, session, monitor);
				DialectUIManager.INSTANCE.openEditor(session, representation, monitor);
			}
		};
		try {
			session.getTransactionalEditingDomain().getCommandStack().execute(createcommand);
		} catch (Exception e) {
			Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
					Messages.NewExtensionWizard_RepresentationCreationError, e));
		}
	}
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:31,代码来源:WizardUtils.java

示例7: getRepresentationByRepresentationDescriptionName

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的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

示例8: asTableByRepresentationDescriptionName

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的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;
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:35,代码来源:M2DocSiriusServices.java

示例9: getDescription

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的package包/类
public RepresentationDescription getDescription(DRepresentation representation) {
  return DialectManager.INSTANCE.getDescription(representation);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:4,代码来源:DiagramHelper.java

示例10: createDRepresentation

import org.eclipse.sirius.business.api.dialect.DialectManager; //导入依赖的package包/类
public DRepresentation createDRepresentation(String name, EObject semantic, RepresentationDescription description, Session session, IProgressMonitor monitor) {
  return DialectManager.INSTANCE.createRepresentation(name, semantic, description, session, monitor);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:4,代码来源:DiagramHelper.java


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