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


Java DialectUIManager类代码示例

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


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

示例1: showInstructions

import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; //导入依赖的package包/类
/**
 * Show the given {@link List} of {@link EObject instruction}.
 * 
 * @param editorPart
 *            the opened {@link DialectEditor}
 * @param instructions
 *            the {@link List} of {@link EObject instruction} to show
 */
public static void showInstructions(DialectEditor editorPart, List<EObject> instructions) {
	Set<DRepresentationElement> representationElements = new LinkedHashSet<DRepresentationElement>();
	for (EObject instruction : instructions) {
		for (EObject eObj : new EObjectQuery(instruction).getInverseReferences(ViewpointPackage.eINSTANCE
				.getDRepresentationElement_SemanticElements())) {
			if (eObj instanceof DRepresentationElement) {
				representationElements.add((DRepresentationElement)eObj);
			}
		}
		showInstruction(editorPart, instruction);
	}
	DialectUIManager.INSTANCE.setSelection(editorPart, new ArrayList<DRepresentationElement>(
			representationElements));
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:23,代码来源:SiriusEditorUtils.java

示例2: openDiagram

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

示例3: asImage

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

示例4: openRepresentationDiagram

import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; //导入依赖的package包/类
private void openRepresentationDiagram(DSemanticDiagram diagram) {
	
	SessionManager sm = SessionManager.INSTANCE;
	Session session = sm.getSession(diagram);
	if (session == null) {
		session = sm.getSession(diagram.eResource().getURI(), new NullProgressMonitor());
		session.open(new NullProgressMonitor());
	}
	DialectUIManager manager = DialectUIManager.INSTANCE;
	manager.openEditor(session, diagram, new NullProgressMonitor());

}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:13,代码来源:InputTreeViewComposite.java

示例5: getEditorInput

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


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