01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: * Sebastian Davids <sdavids@gmx.de> - bug 77332 - [Markers] Add task dialog improvements
11: *******************************************************************************/package org.eclipse.ui.views.markers.internal;
12:
13: import org.eclipse.core.resources.IMarker;
14: import org.eclipse.swt.SWT;
15: import org.eclipse.swt.layout.GridLayout;
16: import org.eclipse.swt.widgets.Composite;
17: import org.eclipse.swt.widgets.Label;
18: import org.eclipse.swt.widgets.Shell;
19:
20: public class DialogProblemProperties extends DialogMarkerProperties {
21:
22: private Label severityLabel;
23:
24: private Label severityImage;
25:
26: public DialogProblemProperties(Shell parentShell) {
27: super (parentShell);
28: setType(IMarker.PROBLEM);
29: }
30:
31: /*
32: * (non-Javadoc)
33: *
34: * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#createAttributesArea(org.eclipse.swt.widgets.Composite)
35: */
36: protected void createAttributesArea(Composite parent) {
37: createSeperator(parent);
38: super .createAttributesArea(parent);
39:
40: new Label(parent, SWT.NONE)
41: .setText(MarkerMessages.propertiesDialog_severityLabel);
42:
43: Composite composite = new Composite(parent, SWT.NONE);
44: GridLayout layout = new GridLayout();
45: layout.numColumns = 2;
46: layout.marginWidth = 0;
47: layout.marginHeight = 0;
48: composite.setLayout(layout);
49:
50: severityImage = new Label(composite, SWT.NONE);
51: severityLabel = new Label(composite, SWT.NONE);
52: }
53:
54: /*
55: * (non-Javadoc)
56: *
57: * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#updateDialogFromMarker()
58: */
59: protected void updateDialogFromMarker() {
60: super .updateDialogFromMarker();
61: IMarker marker = getMarker();
62: if (marker == null) {
63: return;
64: }
65:
66: severityImage.setImage(Util.getImage(marker.getAttribute(
67: IMarker.SEVERITY, -1)));
68: int severity = marker.getAttribute(IMarker.SEVERITY, -1);
69: if (severity == IMarker.SEVERITY_ERROR) {
70: severityLabel
71: .setText(MarkerMessages.propertiesDialog_errorLabel);
72: } else if (severity == IMarker.SEVERITY_WARNING) {
73: severityLabel
74: .setText(MarkerMessages.propertiesDialog_warningLabel);
75: } else if (severity == IMarker.SEVERITY_INFO) {
76: severityLabel
77: .setText(MarkerMessages.propertiesDialog_infoLabel);
78: } else {
79: severityLabel
80: .setText(MarkerMessages.propertiesDialog_noseverityLabel);
81: }
82: }
83: }
|