diff options
author | slewis | 2007-06-26 20:10:38 +0000 |
---|---|---|
committer | slewis | 2007-06-26 20:10:38 +0000 |
commit | 6addf99f451a3cb9d1fc705d129c4f0225659878 (patch) | |
tree | 1f57bdea4a34cb895c4c266b53fd54b50242ada9 /examples | |
parent | 84463bc3578aea1d6f21a850bc16618a69b0961a (diff) | |
download | org.eclipse.ecf-6addf99f451a3cb9d1fc705d129c4f0225659878.tar.gz org.eclipse.ecf-6addf99f451a3cb9d1fc705d129c4f0225659878.tar.xz org.eclipse.ecf-6addf99f451a3cb9d1fc705d129c4f0225659878.zip |
Update to make dependency on org.eclipse.ui.editors.text optional in org.eclipse.ecf.presence.ui and org.eclipse.ecf.ui plugins. This allows them to be used in small environments (e.g. RCP).
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java index 685de62a7..82f72f4bb 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java +++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java @@ -190,14 +190,8 @@ public class ChatComposite extends Composite { sf.setOrientation(SWT.VERTICAL); tableView = table; - SourceViewer result = new SourceViewer(sf, null, null, true, - SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI | SWT.H_SCROLL - | SWT.READ_ONLY); - result.configure(new TextSourceViewerConfiguration(EditorsUI - .getPreferenceStore())); - result.setDocument(new Document()); - - textoutput = result.getTextWidget(); + + textoutput = createStyledTextWidget(sf); textoutput.setLayoutData(new GridData(SWT.FILL)); String fontName = ClientPlugin.getDefault().getPluginPreferences() .getString(ClientPlugin.PREF_CHAT_FONT); @@ -272,6 +266,32 @@ public class ChatComposite extends Composite { initializeDropTargets(); } + private StyledText createStyledTextWidget(Composite parent) { + try { + SourceViewer result = new SourceViewer(parent, null, null, + true, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI + | SWT.READ_ONLY); + result.configure(new TextSourceViewerConfiguration(EditorsUI + .getPreferenceStore())); + result.setDocument(new Document()); + return result.getTextWidget(); + } catch (Exception e) { + ClientPlugin + .getDefault() + .getLog() + .log( + new Status( + IStatus.WARNING, + ClientPlugin.PLUGIN_ID, + IStatus.WARNING, + "Source viewer not available. Hyperlinking will be disabled.", + e)); + return new StyledText(parent, SWT.BORDER | SWT.WRAP + | SWT.V_SCROLL | SWT.MULTI | SWT.READ_ONLY); + } + } + + public void appendText(ChatLine text) { if (text == null || textoutput == null || textoutput.isDisposed()) { return; |