Skip to content

Commit

Permalink
split and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Feb 4, 2011
1 parent fa281c3 commit cceedbd
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 19 deletions.
5 changes: 5 additions & 0 deletions wmibase/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ Bundle-Activator: wmibase.Activator
Require-Bundle: org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.swt,
org.eclipse.swt.internal.ole.win32,
org.eclipse.swt.internal.win32,
org.eclipse.swt.ole.win32
Export-Package: wmibase;version="1.0.0";uses:="org.eclipse.swt.ole.win32,org.osgi.framework"
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package wmisample;
package wmibase;

import org.eclipse.swt.internal.ole.win32.COM;
import org.eclipse.swt.internal.ole.win32.IEnumVARIANT;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.Variant;

Expand Down Expand Up @@ -48,7 +49,7 @@ public static int forEachVariant ( Variant enumerable, VariantVisitor variantVis

try
{
while (enumVariant.Next(1, rgelt, pceltFetched) == COM.S_OK && pceltFetched[0] == 1) {
while (enumVariant.Next(1, rgelt, pceltFetched) == OLE.S_OK && pceltFetched[0] == 1) {
Variant v = Variant.win32_new(rgelt);
variantVisitor.visit ( v );
}
Expand All @@ -63,7 +64,7 @@ public static int forEachVariant ( Variant enumerable, VariantVisitor variantVis
enumVariant.Release();
}

return OS.S_OK;
return OLE.S_OK;

}
finally
Expand All @@ -82,34 +83,34 @@ public static Object convertVariant ( Variant variant )
short type = variant.getType();
switch ( type )
{
case COM.VT_EMPTY:
case COM.VT_NULL:
case OLE.VT_EMPTY:
case OLE.VT_NULL:
return null;
case COM.VT_BOOL:
case OLE.VT_BOOL:
return variant.getBoolean();

case COM.VT_I1:
case OLE.VT_I1:
return variant.getByte ();
case COM.VT_I2:
case OLE.VT_I2:
return variant.getShort ();
case COM.VT_I4:
case OLE.VT_I4:
return variant.getInt();
case COM.VT_I8:
case OLE.VT_I8:
return variant.getLong();

case COM.VT_UI1:
case OLE.VT_UI1:
return variant.getChar();
case COM.VT_UI2:
case OLE.VT_UI2:
return variant.getShort ();
case COM.VT_UI4:
case OLE.VT_UI4:
return variant.getInt();

case COM.VT_BSTR:
case OLE.VT_BSTR:
return variant.getString ();

case COM.VT_R4:
case OLE.VT_R4:
return variant.getFloat();
case COM.VT_R8:
case OLE.VT_R8:
return variant.getDouble();

// FIXME: add some more
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wmisample;
package wmibase;

import java.util.HashMap;
import java.util.LinkedList;
Expand All @@ -9,7 +9,7 @@
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.Variant;

import wmisample.Helper.VariantVisitor;
import wmibase.Helper.VariantVisitor;

public class WMIConnection {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wmisample;
package wmibase;

import java.util.Collections;
import java.util.HashMap;
Expand Down
1 change: 1 addition & 0 deletions wmisample/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: wmibase;version="1.0.0"
3 changes: 3 additions & 0 deletions wmisample/src/wmisample/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;

import wmibase.WMIConnection;
import wmibase.WMIObjectInformation;

public class View extends ViewPart {
public static final String ID = "wmisample.view";

Expand Down

0 comments on commit cceedbd

Please sign in to comment.