Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-06-06 18:05:10 +0000
committerEike Stepper2012-06-06 18:05:10 +0000
commit4a711b5a64c086bd1aec35465e96807cd7572dc0 (patch)
tree1f094a2acda82566abd8de555f21044dfdf16a40 /plugins/org.eclipse.net4j.ui/src/org
parentbc6860460ea734dc2dfa4cc82238486f53c81d41 (diff)
downloadcdo-4a711b5a64c086bd1aec35465e96807cd7572dc0.tar.gz
cdo-4a711b5a64c086bd1aec35465e96807cd7572dc0.tar.xz
cdo-4a711b5a64c086bd1aec35465e96807cd7572dc0.zip
[381472] Design a repository administration API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=381472
Diffstat (limited to 'plugins/org.eclipse.net4j.ui/src/org')
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMConnectorWizard.java152
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPAcceptorWizard.java10
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPConnectorWizard.java194
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java14
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java14
5 files changed, 225 insertions, 159 deletions
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMConnectorWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMConnectorWizard.java
index 9df1eb541e..beae7000bc 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMConnectorWizard.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMConnectorWizard.java
@@ -1,73 +1,79 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
- * Eike Stepper - initial API and implementation
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.net4j.internal.ui.container;
-
-import org.eclipse.net4j.util.factory.ProductCreationException;
-import org.eclipse.net4j.util.ui.container.ElementWizard;
-import org.eclipse.net4j.util.ui.container.ElementWizardFactory;
-
-import org.eclipse.spi.net4j.ConnectorFactory;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Eike Stepper
- * @author Martin Fluegge
- * @since 4.0
- */
-public class JVMConnectorWizard extends ElementWizard implements ModifyListener
-{
- private Text acceptorNameText;
-
- public JVMConnectorWizard()
- {
- }
-
- @Override
- protected void create(Composite parent)
- {
- acceptorNameText = addText(parent, "Acceptor Name:");
- acceptorNameText.addModifyListener(this);
- }
-
- public void modifyText(ModifyEvent e)
- {
- String acceptorName = acceptorNameText.getText();
- if (acceptorName.length() == 0)
- {
- setValidationError(acceptorNameText, "Acceptor name is empty.");
- return;
- }
-
- setResultDescription(acceptorName);
- setValidationError(acceptorNameText, null);
- }
-
- /**
- * @author Eike Stepper
- */
- public static class Factory extends ElementWizardFactory
- {
- public Factory()
- {
- super(ConnectorFactory.PRODUCT_GROUP, "jvm");
- }
-
- @Override
- public JVMConnectorWizard create(String description) throws ProductCreationException
- {
- return new JVMConnectorWizard();
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Eike Stepper - initial API and implementation
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.net4j.internal.ui.container;
+
+import org.eclipse.net4j.util.factory.ProductCreationException;
+import org.eclipse.net4j.util.ui.container.ElementWizard;
+import org.eclipse.net4j.util.ui.container.ElementWizardFactory;
+
+import org.eclipse.spi.net4j.ConnectorFactory;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Eike Stepper
+ * @author Martin Fluegge
+ * @since 4.0
+ */
+public class JVMConnectorWizard extends ElementWizard implements ModifyListener
+{
+ private Text acceptorNameText;
+
+ public JVMConnectorWizard()
+ {
+ }
+
+ @Override
+ protected void create(Composite parent)
+ {
+ acceptorNameText = addText(parent, "Acceptor Name:");
+ acceptorNameText.addModifyListener(this);
+
+ String description = getDefaultDescription();
+ if (description != null)
+ {
+ acceptorNameText.setText(description);
+ }
+ }
+
+ public void modifyText(ModifyEvent e)
+ {
+ String acceptorName = acceptorNameText.getText();
+ if (acceptorName.length() == 0)
+ {
+ setValidationError(acceptorNameText, "Acceptor name is empty.");
+ return;
+ }
+
+ setResultDescription(acceptorName);
+ setValidationError(acceptorNameText, null);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Factory extends ElementWizardFactory
+ {
+ public Factory()
+ {
+ super(ConnectorFactory.PRODUCT_GROUP, "jvm");
+ }
+
+ @Override
+ public JVMConnectorWizard create(String description) throws ProductCreationException
+ {
+ return new JVMConnectorWizard();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPAcceptorWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPAcceptorWizard.java
index 95393b79b5..2188e1eda8 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPAcceptorWizard.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPAcceptorWizard.java
@@ -11,6 +11,8 @@
*/
package org.eclipse.net4j.internal.ui.container;
+import org.eclipse.net4j.internal.tcp.TCPAcceptorFactory;
+import org.eclipse.net4j.internal.tcp.TCPAcceptorFactory.Data;
import org.eclipse.net4j.util.factory.ProductCreationException;
import org.eclipse.net4j.util.ui.container.ElementWizard;
import org.eclipse.net4j.util.ui.container.ElementWizardFactory;
@@ -44,6 +46,14 @@ public class TCPAcceptorWizard extends ElementWizard implements ModifyListener
portText = addText(parent, "Port:");
portText.addModifyListener(this);
+
+ String description = getDefaultDescription();
+ if (description != null)
+ {
+ Data data = new TCPAcceptorFactory.Data(description);
+ addressText.setText(data.getAddress());
+ portText.setText(Integer.toString(data.getPort()));
+ }
}
public void modifyText(ModifyEvent e)
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPConnectorWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPConnectorWizard.java
index 8c8209a954..ba7ebe7894 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPConnectorWizard.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/TCPConnectorWizard.java
@@ -1,84 +1,110 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
- * Eike Stepper - initial API and implementation
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.net4j.internal.ui.container;
-
-import org.eclipse.net4j.util.factory.ProductCreationException;
-import org.eclipse.net4j.util.ui.container.ElementWizard;
-import org.eclipse.net4j.util.ui.container.ElementWizardFactory;
-
-import org.eclipse.spi.net4j.ConnectorFactory;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Eike Stepper
- * @author Martin Fluegge
- * @since 4.0
- */
-public class TCPConnectorWizard extends ElementWizard implements ModifyListener
-{
- private Text hostText;
-
- private Text portText;
-
- public TCPConnectorWizard()
- {
- }
-
- @Override
- protected void create(Composite parent)
- {
- hostText = addText(parent, "Host:");
- hostText.addModifyListener(this);
-
- portText = addText(parent, "Port:");
- portText.addModifyListener(this);
- }
-
- public void modifyText(ModifyEvent e)
- {
- String host = hostText.getText();
- if (host.length() == 0)
- {
- setValidationError(hostText, "Host name is empty.");
- return;
- }
-
- String port = portText.getText();
- if (port.length() != 0)
- {
- host += ":" + port;
- }
-
- setResultDescription(host);
- setValidationError(hostText, null);
- }
-
- /**
- * @author Eike Stepper
- */
- public static class Factory extends ElementWizardFactory
- {
- public Factory()
- {
- super(ConnectorFactory.PRODUCT_GROUP, "tcp");
- }
-
- @Override
- public TCPConnectorWizard create(String description) throws ProductCreationException
- {
- return new TCPConnectorWizard();
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Eike Stepper - initial API and implementation
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.net4j.internal.ui.container;
+
+import org.eclipse.net4j.internal.ui.bundle.OM;
+import org.eclipse.net4j.util.factory.ProductCreationException;
+import org.eclipse.net4j.util.ui.container.ElementWizard;
+import org.eclipse.net4j.util.ui.container.ElementWizardFactory;
+
+import org.eclipse.spi.net4j.ConnectorFactory;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * @author Eike Stepper
+ * @author Martin Fluegge
+ * @since 4.0
+ */
+public class TCPConnectorWizard extends ElementWizard implements ModifyListener
+{
+ private Text hostText;
+
+ private Text portText;
+
+ public TCPConnectorWizard()
+ {
+ }
+
+ @Override
+ protected void create(Composite parent)
+ {
+ hostText = addText(parent, "Host:");
+ hostText.addModifyListener(this);
+
+ portText = addText(parent, "Port:");
+ portText.addModifyListener(this);
+
+ String description = getDefaultDescription();
+ if (description != null)
+ {
+ try
+ {
+ // TODO Don't use URL
+ // Scheme "tcp://" would be rejected!
+ URL url = new URL("http://" + description);
+ // String userID = url.getUserInfo();
+ hostText.setText(url.getHost());
+ int port = url.getPort();
+ if (port != -1)
+ {
+ portText.setText(Integer.toString(port));
+ }
+ }
+ catch (MalformedURLException ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+ }
+
+ public void modifyText(ModifyEvent e)
+ {
+ String host = hostText.getText();
+ if (host.length() == 0)
+ {
+ setValidationError(hostText, "Host name is empty.");
+ return;
+ }
+
+ String port = portText.getText();
+ if (port.length() != 0)
+ {
+ host += ":" + port;
+ }
+
+ setResultDescription(host);
+ setValidationError(hostText, null);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Factory extends ElementWizardFactory
+ {
+ public Factory()
+ {
+ super(ConnectorFactory.PRODUCT_GROUP, "tcp");
+ }
+
+ @Override
+ public TCPConnectorWizard create(String description) throws ProductCreationException
+ {
+ return new TCPConnectorWizard();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java
index d4593002a8..5791387f7b 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java
@@ -33,7 +33,19 @@ public class AcceptorsView extends ContainerView
public final static String ID = "org.eclipse.net4j.AcceptorsView"; //$NON-NLS-1$
private IAction newAcceptorAction = new ElementWizardAction(getShell(), "New Acceptor", "Open a new Net4j acceptor",
- SharedIcons.getDescriptor(SharedIcons.ETOOL_ADD_ACCEPTOR), AcceptorFactory.PRODUCT_GROUP, getContainer());
+ SharedIcons.getDescriptor(SharedIcons.ETOOL_ADD_ACCEPTOR), AcceptorFactory.PRODUCT_GROUP, getContainer(), "tcp")
+ {
+ @Override
+ public String getDefaultDescription(String factoryType)
+ {
+ if ("tcp".equals(factoryType))
+ {
+ return "0.0.0.0:2036";
+ }
+
+ return null;
+ }
+ };
// private Action addAcceptorAction2036 = new SafeAction(Messages.getString("AcceptorsView_0"), //$NON-NLS-1$
// Messages.getString("AcceptorsView_1"), //$NON-NLS-1$
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java
index dd6c17607f..67f5bd90b0 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java
@@ -34,7 +34,19 @@ public class ConnectorsView extends ContainerView
private IAction newConnectorAction = new ElementWizardAction(getShell(), "New Connector",
"Open a new Net4j connector", SharedIcons.getDescriptor(SharedIcons.ETOOL_ADD_CONNECTOR),
- ConnectorFactory.PRODUCT_GROUP, getContainer());
+ ConnectorFactory.PRODUCT_GROUP, getContainer(), "tcp")
+ {
+ @Override
+ public String getDefaultDescription(String factoryType)
+ {
+ if ("tcp".equals(factoryType))
+ {
+ return "localhost";
+ }
+
+ return null;
+ }
+ };
public ConnectorsView()
{

Back to the top