Search in sources :

Example 1 with SelectProjectComponentBuilder

use of org.jboss.tools.openshift.internal.common.ui.SelectProjectComponentBuilder in project jbosstools-openshift by jbosstools.

the class ApplicationSourceListPage method createEclipseProjectControls.

private IObservableValue createEclipseProjectControls(Composite parent, DataBindingContext dbc) {
    IObservableValue eclipseProjectObservable = BeanProperties.value(IApplicationSourceListPageModel.PROPERTY_ECLIPSE_PROJECT).observe(model);
    SelectProjectComponentBuilder builder = new SelectProjectComponentBuilder();
    builder.setTextLabel("Use existing workspace project:").setRequired(false).setEclipseProjectObservable(eclipseProjectObservable).setSelectionListener(onBrowseProjects()).setButtonIndent(0).build(parent, dbc);
    Link gitLabel = new Link(parent, SWT.NONE);
    gitLabel.setText("The project needs to be <a>shared with Git</a> and have a remote repository accessible by OpenShift");
    gitLabel.addSelectionListener(onClickEGitLink());
    GridDataFactory.fillDefaults().span(3, 1).applyTo(gitLabel);
    DataBindingUtils.addDisposableValueChangeListener(new IValueChangeListener() {

        @Override
        public void handleValueChange(ValueChangeEvent event) {
            org.eclipse.core.resources.IProject p = (org.eclipse.core.resources.IProject) event.getObservableValue().getValue();
            toggleEgitLink(gitLabel, p);
        }
    }, eclipseProjectObservable, gitLabel);
    toggleEgitLink(gitLabel, model.getEclipseProject());
    return builder.getProjectNameTextObservable();
}
Also used : IValueChangeListener(org.eclipse.core.databinding.observable.value.IValueChangeListener) ValueChangeEvent(org.eclipse.core.databinding.observable.value.ValueChangeEvent) SelectProjectComponentBuilder(org.jboss.tools.openshift.internal.common.ui.SelectProjectComponentBuilder) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue) Link(org.eclipse.swt.widgets.Link)

Example 2 with SelectProjectComponentBuilder

use of org.jboss.tools.openshift.internal.common.ui.SelectProjectComponentBuilder in project jbosstools-openshift by jbosstools.

the class ServerSettingsWizardPage method createProjectControls.

private void createProjectControls(Composite parent, ServerSettingsWizardPageModel model, DataBindingContext dbc) {
    @SuppressWarnings("unchecked") IObservableValue<IProject> eclipseProjectObservable = BeanProperties.value(ServerSettingsWizardPageModel.PROPERTY_DEPLOYPROJECT).observe(model);
    new SelectProjectComponentBuilder().setTextLabel("Eclipse Project: ").setEclipseProjectObservable(eclipseProjectObservable).setSelectionListener(onBrowseProjects(model, parent.getShell())).build(parent, dbc);
    Button importButton = new Button(parent, SWT.PUSH);
    importButton.setText(OpenShiftCommonUIMessages.ImportButtonLabel);
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(importButton);
    UIUtils.setDefaultButtonWidth(importButton);
    importButton.addSelectionListener(onImportProject(model, parent.getShell()));
}
Also used : Button(org.eclipse.swt.widgets.Button) SelectProjectComponentBuilder(org.jboss.tools.openshift.internal.common.ui.SelectProjectComponentBuilder) IProject(org.eclipse.core.resources.IProject)

Aggregations

SelectProjectComponentBuilder (org.jboss.tools.openshift.internal.common.ui.SelectProjectComponentBuilder)2 IObservableValue (org.eclipse.core.databinding.observable.value.IObservableValue)1 IValueChangeListener (org.eclipse.core.databinding.observable.value.IValueChangeListener)1 ValueChangeEvent (org.eclipse.core.databinding.observable.value.ValueChangeEvent)1 IProject (org.eclipse.core.resources.IProject)1 Button (org.eclipse.swt.widgets.Button)1 Link (org.eclipse.swt.widgets.Link)1