diff options
author | Wim Jongman | 2012-12-12 22:38:57 +0000 |
---|---|---|
committer | Wim Jongman | 2012-12-12 22:38:57 +0000 |
commit | 8731000cd7e124074db754340fcd84ab0b703e86 (patch) | |
tree | 3202045dca693bd45d5efd7677e976dfadcdd09f | |
parent | 41dec86b52fe10c473010a85f2d2c2bb361380c4 (diff) | |
download | org.eclipse.ecf-8731000cd7e124074db754340fcd84ab0b703e86.tar.gz org.eclipse.ecf-8731000cd7e124074db754340fcd84ab0b703e86.tar.xz org.eclipse.ecf-8731000cd7e124074db754340fcd84ab0b703e86.zip |
bug 368052: Chats view should make its intent clear
https://bugs.eclipse.org/bugs/show_bug.cgi?id=368052
-rw-r--r-- | framework/bundles/org.eclipse.ecf.presence.ui/plugin.xml | 26 | ||||
-rw-r--r-- | framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/chatroom/ChatRoomManagerView.java | 67 |
2 files changed, 67 insertions, 26 deletions
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/plugin.xml b/framework/bundles/org.eclipse.ecf.presence.ui/plugin.xml index 748ccff55..dcf11343f 100644 --- a/framework/bundles/org.eclipse.ecf.presence.ui/plugin.xml +++ b/framework/bundles/org.eclipse.ecf.presence.ui/plugin.xml @@ -122,32 +122,6 @@ </perspectiveExtension> </extension> - <extension - point="org.eclipse.ui.perspectiveExtensions"> - <perspectiveExtension - targetID="org.eclipse.ecf.ui.perspective.communications"> - <!-- - <view - id="org.eclipse.ecf.presence.ui.MultiRosterView" - relationship="stack" - relative="org.eclipse.ui.views.ResourceNavigator" - visible="true"> - </view> - <view - id="org.eclipse.ecf.presence.ui.chatroom.ChatRoomManagerView" - relationship="stack" - relative="org.eclipse.ui.views.ProblemView" - visible="true"> - </view> - <view - id="org.eclipse.ecf.presence.ui.MessagesView" - relationship="stack" - relative="org.eclipse.ui.views.ProblemView" - visible="true"> - </view> - --> - </perspectiveExtension> - </extension> <extension point="org.eclipse.ui.commands"> <command 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 c1e49cea7..5d9a97b8a 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 @@ -29,6 +29,7 @@ import org.eclipse.ecf.core.user.IUser; import org.eclipse.ecf.core.util.ECFException; import org.eclipse.ecf.internal.presence.ui.*; import org.eclipse.ecf.internal.presence.ui.preferences.PreferenceConstants; +import org.eclipse.ecf.internal.ui.actions.SelectProviderAction; import org.eclipse.ecf.presence.*; import org.eclipse.ecf.presence.chatroom.*; import org.eclipse.ecf.presence.im.IChatID; @@ -55,6 +56,8 @@ import org.eclipse.ui.part.ViewPart; import org.eclipse.ui.progress.IWorkbenchSiteProgressService; public class ChatRoomManagerView extends ViewPart implements IChatRoomInvitationListener { + public ChatRoomManagerView() { + } private static final String ATSIGN = "@"; //$NON-NLS-1$ @@ -106,6 +109,10 @@ public class ChatRoomManagerView extends ViewPart implements IChatRoomInvitation private String hostName = Messages.ChatRoomManagerView_DEFAULT_HOST; + private CTabItem infoTab; + + private boolean fClearInfoTab = true; + class ChatRoomTab { private SashForm fullChat; @@ -444,10 +451,14 @@ public class ChatRoomManagerView extends ViewPart implements IChatRoomInvitation public void createPartControl(Composite parent) { Composite rootComposite = new Composite(parent, SWT.NONE); rootComposite.setLayout(new FillLayout()); + boolean useTraditionalTabFolder = PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS); rootTabFolder = new CTabFolder(rootComposite, SWT.NORMAL | SWT.CLOSE); rootTabFolder.setUnselectedCloseVisible(false); rootTabFolder.setSimple(useTraditionalTabFolder); + + populateInfoTab(getInfoTabControl(SWT.NONE, "Info", true)); + PlatformUI.getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS) && !rootTabFolder.isDisposed()) { @@ -464,6 +475,53 @@ public class ChatRoomManagerView extends ViewPart implements IChatRoomInvitation }); } + /** + * This enables IM providers to provide additional information about the provider by asking the creation of a separate information tab. This information is displayed in a separate info tab. + * + * @param style with additional information about the provider + * @param title + * @param clearInfoTab set to true if the tab must be cleared when population of the view begins. + * @return the Composite to draw on + */ + public Composite getInfoTabControl(int style, String title, boolean clearInfoTab) { + // dispose old tab + if (infoTab != null) + infoTab.dispose(); + + CTabItem tab = new CTabItem(rootTabFolder, style); + tab.setText(title); + + // assign new tab + this.infoTab = tab; + this.fClearInfoTab = clearInfoTab; + + Composite parent = new Composite(rootTabFolder, SWT.NONE); + parent.setLayout(new FillLayout()); + tab.setControl(parent); + + rootTabFolder.setSelection(tab); + + return parent; + } + + /** + * Creates a tab with view information. This view does nothing when it is opened manually. This tab is used to provide that information. + */ + private void populateInfoTab(Composite parent) { + + Link link = new Link(parent, SWT.NONE); + link.setText("\n This view is not intended to be opened as a standalone view. Please select one of the <a>IM Providers</a> to open a populated view."); + link.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + SelectProviderAction action = new SelectProviderAction(); + action.init(ChatRoomManagerView.this.getSite().getWorkbenchWindow()); + action.run(null); + + } + }); + + } + private boolean closeTabItem(CTabItem tabItem) { ChatRoom chatRoom = findChatRoomForTabItem(tabItem); if (chatRoom == null) { @@ -537,6 +595,14 @@ public class ChatRoomManagerView extends ViewPart implements IChatRoomInvitation } public void initializeWithManager(String localUserName1, String hostName1, final IChatRoomContainer rootChatRoomContainer, final IChatRoomCommandListener commandListener1, final IChatRoomViewCloseListener closeListener) { + + // We get populated, remove the info tab if requested + if (infoTab != null && fClearInfoTab && !(infoTab.isDisposed())) { + infoTab.getControl().dispose(); + infoTab.dispose(); + infoTab = null; + } + ChatRoomManagerView.this.localUserName = (localUserName1 == null) ? Messages.ChatRoomManagerView_DEFAULT_USER : localUserName1; ChatRoomManagerView.this.hostName = (hostName1 == null) ? Messages.ChatRoomManagerView_DEFAULT_HOST : hostName1; ChatRoomManagerView.this.rootCloseListener = closeListener; @@ -1487,6 +1553,7 @@ public class ChatRoomManagerView extends ViewPart implements IChatRoomInvitation outputPaste.setToolTipText(Messages.ChatRoomManagerView_PASTE_TOOLTIP); outputPaste.setAccelerator(SWT.CTRL | 'V'); outputPaste.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); + } private void fillContextMenu(IMenuManager manager) { |