2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.navigation
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.jface
.action
.ContributionItem
;
14 import org
.eclipse
.jface
.action
.IContributionItem
;
15 import org
.eclipse
.jface
.action
.IContributionManager
;
16 import org
.eclipse
.swt
.widgets
.Menu
;
17 import org
.eclipse
.ui
.actions
.ContributionItemFactory
;
18 import org
.eclipse
.ui
.internal
.IPreferenceConstants
;
19 import org
.eclipse
.ui
.internal
.Workbench
;
20 import org
.eclipse
.ui
.internal
.WorkbenchPlugin
;
22 import eu
.etaxonomy
.taxeditor
.editor
.internal
.TaxeditorEditorPlugin
;
23 import eu
.etaxonomy
.taxeditor
.navigation
.internal
.TaxeditorNavigationPlugin
;
24 import eu
.etaxonomy
.taxeditor
.store
.internal
.TaxeditorStorePlugin
;
27 * This is a wrapper for Eclipse's recently opened editors functionality. IsDirty()
28 * and isDynamic() are both set to true to force redraw every time menu is opened.
34 public class RecentNamesContributionItem
extends ContributionItem
{
35 private static final Logger logger
= Logger
36 .getLogger(RecentNamesContributionItem
.class);
38 private IContributionItem recentWindows
;
39 private IContributionManager parent
;
41 // @SuppressWarnings("restriction")
42 // RecentNamesContributionItem() {
43 //// WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 10);
44 // TaxeditorNavigationPlugin.getDefault().getPreferenceStore().setValue("RECENT_FILES", 10);
47 private IContributionItem
getRecentWindows() {
48 if (recentWindows
== null) {
50 // int itemsToShow = TaxeditorNavigationPlugin.getDefault().getPreferenceStore()
51 // .getInt("RECENT_FILES");
53 recentWindows
= ContributionItemFactory
.REOPEN_EDITORS
.create(NavigationUtil
.getActiveWindow());
54 recentWindows
.setParent(parent
);
60 * @see org.eclipse.jface.action.IContributionItem#dispose()
64 public void dispose() {
65 getRecentWindows().dispose();
70 * @see org.eclipse.jface.action.IContributionItem#fill(org.eclipse.swt.widgets.Menu, int)
74 public void fill(Menu parent
, int index
) {
75 // getRecentWindows().fill(parent, index);
79 * @see org.eclipse.jface.action.IContributionItem#isDirty()
83 public boolean isDirty() {
88 * @see org.eclipse.jface.action.IContributionItem#isDynamic()
92 public boolean isDynamic() {