use of org.eclipse.core.databinding.observable.list.IObservableList in project linuxtools by eclipse.
the class ImageSearchPage method createControl.
@Override
public void createControl(final Composite parent) {
final int COLUMNS = 3;
final Composite container = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1).grab(true, false).applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(6, 6).spacing(10, 2).applyTo(container);
// search text
final Label searchImageLabel = new Label(container, SWT.NONE);
searchImageLabel.setText(// $NON-NLS-1$
WizardMessages.getString("ImageSearchPage.imageLabel"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(searchImageLabel);
final Text searchImageText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(searchImageText);
searchImageText.addKeyListener(onKeyPressed());
searchImageText.addTraverseListener(onSearchImageTextTraverse());
final Button searchImageButton = new Button(container, SWT.NONE);
searchImageButton.setText(// $NON-NLS-1$
WizardMessages.getString("ImageSearchPage.search"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(searchImageButton);
searchImageButton.addSelectionListener(onSearchImageButtonSelected());
// result table
final Label searchResultLabel = new Label(container, SWT.NONE);
searchResultLabel.setText(// $NON-NLS-1$
WizardMessages.getString("ImageSearchPage.searchResultLabel"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(COLUMNS, 1).applyTo(searchResultLabel);
final Table table = new Table(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
final TableViewer searchResultTableViewer = new TableViewer(table);
table.setHeaderVisible(true);
table.setLinesVisible(true);
addTableViewerColum(searchResultTableViewer, // $NON-NLS-1$
WizardMessages.getString("ImageSearchPage.nameColumn"), SWT.NONE, SWT.RIGHT, 290, new ImageNameColumnLabelProvider());
addTableViewerColum(searchResultTableViewer, // $NON-NLS-1$
WizardMessages.getString("ImageSearchPage.starsColumn"), SWT.NONE, SWT.RIGHT, 70, new ImageStarsColumnLabelProvider());
addTableViewerColum(searchResultTableViewer, // $NON-NLS-1$
WizardMessages.getString("ImageSearchPage.officialColumn"), SWT.NONE, SWT.CENTER, 70, new ImageOfficialColumnLabelProvider());
addTableViewerColum(searchResultTableViewer, // $NON-NLS-1$
WizardMessages.getString("ImageSearchPage.automatedColumn"), SWT.NONE, SWT.CENTER, 70, new ImageAutomatedColumnLabelProvider());
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).span(COLUMNS, 1).hint(200, 100).applyTo(table);
// description text area
final Group selectedImageDescriptionGroup = new Group(container, SWT.NONE);
// $NON-NLS-1$
selectedImageDescriptionGroup.setText(WizardMessages.getString("ImageSearchPage.descriptionGroup"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, true).span(COLUMNS, 1).applyTo(selectedImageDescriptionGroup);
GridLayoutFactory.fillDefaults().margins(6, 6).spacing(10, 2).applyTo(selectedImageDescriptionGroup);
final Label selectedImageDescription = new Label(selectedImageDescriptionGroup, SWT.WRAP);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, true).hint(200, 100).applyTo(selectedImageDescription);
// bind the search term
final IObservableValue observableTermModel = BeanProperties.value(ImageSearchModel.class, ImageSearchModel.TERM).observe(model);
final ISWTObservableValue imageSearchTextObservable = WidgetProperties.text(SWT.Modify).observe(searchImageText);
ctx.bindValue(imageSearchTextObservable, observableTermModel, new UpdateValueStrategy().setBeforeSetValidator(new SearchTermValidator(searchImageButton)), null);
// observe the viewer content
searchResultTableViewer.setContentProvider(new ObservableListContentProvider());
// observe the viewer content
final IObservableList observableSearchResultModel = BeanProperties.list(ImageSearchModel.class, ImageSearchModel.IMAGE_SEARCH_RESULT).observe(model);
searchResultTableViewer.setInput(observableSearchResultModel);
// observe the viewer selection
ctx.bindValue(ViewerProperties.singleSelection().observe(searchResultTableViewer), BeanProperties.value(ImageSearchModel.SELECTED_IMAGE).observe(model));
// observe the viewer selection to update the description label
final IObservableValue observableSelectedImageDescription = PojoProperties.value("description", // $NON-NLS-1$
String.class).observeDetail(ViewerProperties.singleSelection().observe(searchResultTableViewer));
ctx.bindValue(WidgetProperties.text().observe(selectedImageDescription), observableSelectedImageDescription);
searchImageText.setFocus();
// attach the Databinding context status to this wizard page.
WizardPageSupport.create(this, this.ctx);
setControl(container);
// trigger a search if an image name was provided
if (model.getTerm() != null && !model.getTerm().isEmpty()) {
searchImages();
}
}
use of org.eclipse.core.databinding.observable.list.IObservableList in project InformationSystem by ObeoNetwork.
the class ExportProjectAsLibraryManifestPage method initDataBindings.
@SuppressWarnings({ "rawtypes", "unchecked" })
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue observeTextTxtProjectIdObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtProjectId);
IObservableValue projectIdWizardgetModelObserveValue = PojoProperties.value("projectId").observe(wizard.getModel());
bindingContext.bindValue(observeTextTxtProjectIdObserveWidget, projectIdWizardgetModelObserveValue, null, null);
//
IObservableValue observeTextTxtVersionObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtVersion);
IObservableValue versionWizardgetModelObserveValue = PojoProperties.value("version").observe(wizard.getModel());
bindingContext.bindValue(observeTextTxtVersionObserveWidget, versionWizardgetModelObserveValue, null, null);
//
IObservableValue observeTextTxtCommentObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtComment);
IObservableValue commentWizardgetModelObserveValue = PojoProperties.value("comment").observe(wizard.getModel());
bindingContext.bindValue(observeTextTxtCommentObserveWidget, commentWizardgetModelObserveValue, null, null);
//
ObservableListContentProvider listContentProvider = new ObservableListContentProvider();
IObservableMap[] observeMaps = PojoObservables.observeMaps(listContentProvider.getKnownElements(), MManifest.class, new String[] { "version", "projectId", "comment" });
tableViewer.setLabelProvider(new ObservableMapLabelProvider(observeMaps));
tableViewer.setContentProvider(listContentProvider);
//
IObservableList previousVersionsWizardgetModelObserveList = PojoProperties.list("previousVersions").observe(wizard.getModel());
tableViewer.setInput(previousVersionsWizardgetModelObserveList);
//
return bindingContext;
}
use of org.eclipse.core.databinding.observable.list.IObservableList in project InformationSystem by ObeoNetwork.
the class ExportProjectAsLibraryProjectSelectionPage method initDataBindings.
@SuppressWarnings({ "rawtypes", "unchecked" })
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
ObservableListContentProvider listContentProvider = new ObservableListContentProvider();
IObservableMap observeMap = PojoObservables.observeMap(listContentProvider.getKnownElements(), ModelingProject.class, "project.name");
listViewer.setLabelProvider(new ObservableMapLabelProvider(observeMap));
listViewer.setContentProvider(listContentProvider);
//
IObservableList modelingProjectsWizardgetModelObserveList = PojoProperties.list("modelingProjects").observe(wizard.getModel());
listViewer.setInput(modelingProjectsWizardgetModelObserveList);
//
IObservableValue observeSingleSelectionListViewer_1 = ViewerProperties.singleSelection().observe(listViewer);
IObservableValue selectedModelingProjectWizardgetModelObserveValue = PojoProperties.value("selectedModelingProject").observe(wizard.getModel());
bindingContext.bindValue(observeSingleSelectionListViewer_1, selectedModelingProjectWizardgetModelObserveValue, null, null);
//
IObservableValue observeTextTxtMarFileObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtMarFile);
IObservableValue filePathWizardgetModelObserveValue = PojoProperties.value("filePath").observe(wizard.getModel());
bindingContext.bindValue(observeTextTxtMarFileObserveWidget, filePathWizardgetModelObserveValue, null, null);
//
return bindingContext;
}
use of org.eclipse.core.databinding.observable.list.IObservableList in project InformationSystem by ObeoNetwork.
the class ImportLibraryIntoProjectFileSelectionPage method initDataBindings.
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
ObservableListContentProvider listContentProvider = new ObservableListContentProvider();
IObservableMap observeMap = PojoObservables.observeMap(listContentProvider.getKnownElements(), ModelingProject.class, "project.name");
comboViewer.setLabelProvider(new ObservableMapLabelProvider(observeMap));
comboViewer.setContentProvider(listContentProvider);
//
IObservableList modelingProjectsWizardgetModelObserveList = PojoProperties.list("modelingProjects").observe(wizard.getModel());
comboViewer.setInput(modelingProjectsWizardgetModelObserveList);
//
IObservableValue observeTextTxtMarFileObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtMarFile);
IObservableValue filepathWizardgetModelObserveValue = PojoProperties.value("filepath").observe(wizard.getModel());
bindingContext.bindValue(observeTextTxtMarFileObserveWidget, filepathWizardgetModelObserveValue, null, null);
//
IObservableValue observeTextTxtProjectIdObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtProjectId);
IObservableValue projectIDWizardgetModelObserveValue = PojoProperties.value("projectID").observe(wizard.getModel());
bindingContext.bindValue(observeTextTxtProjectIdObserveWidget, projectIDWizardgetModelObserveValue, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null);
//
IObservableValue observeTextTxtVersionObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtVersion);
IObservableValue versionWizardgetModelObserveValue = PojoProperties.value("version").observe(wizard.getModel());
bindingContext.bindValue(observeTextTxtVersionObserveWidget, versionWizardgetModelObserveValue, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null);
//
IObservableValue observeTextTxtCommentObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtComment);
IObservableValue commentWizardgetModelObserveValue = PojoProperties.value("comment").observe(wizard.getModel());
bindingContext.bindValue(observeTextTxtCommentObserveWidget, commentWizardgetModelObserveValue, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null);
//
IObservableValue observeTextTxtCreationDateObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtCreationDate);
IObservableValue creationDateWizardgetModelObserveValue = PojoProperties.value("creationDate").observe(wizard.getModel());
bindingContext.bindValue(observeTextTxtCreationDateObserveWidget, creationDateWizardgetModelObserveValue, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null);
//
IObservableValue observeSingleSelectionComboViewer = ViewerProperties.singleSelection().observe(comboViewer);
IObservableValue modelingProjectWizardgetModelObserveValue = PojoProperties.value("modelingProject").observe(wizard.getModel());
bindingContext.bindValue(observeSingleSelectionComboViewer, modelingProjectWizardgetModelObserveValue, null, null);
//
return bindingContext;
}
use of org.eclipse.core.databinding.observable.list.IObservableList in project jbosstools-openshift by jbosstools.
the class FormPresenterSupport method init.
/**
* @noreference This method is not intended to be referenced by clients.
*/
protected void init() {
ObservableTracker.setIgnore(true);
try {
aggregateStatusProvider = new MaxSeverityValidationStatusProvider(dbc);
} finally {
ObservableTracker.setIgnore(false);
}
aggregateStatusProvider.addValueChangeListener(new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event) {
statusProviderChanged();
}
});
formPresenter.getControl().addListener(SWT.Dispose, new Listener() {
@Override
public void handleEvent(Event event) {
dispose();
}
});
aggregateStatusProvider.addStaleListener(new IStaleListener() {
@Override
public void handleStale(StaleEvent staleEvent) {
currentStatusStale = true;
handleStatusChanged();
}
});
statusProviderChanged();
dbc.getValidationStatusProviders().addListChangeListener(validationStatusProvidersListener);
for (Iterator it = dbc.getValidationStatusProviders().iterator(); it.hasNext(); ) {
ValidationStatusProvider validationStatusProvider = (ValidationStatusProvider) it.next();
IObservableList targets = validationStatusProvider.getTargets();
targets.addListChangeListener(validationStatusProviderTargetsListener);
for (Iterator iter = targets.iterator(); iter.hasNext(); ) {
((IObservable) iter.next()).addChangeListener(uiChangeListener);
}
}
}
Aggregations