KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > viewsupport > ViewHistory


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 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.jdt.internal.ui.viewsupport;
13
14 import java.util.List JavaDoc;
15
16 import org.eclipse.swt.widgets.Shell;
17
18 import org.eclipse.jface.action.Action;
19 import org.eclipse.jface.action.IAction;
20 import org.eclipse.jface.action.MenuManager;
21 import org.eclipse.jface.resource.ImageDescriptor;
22
23
24 /**
25  *
26  */

27 public abstract class ViewHistory {
28
29     /**
30      * Configure the history List action.
31      * Clients typically want to set a text and an image.
32      *
33      * @param action the action
34      */

35     public abstract void configureHistoryListAction(IAction action);
36     
37     /**
38      * Configure the history drop down action.
39      * Clients typically want to set a tooltip and an image.
40      *
41      * @param action the action
42      */

43     public abstract void configureHistoryDropDownAction(IAction action);
44     
45     /**
46      * @return action to clear history entries, or <code>null</code>
47      */

48     public abstract Action getClearAction();
49
50     public abstract String JavaDoc getHistoryListDialogTitle();
51
52     public abstract String JavaDoc getHistoryListDialogMessage();
53
54     public abstract Shell getShell();
55     
56     
57     /**
58      * @return An unmodifiable list of history entries, can be empty. The list
59      * is sorted by age, youngest first.
60      */

61     public abstract List JavaDoc getHistoryEntries();
62     
63     /**
64      * @return the active entry from the history
65      */

66     public abstract Object JavaDoc getCurrentEntry();
67     
68     /**
69      * @param entry the entry to activate, or <code>null</code> if none should be active
70      */

71     public abstract void setActiveEntry(Object JavaDoc entry);
72     
73     /**
74      * @param remainingEntries all the remaining history entries, can be empty
75      * @param activeEntry the entry to activate, or <code>null</code> if none should be active
76      */

77     public abstract void setHistoryEntries(List JavaDoc remainingEntries, Object JavaDoc activeEntry);
78     
79     /**
80      * @param element the element to render
81      * @return the image descriptor for the given element, or <code>null</code>
82      */

83     public abstract ImageDescriptor getImageDescriptor(Object JavaDoc element);
84     
85     /**
86      * @param element the element to render
87      * @return the label text for the given element
88      */

89     public abstract String JavaDoc getText(Object JavaDoc element);
90     
91     /**
92      * @return a history drop down action, ready for inclusion in a view toolbar
93      */

94     public final IAction createHistoryDropDownAction() {
95         return new HistoryDropDownAction(this);
96     }
97
98     public abstract void addMenuEntries(MenuManager manager);
99     
100     public abstract String JavaDoc getMaxEntriesMessage();
101     public abstract int getMaxEntries();
102     public abstract void setMaxEntries(int maxEntries);
103
104 }
105
Popular Tags