KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.views.tasklist;
13
14 import org.eclipse.core.resources.IMarker;
15 import org.eclipse.jface.viewers.IStructuredSelection;
16 import org.eclipse.ui.PlatformUI;
17
18 /**
19  * This action opens the properties dialog for the current task.
20  */

21 class TaskPropertiesAction extends TaskAction {
22
23     /**
24      * Creates the action.
25      *
26      * @param tasklist the task list
27      * @param id the id
28      */

29     public TaskPropertiesAction(TaskList tasklist, String JavaDoc id) {
30         super(tasklist, id);
31         PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
32                 ITaskListHelpContextIds.TASK_PROPERTIES_ACTION);
33     }
34
35     /**
36      * Performs this action.
37      */

38     public void run() {
39         IStructuredSelection sel = (IStructuredSelection) getTaskList()
40                 .getSelection();
41         Object JavaDoc o = sel.getFirstElement();
42         if (o instanceof IMarker) {
43             TaskPropertiesDialog dialog = new TaskPropertiesDialog(getShell());
44             dialog.setMarker((IMarker) o);
45             dialog.open();
46         }
47     }
48 }
49
Popular Tags