01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor.cheatsheet.comp.actions;
11:
12: import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSConstants;
13: import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSTaskGroup;
14: import org.eclipse.pde.internal.ui.PDEUIMessages;
15: import org.eclipse.pde.internal.ui.util.PDELabelUtility;
16: import org.eclipse.pde.internal.ui.wizards.cheatsheet.CompCSCreationOperation;
17:
18: /**
19: * CompCSAddTaskAction
20: *
21: */
22: public class CompCSAddGroupAction extends CompCSAbstractAddAction {
23:
24: /**
25: *
26: */
27: public CompCSAddGroupAction() {
28: setText(PDEUIMessages.CompCSCreationOperation_group);
29: }
30:
31: /* (non-Javadoc)
32: * @see org.eclipse.jface.action.Action#run()
33: */
34: public void run() {
35:
36: if (fParentObject == null) {
37: return;
38: }
39: ICompCSTaskGroup group = CompCSCreationOperation
40: .createBasicGroup(fParentObject);
41: // Set on the proper parent object
42: if (fParentObject.getType() == ICompCSConstants.TYPE_TASKGROUP) {
43: ICompCSTaskGroup parent = (ICompCSTaskGroup) fParentObject;
44:
45: String name = PDELabelUtility.generateName(
46: getTaskObjectNames(parent),
47: PDEUIMessages.CompCSCreationOperation_group);
48: group.setFieldName(name);
49: parent.addFieldTaskObject(group);
50: } else if (fParentObject.getType() == ICompCSConstants.TYPE_COMPOSITE_CHEATSHEET) {
51: // Not supported by editor
52: }
53: }
54:
55: }
|