Source Code Cross Referenced for ExplorerMenuBar.java in  » Net » SkunkDAV » org » skunk » dav » client » gui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » SkunkDAV » org.skunk.dav.client.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Copyright (c) 2000, Jacob Smullyan.
003:         *
004:         *  This is part of SkunkDAV, a WebDAV client.  See http://skunkdav.sourceforge.net/ 
005:         *  for the latest version.
006:         * 
007:         *  SkunkDAV is free software; you can redistribute it and/or
008:         *  modify it under the terms of the GNU General Public License as published
009:         *  by the Free Software Foundation; either version 2, or (at your option)
010:         *  any later version.
011:         * 
012:         *  SkunkDAV  is distributed in the hope that it will be useful,
013:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *  General Public License for more details.
016:         * 
017:         *  You should have received a copy of the GNU General Public License
018:         *  along with SkunkDAV; see the file COPYING.  If not, write to the Free
019:         *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
020:         *  02111-1307, USA.
021:         */
022:
023:        package org.skunk.dav.client.gui;
024:
025:        import java.awt.Event;
026:        import java.awt.event.InputEvent;
027:        import java.awt.event.KeyEvent;
028:        import java.util.Enumeration;
029:        import java.util.Hashtable;
030:        import javax.swing.JCheckBoxMenuItem;
031:        import javax.swing.JMenu;
032:        import javax.swing.JMenuBar;
033:        import javax.swing.JMenuItem;
034:        import javax.swing.JSeparator;
035:        import javax.swing.KeyStroke;
036:        import javax.swing.event.ChangeEvent;
037:        import javax.swing.event.ChangeListener;
038:        import org.skunk.dav.client.gui.action.AboutAction;
039:        import org.skunk.dav.client.gui.action.CloseAction;
040:        import org.skunk.dav.client.gui.action.CloseBufferAction;
041:        import org.skunk.dav.client.gui.action.CloseViewAction;
042:        import org.skunk.dav.client.gui.action.ConnectionAction;
043:        import org.skunk.dav.client.gui.action.CopyAction;
044:        import org.skunk.dav.client.gui.action.DeleteAction;
045:        import org.skunk.dav.client.gui.action.DisconnectionAction;
046:        import org.skunk.dav.client.gui.action.DownloadAction;
047:        import org.skunk.dav.client.gui.action.ExitAction;
048:        import org.skunk.dav.client.gui.action.MoveAction;
049:        import org.skunk.dav.client.gui.action.NewCollectionAction;
050:        import org.skunk.dav.client.gui.action.NewFileAction;
051:        import org.skunk.dav.client.gui.action.OpenAction;
052:        import org.skunk.dav.client.gui.action.PreferencesAction;
053:        import org.skunk.dav.client.gui.action.PropertiesAction;
054:        import org.skunk.dav.client.gui.action.RefreshAction;
055:        import org.skunk.dav.client.gui.action.SaveAction;
056:        import org.skunk.dav.client.gui.action.SaveAsAction;
057:        import org.skunk.dav.client.gui.action.UploadAction;
058:        import org.skunk.dav.client.gui.editor.DAVEditor;
059:        import org.skunk.dav.client.gui.editor.DAVEditorUndoManager;
060:        import org.skunk.dav.client.gui.editor.SimpleTextEditor;
061:        import org.skunk.dav.client.gui.editor.action.CopyTextAction;
062:        import org.skunk.dav.client.gui.editor.action.CutAction;
063:        import org.skunk.dav.client.gui.editor.action.GotoLineAction;
064:        import org.skunk.dav.client.gui.editor.action.PasteAction;
065:        import org.skunk.dav.client.gui.editor.action.RedoAction;
066:        import org.skunk.dav.client.gui.editor.action.SearchAction;
067:        import org.skunk.dav.client.gui.editor.action.SearchAndReplaceAction;
068:        import org.skunk.dav.client.gui.editor.action.SelectAllAction;
069:        import org.skunk.dav.client.gui.editor.action.SyntaxHighlightAction;
070:        import org.skunk.dav.client.gui.editor.action.UndoAction;
071:        import org.skunk.dav.client.gui.editor.action.WordWrapAction;
072:        import org.skunk.swing.text.syntax.FileMode;
073:        import org.skunk.trace.Debug;
074:
075:        public class ExplorerMenuBar extends JMenuBar {
076:            private static Hashtable menubars = new Hashtable();
077:            private static AboutAction aboutAction;
078:            private ConnectMenu connectMenu;
079:            private Explorer explorer;
080:            private JMenuItem openItem, deleteItem, copyItem, moveItem,
081:                    disconnectionItem, newFileItem, newCollectionItem,
082:                    saveItem, saveAsItem, closeBufferItem, propertiesItem,
083:                    refreshItem, preferencesItem, uploadItem, downloadItem,
084:                    undoItem, redoItem, cutItem, copyTextItem, pasteItem,
085:                    selectAllItem, searchItem, replaceItem, gotoLineItem,
086:                    wordWrapItem, highlightItem;
087:
088:            private boolean showingExits = true;
089:            private boolean trusted = true;
090:            private boolean connected = false;
091:            private boolean editorInFocus = false;
092:            private UndoListener undoListener = new UndoListener();
093:
094:            /*
095:             * word wrap was broken by the syntax highlighting package; 
096:             * this flag enables me to keep the word wrap code around until I reimplement it
097:             */
098:            private boolean WORD_WRAP = false;
099:
100:            private ExplorerMenuBar(Explorer explorer) {
101:                super ();
102:                this .explorer = explorer;
103:                connectMenu = new ConnectMenu(explorer);
104:                add(createFileMenu());
105:                add(createEditMenu());
106:                add(createViewMenu());
107:                add(createHelpMenu());
108:                initState();
109:            }
110:
111:            private void initState() {
112:                //some housekeeping for maintaining state
113:                setConnected(false);
114:                StateMonitor.DomainMatcher dm = new StateMonitor.DomainMatcher() {
115:                    public boolean domainMatches(Object domainKey) {
116:                        return ExplorerMenuBar.this .explorer.equals(domainKey);
117:                    }
118:                };
119:                StateMonitor.registerProperty(this , StateProperties.CONNECTED,
120:                        StateProperties.CONNECTED, null, dm);
121:                StateMonitor.registerProperty(this ,
122:                        StateProperties.EDITOR_IN_FOCUS,
123:                        StateProperties.EDITOR_IN_FOCUS, null, null);
124:            }
125:
126:            public static ExplorerMenuBar getMenuBar(Explorer explorer) {
127:                if (!menubars.containsKey(explorer)) {
128:                    ExplorerMenuBar menubar = new ExplorerMenuBar(explorer);
129:                    menubars.put(explorer, menubar);
130:                    return menubar;
131:                } else
132:                    return (ExplorerMenuBar) menubars.get(explorer);
133:            }
134:
135:            public static void refreshMenus()
136:    {
137:	for (Enumeration enum=menubars.elements();enum.hasMoreElements();)
138:	{
139:	    ExplorerMenuBar emb=(ExplorerMenuBar) enum.nextElement();
140:	    emb.refresh();
141:	}
142:    }
143:
144:            public boolean isShowingExits() {
145:                return showingExits;
146:            }
147:
148:            public void setShowingExits(boolean showingExits) {
149:                this .showingExits = showingExits;
150:            }
151:
152:            public boolean isTrusted() {
153:                return trusted;
154:            }
155:
156:            public void setTrusted(boolean trusted) {
157:                this .trusted = trusted;
158:            }
159:
160:            public boolean isConnected() {
161:                return this .connected;
162:            }
163:
164:            /**
165:             *  this sends a signal to the menu bar that affects the enabled state of some of its menu items.
166:             */
167:            public void setConnected(boolean connected) {
168:                this .connected = connected;
169:                refreshMenuState();
170:            }
171:
172:            public void setEditorInFocus(boolean editorInFocus) {
173:                this .editorInFocus = editorInFocus;
174:                refreshMenuState();
175:                resetUndoItems();
176:            }
177:
178:            public void setSearchInProgress(boolean searchInProgress) {
179:                if (Debug.DEBUG)
180:                    Debug.trace(this , Debug.DP3,
181:                            "in setSearchInProgress with argument : "
182:                                    + searchInProgress);
183:                boolean b = !searchInProgress;
184:                searchItem.setEnabled(b);
185:                replaceItem.setEnabled(b);
186:                gotoLineItem.setEnabled(b);
187:            }
188:
189:            private void refreshMenuState() {
190:                boolean connectedAndShowingExplorer = connected
191:                        && !editorInFocus;
192:                boolean connectedAndShowingEditor = connected && editorInFocus;
193:                boolean editingText = false;
194:                boolean highlighting = false;
195:                boolean canHighlight = false;
196:                if (connectedAndShowingEditor) {
197:                    Buffer b = ExplorerApp.getAppContext().getCurrentView()
198:                            .getFocussedBuffer();
199:                    if (b != null && (b instanceof  SimpleTextEditor)) {
200:                        editingText = true;
201:                        SimpleTextEditor ed = (SimpleTextEditor) b;
202:                        highlighting = ed.isTokenizing();
203:                        FileMode fm = ed.getSyntaxDocument().getFileMode();
204:                        if (Debug.DEBUG)
205:                            Debug.trace(this , Debug.DP4,
206:                                    "file mode of current buffer: {0}", fm);
207:                        canHighlight = highlighting
208:                                || (fm != null && fm.getCanHighlight());
209:                    }
210:                }
211:
212:                openItem.setEnabled(connectedAndShowingExplorer);
213:                copyItem.setEnabled(connectedAndShowingExplorer);
214:                moveItem.setEnabled(connectedAndShowingExplorer);
215:                disconnectionItem.setEnabled(connectedAndShowingExplorer);
216:                newFileItem.setEnabled(connectedAndShowingExplorer);
217:                newCollectionItem.setEnabled(connectedAndShowingExplorer);
218:                refreshItem.setEnabled(connectedAndShowingExplorer);
219:                uploadItem.setEnabled(connectedAndShowingExplorer);
220:                downloadItem.setEnabled(connectedAndShowingExplorer);
221:                propertiesItem.setEnabled(connectedAndShowingExplorer);
222:                saveAsItem.setEnabled(connectedAndShowingEditor);
223:                closeBufferItem.setEnabled(connectedAndShowingEditor);
224:
225:                searchItem.setEnabled(editingText);
226:                gotoLineItem.setEnabled(editingText);
227:                copyTextItem.setEnabled(editingText);
228:                cutItem.setEnabled(editingText);
229:                pasteItem.setEnabled(editingText);
230:                replaceItem.setEnabled(editingText);
231:                selectAllItem.setEnabled(editingText);
232:                if (WORD_WRAP)
233:                    wordWrapItem.setEnabled(editingText);
234:                highlightItem.setArmed(false);
235:                highlightItem.setEnabled(editingText && canHighlight);
236:                highlightItem.setSelected(highlighting);
237:                highlightItem.setArmed(true);
238:            }
239:
240:            private void resetUndoItems() {
241:                Buffer buffer = ExplorerApp.getAppContext().getCurrentView()
242:                        .getFocussedBuffer();
243:                DAVEditorUndoManager undoer;
244:                if ((buffer instanceof  DAVEditor)
245:                        && (undoer = ((DAVEditor) buffer).getUndoManager()) != null) {
246:                    undoItem.setEnabled(undoer.canUndo());
247:                    redoItem.setEnabled(undoer.canRedo());
248:                    undoListener.setEditor((DAVEditor) buffer);
249:
250:                } else {
251:                    undoItem.setEnabled(false);
252:                    redoItem.setEnabled(false);
253:                    undoListener.setEditor(null);
254:                }
255:
256:            }
257:
258:            protected void finalize() throws Throwable {
259:                if (menubars.containsKey(explorer))
260:                    menubars.remove(explorer);
261:                super .finalize();
262:            }
263:
264:            public void refresh() {
265:                connectMenu.refresh();
266:            }
267:
268:            private JMenu createFileMenu() {
269:                String label = ResourceManager
270:                        .getMessage(ResourceManager.FILE_KEY);
271:                JMenu menu = new JMenu(label);
272:
273:                label = ResourceManager.getMessage(ResourceManager.CONNECT_KEY);
274:                JMenuItem connectItem = menu
275:                        .add(new ConnectionAction(explorer));
276:                connectItem.setActionCommand(ConnectionAction.CHOOSE_COMMAND);
277:                connectItem.setText(label);
278:                connectItem.setAccelerator(KeyStroke.getKeyStroke(
279:                        KeyEvent.VK_O, InputEvent.CTRL_MASK));
280:
281:                menu.add(getConnectMenu());
282:
283:                label = ResourceManager
284:                        .getMessage(ResourceManager.DISCONNECTION_KEY);
285:                disconnectionItem = menu.add(new DisconnectionAction(explorer));
286:                disconnectionItem.setAccelerator(KeyStroke.getKeyStroke(
287:                        KeyEvent.VK_X, InputEvent.ALT_MASK
288:                                | InputEvent.SHIFT_MASK));
289:                disconnectionItem.setText(label);
290:
291:                label = ResourceManager
292:                        .getMessage(ResourceManager.NEW_COLLECTION_KEY);
293:                newCollectionItem = menu.add(new NewCollectionAction(explorer));
294:                newCollectionItem.setAccelerator(KeyStroke.getKeyStroke(
295:                        KeyEvent.VK_N, InputEvent.CTRL_MASK
296:                                | InputEvent.SHIFT_MASK));
297:                newCollectionItem.setText(label);
298:
299:                label = ResourceManager
300:                        .getMessage(ResourceManager.NEW_FILE_KEY);
301:                newFileItem = menu.add(new NewFileAction(explorer));
302:                newFileItem.setAccelerator(KeyStroke.getKeyStroke(
303:                        KeyEvent.VK_N, InputEvent.ALT_MASK
304:                                | InputEvent.SHIFT_MASK));
305:                newFileItem.setText(label);
306:
307:                label = ResourceManager.getMessage(ResourceManager.OPEN_KEY);
308:                openItem = menu.add(new OpenAction(explorer));
309:                openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,
310:                        InputEvent.CTRL_MASK));
311:                openItem.setText(label);
312:
313:                label = ResourceManager.getMessage(ResourceManager.SAVE_KEY);
314:                saveItem = menu.add(new SaveAction());
315:                saveItem.setText(label);
316:                saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
317:                        InputEvent.CTRL_MASK));
318:                saveItem.setEnabled(false);
319:                StateMonitor.registerProperty(saveItem, "enabled",
320:                        StateProperties.EDITOR_IN_FOCUS_AND_DIRTY, null, null);
321:
322:                label = ResourceManager.getMessage(ResourceManager.SAVE_AS_KEY);
323:                saveAsItem = menu.add(new SaveAsAction());
324:                saveAsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
325:                        InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK));
326:                saveAsItem.setText(label);
327:
328:                menu.addSeparator();
329:
330:                label = ResourceManager.getMessage(ResourceManager.COPY_KEY);
331:                copyItem = menu.add(new CopyAction(explorer));
332:                copyItem.setText(label);
333:
334:                label = ResourceManager.getMessage(ResourceManager.MOVE_KEY);
335:                moveItem = menu.add(new MoveAction(explorer));
336:                moveItem.setText(label);
337:
338:                if (isTrusted()) {
339:                    menu.addSeparator();
340:
341:                    label = ResourceManager
342:                            .getMessage(ResourceManager.UPLOAD_KEY);
343:                    uploadItem = menu.add(new UploadAction(explorer));
344:                    uploadItem.setText(label);
345:
346:                    label = ResourceManager
347:                            .getMessage(ResourceManager.DOWNLOAD_KEY);
348:                    downloadItem = menu.add(new DownloadAction(explorer));
349:                    downloadItem.setText(label);
350:                }
351:
352:                if (isShowingExits()) {
353:                    menu.addSeparator();
354:
355:                    label = ResourceManager
356:                            .getMessage(ResourceManager.CLOSE_BUFFER_KEY);
357:                    closeBufferItem = menu.add(new CloseBufferAction());
358:                    closeBufferItem.setText(label);
359:                    closeBufferItem.setAccelerator(KeyStroke.getKeyStroke(
360:                            KeyEvent.VK_W, InputEvent.CTRL_MASK));
361:                    closeBufferItem.setEnabled(false);
362:
363:                    JMenuItem tmp;
364:
365:                    /* given that the app does not at present give the user the ability to create multiple views, 
366:                       I am commenting this out.  -JS */
367:                    // 	    label=ResourceManager.getMessage(ResourceManager.CLOSE_KEY);
368:                    // 	    tmp=menu.add(new CloseViewAction());
369:                    // 	    tmp.setText(label);
370:                    // 	    tmp.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK));
371:                    label = ResourceManager
372:                            .getMessage(ResourceManager.EXIT_KEY);
373:                    tmp = menu.add(new ExitAction());
374:                    tmp.setText(label);
375:                    tmp.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,
376:                            InputEvent.CTRL_MASK));
377:                }
378:                return menu;
379:            }
380:
381:            private JMenu getConnectMenu() {
382:                return connectMenu;
383:            }
384:
385:            private JMenu createEditMenu() {
386:                String label = ResourceManager
387:                        .getMessage(ResourceManager.EDIT_KEY);
388:                JMenu menu = new JMenu(label);
389:
390:                label = ResourceManager.getMessage(ResourceManager.UNDO_KEY);
391:                undoItem = menu.add(new UndoAction());
392:                undoItem.setText(label);
393:                undoItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U,
394:                        InputEvent.CTRL_MASK));
395:                undoItem.setEnabled(false);
396:
397:                label = ResourceManager.getMessage(ResourceManager.REDO_KEY);
398:                redoItem = menu.add(new RedoAction());
399:                redoItem.setText(label);
400:                redoItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U,
401:                        InputEvent.ALT_MASK));
402:                redoItem.setEnabled(false);
403:
404:                label = ResourceManager.getMessage(ResourceManager.CUT_KEY);
405:                cutItem = menu.add(new CutAction());
406:                cutItem.setEnabled(false);
407:                cutItem.setText(label);
408:                cutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,
409:                        InputEvent.CTRL_MASK));
410:
411:                label = ResourceManager
412:                        .getMessage(ResourceManager.COPY_TEXT_KEY);
413:                copyTextItem = menu.add(new CopyTextAction());
414:                copyTextItem.setEnabled(false);
415:                copyTextItem.setText(label);
416:                copyTextItem.setAccelerator(KeyStroke.getKeyStroke(
417:                        KeyEvent.VK_C, InputEvent.CTRL_MASK));
418:
419:                label = ResourceManager.getMessage(ResourceManager.PASTE_KEY);
420:                pasteItem = menu.add(new PasteAction());
421:                pasteItem.setEnabled(false);
422:                pasteItem.setText(label);
423:                pasteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
424:                        InputEvent.CTRL_MASK));
425:
426:                label = ResourceManager
427:                        .getMessage(ResourceManager.SELECT_ALL_KEY);
428:                selectAllItem = menu.add(new SelectAllAction()); //new JMenuItem(label);
429:                selectAllItem.setText(label);
430:                selectAllItem.setEnabled(false);
431:
432:                label = ResourceManager.getMessage(ResourceManager.SEARCH_KEY);
433:                searchItem = menu.add(new SearchAction());
434:                searchItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
435:                        InputEvent.ALT_MASK));
436:                searchItem.setText(label);
437:
438:                label = ResourceManager.getMessage(ResourceManager.REPLACE_KEY);
439:                replaceItem = menu.add(new SearchAndReplaceAction());
440:                replaceItem.setEnabled(false);
441:                replaceItem.setText(label);
442:                replaceItem.setAccelerator(KeyStroke.getKeyStroke(
443:                        KeyEvent.VK_R, InputEvent.SHIFT_MASK
444:                                | InputEvent.ALT_MASK));
445:
446:                label = ResourceManager
447:                        .getMessage(ResourceManager.GOTO_LINE_KEY);
448:                gotoLineItem = menu.add(new GotoLineAction());
449:                gotoLineItem.setAccelerator(KeyStroke.getKeyStroke(
450:                        KeyEvent.VK_G, InputEvent.ALT_MASK));
451:                gotoLineItem.setText(label);
452:
453:                menu.add(gotoLineItem);
454:
455:                menu.add(new JSeparator());
456:
457:                if (WORD_WRAP) {
458:
459:                    wordWrapItem = new JCheckBoxMenuItem(ResourceManager
460:                            .getMessage(ResourceManager.WORD_WRAP_KEY));
461:                    wordWrapItem.addActionListener(new WordWrapAction());
462:                    wordWrapItem.setSelected(false);
463:                    wordWrapItem.setEnabled(false);
464:                    menu.add(wordWrapItem);
465:                }
466:
467:                highlightItem = new JCheckBoxMenuItem(ResourceManager
468:                        .getMessage(ResourceManager.SYNTAX_HIGHLIGHT_KEY));
469:                highlightItem.setSelected(false);
470:                highlightItem.setEnabled(false);
471:                highlightItem.addActionListener(new SyntaxHighlightAction());
472:                menu.add(highlightItem);
473:
474:                StateMonitor.registerProperty(this , "searchInProgress",
475:                        SearchAction.SEARCH_IN_PROGRESS_PROPERTY, null, null);
476:
477:                return menu;
478:            }
479:
480:            private JMenu createViewMenu() {
481:                JMenu menu = new JMenu(ResourceManager
482:                        .getMessage(ResourceManager.VIEW_KEY));
483:                String label = ResourceManager
484:                        .getMessage(ResourceManager.REFRESH_KEY);
485:                refreshItem = menu.add(new RefreshAction(explorer));
486:                refreshItem.setText(label);
487:
488:                menu.add(new JSeparator());
489:
490:                label = ResourceManager
491:                        .getMessage(ResourceManager.PROPERTIES_KEY);
492:                propertiesItem = menu.add(new PropertiesAction(explorer));
493:                propertiesItem.setText(label);
494:
495:                menu.add(new JSeparator());
496:
497:                label = ResourceManager
498:                        .getMessage(ResourceManager.PREFERENCES_KEY);
499:                preferencesItem = menu.add(new PreferencesAction());
500:                preferencesItem.setText(label);
501:                return menu;
502:            }
503:
504:            private JMenu createHelpMenu() {
505:                if (aboutAction == null) {
506:                    aboutAction = new AboutAction();
507:                }
508:                JMenu jm = new JMenu(ResourceManager
509:                        .getMessage(ResourceManager.HELP_KEY));
510:                String label = ResourceManager
511:                        .getMessage(ResourceManager.ABOUT_KEY);
512:                JMenuItem tmp = jm.add(aboutAction);
513:                tmp.setText(label);
514:                return jm;
515:            }
516:
517:            /**
518:             * a hook which permits applications to change the text on the "About" splash screen
519:             */
520:            public static void setSplashScreenText(String text) {
521:                if (aboutAction == null)
522:                    aboutAction = new AboutAction();
523:                aboutAction.setSplashScreenText(text);
524:            }
525:
526:            class UndoListener implements  ChangeListener {
527:                private DAVEditor editor;
528:
529:                UndoListener() {
530:                }
531:
532:                UndoListener(DAVEditor editor) {
533:                    setEditor(editor);
534:                }
535:
536:                void setEditor(DAVEditor editor) {
537:                    disconnect();
538:                    this .editor = editor;
539:                    if (editor != null) {
540:                        DAVEditorUndoManager undoer = editor.getUndoManager();
541:                        if (undoer != null)
542:                            undoer.addChangeListener(this );
543:                    }
544:                }
545:
546:                DAVEditor getEditor() {
547:                    return this .editor;
548:                }
549:
550:                void disconnect() {
551:                    if (editor != null)
552:                        editor.getUndoManager().removeChangeListener(this );
553:                }
554:
555:                public void stateChanged(ChangeEvent cheese) {
556:                    resetUndoItems();
557:                }
558:            }
559:
560:        }
561:
562:        /* $Log: ExplorerMenuBar.java,v $
563:         /* Revision 1.37  2001/02/06 23:15:53  smulloni
564:         /* added syntax highlight and selectAll actions to the menu
565:         /*
566:         /* Revision 1.36  2001/02/06 22:13:40  smulloni
567:         /* first more-or-less working version of syntax highlighting, with customization.
568:         /*
569:         /* Revision 1.35  2001/01/05 08:01:12  smulloni
570:         /* changes to the connection gui for the Explorer; added depth configurability to
571:         /* propfind in the jpython test script; added an experimental "allprop" system
572:         /* property which affects the propfind query type
573:         /*
574:         /* Revision 1.34  2000/12/21 18:53:13  smulloni
575:         /* cosmetic improvements.
576:         /*
577:         /* Revision 1.33  2000/12/19 22:36:05  smulloni
578:         /* adjustments to preamble.
579:         /*
580:         /* Revision 1.32  2000/12/19 20:17:54  smulloni
581:         /* added an "About..." menu item.
582:         /*
583:         /* Revision 1.31  2000/12/19 19:22:22  smulloni
584:         /* some tweaks: ExitAction now cleans up the app's buffers.  The app now does
585:         /* not resize every time a buffer is added or removed.
586:         /*
587:         /* Revision 1.30  2000/12/15 23:22:07  smulloni
588:         /* added word wrap to text editor.
589:         /*
590:         /* Revision 1.29  2000/12/14 23:09:17  smulloni
591:         /* fixes to search and replace; partial fix to adding custom properties bug.
592:         /*
593:         /* Revision 1.28  2000/12/14 06:36:26  smulloni
594:         /* changes to search and replace in text editor.
595:         /*
596:         /* Revision 1.27  2000/12/08 05:50:30  smulloni
597:         /* fixed MessageCatalogEditor.  The spi features are now a special build option,
598:         /* and editors are loaded through reflection.
599:         /*
600:         /* Revision 1.26  2000/12/03 23:53:26  smulloni
601:         /* added license and copyright preamble to java files.
602:         /*
603:         /* Revision 1.25  2000/12/03 20:40:05  smulloni
604:         /* reconciling the minos.skunk.org cvs repository with sourceforge.
605:         /*
606:         /* Revision 1.25  2000/12/01 22:54:13  smullyan
607:         /* added undo and basic editing functionality to text editor; defined some
608:         /* keybindings in an inflexible way that will have to be changed soon.
609:         /*
610:         /* Revision 1.24  2000/12/01 16:25:52  smullyan
611:         /* improvements to look and feel; fixed NPE in DAVFile; new actions for text
612:         /* editor
613:         /*
614:         /* Revision 1.23  2000/11/29 23:16:04  smullyan
615:         /* adding first rough cut of search capability to the text editor.  View
616:         /* is being updated to allow components to be docked into the status bar.
617:         /*
618:         /* Revision 1.22  2000/11/28 00:01:38  smullyan
619:         /* added a status bar/minibuffer, with a location field showing the current line and
620:         /* column number (for the SimpleTextEditor and kin only).
621:         /*
622:         /* Revision 1.21  2000/11/23 04:37:32  smullyan
623:         /* editor and explorer now synch their files using the StateMonitor, which has
624:         /* been improved significantly
625:         /*
626:         /* Revision 1.20  2000/11/22 00:11:27  smullyan
627:         /* editor now locks and unlocks, more or less appropriately.
628:         /*
629:         /* Revision 1.19  2000/11/20 23:30:20  smullyan
630:         /* more editor integration work.
631:         /*
632:         /* Revision 1.18  2000/11/18 04:36:04  smullyan
633:         /* work on StateMonitor and related functionality.
634:         /*
635:         /* Revision 1.17  2000/11/17 20:25:05  smullyan
636:         /* new SaveAction; a StateMonitor being added to handle application state.
637:         /*
638:         /* Revision 1.16  2000/11/16 20:45:18  smullyan
639:         /* the start of editor integration.
640:         /*
641:         /* Revision 1.15  2000/11/10 22:40:06  smullyan
642:         /* added icon to table for resource type; fixes to copy and move; disabling of
643:         /* menu items that are inappropriate.
644:         /*
645:         /* Revision 1.14  2000/11/09 23:34:57  smullyan
646:         /* log added to every Java file, with the help of python.  Lock stealing
647:         /* implemented, and treatment of locks made more robust.
648:         /* */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.