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

Java SessionManager类代码示例

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

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



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

示例1: getServices

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
@Override
public Set<IService> getServices(IReadOnlyQueryEnvironment queryEnvironment, Map<String, String> options) {
    final Set<IService> res = new LinkedHashSet<>();

    final String sessionURIStr = options.get(M2DocSiriusUtils.SIRIUS_SESSION_OPTION);
    if (sessionURIStr != null) {
        URI sessionURI = URI.createURI(sessionURIStr, false);
        final String genconfURIStr = options.get(GenconfUtils.GENCONF_URI_OPTION);
        if (genconfURIStr != null) {
            sessionURI = sessionURI.resolve(URI.createURI(genconfURIStr));
        }
        if (URIConverter.INSTANCE.exists(sessionURI, Collections.emptyMap())) {
            final Session session = SessionManager.INSTANCE.getSession(sessionURI, new NullProgressMonitor());
            final M2DocSiriusServices serviceInstance = new M2DocSiriusServices(session);
            res.addAll(ServiceUtils.getServices(queryEnvironment, serviceInstance));
            services.put(queryEnvironment, serviceInstance);
        }
    }

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


示例2: getSessions

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
/**
 * Gets the {@link List} of {@link Session} referencing the given semantic {@link URI}.
 * 
 * @param uri
 *            the semantic {@link URI}
 * @return the {@link List} of {@link Session} referencing the given semantic {@link URI}
 */
public static List<Session> getSessions(URI uri) {
	final List<Session> res = new ArrayList<Session>();
	final URI resourceURI = uri.trimFragment();
	for (Session session : SessionManager.INSTANCE.getSessions()) {
		for (Resource resource : session.getSemanticResources()) {
			if (resourceURI.equals(resource.getURI())) {
				res.add(session);
				break;
			}
		}
	}

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


示例3: killPreviousSiriusSession

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
private static void killPreviousSiriusSession(URI sessionResourceURI) {
	final Session session = SessionManager.INSTANCE.getExistingSession(sessionResourceURI);
	if (session != null) {
		final IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
		DebugPermissionProvider permProvider = new DebugPermissionProvider();
		if (!permProvider.provides(session.getTransactionalEditingDomain().getResourceSet())) {
			// this is a not debugSession (ie. a normal editing session)
			if (uiSession != null) {
				for (final DialectEditor editor : uiSession.getEditors()) {
					final IEditorSite editorSite = editor.getEditorSite();
					if (editor.getSite() == null) {
						editorSite.getShell().getDisplay().syncExec(new Runnable() {
							@Override
							public void run() {
								editorSite.getPage().closeEditor(editor, true);
							}
						});
					}
				}
				PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
					@Override
					public void run() {
						uiSession.close();
					}
				});
			}
		}
		PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
			@Override
			public void run() {
				session.close(new NullProgressMonitor());
				SessionManager.INSTANCE.remove(session);
			}
		});
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:37,代码来源:DefaultModelLoader.java


示例4: getAuthority

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
@Override
public IPermissionAuthority getAuthority(final ResourceSet set) {
	final DebugPermissionAuthority res;

	final DebugPermissionAuthority existing = (DebugPermissionAuthority) IExecutionCheckpoint.CHECKPOINTS
			.get(set);

	if (existing != null) {
		res = existing;
	} else {
		res = new DebugPermissionAuthority();
		IExecutionCheckpoint.CHECKPOINTS.put(set, res);
		if (set.getResources().size() > 0) {
			final Session session = SessionManager.INSTANCE.getSession(set
					.getResources().get(0));
			if (session != null) {
				session.addListener(new SessionListener() {
					@Override
					public void notify(int changeKind) {
						if (changeKind == SessionListener.CLOSED) {
							IExecutionCheckpoint.CHECKPOINTS.remove(set);
						}
					}
				});
			}
		}
	}

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


示例5: getSession

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


示例6: importExtension

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
public void importExtension(Extension extension) {
	Shell shell = Display.getCurrent().getActiveShell();
	Session session = SessionManager.INSTANCE.getSession(extension);
	LoadExtensionDialog dialog = new LoadExtensionDialog(shell, session.getTransactionalEditingDomain());
	dialog.open();

	for (URI uri : dialog.getURIs()) {
		session.addSemanticResource(uri, new NullProgressMonitor());
		Resource resource = session.getTransactionalEditingDomain().getResourceSet().getResource(uri, true);
		if (!resource.getContents().isEmpty() && (resource.getContents().get(0) instanceof Extension)
				&& !extension.getImport().contains(resource.getContents().get(0))) {
			extension.getImport().add((Extension) resource.getContents().get(0));
		}
	}
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:16,代码来源:DesignServices.java


示例7: useExtension

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
public void useExtension(Configuration configuration) {
	Shell shell = Display.getCurrent().getActiveShell();
	Session session = SessionManager.INSTANCE.getSession(configuration);
	LoadExtensionDialog dialog = new LoadExtensionDialog(shell, session.getTransactionalEditingDomain());
	dialog.open();

	for (URI uri : dialog.getURIs()) {
		session.addSemanticResource(uri, new NullProgressMonitor());
		Resource resource = session.getTransactionalEditingDomain().getResourceSet().getResource(uri, true);
		if (!resource.getContents().isEmpty() && (resource.getContents().get(0) instanceof Extension)
				&& !configuration.getUse().contains(resource.getContents().get(0))) {
			configuration.getUse().add((Extension) resource.getContents().get(0));
		}
	}
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:16,代码来源:DesignServices.java


示例8: getCoreExtension

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
/**
 * Get the OCCI core extension.
 */
private Extension getCoreExtension(EObject eobject)
{
	Session session = SessionManager.INSTANCE.getSession(eobject);
	Resource resource = session.getSessionResource().getResourceSet().getResource(
				URI.createURI(OcciCoreConstants.OCCI_CORE_URI, true), true);
	return (Extension) resource.getContents().get(0);
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:11,代码来源:DesignServices.java


示例9: closeOtherSessions

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
private static void closeOtherSessions(IProject currentProject) {
	List<Session> sessions = new ArrayList<Session>(SessionManager.INSTANCE.getSessions());
	Session currentSession = null;
	ModelingProject modelingProject = ModelingProject.asModelingProject(currentProject).get();
	if (modelingProject != null) {
		currentSession = modelingProject.getSession();
	}
	for (Session session : sessions) {
		if (!session.equals(currentSession)) {
			session.close(null);
		}
	}
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:14,代码来源:RegisterAllOCCIExtensionAction.java


示例10: closeOtherSessions

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
private static void closeOtherSessions(IProject currentProject) {
    List<Session> sessions = new ArrayList<Session>(SessionManager.INSTANCE.getSessions());
    Session currentSession = null;
    ModelingProject modelingProject = ModelingProject.asModelingProject(currentProject).get();
    if (modelingProject != null) {
        currentSession = modelingProject.getSession();
    }
    for (Session session : sessions) {
        if (!session.equals(currentSession)) {
            session.close(null);
        }
    }
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:14,代码来源:RegisterOCCIExtensionAction.java


示例11: createResourceSetForModels

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
@Override
public ResourceSet createResourceSetForModels(Generation generation) {
    ResourceSet created = null;
    final Map<String, String> options = GenconfUtils.getOptions(generation);
    final String representationsFileName = options.get(M2DocSiriusUtils.SIRIUS_SESSION_OPTION);
    if (representationsFileName != null) {
        final URI sessionURI = GenconfUtils.getResolvedURI(generation,
                URI.createURI(representationsFileName, false));
        if (URIConverter.INSTANCE.exists(sessionURI, Collections.emptyMap())) {
            try {
                final Session session = SessionManager.INSTANCE.getSession(sessionURI, new NullProgressMonitor());
                sessions.put(generation, session);
                if (!session.isOpen()) {
                    session.open(new NullProgressMonitor());
                    sessionToClose.add(session);
                }
                created = session.getTransactionalEditingDomain().getResourceSet();
                SessionTransientAttachment transiantAttachment = new SessionTransientAttachment(session);
                created.eAdapters().add(transiantAttachment);
                transientAttachments.put(session, transiantAttachment);
                // CHECKSTYLE:OFF
            } catch (Exception e) {
                // CHECKSTYLE:ON
                // TODO remove this workaround see https://support.jira.obeo.fr/browse/VP-5389
                if (PlatformUI.isWorkbenchRunning()) {
                    MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                            "Unable to open Sirius Session",
                            "Check the " + M2DocSiriusUtils.SIRIUS_SESSION_OPTION
                                + " option or try to open the session manually by double clicking the .aird file:\n"
                                + e.getMessage());
                }
            }
        } else {
            throw new IllegalArgumentException("The Sirius session doesn't exists: " + sessionURI);
        }
    }
    return created;
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:39,代码来源:SiriusConfigurationProvider.java


示例12: engineAboutToDispose

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
@Override
public void engineAboutToDispose(IExecutionEngine engine) {
	if (engine.getExecutionContext().getRunConfiguration()
			.getAnimatorURI() != null) {
		Session session = SessionManager.INSTANCE.getSession(engine
				.getExecutionContext().getRunConfiguration()
				.getAnimatorURI(), new NullProgressMonitor());
		session.close(new NullProgressMonitor());
		SessionManager.INSTANCE.remove(session);
	}
}
 
开发者ID:SiriusLab,项目名称:ModelDebugging,代码行数:12,代码来源:AbstractGemocAnimatorServices.java


示例13: openRepresentationDiagram

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


示例14: createLaunchConfiguration

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
@Override
protected ILaunchConfiguration[] createLaunchConfiguration(IResource file, EObject firstInstruction,
		String mode) throws CoreException {
	final ILaunchConfiguration[] res;
	if (SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(file.getFileExtension())) {
		final IResource semanticFile;
		if (firstInstruction != null) {
			semanticFile = getLaunchableResource(new StructuredSelection(firstInstruction));
			res = super.createLaunchConfiguration(semanticFile, firstInstruction, mode);
		} else {
			final Session session = SessionManager.INSTANCE.getSession(URI.createPlatformResourceURI(file
					.getFullPath().toString(), true), new NullProgressMonitor());
			session.getSemanticResources();
			// prompt the selection of an instruction from the Session EResources
			EObject selectedInstruction = DSLLaunchConfigurationTab.openFirstInstructionSelection(
					PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), session
							.getTransactionalEditingDomain().getResourceSet());
			if (selectedInstruction != null) {
				semanticFile = getLaunchableResource(new StructuredSelection(selectedInstruction));
				res = super.createLaunchConfiguration(semanticFile, selectedInstruction, mode);
			} else {
				// TODO we have to few information to create the launch configuration prompt the user for
				// aird + first instruction ?
				semanticFile = null;
				res = super.createLaunchConfiguration(file, firstInstruction, mode);
			}
		}
		for (ILaunchConfiguration config : res) {
			if (config instanceof ILaunchConfigurationWorkingCopy) {
				((ILaunchConfigurationWorkingCopy)config).setAttribute(SIRIUS_RESOURCE_URI, file
						.getFullPath().toString());
				if (semanticFile != null) {
					IResource[] resources = config.getMappedResources();
					resources = Arrays.copyOf(resources, resources.length + 1);
					resources[resources.length - 1] = file;
					((ILaunchConfigurationWorkingCopy)config).setMappedResources(resources);
				}
				((ILaunchConfigurationWorkingCopy)config).doSave();
			}
		}
	} else {
		// TODO? assume the file is the first instruction resource
		res = super.createLaunchConfiguration(file, firstInstruction, mode);
	}
	return res;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:47,代码来源:AbstractDSLLaunchConfigurationDelegateSiriusUI.java


示例15: getEditorInput

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


示例16: getMappingManager

import org.eclipse.sirius.business.api.session.SessionManager; //导入依赖的package包/类
private DiagramMappingsManager getMappingManager(final DSemanticDiagram diagram) {
	Session session = SessionManager.INSTANCE.getSession(diagram.getTarget());
	return DiagramMappingsManagerRegistry.INSTANCE.getDiagramMappingsManager(session, diagram);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:5,代码来源:DiagramServices.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java XAxisRendererHorizontalBarChart类代码示例发布时间:2022-05-23
下一篇:
Java Event类代码示例发布时间: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