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.onlineAccessor.JDIInstanceMethodCaller; 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; @SuppressWarnings("restriction") public class SeedAliasLabelProvider extends LabelProvider implements ITableLabelProvider { @Override public String getColumnText(Object element, int columnIndex) { if (element instanceof JDIInstanceMethodCaller) { JDIInstanceMethodCaller mc = (JDIInstanceMethodCaller)element; try { switch (columnIndex) { case 0: return ((StringReference)mc.callInstanceMethod("getObjectId")).value(); case 1: return ((StringReference)mc.callInstanceMethod("getClassName")).value(); case 2: return ((StringReference)mc.callInstanceMethod("getSourceFileName")).value(); case 3: return String.valueOf(((IntegerValue)mc.callInstanceMethod("getLineNo")).value()); case 4: return ((StringReference)mc.callInstanceMethod("getStatementType")).value(); case 5: return ((StringReference)mc.callInstanceMethod("getOccurrenceText")).value(); case 6: return ((StringReference)mc.callInstanceMethod("getStatementSignature")).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); } }