summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-06 04:56:44 (EDT)
committerEike Stepper2007-08-06 04:56:44 (EDT)
commite1ca00aca6525feb0ea2248bf3bf3d24d148538f (patch)
treecc2b4e7bf27149dead08f53278ac75dd3248c0ff
parent37fcd4a07f78780f31364253281df1bd3479488a (diff)
downloadcdo-e1ca00aca6525feb0ea2248bf3bf3d24d148538f.zip
cdo-e1ca00aca6525feb0ea2248bf3bf3d24d148538f.tar.gz
cdo-e1ca00aca6525feb0ea2248bf3bf3d24d148538f.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RegisterPackageDialog.java102
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java29
4 files changed, 11 insertions, 127 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java
index 291220e..2578152 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java
@@ -42,7 +42,8 @@ public class RegisterGeneratedPackagesAction extends RegisterPackagesAction
{
Shell shell = page.getWorkbenchWindow().getShell();
SelectPackageDialog dialog = new SelectPackageDialog(shell, "Generated Packages",
- "Select one or more packages for registration with the CDO package registry");
+ "Select one or more packages for registration with the CDO package registry", session.getPackageRegistry()
+ .keySet());
if (dialog.open() == SelectPackageDialog.OK)
{
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
index d909eee..009dbc1 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
@@ -36,8 +36,8 @@ public abstract class OM
public static final OMPreferences PREFS = BUNDLE.preferences();
- public static final OMPreference<String[]> PREF_HISTORY_REGISTER_PACKAGE = PREFS
- .initArray("history.register.package");
+ public static final OMPreference<String[]> PREF_HISTORY_SELECT_PACKAGES = PREFS
+ .initArray("PREF_HISTORY_SELECT_PACKAGES");
static void start() throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RegisterPackageDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RegisterPackageDialog.java
deleted file mode 100644
index b30cd35..0000000
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RegisterPackageDialog.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
- * 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
- **************************************************************************/
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.CDOSession;
-import org.eclipse.emf.cdo.internal.ui.bundle.OM;
-
-import org.eclipse.net4j.internal.util.collection.PreferenceHistory;
-import org.eclipse.net4j.util.collection.IHistory;
-
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Eike Stepper
- */
-public class RegisterPackageDialog extends TitleAreaDialog
-{
- public static final IHistory<String> HISTORY = new PreferenceHistory(OM.PREF_HISTORY_REGISTER_PACKAGE);
-
- private static final String TITLE = "Register Package";
-
- private CDOSession session;
-
- public RegisterPackageDialog(Shell parentShell, CDOSession session)
- {
- super(parentShell);
- this.session = session;
- setShellStyle(getShellStyle() | SWT.TITLE | SWT.RESIZE);
- }
-
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = (Composite)super.createDialogArea(parent);
- setTitle(TITLE);
-
- IPackageProvider[] packageProviders = getPackageProviders();
- Composite packageProviderArea = new Composite(composite, SWT.NONE);
- packageProviderArea.setLayout(new GridLayout(packageProviders.length, false));
- packageProviderArea.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
- for (final IPackageProvider packageProvider : packageProviders)
- {
- Button button = new Button(packageProviderArea, SWT.PUSH);
- button.setText(packageProvider.getTitle());
- button.addSelectionListener(new SelectionAdapter()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- EPackage ePackage = packageProvider.getPackage(session, e);
- if (ePackage != null)
- {
- session.getPackageRegistry().putEPackage(ePackage);
- }
- }
- });
- }
-
- Composite grid = new Composite(composite, SWT.NONE);
- grid.setLayout(new GridLayout(2, false));
-
- return composite;
- }
-
- protected IPackageProvider[] getPackageProviders()
- {
- return new IPackageProvider[0];
- }
-
- protected void registerPackage()
- {
- // RegisterCDOPackageAction action = new RegisterCDOPackageAction(page,
- // session);
- // action.run();
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java
index d0aae1c..af5ca46 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java
@@ -78,29 +78,13 @@ public class SelectPackageDialog extends BaseDialog<CheckboxTableViewer>
viewer.setLabelProvider(new PackageLabelProvider());
viewer.setInput(packageTypes);
- setCurrentViewer(viewer);
- }
+ String[] uris = OM.PREF_HISTORY_SELECT_PACKAGES.getValue();
+ if (uris != null)
+ {
+ viewer.setCheckedElements(uris);
+ }
- @Override
- protected void createButtonsForButtonBar(Composite parent)
- {
- super.createButtonsForButtonBar(parent);
- // final PreferenceButton showIgnored = new PreferenceButton(parent,
- // SWT.CHECK, OM.PREF_SHOW_IGNORED_BUNDLES);
- // showIgnored.setText("Show ignored bundles");
- // showIgnored.addSelectionListener(new SelectionAdapter()
- // {
- // @Override
- // public void widgetSelected(SelectionEvent e)
- // {
- // OM.PREF_SHOW_IGNORED_BUNDLES.setValue(showIgnored.getSelection());
- // getCurrentViewer().refresh(true);
- // }
- // });
- //
- // PreferenceButton startup = new PreferenceButton(parent, SWT.CHECK,
- // OM.PREF_CHECK_DURING_STARTUP);
- // startup.setText("Check during startup");
+ setCurrentViewer(viewer);
}
@Override
@@ -112,6 +96,7 @@ public class SelectPackageDialog extends BaseDialog<CheckboxTableViewer>
checkedURIs.add((String)checkedElement);
}
+ OM.PREF_HISTORY_SELECT_PACKAGES.setValue(checkedURIs.toArray(new String[checkedURIs.size()]));
super.okPressed();
}