diff -r 4eae2726ff31 -r bb528d06abcd core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/AbstractImportExportPage.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/AbstractImportExportPage.java Thu Aug 12 13:56:20 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/AbstractImportExportPage.java Thu Aug 12 15:22:11 2010 -0500 @@ -1,25 +1,26 @@ /* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ package com.nokia.carbide.internal.discovery.ui.wizard; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.resource.ImageDescriptor; @@ -52,61 +53,68 @@ protected Text pathText; protected Button browseButton; protected CheckboxTableViewer viewer; - protected static final ImageDescriptor FEATURE_IMGDESC = - Activator.getImageDescriptor("icons/iu_obj.gif"); //$NON-NLS-1$ + protected static final ImageDescriptor FEATURE_IMGDESC = Activator + .getImageDescriptor("icons/iu_obj.gif"); //$NON-NLS-1$ protected Image featureImg; public AbstractImportExportPage(String pageName) { super(pageName); } - + public void createControl(Composite parent) { - initializeDialogUnits(parent); - featureImg = FEATURE_IMGDESC.createImage(); + initializeDialogUnits(parent); + featureImg = FEATURE_IMGDESC.createImage(); - Composite composite = new Composite(parent, SWT.NONE); - GridLayoutFactory.swtDefaults().numColumns(2).applyTo(composite); - GridDataFactory.fillDefaults().applyTo(composite); - composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + Composite composite = new Composite(parent, SWT.NONE); + GridLayoutFactory.swtDefaults().numColumns(2).applyTo(composite); + GridDataFactory.fillDefaults().applyTo(composite); + composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); - setControl(composite); + Dialog.applyDialogFont(composite); + setControl(composite); } protected void createBrowseGroup(Composite parent, String labelText) { - Composite composite = new Composite(parent, SWT.NONE); - GridLayoutFactory.fillDefaults().numColumns(3).applyTo(composite); - GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).span(2, 1).applyTo(composite); - - Label label = new Label(composite, SWT.NONE); - label.setText(labelText); - - pathText = new Text(composite, SWT.BORDER); - GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).hint(250, SWT.DEFAULT).applyTo(pathText); - pathText.addModifyListener(new ModifyListener() { + Composite composite = new Composite(parent, SWT.NONE); + GridLayoutFactory.fillDefaults().numColumns(3).applyTo(composite); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING) + .grab(true, false).applyTo(composite); + + Label label = new Label(composite, SWT.NONE); + label.setText(labelText); + + pathText = new Text(composite, SWT.BORDER); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER) + .grab(true, false).hint(250, SWT.DEFAULT).applyTo(pathText); + pathText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { setPageComplete(validatePage()); } - }); - browseButton = new Button(composite, SWT.PUSH); - browseButton.setText("Browse..."); - browseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - setButtonLayoutData(browseButton); + }); + browseButton = new Button(composite, SWT.PUSH); + browseButton.setText("Browse..."); + browseButton + .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + setButtonLayoutData(browseButton); + + new Label(parent, SWT.NONE); // spacer } protected void createViewerGroup(Composite parent, String labelText) { Label label = new Label(parent, SWT.NONE); label.setText(labelText); GridDataFactory.defaultsFor(label).span(2, 1).applyTo(label); - + viewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER); - TableViewerColumn featureColumn = new TableViewerColumn(viewer, SWT.CENTER); + TableViewerColumn featureColumn = new TableViewerColumn(viewer, + SWT.CENTER); featureColumn.getColumn().setText("Feature"); featureColumn.setLabelProvider(new ColumnLabelProvider() { @Override public Image getImage(Object element) { return featureImg; } - + @Override public String getText(Object element) { if (element instanceof FeatureInfo) @@ -114,7 +122,8 @@ return null; } }); - TableViewerColumn versionColumn = new TableViewerColumn(viewer, SWT.CENTER); + TableViewerColumn versionColumn = new TableViewerColumn(viewer, + SWT.CENTER); versionColumn.getColumn().setText("Version"); versionColumn.setLabelProvider(new ColumnLabelProvider() { @Override @@ -125,14 +134,16 @@ return null; } }); - + viewer.getControl().setLayoutData( - new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL + | GridData.GRAB_VERTICAL)); viewer.setContentProvider(new ArrayContentProvider()); viewer.getTable().setHeaderVisible(true); - + Composite buttonComposite = new Composite(parent, SWT.NONE); - GridDataFactory.swtDefaults().align(SWT.END, SWT.BEGINNING).applyTo(buttonComposite); + GridDataFactory.swtDefaults().align(SWT.END, SWT.BEGINNING) + .applyTo(buttonComposite); buttonComposite.setLayout(new GridLayout()); Button checkAllButton = new Button(buttonComposite, SWT.PUSH); checkAllButton.setText("Select All"); @@ -153,7 +164,7 @@ } }); } - + protected abstract boolean validatePage(); public Collection getSelectedFeatures() { @@ -164,7 +175,7 @@ } return infos; } - + protected void packColumns() { TableColumn[] columns = viewer.getTable().getColumns(); for (TableColumn column : columns) { @@ -177,7 +188,7 @@ viewer.setAllChecked(true); setPageComplete(validatePage()); } - + @Override public void dispose() { super.dispose();