34 |
exception statement from your version. */ |
exception statement from your version. */ |
35 |
|
|
36 |
|
|
37 |
|
#include "jniHelp.h" |
38 |
|
#include "pluginDebug.h" |
39 |
#include "GCJJVMConsole.h" |
#include "GCJJVMConsole.h" |
40 |
|
|
41 |
GCJJVMConsole::GCJJVMConsole () |
GCJJVMConsole::GCJJVMConsole (JNIEnv* jniEnv) |
42 |
|
: m_jniEnv (jniEnv) |
43 |
|
, m_isVisible (false) |
44 |
{ |
{ |
45 |
|
PLUGIN_DEBUG ("GCJJVMConsole::GCJJVMConsole\n"); |
46 |
|
|
47 |
|
// FIXME: Initialize this. |
48 |
|
m_consoleDialog = NULL; |
49 |
} |
} |
50 |
|
|
51 |
GCJJVMConsole::~GCJJVMConsole () |
GCJJVMConsole::~GCJJVMConsole() |
52 |
{ |
{ |
53 |
|
PLUGIN_DEBUG ("GCJJVMConsole::~GCJJVMConsole\n"); |
54 |
} |
} |
55 |
|
|
56 |
NS_IMPL_ISUPPORTS1 (GCJJVMConsole, nsIJVMConsole) |
NS_IMPL_ISUPPORTS1 (GCJJVMConsole, nsIJVMConsole) |
58 |
NS_IMETHODIMP |
NS_IMETHODIMP |
59 |
GCJJVMConsole::IsVisible (PRBool* result) |
GCJJVMConsole::IsVisible (PRBool* result) |
60 |
{ |
{ |
61 |
(*result) = PR_TRUE; |
PLUGIN_DEBUG ("GCJJVMConsole::IsVisible\n"); |
62 |
return NS_ERROR_NOT_IMPLEMENTED; |
|
63 |
|
(*result) = m_isVisible ? PR_TRUE : PR_FALSE; |
64 |
|
return NS_OK; |
65 |
} |
} |
66 |
|
|
67 |
NS_IMETHODIMP |
NS_IMETHODIMP |
68 |
GCJJVMConsole::Show () |
GCJJVMConsole::Show () |
69 |
{ |
{ |
70 |
|
PLUGIN_DEBUG ("GCJJVMConsole::Show\n"); |
71 |
|
|
72 |
|
assert (m_consoleDialog != NULL); |
73 |
|
|
74 |
|
jclass consoleDialog_cl = m_jniEnv->GetObjectClass (m_consoleDialog); |
75 |
|
assert (consoleDialog_cl != NULL); |
76 |
|
|
77 |
|
jmethodID consoleDialog_show = m_jniEnv->GetMethodID (consoleDialog_cl, "show", "()V"); |
78 |
|
assert (consoleDialog_show != NULL); |
79 |
|
|
80 |
|
m_jniEnv->CallVoidMethod (m_consoleDialog, consoleDialog_show); |
81 |
|
CHECK_EXCEPTIONS; |
82 |
|
|
83 |
return NS_OK; |
return NS_OK; |
84 |
} |
} |
85 |
|
|
86 |
NS_IMETHODIMP |
NS_IMETHODIMP |
87 |
GCJJVMConsole::Hide () |
GCJJVMConsole::Hide () |
88 |
{ |
{ |
89 |
|
PLUGIN_DEBUG ("GCJJVMConsole::Hide\n"); |
90 |
|
|
91 |
|
assert (m_consoleDialog != NULL); |
92 |
|
|
93 |
|
jclass consoleDialog_cl = m_jniEnv->GetObjectClass (m_consoleDialog); |
94 |
|
assert (consoleDialog_cl != NULL); |
95 |
|
|
96 |
|
jmethodID consoleDialog_hide = m_jniEnv->GetMethodID (consoleDialog_cl, "hide", "()V"); |
97 |
|
assert (consoleDialog_hide != NULL); |
98 |
|
|
99 |
|
m_jniEnv->CallVoidMethod (m_consoleDialog, consoleDialog_hide); |
100 |
|
CHECK_EXCEPTIONS; |
101 |
|
|
102 |
return NS_OK; |
return NS_OK; |
103 |
} |
} |
104 |
|
|
105 |
NS_IMETHODIMP |
NS_IMETHODIMP |
106 |
GCJJVMConsole::Print (const char* message, const char* encodingName) |
GCJJVMConsole::Print (const char* text, const char* encoding) |
107 |
{ |
{ |
108 |
return NS_ERROR_NOT_IMPLEMENTED; |
PLUGIN_DEBUG ("GCJJVMConsole::Print\n"); |
109 |
|
|
110 |
|
assert (m_consoleDialog != NULL); |
111 |
|
|
112 |
|
jclass consoleDialog_cl = m_jniEnv->GetObjectClass (m_consoleDialog); |
113 |
|
assert (consoleDialog_cl != NULL); |
114 |
|
|
115 |
|
jmethodID consoleDialog_print = m_jniEnv->GetMethodID (consoleDialog_cl, "print", "(Ljava.lang.String;Ljava.lang.String;)V"); |
116 |
|
assert (consoleDialog_print != NULL); |
117 |
|
|
118 |
|
// FIXME: Handle case when encoding is NULL |
119 |
|
jstring jv_text = m_jniEnv->NewStringUTF (text); |
120 |
|
jstring jv_encoding = m_jniEnv->NewStringUTF (encoding); |
121 |
|
|
122 |
|
m_jniEnv->CallVoidMethod (m_consoleDialog, consoleDialog_print, jv_text, jv_encoding); |
123 |
|
CHECK_EXCEPTIONS; |
124 |
|
|
125 |
|
return NS_OK; |
126 |
} |
} |