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.ICompCSTask;
14: import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSTaskGroup;
15: import org.eclipse.pde.internal.ui.PDEUIMessages;
16: import org.eclipse.pde.internal.ui.util.PDELabelUtility;
17: import org.eclipse.pde.internal.ui.wizards.cheatsheet.CompCSCreationOperation;
18:
19: /**
20: * CompCSAddTaskAction
21: *
22: */
23: public class CompCSAddTaskAction extends CompCSAbstractAddAction {
24:
25: /**
26: *
27: */
28: public CompCSAddTaskAction() {
29: setText(PDEUIMessages.CompCSCreationOperation_task);
30: }
31:
32: /* (non-Javadoc)
33: * @see org.eclipse.jface.action.Action#run()
34: */
35: public void run() {
36:
37: if (fParentObject == null) {
38: return;
39: }
40: ICompCSTask task = CompCSCreationOperation
41: .createBasicTask(fParentObject);
42: // Set on the proper parent object
43: if (fParentObject.getType() == ICompCSConstants.TYPE_TASKGROUP) {
44: ICompCSTaskGroup parent = (ICompCSTaskGroup) fParentObject;
45:
46: String name = PDELabelUtility.generateName(
47: getTaskObjectNames(parent),
48: PDEUIMessages.CompCSCreationOperation_task);
49: task.setFieldName(name);
50: parent.addFieldTaskObject(task);
51: } else if (fParentObject.getType() == ICompCSConstants.TYPE_COMPOSITE_CHEATSHEET) {
52: // Not supported by editor
53: }
54: }
55:
56: }
|