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