Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Two questions about files in bundle and ISpellingEngine
Two questions about files in bundle and ISpellingEngine [message #553652] Wed, 18 August 2010 11:23
Mauro Condarelli is currently offline Mauro Condarelli
Messages: 424
Registered: September 2009
Senior Member
Hi,
in my quest to integrate a usable Spell Checker into my RCP app I am now
trying to integrate Hunspell.

============================================================ =========
First problem:
============================================================ =========
I had a lot of troubles because I wanted to package the spell-checker in
a separate plugin and I obviously have several native dlls in my bundle.
My current solution is:
- I have the following directory structure:

.../workspace/
it.condarelli.spelling.hunspell/
src/
it/
...
lib/
dict/
en_US.aff
en_US.dic
it_IT.aff
it_IT.dic
hunspell.dll
jna.jar
META-INF/
MANIFEST.MF
build.properties
plugin.xml

it.condarelli.spelling.test/
src/
it/
...
META-INF/
MANIFEST.MF
build.properties
plugin.xml
splash.bmp

- I have the following in my
it.condarelli.spelling.hunspell/META-INF/MANIFEST.MF:
Bundle-NativeCode: /lib/hunspell.dll;osname=win32;processor=x86

- I use the following code to load the spelling dll:
private Hunspell() {
System.loadLibrary("hunspell.dll");
hsl = (HunspellLibrary)
com.sun.jna.Native.loadLibrary("hunspell.dll", HunspellLibrary.class);
}

All this works as expected (is there a better way?).
Problem is when I ask hunspell to load a dictionary.
I have found no way to access the files in lib/dict.
I have to load from elsewhere in the filesystem (currently
"C:/opt/lib/dict/").

This somewhat makes sense, since the plugin will be a single .jar and
hunspell.dll knows nothing about jars, only files in the filesystem.
Is there some way to extract them from the bundle so hunspell can find them?

============================================================ =========
second question
============================================================ =========
In an attempt to integrate with the existing spelling framework I
implemented

import org.eclipse.ui.texteditor.spelling.ISpellingEngine;
public class Hunspell implements ISpellingEngine { ...

Documentation says:

------------------------------
A spelling engine that can be contributed to the
org.eclipse.ui.workbench.texteditor.spellingEngine extension point. The
SpellingContext provides information about the content type to be
checked. In general a spelling engine should at least support the text
content type.

This interface is intended to be implemented by clients.
------------------------------

Problem is I have no idea how to "contribute to the extension point".
Can someone point me in the right direction?

I have implemented (for testing purposes) a

private class MyProblemCollector implements
ISpellingProblemCollector { ...

That can draw squiggle underlines and show suggestions in a StyledText
Widget.

I will now do the same for a SourceViewer in preparation for TextEditor,
but this is not what I really want to have: I would like to interface
directly with the spelling-checker framework that's available.

Can someone point me to the right documentation?

Many Thanks in Advance
Mauro
Previous Topic:[plugin ] problem with paths used in plugin
Next Topic:Saving project data before a project is closed or deleted
Goto Forum:
  


Current Time: Mon Oct 20 18:10:59 GMT 2014

Powered by FUDForum. Page generated in 0.02172 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software