-
Notifications
You must be signed in to change notification settings - Fork 7
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
[WIP] Merge KEITH features #49
Changes from 1 commit
bff3ed3
4981102
9fb5bbb
0489849
485ef75
f024080
2063ec7
5839b7b
ec2d0bd
c88c686
bb45396
8aecd09
e6e7ae3
7828a3a
d9ef1c1
5efdf10
0717f80
8c5e1a8
76111ff
9ce3f6a
cc74bd9
cef09dc
361b189
2eb0711
518a699
2911f1e
91d30ba
ac39b6e
4bc5e8b
c10f869
26498c7
2c66f56
662b914
284b1a1
e821696
328c3ee
9f03e1f
dfa4742
f6770ce
9fb0637
5205422
c7b5f87
a56e8f9
7a7b9af
9ee1444
195704d
450a874
f1e8c3f
4ce68ca
2e76f3a
18cb08a
ef303f3
8cc8c64
16554bf
eb6ee99
98bd9b8
27d045e
63f8357
36ab3b4
901a430
dfeaf95
83994bb
c32c0cc
664f50c
3e5176f
4ea19fc
a21c5b0
47ed147
d8ae5d8
c8c06fc
13ec652
492657e
3642dc3
82709b3
f938b56
5416797
8cc95e3
e4731f0
55e605a
842ae04
ced49fa
a33b543
b8e890b
7c9b7ba
cf5afcf
d3c8a84
6243b42
396d9d1
1f95408
bc704b2
25bbdb4
f53fdeb
bb0382a
b6daf43
9bd027c
5e2d742
ff99a18
d8b9615
de6b712
f3dbdf8
9004d21
b075088
0247c07
f173888
b7fa393
bdb334a
5e0f138
07b6606
cd37baf
7df2182
27df047
9d51ddc
ebad87a
290006d
d5ca87a
aab655a
311d5b7
35e8b12
365b532
a1774ff
469916a
0a12fb1
f62b083
212c46b
312c957
3e74d1d
2b7d02a
e667242
ac20b08
151191a
0d05064
fc50a46
94b15d4
6a20b38
92fc4ae
c16ab5e
7c1335d
cf9657c
1ee66f4
3b323a5
a73f837
b527b9a
94e382f
bd84746
54e9924
2cd70c2
46b0f81
2ed24e3
5246f6e
4bdc847
240fb91
328882f
2d7ee10
e954fa9
b6995e7
3db76d6
d5dd2e5
8a15e0b
790351b
3213378
3570d12
2a57fb6
3c3ab6e
bdb6aec
abc2b6d
c218559
23d0a16
765bb1e
6c5d515
3f7111c
ab308ce
478435a
c65383d
a40bd7b
80f1894
ae8ae65
30df28b
4da94d0
307c8f6
ee6b0cc
d393885
3c32ea6
78518e7
f7c66ec
b9104ea
9c6e8c9
0973d98
f4f5e2d
b58a9b6
e808ae3
56823b3
d45aee7
67c1045
26bc4af
90f4a68
4a84a0c
f782c91
46e4f0e
d3061ef
b7bcc6e
55733d7
9ea740e
06f28ff
f20c85c
c8100f2
002a072
8c8a95b
e11825a
efb4ecc
aed80d9
f1f43ad
4da240a
3a1b271
1407515
4816710
7d8c50f
cdfd37b
b51c770
126d1bc
bf20382
a8c439c
6fd544c
27e2b70
a2b14ab
bfe0a58
2a33650
5ca065c
c32530a
a50b86a
3857c9c
9edb76e
2773010
4beb7bf
3ba6b74
7596d70
588a149
926dff3
2bef347
86657ea
2aaaf31
b451840
c2b22c5
a86714e
8988bee
4345e92
742fa13
4b61323
1db75b0
4822e95
1239195
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
generic one.
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,9 @@ public final class KlighdDataManager { | |
|
||
/** name of the 'offscreenRenderer' element. */ | ||
private static final String ELEMENT_OFFSCREEN_RENDERER = "offscreenRenderer"; | ||
|
||
/** name of the 'preservedProperties' element. */ | ||
private static final String PRESERVED_PROPERTIES = "preservedProperties"; | ||
|
||
/** name of the 'startupHook' element. */ | ||
private static final String ELEMENT_STARTUP_HOOK = "startupHook"; | ||
|
@@ -219,7 +222,7 @@ public static KlighdDataManager getInstance() { | |
private final List<CustomFigureWrapperDescriptor> customFigureWrapperMapping = Lists.newArrayList(); | ||
|
||
/** the properties that shall be preserved from the layout graph to the kgraph */ | ||
private final List<IProperty<Object>> preservedProperties = Lists.newArrayList(); | ||
private final List<IProperty<?>> preservedProperties = Lists.newArrayList(); | ||
|
||
/** | ||
* A private constructor to prevent instantiation. | ||
|
@@ -231,7 +234,6 @@ private KlighdDataManager() { | |
if (Klighd.IS_PLATFORM_RUNNING) { | ||
// load the data from the extension points | ||
loadKlighdExtensionsViaExtensionPoint(); | ||
loadPreservedPropertiesViaExtensionPoint(); | ||
try { | ||
loadDiagramSynthesesViaExtensionPoint(id2Synthesis, type2Syntheses); | ||
|
||
|
@@ -247,7 +249,6 @@ private KlighdDataManager() { | |
} else { | ||
loadDiagramSynthesesViaServiceLoader(id2Synthesis, type2Syntheses); | ||
loadKlighdExtensionsViaServiceLoader(); | ||
loadPreservedPropertiesViaServiceLoader(); | ||
} | ||
|
||
this.idSynthesisMapping = id2Synthesis; | ||
|
@@ -295,11 +296,19 @@ private void loadKlighdExtensionsViaExtensionPoint() { | |
final String elementName = element.getName(); | ||
final String id = element.getAttribute(ATTRIBUTE_ID); | ||
|
||
// 'wrapper' extensions don't define an 'id' so check for that type of extension first | ||
// before checking for a valid id | ||
// 'wrapper' and 'preservedProperties' extensions don't define an 'id' so check for that type of extension | ||
// first before checking for a valid id | ||
if (ELEMENT_WRAPPER.equals(elementName)) { | ||
registerCustomFigureWrapper(element); | ||
|
||
} else if (PRESERVED_PROPERTIES.equals(elementName)) { | ||
doRegisterExtension(element, IPreservedProperties.class, | ||
(preservedProperties) -> { | ||
for (IProperty<?> property : preservedProperties.getProperties()) { | ||
registerPreservedProperty(property); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not creating an additional method There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. The IPreservedProperties interface now is an Iterable, making this change straightforward. |
||
} | ||
}); | ||
|
||
} else if (Strings.isNullOrEmpty(id)) { | ||
final String msg = "KLighD: Found element of type '" + elementName | ||
+ "' extending extension point '" + EXTP_ID_EXTENSIONS | ||
|
@@ -369,6 +378,12 @@ private void loadKlighdExtensionsViaServiceLoader() { | |
KlighdDataManager.class.getClassLoader())) { | ||
registerAction(action.getClass().getName(), action); | ||
} | ||
for (IPreservedProperties preservedProperties : ServiceLoader.load(IPreservedProperties.class, | ||
KlighdDataManager.class.getClassLoader())) { | ||
for (IProperty<?> property : preservedProperties.getProperties()) { | ||
registerPreservedProperty(property); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a method registerPreservedProperties(Iterable<IProperty<?>>) would useful here, too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also done. |
||
} | ||
} | ||
} | ||
|
||
private <T> void doRegisterExtension(final IConfigurationElement element, | ||
|
@@ -644,7 +659,7 @@ public KlighdDataManager registerDiagramSynthesisClass(final String id, | |
return this; | ||
} | ||
|
||
public KlighdDataManager registerPreservedProperties(IProperty<Object> preservedProperty) { | ||
public KlighdDataManager registerPreservedProperty(IProperty<?> preservedProperty) { | ||
this.preservedProperties.add(preservedProperty); | ||
return this; | ||
} | ||
|
@@ -1181,45 +1196,8 @@ public List<CustomFigureWrapperDescriptor> getCustomFigureWrapperDescriptors() { | |
* | ||
* @return the {@link List} of registered properties to preserve | ||
*/ | ||
public List<IProperty<Object>> getPreservedProperties() { | ||
public List<IProperty<?>> getPreservedProperties() { | ||
return this.preservedProperties; | ||
} | ||
|
||
/** | ||
* Loads all registered extensions from the extension point 'preservedProperties' and builds up the | ||
* corresponding list of properties. | ||
*/ | ||
private void loadPreservedPropertiesViaExtensionPoint() { | ||
final Iterable<IConfigurationElement> extensions = Iterables.filter( | ||
Arrays.asList( | ||
Platform.getExtensionRegistry().getConfigurationElementsFor(IPreservedProperties.EXTENSION_POINT_ID) | ||
), | ||
element -> true | ||
); | ||
for (IConfigurationElement element : extensions) { | ||
try { | ||
preservedProperties.addAll( | ||
((IPreservedProperties<Object>) element.createExecutableExtension(IPreservedProperties.ATTRIBUTE_ID)) | ||
.getProperties()); | ||
} catch (CoreException e) { | ||
Klighd.handle( | ||
new Status(IStatus.ERROR, Klighd.PLUGIN_ID, | ||
KlighdDataManager.CORE_EXCEPTION_ERROR_MSG.replace("<<CLAZZ>>", | ||
element.getAttribute("id")), e)); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Loads the registered properties to preserve from the layout graph via Java {@link ServiceLoader}. | ||
*/ | ||
private void loadPreservedPropertiesViaServiceLoader() { | ||
final Iterable<IPreservedProperties<Object>> listOfPropertyLists = Iterables.transform( | ||
ServiceLoader.load(IPreservedProperties.class, KlighdDataManager.class.getClassLoader()), | ||
s -> s | ||
); | ||
for (IPreservedProperties<Object> propertyList : listOfPropertyLists) { | ||
preservedProperties.addAll(propertyList.getProperties()); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We agreed on having the startupHooks as an extension type within the
extensions
point declared above, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we did, and it is implemented as such. I guess I overlooked this reference when removing it again. Will remove.