X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=case-study%2Fjdt-before%2Fui%2Forg%2Feclipse%2Fjdt%2Finternal%2Fui%2Fviewsupport%2FViewHistory.java;fp=case-study%2Fjdt-before%2Fui%2Forg%2Feclipse%2Fjdt%2Finternal%2Fui%2Fviewsupport%2FViewHistory.java;h=3b81eb7907a1c33b16c5032950f767300dcc9b51;hb=1b2798f607d741df30e5197f427381cbff326adc;hp=0000000000000000000000000000000000000000;hpb=246231e4bd9b24345490f369747c0549ca308c4d;p=ifi-stolz-refaktor.git diff --git a/case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/viewsupport/ViewHistory.java b/case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/viewsupport/ViewHistory.java new file mode 100644 index 00000000..3b81eb79 --- /dev/null +++ b/case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/viewsupport/ViewHistory.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2006, 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.jdt.internal.ui.viewsupport; + +import java.util.List; + +import org.eclipse.swt.widgets.Shell; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.resource.ImageDescriptor; + + +/** + * History support for a view. + * + * @param the type of elements managed by this history + */ +public abstract class ViewHistory { + + /** + * Configure the history List action. + * Clients typically want to set a text and an image. + * + * @param action the action + */ + public abstract void configureHistoryListAction(IAction action); + + /** + * Configure the history drop down action. + * Clients typically want to set a tooltip and an image. + * + * @param action the action + */ + public abstract void configureHistoryDropDownAction(IAction action); + + /** + * @return action to clear history entries, or null + */ + public abstract Action getClearAction(); + + public abstract String getHistoryListDialogTitle(); + + public abstract String getHistoryListDialogMessage(); + + public abstract Shell getShell(); + + + /** + * @return An unmodifiable list of history entries, can be empty. The list + * is sorted by age, youngest first. + */ + public abstract List getHistoryEntries(); + + /** + * @return the active entry from the history + */ + public abstract E getCurrentEntry(); + + /** + * @param entry the entry to activate, or null if none should be active + */ + public abstract void setActiveEntry(E entry); + + /** + * @param remainingEntries all the remaining history entries, can be empty + * @param activeEntry the entry to activate, or null if none should be active + */ + public abstract void setHistoryEntries(List remainingEntries, E activeEntry); + + /** + * @param element the element to render + * @return the image descriptor for the given element, or null + */ + public abstract ImageDescriptor getImageDescriptor(Object element); + + /** + * @param element the element to render + * @return the label text for the given element + */ + public abstract String getText(E element); + + /** + * @return a history drop down action, ready for inclusion in a view toolbar + */ + public final IAction createHistoryDropDownAction() { + return new HistoryDropDownAction(this); + } + + public abstract void addMenuEntries(MenuManager manager); + + public abstract String getMaxEntriesMessage(); + public abstract int getMaxEntries(); + public abstract void setMaxEntries(int maxEntries); + +}