ref #8801: disabled submenu items should be visible again
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / WorkbenchUndoContextAdapterFactory.java
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.core.commands.operations.IUndoContext;
14 import org.eclipse.core.commands.operations.UndoContext;
15 import org.eclipse.core.runtime.IAdapterFactory;
16
17
18 /**
19 * <p>WorkbenchUndoContextAdapterFactory class.</p>
20 *
21 * @author p.ciardelli
22 * @created 04.06.2009
23 * @version 1.0
24 */
25 public class WorkbenchUndoContextAdapterFactory implements IAdapterFactory {
26 private static final Logger logger = Logger
27 .getLogger(WorkbenchUndoContextAdapterFactory.class);
28 private UndoContext defaultUndoContext;
29
30 private static final Class[] ADAPTER_LIST = new Class[] { IUndoContext.class };
31
32 /* (non-Javadoc)
33 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
34 */
35 /** {@inheritDoc} */
36 @Override
37 public Object getAdapter(Object adaptableObject, Class adapterType) {
38 // if (IUndoContext.class.equals(adapterType)) {
39 // return NavigationUtil.getWorkbenchUndoContext();
40 // }
41 return null;
42 }
43
44 /**
45 * @return
46 */
47 private Object getDefaultUndoContext() {
48 if (defaultUndoContext == null) {
49 defaultUndoContext = new UndoContext();
50 }
51 return defaultUndoContext;
52 }
53
54 /* (non-Javadoc)
55 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
56 */
57 /**
58 * <p>getAdapterList</p>
59 *
60 * @return an array of {@link java.lang.Class} objects.
61 */
62 @Override
63 public Class[] getAdapterList() {
64 return ADAPTER_LIST;
65 }
66 }