1
2
3
4
5
6
7
8
9
10
11
12 package sk.uniba.euromath.editor.wizards.document;
13 import java.util.Set;
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.swt.widgets.Control;
16 import sk.uniba.euromath.document.NamespaceManager;
17 import sk.uniba.euromath.editor.lang.Messages;
18 import sk.uniba.euromath.editor.widgets.IModifyListener;
19 import sk.uniba.euromath.editor.widgets.NewPrefixesQuery;
20 import sk.uniba.euromath.editor.widgets.ValidityMessages;
21 import sk.uniba.euromath.editor.wizards.BaseWizardPage;
22 /***
23 * Queries for new prefixes.
24 * @author Martin Vysny
25 */
26 public class NewPrefixesQueryWizardPage extends BaseWizardPage {
27 /***
28 * The widget. Do not modify.
29 */
30 public NewPrefixesQuery npq;
31 /***
32 * Constructor.
33 * @param namespaces get prefixes for these namespaces.
34 * @param nsManager current namespace manager. New prefixes are not
35 * registered here, new manager is created instead.
36 */
37 public NewPrefixesQueryWizardPage(Set<String> namespaces,
38 NamespaceManager nsManager) {
39 super(
40 "NewPrefixesQuery", Messages.getString("SELECT_NEW_PREFIXES"), null);
41 this.namespaces = namespaces;
42 this.nsManager = nsManager;
43 }
44 /***
45 * Get prefixes for these namespaces.
46 */
47 protected final Set<String> namespaces;
48 /***
49 * Current namespace manager. New prefixes are not registered here, new
50 * manager is created instead.
51 */
52 protected final NamespaceManager nsManager;
53
54
55
56
57 @Override
58 public Control handleCreateControl(Composite parent) {
59 npq = new NewPrefixesQuery(parent, namespaces, nsManager);
60 npq.addModifyListener(new IModifyListener() {
61 public void dataModified() {
62 validatePage();
63 }
64 });
65 validatePage();
66 return npq.getComposite();
67 }
68 /***
69 * Validates the page and shows appropriate error message if necessary.
70 */
71 protected void validatePage() {
72 npq.getPrefixes();
73 ValidityMessages messages = npq.getMessages();
74 setMessages(messages);
75 }
76
77
78
79
80 @Override
81 public void handleDispose() {
82
83 }
84 }