diff options
author | slewis | 2007-11-03 20:12:07 +0000 |
---|---|---|
committer | slewis | 2007-11-03 20:12:07 +0000 |
commit | cca653ce95f28362ec541ace98c830e03e0d9316 (patch) | |
tree | 3d886181017c556de14789df3497a955e11ec12b /framework/bundles/org.eclipse.ecf.presence.collab.ui | |
parent | e0cb38e6311e1ae0ebdac77c899edb96521b863d (diff) | |
download | org.eclipse.ecf-cca653ce95f28362ec541ace98c830e03e0d9316.tar.gz org.eclipse.ecf-cca653ce95f28362ec541ace98c830e03e0d9316.tar.xz org.eclipse.ecf-cca653ce95f28362ec541ace98c830e03e0d9316.zip |
Added console stack sharing
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.presence.collab.ui')
12 files changed, 156 insertions, 223 deletions
diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/icons/console_view.gif b/framework/bundles/org.eclipse.ecf.presence.collab.ui/icons/console_view.gif Binary files differnew file mode 100644 index 000000000..a598f6082 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/icons/console_view.gif diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/plugin.xml b/framework/bundles/org.eclipse.ecf.presence.collab.ui/plugin.xml index 07eabd58c..2f056d716 100644 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/plugin.xml +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/plugin.xml @@ -35,13 +35,6 @@ id="org.eclipse.ecf.presence.collab.ui.dynamic5"> </dynamic> </menuContribution> - <menuContribution - locationURI="popup:org.eclipse.ecf.presence.ui.MultiRosterView?before=additions"> - <dynamic - class="org.eclipse.ecf.presence.ui.menu.NoopRosterMenuContributionItem" - id="org.eclipse.ecf.presence.collab.ui.dynamic5"> - </dynamic> - </menuContribution> </extension> <extension point="org.eclipse.ecf.presence.ui.rosterViewerDropTarget"> @@ -60,7 +53,7 @@ <menuContribution locationURI="popup:org.eclipse.ecf.presence.ui.MultiRosterView?before=additions"> <dynamic - class="org.eclipse.ecf.presence.collab.ui.console.StackShareRosterEntryContributionItem" + class="org.eclipse.ecf.presence.collab.ui.console.ConsoleShareRosterEntryContributionItem" id="org.eclipse.ecf.presence.collab.ui.console"> </dynamic> </menuContribution> diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/Messages.java b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/Messages.java index b42fe8ad8..45c5a3a2d 100644 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/Messages.java +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/Messages.java @@ -49,15 +49,17 @@ public class Messages extends NLS { public static String ViewShareRosterContributionItem_VIEWSHARE_LISTENER_MENU_ADD_TEXT; public static String ViewShareRosterContributionItem_VIEWSHARE_LISTENER_MENU_REMOVE_TEXT; public static String ViewShareRosterEntryContributionItem_VIEWSHARE_MENU_TEXT; + public static String ConsoleShare_RosterContributionItem_CONSOLE_ICON; - public static String StackShare_STACKSHARE_ERROR_DIALOG_TITLE; - public static String StackShare_STACKSHARE_ERROR_DIALOG_MESSAGE; - public static String StackShare_EXCEPTION_WP_NOT_AVAILABLE; - public static String StackShare_EXCEPTION_WW_NOT_AVAILABLE; - public static String StackShare_STACK_TRACE_FROM_MESSAGE; - public static String StackShare_STACK_TRACE_CONTENT; - public static String StackShare_STACK_TRACE_FROM_TITLE; - public static String StackShare_STACKSHARE_ERROR_LOG_MESSAGE; + public static String ConsoleShare_STACKSHARE_ERROR_DIALOG_TITLE; + public static String ConsoleShare_STACKSHARE_ERROR_DIALOG_MESSAGE; + public static String ConsoleShare_EXCEPTION_WP_NOT_AVAILABLE; + public static String ConsoleShare_EXCEPTION_WW_NOT_AVAILABLE; + public static String ConsoleShare_STACK_TRACE_FROM_MESSAGE; + public static String ConsoleShare_STACK_TRACE_CONTENT; + public static String ConsoleShare_STACK_TRACE_FROM_TITLE; + public static String ConsoleShare_STACKSHARE_ERROR_LOG_MESSAGE; + public static String ConsoleShare_RosterEntryMenu; static { // initialize resource bundle diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/StartShareReceivers.java b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/StartShareReceivers.java index 3042109cd..b3596d04a 100644 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/StartShareReceivers.java +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/StartShareReceivers.java @@ -26,7 +26,7 @@ import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.start.IECFStart; import org.eclipse.ecf.core.util.ECFException; import org.eclipse.ecf.datashare.IChannelContainerAdapter; -import org.eclipse.ecf.presence.collab.ui.console.StackShare; +import org.eclipse.ecf.presence.collab.ui.console.ConsoleShare; import org.eclipse.ecf.presence.collab.ui.url.URLShare; import org.eclipse.ecf.presence.collab.ui.view.ViewShare; import org.eclipse.osgi.util.NLS; @@ -55,7 +55,7 @@ public class StartShareReceivers implements IECFStart { try { URLShare.addURLShare(containerID, cca); ViewShare.addViewShare(containerID, cca); - StackShare.addStackShare(containerID, cca); + ConsoleShare.addStackShare(containerID, cca); } catch (ECFException e) { Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, IStatus.WARNING, NLS.bind(Messages.StartURLShareAndViewShare_STATUS_URLSHARE_NOT_CREATED, container.getID()), null)); } @@ -63,7 +63,7 @@ public class StartShareReceivers implements IECFStart { // disconnected URLShare.removeURLShare(containerID); ViewShare.removeViewShare(containerID); - StackShare.removeStackShare(containerID); + ConsoleShare.removeStackShare(containerID); } else if (event instanceof IContainerDisposeEvent) { containerManager.removeListener(containerManagerListener); } diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/messages.properties b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/messages.properties index 6a7d9004a..4fda68cea 100644 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/messages.properties +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/internal/presence/collab/ui/messages.properties @@ -42,11 +42,13 @@ ViewShare_VIEWSHARE_ERROR_LOG_MESSAGE=Exception in openView ViewShare_VIEWSHARE_VIEW_REQUEST_DIALOG_TITLE=Send Show View Request ViewShare_VIEWSHARE_VIEW_REQUEST_DIALOG_MESSAGE=Select View to Show Remotely -StackShare_STACKSHARE_ERROR_DIALOG_TITLE=Error showing stack trace -StackShare_STACKSHARE_ERROR_DIALOG_MESSAGE=Error showing stack trace {0} -StackShare_EXCEPTION_WP_NOT_AVAILABLE=workbench page not available -StackShare_EXCEPTION_WW_NOT_AVAILABLE=workbench window not available -StackShare_STACK_TRACE_CONTENT=\n\n------Received Stack Trace from {0}------\n\n{1}\n\n------End Stack Trace from {0}------ -StackShare_STACK_TRACE_FROM_MESSAGE={0} has sent you a stack trace.\n\nTo be able to receive stack traces you must have the 'Java Stack Trace Console' open. -StackShare_STACK_TRACE_FROM_TITLE=Stack Trace from {0} -StackShare_STACKSHARE_ERROR_LOG_MESSAGE=Exception in stack trace presentation for console +ConsoleShare_STACKSHARE_ERROR_DIALOG_TITLE=Error showing text to console +ConsoleShare_STACKSHARE_ERROR_DIALOG_MESSAGE=Error showing text to console {0} +ConsoleShare_EXCEPTION_WP_NOT_AVAILABLE=workbench page not available +ConsoleShare_EXCEPTION_WW_NOT_AVAILABLE=workbench window not available +ConsoleShare_STACK_TRACE_CONTENT=\n\n------Received from {0}------\n\n{1}\n\n------End from {0}------ +ConsoleShare_STACK_TRACE_FROM_MESSAGE={0} has sent you text for the Console view.\n\nTo receive you must have the Java Stack Trace Console open. +ConsoleShare_STACK_TRACE_FROM_TITLE=Stack Trace From {0} +ConsoleShare_STACKSHARE_ERROR_LOG_MESSAGE=Exception in Console Presentation +ConsoleShare_RosterContributionItem_CONSOLE_ICON=icons/console_view.gif +ConsoleShare_RosterEntryMenu=Send Console Selection diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/AbstractCollabShare.java b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/AbstractCollabShare.java new file mode 100644 index 000000000..6ad5e4e0f --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/AbstractCollabShare.java @@ -0,0 +1,87 @@ +/**************************************************************************** + * Copyright (c) 2007 Composent, Inc. and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Composent, Inc. - initial API and implementation + *****************************************************************************/ + +package org.eclipse.ecf.presence.collab.ui; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.Map; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.ecf.core.identity.ID; +import org.eclipse.ecf.core.util.ECFException; +import org.eclipse.ecf.datashare.AbstractShare; +import org.eclipse.ecf.datashare.IChannelContainerAdapter; +import org.eclipse.ecf.internal.presence.collab.ui.Activator; +import org.eclipse.jface.dialogs.MessageDialog; + +/** + * + */ +public abstract class AbstractCollabShare extends AbstractShare { + + /** + * @param adapter + * @throws ECFException + */ + public AbstractCollabShare(IChannelContainerAdapter adapter) throws ECFException { + super(adapter); + } + + /** + * @param adapter + * @param channelID + * @throws ECFException + */ + public AbstractCollabShare(IChannelContainerAdapter adapter, ID channelID) throws ECFException { + super(adapter, channelID); + } + + /** + * @param adapter + * @param channelID + * @param options + * @throws ECFException + */ + public AbstractCollabShare(IChannelContainerAdapter adapter, ID channelID, Map options) throws ECFException { + super(adapter, channelID, options); + } + + protected byte[] serialize(Object o) throws Exception { + final ByteArrayOutputStream bos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(o); + return bos.toByteArray(); + } + + protected Object deserialize(byte[] bytes) throws Exception { + final ByteArrayInputStream bins = new ByteArrayInputStream(bytes); + final ObjectInputStream oins = new ObjectInputStream(bins); + return oins.readObject(); + } + + protected void logError(String exceptionString, Throwable e) { + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, exceptionString, e)); + + } + + protected void logError(IStatus status) { + Activator.getDefault().getLog().log(status); + } + + protected void showErrorToUser(String title, String message) { + MessageDialog.openError(null, title, message); + } + +} diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/StackShare.java b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/ConsoleShare.java index 59cd5afbd..ed4c05c6f 100644 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/StackShare.java +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/ConsoleShare.java @@ -11,21 +11,14 @@ package org.eclipse.ecf.presence.collab.ui.console; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; import java.util.Hashtable; +import java.util.Map; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.util.ECFException; -import org.eclipse.ecf.datashare.AbstractShare; import org.eclipse.ecf.datashare.IChannelContainerAdapter; -import org.eclipse.ecf.internal.presence.collab.ui.Activator; import org.eclipse.ecf.internal.presence.collab.ui.Messages; +import org.eclipse.ecf.presence.collab.ui.AbstractCollabShare; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.TextSelection; @@ -40,6 +33,7 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.console.ConsolePlugin; import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.IConsoleConstants; import org.eclipse.ui.console.IConsoleManager; import org.eclipse.ui.console.IConsoleView; import org.eclipse.ui.console.TextConsole; @@ -47,11 +41,9 @@ import org.eclipse.ui.console.TextConsole; /** * Send/receive requests to share a specific view (identified by view ID). */ -public class StackShare extends AbstractShare { +public class ConsoleShare extends AbstractCollabShare { - private static Hashtable stackSharechannels = new Hashtable(); - - private ID containerID = null; + private static final Map consoleSharechannels = new Hashtable(); private static TextSelection selection = null; private static boolean initialized = false; @@ -59,18 +51,22 @@ public class StackShare extends AbstractShare { private static final ISelectionListener selectionListener = new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (part instanceof IConsoleView && selection instanceof TextSelection) { - StackShare.selection = (TextSelection) selection; + TextSelection s = (TextSelection) selection; + if (s == null || s.getLength() == 0) + ConsoleShare.selection = null; + else + ConsoleShare.selection = (TextSelection) selection; } } }; - public static StackShare getStackShare(ID containerID) { - return (StackShare) stackSharechannels.get(containerID); + public static ConsoleShare getStackShare(ID containerID) { + return (ConsoleShare) consoleSharechannels.get(containerID); } - public static StackShare addStackShare(ID containerID, IChannelContainerAdapter channelAdapter) throws ECFException { + public static ConsoleShare addStackShare(ID containerID, IChannelContainerAdapter channelAdapter) throws ECFException { initialize(); - return (StackShare) stackSharechannels.put(containerID, new StackShare(containerID, channelAdapter)); + return (ConsoleShare) consoleSharechannels.put(containerID, new ConsoleShare(channelAdapter)); } private static void initialize() { @@ -90,49 +86,29 @@ public class StackShare extends AbstractShare { return selection; } - public static StackShare removeStackShare(ID containerID) { - return (StackShare) stackSharechannels.remove(containerID); + public static ConsoleShare removeStackShare(ID containerID) { + return (ConsoleShare) consoleSharechannels.remove(containerID); } - public StackShare(ID containerID, IChannelContainerAdapter adapter) throws ECFException { + public ConsoleShare(IChannelContainerAdapter adapter) throws ECFException { super(adapter); - Assert.isNotNull(containerID); - this.containerID = containerID; - } - - protected ID getContainerID() { - return containerID; - } - - private void logError(String exceptionString, Throwable e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, exceptionString, e)); - - } - - private void logError(IStatus status) { - Activator.getDefault().getLog().log(status); - } - - private void showErrorToUser(String title, String message) { - MessageDialog.openError(null, title, message); } private void handleShowStackRequest(final String user, final String stackTrace) { Display.getDefault().asyncExec(new Runnable() { public void run() { try { - final String viewID = "org.eclipse.ui.console.ConsoleView"; //$NON-NLS-1$ final IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (ww == null) - throw new PartInitException(Messages.StackShare_EXCEPTION_WW_NOT_AVAILABLE); + throw new PartInitException(Messages.ConsoleShare_EXCEPTION_WW_NOT_AVAILABLE); final IWorkbenchPage wp = ww.getActivePage(); if (wp == null) - throw new PartInitException(Messages.StackShare_EXCEPTION_WP_NOT_AVAILABLE); - wp.showView(viewID); + throw new PartInitException(Messages.ConsoleShare_EXCEPTION_WP_NOT_AVAILABLE); + wp.showView(IConsoleConstants.ID_CONSOLE_VIEW); final IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); final IConsole[] consoles = consoleManager.getConsoles(); if (consoles.length == 0) { - MessageDialog.openInformation(null, NLS.bind(Messages.StackShare_STACK_TRACE_FROM_TITLE, user), NLS.bind(Messages.StackShare_STACK_TRACE_FROM_MESSAGE, user)); + MessageDialog.openInformation(null, NLS.bind(Messages.ConsoleShare_STACK_TRACE_FROM_TITLE, user), NLS.bind(Messages.ConsoleShare_STACK_TRACE_FROM_MESSAGE, user)); return; } else { for (int i = 0; i < consoles.length; i++) { @@ -147,24 +123,21 @@ public class StackShare extends AbstractShare { } } } catch (final Exception e) { - showErrorToUser(Messages.StackShare_STACKSHARE_ERROR_DIALOG_TITLE, NLS.bind(Messages.StackShare_STACKSHARE_ERROR_DIALOG_MESSAGE, e.getLocalizedMessage())); - logError(Messages.StackShare_STACKSHARE_ERROR_LOG_MESSAGE, e); + showErrorToUser(Messages.ConsoleShare_STACKSHARE_ERROR_DIALOG_TITLE, NLS.bind(Messages.ConsoleShare_STACKSHARE_ERROR_DIALOG_MESSAGE, e.getLocalizedMessage())); + logError(Messages.ConsoleShare_STACKSHARE_ERROR_LOG_MESSAGE, e); } } }); } private String getStackTraceToShow(String user, String stackTrace) { - return NLS.bind(Messages.StackShare_STACK_TRACE_CONTENT, user, stackTrace); + return NLS.bind(Messages.ConsoleShare_STACK_TRACE_CONTENT, user, stackTrace); } public void sendShareStackRequest(final String senderuser, final ID toID, final String stackTrace) { Display.getDefault().asyncExec(new Runnable() { public void run() { - try { - // Actually send messages to target remote user (toID), - // with selectedIDs (view IDs) to show sendMessage(toID, serialize(new Object[] {senderuser, stackTrace})); } catch (final ECFException e) { showErrorToUser(Messages.Share_ERROR_SEND_TITLE, NLS.bind(Messages.Share_ERROR_SEND_MESSAGE, e.getStatus().getException().getLocalizedMessage())); @@ -192,16 +165,4 @@ public class StackShare extends AbstractShare { } } - protected byte[] serialize(Object o) throws Exception { - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - final ObjectOutputStream oos = new ObjectOutputStream(bos); - oos.writeObject(o); - return bos.toByteArray(); - } - - protected Object deserialize(byte[] bytes) throws Exception { - final ByteArrayInputStream bins = new ByteArrayInputStream(bytes); - final ObjectInputStream oins = new ObjectInputStream(bins); - return oins.readObject(); - } } diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/StackShareRosterEntryContributionItem.java b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/ConsoleShareRosterEntryContributionItem.java index e637e756a..c1c3257cf 100644 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/StackShareRosterEntryContributionItem.java +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/ConsoleShareRosterEntryContributionItem.java @@ -12,23 +12,25 @@ package org.eclipse.ecf.presence.collab.ui.console; import org.eclipse.ecf.core.IContainer; import org.eclipse.ecf.datashare.IChannelContainerAdapter; +import org.eclipse.ecf.internal.presence.collab.ui.Activator; +import org.eclipse.ecf.internal.presence.collab.ui.Messages; import org.eclipse.ecf.presence.roster.IRosterEntry; import org.eclipse.ecf.presence.ui.roster.AbstractRosterEntryContributionItem; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.TextSelection; -public class StackShareRosterEntryContributionItem extends AbstractRosterEntryContributionItem { +public class ConsoleShareRosterEntryContributionItem extends AbstractRosterEntryContributionItem { - public StackShareRosterEntryContributionItem() { + public ConsoleShareRosterEntryContributionItem() { } - public StackShareRosterEntryContributionItem(String id) { + public ConsoleShareRosterEntryContributionItem(String id) { super(id); } protected IAction[] makeActions() { - final TextSelection selection = StackShare.getSelection(); + final TextSelection selection = ConsoleShare.getSelection(); if (selection == null) return null; // Else check for Roster entry @@ -39,17 +41,17 @@ public class StackShareRosterEntryContributionItem extends AbstractRosterEntryCo final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class); // If the container has channel container adapter and is online/available if (channelAdapter != null && isAvailable(entry)) { - final StackShare tmp = StackShare.getStackShare(c.getID()); + final ConsoleShare tmp = ConsoleShare.getStackShare(c.getID()); // If there is an URL share associated with this container if (tmp != null) { - final StackShare stackshare = tmp; + final ConsoleShare stackshare = tmp; final IAction action = new Action() { public void run() { stackshare.sendShareStackRequest(entry.getRoster().getUser().getName(), entry.getUser().getID(), selection.getText()); } }; - action.setText(Messages.getString("StackShareRosterEntryContributionItem.SEND_STACK_TRACE_MENU")); //$NON-NLS-1$ - //action.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, Messages.URLShareRosterContributionItem_BROWSER_ICON)); + action.setText(Messages.ConsoleShare_RosterEntryMenu); + action.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, Messages.ConsoleShare_RosterContributionItem_CONSOLE_ICON)); return new IAction[] {action}; } } diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/Messages.java b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/Messages.java deleted file mode 100644 index 344add031..000000000 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/Messages.java +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** - * Copyright (c) 2007 Composent, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Composent, Inc. - initial API and implementation - *****************************************************************************/ - -package org.eclipse.ecf.presence.collab.ui.console; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * - */ -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.ecf.presence.collab.ui.console.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/messages.properties b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/messages.properties deleted file mode 100644 index 19f70d28b..000000000 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/console/messages.properties +++ /dev/null @@ -1 +0,0 @@ -StackShareRosterEntryContributionItem.SEND_STACK_TRACE_MENU=Send Stack Trace diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/url/URLShare.java b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/url/URLShare.java index 0f1a2e5bf..a890decc5 100644 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/url/URLShare.java +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/url/URLShare.java @@ -11,22 +11,14 @@ package org.eclipse.ecf.presence.collab.ui.url; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; import java.net.URL; import java.util.Hashtable; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.util.ECFException; -import org.eclipse.ecf.datashare.AbstractShare; import org.eclipse.ecf.datashare.IChannelContainerAdapter; -import org.eclipse.ecf.internal.presence.collab.ui.Activator; import org.eclipse.ecf.internal.presence.collab.ui.Messages; +import org.eclipse.ecf.presence.collab.ui.AbstractCollabShare; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.osgi.util.NLS; @@ -38,45 +30,24 @@ import org.eclipse.ui.browser.IWorkbenchBrowserSupport; /** * Send/receive requests to display an URL in the internal web browser. */ -public class URLShare extends AbstractShare { +public class URLShare extends AbstractCollabShare { - private ID containerID = null; - - private static Hashtable urlsharechannels = new Hashtable(); + private static final Hashtable urlsharechannels = new Hashtable(); public static URLShare getURLShare(ID containerID) { return (URLShare) urlsharechannels.get(containerID); } public static URLShare addURLShare(ID containerID, IChannelContainerAdapter channelAdapter) throws ECFException { - return (URLShare) urlsharechannels.put(containerID, new URLShare(containerID, channelAdapter)); + return (URLShare) urlsharechannels.put(containerID, new URLShare(channelAdapter)); } public static URLShare removeURLShare(ID containerID) { return (URLShare) urlsharechannels.remove(containerID); } - public URLShare(ID containerID, IChannelContainerAdapter adapter) throws ECFException { + public URLShare(IChannelContainerAdapter adapter) throws ECFException { super(adapter); - Assert.isNotNull(containerID); - this.containerID = containerID; - } - - protected ID getContainerID() { - return containerID; - } - - private void logError(String exceptionString, Throwable e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, exceptionString, e)); - - } - - private void logError(IStatus status) { - Activator.getDefault().getLog().log(status); - } - - private void showErrorToUser(String title, String message) { - MessageDialog.openError(null, title, message); } private void showURL(final String user, final String url) { @@ -149,16 +120,4 @@ public class URLShare extends AbstractShare { } } - protected byte[] serialize(Object o) throws Exception { - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - final ObjectOutputStream oos = new ObjectOutputStream(bos); - oos.writeObject(o); - return bos.toByteArray(); - } - - protected Object deserialize(byte[] bytes) throws Exception { - final ByteArrayInputStream bins = new ByteArrayInputStream(bytes); - final ObjectInputStream oins = new ObjectInputStream(bins); - return oins.readObject(); - } } diff --git a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/view/ViewShare.java b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/view/ViewShare.java index e5f7c5212..9cb13df22 100644 --- a/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/view/ViewShare.java +++ b/framework/bundles/org.eclipse.ecf.presence.collab.ui/src/org/eclipse/ecf/presence/collab/ui/view/ViewShare.java @@ -11,24 +11,20 @@ package org.eclipse.ecf.presence.collab.ui.view; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; import java.util.Hashtable; +import java.util.Map; -import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.util.ECFException; -import org.eclipse.ecf.datashare.AbstractShare; import org.eclipse.ecf.datashare.IChannelContainerAdapter; import org.eclipse.ecf.internal.presence.collab.ui.Activator; import org.eclipse.ecf.internal.presence.collab.ui.Messages; import org.eclipse.ecf.internal.presence.collab.ui.view.ShowViewDialogLabelProvider; import org.eclipse.ecf.internal.presence.collab.ui.view.ShowViewDialogTreeContentProvider; import org.eclipse.ecf.internal.presence.collab.ui.view.ShowViewDialogViewerFilter; +import org.eclipse.ecf.presence.collab.ui.AbstractCollabShare; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.jface.window.Window; @@ -46,45 +42,24 @@ import org.eclipse.ui.views.IViewRegistry; /** * Send/receive requests to share a specific view (identified by view ID). */ -public class ViewShare extends AbstractShare { +public class ViewShare extends AbstractCollabShare { - private static Hashtable viewSharechannels = new Hashtable(); - - private ID containerID = null; + private static final Map viewSharechannels = new Hashtable(); public static ViewShare getViewShare(ID containerID) { return (ViewShare) viewSharechannels.get(containerID); } public static ViewShare addViewShare(ID containerID, IChannelContainerAdapter channelAdapter) throws ECFException { - return (ViewShare) viewSharechannels.put(containerID, new ViewShare(containerID, channelAdapter)); + return (ViewShare) viewSharechannels.put(containerID, new ViewShare(channelAdapter)); } public static ViewShare removeViewShare(ID containerID) { return (ViewShare) viewSharechannels.remove(containerID); } - public ViewShare(ID containerID, IChannelContainerAdapter adapter) throws ECFException { + public ViewShare(IChannelContainerAdapter adapter) throws ECFException { super(adapter); - Assert.isNotNull(containerID); - this.containerID = containerID; - } - - protected ID getContainerID() { - return containerID; - } - - private void logError(String exceptionString, Throwable e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, exceptionString, e)); - - } - - private void logError(IStatus status) { - Activator.getDefault().getLog().log(status); - } - - private void showErrorToUser(String title, String message) { - MessageDialog.openError(null, title, message); } private void handleOpenViewRequest(final String user, final String viewID, final String secondaryID, final int mode) { @@ -174,16 +149,4 @@ public class ViewShare extends AbstractShare { } } - protected byte[] serialize(Object o) throws Exception { - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - final ObjectOutputStream oos = new ObjectOutputStream(bos); - oos.writeObject(o); - return bos.toByteArray(); - } - - protected Object deserialize(byte[] bytes) throws Exception { - final ByteArrayInputStream bins = new ByteArrayInputStream(bytes); - final ObjectInputStream oins = new ObjectInputStream(bins); - return oins.readObject(); - } } |