Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-06-09 06:25:01 +0000
committerEike Stepper2012-06-09 06:25:01 +0000
commitf8aaeebdc8d20dd68e9a0087e1cede40d2e1d38b (patch)
treec8a6e7a5849d5ce84f874678dd35a531c073d0b6 /plugins/org.eclipse.net4j.ui/src
parenta64c90c2035bae5c504e15d66213beb78b93a66d (diff)
downloadcdo-f8aaeebdc8d20dd68e9a0087e1cede40d2e1d38b.tar.gz
cdo-f8aaeebdc8d20dd68e9a0087e1cede40d2e1d38b.tar.xz
cdo-f8aaeebdc8d20dd68e9a0087e1cede40d2e1d38b.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/views/AcceptorsView.java71
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java49
2 files changed, 60 insertions, 60 deletions
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 759cad3a73..45e9aabee2 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
@@ -24,6 +24,7 @@ import org.eclipse.net4j.util.ui.views.IElementFilter;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.spi.net4j.AcceptorFactory;
+import org.eclipse.swt.widgets.Shell;
/**
* @author Eike Stepper
@@ -32,47 +33,7 @@ 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 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";
- }
-
- return null;
- }
- };
-
- // private Action addAcceptorAction2036 = new SafeAction(Messages.getString("AcceptorsView_0"), //$NON-NLS-1$
- // Messages.getString("AcceptorsView_1"), //$NON-NLS-1$
- // getAddImageDescriptor())
- // {
- // @Override
- // protected void safeRun() throws Exception
- // {
- // Net4jUtil.getAcceptor(IPluginContainer.INSTANCE, "tcp", "0.0.0.0:2036"); //$NON-NLS-1$ //$NON-NLS-2$
- // }
- // };
- //
- // private Action addAcceptorAction2037 = new SafeAction(Messages.getString("AcceptorsView_4"),
- // Messages.getString("AcceptorsView_5"), //$NON-NLS-1$
- // getAddImageDescriptor())
- // {
- // @Override
- // protected void safeRun() throws Exception
- // {
- // Net4jUtil.getAcceptor(IPluginContainer.INSTANCE, "tcp", "0.0.0.0:2037"); //$NON-NLS-1$ //$NON-NLS-2$
- // }
- // };
+ private IAction newAcceptorAction;
public AcceptorsView()
{
@@ -99,7 +60,35 @@ public class AcceptorsView extends ContainerView
@Override
protected void fillLocalToolBar(IToolBarManager manager)
{
+ if (newAcceptorAction == null)
+ {
+ newAcceptorAction = createNewAcceptorAction(getShell(), getContainer());
+ }
+
manager.add(newAcceptorAction);
super.fillLocalToolBar(manager);
}
+
+ public static ElementWizardAction createNewAcceptorAction(Shell shell, IManagedContainer container)
+ {
+ return new ElementWizardAction(shell, "New Acceptor", "Open a new acceptor",
+ SharedIcons.getDescriptor(SharedIcons.ETOOL_ADD_ACCEPTOR), AcceptorFactory.PRODUCT_GROUP, container, "tcp")
+ {
+ @Override
+ public String getDefaultDescription(String factoryType)
+ {
+ if ("jvm".equals(factoryType))
+ {
+ return "default";
+ }
+
+ if ("tcp".equals(factoryType))
+ {
+ return "0.0.0.0:2036";
+ }
+
+ return null;
+ }
+ };
+ }
}
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 699e7251bb..078269a37f 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
@@ -24,6 +24,7 @@ import org.eclipse.net4j.util.ui.views.IElementFilter;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.spi.net4j.ConnectorFactory;
+import org.eclipse.swt.widgets.Shell;
/**
* @author Eike Stepper
@@ -32,25 +33,7 @@ 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 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";
- }
-
- return null;
- }
- };
+ private IAction newConnectorAction;
public ConnectorsView()
{
@@ -77,7 +60,35 @@ public class ConnectorsView extends ContainerView
@Override
protected void fillLocalToolBar(IToolBarManager manager)
{
+ if (newConnectorAction == null)
+ {
+ newConnectorAction = createNewConnectorAction(getShell(), getContainer());
+ }
+
manager.add(newConnectorAction);
super.fillLocalToolBar(manager);
}
+
+ public static ElementWizardAction createNewConnectorAction(Shell shell, IManagedContainer container)
+ {
+ return new ElementWizardAction(shell, "New Connector", "Open a new connector",
+ SharedIcons.getDescriptor(SharedIcons.ETOOL_ADD_CONNECTOR), ConnectorFactory.PRODUCT_GROUP, container, "tcp")
+ {
+ @Override
+ public String getDefaultDescription(String factoryType)
+ {
+ if ("jvm".equals(factoryType))
+ {
+ return "default";
+ }
+
+ if ("tcp".equals(factoryType))
+ {
+ return "localhost";
+ }
+
+ return null;
+ }
+ };
+ }
}

Back to the top