KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > cheatsheet > comp > actions > CompCSAddTaskAction


1 /*******************************************************************************
2  * Copyright (c) 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.pde.internal.ui.editor.cheatsheet.comp.actions;
13
14 import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSConstants;
15 import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSTask;
16 import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSTaskGroup;
17 import org.eclipse.pde.internal.ui.PDEUIMessages;
18 import org.eclipse.pde.internal.ui.wizards.cheatsheet.CompCSCreationOperation;
19
20
21 /**
22  * CompCSAddTaskAction
23  *
24  */

25 public class CompCSAddTaskAction extends CompCSAbstractAddAction {
26
27     /**
28      *
29      */

30     public CompCSAddTaskAction() {
31         setText(PDEUIMessages.CompCSCreationOperation_task);
32     }
33
34     /* (non-Javadoc)
35      * @see org.eclipse.jface.action.Action#run()
36      */

37     public void run() {
38         
39         if (fParentObject == null) {
40             return;
41         }
42         ICompCSTask task = CompCSCreationOperation.createBasicTask(fParentObject);
43         // Set on the proper parent object
44
if (fParentObject.getType() == ICompCSConstants.TYPE_TASKGROUP) {
45             ICompCSTaskGroup parent = (ICompCSTaskGroup)fParentObject;
46             String JavaDoc name = generateTaskObjectName(parent, PDEUIMessages.CompCSCreationOperation_task);
47             task.setFieldName(name);
48             parent.addFieldTaskObject(task);
49         } else if (fParentObject.getType() == ICompCSConstants.TYPE_COMPOSITE_CHEATSHEET) {
50             // Not supported by editor
51
}
52     }
53     
54 }
55
Popular Tags