1 11 package org.eclipse.debug.internal.ui.views.memory.renderings; 12 13 import org.eclipse.debug.internal.ui.DebugUIMessages; 14 import org.eclipse.debug.ui.DebugUITools; 15 import org.eclipse.debug.ui.memory.AbstractMemoryRendering; 16 import org.eclipse.jface.text.Document; 17 import org.eclipse.jface.text.TextViewer; 18 import org.eclipse.swt.SWT; 19 import org.eclipse.swt.custom.StyledText; 20 import org.eclipse.swt.widgets.Composite; 21 import org.eclipse.swt.widgets.Control; 22 23 27 31 public class ErrorRendering extends AbstractMemoryRendering { 32 33 private TextViewer fTextViewer; 34 private String fRenderingId; 35 private Throwable fException; 36 37 41 public ErrorRendering(String renderingId, Throwable exception) 42 { 43 super("org.eclipse.debug.internal.ui.views.memory.errorrendering"); fRenderingId = renderingId; 45 fException = exception; 46 } 47 48 51 public Control createControl(Composite parent) { 52 fTextViewer = new TextViewer(parent, SWT.READ_ONLY); 53 fTextViewer.setDocument(new Document()); 54 StyledText styleText = fTextViewer.getTextWidget(); 55 56 styleText.setText("\r\n\r\n" + DebugUIMessages.EmptyViewTab_Unable_to_create + "\n" + getRenderingName() + "\n\n" + DebugUIMessages.ErrorRendering_0 + fException.getMessage()); 58 59 return fTextViewer.getControl(); 60 } 61 62 63 66 private String getRenderingName() { 67 68 if (DebugUITools.getMemoryRenderingManager().getRenderingType(fRenderingId)!= null) 69 { 70 String name = 71 DebugUITools.getMemoryRenderingManager() 72 .getRenderingType(fRenderingId) 73 .getLabel(); 74 75 return name; 76 } 77 return "Unknown"; } 79 80 83 public Control getControl() { 84 return fTextViewer.getControl(); 85 } 86 87 public void refresh() { 88 } 89 90 } 91 | Popular Tags |