KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nightlabs > editor2d > properties > EditorPropertyPage


1 /* *****************************************************************************
2  * NightLabs Editor2D - Graphical editor framework *
3  * Copyright (C) 2004-2005 NightLabs - http://NightLabs.org *
4  * Project author: Daniel Mazurek <Daniel.Mazurek [at] nightlabs [dot] org> *
5  * *
6  * This library is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin St, Fifth Floor, *
20  * Boston, MA 02110-1301 USA *
21  * *
22  * Or get it online : *
23  * http://www.gnu.org/copyleft/lesser.html *
24  * *
25  * *
26  ******************************************************************************/

27
28 package org.nightlabs.editor2d.properties;
29
30 import java.beans.PropertyChangeEvent JavaDoc;
31 import java.beans.PropertyChangeListener JavaDoc;
32 import java.util.ArrayList JavaDoc;
33 import java.util.Collection JavaDoc;
34 import java.util.Iterator JavaDoc;
35
36 import org.eclipse.jface.action.IMenuManager;
37 import org.eclipse.jface.action.IStatusLineManager;
38 import org.eclipse.jface.action.IToolBarManager;
39 import org.eclipse.ui.views.properties.PropertySheetPage;
40 import org.nightlabs.base.language.ILanguageManager;
41 import org.nightlabs.base.language.LanguageAction;
42 import org.nightlabs.base.language.LanguageChangeEvent;
43 import org.nightlabs.base.language.LanguageChangeListener;
44 import org.nightlabs.base.language.LanguageContributionItem;
45 import org.nightlabs.base.language.LanguageManager;
46 import org.nightlabs.language.LanguageCf;
47
48 public class EditorPropertyPage
49 extends PropertySheetPage
50 {
51     public EditorPropertyPage()
52     {
53         super();
54         langMan = LanguageManager.sharedInstance();
55         langMan.addPropertyChangeListener(languageListener);
56     }
57
58     protected PropertyChangeListener JavaDoc languageListener = new PropertyChangeListener JavaDoc()
59     {
60         public void propertyChange(PropertyChangeEvent JavaDoc evt)
61         {
62             if (!getControl().isDisposed()) {
63                 refresh();
64             }
65         }
66     };
67     
68 // protected LanguageChangeListener langListener = new LanguageChangeListener()
69
// {
70
// public void languageChanged(LanguageChangeEvent event)
71
// {
72
// if (!getControl().isDisposed()) {
73
// refresh();
74
// }
75
// }
76
// };
77

78     protected LanguageManager langMan = null;
79     
80     protected LanguageContributionItem langContribution = null;
81   public void makeContributions(IMenuManager menuManager,
82       IToolBarManager toolBarManager, IStatusLineManager statusLineManager)
83   {
84 // langContribution = new LanguageContributionItem(langMan);
85
// toolBarManager.add(langContribution);
86

87     super.makeContributions(menuManager, toolBarManager, statusLineManager);
88     
89 // Collection languageActions = makeLanguageActions();
90
// for (Iterator it = languageActions.iterator(); it.hasNext(); ) {
91
// LanguageAction action = (LanguageAction) it.next();
92
// menuManager.add(action);
93
// }
94
}
95   
96 // protected Collection makeLanguageActions()
97
// {
98
// Collection languageActions = new ArrayList(langMan.getLanguages().size());
99
// for (Iterator it = langMan.getLanguages().iterator(); it.hasNext(); ) {
100
// LanguageCf language = (LanguageCf) it.next();
101
// LanguageAction action = new LanguageAction(langMan, language.getLanguageID());
102
// languageActions.add(action);
103
// }
104
// return languageActions;
105
// }
106

107 }
108
Popular Tags