|
Lines 15-20
Link Here
|
| 15 |
import java.net.URISyntaxException; |
15 |
import java.net.URISyntaxException; |
| 16 |
import org.eclipse.core.runtime.*; |
16 |
import org.eclipse.core.runtime.*; |
| 17 |
import org.eclipse.equinox.internal.p2.ui.ProvUI; |
17 |
import org.eclipse.equinox.internal.p2.ui.ProvUI; |
|
|
18 |
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages; |
| 18 |
import org.eclipse.equinox.internal.p2.ui.actions.PropertyDialogAction; |
19 |
import org.eclipse.equinox.internal.p2.ui.actions.PropertyDialogAction; |
| 19 |
import org.eclipse.equinox.internal.p2.ui.dialogs.*; |
20 |
import org.eclipse.equinox.internal.p2.ui.dialogs.*; |
| 20 |
import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext; |
21 |
import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext; |
|
Lines 47-52
Link Here
|
| 47 |
* @see EditBundleContainerWizard |
48 |
* @see EditBundleContainerWizard |
| 48 |
* @see AddBundleContainerWizard |
49 |
* @see AddBundleContainerWizard |
| 49 |
*/ |
50 |
*/ |
|
|
51 |
@SuppressWarnings("restriction") |
| 50 |
public class EditIUContainerPage extends WizardPage implements IEditBundleContainerPage { |
52 |
public class EditIUContainerPage extends WizardPage implements IEditBundleContainerPage { |
| 51 |
|
53 |
|
| 52 |
// Status for any errors on the page |
54 |
// Status for any errors on the page |
|
Lines 234-242
Link Here
|
| 234 |
GridData data = (GridData) fAvailableIUGroup.getStructuredViewer().getControl().getLayoutData(); |
236 |
GridData data = (GridData) fAvailableIUGroup.getStructuredViewer().getControl().getLayoutData(); |
| 235 |
data.heightHint = 200; |
237 |
data.heightHint = 200; |
| 236 |
|
238 |
|
| 237 |
fSelectionCount = SWTFactory.createLabel(parent, NLS.bind(Messages.EditIUContainerPage_itemsSelected, Integer.toString(0)), 1); |
239 |
Composite buttonParent = new Composite(parent, SWT.NONE); |
|
|
240 |
GridLayout gridLayout = new GridLayout(); |
| 241 |
gridLayout.numColumns = 3; |
| 242 |
gridLayout.marginWidth = 0; |
| 243 |
gridLayout.horizontalSpacing = 10; |
| 244 |
buttonParent.setLayout(gridLayout); |
| 245 |
|
| 246 |
GridData gridData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); |
| 247 |
buttonParent.setLayoutData(gridData); |
| 248 |
|
| 249 |
Button selectAll = new Button(buttonParent, SWT.PUSH); |
| 250 |
selectAll.setText(ProvUIMessages.SelectableIUsPage_Select_All); |
| 251 |
GridData selectAllData = setButtonLayoutData(selectAll); |
| 252 |
selectAllData.widthHint = 90; |
| 253 |
|
| 254 |
selectAll.addListener(SWT.Selection, new Listener() { |
| 255 |
@Override |
| 256 |
public void handleEvent(Event event) { |
| 257 |
setAllChecked(true); |
| 258 |
} |
| 259 |
}); |
| 260 |
|
| 261 |
Button deselectAll = new Button(buttonParent, SWT.PUSH); |
| 262 |
deselectAll.setText(ProvUIMessages.SelectableIUsPage_Deselect_All); |
| 263 |
GridData deselectAllData = setButtonLayoutData(deselectAll); |
| 264 |
deselectAllData.widthHint = 90; |
| 265 |
deselectAll.addListener(SWT.Selection, new Listener() { |
| 266 |
@Override |
| 267 |
public void handleEvent(Event event) { |
| 268 |
setAllChecked(false); |
| 269 |
} |
| 270 |
}); |
| 271 |
fSelectionCount = SWTFactory.createLabel(buttonParent, NLS.bind(Messages.EditIUContainerPage_itemsSelected, Integer.toString(0)), 1); |
| 272 |
GridData labelData = new GridData(); |
| 273 |
labelData.widthHint = 200; |
| 274 |
fSelectionCount.setLayoutData(labelData); |
| 238 |
} |
275 |
} |
| 239 |
|
276 |
|
|
|
277 |
void setAllChecked(boolean checked) { |
| 278 |
if (checked) { |
| 279 |
TreeItem[] items = fAvailableIUGroup.getCheckboxTreeViewer().getTree().getItems(); |
| 280 |
checkAll(checked, items); |
| 281 |
fAvailableIUGroup.setChecked(fAvailableIUGroup.getCheckboxTreeViewer().getCheckedElements()); |
| 282 |
} else { |
| 283 |
fAvailableIUGroup.setChecked(new Object[0]); |
| 284 |
} |
| 285 |
updateSelection(); |
| 286 |
} |
| 287 |
|
| 288 |
private void checkAll(boolean checked, TreeItem[] items) { |
| 289 |
for (int i = 0; i < items.length; i++) { |
| 290 |
items[i].setChecked(checked); |
| 291 |
TreeItem[] children = items[i].getItems(); |
| 292 |
checkAll(checked, children); |
| 293 |
} |
| 294 |
} |
| 295 |
|
| 296 |
void updateSelection() { |
| 297 |
int count = fAvailableIUGroup.getCheckedLeafIUs().length; |
| 298 |
setPageComplete(count > 0); |
| 299 |
String message; |
| 300 |
if (count == 0) { |
| 301 |
message = ProvUIMessages.AvailableIUsPage_MultipleSelectionCount; |
| 302 |
fSelectionCount.setText(NLS.bind(message, Integer.toString(count))); |
| 303 |
} else { |
| 304 |
message = count == 1 ? ProvUIMessages.AvailableIUsPage_SingleSelectionCount : ProvUIMessages.AvailableIUsPage_MultipleSelectionCount; |
| 305 |
fSelectionCount.setText(NLS.bind(message, Integer.toString(count))); |
| 306 |
} |
| 307 |
} |
| 240 |
/** |
308 |
/** |
| 241 |
* Details area underneath the group that displays more info on the selected IU |
309 |
* Details area underneath the group that displays more info on the selected IU |
| 242 |
* @param parent parent composite |
310 |
* @param parent parent composite |