Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0769f45367d6847eb6b064b9c03a5586306a03d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**********************************************************************
Copyright (c) 2000, 2002 IBM Corp. and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Common Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/cpl-v10.html

Contributors:
    IBM Corporation - Initial implementation
**********************************************************************/

package org.eclipse.ui.texteditor;

 
import java.util.Map;
import java.util.ResourceBundle;

import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;

import org.eclipse.ui.views.tasklist.TaskPropertiesDialog;


/**
 * Creates a new task marker. Uses the Workbench's task properties dialog.
 * @since 2.0
 */
public class AddTaskAction extends AddMarkerAction {
	
	/**
	 * Creates a new action for the given text editor. The action configures its
	 * visual representation from the given resource bundle.
	 *
	 * @param bundle the resource bundle
	 * @param prefix a prefix to be prepended to the various resource keys
	 *   (described in <code>ResourceAction</code> constructor), or 
	 *   <code>null</code> if none
	 * @param editor the text editor
	 * @see ResourceAction#ResourceAction
	 */
	public AddTaskAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
		super(bundle, prefix, editor, IMarker.TASK, false);
	}
	
	/*
	 * @see IAction#run()
	 */
	public void run() {
		
		IResource resource= getResource();
		if (resource == null)
			return;
		Map attributes= getInitialAttributes();

		TaskPropertiesDialog dialog = new TaskPropertiesDialog(getTextEditor().getSite().getShell());
		dialog.setResource(resource);
		dialog.setInitialAttributes(attributes);
		dialog.open();
	}
}

Back to the top