|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2009, 2014 IBM Corporation and others. |
2 |
* Copyright (c) 2009, 2015 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 16-21
Link Here
|
| 16 |
import java.util.concurrent.atomic.AtomicBoolean; |
16 |
import java.util.concurrent.atomic.AtomicBoolean; |
| 17 |
import org.eclipse.core.runtime.*; |
17 |
import org.eclipse.core.runtime.*; |
| 18 |
import org.eclipse.equinox.internal.p2.ui.ProvUI; |
18 |
import org.eclipse.equinox.internal.p2.ui.ProvUI; |
|
|
19 |
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages; |
| 19 |
import org.eclipse.equinox.internal.p2.ui.actions.PropertyDialogAction; |
20 |
import org.eclipse.equinox.internal.p2.ui.actions.PropertyDialogAction; |
| 20 |
import org.eclipse.equinox.internal.p2.ui.dialogs.*; |
21 |
import org.eclipse.equinox.internal.p2.ui.dialogs.*; |
| 21 |
import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext; |
22 |
import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext; |
|
Lines 303-309
Link Here
|
| 303 |
GridData data = (GridData) fAvailableIUGroup.getStructuredViewer().getControl().getLayoutData(); |
304 |
GridData data = (GridData) fAvailableIUGroup.getStructuredViewer().getControl().getLayoutData(); |
| 304 |
data.heightHint = 200; |
305 |
data.heightHint = 200; |
| 305 |
|
306 |
|
| 306 |
fSelectionCount = SWTFactory.createLabel(parent, NLS.bind(Messages.EditIUContainerPage_itemsSelected, Integer.toString(0)), 1); |
307 |
|
|
|
308 |
Composite buttonParent = new Composite(parent, SWT.NONE); |
| 309 |
GridLayout gridLayout = new GridLayout(); |
| 310 |
gridLayout.numColumns = 3; |
| 311 |
gridLayout.marginWidth = 0; |
| 312 |
gridLayout.horizontalSpacing = 10; |
| 313 |
buttonParent.setLayout(gridLayout); |
| 314 |
|
| 315 |
GridData gridData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); |
| 316 |
buttonParent.setLayoutData(gridData); |
| 317 |
|
| 318 |
Button selectAll = new Button(buttonParent, SWT.PUSH); |
| 319 |
selectAll.setText(ProvUIMessages.SelectableIUsPage_Select_All); |
| 320 |
GridData selectAllData = setButtonLayoutData(selectAll); |
| 321 |
selectAllData.widthHint = 90; |
| 322 |
|
| 323 |
selectAll.addListener(SWT.Selection, new Listener() { |
| 324 |
@Override |
| 325 |
public void handleEvent(Event event) { |
| 326 |
setAllChecked(true); |
| 327 |
} |
| 328 |
}); |
| 329 |
|
| 330 |
Button deselectAll = new Button(buttonParent, SWT.PUSH); |
| 331 |
deselectAll.setText(ProvUIMessages.SelectableIUsPage_Deselect_All); |
| 332 |
GridData deselectAllData = setButtonLayoutData(deselectAll); |
| 333 |
deselectAllData.widthHint = 90; |
| 334 |
deselectAll.addListener(SWT.Selection, new Listener() { |
| 335 |
@Override |
| 336 |
public void handleEvent(Event event) { |
| 337 |
setAllChecked(false); |
| 338 |
} |
| 339 |
}); |
| 340 |
fSelectionCount = SWTFactory.createLabel(buttonParent, NLS.bind(Messages.EditIUContainerPage_itemsSelected, Integer.toString(0)), 1); |
| 341 |
GridData labelData = new GridData(); |
| 342 |
labelData.widthHint = 100; |
| 343 |
fSelectionCount.setLayoutData(labelData); |
| 344 |
} |
| 345 |
|
| 346 |
@SuppressWarnings("deprecation") |
| 347 |
void setAllChecked(boolean checked) { |
| 348 |
if (checked) { |
| 349 |
// TODO ideally there should be API on AvailableIUGroup to do this. |
| 350 |
// This is reachy and too knowledgeable of the group's implementation. |
| 351 |
fAvailableIUGroup.getCheckboxTreeViewer().setAllChecked(checked); |
| 352 |
// to ensure that the listeners get processed. |
| 353 |
fAvailableIUGroup.setChecked(fAvailableIUGroup.getCheckboxTreeViewer().getCheckedElements()); |
| 354 |
|
| 355 |
} else { |
| 356 |
fAvailableIUGroup.setChecked(new Object[0]); |
| 357 |
} |
| 358 |
updateSelection(); |
| 359 |
} |
| 360 |
|
| 361 |
void updateSelection() { |
| 362 |
int count = fAvailableIUGroup.getCheckedLeafIUs().length; |
| 363 |
setPageComplete(count > 0); |
| 364 |
if (count == 0) { |
| 365 |
fSelectionCount.setText(""); //$NON-NLS-1$ |
| 366 |
} else { |
| 367 |
String message = count == 1 ? ProvUIMessages.AvailableIUsPage_SingleSelectionCount : ProvUIMessages.AvailableIUsPage_MultipleSelectionCount; |
| 368 |
fSelectionCount.setText(NLS.bind(message, Integer.toString(count))); |
| 369 |
} |
| 370 |
|
| 307 |
} |
371 |
} |
| 308 |
|
372 |
|
| 309 |
/** |
373 |
/** |