summaryrefslogtreecommitdiff
path: root/core/doc/help/html/devdoc/extending/ar01s02.html
blob: 0e72ba138aa057bd39033faf45580385d34d31b9 (plain)
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
119
120
121
122
123
124
125
126
127
128
129
130
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Adding a new language support</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link href="../../styles.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
	alink="#0000FF">
<div class="section" lang="en-GB">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id2473020"></a>Adding
a new language support</h2>
</div>
</div>
</div>
<p>In order to add a new programming language to the ones supported
by the LibreOffice integration plugin, you will have to develop a
small other plugin. Creating a new implementation language support
plugin will require some Java knowledge and the use of other Eclipse
plugins.</p>
<p>First of all, create a new Eclipse Plugin project using <span
	class="strong"><strong>File &gt; New Project</strong></span> and use
the following values to fill in the form:</p>
<div class="itemizedlist">
<ul type="disc">
	<li>
	<p>Name: <code class="literal">org.openoffice.ide.eclipse.&lt;language&gt;</code></p>
	</li>
	<li>
	<p>Plugin ID: <code class="literal">org.openoffice.ide.eclipse.&lt;language&gt;</code></p>
	</li>
	<li>
	<p>Class name: <code class="literal">org.openoffice.ide.eclipse.&lt;language&gt;.&lt;Language&gt;Plugin</code></p>
	</li>
</ul>
</div>
<p>In the opened editor, go to the &#8220;<span class="strong"><strong>dependencies</strong></span>&#8221;
page and add the <code class="literal">org.openoffice.ide.eclipse.core</code>
plugin to the list. In order to fit the other plugins, rename the <code
	class="literal">src</code> folder into <code class="literal">source</code>.
To have a short directory name, rename you project directory in <code
	class="literal">&lt;language&gt;</code> using your preferred file
browser.</p>
<p>Adding a new implementation language support means using two
extensions points defined by the <code class="literal">org.openoffice.ide.eclipse.core</code>
plugin:</p>
<div class="itemizedlist">
<ul type="disc">
	<li>
	<p><code class="literal">org.openoffice.ide.eclipse.core.language</code>:
	the main extension point for the new language plugin</p>
	</li>
	<li>
	<p><code class="literal">org.openoffice.ide.eclipse.core.MainProvider</code>:
	helps to show the implementations classes in the URE launch
	configuration tab.</p>
	</li>
</ul>
</div>
<div class="section" lang="en-GB">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="id2473452"></a>The language extension
point</h3>
</div>
</div>
</div>
<p>Now you are ready to add a new language in your freshly created
plugin. Therefore go to the &#8220;<span class="strong"><strong>extensions</strong></span>&#8221;
page and add a new <code class="literal">org.openoffice.ide.eclipse.core.language</code>
extension.</p>
<p>Now right click on it and select language to add a language item
to configure. Change the name into the language name to print in the
plugin dialogs (e.g.: &#8220;Java&#8221;, &#8220;C++&#8221; or
&#8220;Python&#8221;). Then click on the &#8220;<span class="strong"><strong>class</strong></span>&#8221;
link to create a new class implementing the <code class="literal">ILanguage</code>
interface &#8211; this class could be named Language. Now you will have
to fill in the class methods. You can get some help on each method in
the plugin API reference.</p>
</div>
<div class="section" lang="en-GB">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="id2473506"></a>Packaging the language
plugin</h3>
</div>
</div>
</div>
<p>There are several ways to package your language plugin. The best
one is to integrate it in the global plugin build chain. For this,
checkout the other project from the CVS: they are named &#8220;<code
	class="literal">core</code>&#8221;, &#8220;<code class="literal">java</code>&#8221;
and &#8220;<code class="literal">build</code>&#8221;. Now follow these
instructions to make your plugin to be build with the others.</p>
<div class="itemizedlist">
<ul type="disc">
	<li>
	<p>Create a <code class="literal">build</code> directory</p>
	</li>
	<li>
	<p>Copy the content of the <code class="literal">build</code>
	directory from the <code class="literal">java</code> plugin</p>
	</li>
	<li>
	<p>Replace <code class="literal">java</code> by your language in
	all the copied files</p>
	</li>
	<li>
	<p>Change the version in the <code class="literal">build/build.properties</code>
	file</p>
	</li>
	<li>
	<p>Add an ant call to your <code class="literal">build.xml</code>
	file in the build project's <code class="literal">build.xml</code> file
	like this:</p>
	</li>
</ul>
</div>
<pre class="programlisting">&lt;ant dir="language/build/" inheritall="false" target="clean" /&gt;</pre>
<p>Now, you will be able to build all the plugins by running the
build project ant file.</p>
</div>
</div>
</body>
</html>