# HG changeset patch # User timkelly # Date 1277413134 18000 # Node ID 71d1c8d0e56d6ba3afa5146a55425a34b74be0a0 # Parent ac789a0152a8039c4356c9c1e7aaffeafa6bd44c add selectionListener on Remove Variant button. Only enable when a variant is selected. diff -r ac789a0152a8 -r 71d1c8d0e56d core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Wed Jun 23 14:23:08 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Thu Jun 24 15:58:54 2010 -0500 @@ -26,8 +26,10 @@ import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; @@ -94,6 +96,16 @@ customVariantListViewer.getList().setLayoutData(gd); customVariantListViewer.setContentProvider(new ArrayContentProvider()); customVariantListViewer.setLabelProvider(new LabelProvider()); + customVariantListViewer.addSelectionChangedListener( new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + if (customVariantListViewer.getSelection() != null && !customVariantListViewer.getSelection().isEmpty()){ + removeVariantButton.setEnabled(true); + } else { + removeVariantButton.setEnabled(false); + } + } + }); refreshButton = new Button(this, SWT.NONE); refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonText")); //$NON-NLS-1$ @@ -162,6 +174,7 @@ removeVariantButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RemoveProductButtonText")); //$NON-NLS-1$ removeVariantButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.RemoveProductButtonToolTip")); //$NON-NLS-1$ removeVariantButton.setLayoutData(gridData); + removeVariantButton.setEnabled(false); removeVariantButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {widgetSelected(e);} @@ -174,6 +187,7 @@ data.remove(stringSelection); customVariantListViewer.setInput(data); customVariantListViewer.refresh(true); + removeVariantButton.setEnabled(false); } }