Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-10-18 06:37:39 +0000
committerEike Stepper2010-10-18 06:37:39 +0000
commit8a60628572ccb8cc0776d7f37b4e60ec4e11d61a (patch)
tree36034e5f9a33208a2ab12cd650ae38b1ac9da12a
parentfc496efc6074f6be8ba0b14be5d056d3b3cfa965 (diff)
downloadcdo-8a60628572ccb8cc0776d7f37b4e60ec4e11d61a.tar.gz
cdo-8a60628572ccb8cc0776d7f37b4e60ec4e11d61a.tar.xz
cdo-8a60628572ccb8cc0776d7f37b4e60ec4e11d61a.zip
[327405] Provide an offline CDOWorkspace with Checkout/Update/Commit workflows
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327405
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/NewRepositoryLocationDialog.java61
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/RepositoryLocationsView.java2
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java70
3 files changed, 102 insertions, 31 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/NewRepositoryLocationDialog.java b/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/NewRepositoryLocationDialog.java
index 874be6d8f3..1e3f71deb9 100644
--- a/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/NewRepositoryLocationDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/NewRepositoryLocationDialog.java
@@ -5,9 +5,13 @@ import org.eclipse.net4j.util.ui.container.ElementWizardComposite;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
/**
* @author Eike Stepper
@@ -16,12 +20,35 @@ public class NewRepositoryLocationDialog extends TitleAreaDialog
{
private ElementWizardComposite connectorWizard;
+ private Text repositoryNameText;
+
+ private String connectorType;
+
+ private String connectorDescription;
+
+ private String repositoryName;
+
public NewRepositoryLocationDialog(Shell parentShell)
{
super(parentShell);
setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
}
+ public String getConnectorType()
+ {
+ return connectorType;
+ }
+
+ public String getConnectorDescription()
+ {
+ return connectorDescription;
+ }
+
+ public String getRepositoryName()
+ {
+ return repositoryName;
+ }
+
@Override
protected void configureShell(Shell newShell)
{
@@ -35,18 +62,36 @@ public class NewRepositoryLocationDialog extends TitleAreaDialog
setTitle("New Repository Location");
// setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PACKAGE_MANAGER));
- connectorWizard = new ElementWizardComposite.WithRadios(parent, SWT.NONE, "org.eclipse.net4j.connectors",
- "Connector:");
- // IPluginContainer container = getContainer();
- // connectorWizard = (IElementWizard)container.getElement("org.eclipse.net4j.util.ui.elementWizards",
- // "org.eclipse.net4j.connectors", null);
- //
- // connectorWizard.create(parent, container, "org.eclipse.net4j.connectors", "", "", null);
- return connectorWizard;
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ Group group1 = new Group(composite, SWT.NONE);
+ group1.setLayout(new GridLayout(1, false));
+ group1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
+ group1.setText("Connection");
+ connectorWizard = new ElementWizardComposite.WithRadios(group1, SWT.NONE, "org.eclipse.net4j.connectors", "Type:");
+ connectorWizard.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ Group group2 = new Group(composite, SWT.NONE);
+ group2.setLayout(new GridLayout(1, false));
+ group2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
+ group2.setText("Repository");
+ repositoryNameText = new Text(group2, SWT.BORDER);
+ repositoryNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ return composite;
}
protected IPluginContainer getContainer()
{
return IPluginContainer.INSTANCE;
}
+
+ @Override
+ protected void okPressed()
+ {
+ connectorType = connectorWizard.getFactoryType();
+ connectorDescription = connectorWizard.getDescription();
+ repositoryName = repositoryNameText.getText();
+ super.okPressed();
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/RepositoryLocationsView.java b/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/RepositoryLocationsView.java
index f50fd84ec3..4776fa37f3 100644
--- a/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/RepositoryLocationsView.java
+++ b/plugins/org.eclipse.emf.cdo.ui.location/src/org/eclipse/emf/cdo/ui/internal/location/RepositoryLocationsView.java
@@ -79,6 +79,8 @@ public class RepositoryLocationsView extends ContainerView
NewRepositoryLocationDialog dialog = new NewRepositoryLocationDialog(getSite().getShell());
if (dialog.open() == NewRepositoryLocationDialog.OK)
{
+ IRepositoryLocationManager.INSTANCE.addRepositoryLocation(dialog.getConnectorType(),
+ dialog.getConnectorDescription(), dialog.getRepositoryName());
}
}
}
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java
index 2d9ff62bfc..ecbea2f318 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java
@@ -56,6 +56,8 @@ public abstract class ElementWizardComposite extends Composite
private List<String> factoryTypes;
+ private Map<String, String> defaultDescriptions = new HashMap<String, String>();
+
private List<IElementWizard> wizards;
private Map<IElementWizard, List<Control>> wizardControls = new HashMap<IElementWizard, List<Control>>();
@@ -89,6 +91,16 @@ public abstract class ElementWizardComposite extends Composite
this.validationContext = validationContext;
}
+ public String getDefaultDescription(String factoryType)
+ {
+ return defaultDescriptions.get(factoryType);
+ }
+
+ public void setDefaultDescription(String factoryType, String value)
+ {
+ defaultDescriptions.put(factoryType, value);
+ }
+
protected void init()
{
IManagedContainer container = getContainer();
@@ -104,8 +116,10 @@ public abstract class ElementWizardComposite extends Composite
try
{
+ String description = getDefaultDescription(factoryType);
+
IElementWizard wizard = (IElementWizard)container.getElement(ElementWizardFactory.PRODUCT_GROUP,
- getProductGroup() + ":" + factoryType, null);
+ getProductGroup() + ":" + factoryType, description);
wizards.add(wizard);
wizardControls.put(wizard, new ArrayList<Control>());
}
@@ -203,21 +217,31 @@ public abstract class ElementWizardComposite extends Composite
}
}
- protected String getDefaultDescription(String factoryType)
+ protected IManagedContainer getContainer()
{
- return null;
+ return IPluginContainer.INSTANCE;
}
- protected IManagedContainer getContainer()
+ public String getDescription()
{
- return IPluginContainer.INSTANCE;
+ String resultType = getFactoryType();
+ for (int i = 0; i < wizards.size(); i++)
+ {
+ String factoryType = factoryTypes.get(i);
+ if (resultType.equals(factoryType))
+ {
+ return wizards.get(i).getResultDescription();
+ }
+ }
+
+ return null;
}
- protected abstract void createFactoryTypeControl();
+ public abstract String getFactoryType();
protected abstract void setFactoryType(String factoryType);
- protected abstract String getFactoryType();
+ protected abstract void createFactoryTypeControl();
/**
* @author Eike Stepper
@@ -241,7 +265,7 @@ public abstract class ElementWizardComposite extends Composite
}
@Override
- protected String getFactoryType()
+ public String getFactoryType()
{
return combo.getText();
}
@@ -298,21 +322,7 @@ public abstract class ElementWizardComposite extends Composite
}
@Override
- protected void createFactoryTypeControl()
- {
- composite = new Composite(this, SWT.SINGLE);
- composite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
- composite.setLayout(new FillLayout());
- for (String factoryType : getFactoryTypes())
- {
- Button choice = new Button(composite, SWT.RADIO);
- choice.setText(factoryType);
- choice.addSelectionListener(this);
- }
- }
-
- @Override
- protected String getFactoryType()
+ public String getFactoryType()
{
Control[] choices = composite.getChildren();
@@ -342,5 +352,19 @@ public abstract class ElementWizardComposite extends Composite
factoryTypeChanged();
}
+
+ @Override
+ protected void createFactoryTypeControl()
+ {
+ composite = new Composite(this, SWT.SINGLE);
+ composite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
+ composite.setLayout(new FillLayout());
+ for (String factoryType : getFactoryTypes())
+ {
+ Button choice = new Button(composite, SWT.RADIO);
+ choice.setText(factoryType);
+ choice.addSelectionListener(this);
+ }
+ }
}
}

Back to the top