KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > markers > internal > DialogProblemProperties


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  * Sebastian Davids <sdavids@gmx.de> - bug 77332 - [Markers] Add task dialog improvements
11  *******************************************************************************/

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     /*
34      * (non-Javadoc)
35      *
36      * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#createAttributesArea(org.eclipse.swt.widgets.Composite)
37      */

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     /*
57      * (non-Javadoc)
58      *
59      * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#updateDialogFromMarker()
60      */

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