01: /*******************************************************************************
02: * Copyright (c) 2005, 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.provisional.cheatsheets;
11:
12: import org.eclipse.jface.viewers.ISelection;
13: import org.eclipse.jface.viewers.ISelectionProvider;
14: import org.eclipse.swt.widgets.Composite;
15: import org.eclipse.swt.widgets.Control;
16: import org.eclipse.ui.forms.widgets.FormToolkit;
17:
18: /**
19: * Classes that extend this class are responsible for rendering the
20: * hierarchy of tasks in the composite cheat sheet. They must support task
21: * selection via the selection provider, be able to accept focus, and create
22: * control when asked.
23: */
24:
25: public abstract class TaskExplorer {
26: /**
27: * @return the id of this TaskExplorer which must match the id used in the
28: * extension point
29: */
30: public abstract String getId();
31:
32: /**
33: * Create a control which will display the structure of the composite cheat
34: * sheet and allow tasks within the composite cheat sheet to be selected.
35: *
36: * @param parent
37: * @param toolkit
38: */
39: public abstract void createControl(Composite parent,
40: FormToolkit toolkit);
41:
42: /**
43: * Get the control created by a previous call to createControl
44: *
45: * @return the task explorer control
46: */
47: public abstract Control getControl();
48:
49: /**
50: * Called when the explorer gains focus.
51: */
52: public abstract void setFocus();
53:
54: /**
55: * Get the selection provider for this explorer. The selections returned by
56: * the selection provider should represent IGuideTasks.
57: *
58: * @return the selection provider for the task explorer
59: */
60: public abstract ISelectionProvider getSelectionProvider();
61:
62: /**
63: * Sets the composite cheat sheet to be displayed. createControl will
64: * already have been called.
65: *
66: * @param compositeCheatSheet
67: */
68: public abstract void setCompositeCheatSheet(
69: ICompositeCheatSheet compositeCheatSheet);
70:
71: /**
72: * Called after this explorer is no longer in use. Any resources should be
73: * disposed of at this point.
74: */
75: public abstract void dispose();
76:
77: /**
78: * Called when the state of a task changes and the representation of the
79: * task may need to be redrawn.
80: *
81: * @param task
82: */
83: public abstract void taskUpdated(ICompositeCheatSheetTask task);
84:
85: /**
86: * Called to set the provided selection and optionally reveal it
87: * if the scroll bars are active and the selected tasks
88: * are partially or fully hidden.
89: *
90: * @param selection the new selection
91: * @param reveal if <code>true</code>, expose the task if hidden;
92: * otherwise, just select.
93: */
94: public abstract void setSelection(ISelection selection,
95: boolean reveal);
96: }
|