Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ec3b3ec9a8a68e23bc241356807dcd8a6292f630 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*****************************************************************************
 * Copyright (c) 2014 CEA LIST.
 *
 *    
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.uml.developper.mde.transcription;

import org.eclipse.papyrus.uml.developper.mde.I_DocumentStereotype;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Stereotype;

/**
 * this class is a specialization to generate mediawiki files.
 *
 */
public class WikiTranscription implements ITranscription {



	/**
	 * @see org.eclipse.papyrus.uml.developper.mde.transcription.ITranscription#writeEndingDocument(java.lang.StringBuffer)
	 *
	 * @param out
	 */
	
	public void writeEndingDocument(StringBuffer out) {
	}


	/**
	 * @see org.eclipse.papyrus.uml.developper.mde.transcription.ITranscription#writeBeginningDocument(java.lang.StringBuffer)
	 *
	 * @param out
	 * @return the string buffer after adding the prefix for the document
	 */
	
	public StringBuffer writeBeginningDocument(StringBuffer out) {
		out.append("\n__TOC__"); //$NON-NLS-1$
		return out;
	}


	/**
	 * @see org.eclipse.papyrus.uml.developper.mde.transcription.ITranscription#writeDocumentTitle(java.lang.StringBuffer, org.eclipse.uml2.uml.Model)
	 *
	 * @param out
	 * @param documentModel
	 */
	
	public void writeDocumentTitle(StringBuffer out, Model documentModel) {
		out.append("\n= "+documentModel.getName()+" ="); //$NON-NLS-1$ //$NON-NLS-2$
	}

	


	/**
	 * @see org.eclipse.papyrus.uml.developper.mde.transcription.ITranscription#writesectionTitle(java.lang.StringBuffer, int, org.eclipse.uml2.uml.Element)
	 *
	 * @param out
	 * @param level
	 * @param packageableElement
	 */
	
	public void writesectionTitle(StringBuffer out, int level, Element packageableElement) {
		if(level==2){
		out.append("\n=="+((Package)packageableElement).getName()+"==");} //$NON-NLS-1$ //$NON-NLS-2$
		if(level==3){
			out.append("\n==="+((Package)packageableElement).getName()+"===");} //$NON-NLS-1$ //$NON-NLS-2$
		if(level==4){
			out.append("\n===="+((Package)packageableElement).getName()+"====");} //$NON-NLS-1$ //$NON-NLS-2$
		
	}


	/**
	 * @see org.eclipse.papyrus.uml.developper.mde.transcription.ITranscription#writeImageRef(java.lang.StringBuffer, org.eclipse.uml2.uml.Element, org.eclipse.uml2.uml.Stereotype)
	 *
	 * @param out
	 * @param packageableElement
	 * @param imgRefStereotype
	 */
	
	public void writeImageRef(StringBuffer out, Element packageableElement, Stereotype imgRefStereotype) {
		out.append("\n[[Image:"+((Element)packageableElement).getValue(imgRefStereotype, I_DocumentStereotype.IMAGEREF_REF_ATT)+"|"+((Comment)packageableElement).getBody()+"]]<br>");  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	}


	/**
	 * @see org.eclipse.papyrus.uml.developper.mde.transcription.ITranscription#writeParagraph(java.lang.StringBuffer, org.eclipse.uml2.uml.Element)
	 *
	 * @param out
	 * @param packageableElement
	 */
	
	public void writeParagraph(StringBuffer out, Element packageableElement) {
		out.append("\n"+((Comment)packageableElement).getBody()); //$NON-NLS-1$
	}


	public String getNameFile() {
		
		return "DeveloperDoc.mediawiki"; //$NON-NLS-1$
	}


}

Back to the top