KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > texteditor > AddTaskAction


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  *******************************************************************************/

11
12 package org.eclipse.ui.texteditor;
13
14
15 import java.util.Map JavaDoc;
16 import java.util.ResourceBundle JavaDoc;
17
18 import org.eclipse.core.resources.IMarker;
19 import org.eclipse.core.resources.IResource;
20
21 import org.eclipse.ui.views.tasklist.TaskPropertiesDialog;
22
23
24 /**
25  * Creates a new task marker. Uses the Workbench's task properties dialog.
26  * @since 2.0
27  */

28 public class AddTaskAction extends AddMarkerAction {
29
30     /**
31      * Creates a new action for the given text editor. The action configures its
32      * visual representation from the given resource bundle.
33      *
34      * @param bundle the resource bundle
35      * @param prefix a prefix to be prepended to the various resource keys
36      * (described in <code>ResourceAction</code> constructor), or
37      * <code>null</code> if none
38      * @param editor the text editor
39      * @see AddMarkerAction#AddMarkerAction(ResourceBundle, String, ITextEditor, String, boolean)
40      * @since 3.0
41      */

42     public AddTaskAction(ResourceBundle JavaDoc bundle, String JavaDoc prefix, ITextEditor editor) {
43         super(bundle, prefix, editor, IMarker.TASK, false);
44     }
45
46     /*
47      * @see IAction#run()
48      */

49     public void run() {
50
51         IResource resource= getResource();
52         if (resource == null)
53             return;
54         Map JavaDoc attributes= getInitialAttributes();
55
56         TaskPropertiesDialog dialog= new TaskPropertiesDialog(getTextEditor().getSite().getShell());
57         dialog.setResource(resource);
58         dialog.setInitialAttributes(attributes);
59         dialog.open();
60     }
61 }
62
Popular Tags