KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > cheatsheets > composite > model > EditableTask


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.ui.internal.cheatsheets.composite.model;
13
14 /**
15  * The concrete implementation of an editable task
16  */

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