Search in sources :

Example 6 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project azure-tools-for-java by Microsoft.

the class CreateArmStorageAccountForm method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    setTitle("Create New Storage Account");
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "com.microsoft.azuretools.azureexplorer.storage_account_dialog");
    Composite container = new Composite(parent, SWT.FILL);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridLayout.marginBottom = 10;
    container.setLayout(gridLayout);
    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = SWT.FILL;
    //		gridData.widthHint = 250;
    container.setLayoutData(gridData);
    nameLabel = new Label(container, SWT.LEFT);
    nameLabel.setText("Name:");
    nameTextField = new Text(container, SWT.LEFT | SWT.BORDER);
    //        gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    nameTextField.setLayoutData(gridDataForText(180));
    subscriptionLabel = new Label(container, SWT.LEFT);
    subscriptionLabel.setText("Subscription:");
    subscriptionComboBox = new Combo(container, SWT.READ_ONLY);
    subscriptionComboBox.setLayoutData(gridDataForText(180));
    resourceGroupLabel = new Label(container, SWT.LEFT);
    resourceGroupLabel.setText("Resource group:");
    gridData = new GridData();
    gridData.verticalAlignment = SWT.TOP;
    resourceGroupLabel.setLayoutData(gridData);
    final Composite composite = new Composite(container, SWT.NONE);
    gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.verticalAlignment = GridData.BEGINNING;
    gridData.grabExcessHorizontalSpace = true;
    //        gridData.widthHint = 250;
    composite.setLayout(gridLayout);
    composite.setLayoutData(gridData);
    createNewRadioButton = new Button(composite, SWT.RADIO);
    createNewRadioButton.setText("Create new");
    createNewRadioButton.setSelection(true);
    resourceGrpField = new Text(composite, SWT.LEFT | SWT.BORDER);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    resourceGrpField.setLayoutData(gridData);
    useExistingRadioButton = new Button(composite, SWT.RADIO);
    useExistingRadioButton.setText("Use existing");
    resourceGrpCombo = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    resourceGrpCombo.setLayoutData(gridData);
    resourceGroupViewer = new ComboViewer(resourceGrpCombo);
    resourceGroupViewer.setContentProvider(ArrayContentProvider.getInstance());
    SelectionListener updateListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            updateResourceGroup();
        }
    };
    createNewRadioButton.addSelectionListener(updateListener);
    useExistingRadioButton.addSelectionListener(updateListener);
    updateResourceGroup();
    regionLabel = new Label(container, SWT.LEFT);
    regionLabel.setText("Region:");
    regionComboBox = new Combo(container, SWT.READ_ONLY);
    regionComboBox.setLayoutData(gridDataForText(180));
    kindLabel = new Label(container, SWT.LEFT);
    kindLabel.setText("Account kind:");
    kindCombo = new Combo(container, SWT.READ_ONLY);
    kindCombo.setLayoutData(gridDataForText(180));
    performanceLabel = new Label(container, SWT.LEFT);
    performanceLabel.setText("Performance:");
    performanceCombo = new Combo(container, SWT.READ_ONLY);
    performanceCombo.setLayoutData(gridDataForText(180));
    replicationLabel = new Label(container, SWT.LEFT);
    replicationLabel.setText("Replication:");
    replicationComboBox = new Combo(container, SWT.READ_ONLY);
    replicationComboBox.setLayoutData(gridDataForText(180));
    if (subscription == null) {
        // not showing access tier with general purpose storage account which is used when creating vm
        accessTierLabel = new Label(container, SWT.LEFT);
        accessTierLabel.setText("Access Tier:");
        accessTierComboBox = new Combo(container, SWT.READ_ONLY);
        accessTierComboBox.setLayoutData(gridDataForText(180));
        for (AccessTier type : AccessTier.values()) {
            accessTierComboBox.add(type.toString());
            accessTierComboBox.setData(type.toString(), type);
        }
        accessTierComboBox.select(0);
    }
    pricingLabel = new Link(container, SWT.LEFT);
    pricingLabel.setText(PRICING_LINK);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    pricingLabel.setLayoutData(gridData);
    pricingLabel.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            try {
                PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(event.text));
            } catch (Exception ex) {
                /*
					 * only logging the error in log file
					 * not showing anything to end user
					 */
                Activator.getDefault().log("Error occurred while opening link in default browser.", ex);
            }
        }
    });
    nameTextField.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent modifyEvent) {
            validateEmptyFields();
        }
    });
    regionComboBox.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            validateEmptyFields();
        }
    });
    resourceGrpField.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent modifyEvent) {
            validateEmptyFields();
        }
    });
    resourceGrpCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            validateEmptyFields();
        }
    });
    fillFields();
    return super.createDialogArea(parent);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) AccessTier(com.microsoft.azure.management.storage.AccessTier) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) URL(java.net.URL) InvocationTargetException(java.lang.reflect.InvocationTargetException) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) ComboViewer(org.eclipse.jface.viewers.ComboViewer) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Link(org.eclipse.swt.widgets.Link) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 7 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project azure-tools-for-java by Microsoft.

the class SettingsStep method createSettingsPanel.

private void createSettingsPanel(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    GridData gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.verticalAlignment = GridData.BEGINNING;
    gridData.grabExcessHorizontalSpace = true;
    composite.setLayout(gridLayout);
    composite.setLayoutData(gridData);
    resourceGrpLabel = new Label(composite, SWT.LEFT);
    resourceGrpLabel.setText("Resource group:");
    final Composite container = new Composite(composite, SWT.NONE);
    gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.verticalAlignment = GridData.BEGINNING;
    // gridData.grabExcessHorizontalSpace = true;
    gridData.widthHint = 250;
    container.setLayout(gridLayout);
    container.setLayoutData(gridData);
    createNewRadioButton = new Button(container, SWT.RADIO);
    createNewRadioButton.setText("Create new");
    resourceGrpField = new Text(container, SWT.LEFT | SWT.BORDER);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    resourceGrpField.setLayoutData(gridData);
    useExistingRadioButton = new Button(container, SWT.RADIO);
    useExistingRadioButton.setText("Use existing");
    resourceGrpCombo = new Combo(container, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    resourceGrpCombo.setLayoutData(gridData);
    resourceGroupViewer = new ComboViewer(resourceGrpCombo);
    resourceGroupViewer.setContentProvider(ArrayContentProvider.getInstance());
    SelectionListener updateListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            handleResourceGroup();
        }
    };
    createNewRadioButton.addSelectionListener(updateListener);
    useExistingRadioButton.addSelectionListener(updateListener);
    createNewRadioButton.setSelection(true);
    handleResourceGroup();
    storageAccountLabel = new Label(composite, SWT.LEFT);
    storageAccountLabel.setText("Storage account:");
    storageComboBox = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    storageComboBox.setLayoutData(gridData);
    networkLabel = new Label(composite, SWT.LEFT);
    networkLabel.setText("Virtual Network:");
    networkComboBox = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    networkComboBox.setLayoutData(gridData);
    subnetLabel = new Label(composite, SWT.LEFT);
    subnetLabel.setText("Subnet:");
    subnetComboBox = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    subnetComboBox.setLayoutData(gridData);
    pipLabel = new Label(composite, SWT.LEFT);
    pipLabel.setText("Public IP address:");
    pipCombo = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    pipCombo.setLayoutData(gridData);
    nsgLabel = new Label(composite, SWT.LEFT);
    nsgLabel.setText("Network security group (firewall):");
    nsgCombo = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    nsgCombo.setLayoutData(gridData);
    availabilityLabel = new Label(composite, SWT.LEFT);
    availabilityLabel.setText("Availability set:");
    availabilityCombo = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    availabilityCombo.setLayoutData(gridData);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) ComboViewer(org.eclipse.jface.viewers.ComboViewer) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 8 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project tdi-studio-se by Talend.

the class MemoryRuntimeComposite method initContextInput.

@SuppressWarnings("unchecked")
private void initContextInput() {
    List<IContext> contextList = (List<IContext>) viewPart.getContextComposite().getContextComboInput();
    if (contextList != null) {
        contextCombo.setSelection(new StructuredSelection(contextList.get(0)));
        contextCombo.setInput(contextList);
        ComboViewer processContextComboViewer = viewPart.getContextComposite().getContextComboViewer();
        IContext selectedContext = (IContext) ((IStructuredSelection) processContextComboViewer.getSelection()).getFirstElement();
        for (int i = 0; i < contextList.size(); i++) {
            if (contextList.get(i).getName().equals(selectedContext.getName())) {
                contextCombo.getCombo().select(i);
            }
        }
        contextCombo.addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(SelectionChangedEvent event) {
                viewPart.getContextComposite().runSelectionChange(event);
            }
        });
    } else {
        contextCombo.getCombo().setEnabled(false);
    }
}
Also used : IContext(org.talend.core.model.process.IContext) ComboViewer(org.eclipse.jface.viewers.ComboViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) List(java.util.List) ArrayList(java.util.ArrayList) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Point(org.eclipse.swt.graphics.Point)

Example 9 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project tdi-studio-se by Talend.

the class LoginProjectPage method instantiateControl.

@Override
public void instantiateControl(Composite container) {
    /**
         * 1. Create all the control first
         */
    //$NON-NLS-1$
    String execute = Messages.getString("LoginProjectPage.execute");
    // Image openImage = ImageProvider.getImage(ERepositoryImages.OPEN_PROJECT_ICON);
    // Connection Area
    title = new Label(container, SWT.NONE);
    title.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    title.setText(Messages.getString("LoginProjectPage.title"));
    connectionManageArea = new Composite(container, SWT.NONE);
    connectionsViewer = new ComboViewer(connectionManageArea, SWT.READ_ONLY);
    connectionsViewer.getControl().setFont(LoginDialogV2.fixedFont);
    manageButton = new Button(connectionManageArea, SWT.NONE);
    manageButton.setFont(LoginDialogV2.fixedFont);
    manageButton.setBackground(backgroundColor);
    //$NON-NLS-1$
    manageButton.setText(Messages.getString("LoginProjectPage.manage"));
    // Project Operation Area
    projectOperationArea = new Composite(container, SWT.NONE);
    // Existing Project Area
    selectExistingProject = new Button(projectOperationArea, SWT.RADIO);
    selectExistingProject.setFont(LoginDialogV2.fixedFont);
    selectExistingProject.setBackground(backgroundColor);
    //$NON-NLS-1$
    selectExistingProject.setText(Messages.getString("LoginProjectPage.selectProject"));
    projectListArea = new Composite(projectOperationArea, SWT.NONE);
    projectViewer = new ListViewer(projectListArea, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    projectViewer.getControl().setFont(LoginDialogV2.fixedFont);
    projectViewer.setContentProvider(ArrayContentProvider.getInstance());
    projectViewer.setLabelProvider(new ProjectLabelProvider());
    projectViewer.setSorter(new ViewerSorter());
    // Branch Area
    branchArea = new Composite(projectListArea, SWT.NONE);
    branchLabel = new Label(branchArea, SWT.NONE);
    branchLabel.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    branchLabel.setText(Messages.getString("LoginProjectPage.Branch"));
    branchesViewer = new ComboViewer(branchArea, SWT.READ_ONLY);
    branchesViewer.getControl().setFont(LoginDialogV2.fixedFont);
    branchesViewer.setContentProvider(ArrayContentProvider.getInstance());
    branchesViewer.setLabelProvider(new LabelProvider());
    refreshProjectButton = new Button(branchArea, SWT.NONE);
    refreshProjectButton.setFont(LoginDialogV2.fixedFont);
    refreshProjectButton.setBackground(backgroundColor);
    refreshProjectButton.setImage(ImageProvider.getImage(EImage.REFRESH_ICON));
    // Create New Project
    createNewProject = new Button(projectOperationArea, SWT.RADIO);
    createNewProject.setFont(LoginDialogV2.fixedFont);
    createNewProject.setBackground(backgroundColor);
    //$NON-NLS-1$
    createNewProject.setText(Messages.getString("LoginProjectPage.createNewProject"));
    newProjectName = new Text(projectOperationArea, SWT.BORDER);
    newProjectName.setFont(LoginDialogV2.fixedFont);
    newProjectName.setBackground(backgroundColor);
    executeCreateNewProject = new Button(projectOperationArea, SWT.NONE);
    executeCreateNewProject.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    executeCreateNewProject.setText(Messages.getString("LoginProjectPage.create"));
    executeCreateNewProject.setBackground(backgroundColor);
    // Import Demo Project
    importDemoProject = new Button(projectOperationArea, SWT.RADIO);
    importDemoProject.setFont(LoginDialogV2.fixedFont);
    importDemoProject.setBackground(backgroundColor);
    //$NON-NLS-1$
    importDemoProject.setText(Messages.getString("LoginProjectPage.importDemoProject"));
    executeImportDemoProject = new Button(projectOperationArea, SWT.NONE);
    executeImportDemoProject.setFont(LoginDialogV2.fixedFont);
    // executeImportDemoProject.setImage(openImage);
    executeImportDemoProject.setText(execute);
    executeImportDemoProject.setBackground(backgroundColor);
    // Import Local Project
    importLocalProject = new Button(projectOperationArea, SWT.RADIO);
    importLocalProject.setFont(LoginDialogV2.fixedFont);
    importLocalProject.setBackground(backgroundColor);
    //$NON-NLS-1$
    importLocalProject.setText(Messages.getString("LoginProjectPage.importLocalProject"));
    executeImportLocalProject = new Button(projectOperationArea, SWT.NONE);
    executeImportLocalProject.setFont(LoginDialogV2.fixedFont);
    // executeImportLocalProject.setImage(openImage);
    executeImportLocalProject.setText(execute);
    executeImportLocalProject.setBackground(backgroundColor);
    // Create SandBox Project
    createSandBoxProject = new Button(projectOperationArea, SWT.RADIO);
    createSandBoxProject.setFont(LoginDialogV2.fixedFont);
    createSandBoxProject.setBackground(backgroundColor);
    //$NON-NLS-1$
    createSandBoxProject.setText(Messages.getString("LoginProjectPage.createSandBoxProject.title"));
    executeCreateSandBoxProject = new Button(projectOperationArea, SWT.NONE);
    executeCreateSandBoxProject.setFont(LoginDialogV2.fixedFont);
    // executeCreateSandBoxProject.setImage(openImage);
    executeCreateSandBoxProject.setText(execute);
    executeCreateSandBoxProject.setBackground(backgroundColor);
    super.instantiateControl(container);
}
Also used : ListViewer(org.eclipse.jface.viewers.ListViewer) Composite(org.eclipse.swt.widgets.Composite) ComboViewer(org.eclipse.jface.viewers.ComboViewer) Button(org.eclipse.swt.widgets.Button) Label(org.eclipse.swt.widgets.Label) ViewerSorter(org.eclipse.jface.viewers.ViewerSorter) Text(org.eclipse.swt.widgets.Text) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 10 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project tdi-studio-se by Talend.

the class ContextParameterPage method createControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
     */
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    container.setLayout(layout);
    GridData data;
    // Name
    Label nameLabel = new Label(container, SWT.NONE);
    //$NON-NLS-1$
    nameLabel.setText(Messages.getString("ContextParameterPage.name"));
    nameText = new Text(container, SWT.BORDER);
    nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // Comment
    Label commentLabel = new Label(container, SWT.NONE);
    //$NON-NLS-1$
    commentLabel.setText(Messages.getString("ContextParameterPage.comment"));
    commentLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    commentText = new Text(container, SWT.BORDER | SWT.MULTI | SWT.WRAP);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = 60;
    commentText.setLayoutData(data);
    // Type
    Label typeLabel = new Label(container, SWT.NONE);
    //$NON-NLS-1$
    typeLabel.setText(Messages.getString("ContextParameterPage.type"));
    typeViewer = new ComboViewer(container, SWT.BORDER | SWT.READ_ONLY);
    typeViewer.setContentProvider(ArrayContentProvider.getInstance());
    typeViewer.setLabelProvider(new LabelProvider());
    typeViewer.setInput(MetadataTalendType.getCxtParameterTalendTypesLabels());
    typeViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // Prompt
    Label promptLabel = new Label(container, SWT.NONE);
    //$NON-NLS-1$
    promptLabel.setText(Messages.getString("ContextParameterPage.prompt"));
    promptText = new Text(container, SWT.BORDER);
    promptText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // Prompt
    new Label(container, SWT.NONE);
    promptBtn = new Button(container, SWT.CHECK);
    //$NON-NLS-1$
    promptBtn.setText(Messages.getString("ContextParameterPage.shouldPrompt"));
    // Default
    Label defaultLabel = new Label(container, SWT.NONE);
    //$NON-NLS-1$
    defaultLabel.setText(Messages.getString("ContextParameterPage.defaultValue"));
    defaultText = new Text(container, SWT.BORDER);
    defaultText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    setControl(container);
    updateContent();
    addListeners();
    updatePageComplete();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ComboViewer(org.eclipse.jface.viewers.ComboViewer) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Aggregations

ComboViewer (org.eclipse.jface.viewers.ComboViewer)25 GridData (org.eclipse.swt.layout.GridData)22 Combo (org.eclipse.swt.widgets.Combo)16 Composite (org.eclipse.swt.widgets.Composite)16 Label (org.eclipse.swt.widgets.Label)16 GridLayout (org.eclipse.swt.layout.GridLayout)15 Button (org.eclipse.swt.widgets.Button)15 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)12 SelectionEvent (org.eclipse.swt.events.SelectionEvent)12 Text (org.eclipse.swt.widgets.Text)12 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)11 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)11 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)11 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)11 LabelProvider (org.eclipse.jface.viewers.LabelProvider)10 Group (org.eclipse.swt.widgets.Group)7 ISelection (org.eclipse.jface.viewers.ISelection)6 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)5 Point (org.eclipse.swt.graphics.Point)4 DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)4