-
Notifications
You must be signed in to change notification settings - Fork 28
Collab advanced #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Collab advanced #241
Changes from 10 commits
e0a973b
256efb0
aca65d5
07b0d59
e028999
d8d6b5a
4cede84
69458c6
20239aa
5e6c70f
127954b
d5ae6f0
62521fd
8d378b1
c146392
8adc42b
16c762b
b03b60d
b57e6b8
e7442ca
e4e1637
29a124a
3ac4556
711aea7
1372448
75f5577
ecc595e
09bd204
509762f
7660f10
810a4ae
add144a
e39ff76
240aa82
4a8be94
a2aa2e0
fd93384
869bd2e
169c1d9
0a15627
d598a99
44fd729
5fcc9ff
51383ac
b68e8cc
ee0273d
321094d
22ba4e0
3cce802
388160c
6508f85
211fe3c
537502e
e565e25
3ce80ce
7c94bc9
b28dc41
72c1c59
94f7658
893663a
828eb37
2ee2d54
17b959b
d3f70af
b14d1ba
19600e7
bffdd11
1d3f8b4
dc6239f
3d9df79
fdcc09c
66c8e7d
c3ff7f8
8ebeee8
4057635
2e3477b
eeece97
0644ec8
5cc08aa
acc8e99
bef86fa
736732c
94d0469
9e0966f
5ef121f
eb92049
500248a
fadb5e5
4aff77d
9ca913d
6816814
d36f040
0c45065
b19c75c
e2ee370
a41def6
1cdaf34
55413f7
f4caf3d
ef228ce
e3212d2
de979e3
3b69c61
bfd1d4a
673a5c5
80861b1
93602f6
2689a11
45d8bb7
48c8421
2a13df9
edfdeec
4f63c49
d8c5aea
010c9c0
03b2954
690a6ae
968a911
abfee53
7dbeac2
ecfd74c
870cbac
e01800e
20f1d2a
49add54
1dfd99f
4031e35
fe0583f
24d6e3e
1c88981
5b2ddd5
6ae7edb
9c23872
afc9995
7d77a6a
cde176a
b658f26
7b83708
4b59106
e9e541d
42df2f9
c53b472
3e896ab
f599b30
2e68379
4086508
6a73618
2c98175
8e04f99
9d5605c
bb8c083
ffdd8d2
db1154f
a0ede16
5de00e2
2c89a2d
cd912b2
284e2dd
cbff858
88719d8
e1e1ef4
3cd5d8a
30f049b
a398b24
24a9ee7
75284c4
406046b
5a0d50b
0ef0a7e
a5107f0
4a5bb99
75cf930
593b597
6d96d40
f4ebcf0
365d38b
63dc23b
cfa7065
017bf0e
d835a03
adb437d
19a4bfd
dbc2f53
353b98a
de002f8
63ac005
92b3258
975dec8
d01e5da
0f9e3ee
3e31289
7ecc193
947ad04
c8389fa
ff544bc
4e59c8e
b061e44
7dc105e
c242862
2d38664
0814290
c17a028
3a422c8
28f8498
3ba1ec1
6df5044
3586921
dece944
de3825e
3d47c33
78a5fbd
7a40ce7
78ec6bc
bae2608
3d8d7f4
960bfb6
9738515
3f46eee
384e49c
d1f939b
f421a56
e7f46ab
f137307
f5eda9c
cfb3ec5
4a2c8dc
fee6301
2830044
d37d7df
b214e07
411ddfa
ae71e47
2fb9f99
6441a5b
36832c4
76e45eb
64419ec
00a8f77
050c1b0
44188ce
6bea5d5
952d7ed
04ec7b9
2484659
354a11e
66a75da
c8715d2
dbce3c0
03c6f94
7ab57b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.eclipse.glsp.server.command; | ||
Check warning on line 1 in plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/command/CommandStackFactory.java
|
||
MatthiasHofstaetter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import org.eclipse.emf.common.command.CommandStack; | ||
|
||
public interface CommandStackFactory { | ||
CommandStack createCommandStack(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.eclipse.glsp.server.command; | ||
Check warning on line 1 in plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/command/CommandStackManager.java
|
||
MatthiasHofstaetter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import org.eclipse.emf.common.command.CommandStack; | ||
|
||
import java.util.List; | ||
|
||
public interface CommandStackManager { | ||
CommandStack getOrCreateCommandStack(String subclientId); | ||
|
||
List<CommandStack> getAllCommandStacks(); | ||
|
||
void setCommandStack(CommandStack commandStack, String subclientId); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.eclipse.glsp.server.command; | ||
Check warning on line 1 in plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/command/DefaultCommandStackManager.java
|
||
MatthiasHofstaetter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import com.google.inject.Inject; | ||
import org.eclipse.emf.common.command.CommandStack; | ||
import org.eclipse.glsp.server.utils.CollaborationUtil; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class DefaultCommandStackManager implements CommandStackManager { | ||
|
||
@Inject | ||
CommandStackFactory factory; | ||
Check warning on line 15 in plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/command/DefaultCommandStackManager.java
|
||
|
||
// subclientId, CommandStack | ||
protected Map<String, CommandStack> commandStackMap = new HashMap<>(); | ||
|
||
@Override | ||
public CommandStack getOrCreateCommandStack(final String subclientId) { | ||
String subclientIdOrFallback = getSubclientIdOrFallback(subclientId); | ||
if (commandStackMap.containsKey(subclientIdOrFallback)) { | ||
return commandStackMap.get(subclientIdOrFallback); | ||
} | ||
|
||
CommandStack commandStack = factory.createCommandStack(); | ||
commandStackMap.put(subclientIdOrFallback, commandStack); | ||
return commandStack; | ||
} | ||
|
||
@Override | ||
public List<CommandStack> getAllCommandStacks() { | ||
return new ArrayList<>(commandStackMap.values()); | ||
} | ||
|
||
@Override | ||
public void setCommandStack(final CommandStack commandStack, final String subclientId) { | ||
String subclientIdOrFallback = getSubclientIdOrFallback(subclientId); | ||
if (commandStackMap.containsKey(subclientIdOrFallback)) { | ||
commandStackMap.get(subclientIdOrFallback).flush(); | ||
} | ||
commandStackMap.put(subclientIdOrFallback, commandStack); | ||
} | ||
|
||
private String getSubclientIdOrFallback(final String subclientId) { | ||
if (subclientId != null) { | ||
return subclientId; | ||
} | ||
return CollaborationUtil.FALLBACK_SUBCLIENT_ID; | ||
} | ||
|
||
} |
Uh oh!
There was an error while loading. Please reload this page.