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.ui.internal.cheatsheets.composite.model;
11:
12: /**
13: * The concrete implementation of an editable task
14: */
15:
16: import org.eclipse.ui.IMemento;
17: import org.eclipse.ui.internal.cheatsheets.composite.parser.EditableTaskParseStrategy;
18: import org.eclipse.ui.internal.cheatsheets.composite.parser.ITaskParseStrategy;
19: import org.eclipse.ui.internal.provisional.cheatsheets.ICompositeCheatSheetTask;
20: import org.eclipse.ui.internal.provisional.cheatsheets.IEditableTask;
21: import org.eclipse.ui.internal.provisional.cheatsheets.TaskEditor;
22:
23: public class EditableTask extends AbstractTask implements IEditableTask {
24:
25: private TaskEditor editor;
26:
27: private ITaskParseStrategy parserStrategy;
28:
29: private boolean editorInitialized = false;
30:
31: private boolean underReview = false;
32:
33: public EditableTask(CompositeCheatSheetModel model, String id,
34: String name, String kind) {
35: super (model, id, name, kind);
36: parserStrategy = new EditableTaskParseStrategy();
37: }
38:
39: public ITaskParseStrategy getParserStrategy() {
40: return parserStrategy;
41: }
42:
43: public ICompositeCheatSheetTask[] getSubtasks() {
44: return EMPTY;
45: }
46:
47: public void setStarted() {
48: if (state == NOT_STARTED) {
49: setState(IN_PROGRESS);
50: }
51: }
52:
53: public void setEditor(TaskEditor editor) {
54: this .editor = editor;
55: }
56:
57: public TaskEditor getEditor() {
58: return editor;
59: }
60:
61: public void reset() {
62: setStateNoNotify(NOT_STARTED);
63: editorInitialized = false;
64: }
65:
66: public void setInput(IMemento memento) {
67: if (editor != null) {
68: editor.setInput(this , memento);
69: editorInitialized = true;
70: }
71: }
72:
73: public boolean isEditorInitialized() {
74: return editorInitialized;
75: }
76:
77: public void setUnderReview(boolean underReview) {
78: this .underReview = underReview;
79: }
80:
81: public boolean isUnderReview() {
82: return underReview;
83: }
84:
85: }
|