Skip to content

Commit d74fd00

Browse files
committed
Issue #440: resolves CustomDeclarationOrder
1 parent cb74232 commit d74fd00

1 file changed

Lines changed: 45 additions & 45 deletions

File tree

net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/config/meta/MetadataFactory.java

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,51 @@ private MetadataFactory() {
151151
refresh();
152152
}
153153

154+
/**
155+
* Creates a set of generic metadata for a module that has no metadata delivered with the plugin.
156+
*
157+
* @param module
158+
* the module
159+
* @return the generic metadata built
160+
*/
161+
public static RuleMetadata createGenericMetadata(Module module) {
162+
163+
String parent = null;
164+
try {
165+
166+
Class<?> checkClass = CheckstylePlugin.getDefault().getAddonExtensionClassLoader()
167+
.loadClass(module.getName());
168+
169+
Object moduleInstance = checkClass.getDeclaredConstructor().newInstance();
170+
171+
if (moduleInstance instanceof AbstractFileSetCheck) {
172+
parent = XMLTags.CHECKER_MODULE;
173+
} else {
174+
parent = XMLTags.TREEWALKER_MODULE;
175+
}
176+
} catch (Exception ex) {
177+
// Ok we tried... default to TreeWalker
178+
parent = XMLTags.TREEWALKER_MODULE;
179+
}
180+
181+
RuleGroupMetadata otherGroup = getRuleGroupMetadata(XMLTags.OTHER_GROUP);
182+
RuleMetadata ruleMeta = new RuleMetadata(module.getName(), module.getName(), parent,
183+
MetadataFactory.getDefaultSeverity(), false, true, true, false, otherGroup);
184+
module.setMetaData(ruleMeta);
185+
sRuleMetadata.put(ruleMeta.getInternalName(), ruleMeta);
186+
187+
List<ConfigProperty> properties = module.getProperties();
188+
int size = properties != null ? properties.size() : 0;
189+
for (int i = 0; i < size; i++) {
190+
191+
ConfigProperty property = properties.get(i);
192+
ConfigPropertyMetadata meta = new ConfigPropertyMetadata(ConfigPropertyType.String,
193+
property.getName(), null, null);
194+
property.setMetaData(meta);
195+
}
196+
return ruleMeta;
197+
}
198+
154199
/**
155200
* Create metadata for modules not present in the previously eclipse provided metadata.
156201
* Work in progress.
@@ -254,51 +299,6 @@ private static ConfigPropertyMetadata createPropertyConfig(ModuleDetails moduleD
254299

255300
}
256301

257-
/**
258-
* Creates a set of generic metadata for a module that has no metadata delivered with the plugin.
259-
*
260-
* @param module
261-
* the module
262-
* @return the generic metadata built
263-
*/
264-
public static RuleMetadata createGenericMetadata(Module module) {
265-
266-
String parent = null;
267-
try {
268-
269-
Class<?> checkClass = CheckstylePlugin.getDefault().getAddonExtensionClassLoader()
270-
.loadClass(module.getName());
271-
272-
Object moduleInstance = checkClass.getDeclaredConstructor().newInstance();
273-
274-
if (moduleInstance instanceof AbstractFileSetCheck) {
275-
parent = XMLTags.CHECKER_MODULE;
276-
} else {
277-
parent = XMLTags.TREEWALKER_MODULE;
278-
}
279-
} catch (Exception ex) {
280-
// Ok we tried... default to TreeWalker
281-
parent = XMLTags.TREEWALKER_MODULE;
282-
}
283-
284-
RuleGroupMetadata otherGroup = getRuleGroupMetadata(XMLTags.OTHER_GROUP);
285-
RuleMetadata ruleMeta = new RuleMetadata(module.getName(), module.getName(), parent,
286-
MetadataFactory.getDefaultSeverity(), false, true, true, false, otherGroup);
287-
module.setMetaData(ruleMeta);
288-
sRuleMetadata.put(ruleMeta.getInternalName(), ruleMeta);
289-
290-
List<ConfigProperty> properties = module.getProperties();
291-
int size = properties != null ? properties.size() : 0;
292-
for (int i = 0; i < size; i++) {
293-
294-
ConfigProperty property = properties.get(i);
295-
ConfigPropertyMetadata meta = new ConfigPropertyMetadata(ConfigPropertyType.String,
296-
property.getName(), null, null);
297-
property.setMetaData(meta);
298-
}
299-
return ruleMeta;
300-
}
301-
302302
/**
303303
* Create repository of Module Details from checkstyle metadata and third party extension checks metadata.
304304
*/

0 commit comments

Comments
 (0)