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

Java DRepresentation类代码示例

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

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



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

示例1: getRepresentations

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的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;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:27,代码来源:SiriusEditorUtils.java


示例2: representSemanticElement

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
/**
 * Tells if the given {@link DRepresentation} represents the given {@link EObject instruction}.
 * 
 * @param representation
 *            the {@link DRepresentation}
 * @param instruction
 *            the {@link EObject instruction}
 * @return <code>true</code> if the given {@link DRepresentation} represents the given {@link EObject
 *         instruction}, <code>false</code> otherwise
 */
public static boolean representSemanticElement(DRepresentation representation, EObject instruction) {
	boolean res = false;

	if (representation.eCrossReferences().contains(instruction)) {
		res = true;
	} else {
		for (final DRepresentationElement representationElement : representation
				.getRepresentationElements()) {
			if (representationElement.eCrossReferences().contains(instruction)) {
				res = true;
				break;
			}
		}
	}

	return res;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:28,代码来源:SiriusEditorUtils.java


示例3: notifySirius

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
/**
 * Notifies Sirius about a change in the given {@link DSLBreakpoint}.
 * 
 * @param instructionUris
 *            the {@link URI}s of the instructions to refresh.
 * @param debugModelID
 *            the debug model identifier
 */
public void notifySirius(Set<URI> instructionUris, String debugModelID) {
	Map<String, Set<String>> toRefresh = representationToRefresh.get(debugModelID);
	if (toRefresh != null) {
		for (IEditingSession session : SessionUIManager.INSTANCE.getUISessions()) {
			final TransactionalEditingDomain transactionalEditingDomain = session.getSession()
					.getTransactionalEditingDomain();
			final boolean instructionPresent = isOneInstructionPresent(instructionUris,
					transactionalEditingDomain.getResourceSet());
			if (instructionPresent) {
				final List<DRepresentation> representations = getRepresentationsToRefresh(toRefresh,
						session);
				refreshRepresentations(transactionalEditingDomain, representations);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:25,代码来源:AbstractDSLDebuggerServices.java


示例4: notifySirius

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
/**
 * Notifies Sirius about a change in the given {@link DSLBreakpoint}.
 * 
 * @param instructionUri
 *            the {@link URI} of the instruction to refresh.
 */
public void notifySirius(Set<URI> instructionUris) {
	final Map<String, Set<String>> toRefresh = representationToRefresh;
	for (IEditingSession session : SessionUIManager.INSTANCE
			.getUISessions()) {
		final TransactionalEditingDomain transactionalEditingDomain = session
				.getSession().getTransactionalEditingDomain();
		final ResourceSet resourceSet = transactionalEditingDomain
				.getResourceSet();
		final boolean instructionPresent = isOneInstructionPresent(
				instructionUris, resourceSet);
		if (instructionPresent) {
			final List<DRepresentation> representations = getRepresentationsToRefresh(
					toRefresh, session);
			refreshRepresentations(transactionalEditingDomain,
					representations);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:25,代码来源:AbstractGemocAnimatorServices.java


示例5: refreshRepresentations

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
/**Refreshes given {@link DRepresentation} in the given {@link TransactionalEditingDomain}.
 * @param transactionalEditingDomain the {@link TransactionalEditingDomain}
 * @param representations the {@link List} of {@link DRepresentation} to refresh
 */
public void refreshRepresentations(
		final TransactionalEditingDomain transactionalEditingDomain,
		final List<DRepresentation> representations) {
	// TODO prevent the editors from getting dirty
	if (representations.size() != 0) {
		final RefreshRepresentationsCommand refresh = new RefreshRepresentationsCommand(
				transactionalEditingDomain,
				new NullProgressMonitor(),
				representations);
		try {
			CommandExecution.execute(transactionalEditingDomain, refresh);
		} catch (Exception e){
			String repString = representations.stream().map(r -> r.getName()).collect(Collectors.joining(", "));
			Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Failed to refresh Sirius representation(s)["+repString+"], we hope to be able to do it later", e));
		}
		
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:23,代码来源:AbstractGemocAnimatorServices.java


示例6: asImageByRepresentationDescriptionName

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
@Documentation(
    value = "Gets the Sequence of images for the diagrams 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"),
        @Param(name = "refresh", value = "true to refresh the representation"),
        @Param(name = "layerNames", value = "the OrderedSet of layer names to activate"),
    },
    result = "the Sequence of images for the diagrams associated to the given EObject with the given description name.",
    examples = {
        @Example(expression = "ePackage.asImageByRepresentationDescriptionName('class diagram', true, OrderedSet{'Layer 1', 'Layer 2'})", result = "Sequence{image1, image2}"),
    }
)
// @formatter:on
public List<MImage> asImageByRepresentationDescriptionName(EObject eObj, String descriptionName, boolean refresh,
        Set<String> layerNames) throws SizeTooLargeException, IOException {
    final List<MImage> res = new ArrayList<>();

    for (DRepresentation representation : SiriusRepresentationUtils
            .getRepresentationByRepresentationDescriptionName(session, eObj, descriptionName)) {
        res.add(asImage(representation, refresh, layerNames));
    }

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


示例7: getRepresentationsToRefresh

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的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


示例8: refreshRepresentations

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
/**
 * Refreshes given {@link DRepresentation} in the given {@link TransactionalEditingDomain}.
 * 
 * @param transactionalEditingDomain
 *            the {@link TransactionalEditingDomain}
 * @param representations
 *            the {@link List} of {@link DRepresentation} to refresh
 */
public void refreshRepresentations(final TransactionalEditingDomain transactionalEditingDomain,
		final List<DRepresentation> representations) {
	// TODO prevent the editors from getting dirty
	if (representations.size() != 0) {
		final RefreshRepresentationsCommand refresh = new RefreshRepresentationsCommand(
				transactionalEditingDomain, new NullProgressMonitor(), representations);

		CommandStack commandStack = transactionalEditingDomain.getCommandStack();

		// If the command stack is transactionnal, we add a one-shot exception handler.
		if (commandStack instanceof AbstractTransactionalCommandStack) {
			AbstractTransactionalCommandStack transactionnalCommandStack = (AbstractTransactionalCommandStack)commandStack;
			transactionnalCommandStack.setExceptionHandler(new ExceptionHandler() {

				@Override
				public void handleException(Exception e) {
					// TODO Auto-generated method stub

					String repString = representations.stream().map(r -> r.getName()).collect(
							Collectors.joining(", "));
					DebugSiriusIdeUiPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING,
							DebugSiriusIdeUiPlugin.ID, "Failed to refresh Sirius representation(s)["
									+ repString + "], we hope to be able to do it later", e));

					// Self-remove from the command stack.
					transactionnalCommandStack.setExceptionHandler(null);

				}
			});
		}

		commandStack.execute(refresh);

	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:44,代码来源:AbstractDSLDebuggerServices.java


示例9: getRepresentationsToRefresh

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的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


示例10: hasKind

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
public boolean hasKind(DRepresentation diagram, String diagramDescriptionId) {
  if (diagram != null) {
    RepresentationDescription description = getDescription(diagram);
    return hasKind(description, diagramDescriptionId);
  }
  return false;
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:8,代码来源:DiagramHelper.java


示例11: getSession

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
/**
 * Returns the current session for the given diagram_p
 * 
 * @param diagram
 * @return
 */
public Session getSession(DRepresentation diagram) {
  if (diagram instanceof DSemanticDecorator) {
    EObject target = ((DSemanticDecorator) diagram).getTarget();
    if (target == null) {
      return null;
    }
    return SessionManager.INSTANCE.getSession(target);
  }
  return null;
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:17,代码来源:DiagramHelper.java


示例12: getRepresentation

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
/**
 * @param decorator
 * @return
 */
public DRepresentation getRepresentation(DSemanticDecorator decorator) {
  if (decorator instanceof DRepresentation) {
    return ((DRepresentation) decorator);
  }
  return (DRepresentation) EcoreUtil2.getFirstContainer(decorator, ViewpointPackage.Literals.DREPRESENTATION);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:11,代码来源:DiagramHelper.java


示例13: openDiagram

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的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


示例14: getRepresentationByRepresentationDescriptionName

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的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


示例15: asImage

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
@Documentation(
    value = "Insert the image of the given representation if it's a diagram.",
    params = {
        @Param(name = "representation", value = "the DRepresentation"),
    },
    result = "insert the image of the given representation if it's a diagram.",
    examples = {
        @Example(expression = "dRepresentation.asImage()", result = "insert the image of the given representation if it's a diagram"),
    }
)
// @formatter:on
public MImage asImage(final DRepresentation representation) throws SizeTooLargeException, IOException {
    final MImage res;

    final File tmpFile = File.createTempFile(sanitize(representation.getName()) + "-m2doc", ".jpg");
    tmpFiles.add(tmpFile);

    // Make sure to run the Sirius image export in the UI thread.
    Runnable exportDiagUnitOfWork = new Runnable() {
        @Override
        public void run() {
            try {
                DialectUIManager.INSTANCE.export(representation, session, new Path(tmpFile.getAbsolutePath()),
                        FORMAT, new NullProgressMonitor());
            } catch (SizeTooLargeException e) {
                throw new RuntimeException(e);
            }

        }
    };
    if (Display.getDefault() != null) {
        Display.getDefault().syncExec(exportDiagUnitOfWork);
    } else {
        exportDiagUnitOfWork.run();
    }

    res = new MImageImpl(URI.createFileURI(tmpFile.getAbsolutePath()));

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


示例16: findRepresentationDiagram

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
private DSemanticDiagram findRepresentationDiagram(EObject eobjectRoot){
	
	if(eobjectRoot == null){
		return null;
	}
	
	EObject repRoot = alternative.getModelRootObject(ModelType.REPRESENTATIONS.getToolchainFileID());
	if(repRoot instanceof DAnalysis){
		
		DAnalysis analysis = (DAnalysis)repRoot;
		for(DView view : analysis.getOwnedViews()){
			if(view instanceof DRepresentationContainer){
				DRepresentationContainer repContainer = (DRepresentationContainer)view;
				for(DRepresentation rep : repContainer.getOwnedRepresentations()){
					if(rep instanceof DSemanticDiagram){
						DSemanticDiagram diagram = (DSemanticDiagram)rep;
						if(diagram.getTarget() == eobjectRoot){
							return diagram;
						}
					}
				}
			}
		}
		
	}
	
	return null;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:29,代码来源:InputTreeViewComposite.java


示例17: getEditorInput

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
@Override
public IEditorInput getEditorInput(Object element) {
	final IEditorInput res;

	final URI instructionURI;
	if (element instanceof EObject) {
		instructionURI = EcoreUtil.getURI((EObject)element);
	} else if (element instanceof DSLBreakpoint) {
		instructionURI = ((DSLBreakpoint)element).getURI();
	} else {
		instructionURI = null;
	}

	editor = null;
	if (instructionURI != null) {

		final Session session;
		final Session inSession;
		if (element instanceof EObject) {
			inSession = SessionManager.INSTANCE.getSession((EObject)element);
		} else {
			inSession = null;
		}
		if (inSession != null) {
			session = inSession;
		} else {
			List<Session> sessions = SiriusEditorUtils.getSessions(instructionURI);
			if (sessions.size() > 1) {
				session = selectSession(sessions);
			} else if (sessions.size() == 1) {
				session = sessions.get(0);
			} else {
				session = null;
			}
		}

		if (session != null) {
			List<DRepresentation> representations = SiriusEditorUtils.getRepresentations(session,
					instructionURI);

			final DRepresentation representation;
			if (representations.size() > 1) {
				representation = selectRepresentation(representations);
			} else if (representations.size() == 1) {
				representation = representations.get(0);
			} else {
				representation = null;
			}

			if (representation != null) {
				editor = DialectUIManager.INSTANCE.openEditor(session, representation,
						new NullProgressMonitor());
				res = editor.getEditorInput();
			} else {
				res = super.getEditorInput(instructionURI);
			}
		} else {
			res = super.getEditorInput(instructionURI);
		}
	} else {
		return null;
	}

	return res;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:66,代码来源:DSLDebugModelPresentation.java


示例18: getDescription

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


示例19: createDRepresentation

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的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


示例20: isA

import org.eclipse.sirius.viewpoint.DRepresentation; //导入依赖的package包/类
/**
 * Returns whether the given diagram use the given description
 * 
 * @param diagram
 *          current diagram
 * @param diagramDescriptionId_p
 *          a DiagramDescriptionConstants
 */
public boolean isA(DRepresentation diagram, String descriptionId) {
  if (diagram != null) {
    RepresentationDescription description = getDescription(diagram);
    return isA(description, descriptionId);
  }
  return false;
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:16,代码来源:DiagramHelper.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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