1 12 13 package org.eclipse.ui.views.markers.internal; 14 15 import org.eclipse.core.resources.IMarker; 16 import org.eclipse.swt.SWT; 17 import org.eclipse.swt.layout.GridLayout; 18 import org.eclipse.swt.widgets.Composite; 19 import org.eclipse.swt.widgets.Label; 20 import org.eclipse.swt.widgets.Shell; 21 22 class DialogProblemProperties extends DialogMarkerProperties { 23 24 private Label severityLabel; 25 26 private Label severityImage; 27 28 DialogProblemProperties(Shell parentShell) { 29 super(parentShell); 30 setType(IMarker.PROBLEM); 31 } 32 33 38 protected void createAttributesArea(Composite parent) { 39 createSeperator(parent); 40 super.createAttributesArea(parent); 41 42 new Label(parent, SWT.NONE) 43 .setText(MarkerMessages.propertiesDialog_severityLabel); 44 45 Composite composite = new Composite(parent, SWT.NONE); 46 GridLayout layout = new GridLayout(); 47 layout.numColumns = 2; 48 layout.marginWidth = 0; 49 layout.marginHeight = 0; 50 composite.setLayout(layout); 51 52 severityImage = new Label(composite, SWT.NONE); 53 severityLabel = new Label(composite, SWT.NONE); 54 } 55 56 61 protected void updateDialogFromMarker() { 62 super.updateDialogFromMarker(); 63 IMarker marker = getMarker(); 64 if (marker == null) { 65 return; 66 } 67 68 severityImage.setImage(Util.getImage(marker.getAttribute( 69 IMarker.SEVERITY, -1))); 70 int severity = marker.getAttribute(IMarker.SEVERITY, -1); 71 if (severity == IMarker.SEVERITY_ERROR) { 72 severityLabel.setText(MarkerMessages.propertiesDialog_errorLabel); 73 } else if (severity == IMarker.SEVERITY_WARNING) { 74 severityLabel.setText(MarkerMessages.propertiesDialog_warningLabel); 75 } else if (severity == IMarker.SEVERITY_INFO) { 76 severityLabel.setText(MarkerMessages.propertiesDialog_infoLabel); 77 } else { 78 severityLabel 79 .setText(MarkerMessages.propertiesDialog_noseverityLabel); 80 } 81 } 82 } 83 | Popular Tags |