KickJava   Java API By Example, From Geeks To Geeks.

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


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.ICompCSTaskGroup;
16 import org.eclipse.pde.internal.ui.PDEUIMessages;
17 import org.eclipse.pde.internal.ui.wizards.cheatsheet.CompCSCreationOperation;
18
19
20 /**
21  * CompCSAddTaskAction
22  *
23  */

24 public class CompCSAddGroupAction extends CompCSAbstractAddAction {
25
26     /**
27      *
28      */

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

36     public void run() {
37         
38         if (fParentObject == null) {
39             return;
40         }
41         ICompCSTaskGroup group =
42             CompCSCreationOperation.createBasicGroup(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_group);
47             group.setFieldName(name);
48             parent.addFieldTaskObject(group);
49         } else if (fParentObject.getType() == ICompCSConstants.TYPE_COMPOSITE_CHEATSHEET) {
50             // Not supported by editor
51
}
52     }
53     
54 }
55
Popular Tags