diff options
author | Hamdan Msheik | 2013-08-16 19:50:08 +0000 |
---|---|---|
committer | Pascal Rapicault | 2013-12-09 19:43:56 +0000 |
commit | ac5dd54a48358c1bd9f99b1db69af5d209678a5c (patch) | |
tree | 326483809b3c00509ddb6644bfe2431d42ab7242 /bundles | |
parent | ab3a3cd49275494ecf24e8ea1d963c0857c7d087 (diff) | |
download | rt.equinox.p2-ac5dd54a48358c1bd9f99b1db69af5d209678a5c.tar.gz rt.equinox.p2-ac5dd54a48358c1bd9f99b1db69af5d209678a5c.tar.xz rt.equinox.p2-ac5dd54a48358c1bd9f99b1db69af5d209678a5c.zip |
Bug - 401942 Fixed migration page scroll bar issue.
Signed-off-by: Pascal Rapicault <pascal@rapicault.net>
Signed-off-by: Hamdan Msheik <hamdan.msheik@ericsson.com>
Diffstat (limited to 'bundles')
4 files changed, 95 insertions, 23 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java index 9a135a41f..6458bb1bc 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java @@ -42,6 +42,7 @@ import org.eclipse.jface.viewers.*; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; @@ -235,7 +236,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis } public MigrationPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IProfile toImportFrom, Collection<IInstallableUnit> unitsToMigrate, boolean firstTime) { - super("MigrationPageInstace"); //$NON-NLS-1$ + super("MigrationPageInstance"); //$NON-NLS-1$ this.wizard = wizard; this.ui = ui; profile = getSelfProfile(); @@ -270,6 +271,11 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis column.getColumn().setText(titles[i]); column.getColumn().setResizable(true); column.getColumn().setMoveable(true); + if (titles[i].equals(ProvUIMessages.Column_Name)) { + column.getColumn().setWidth(300); + } else { + column.getColumn().setWidth(200); + } if (ProvUIMessages.Column_Name.equals(titles[i])) updateTableSorting(i); final int columnIndex = i; @@ -321,19 +327,36 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis return new IUColumnConfig[] {new IUColumnConfig(org.eclipse.equinox.internal.p2.ui.ProvUIMessages.ProvUI_NameColumnTitle, IUColumnConfig.COLUMN_NAME, ILayoutConstants.DEFAULT_PRIMARY_COLUMN_WIDTH), new IUColumnConfig(org.eclipse.equinox.internal.p2.ui.ProvUIMessages.ProvUI_VersionColumnTitle, IUColumnConfig.COLUMN_VERSION, ILayoutConstants.DEFAULT_SMALL_COLUMN_WIDTH), new IUColumnConfig(org.eclipse.equinox.internal.p2.ui.ProvUIMessages.ProvUI_IdColumnTitle, IUColumnConfig.COLUMN_ID, ILayoutConstants.DEFAULT_COLUMN_WIDTH)}; } + protected void createContents(Composite composite) { + createInstallationTable(composite); + createAdditionOptions(composite); + } + protected void createInstallationTable(final Composite parent) { - Group group = new Group(parent, SWT.NONE); - GridData griddata = new GridData(GridData.FILL, GridData.FILL, true, true); - griddata.verticalSpan = griddata.horizontalSpan = 0; - group.setLayoutData(griddata); - group.setLayout(new GridLayout(1, false)); + + SashForm sashForm = new SashForm(parent, SWT.VERTICAL); + FillLayout fill = new FillLayout(); + sashForm.setLayout(fill); + GridData data = new GridData(GridData.FILL_BOTH); + sashForm.setLayoutData(data); + Composite sashComposite = new Composite(sashForm, SWT.NONE); + GridLayout grid = new GridLayout(); + grid.marginWidth = 0; + grid.marginHeight = 0; + sashComposite.setLayout(grid); + PatternFilter filter = getPatternFilter(); filter.setIncludeLeadingWildcard(true); - final ImportExportFilteredTree filteredTree = new ImportExportFilteredTree(group, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, filter, true); + final ImportExportFilteredTree filteredTree = new ImportExportFilteredTree(sashComposite, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, filter, true); viewer = (CheckboxTreeViewer) filteredTree.getViewer(); final Tree tree = viewer.getTree(); tree.setHeaderVisible(true); tree.setLinesVisible(false); + GridData treeDataGrid = new GridData(GridData.FILL_BOTH); + treeDataGrid.heightHint = convertHeightInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_HEIGHT); + treeDataGrid.widthHint = convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH); + tree.setLayoutData(treeDataGrid); + viewer.setComparator(new TreeViewerComparator()); viewer.setComparer(new ProvElementComparer()); createColumns(viewer); @@ -427,7 +450,6 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis } }); viewer.getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); - viewer.getControl().setSize(300, 200); viewer.setInput(getInput()); viewer.getTree().addListener(SWT.Selection, new Listener() { @@ -444,7 +466,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis } }); - Composite buttons = new Composite(group, SWT.NONE); + Composite buttons = new Composite(sashComposite, SWT.NONE); buttons.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); buttons.setLayout(new RowLayout(SWT.HORIZONTAL)); Button selectAll = new Button(buttons, SWT.PUSH); @@ -637,11 +659,6 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis return isPageComplete(); } - protected void createContents(Composite composite) { - createInstallationTable(composite); - createAdditionOptions(composite); - } - protected String getDialogTitle() { return ProvUIMessages.MigrationPage_DIALOG_TITLE; } @@ -892,4 +909,5 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis boolean updateToLatest = Platform.getPreferencesService().getBoolean(AutomaticUpdatePlugin.PLUGIN_ID, "updateToLatest", false, contexts); return updateToLatest; } + }
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java index 81890500b..092844154 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java @@ -182,7 +182,7 @@ public class MigrationSupport { Display d = Display.getDefault(); d.asyncExec(new Runnable() { public void run() { - WizardDialog migrateWizard = new WizardDialog(getWorkbenchWindowShell(), new MigrationWizard(inputProfile, unitsToMigrate, reposToMigrate, reposToMigrate != null)); + WizardDialog migrateWizard = new MigrationWizardDialog(getWorkbenchWindowShell(), new MigrationWizard(inputProfile, unitsToMigrate, reposToMigrate, reposToMigrate != null)); migrateWizard.create(); migrateWizard.open(); } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizard.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizard.java index 5d6af1c6b..9fe09528f 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizard.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizard.java @@ -33,7 +33,8 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; import org.eclipse.equinox.p2.ui.ProvisioningUI; -import org.eclipse.jface.dialogs.*; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.IWizardPage; @@ -63,13 +64,6 @@ public class MigrationWizard extends InstallWizard implements IImportWizard { public MigrationWizard(ProvisioningUI ui, InstallOperation operation, Collection<IInstallableUnit> initialSelections, LoadMetadataRepositoryJob preloadJob) { super(ui, operation, initialSelections, preloadJob); - IDialogSettings workbenchSettings = ProvUIActivator.getDefault().getDialogSettings(); - String sectionName = "MigrationWizard"; //$NON-NLS-1$ - IDialogSettings section = workbenchSettings.getSection(sectionName); - if (section == null) { - section = workbenchSettings.addNewSection(sectionName); - } - setDialogSettings(section); } public void init(IWorkbench workbench, IStructuredSelection selection) { diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizardDialog.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizardDialog.java new file mode 100644 index 000000000..ac0f522f5 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizardDialog.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2013 Ericsson AB 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: + * Ericsson AB - initial API and implementation + * Ericsson AB (Hamdan Msheik) + * Ericsson AB (Pascal Rapicault) + *******************************************************************************/ + +package org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration; + +import org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard; +import org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdatePlugin; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Shell; + +/** + * Subclass of WizardDialog that provides bounds saving behavior. + * @since 3.5 + * + */ +public class MigrationWizardDialog extends WizardDialog { + private ProvisioningOperationWizard wizard; + + public MigrationWizardDialog(Shell parent, ProvisioningOperationWizard wizard) { + super(parent, wizard); + this.wizard = wizard; + setShellStyle(getShellStyle() | SWT.RESIZE); + } + + protected IDialogSettings getDialogBoundsSettings() { + IDialogSettings settings = AutomaticUpdatePlugin.getDefault().getDialogSettings(); + IDialogSettings section = settings.getSection(wizard.getDialogSettingsSectionName()); + if (section == null) { + section = settings.addNewSection(wizard.getDialogSettingsSectionName()); + // Set initial bound values for the MigrationWizardDialog so that it does not cover all the height of the screen when migrating a large set of IUs. + section.put("DIALOG_WIDTH", 883); + section.put("DIALOG_HEIGHT", 691); + + } + return section; + } + + /** + * @see org.eclipse.jface.window.Window#close() + */ + public boolean close() { + if (getShell() != null && !getShell().isDisposed()) { + wizard.saveBoundsRelatedSettings(); + } + return super.close(); + } + +} |