File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/search/SearchPanel.java | File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/search/SearchPanel.java | |||
Method name: void initSearchProvider()
|
Method name: void initContextProvider()
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | try {↵ | 1 | try {↵ | |
2 | IExtensionHandler handler = PluginManager↵ | 2 | IExtensionHandler handler = PluginManager↵ | |
3 | .getInstance()↵ | 3 | .getInstance()↵ | |
4 | .getExtensionHandler(↵ | 4 | .getExtensionHandler(↵ | |
5 | IExtensionHandlerKeys.ORG_COLUMBA_CORE_SEARCH);↵ | 5 | IExtensionHandlerKeys.ORG_COLUMBA_CORE_CONTEXT_PROVIDER);↵ | |
6 | String[] ids = handler.getPluginIdList();↵ | 6 | String[] ids = handler.getPluginIdList();↵ | |
7 | for (int i = 0; i < ids.length; i++) {↵ | 7 | for (int i = 0; i < ids.length; i++) {↵ | |
8 | try {↵ | 8 | try {↵ | |
9 | IExtension extension = handler.getExtension(ids[i]);↵ | 9 | IExtension extension = handler.getExtension(ids[i]);↵ | |
10 | ISearchProvider provider = (ISearchProvider) extension↵ | 10 | IContextProvider provider = (IContextProvider) extension↵ | |
11 | .instanciateExtension(null);↵ | 11 | .instanciateExtension(null);↵ | |
12 | searchManager.registerProvider(provider);↵ | 12 | contextSearchManager.register(provider);↵ | |
13 | } catch (PluginException e) {↵ | 13 | } catch (PluginException e) {↵ | |
14 | LOG.severe("Error while loading plugin: " + e.getMessage());↵ | 14 | LOG.severe("Error while loading plugin: " + e.getMessage());↵ | |
15 | if (Logging.DEBUG)↵ | 15 | if (Logging.DEBUG)↵ | |
16 | e.printStackTrace();↵ | 16 | e.printStackTrace();↵ | |
17 | }↵ | 17 | }↵ | |
18 | }↵ | 18 | }↵ | |
19 | } catch (PluginHandlerNotFoundException e) {↵ | 19 | } catch (PluginHandlerNotFoundException e) {↵ | |
20 | LOG.severe("Error while loading plugin: " + e.getMessage());↵ | 20 | LOG.severe("Error while loading plugin: " + e.getMessage());↵ | |
21 | if (Logging.DEBUG)↵ | 21 | if (Logging.DEBUG)↵ | |
22 | e.printStackTrace();↵ | 22 | e.printStackTrace();↵ | |
23 | } | 23 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.6 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 26 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | try | 3 | try | |||||||||||
3 | IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_SEARCH); |
| 4 | IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_CONTEXT_PROVIDER); | ||||||||||
4 | String[] ids = handler.getPluginIdList(); | 5 | String[] ids = handler.getPluginIdList(); | |||||||||||
5 | for (int i = 0; i < ids.length; i++) | 6 | for (int i = 0; i < ids.length; i++) | |||||||||||
6 | try | 7 | try | |||||||||||
7 | IExtension extension = handler.getExtension(ids[i]); | 8 | IExtension extension = handler.getExtension(ids[i]); | |||||||||||
8 | ISearchProvider provider = (ISearchProvider)extension.instanciateExtension(null); |
| | |||||||||||
|
| 9 | IContextProvider provider = (IContextProvider)extension.instanciateExtension(null); | |||||||||||
9 | searchManager.registerProvider(provider); |
| | |||||||||||
|
| 10 | contextSearchManager.register(provider); |
Row | Violation |
---|---|
1 | Unmatched statement ISearchProvider provider=(ISearchProvider)extension.instanciateExtension(null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement ISearchProvider provider=(ISearchProvider)extension.instanciateExtension(null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
3 | Unmatched statement IContextProvider provider=(IContextProvider)extension.instanciateExtension(null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement IContextProvider provider=(IContextProvider)extension.instanciateExtension(null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
5 | Unmatched statement searchManager.registerProvider(provider); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement contextSearchManager.register(provider); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |