blob: 0a68b93ea0c229361f9668b439653d2c929a5e2f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
/*******************************************************************************
* Copyright (c) 2007, 2008 THALES GLOBAL SERVICES.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.sirius.business.api.session;
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.sirius.business.internal.session.SessionManagerImpl;
/**
* The {@link SessionManager} is responsible for a set of sessions.
*
* @author cbrun
*/
public interface SessionManager {
/**
* Default session manager instance.
*/
SessionManager INSTANCE = SessionManagerImpl.init();
/**
* Add a new listener for the session manager.
*
* @param listener
* new listener to add.
*/
void addSessionsListener(SessionManagerListener listener);
/**
* Remove the given listener.
*
* @param listener
* listener to remove.
*/
void removeSessionsListener(SessionManagerListener listener);
/**
* return the sessions currently active.
*
* @return the sessions currently active.
*/
Collection<Session> getSessions();
/**
* Add a new session.<BR>
* This method should not be called by client. It must be automatically
* called by {@link Session#open(IProgressMonitor))}.
*
* @param newSession
* session to add.
*/
void add(Session newSession);
/**
* Remove an existing session.<BR>
* This method should not be called by client. It must be automatically
* called by {@link Session#close()}.
*
* @param removedSession
* session to remove.
*/
void remove(Session removedSession);
/**
* Add a new resource in the session notifying all the manager listeners.
*
* @param session
* session in which we'll add the resource.
* @param newResource
* resource to add.
*
* @deprecated since 4.0 add
* {@link Session#addSemanticResource(URI, org.eclipse.core.runtime.IProgressMonitor)}
* instead to add semantic Resource.
*/
void addResource(Session session, Resource newResource);
/**
* Notify the session manager listeners of a Representation creation.
*
* @param session
* the session in which creation occurs
*/
void notifyRepresentationCreated(Session session);
/**
* Notify the session manager listeners of a Representation renamed.
*
* @param session
* the session in which rename occurs
* @since 2.13
*/
void notifyRepresentationRenamed(Session session);
/**
* Notify the session manager listeners of a Representation deletion.
*
* @param session
* the session in which deletion occurs
*/
void notifyRepresentationDeleted(Session session);
/**
* Try to return the session corresponding to an {@link EObject}.
*
* @param any
* semantic EObject.
* @return the corresponding session.
*/
Session getSession(EObject any);
/**
* Try to return the session corresponding to an {@link EObject}.
*
* @param semanticResource
* a semantic Resource.
* @return the corresponding session.
*/
Session getSession(Resource semanticResource);
/**
* Return the {@link Session} whose Resource's URI correspond to
* sessionResourceURI. If the Resource has already been loaded returns the
* existing Session else try to load it.
*
* @param sessionResourceURI
* a session Resource {@link URI}
* @return the corresponding session if exist.
*
* @since 4.0
* @deprecated use {@link SessionManager#getSession(URI, IProgressMonitor)}
* instead
*/
Session getSession(URI sessionResourceURI);
/**
* Return the {@link Session} whose Resource's URI correspond to
* sessionResourceURI. If the Resource has already been loaded returns the
* existing Session else try to load it.
*
* @param sessionResourceURI
* a session Resource {@link URI}
* @param monitor
* a {@link IProgressMonitor} to show progression of Session
* getting, especially if there is a resource loading
* @return the corresponding session if exist.
*/
Session getSession(URI sessionResourceURI, IProgressMonitor monitor);
/**
* Return the {@link Session} whose Resource's URI correspond to
* sessionResourceURI. If the Resource has already been loaded returns the
* existing Session else return null.
*
* @param sessionResourceURI
* a session Resource {@link URI}
* @return the corresponding session if exist.
*
* @since 4.0
*/
Session getExistingSession(URI sessionResourceURI);
}
|