| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.edit.internal; |
| 21 |
|
|
| 22 |
|
import javax.inject.Inject; |
| 23 |
|
import javax.inject.Named; |
| 24 |
|
import javax.inject.Singleton; |
| 25 |
|
|
| 26 |
|
import org.apache.commons.lang3.StringUtils; |
| 27 |
|
import org.xwiki.component.annotation.Component; |
| 28 |
|
import org.xwiki.configuration.ConfigurationSource; |
| 29 |
|
import org.xwiki.edit.Editor; |
| 30 |
|
import org.xwiki.edit.EditorConfiguration; |
| 31 |
|
import org.xwiki.rendering.block.XDOM; |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
@link@link |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
@version |
| 43 |
|
@since |
| 44 |
|
|
| 45 |
|
@Component |
| 46 |
|
@Singleton |
| |
|
| 95.5% |
Uncovered Elements: 1 (22) |
Complexity: 6 |
Complexity Density: 0.5 |
|
| 47 |
|
public class XDOMEditorConfiguration implements EditorConfiguration<XDOM> |
| 48 |
|
{ |
| 49 |
|
@Inject |
| 50 |
|
@Named("user") |
| 51 |
|
private ConfigurationSource userConfig; |
| 52 |
|
|
| 53 |
|
@Inject |
| 54 |
|
@Named("documents") |
| 55 |
|
private ConfigurationSource documentsConfig; |
| 56 |
|
|
| 57 |
|
@Inject |
| 58 |
|
@Named("xwikicfg") |
| 59 |
|
private ConfigurationSource xwikiConfig; |
| 60 |
|
|
| |
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 61 |
92 |
@Override... |
| 62 |
|
public String getDefaultEditor() |
| 63 |
|
{ |
| 64 |
92 |
String propertyName = "editor"; |
| 65 |
92 |
String defaultEditor = this.userConfig.getProperty(propertyName, String.class); |
| 66 |
92 |
if (StringUtils.isEmpty(defaultEditor)) { |
| 67 |
84 |
defaultEditor = this.documentsConfig.getProperty(propertyName, String.class); |
| 68 |
84 |
if (StringUtils.isEmpty(defaultEditor)) { |
| 69 |
84 |
defaultEditor = this.xwikiConfig.getProperty("xwiki.editor", TextXDOMEditor.ROLE_HINT); |
| 70 |
|
} |
| 71 |
|
} |
| 72 |
|
|
| 73 |
92 |
return StringUtils.lowerCase(defaultEditor); |
| 74 |
|
} |
| 75 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 76 |
429 |
@Override... |
| 77 |
|
public String getDefaultEditor(String category) |
| 78 |
|
{ |
| 79 |
429 |
if (StringUtils.isEmpty(category)) { |
| 80 |
92 |
return getDefaultEditor(); |
| 81 |
337 |
} else if (TextXDOMEditor.ROLE_HINT.equals(category)) { |
| 82 |
264 |
return TextXDOMEditor.ROLE_HINT; |
| 83 |
|
} else { |
| 84 |
73 |
return null; |
| 85 |
|
} |
| 86 |
|
} |
| 87 |
|
} |