Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-06-07 10:39:11 +0000
committerEike Stepper2012-06-07 10:39:11 +0000
commit9b52277f7c4465faf18b74562958f9a660c802a3 (patch)
treef79a4a015121f7df8a18ac1832da56aa00616a4a /plugins/org.eclipse.net4j.ui/src
parenta25531ae8a5c85586fdb590c0f806be3a807b634 (diff)
downloadcdo-9b52277f7c4465faf18b74562958f9a660c802a3.tar.gz
cdo-9b52277f7c4465faf18b74562958f9a660c802a3.tar.xz
cdo-9b52277f7c4465faf18b74562958f9a660c802a3.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')
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMAcceptorWizard.java6
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMConnectorWizard.java86
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java7
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java10
4 files changed, 88 insertions, 21 deletions
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMAcceptorWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMAcceptorWizard.java
index 88604cbc7a..3c59fbc836 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMAcceptorWizard.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/container/JVMAcceptorWizard.java
@@ -39,6 +39,12 @@ public class JVMAcceptorWizard extends ElementWizard implements ModifyListener
{
acceptorNameText = addText(parent, "Acceptor Name:");
acceptorNameText.addModifyListener(this);
+
+ String description = getDefaultDescription();
+ if (description != null)
+ {
+ acceptorNameText.setText(description);
+ }
}
public void modifyText(ModifyEvent e)
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 beae7000bc..fb04f21361 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
@@ -11,6 +11,9 @@
*/
package org.eclipse.net4j.internal.ui.container;
+import org.eclipse.net4j.internal.jvm.JVMAcceptorFactory;
+import org.eclipse.net4j.internal.ui.bundle.OM;
+import org.eclipse.net4j.jvm.IJVMAcceptor;
import org.eclipse.net4j.util.factory.ProductCreationException;
import org.eclipse.net4j.util.ui.container.ElementWizard;
import org.eclipse.net4j.util.ui.container.ElementWizardFactory;
@@ -18,18 +21,23 @@ 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.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
/**
* @author Eike Stepper
* @author Martin Fluegge
* @since 4.0
*/
-public class JVMConnectorWizard extends ElementWizard implements ModifyListener
+public class JVMConnectorWizard extends ElementWizard
{
- private Text acceptorNameText;
-
public JVMConnectorWizard()
{
}
@@ -37,27 +45,71 @@ public class JVMConnectorWizard extends ElementWizard implements ModifyListener
@Override
protected void create(Composite parent)
{
- acceptorNameText = addText(parent, "Acceptor Name:");
- acceptorNameText.addModifyListener(this);
+ List<String> choices = new ArrayList<String>();
- String description = getDefaultDescription();
- if (description != null)
+ try
{
- acceptorNameText.setText(description);
+ Object[] elements = getContainer().getElements(JVMAcceptorFactory.PRODUCT_GROUP, JVMAcceptorFactory.TYPE);
+ for (Object object : elements)
+ {
+ if (object instanceof IJVMAcceptor)
+ {
+ IJVMAcceptor acceptor = (IJVMAcceptor)object;
+ choices.add(acceptor.getName());
+ }
+ }
+ }
+ catch (NoClassDefFoundError error)
+ {
+ OM.LOG.error(error);
}
- }
- public void modifyText(ModifyEvent e)
- {
- String acceptorName = acceptorNameText.getText();
- if (acceptorName.length() == 0)
+ if (!choices.isEmpty())
{
- setValidationError(acceptorNameText, "Acceptor name is empty.");
- return;
+ Collections.sort(choices);
+
+ final Combo acceptorCombo = addCombo(parent, "Acceptor:", choices);
+ acceptorCombo.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ String acceptorName = acceptorCombo.getText();
+ setResultDescription(acceptorName);
+ }
+ });
+
+ String description = getDefaultDescription();
+ if (description != null)
+ {
+ acceptorCombo.setText(description);
+ }
}
+ else
+ {
+ final Text acceptorNameText = addText(parent, "Acceptor Name:");
+ acceptorNameText.addModifyListener(new ModifyListener()
+ {
+ 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);
+ setResultDescription(acceptorName);
+ setValidationError(acceptorNameText, null);
+ }
+ });
+
+ String description = getDefaultDescription();
+ if (description != null)
+ {
+ acceptorNameText.setText(description);
+ }
+ }
}
/**
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 5791387f7b..759cad3a73 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
@@ -32,12 +32,17 @@ 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",
+ private IAction newAcceptorAction = new ElementWizardAction(getShell(), "New Acceptor", "Open a new acceptor",
SharedIcons.getDescriptor(SharedIcons.ETOOL_ADD_ACCEPTOR), AcceptorFactory.PRODUCT_GROUP, getContainer(), "tcp")
{
@Override
public String getDefaultDescription(String factoryType)
{
+ if ("jvm".equals(factoryType))
+ {
+ return "default";
+ }
+
if ("tcp".equals(factoryType))
{
return "0.0.0.0:2036";
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 67f5bd90b0..699e7251bb 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
@@ -32,13 +32,17 @@ public class ConnectorsView extends ContainerView
{
public final static String ID = "org.eclipse.net4j.ConnectorsView"; //$NON-NLS-1$
- private IAction newConnectorAction = new ElementWizardAction(getShell(), "New Connector",
- "Open a new Net4j connector", SharedIcons.getDescriptor(SharedIcons.ETOOL_ADD_CONNECTOR),
- ConnectorFactory.PRODUCT_GROUP, getContainer(), "tcp")
+ private IAction newConnectorAction = new ElementWizardAction(getShell(), "New Connector", "Open a new connector",
+ SharedIcons.getDescriptor(SharedIcons.ETOOL_ADD_CONNECTOR), ConnectorFactory.PRODUCT_GROUP, getContainer(), "tcp")
{
@Override
public String getDefaultDescription(String factoryType)
{
+ if ("jvm".equals(factoryType))
+ {
+ return "default";
+ }
+
if ("tcp".equals(factoryType))
{
return "localhost";

Back to the top