package org.ntlab.reversedebugger; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.ISharedImages; import org.eclipse.ui.PlatformUI; import org.ntlab.debuggingControl.MethodCaller; import com.sun.jdi.ClassNotLoadedException; import com.sun.jdi.IncompatibleThreadStateException; import com.sun.jdi.IntegerValue; import com.sun.jdi.InvalidTypeException; import com.sun.jdi.InvocationException; import com.sun.jdi.StringReference; public class ObjectFlowAliasLabelProvider extends LabelProvider implements ITableLabelProvider { @Override public String getColumnText(Object element, int columnIndex) { if (element instanceof MethodCaller) { MethodCaller mc = (MethodCaller)element; if (mc.getObj() == null) { return ""; } try { switch (columnIndex) { case 0: return ((StringReference)mc.callInstanceMethod("getObjectId")).value(); case 1: return ((StringReference)mc.callInstanceMethod("getClassName")).value(); case 2: return String.valueOf(((IntegerValue)mc.callInstanceMethod("getLineNo")).value()); case 3: return ((StringReference)mc.callInstanceMethod("getStatementType")).value(); case 4: return ((StringReference)mc.callInstanceMethod("getStatementSignature")).value(); case 5: return String.format("%3d", (((IntegerValue)mc.callInstanceMethod("getOccurrenceExp")).value())); } } catch (InvalidTypeException | ClassNotLoadedException | InvocationException | IncompatibleThreadStateException e) { e.printStackTrace(); } } return "テスト用テキスト" + columnIndex; } @Override public Image getColumnImage(Object element, int columnIndex) { return getImage(element); } @Override public Image getImage(Object element) { return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); } }