Hi,
i'm currently working on a plugin for Adobe InDesign and i have some
problems with that. I'm not really a c++ guru, maybe somebody here has
an idea how to solve this.
The plugin is written in C++ and it's calling a java application. This
application displays a window and pushing a button is calling back the
c++-plugin again.
// The plugin class. CActionComponen t is part of the InDesign SDK
class MyJNIComponent : public CActionComponen t {
public:
...
static void onCreateDocumen t();
...
private:
...
void registerCallbac ks();
...
}
// this is called from the java application
JNIEXPORT void JNICALL Java_createDocu ment(JNIEnv *e, jobject o);
// this is called from Java_createDocu ment()
void MyJNIComponent: :onCreateDocume nt() {
...
// Here i'm using SDK-methods and functions to create and display a
document.
// And here is the problem - i get an assertion from the SDK.
// The code to create the document is ok, i used this code before
and i can
// call this method from inside the plugin without assertion
...
}
// Register Callback from the Java Application back to the Plugin
void MyJNIComponent: :registerCallba cks() {
jint res;
JNINativeMethod nm;
// if this method is called in the java application ..
CJavaClassInsta nce layoutSystemToo lBox("path/to/my/java/class");
nm.name="create Document";
nm.signature="( )V";
// .. call this function in the plugin
nm.fnPtr=Java_c reateDocument;
res=CJavaVM::en v()->RegisterNative s(layoutSystemT oolBox.getClass Definition(),&n m,1);
if (res!=0) {
CJavaVM::report Error("Can't find the Java_createDocu ment
method.");
return ;
}
}
// this function is called from java
JNIEXPORT void JNICALL Java_createDocu ment(JNIEnv *e, jobject o){
CJavaVM::env()->ExceptionClear ();
// calling method in plugin class
MyJNIComponent: :onCreateDocume nt();
}
I think the problem is, that Java_createDocu ment() is not part of the
MyJNIComponent class and when i'm calling
MyJNIComponent: :onCreateDocume nt() from Java_createDocu ment() some
variables are not proper initialized.
And i don't know how to make Java_createDocu ment() part of the class.
Or if there is another way to solve this?
Thanks for any suggestions.
i'm currently working on a plugin for Adobe InDesign and i have some
problems with that. I'm not really a c++ guru, maybe somebody here has
an idea how to solve this.
The plugin is written in C++ and it's calling a java application. This
application displays a window and pushing a button is calling back the
c++-plugin again.
// The plugin class. CActionComponen t is part of the InDesign SDK
class MyJNIComponent : public CActionComponen t {
public:
...
static void onCreateDocumen t();
...
private:
...
void registerCallbac ks();
...
}
// this is called from the java application
JNIEXPORT void JNICALL Java_createDocu ment(JNIEnv *e, jobject o);
// this is called from Java_createDocu ment()
void MyJNIComponent: :onCreateDocume nt() {
...
// Here i'm using SDK-methods and functions to create and display a
document.
// And here is the problem - i get an assertion from the SDK.
// The code to create the document is ok, i used this code before
and i can
// call this method from inside the plugin without assertion
...
}
// Register Callback from the Java Application back to the Plugin
void MyJNIComponent: :registerCallba cks() {
jint res;
JNINativeMethod nm;
// if this method is called in the java application ..
CJavaClassInsta nce layoutSystemToo lBox("path/to/my/java/class");
nm.name="create Document";
nm.signature="( )V";
// .. call this function in the plugin
nm.fnPtr=Java_c reateDocument;
res=CJavaVM::en v()->RegisterNative s(layoutSystemT oolBox.getClass Definition(),&n m,1);
if (res!=0) {
CJavaVM::report Error("Can't find the Java_createDocu ment
method.");
return ;
}
}
// this function is called from java
JNIEXPORT void JNICALL Java_createDocu ment(JNIEnv *e, jobject o){
CJavaVM::env()->ExceptionClear ();
// calling method in plugin class
MyJNIComponent: :onCreateDocume nt();
}
I think the problem is, that Java_createDocu ment() is not part of the
MyJNIComponent class and when i'm calling
MyJNIComponent: :onCreateDocume nt() from Java_createDocu ment() some
variables are not proper initialized.
And i don't know how to make Java_createDocu ment() part of the class.
Or if there is another way to solve this?
Thanks for any suggestions.
Comment