summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-02-25 02:03:16 (EST)
committerEike Stepper2007-02-25 02:03:16 (EST)
commit1396f2c897936175090e273e112f5f24293a602f (patch)
treeeef849f4119d5a74ed7bf2b5ea79725b6f854486
parenta29cd83737980bb1b2a053a0b9f65076c960c053 (diff)
downloadcdo-1396f2c897936175090e273e112f5f24293a602f.zip
cdo-1396f2c897936175090e273e112f5f24293a602f.tar.gz
cdo-1396f2c897936175090e273e112f5f24293a602f.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java125
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java1
2 files changed, 65 insertions, 61 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
index eb6758e..eba1c8e 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
@@ -7,6 +7,9 @@ import org.eclipse.net4j.container.Container;
import org.eclipse.net4j.container.ContainerManager;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
@@ -42,11 +45,11 @@ public class CDOSessionsView extends ViewPart
// private DrillDownAdapter drillDownAdapter;
- private Action openSessionAction;
+ private Action doubleClickAction = new DoubleClickAction();
- private Action addConnectorAction;
+ private Action openSessionAction = new OpenSessionAction();
- private Action doubleClickAction;
+ private Action addConnectorAction;
public CDOSessionsView()
{
@@ -63,7 +66,6 @@ public class CDOSessionsView extends ViewPart
viewer.setSorter(new CDOSessionsNameSorter());
viewer.setInput(CDO_ADAPTER);
- makeActions();
hookContextMenu();
hookDoubleClickAction();
contributeToActionBars();
@@ -80,6 +82,7 @@ public class CDOSessionsView extends ViewPart
CDOSessionsView.this.fillContextMenu(manager);
}
});
+
Menu menu = menuMgr.createContextMenu(getCurrentViewer().getControl());
getCurrentViewer().getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, getCurrentViewer());
@@ -99,8 +102,8 @@ public class CDOSessionsView extends ViewPart
private void fillLocalPullDown(IMenuManager manager)
{
- manager.add(openSessionAction);
- manager.add(addConnectorAction);
+ addContribution(manager, openSessionAction);
+ addContribution(manager, addConnectorAction);
// manager.add(new Separator());
// manager.add(action2);
}
@@ -117,68 +120,26 @@ public class CDOSessionsView extends ViewPart
private void fillLocalToolBar(IToolBarManager manager)
{
- manager.add(openSessionAction);
- manager.add(addConnectorAction);
- // manager.add(action2);
+ addContribution(manager, openSessionAction);
+ addContribution(manager, addConnectorAction);
// manager.add(new Separator());
// drillDownAdapter.addNavigationActions(manager);
}
- private void makeActions()
+ protected void addContribution(IContributionManager manager, IContributionItem item)
{
- openSessionAction = new Action()
- {
- public void run()
- {
- InputDialog dialog = new InputDialog(getCurrentViewer().getControl().getShell(), "CDO Sessions",
- "Enter a session description:", null, null);
- if (dialog.open() == InputDialog.OK)
- {
- String description = dialog.getValue();
- Object object = CDO_ADAPTER.getSession(description);
- if (object == null)
- {
- showMessage("Error while creating session for description" + description);
- }
- }
- }
- };
- openSessionAction.setText("Open Session");
- openSessionAction.setToolTipText("Open a CDO session");
- openSessionAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
- ISharedImages.IMG_TOOL_NEW_WIZARD));
-
- addConnectorAction = new Action()
+ if (manager != null && item != null)
{
- public void run()
- {
- InputDialog dialog = new InputDialog(getCurrentViewer().getControl().getShell(), "Net4j Explorer",
- "Enter a connector description:", null, null);
- if (dialog.open() == InputDialog.OK)
- {
- String description = dialog.getValue();
- Object object = CONTAINER.getConnector(description);
- if (object == null)
- {
- showMessage("Error while creating connector for description" + description);
- }
- }
- }
- };
- addConnectorAction.setText("Add Connector");
- addConnectorAction.setToolTipText("Add a connector");
- addConnectorAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
- ISharedImages.IMG_TOOL_NEW_WIZARD));
+ manager.add(item);
+ }
+ }
- doubleClickAction = new Action()
+ protected void addContribution(IContributionManager manager, IAction action)
+ {
+ if (manager != null && action != null)
{
- public void run()
- {
- ISelection selection = getCurrentViewer().getSelection();
- Object obj = ((IStructuredSelection)selection).getFirstElement();
- showMessage("Double-click detected on " + obj.toString());
- }
- };
+ manager.add(action);
+ }
}
private void hookDoubleClickAction()
@@ -192,7 +153,7 @@ public class CDOSessionsView extends ViewPart
});
}
- private void showMessage(String message)
+ protected void showMessage(String message)
{
MessageDialog.openInformation(getCurrentViewer().getControl().getShell(), "Net4j Explorer", message);
}
@@ -201,4 +162,46 @@ public class CDOSessionsView extends ViewPart
{
getCurrentViewer().getControl().setFocus();
}
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class DoubleClickAction extends Action
+ {
+ public void run()
+ {
+ ISelection selection = getCurrentViewer().getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ showMessage("Double-click detected on " + obj.toString());
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class OpenSessionAction extends Action
+ {
+ public OpenSessionAction()
+ {
+ setText("Open Session");
+ setToolTipText("Open a CDO session");
+ setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
+ ISharedImages.IMG_TOOL_NEW_WIZARD));
+ }
+
+ public void run()
+ {
+ InputDialog dialog = new InputDialog(getCurrentViewer().getControl().getShell(), "CDO Sessions",
+ "Enter a session description:", null, null);
+ if (dialog.open() == InputDialog.OK)
+ {
+ String description = dialog.getValue();
+ Object object = CDO_ADAPTER.getSession(description);
+ if (object == null)
+ {
+ showMessage("Error while creating session for description " + description);
+ }
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java
index 5f5c784..20f719b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java
@@ -340,6 +340,7 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
public Channel openChannel(String protocolID, Object protocolData) throws ConnectorException
{
+ waitForConnection(Long.MAX_VALUE);
short channelIndex = findFreeChannelIndex();
ChannelImpl channel = createChannel(channelIndex, protocolID, protocolData);
registerChannelWithPeer(channelIndex, protocolID);