本文整理汇总了Java中org.eclipse.sirius.business.api.session.Session类的典型用法代码示例。如果您正苦于以下问题:Java Session类的具体用法?Java Session怎么用?Java Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Session类属于org.eclipse.sirius.business.api.session包,在下文中一共展示了Session类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getRepresentations
import org.eclipse.sirius.business.api.session.Session; //导入依赖的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: createSession
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
public Session createSession(ResourceSet set, final URI sessionResourceURI, IProgressMonitor monitor) throws CoreException {
final TransactionalEditingDomain transactionalEditingDomain = EditingDomainFactoryService.INSTANCE.getEditingDomainFactory().createEditingDomain(set);
// Configure the resource set, its is done here and not before the
// editing domain creation which could provide its own resource set.
transactionalEditingDomain.getResourceSet().eAdapters().add(new SiriusCrossReferenceAdapterImpl());
if (Movida.isEnabled()) {
transactionalEditingDomain.getResourceSet().setURIConverter(new ViewpointURIConverter((ViewpointRegistry) org.eclipse.sirius.business.api.componentization.ViewpointRegistry.getInstance()));
}
// Create or load the session.
boolean alreadyExistingResource = exists(sessionResourceURI, transactionalEditingDomain.getResourceSet());
Session session = null;
if (alreadyExistingResource) {
session = loadSessionModelResource(sessionResourceURI, transactionalEditingDomain, monitor);
} else {
session = createSessionResource(sessionResourceURI, transactionalEditingDomain, monitor);
}
return session;
}
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:21,代码来源:DebugSessionFactory.java
示例3: linkActivated
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
@Override
public void linkActivated(final HyperlinkEvent event) {
Session session = ActivityExplorerManager.INSTANCE.getSession();
RefreshEditorsPrecommitListener repl = session.getRefreshEditorsListener();
repl.notify(SessionListener.REPRESENTATION_CHANGE);
repl.notify(SessionListener.SEMANTIC_CHANGE);
EObject root = ActivityExplorerManager.INSTANCE.getRootSemanticModel();
if (root instanceof Project) {
Project rootProject = (Project) root;
final EList<BehaviorScenario> bsList = rootProject.getDesign().getWorkloadBehavior().getBehavior();
if (bsList.isEmpty()) {
final BehaviorScenario bs = GqamFactory.eINSTANCE.createBehaviorScenario();
final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(rootProject);
domain.getCommandStack().execute(new RecordingCommand(domain) {
public void doExecute() {
bsList.add(bs);
}
});
}
linkPressed(event, bsList.get(0), session);
}
}
开发者ID:polarsys,项目名称:time4sys,代码行数:23,代码来源:BehaviorScenarioActivity.java
示例4: linkPressed
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
@Override
protected void linkPressed(final HyperlinkEvent event, final EObject project_p, final Session session) {
if (project_p instanceof Project) {
TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(project_p);
domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
final Project prj = ((Project) project_p);
final Mapping mapping = ToPeriodicDerivation.getOrApply(prj);
final DesignModel toBeAnalysedModel = (DesignModel) mapping.getSubLinks().get(0).getUniqueTargetValue("copy");
final URI uri = prj.eResource().getURI();
IPath path = new Path(uri.toPlatformString(true));
final String filename = path.lastSegment().replaceAll(".time4sys", "-report.asciidoc");
path = path.removeLastSegments(1);
path = path.append(filename);
IWorkspaceRoot wrkspc = ResourcesPlugin.getWorkspace().getRoot();
final IFile output = wrkspc.getFile(path);
generateReport(toBeAnalysedModel, output, null);
}
});
}
}
开发者ID:polarsys,项目名称:time4sys,代码行数:25,代码来源:DesignSimpleReport.java
示例5: openDashboard
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
/**
* Open the dashboard representation containing in the representation file
* of this Modeling project.
*
* @param curProject
* The modeling project containing the representations file.
*/
public void openDashboard(IProject curProject) {
final Option<ModelingProject> opionalModelingProject = ModelingProject.asModelingProject(curProject);
if (opionalModelingProject.some()) {
final Session session = opionalModelingProject.get().getSession();
if (session != null) {
final boolean initialValue = ActivityExplorerActivator.getDefault().getPreferenceStore()
.getBoolean(PreferenceConstants.P_OPEN_ACTIVITY_EXPLORER);
// in order to open activity explorer at project creation the
// preference store
// P_OPEN_ACTIVITY_EXPLORER need to be set to true
ActivityExplorerActivator.getDefault().getPreferenceStore()
.setValue(PreferenceConstants.P_OPEN_ACTIVITY_EXPLORER, true);
final IEditorPart part = ActivityExplorerManager.INSTANCE.getEditorFromSession(session);
if (part != null) {
// Activity explorer already opened
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(part);
} else {
ActivityExplorerManager.INSTANCE.openEditor(session);
}
ActivityExplorerActivator.getDefault().getPreferenceStore()
.setValue(PreferenceConstants.P_OPEN_ACTIVITY_EXPLORER, initialValue);
}
}
}
开发者ID:polarsys,项目名称:time4sys,代码行数:33,代码来源:AbstractNewModelWizard.java
示例6: addURIs
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
/**
* Get ePackage nsuri from all session resources.
*
* @param session
* Session
* @return uris list
*/
protected List<String> addURIs(Session session) {
List<String> uris = new ArrayList<>();
for (Resource resource : session.getSemanticResources()) {
if (!resource.getContents().isEmpty() && resource.getContents().get(0) instanceof EObject
&& resource.getContents().get(0).eClass() != null
&& resource.getContents().get(0).eClass().getEPackage() != null
&& resource.getContents().get(0).eClass().getEPackage().getNsURI() != null
&& !resource.getContents().get(0).eClass().getEPackage().getNsURI().isEmpty()) {
String nsURI = resource.getContents().get(0).eClass().getEPackage().getNsURI();
if (!uris.contains(nsURI)) {
uris.add(nsURI);
}
}
}
return uris;
}
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:24,代码来源:SiriusConfigurationProvider.java
示例7: postGenerate
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.obeonetwork.m2doc.genconf.provider.IConfigurationProvider#postGenerate(org.obeonetwork.m2doc.genconf.Generation,
* org.eclipse.core.resources.IProject, org.eclipse.core.resources.File, org.eclipse.core.resources.File,
* org.obeonetwork.m2doc.template.DocumentTemplate)
*/
@Override
public List<URI> postGenerate(Generation generation, URI templateURI, URI generatedURI,
DocumentTemplate documentTemplate) {
final Session session = sessions.remove(generation);
if (session != null) {
if (session.isOpen()) {
session.getTransactionalEditingDomain().getResourceSet().eAdapters()
.remove(transientAttachments.remove(session));
}
if (sessionToClose.remove(session)) {
session.close(new NullProgressMonitor());
}
}
return Collections.emptyList();
}
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:24,代码来源:SiriusConfigurationProvider.java
示例8: getSessionFromPlatformResource
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
/**
* Gets the {@link Session} path form the given platform resource {@link URI}.
*
* @param platformResourceURI
* the platform resource {@link URI}
* @return the {@link Session} path form the given platform resource {@link URI} if any, <code>null</code> otherwise
*/
private String getSessionFromPlatformResource(final URI platformResourceURI) {
final String res;
final String filePath = platformResourceURI.toPlatformString(true);
final IFile genconfFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath));
Option<ModelingProject> optionalModelingProject = ModelingProject.asModelingProject(genconfFile.getProject());
if (optionalModelingProject.some()) {
final ModelingProject project = optionalModelingProject.get();
final Session session = project.getSession();
if (session != null) {
final URI sessionURI = session.getSessionResource().getURI();
res = sessionURI.deresolve(platformResourceURI).toString();
} else {
res = null;
}
} else {
res = null;
}
return res;
}
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:27,代码来源:SiriusServiceConfigurator.java
示例9: getServices
import org.eclipse.sirius.business.api.session.Session; //导入依赖的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
示例10: getAssociatedRepresentationByName
import org.eclipse.sirius.business.api.session.Session; //导入依赖的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
示例11: getSessions
import org.eclipse.sirius.business.api.session.Session; //导入依赖的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
示例12: killPreviousSiriusSession
import org.eclipse.sirius.business.api.session.Session; //导入依赖的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
示例13: getAuthority
import org.eclipse.sirius.business.api.session.Session; //导入依赖的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
示例14: linkActivated
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
@Override
public void linkActivated(HyperlinkEvent event) {
Session session = ActivityExplorerManager.INSTANCE.getSession();
RefreshEditorsPrecommitListener repl = session.getRefreshEditorsListener();
repl.notify(SessionListener.REPRESENTATION_CHANGE);
repl.notify(SessionListener.SEMANTIC_CHANGE);
EObject root = ActivityExplorerManager.INSTANCE.getRootSemanticModel();
if (root instanceof Project) {
Project rootProject = (Project) root;
linkPressed(event, rootProject.getAnalysis(), session);
}
}
开发者ID:polarsys,项目名称:time4sys,代码行数:13,代码来源:AnalysisOverview.java
示例15: linkPressed
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
@Override
protected void linkPressed(final HyperlinkEvent event, final EObject project_p, final Session session) {
if (project_p instanceof Project) {
TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(project_p);
domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
AnalyzedSystem analyzed = ((Project) project_p).deriveAnalyzedSystem(true);
((Project) project_p).setAnalysis(analyzed);
}
});
}
}
开发者ID:polarsys,项目名称:time4sys,代码行数:16,代码来源:AnalysisTransformation.java
示例16: linkActivated
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
@Override
public void linkActivated(HyperlinkEvent event) {
Session session = ActivityExplorerManager.INSTANCE.getSession();
RefreshEditorsPrecommitListener repl = session.getRefreshEditorsListener();
repl.notify(SessionListener.REPRESENTATION_CHANGE);
repl.notify(SessionListener.SEMANTIC_CHANGE);
EObject root = ActivityExplorerManager.INSTANCE.getRootSemanticModel();
if (root instanceof Project) {
Project rootProject = (Project) root;
linkPressed(event, rootProject.getDesign(), session);
}
}
开发者ID:polarsys,项目名称:time4sys,代码行数:13,代码来源:DesignActivity.java
示例17: createSemanticResource
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
/**
* Create a new Time4Sys model in a project.
*
* @param project
* Modeling project
* @param rootObjectType
* Name of the root object
* @param newT4SFileName
* Name of the Time4Sys file
* @return Newly created Time4Sys file
*/
public static Option<IFile> createSemanticResource(final IProject project, final String rootObjectType,
final String newT4SFileName, final String newT4SFile) {
final Option<ModelingProject> modelingProject = ModelingProject.asModelingProject(project);
final Session session = modelingProject.get().getSession();
final String platformPath = getNewTime4SysModelFilePath(project, newT4SFile);
session.getTransactionalEditingDomain().getCommandStack()
.execute(new RecordingCommand(session.getTransactionalEditingDomain()) {
@Override
protected void doExecute() {
final URI semanticModelURI = URI.createPlatformResourceURI(platformPath, true);
final Resource res = new ResourceSetImpl().createResource(semanticModelURI);
/* Add the initial model object to the contents. */
final EObject rootObject = Time4SysProjectUtils.createInitialModel(rootObjectType);
if (rootObject != null) {
((Project) rootObject).setName(newT4SFileName);
res.getContents().add(rootObject);
}
try {
res.save(Maps.newHashMap());
} catch (final IOException e) {
}
session.addSemanticResource(semanticModelURI, new NullProgressMonitor());
session.save(new NullProgressMonitor());
}
});
return Options.newSome(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformPath)));
}
开发者ID:polarsys,项目名称:time4sys,代码行数:44,代码来源:Time4SysProjectUtils.java
示例18: getDescription
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
public RepresentationDescription getDescription(Session session, String descriptionId) {
Collection<Viewpoint> viewpoints = session.getSelectedViewpoints(true);
for (Viewpoint viewpoint : viewpoints) {
for (RepresentationDescription description : viewpoint.getOwnedRepresentations()) {
if (descriptionId.equals(description.getName())) {
return description;
}
}
}
return null;
}
开发者ID:polarsys,项目名称:time4sys,代码行数:12,代码来源:DiagramHelper.java
示例19: getSession
import org.eclipse.sirius.business.api.session.Session; //导入依赖的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
示例20: generateDesignTestProject
import org.eclipse.sirius.business.api.session.Session; //导入依赖的package包/类
private void generateDesignTestProject(IProject project, String extensionName, final IProgressMonitor monitor)
throws CoreException, IOException, WorkbenchException {
/*
* Create design test project
*/
IProject testProject = DesignerGeneratorUtils.genDesignTestProject(project, monitor);
/*
* Create design representation
*/
final Resource resource = resourceSet.createResource(URI.createURI(
"platform:/resource/" + testProject.getFullPath() + "/sample." + extensionName.toLowerCase()));
resource.getContents().add(OCCIFactory.eINSTANCE.createConfiguration());
resource.save(Collections.EMPTY_MAP);
// switch perspective
PlatformUI.getWorkbench().showPerspective("org.eclipse.sirius.ui.tools.perspective.modeling",
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
final Session session = ModelingProject.asModelingProject(testProject).get().getSession();
session.getTransactionalEditingDomain().getCommandStack()
.execute(new RecordingCommand(session.getTransactionalEditingDomain()) {
@Override
protected void doExecute() {
session.addSemanticResource(resource.getURI(), monitor);
}
});
WizardUtils.enableViewpoint(session,
"viewpoint:/" + project.getName() + '/' + ConverterUtils.toU1Case(extensionName) + "Configuration");
String diagramInstanceName = "Sample " + extensionName;
EObject root = WizardUtils.getRoot(session, resource.getURI());
WizardUtils.openDiagram(monitor, testProject, "Configuration Diagram", diagramInstanceName, root);
project.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:37,代码来源:DesignerGeneratorAction.java
注:本文中的org.eclipse.sirius.business.api.session.Session类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论