diff options
author | slewis | 2007-07-26 20:43:14 +0000 |
---|---|---|
committer | slewis | 2007-07-26 20:43:14 +0000 |
commit | 52f70ff2030f4363bd4552426775ee687909f6c8 (patch) | |
tree | 6b08cf1c159688af43ba2542783485e373d74ab4 /framework/bundles/org.eclipse.ecf.presence.ui | |
parent | 3a1f85d759e565995e3a9e571a177c8debd89598 (diff) | |
download | org.eclipse.ecf-52f70ff2030f4363bd4552426775ee687909f6c8.tar.gz org.eclipse.ecf-52f70ff2030f4363bd4552426775ee687909f6c8.tar.xz org.eclipse.ecf-52f70ff2030f4363bd4552426775ee687909f6c8.zip |
Additions to ChatRoomManagerView to support see the root channel tab as highlighted if system text is output to it.
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=192762
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.presence.ui')
-rw-r--r-- | framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/chatroom/ChatRoomManagerView.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/chatroom/ChatRoomManagerView.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/chatroom/ChatRoomManagerView.java index 4d82599be..d1af75bfe 100644 --- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/chatroom/ChatRoomManagerView.java +++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/chatroom/ChatRoomManagerView.java @@ -248,8 +248,55 @@ public class ChatRoomManagerView extends ViewPart implements if (withParticipants) { hookParticipantsContextMenu(); } + + StyledText st = getOutputText(); + if (st != null) { + ScrollBar vsb = st.getVerticalBar(); + if (vsb != null) { + vsb.addSelectionListener(scrollSelectionListener); + vsb.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + StyledText st = getOutputText(); + if (st != null) { + ScrollBar vsb = st.getVerticalBar(); + if (vsb != null) vsb.removeSelectionListener(scrollSelectionListener); + } + }}); + } + } + + } + + private SelectionListener scrollSelectionListener = new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + } + + public void widgetSelected(SelectionEvent e) { + if (shouldScrollToEnd(getOutputText())) { + makeTabItemNormal(); + } + } + + }; + + protected void makeTabItemBold() { + changeTabItem(true); } + protected void makeTabItemNormal() { + changeTabItem(false); + } + + protected void changeTabItem(boolean bold) { + CTabItem item = tabItem; + Font oldFont = item.getFont(); + FontData[] fd = oldFont.getFontData(); + item.setFont(new Font(oldFont.getDevice(), fd[0].getName(), fd[0] + .getHeight(), (bold) ? SWT.BOLD : SWT.NORMAL)); + } + + private StyledText createStyledTextWidget(Composite parent) { try { SourceViewer result = new SourceViewer(parent, null, null, @@ -821,6 +868,7 @@ public class ChatRoomManagerView extends ViewPart implements itemSelected = (CTabItem) e.item; if (itemSelected == chatRoomTab.tabItem) makeTabItemNormal(); + if (itemSelected == rootChannelTab.tabItem) rootChannelTab.makeTabItemNormal(); } }); @@ -1209,6 +1257,7 @@ public class ChatRoomManagerView extends ViewPart implements return; appendText(getRootTextOutput(), new ChatLine(messageBody, new ChatRoomParticipant(fromID))); + if (rootChannelTab != null) rootChannelTab.makeTabItemBold(); } }); } |