Changeset 29185 in vbox for trunk/src/libs/xpcom18a4/java
- Timestamp:
- May 7, 2010 9:03:34 AM (15 years ago)
- Location:
- trunk/src/libs/xpcom18a4/java
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/java/src/nsJavaXPCOMGlue.cpp
r29140 r29185 158 158 }; 159 159 160 NS_IMPL_ISUPPORTS1(nsXPTCJStub, nsISupports); 160 NS_IMPL_ADDREF(nsXPTCJStub) 161 NS_IMPL_RELEASE(nsXPTCJStub) 162 163 NS_IMETHODIMP nsXPTCJStub::QueryInterface(REFNSIID aIID, void** aInstancePtr) 164 { 165 return mOuter->QueryInterface(aIID, aInstancePtr); 166 } 161 167 162 168 nsresult -
trunk/src/libs/xpcom18a4/java/src/org/virtualbox/VirtualBoxManager.java
r29140 r29185 114 114 return true; 115 115 } 116 117 public Mozilla getMozilla() 118 { 119 return mozilla; 120 } 121 122 public void waitForEvents(long tmo) 123 { 124 mozilla.waitForEvents(tmo); 125 } 126 127 public ILocalOwner makeWrapper(nsISupports obj) 128 { 129 130 ILocalOwner lo = (ILocalOwner) this.componentManager 131 .createInstanceByContractID("@virtualbox.org/CallbackWrapper;1", 132 null, 133 ILocalOwner.ILOCALOWNER_IID); 134 lo.setLocalObject(obj); 135 return lo; 136 } 137 138 public IVirtualBoxCallback makeVirtualBoxCallback(IVirtualBoxCallback obj) 139 { 140 ILocalOwner lo = makeWrapper(obj); 141 return (IVirtualBoxCallback)lo.queryInterface(IVirtualBoxCallback.IVIRTUALBOXCALLBACK_IID); 142 } 116 143 } -
trunk/src/libs/xpcom18a4/java/tests/TestVBox.java
r29183 r29185 34 34 /** @todo long -> MachineState */ 35 35 public void onMachineStateChange(String machineId, long state) { System.out.println("onMachineStateChange -- VM: " + machineId + ", state: " + state); }; 36 36 37 37 /** @todo ugly reimplementation of queryInterface, should have base class to derive from */ 38 38 public nsISupports queryInterface(String iid) { return org.mozilla.xpcom.Mozilla.queryInterface(this, iid); } 39 39 }; 40 41 40 41 42 42 public static void main(String[] args) 43 43 { … … 68 68 } 69 69 70 //VBoxCallbacks vboxCallbacks = new VBoxCallbacks();71 // vbox.registerCallback(vboxCallbacks);70 VBoxCallbacks vboxCallbacks = new VBoxCallbacks(); 71 vbox.registerCallback(mgr.makeVirtualBoxCallback(vboxCallbacks)); 72 72 73 73 /* do something silly, start the first VM in the list */ … … 76 76 if (mgr.startVm(m, 7000)) 77 77 { 78 System.out.println("started, presss any key..."); 79 int ch = System.in.read(); 78 VBoxCbImpl cb = new VBoxCbImpl(); 79 vbox.registerCallback(mgr.makeVirtualBoxCallback(cb)); 80 81 if (false) 82 { 83 System.out.println("started, presss any key..."); 84 int ch = System.in.read(); 85 } else { 86 while (true) 87 { 88 mgr.waitForEvents(500); 89 } 90 } 80 91 } 81 92 else … … 83 94 System.out.println("cannot start machine "+m); 84 95 } 85 86 //vbox.unregisterCallback(vboxCallbacks);96 97 vbox.unregisterCallback(vboxCallbacks); 87 98 } 88 99 catch (Throwable e)
Note:
See TracChangeset
for help on using the changeset viewer.