2 * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
\r
4 * The program is provided "as is" without any warranty express or
\r
5 * implied, including the warranty of non-infringement and the implied
\r
6 * warranties of merchantibility and fitness for a particular purpose.
\r
7 * IBM will not be liable for any damages suffered by you as a result
\r
8 * of using the Program. In no event will IBM be liable for any
\r
9 * special, indirect or consequential damages or lost profits even if
\r
10 * IBM has been advised of the possibility of their occurrence. IBM
\r
11 * will not be liable for any third party claims against you.
\r
13 package com.ibm.richtext.uiimpl;
\r
15 import java.awt.Window;
\r
16 import java.awt.event.WindowAdapter;
\r
17 import java.awt.event.WindowEvent;
\r
19 import com.ibm.richtext.textpanel.MTextPanel;
\r
20 import com.ibm.richtext.uiimpl.resources.MenuData;
\r
22 public final class DialogItem extends CommandMenuItem {
\r
24 static final String COPYRIGHT =
\r
25 "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
\r
26 public static abstract class DialogFactory {
\r
28 public abstract Window createDialog(MTextPanel textPanel);
\r
31 private DialogFactory fDialogFactory;
\r
32 private Window fDialog = null;
\r
34 public DialogItem(MenuData menuData,
\r
35 DialogFactory dialogFactory) {
\r
37 super(menuData, true);
\r
38 fDialogFactory = dialogFactory;
\r
41 protected void textPanelChanged() {
\r
45 protected boolean isEnabled() {
\r
47 // should never get called...
\r
51 public boolean respondsToEventType(int type) {
\r
56 protected void performAction() {
\r
58 if (fDialog == null) {
\r
59 MTextPanel panel = getTextPanel();
\r
60 if (panel != null) {
\r
61 fDialog = fDialogFactory.createDialog(panel);
\r
62 fDialog.addWindowListener(new WindowAdapter() {
\r
63 public void windowClosed(WindowEvent e) {
\r