Lines 29-34
Link Here
|
29 |
import org.eclipse.ecf.example.collab.share.User; |
29 |
import org.eclipse.ecf.example.collab.share.User; |
30 |
import org.eclipse.ecf.example.collab.share.io.FileTransferParams; |
30 |
import org.eclipse.ecf.example.collab.share.io.FileTransferParams; |
31 |
import org.eclipse.ecf.internal.example.collab.ClientPlugin; |
31 |
import org.eclipse.ecf.internal.example.collab.ClientPlugin; |
|
|
32 |
import org.eclipse.ecf.presence.ui.chatroom.MessageRenderer; |
33 |
import org.eclipse.ecf.ui.SharedImages; |
32 |
import org.eclipse.ecf.ui.screencapture.IImageSender; |
34 |
import org.eclipse.ecf.ui.screencapture.IImageSender; |
33 |
import org.eclipse.ecf.ui.screencapture.ScreenCaptureJob; |
35 |
import org.eclipse.ecf.ui.screencapture.ScreenCaptureJob; |
34 |
import org.eclipse.jface.action.Action; |
36 |
import org.eclipse.jface.action.Action; |
Lines 40-47
Link Here
|
40 |
import org.eclipse.jface.dialogs.InputDialog; |
42 |
import org.eclipse.jface.dialogs.InputDialog; |
41 |
import org.eclipse.jface.dialogs.MessageDialog; |
43 |
import org.eclipse.jface.dialogs.MessageDialog; |
42 |
import org.eclipse.jface.preference.IPreferenceStore; |
44 |
import org.eclipse.jface.preference.IPreferenceStore; |
43 |
import org.eclipse.jface.resource.FontRegistry; |
45 |
//import org.eclipse.jface.resource.FontRegistry; |
44 |
import org.eclipse.jface.resource.ImageDescriptor; |
46 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
|
47 |
import org.eclipse.jface.resource.JFaceResources; |
45 |
import org.eclipse.jface.text.Document; |
48 |
import org.eclipse.jface.text.Document; |
46 |
import org.eclipse.jface.text.ITextSelection; |
49 |
import org.eclipse.jface.text.ITextSelection; |
47 |
import org.eclipse.jface.text.TextSelection; |
50 |
import org.eclipse.jface.text.TextSelection; |
Lines 59-69
Link Here
|
59 |
import org.eclipse.jface.window.Window; |
62 |
import org.eclipse.jface.window.Window; |
60 |
import org.eclipse.osgi.util.NLS; |
63 |
import org.eclipse.osgi.util.NLS; |
61 |
import org.eclipse.swt.SWT; |
64 |
import org.eclipse.swt.SWT; |
62 |
import org.eclipse.swt.custom.SashForm; |
65 |
//import org.eclipse.swt.custom.SashForm; |
63 |
import org.eclipse.swt.custom.StyleRange; |
66 |
import org.eclipse.swt.custom.StyleRange; |
64 |
import org.eclipse.swt.custom.StyledText; |
67 |
import org.eclipse.swt.custom.StyledText; |
65 |
import org.eclipse.swt.events.DisposeEvent; |
68 |
//import org.eclipse.swt.events.DisposeEvent; |
66 |
import org.eclipse.swt.events.DisposeListener; |
69 |
//import org.eclipse.swt.events.DisposeListener; |
67 |
import org.eclipse.swt.events.FocusEvent; |
70 |
import org.eclipse.swt.events.FocusEvent; |
68 |
import org.eclipse.swt.events.FocusListener; |
71 |
import org.eclipse.swt.events.FocusListener; |
69 |
import org.eclipse.swt.events.KeyEvent; |
72 |
import org.eclipse.swt.events.KeyEvent; |
Lines 73-83
Link Here
|
73 |
import org.eclipse.swt.events.MouseEvent; |
76 |
import org.eclipse.swt.events.MouseEvent; |
74 |
import org.eclipse.swt.events.MouseListener; |
77 |
import org.eclipse.swt.events.MouseListener; |
75 |
import org.eclipse.swt.graphics.Color; |
78 |
import org.eclipse.swt.graphics.Color; |
76 |
import org.eclipse.swt.graphics.FontData; |
79 |
//import org.eclipse.swt.graphics.FontData; |
|
|
80 |
import org.eclipse.swt.graphics.FontMetrics; |
81 |
import org.eclipse.swt.graphics.GC; |
77 |
import org.eclipse.swt.graphics.Image; |
82 |
import org.eclipse.swt.graphics.Image; |
78 |
import org.eclipse.swt.graphics.ImageData; |
83 |
import org.eclipse.swt.graphics.ImageData; |
79 |
import org.eclipse.swt.layout.FillLayout; |
84 |
//import org.eclipse.swt.layout.FillLayout; |
80 |
import org.eclipse.swt.layout.GridData; |
85 |
import org.eclipse.swt.layout.GridData; |
|
|
86 |
import org.eclipse.swt.layout.GridLayout; |
81 |
import org.eclipse.swt.widgets.Composite; |
87 |
import org.eclipse.swt.widgets.Composite; |
82 |
import org.eclipse.swt.widgets.Control; |
88 |
import org.eclipse.swt.widgets.Control; |
83 |
import org.eclipse.swt.widgets.Display; |
89 |
import org.eclipse.swt.widgets.Display; |
Lines 94-109
Link Here
|
94 |
import org.eclipse.ui.dialogs.ISelectionStatusValidator; |
100 |
import org.eclipse.ui.dialogs.ISelectionStatusValidator; |
95 |
import org.eclipse.ui.editors.text.EditorsUI; |
101 |
import org.eclipse.ui.editors.text.EditorsUI; |
96 |
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; |
102 |
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; |
|
|
103 |
//import org.eclipse.ui.part.ViewPart; |
97 |
import org.eclipse.ui.views.IViewCategory; |
104 |
import org.eclipse.ui.views.IViewCategory; |
98 |
import org.eclipse.ui.views.IViewDescriptor; |
105 |
import org.eclipse.ui.views.IViewDescriptor; |
99 |
import org.eclipse.ui.views.IViewRegistry; |
106 |
import org.eclipse.ui.views.IViewRegistry; |
100 |
|
107 |
|
101 |
public class ChatComposite extends Composite { |
108 |
public class ChatComposite extends Composite { |
102 |
private static final String CHAT_OUTPUT_FONT = "ChatFont"; //$NON-NLS-1$ |
109 |
// private static final String CHAT_OUTPUT_FONT = "ChatFont"; //$NON-NLS-1$ |
103 |
final LineChatClientView view; |
110 |
final LineChatClientView view; |
104 |
private Color meColor = null; |
111 |
// private Color meColor = null; |
105 |
private Color otherColor = null; |
112 |
// private Color otherColor = null; |
106 |
private Color systemColor = null; |
113 |
// private Color systemColor = null; |
107 |
|
114 |
|
108 |
Action appShare = null; |
115 |
Action appShare = null; |
109 |
|
116 |
|
Lines 121-132
Link Here
|
121 |
|
128 |
|
122 |
Action showChatWindow; |
129 |
Action showChatWindow; |
123 |
|
130 |
|
124 |
protected final String TEXT_INPUT_INIT = MessageLoader.getString("LineChatClientView.textinputinit"); //$NON-NLS-1$ |
131 |
// protected final String TEXT_INPUT_INIT = MessageLoader.getString("LineChatClientView.textinputinit"); //$NON-NLS-1$ |
125 |
protected static final int DEFAULT_INPUT_HEIGHT = 25; |
132 |
protected static final int DEFAULT_INPUT_HEIGHT = 25; |
126 |
protected static final int DEFAULT_INPUT_SEPARATOR = 5; |
133 |
protected static final int DEFAULT_INPUT_SEPARATOR = 5; |
127 |
|
134 |
|
128 |
Text textinput = null; |
135 |
Text textinput = null; |
129 |
StyledText textoutput = null; |
136 |
StyledText textoutput = null; |
|
|
137 |
|
138 |
MessageRenderer messageRenderer = null; |
139 |
|
130 |
TableViewer tableView = null; |
140 |
TableViewer tableView = null; |
131 |
ChatDropTarget chatDropTarget = null; |
141 |
ChatDropTarget chatDropTarget = null; |
132 |
TreeDropTarget treeDropTarget = null; |
142 |
TreeDropTarget treeDropTarget = null; |
Lines 134-194
Link Here
|
134 |
ChatWindow chatWindow; |
144 |
ChatWindow chatWindow; |
135 |
boolean typing; |
145 |
boolean typing; |
136 |
|
146 |
|
137 |
ChatComposite(LineChatClientView view, Composite parent, TableViewer table, String initText) { |
147 |
User localUser; |
138 |
this(view, parent, table, initText, null); |
148 |
|
|
|
149 |
ChatComposite(LineChatClientView view, Composite parent, TableViewer table, User localUser, String initText) { |
150 |
this(view, parent, table, localUser, initText, null); |
139 |
} |
151 |
} |
140 |
|
152 |
|
141 |
ChatComposite(LineChatClientView view, Composite parent, TableViewer table, String initText, ChatWindow chatWindow) { |
153 |
ChatComposite(LineChatClientView view, Composite parent, TableViewer table, User localUser, String initText, ChatWindow chatWindow) { |
142 |
super(parent, SWT.NONE); |
154 |
super(parent, SWT.NONE); |
143 |
this.view = view; |
155 |
this.view = view; |
144 |
this.chatWindow = chatWindow; |
156 |
this.chatWindow = chatWindow; |
145 |
setLayout(new FillLayout()); |
157 |
this.localUser = localUser; |
146 |
meColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_ME_TEXT_COLOR)); |
158 |
//setLayout(new FillLayout()); |
147 |
otherColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_OTHER_TEXT_COLOR)); |
159 |
GridLayout layout = new GridLayout(); |
148 |
systemColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_SYSTEM_TEXT_COLOR)); |
160 |
layout.marginHeight=0; |
|
|
161 |
layout.marginWidth=0; |
162 |
layout.verticalSpacing=3; |
163 |
layout.horizontalSpacing=3; |
164 |
layout.marginTop=1; |
165 |
layout.marginBottom=0; |
166 |
layout.marginRight=1; |
167 |
setLayout(layout); |
168 |
// meColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_ME_TEXT_COLOR)); |
169 |
// otherColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_OTHER_TEXT_COLOR)); |
170 |
// systemColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_SYSTEM_TEXT_COLOR)); |
149 |
ClientPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(new ColorPropertyChangeListener()); |
171 |
ClientPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(new ColorPropertyChangeListener()); |
150 |
|
172 |
|
151 |
this.addDisposeListener(new DisposeListener() { |
173 |
// this.addDisposeListener(new DisposeListener() { |
152 |
|
174 |
// |
153 |
public void widgetDisposed(DisposeEvent e) { |
175 |
// public void widgetDisposed(DisposeEvent e) { |
154 |
if (meColor != null) { |
176 |
// if (meColor != null) { |
155 |
meColor.dispose(); |
177 |
// meColor.dispose(); |
156 |
} |
178 |
// } |
157 |
|
179 |
// |
158 |
if (otherColor != null) { |
180 |
// if (otherColor != null) { |
159 |
otherColor.dispose(); |
181 |
// otherColor.dispose(); |
160 |
} |
182 |
// } |
161 |
|
183 |
// |
162 |
if (systemColor != null) { |
184 |
// if (systemColor != null) { |
163 |
systemColor.dispose(); |
185 |
// systemColor.dispose(); |
164 |
} |
186 |
// } |
165 |
} |
187 |
// } |
166 |
|
188 |
// |
167 |
}); |
189 |
// }); |
168 |
final SashForm sf = new SashForm(this, SWT.NORMAL); |
190 |
|
169 |
sf.setLayout(new FillLayout()); |
191 |
//final SashForm sf = new SashForm(this, SWT.NORMAL); |
170 |
sf.setOrientation(SWT.VERTICAL); |
192 |
//sf.setLayout(new FillLayout()); |
|
|
193 |
//sf.setOrientation(SWT.VERTICAL); |
194 |
Composite sf = this; |
171 |
|
195 |
|
172 |
tableView = table; |
196 |
tableView = table; |
173 |
|
197 |
|
174 |
textoutput = createStyledTextWidget(sf); |
198 |
textoutput = createStyledTextWidget(sf); |
175 |
textoutput.setLayoutData(new GridData(SWT.FILL)); |
199 |
//textoutput.setLayoutData(new GridData(SWT.FILL)); |
176 |
final String fontName = ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_CHAT_FONT); |
200 |
textoutput.setLayoutData(new GridData(GridData.FILL_BOTH)); |
177 |
if (!(fontName == null) && !(fontName.equals(""))) { //$NON-NLS-1$ |
201 |
// final String fontName = ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_CHAT_FONT); |
178 |
final FontRegistry fr = ClientPlugin.getDefault().getFontRegistry(); |
202 |
// if (!(fontName == null) && !(fontName.equals(""))) { //$NON-NLS-1$ |
179 |
final FontData[] newFont = {new FontData(fontName)}; |
203 |
// final FontRegistry fr = ClientPlugin.getDefault().getFontRegistry(); |
180 |
|
204 |
// final FontData[] newFont = {new FontData(fontName)}; |
181 |
fr.put(CHAT_OUTPUT_FONT, newFont); |
205 |
// |
182 |
textoutput.setFont(fr.get(CHAT_OUTPUT_FONT)); |
206 |
// fr.put(CHAT_OUTPUT_FONT, newFont); |
183 |
} |
207 |
// textoutput.setFont(fr.get(CHAT_OUTPUT_FONT)); |
|
|
208 |
// } |
184 |
|
209 |
|
|
|
210 |
messageRenderer = new MessageRenderer(); |
211 |
|
185 |
ClientPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(new FontPropertyChangeListener()); |
212 |
ClientPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(new FontPropertyChangeListener()); |
186 |
|
213 |
|
187 |
textoutput.append(initText); |
214 |
String local = localUser.getNickname(); |
188 |
|
215 |
String output = messageRenderer.render(initText, null, local); |
189 |
textinput = new Text(sf, SWT.SINGLE | SWT.BORDER); |
216 |
StyleRange[] ranges = messageRenderer.getStyleRanges(); |
190 |
textinput.setText(TEXT_INPUT_INIT); |
217 |
int startRange = textoutput.getText().length(); |
191 |
textinput.setLayoutData(new GridData(SWT.FILL)); |
218 |
textoutput.append(output); |
|
|
219 |
if (ranges != null) { |
220 |
// set all ranges to start as message line starts |
221 |
for (int i = 0; i < ranges.length; i++) { |
222 |
ranges[i].start += startRange; |
223 |
} |
224 |
textoutput.replaceStyleRanges(startRange, output.length(), ranges); |
225 |
} |
226 |
|
227 |
//textinput = new Text(sf, SWT.SINGLE | SWT.BORDER); |
228 |
textinput = new Text(sf, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.WRAP); |
229 |
// textinput.setText(TEXT_INPUT_INIT); |
230 |
//textinput.setLayoutData(new GridData(SWT.FILL)); |
231 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL); |
232 |
GC gc = new GC(textinput); |
233 |
gc.setFont(JFaceResources.getDialogFont()); |
234 |
FontMetrics fontMetrics = gc.getFontMetrics(); |
235 |
gc.dispose(); |
236 |
gd.heightHint = fontMetrics.getHeight() * 2; |
237 |
textinput.setLayoutData(gd); |
192 |
|
238 |
|
193 |
textinput.selectAll(); |
239 |
textinput.selectAll(); |
194 |
textinput.addKeyListener(new KeyListener() { |
240 |
textinput.addKeyListener(new KeyListener() { |
Lines 202-211
Link Here
|
202 |
}); |
248 |
}); |
203 |
textinput.addFocusListener(new FocusListener() { |
249 |
textinput.addFocusListener(new FocusListener() { |
204 |
public void focusGained(FocusEvent e) { |
250 |
public void focusGained(FocusEvent e) { |
205 |
final String t = textinput.getText(); |
251 |
// final String t = textinput.getText(); |
206 |
if (t.equals(TEXT_INPUT_INIT)) { |
252 |
// if (t.equals(TEXT_INPUT_INIT)) { |
207 |
textinput.selectAll(); |
253 |
// textinput.selectAll(); |
208 |
} |
254 |
// } |
209 |
} |
255 |
} |
210 |
|
256 |
|
211 |
public void focusLost(FocusEvent e) { |
257 |
public void focusLost(FocusEvent e) { |
Lines 219-228
Link Here
|
219 |
} |
265 |
} |
220 |
|
266 |
|
221 |
public void mouseUp(MouseEvent e) { |
267 |
public void mouseUp(MouseEvent e) { |
222 |
final String t = textinput.getText(); |
268 |
// final String t = textinput.getText(); |
223 |
if (t.equals(TEXT_INPUT_INIT)) { |
269 |
// if (t.equals(TEXT_INPUT_INIT)) { |
224 |
textinput.selectAll(); |
270 |
// textinput.selectAll(); |
225 |
} |
271 |
// } |
226 |
} |
272 |
} |
227 |
}); |
273 |
}); |
228 |
textinput.addModifyListener(new ModifyListener() { |
274 |
textinput.addModifyListener(new ModifyListener() { |
Lines 236-242
Link Here
|
236 |
} |
282 |
} |
237 |
}); |
283 |
}); |
238 |
|
284 |
|
239 |
sf.setWeights(new int[] {90, 10}); |
285 |
//sf.setWeights(new int[] {90, 10}); |
|
|
286 |
|
240 |
// make actions |
287 |
// make actions |
241 |
makeActions(); |
288 |
makeActions(); |
242 |
hookContextMenu(); |
289 |
hookContextMenu(); |
Lines 265-296
Link Here
|
265 |
} |
312 |
} |
266 |
|
313 |
|
267 |
final User user = text.getOriginator(); |
314 |
final User user = text.getOriginator(); |
268 |
final StyleRange range = new StyleRange(); |
315 |
|
269 |
range.start = textoutput.getText().length(); |
316 |
String name = (user!=null)? user.getNickname() : null; |
270 |
if (user != null) { |
317 |
String local = localUser.getNickname(); |
271 |
String prefix = user.getNickname() + ": "; //$NON-NLS-1$ |
318 |
String output = messageRenderer.render(text.getText(), name, local); |
272 |
final String date = text.getDate(); |
319 |
StyleRange[] ranges = messageRenderer.getStyleRanges(); |
273 |
if (date != null && !date.equals("")) { //$NON-NLS-1$ |
320 |
|
274 |
prefix = date + ' ' + prefix; |
321 |
// final StyleRange range = new StyleRange(); |
275 |
} |
322 |
// range.start = textoutput.getText().length(); |
276 |
range.length = prefix.length(); |
323 |
// if (user != null) { |
277 |
range.foreground = user.equals(view.userdata) ? meColor : otherColor; |
324 |
// String prefix = user.getNickname() + ": "; //$NON-NLS-1$ |
278 |
textoutput.append(prefix); |
325 |
// final String date = text.getDate(); |
279 |
textoutput.setStyleRange(range); |
326 |
// if (date != null && !date.equals("")) { //$NON-NLS-1$ |
280 |
textoutput.append(text.getText()); |
327 |
// prefix = date + ' ' + prefix; |
281 |
} else { |
328 |
// } |
282 |
String content = text.getText(); |
329 |
// range.length = prefix.length(); |
283 |
final String date = text.getDate(); |
330 |
// range.foreground = user.equals(view.userdata) ? meColor : otherColor; |
284 |
if (date != null && !date.equals("")) { //$NON-NLS-1$ |
331 |
// textoutput.append(prefix); |
285 |
content = date + ' ' + content; |
332 |
// textoutput.setStyleRange(range); |
286 |
} |
333 |
// //textoutput.append(text.getText()); |
287 |
range.length = content.length(); |
334 |
// String content = text.getText(); |
288 |
range.foreground = otherColor; |
335 |
// int startLength = textoutput.getText().length(); |
289 |
textoutput.append(content); |
336 |
// hyperlinkRenderer.scan(content); |
|
|
337 |
// textoutput.append(content); |
338 |
// hyperlinkRenderer.setStyleRange(startLength, null); |
339 |
// } else { |
340 |
// String content = text.getText(); |
341 |
// final String date = text.getDate(); |
342 |
// if (date != null && !date.equals("")) { //$NON-NLS-1$ |
343 |
// content = date + ' ' + content; |
344 |
// } |
345 |
// range.length = content.length(); |
346 |
// range.foreground = otherColor; |
347 |
// |
348 |
// int startLength = textoutput.getText().length(); |
349 |
// hyperlinkRenderer.scan(content); |
350 |
// textoutput.append(content); |
351 |
// hyperlinkRenderer.setStyleRange(startLength, null); |
352 |
// } |
353 |
|
354 |
if (output == null) { |
355 |
return; |
290 |
} |
356 |
} |
291 |
|
357 |
|
|
|
358 |
int startRange = textoutput.getText().length(); |
359 |
|
292 |
if (!text.isNoCRLF()) { |
360 |
if (!text.isNoCRLF()) { |
293 |
textoutput.append(Text.DELIMITER); |
361 |
output = output+Text.DELIMITER; |
|
|
362 |
} |
363 |
|
364 |
textoutput.append(output); |
365 |
|
366 |
if (ranges != null) { |
367 |
|
368 |
// set all ranges to start as message line starts |
369 |
for (int i = 0; i < ranges.length; i++) { |
370 |
ranges[i].start += startRange; |
371 |
} |
372 |
textoutput.replaceStyleRanges(startRange, output.length(), ranges); |
294 |
} |
373 |
} |
295 |
|
374 |
|
296 |
// scroll to end |
375 |
// scroll to end |
Lines 635-641
Link Here
|
635 |
} |
714 |
} |
636 |
}; |
715 |
}; |
637 |
coBrowseURL.setText(MessageLoader.getString("LineChatClientView.contextmenu.cobrowse")); //$NON-NLS-1$ |
716 |
coBrowseURL.setText(MessageLoader.getString("LineChatClientView.contextmenu.cobrowse")); //$NON-NLS-1$ |
638 |
|
717 |
|
639 |
appShare = new Action() { |
718 |
appShare = new Action() { |
640 |
public void run() { |
719 |
public void run() { |
641 |
} |
720 |
} |
Lines 843-850
Link Here
|
843 |
} |
922 |
} |
844 |
|
923 |
|
845 |
protected void outputClear() { |
924 |
protected void outputClear() { |
846 |
if (MessageDialog.openConfirm(null, MessageLoader.getString("ChatComposite.DIALOG_CONFIRM_CLEAR_TITLE"), MessageLoader.getString("ChatComposite.DIALOG_CONFIRM_CLEAR_TEXT"))) //$NON-NLS-1$ //$NON-NLS-2$ |
925 |
if (MessageDialog.openConfirm(null, MessageLoader.getString("ChatComposite.DIALOG_CONFIRM_CLEAR_TITLE"), MessageLoader.getString("ChatComposite.DIALOG_CONFIRM_CLEAR_TEXT"))) { //$NON-NLS-1$ //$NON-NLS-2$ |
847 |
textoutput.setText(""); //$NON-NLS-1$ |
926 |
textoutput.setText(""); //$NON-NLS-1$ |
|
|
927 |
} |
848 |
} |
928 |
} |
849 |
|
929 |
|
850 |
protected void outputCopy() { |
930 |
protected void outputCopy() { |
Lines 1034-1047
Link Here
|
1034 |
treeDropTarget = new TreeDropTarget(view, tableView.getControl(), this); |
1114 |
treeDropTarget = new TreeDropTarget(view, tableView.getControl(), this); |
1035 |
} |
1115 |
} |
1036 |
|
1116 |
|
1037 |
private Color colorFromRGBString(String rgb) { |
1117 |
// private Color colorFromRGBString(String rgb) { |
1038 |
if (rgb == null || rgb.equals("")) { //$NON-NLS-1$ |
1118 |
// if (rgb == null || rgb.equals("")) { //$NON-NLS-1$ |
1039 |
return new Color(getShell().getDisplay(), 0, 0, 0); |
1119 |
// return new Color(getShell().getDisplay(), 0, 0, 0); |
1040 |
} else { |
1120 |
// } else { |
1041 |
final String[] vals = rgb.split(","); //$NON-NLS-1$ |
1121 |
// final String[] vals = rgb.split(","); //$NON-NLS-1$ |
1042 |
return new Color(getShell().getDisplay(), Integer.parseInt(vals[0]), Integer.parseInt(vals[1]), Integer.parseInt(vals[2])); |
1122 |
// return new Color(getShell().getDisplay(), Integer.parseInt(vals[0]), Integer.parseInt(vals[1]), Integer.parseInt(vals[2])); |
1043 |
} |
1123 |
// } |
1044 |
} |
1124 |
// } |
1045 |
|
1125 |
|
1046 |
private class ColorPropertyChangeListener implements org.eclipse.core.runtime.Preferences.IPropertyChangeListener { |
1126 |
private class ColorPropertyChangeListener implements org.eclipse.core.runtime.Preferences.IPropertyChangeListener { |
1047 |
|
1127 |
|
Lines 1051-1062
Link Here
|
1051 |
* @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent) |
1131 |
* @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent) |
1052 |
*/ |
1132 |
*/ |
1053 |
public void propertyChange(PropertyChangeEvent event) { |
1133 |
public void propertyChange(PropertyChangeEvent event) { |
1054 |
meColor.dispose(); |
1134 |
// meColor.dispose(); |
1055 |
otherColor.dispose(); |
1135 |
// otherColor.dispose(); |
1056 |
systemColor.dispose(); |
1136 |
// systemColor.dispose(); |
1057 |
meColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_ME_TEXT_COLOR)); |
1137 |
// meColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_ME_TEXT_COLOR)); |
1058 |
otherColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_OTHER_TEXT_COLOR)); |
1138 |
// otherColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_OTHER_TEXT_COLOR)); |
1059 |
systemColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_SYSTEM_TEXT_COLOR)); |
1139 |
// systemColor = colorFromRGBString(ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_SYSTEM_TEXT_COLOR)); |
1060 |
} |
1140 |
} |
1061 |
|
1141 |
|
1062 |
} |
1142 |
} |
Lines 1068-1083
Link Here
|
1068 |
* @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent) |
1148 |
* @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent) |
1069 |
*/ |
1149 |
*/ |
1070 |
public void propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) { |
1150 |
public void propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) { |
1071 |
if (event.getProperty().equals(ClientPlugin.PREF_CHAT_FONT)) { |
1151 |
// if (event.getProperty().equals(ClientPlugin.PREF_CHAT_FONT)) { |
1072 |
final String fontName = ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_CHAT_FONT); |
1152 |
// final String fontName = ClientPlugin.getDefault().getPluginPreferences().getString(ClientPlugin.PREF_CHAT_FONT); |
1073 |
if (!(fontName == null) && !(fontName.equals(""))) { //$NON-NLS-1$ |
1153 |
// if (!(fontName == null) && !(fontName.equals(""))) { //$NON-NLS-1$ |
1074 |
final FontRegistry fr = ClientPlugin.getDefault().getFontRegistry(); |
1154 |
// final FontRegistry fr = ClientPlugin.getDefault().getFontRegistry(); |
1075 |
final FontData[] newFont = {new FontData(fontName)}; |
1155 |
// final FontData[] newFont = {new FontData(fontName)}; |
1076 |
|
1156 |
// |
1077 |
fr.put(CHAT_OUTPUT_FONT, newFont); |
1157 |
// fr.put(CHAT_OUTPUT_FONT, newFont); |
1078 |
textoutput.setFont(fr.get(CHAT_OUTPUT_FONT)); |
1158 |
// textoutput.setFont(fr.get(CHAT_OUTPUT_FONT)); |
1079 |
} |
1159 |
// } |
1080 |
} |
1160 |
// } |
1081 |
} |
1161 |
} |
1082 |
|
1162 |
|
1083 |
} |
1163 |
} |