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: *******************************************************************************/package org.eclipse.ui.texteditor;
11:
12: import java.util.Map;
13: import java.util.ResourceBundle;
14:
15: import org.eclipse.core.resources.IMarker;
16: import org.eclipse.core.resources.IResource;
17:
18: import org.eclipse.ui.views.tasklist.TaskPropertiesDialog;
19:
20: /**
21: * Creates a new task marker. Uses the Workbench's task properties dialog.
22: * @since 2.0
23: */
24: public class AddTaskAction extends AddMarkerAction {
25:
26: /**
27: * Creates a new action for the given text editor. The action configures its
28: * visual representation from the given resource bundle.
29: *
30: * @param bundle the resource bundle
31: * @param prefix a prefix to be prepended to the various resource keys
32: * (described in <code>ResourceAction</code> constructor), or
33: * <code>null</code> if none
34: * @param editor the text editor
35: * @see AddMarkerAction#AddMarkerAction(ResourceBundle, String, ITextEditor, String, boolean)
36: * @since 3.0
37: */
38: public AddTaskAction(ResourceBundle bundle, String prefix,
39: ITextEditor editor) {
40: super (bundle, prefix, editor, IMarker.TASK, false);
41: }
42:
43: /*
44: * @see IAction#run()
45: */
46: public void run() {
47:
48: IResource resource = getResource();
49: if (resource == null)
50: return;
51: Map attributes = getInitialAttributes();
52:
53: TaskPropertiesDialog dialog = new TaskPropertiesDialog(
54: getTextEditor().getSite().getShell());
55: dialog.setResource(resource);
56: dialog.setInitialAttributes(attributes);
57: dialog.open();
58: }
59: }
|