Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e337b03

Browse files
committed
Markdown support
- Add com.archimatetool.markdown plug-in - Add preview tab in Property Documentation, Purpose and Content sections - Render in Jasper and HTML reports - Add a DocumentationMDRenderer for label expressions. This uses a TextContentRenderer to strip out MD - Very limited support of rendering HTML in Jasper Reports so use a TextContentRenderer
1 parent f71d938 commit e337b03

63 files changed

Lines changed: 948 additions & 179 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

com.archimatetool.canvas/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Require-Bundle: org.eclipse.core.runtime,
1414
org.eclipse.ui.views.properties.tabbed,
1515
com.archimatetool.editor,
1616
com.archimatetool.jdom,
17+
com.archimatetool.markdown,
1718
com.archimatetool.templates
1819
Bundle-ClassPath: com.archimatetool.canvas.jar
1920
Bundle-Activator: com.archimatetool.canvas.CanvasEditorPlugin

com.archimatetool.canvas/src/com/archimatetool/canvas/figures/CanvasBlockFigure.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.archimatetool.editor.diagram.figures.TextPositionDelegate;
2727
import com.archimatetool.editor.ui.ColorFactory;
2828
import com.archimatetool.editor.utils.StringUtils;
29+
import com.archimatetool.markdown.MarkdownUtils;
2930
import com.archimatetool.model.IDiagramModelObject;
3031

3132

@@ -98,6 +99,7 @@ public void refreshVisuals() {
9899
@Override
99100
public void setText() {
100101
String content = getDiagramModelObject().getContent();
102+
content = MarkdownUtils.convertMarkdownToText(content);
101103
getTextControl().setText(StringUtils.safeString(content));
102104
}
103105

com.archimatetool.canvas/src/com/archimatetool/canvas/figures/CanvasStickyFigure.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.archimatetool.editor.ui.ColorFactory;
2929
import com.archimatetool.editor.utils.PlatformUtils;
3030
import com.archimatetool.editor.utils.StringUtils;
31+
import com.archimatetool.markdown.MarkdownUtils;
3132

3233

3334
/**
@@ -86,6 +87,7 @@ public void refreshVisuals() {
8687
@Override
8788
public void setText() {
8889
String text = getDiagramModelObject().getContent();
90+
text = MarkdownUtils.convertMarkdownToText(text);
8991
getTextControl().setText(StringUtils.safeString(text));
9092
}
9193

com.archimatetool.editor.feature/feature.xml

Lines changed: 16 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -38,152 +38,98 @@ OTHER DEALINGS IN THE SOFTWARE.
3838

3939
<plugin
4040
id="com.archimatetool.canvas"
41-
download-size="0"
42-
install-size="0"
4341
version="0.0.0"/>
4442

4543
<plugin
4644
id="com.archimatetool.csv"
47-
download-size="0"
48-
install-size="0"
49-
version="0.0.0"
50-
unpack="false"/>
45+
version="0.0.0"/>
5146

5247
<plugin
5348
id="com.archimatetool.editor"
54-
download-size="0"
55-
install-size="0"
5649
version="0.0.0"/>
5750

5851
<plugin
5952
id="com.archimatetool.editor.themes"
60-
download-size="0"
61-
install-size="0"
6253
version="0.0.0"/>
6354

6455
<plugin
6556
id="com.archimatetool.export.svg"
66-
download-size="0"
67-
install-size="0"
6857
version="0.0.0"/>
6958

7059
<plugin
7160
id="com.archimatetool.hammer"
72-
download-size="0"
73-
install-size="0"
74-
version="0.0.0"
75-
unpack="false"/>
61+
version="0.0.0"/>
7662

7763
<plugin
7864
id="com.archimatetool.help"
79-
download-size="0"
80-
install-size="0"
8165
version="0.0.0"/>
8266

8367
<plugin
8468
id="com.archimatetool.jasperreports"
85-
download-size="0"
86-
install-size="0"
8769
version="0.0.0"/>
8870

8971
<plugin
9072
id="com.archimatetool.jdom"
91-
download-size="0"
92-
install-size="0"
9373
version="0.0.0"/>
9474

9575
<plugin
9676
id="com.archimatetool.model"
97-
download-size="0"
98-
install-size="0"
9977
version="0.0.0"/>
10078

10179
<plugin
10280
id="com.archimatetool.reports"
103-
download-size="0"
104-
install-size="0"
10581
version="0.0.0"/>
10682

10783
<plugin
10884
id="com.archimatetool.templates"
109-
download-size="0"
110-
install-size="0"
11185
version="0.0.0"/>
11286

11387
<plugin
11488
id="com.archimatetool.widgets"
115-
download-size="0"
116-
install-size="0"
11789
version="0.0.0"/>
11890

11991
<plugin
12092
id="com.archimatetool.zest"
121-
download-size="0"
122-
install-size="0"
123-
version="0.0.0"
124-
unpack="false"/>
93+
version="0.0.0"/>
12594

12695
<plugin
12796
id="com.archimatetool.editor.browser"
128-
download-size="0"
129-
install-size="0"
130-
version="0.0.0"
131-
unpack="false"/>
97+
version="0.0.0"/>
13298

13399
<plugin
134100
id="com.archimatetool.commandline"
135-
download-size="0"
136-
install-size="0"
137-
version="0.0.0"
138-
unpack="false"/>
101+
version="0.0.0"/>
139102

140103
<plugin
141104
id="com.archimatetool.reports.commandline"
142-
download-size="0"
143-
install-size="0"
144-
version="0.0.0"
145-
unpack="false"/>
105+
version="0.0.0"/>
146106

147107
<plugin
148108
id="com.archimatetool.csv.commandline"
149-
download-size="0"
150-
install-size="0"
151-
version="0.0.0"
152-
unpack="false"/>
109+
version="0.0.0"/>
153110

154111
<plugin
155112
id="com.archimatetool.jasperreports.commandline"
156-
download-size="0"
157-
install-size="0"
158-
version="0.0.0"
159-
unpack="false"/>
113+
version="0.0.0"/>
160114

161115
<plugin
162116
id="org.opengroup.archimate.xmlexchange"
163-
download-size="0"
164-
install-size="0"
165-
version="0.0.0"
166-
unpack="false"/>
117+
version="0.0.0"/>
167118

168119
<plugin
169120
id="org.opengroup.archimate.xmlexchange.commandline"
170-
download-size="0"
171-
install-size="0"
172-
version="0.0.0"
173-
unpack="false"/>
121+
version="0.0.0"/>
174122

175123
<plugin
176124
id="com.archimatetool.modelimporter"
177-
download-size="0"
178-
install-size="0"
179-
version="0.0.0"
180-
unpack="false"/>
125+
version="0.0.0"/>
181126

182127
<plugin
183128
id="com.archimatetool.modelimporter.commandline"
184-
download-size="0"
185-
install-size="0"
186-
version="0.0.0"
187-
unpack="false"/>
129+
version="0.0.0"/>
130+
131+
<plugin
132+
id="com.archimatetool.markdown"
133+
version="0.0.0"/>
188134

189135
</feature>

com.archimatetool.editor/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Require-Bundle: org.eclipse.core.runtime,
1818
org.eclipse.ui.views.properties.tabbed;visibility:=reexport,
1919
com.archimatetool.model;visibility:=reexport,
2020
com.archimatetool.jdom,
21+
com.archimatetool.markdown,
2122
com.archimatetool.widgets,
2223
org.eclipse.e4.core.services,
2324
org.eclipse.e4.core.contexts,

com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/diagram/NoteFigure.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.archimatetool.editor.diagram.figures.IconicDelegate;
2323
import com.archimatetool.editor.diagram.figures.TextPositionDelegate;
2424
import com.archimatetool.editor.ui.textrender.TextRenderer;
25+
import com.archimatetool.markdown.MarkdownUtils;
2526
import com.archimatetool.model.IDiagramModelNote;
2627
import com.archimatetool.model.IDiagramModelObject;
2728

@@ -80,6 +81,7 @@ public void refreshVisuals() {
8081
@Override
8182
public void setText() {
8283
String text = TextRenderer.getDefault().render(getDiagramModelObject(), getDiagramModelObject().getContent());
84+
text = MarkdownUtils.convertMarkdownToText(text);
8385
fTextFlow.setText(text);
8486
}
8587

com.archimatetool.editor/src/com/archimatetool/editor/diagram/sketch/figures/StickyFigure.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import com.archimatetool.editor.diagram.figures.AbstractTextControlContainerFigure;
1414
import com.archimatetool.editor.utils.StringUtils;
15+
import com.archimatetool.markdown.MarkdownUtils;
1516
import com.archimatetool.model.IDiagramModelObject;
1617
import com.archimatetool.model.ISketchModelSticky;
1718

@@ -30,6 +31,7 @@ public StickyFigure(ISketchModelSticky diagramModelSticky) {
3031
@Override
3132
public void setText() {
3233
String text = getDiagramModelObject().getContent();
34+
text = MarkdownUtils.convertMarkdownToText(text);
3335
((TextFlow)getTextControl()).setText(StringUtils.safeString(text));
3436
}
3537

com.archimatetool.editor/src/com/archimatetool/editor/propertysections/AbstractArchiPropertySection.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,17 @@ protected Text createSingleTextControl(Composite parent, int style) {
147147
* @return A StyledTextControl
148148
*/
149149
protected StyledTextControl createStyledTextControl(Composite parent, int style) {
150-
StyledTextControl styledTextControl = new StyledTextControl(parent, style | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
150+
return createStyledTextControl(parent, style, true);
151+
}
152+
153+
/**
154+
* @param parent Parent
155+
* @param style The style
156+
* @param renderLinks if true will render links
157+
* @return A StyledTextControl
158+
*/
159+
protected StyledTextControl createStyledTextControl(Composite parent, int style, boolean renderLinks) {
160+
StyledTextControl styledTextControl = new StyledTextControl(parent, style | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP, renderLinks);
151161

152162
// Add listener to disable global actions when it gets the focus
153163
addGlobalActionDisablementListener(styledTextControl.getControl());

com.archimatetool.editor/src/com/archimatetool/editor/propertysections/AbstractECorePropertySection.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,23 @@ protected PropertySectionTextControl createDocumentationControl(Composite parent
288288
return createDocumentationPropertySectionTextControl(styledTextControl.getControl());
289289
}
290290

291+
/**
292+
* Create a Documentation Markdown control
293+
*/
294+
protected MarkdownControl createDocumentationMarkdownControl(Composite parent, String hint) {
295+
// Label
296+
createLabel(parent, Messages.AbstractECorePropertySection_2, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.NONE);
297+
298+
MarkdownControl markDownControl = new MarkdownControl(parent, this, Messages.AbstractNameDocumentationSection_1) {
299+
@Override
300+
protected PropertySectionTextControl createPropertySectionTextControl(StyledTextControl styledTextControl) {
301+
return createDocumentationPropertySectionTextControl(styledTextControl.getControl());
302+
}
303+
};
304+
305+
return markDownControl;
306+
}
307+
291308
/**
292309
* Create a PropertySectionTextControl for Documentation
293310
*/

com.archimatetool.editor/src/com/archimatetool/editor/propertysections/AbstractNameDocumentationSection.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ public abstract class AbstractNameDocumentationSection extends AbstractECoreProp
2323
private static final String HELP_ID = "com.archimatetool.help.elementPropertySection"; //$NON-NLS-1$
2424

2525
protected PropertySectionTextControl fTextName;
26-
protected PropertySectionTextControl fTextDocumentation;
26+
protected MarkdownControl documentationMarkdownControl;
2727

2828
@Override
2929
protected void createControls(Composite parent) {
3030
fTextName = createNameControl(parent, Messages.AbstractNameDocumentationSection_0);
31-
fTextDocumentation = createDocumentationControl(parent, Messages.AbstractNameDocumentationSection_1);
32-
31+
documentationMarkdownControl = createDocumentationMarkdownControl(parent, Messages.AbstractNameDocumentationSection_1);
32+
3333
// Help ID
3434
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
3535
}
@@ -73,12 +73,21 @@ protected void refreshDocumentationField() {
7373
return;
7474
}
7575

76-
fTextDocumentation.refresh(getFirstSelectedObject());
77-
fTextDocumentation.setEditable(!isLocked(getFirstSelectedObject()));
76+
documentationMarkdownControl.update();
7877
}
7978

8079
@Override
8180
public boolean shouldUseExtraSpace() {
8281
return true;
8382
}
83+
84+
@Override
85+
public void dispose() {
86+
super.dispose();
87+
88+
if(documentationMarkdownControl != null) {
89+
documentationMarkdownControl.dispose();
90+
documentationMarkdownControl = null;
91+
}
92+
}
8493
}

0 commit comments

Comments
 (0)