001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: * Sebastian Davids <sdavids@gmx.de> - bug 132427 - [Markers] TaskPropertiesDialog problems
011: *******************************************************************************/package org.eclipse.ui.views.tasklist;
012:
013: import java.util.Map;
014:
015: import org.eclipse.core.resources.IMarker;
016: import org.eclipse.core.resources.IResource;
017: import org.eclipse.jface.dialogs.IDialogSettings;
018:
019: import org.eclipse.swt.widgets.Shell;
020:
021: import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
022: import org.eclipse.ui.views.markers.internal.DialogTaskProperties;
023:
024: /**
025: * Shows the properties of a new or existing task, or a problem.
026: */
027: public class TaskPropertiesDialog extends DialogTaskProperties {
028:
029: private static final String DIALOG_SETTINGS_SECTION = "TaskPropertiesDialogSettings"; //$NON-NLS-1$
030:
031: /**
032: * Creates the dialog. By default this dialog creates a new task. To set the
033: * resource and initial attributes for the new task, use
034: * <code>setResource</code> and <code>setInitialAttributes</code>. To
035: * show or modify an existing task, use <code>setMarker</code>.
036: *
037: * @param parentShell
038: * the parent shell
039: */
040: public TaskPropertiesDialog(Shell parentShell) {
041: super (parentShell);
042: }
043:
044: /*
045: * (non-Javadoc)
046: *
047: * @see org.eclipse.jface.window.Dialog#getDialogBoundsSettings()
048: *
049: * @since 3.2
050: */
051: protected IDialogSettings getDialogBoundsSettings() {
052: IDialogSettings settings = IDEWorkbenchPlugin.getDefault()
053: .getDialogSettings();
054: IDialogSettings section = settings
055: .getSection(DIALOG_SETTINGS_SECTION);
056: if (section == null) {
057: section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
058: }
059: return section;
060: }
061:
062: /**
063: * Sets the marker to show or modify.
064: *
065: * @param marker the marker, or <code>null</code> to create a new marker
066: */
067: public void setMarker(IMarker marker) {
068: // Method is overridden because API is being inherited from an internal class.
069: super .setMarker(marker);
070: }
071:
072: /**
073: * Returns the marker being created or modified.
074: * For a new marker, this returns <code>null</code> until
075: * the dialog returns, but is non-null after.
076: *
077: * @return the marker
078: */
079: public IMarker getMarker() {
080: // Method is overridden because API is being inherited from an internal class.
081: return super .getMarker();
082: }
083:
084: /**
085: * Sets the resource to use when creating a new task.
086: * If not set, the new task is created on the workspace root.
087: *
088: * @param resource the resource
089: */
090: public void setResource(IResource resource) {
091: // Method is overridden because API is being inherited from an internal class.
092: super .setResource(resource);
093: }
094:
095: /**
096: * Returns the resource to use when creating a new task,
097: * or <code>null</code> if none has been set.
098: * If not set, the new task is created on the workspace root.
099: *
100: * @return the resource
101: */
102: public IResource getResource() {
103: // Method is overridden because API is being inherited from an internal class.
104: return super .getResource();
105: }
106:
107: /**
108: * Sets initial attributes to use when creating a new task.
109: * If not set, the new task is created with default attributes.
110: *
111: * @param initialAttributes the initial attributes
112: */
113: public void setInitialAttributes(Map initialAttributes) {
114: // Method is overridden because API is being inherited from an internal class.
115: super .setInitialAttributes(initialAttributes);
116: }
117:
118: /**
119: * Returns the initial attributes to use when creating a new task,
120: * or <code>null</code> if not set.
121: * If not set, the new task is created with default attributes.
122: *
123: * @return the initial attributes
124: */
125: public Map getInitialAttributes() {
126: // Method is overridden because API is being inherited from an internal class.
127: return super.getInitialAttributes();
128: }
129:
130: }
|