1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.navigation;
|
11
|
|
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
|
|
18
|
/**
|
19
|
* This is a wrapper for Eclipse's recently opened editors functionality. IsDirty()
|
20
|
* and isDynamic() are both set to true to force redraw every time menu is opened.
|
21
|
*
|
22
|
* @author p.ciardelli
|
23
|
* @created 23.04.2009
|
24
|
* @version 1.0
|
25
|
*/
|
26
|
public class RecentNamesContributionItem extends ContributionItem {
|
27
|
//FIXME E4 migrate recent menu items
|
28
|
private static final Logger logger = Logger
|
29
|
.getLogger(RecentNamesContributionItem.class);
|
30
|
|
31
|
private IContributionItem recentWindows;
|
32
|
private IContributionManager parent;
|
33
|
|
34
|
// @SuppressWarnings("restriction")
|
35
|
// RecentNamesContributionItem() {
|
36
|
//// WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 10);
|
37
|
// TaxeditorNavigationPlugin.getDefault().getPreferenceStore().setValue("RECENT_FILES", 10);
|
38
|
// }
|
39
|
|
40
|
private IContributionItem getRecentWindows() {
|
41
|
// if (recentWindows == null) {
|
42
|
//
|
43
|
//// int itemsToShow = TaxeditorNavigationPlugin.getDefault().getPreferenceStore()
|
44
|
//// .getInt("RECENT_FILES");
|
45
|
//
|
46
|
// recentWindows = ContributionItemFactory.REOPEN_EDITORS.create(NavigationUtil.getActiveWindow());
|
47
|
// recentWindows.setParent(parent);
|
48
|
// }
|
49
|
return recentWindows;
|
50
|
}
|
51
|
|
52
|
/* (non-Javadoc)
|
53
|
* @see org.eclipse.jface.action.IContributionItem#dispose()
|
54
|
*/
|
55
|
/** {@inheritDoc} */
|
56
|
@Override
|
57
|
public void dispose() {
|
58
|
getRecentWindows().dispose();
|
59
|
super.dispose();
|
60
|
}
|
61
|
|
62
|
/* (non-Javadoc)
|
63
|
* @see org.eclipse.jface.action.IContributionItem#fill(org.eclipse.swt.widgets.Menu, int)
|
64
|
*/
|
65
|
/** {@inheritDoc} */
|
66
|
@Override
|
67
|
public void fill(Menu parent, int index) {
|
68
|
// getRecentWindows().fill(parent, index);
|
69
|
}
|
70
|
|
71
|
/* (non-Javadoc)
|
72
|
* @see org.eclipse.jface.action.IContributionItem#isDirty()
|
73
|
*/
|
74
|
/** {@inheritDoc} */
|
75
|
@Override
|
76
|
public boolean isDirty() {
|
77
|
return true;
|
78
|
}
|
79
|
|
80
|
/* (non-Javadoc)
|
81
|
* @see org.eclipse.jface.action.IContributionItem#isDynamic()
|
82
|
*/
|
83
|
/** {@inheritDoc} */
|
84
|
@Override
|
85
|
public boolean isDynamic() {
|
86
|
return true;
|
87
|
}
|
88
|
}
|