0
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
package com.nokia.s60tools.apiquery.shared.ui.dialogs;
|
|
20 |
|
|
21 |
import org.eclipse.swt.widgets.MessageBox;
|
|
22 |
import org.eclipse.swt.widgets.Shell;
|
|
23 |
|
|
24 |
import com.nokia.s60tools.apiquery.shared.common.ProductInfoRegistry;
|
|
25 |
import com.nokia.s60tools.apiquery.shared.plugin.APIQueryPlugin;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* This class wraps the MessageBox in order to
|
|
29 |
* enhance it with product name, and run it in
|
|
30 |
* AppDep plugin's active shell context.
|
|
31 |
*
|
|
32 |
* @see org.eclipse.swt.widgets.MessageBox
|
|
33 |
*/
|
|
34 |
public class APIQueryMessageBox {
|
|
35 |
|
|
36 |
MessageBox msgBox;
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Constructor.
|
|
40 |
* @param message User visible message.
|
|
41 |
* @param style Style bits.
|
|
42 |
*/
|
|
43 |
public APIQueryMessageBox(String message, int style){
|
|
44 |
Shell sh = APIQueryPlugin.getCurrentlyActiveWbWindowShell();
|
|
45 |
msgBox = new MessageBox(sh, style);
|
|
46 |
msgBox.setMessage(message);
|
|
47 |
msgBox.setText(ProductInfoRegistry.getProductName());
|
|
48 |
}
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Constructor.
|
|
52 |
* @param sh Parent shell for the new instance.
|
|
53 |
* @param message User visible message.
|
|
54 |
* @param style Style bits.
|
|
55 |
*/
|
|
56 |
public APIQueryMessageBox(Shell sh, String message, int style){
|
|
57 |
msgBox = new MessageBox(sh, style);
|
|
58 |
msgBox.setMessage(message);
|
|
59 |
msgBox.setText(ProductInfoRegistry.getProductName());
|
|
60 |
}
|
|
61 |
|
|
62 |
/* (non-Javadoc)
|
|
63 |
* @see java.lang.Object#equals(java.lang.Object)
|
|
64 |
*/
|
|
65 |
public boolean equals(Object arg0) {
|
|
66 |
return msgBox.equals(arg0);
|
|
67 |
}
|
|
68 |
|
|
69 |
/* (non-Javadoc)
|
|
70 |
* @see org.eclipse.swt.widgets.MessageBox#getMessage()
|
|
71 |
*/
|
|
72 |
public String getMessage() {
|
|
73 |
return msgBox.getMessage();
|
|
74 |
}
|
|
75 |
|
|
76 |
/* (non-Javadoc)
|
|
77 |
* @see org.eclipse.swt.widgets.Dialog#getParent()
|
|
78 |
*/
|
|
79 |
public Shell getParent() {
|
|
80 |
return msgBox.getParent();
|
|
81 |
}
|
|
82 |
|
|
83 |
/* (non-Javadoc)
|
|
84 |
* @see org.eclipse.swt.widgets.Dialog#getStyle()
|
|
85 |
*/
|
|
86 |
public int getStyle() {
|
|
87 |
return msgBox.getStyle();
|
|
88 |
}
|
|
89 |
|
|
90 |
/* (non-Javadoc)
|
|
91 |
* @see org.eclipse.swt.widgets.Dialog#getText()
|
|
92 |
*/
|
|
93 |
public String getText() {
|
|
94 |
return msgBox.getText();
|
|
95 |
}
|
|
96 |
|
|
97 |
/* (non-Javadoc)
|
|
98 |
* @see java.lang.Object#hashCode()
|
|
99 |
*/
|
|
100 |
public int hashCode() {
|
|
101 |
return msgBox.hashCode();
|
|
102 |
}
|
|
103 |
|
|
104 |
/* (non-Javadoc)
|
|
105 |
* @see org.eclipse.swt.widgets.MessageBox#setMessage(java.lang.String)
|
|
106 |
*/
|
|
107 |
public void setMessage(String string) {
|
|
108 |
msgBox.setMessage(string);
|
|
109 |
}
|
|
110 |
|
|
111 |
/* (non-Javadoc)
|
|
112 |
* @see org.eclipse.swt.widgets.Dialog#setText(java.lang.String)
|
|
113 |
*/
|
|
114 |
public void setText(String string) {
|
|
115 |
msgBox.setText(string);
|
|
116 |
}
|
|
117 |
|
|
118 |
/* (non-Javadoc)
|
|
119 |
* @see java.lang.Object#toString()
|
|
120 |
*/
|
|
121 |
public String toString() {
|
|
122 |
return msgBox.toString();
|
|
123 |
}
|
|
124 |
|
|
125 |
/* (non-Javadoc)
|
|
126 |
* @see org.eclipse.swt.widgets.MessageBox#open()
|
|
127 |
*/
|
|
128 |
public int open() {
|
|
129 |
return msgBox.open();
|
|
130 |
}
|
|
131 |
|
|
132 |
}
|