KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > tasklist > TaskPropertiesDialog


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 132427 - [Markers] TaskPropertiesDialog problems
11  *******************************************************************************/

12
13 package org.eclipse.ui.views.tasklist;
14
15 import java.util.Map JavaDoc;
16
17 import org.eclipse.core.resources.IMarker;
18 import org.eclipse.core.resources.IResource;
19 import org.eclipse.jface.dialogs.IDialogSettings;
20
21 import org.eclipse.swt.widgets.Shell;
22
23 import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
24 import org.eclipse.ui.views.markers.internal.DialogTaskProperties;
25
26 /**
27  * Shows the properties of a new or existing task, or a problem.
28  */

29 public class TaskPropertiesDialog extends DialogTaskProperties {
30
31     private static final String JavaDoc DIALOG_SETTINGS_SECTION = "TaskPropertiesDialogSettings"; //$NON-NLS-1$
32

33     /**
34      * Creates the dialog. By default this dialog creates a new task. To set the
35      * resource and initial attributes for the new task, use
36      * <code>setResource</code> and <code>setInitialAttributes</code>. To
37      * show or modify an existing task, use <code>setMarker</code>.
38      *
39      * @param parentShell
40      * the parent shell
41      */

42     public TaskPropertiesDialog(Shell parentShell) {
43         super(parentShell);
44     }
45
46     /*
47      * (non-Javadoc)
48      *
49      * @see org.eclipse.jface.window.Dialog#getDialogBoundsSettings()
50      *
51      * @since 3.2
52      */

53     protected IDialogSettings getDialogBoundsSettings() {
54         IDialogSettings settings = IDEWorkbenchPlugin.getDefault()
55                 .getDialogSettings();
56         IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
57         if (section == null) {
58             section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
59         }
60         return section;
61     }
62     
63     /**
64      * Sets the marker to show or modify.
65      *
66      * @param marker the marker, or <code>null</code> to create a new marker
67      */

68     public void setMarker(IMarker marker) {
69         // Method is overridden because API is being inherited from an internal class.
70
super.setMarker(marker);
71     }
72
73     /**
74      * Returns the marker being created or modified.
75      * For a new marker, this returns <code>null</code> until
76      * the dialog returns, but is non-null after.
77      *
78      * @return the marker
79      */

80     public IMarker getMarker() {
81         // Method is overridden because API is being inherited from an internal class.
82
return super.getMarker();
83     }
84
85     /**
86      * Sets the resource to use when creating a new task.
87      * If not set, the new task is created on the workspace root.
88      *
89      * @param resource the resource
90      */

91     public void setResource(IResource resource) {
92         // Method is overridden because API is being inherited from an internal class.
93
super.setResource(resource);
94     }
95
96     /**
97      * Returns the resource to use when creating a new task,
98      * or <code>null</code> if none has been set.
99      * If not set, the new task is created on the workspace root.
100      *
101      * @return the resource
102      */

103     public IResource getResource() {
104         // Method is overridden because API is being inherited from an internal class.
105
return super.getResource();
106     }
107
108     /**
109      * Sets initial attributes to use when creating a new task.
110      * If not set, the new task is created with default attributes.
111      *
112      * @param initialAttributes the initial attributes
113      */

114     public void setInitialAttributes(Map JavaDoc initialAttributes) {
115         // Method is overridden because API is being inherited from an internal class.
116
super.setInitialAttributes(initialAttributes);
117     }
118
119     /**
120      * Returns the initial attributes to use when creating a new task,
121      * or <code>null</code> if not set.
122      * If not set, the new task is created with default attributes.
123      *
124      * @return the initial attributes
125      */

126     public Map JavaDoc getInitialAttributes() {
127         // Method is overridden because API is being inherited from an internal class.
128
return super.getInitialAttributes();
129     }
130
131 }
132
Popular Tags