Révision 4005
TXM/trunk/bundles/org.txm.groovy.core/src/groovy/org/txm/macro/debug/ExtensionPointsMacro.groovy (revision 4005) | ||
---|---|---|
1 |
// Copyright © 2023 MY_INSTITUTION |
|
2 |
// Licensed under the terms of the GNU General Public License version 3 (http://www.gnu.org/licenses/gpl-3.0.html) |
|
3 |
// @author mdecorde |
|
4 |
|
|
5 |
// STANDARD DECLARATIONS |
|
6 |
package org.txm.macro.debug |
|
7 |
|
|
8 |
import org.kohsuke.args4j.* |
|
9 |
import groovy.transform.Field |
|
10 |
import org.txm.rcp.swt.widget.parameters.* |
|
11 |
import org.eclipse.core.runtime.RegistryFactory; |
|
12 |
import org.txm.core.results.TXMResult; |
|
13 |
|
|
14 |
|
|
15 |
@Field @Option(name="extension_point_filter", usage="Positive filter by name", widget="String", required=false, def=".+") |
|
16 |
def extension_point_filter |
|
17 |
|
|
18 |
@Field @Option(name="extension_attribute_filter", usage="Positive filter by name", widget="String", required=false, def="") |
|
19 |
def extension_attribute_filter |
|
20 |
|
|
21 |
@Field @Option(name="extension_attribute_value_filter", usage="Positive filter by name", widget="String", required=false, def=".+") |
|
22 |
def extension_attribute_value_filter |
|
23 |
|
|
24 |
// Open the parameters input dialog box |
|
25 |
if (!ParametersDialog.open(this)) return; |
|
26 |
|
|
27 |
extension_point_filter = /$extension_point_filter/ |
|
28 |
extension_attribute_value_filter = /$extension_attribute_value_filter/ |
|
29 |
|
|
30 |
println "Extensions points: " |
|
31 |
def eps = RegistryFactory.getRegistry().getExtensionPoints() |
|
32 |
eps.sort() |
|
33 |
for (def ep : eps) { |
|
34 |
|
|
35 |
if (!(ep.getUniqueIdentifier() =~ extension_point_filter)) continue; |
|
36 |
|
|
37 |
|
|
38 |
System.out.println(ep.getUniqueIdentifier()); |
|
39 |
for (def c : RegistryFactory.getRegistry().getConfigurationElementsFor(ep.getUniqueIdentifier())) { |
|
40 |
if (extension_attribute_filter.length() > 0) { |
|
41 |
if (extension_attribute_value_filter.length() == 0) { |
|
42 |
if (c.getAttribute(extension_attribute_filter) == null) continue; |
|
43 |
} else { |
|
44 |
if (!(c.getAttribute(extension_attribute_filter) =~ extension_attribute_value_filter)) continue; |
|
45 |
} |
|
46 |
} |
|
47 |
|
|
48 |
println "\t"+c+": "+c.getAttributeNames().collect() { it-> it + "="+c.getAttribute(it) }.join(", ") |
|
49 |
} |
|
50 |
} |
|
51 |
|
Formats disponibles : Unified diff