use of org.eclipse.ui.internal.dialogs.SimpleWorkingSetSelectionDialog in project eclipse.platform.ui by eclipse-platform.
the class WorkingSetConfigurationBlock method createContent.
/**
* Add this block to the <code>parent</code>
*
* @param parent the parent to add the block to
*/
public void createContent(final Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
composite.setLayout(new GridLayout(3, false));
enableButton = new Button(composite, SWT.CHECK);
enableButton.setText(enableButtonLabel);
GridData enableData = new GridData(SWT.FILL, SWT.CENTER, true, false);
enableData.horizontalSpan = 2;
enableButton.setLayoutData(enableData);
enableButton.setSelection(selectedWorkingSets.length > 0);
newButton = new Button(composite, SWT.PUSH);
newButton.setText(this.newButtonLabel);
setButtonLayoutData(newButton);
newButton.addSelectionListener(widgetSelectedAdapter(e -> createNewWorkingSet(newButton.getShell())));
workingSetLabel = new Label(composite, SWT.NONE);
workingSetLabel.setText(comboLabel);
workingSetCombo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false);
textData.horizontalIndent = 0;
workingSetCombo.setLayoutData(textData);
selectButton = new Button(composite, SWT.PUSH);
selectButton.setText(selectLabel);
setButtonLayoutData(selectButton);
selectButton.addSelectionListener(widgetSelectedAdapter(e -> {
SimpleWorkingSetSelectionDialog dialog = new SimpleWorkingSetSelectionDialog(parent.getShell(), workingSetTypeIds, selectedWorkingSets, false);
dialog.setMessage(WorkbenchMessages.WorkingSetGroup_WorkingSetSelection_message);
if (dialog.open() == Window.OK) {
IWorkingSet[] result = dialog.getSelection();
if (result != null && result.length > 0) {
selectedWorkingSets = result;
PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(result[0]);
} else {
selectedWorkingSets = EMPTY_WORKING_SET_ARRAY;
}
updateWorkingSetSelection();
}
}));
enableButton.addSelectionListener(widgetSelectedAdapter(e -> updateEnableState(enableButton.getSelection())));
updateEnableState(enableButton.getSelection());
workingSetCombo.addSelectionListener(widgetSelectedAdapter(e -> updateSelectedWorkingSets()));
workingSetCombo.setItems(getHistoryEntries());
if (selectedWorkingSets.length == 0 && selectionHistory.size() > 0) {
workingSetCombo.select(historyIndex(selectionHistory.get(0)));
updateSelectedWorkingSets();
} else {
updateWorkingSetSelection();
}
}
Aggregations