1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.uiextension.internal; |
21 |
|
|
22 |
|
import javax.inject.Named; |
23 |
|
import javax.inject.Singleton; |
24 |
|
|
25 |
|
import org.xwiki.component.annotation.Component; |
26 |
|
import org.xwiki.rendering.syntax.Syntax; |
27 |
|
|
28 |
|
import com.xpn.xwiki.XWiki; |
29 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
30 |
|
import com.xpn.xwiki.internal.mandatory.AbstractMandatoryDocumentInitializer; |
31 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
32 |
|
import com.xpn.xwiki.objects.classes.TextAreaClass.ContentType; |
33 |
|
import com.xpn.xwiki.objects.classes.TextAreaClass.EditorType; |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@version |
39 |
|
@since |
40 |
|
|
41 |
|
@Component |
42 |
|
@Named("XWiki.UIExtensionClass") |
43 |
|
@Singleton |
|
|
| 82.4% |
Uncovered Elements: 3 (17) |
Complexity: 3 |
Complexity Density: 0.23 |
|
44 |
|
public class UIExtensionClassDocumentInitializer extends AbstractMandatoryDocumentInitializer |
45 |
|
implements WikiUIExtensionConstants |
46 |
|
{ |
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
60 |
public UIExtensionClassDocumentInitializer()... |
51 |
|
{ |
52 |
60 |
super(XWiki.SYSTEM_SPACE, "UIExtensionClass"); |
53 |
|
} |
54 |
|
|
|
|
| 78.6% |
Uncovered Elements: 3 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
|
55 |
92 |
@Override... |
56 |
|
public boolean updateDocument(XWikiDocument document) |
57 |
|
{ |
58 |
92 |
boolean needsUpdate = false; |
59 |
|
|
60 |
92 |
BaseClass bclass = document.getXClass(); |
61 |
|
|
62 |
|
|
63 |
92 |
if (!Syntax.XWIKI_2_1.equals(document.getSyntax())) { |
64 |
0 |
document.setSyntax(Syntax.XWIKI_2_1); |
65 |
0 |
needsUpdate = true; |
66 |
|
} |
67 |
|
|
68 |
92 |
needsUpdate |= bclass.addTextField(EXTENSION_POINT_ID_PROPERTY, "Extension Point ID", 30); |
69 |
92 |
needsUpdate |= bclass.addTextField(ID_PROPERTY, "Extension ID", 30); |
70 |
|
|
71 |
92 |
needsUpdate |= bclass.addTextAreaField(CONTENT_PROPERTY, "Extension Content", 40, 10, EditorType.TEXT); |
72 |
|
|
73 |
92 |
needsUpdate |= |
74 |
|
bclass.addTextAreaField(PARAMETERS_PROPERTY, "Extension Parameters", 40, 10, ContentType.PURE_TEXT); |
75 |
92 |
needsUpdate |= bclass.addStaticListField(SCOPE_PROPERTY, "Extension Scope", 1, false, |
76 |
|
"wiki=Current Wiki|user=Current User|global=Global", "select"); |
77 |
|
|
78 |
92 |
needsUpdate |= setClassDocumentFields(document, "UI Extension Class"); |
79 |
|
|
80 |
92 |
return needsUpdate; |
81 |
|
} |
82 |
|
} |