List of usage examples for org.eclipse.jface.viewers ComboViewer ComboViewer
public ComboViewer(Composite parent, int style)
From source file:com.nokia.carbide.cpp.internal.project.ui.mmpEditor.LinkerSectionPart.java
License:Open Source License
/** * Fill the section/* w w w . j a v a 2 s . c o m*/ */ private void createClient(Section section, FormToolkit toolkit) { section.setText(Messages.LinkerSectionPart_title); Composite container = toolkit.createComposite(section); toolkit.paintBordersFor(container); final FormLayout formLayout = new FormLayout(); formLayout.marginHeight = 2; formLayout.marginWidth = 2; container.setLayout(formLayout); // section.setClient(container); final Label linkerDefinitionFileLabel = toolkit.createLabel(container, Messages.LinkerSectionPart_defFileLabel, SWT.NONE); final FormData formData_10 = new FormData(); formData_10.left = new FormAttachment(0, 16); formData_10.right = new FormAttachment(0, 200); formData_10.top = new FormAttachment(0, 5); linkerDefinitionFileLabel.setLayoutData(formData_10); defFileViewer = new ComboViewer(container, SWT.READ_ONLY | SWT.FLAT); defFileViewer.setContentProvider(new ArrayContentProvider()); defFileViewer.setLabelProvider(new DefFileLabelProvider()); defFileViewer.setInput(getDefFiles()); Combo defFileCombo = defFileViewer.getCombo(); defFileCombo.setToolTipText(Messages.LinkerSectionPart_defFileTooltip); final FormData formData_8 = new FormData(); formData_8.left = new FormAttachment(linkerDefinitionFileLabel, 0, SWT.LEFT); formData_8.right = new FormAttachment(0, 200); formData_8.top = new FormAttachment(0, 24); formData_8.bottom = new FormAttachment(0, 45); defFileCombo.setLayoutData(formData_8); toolkit.adapt(defFileCombo, true, true); exportUnfrozenButton = toolkit.createButton(container, Messages.LinkerSectionPart_exportUnfrozenBtn, SWT.CHECK); exportUnfrozenButton.setToolTipText(Messages.LinkerSectionPart_exportUnfrozenTooltip); final FormData formData = new FormData(); formData.bottom = new FormAttachment(defFileCombo, 21, SWT.BOTTOM); formData.top = new FormAttachment(defFileCombo, 5, SWT.BOTTOM); formData.right = new FormAttachment(defFileCombo, 0, SWT.RIGHT); formData.left = new FormAttachment(0, 15); exportUnfrozenButton.setLayoutData(formData); dontExportLibraryButton = toolkit.createButton(container, Messages.LinkerSectionPart_dontExportBtn, SWT.CHECK); dontExportLibraryButton.setToolTipText(Messages.LinkerSectionPart_dontExportTooltip); final FormData formData_1 = new FormData(); formData_1.bottom = new FormAttachment(exportUnfrozenButton, 21, SWT.BOTTOM); formData_1.top = new FormAttachment(exportUnfrozenButton, 5, SWT.BOTTOM); formData_1.right = new FormAttachment(exportUnfrozenButton, 0, SWT.RIGHT); formData_1.left = new FormAttachment(exportUnfrozenButton, 0, SWT.LEFT); dontExportLibraryButton.setLayoutData(formData_1); noStrictdefButton = toolkit.createButton(container, Messages.LinkerSectionPart_noStrictDefBtn, SWT.CHECK); noStrictdefButton.setToolTipText(Messages.LinkerSectionPart_noStrictDefTooltip); final FormData formData_2 = new FormData(); formData_2.bottom = new FormAttachment(dontExportLibraryButton, 21, SWT.BOTTOM); formData_2.top = new FormAttachment(dontExportLibraryButton, 5, SWT.BOTTOM); formData_2.right = new FormAttachment(dontExportLibraryButton, 0, SWT.RIGHT); formData_2.left = new FormAttachment(dontExportLibraryButton, 0, SWT.LEFT); noStrictdefButton.setLayoutData(formData_2); compressTargetExecutableButton = toolkit.createButton(container, Messages.LinkerSectionPart_compressExeBtn, SWT.CHECK); compressTargetExecutableButton.setToolTipText(Messages.LinkerSectionPart_compressTargetTooltip); final FormData formData_3 = new FormData(); formData_3.bottom = new FormAttachment(noStrictdefButton, 21, SWT.BOTTOM); formData_3.top = new FormAttachment(noStrictdefButton, 5, SWT.BOTTOM); formData_3.right = new FormAttachment(noStrictdefButton, 0, SWT.RIGHT); formData_3.left = new FormAttachment(noStrictdefButton, 0, SWT.LEFT); compressTargetExecutableButton.setLayoutData(formData_3); linkAsInternalLabel = toolkit.createLabel(container, Messages.LinkerSectionPart_linkAsLabel, SWT.NONE); final FormData formData_4 = new FormData(); formData_4.bottom = new FormAttachment(compressTargetExecutableButton, 18, SWT.BOTTOM); formData_4.top = new FormAttachment(compressTargetExecutableButton, 5, SWT.BOTTOM); formData_4.right = new FormAttachment(compressTargetExecutableButton, 0, SWT.RIGHT); formData_4.left = new FormAttachment(compressTargetExecutableButton, 0, SWT.LEFT); linkAsInternalLabel.setLayoutData(formData_4); linkAsText = toolkit.createText(container, null, SWT.NONE); linkAsText.setToolTipText(Messages.LinkerSectionPart_linkAsTooltip); final FormData formData_5 = new FormData(); formData_5.top = new FormAttachment(linkAsInternalLabel, 5, SWT.BOTTOM); formData_5.right = new FormAttachment(linkAsInternalLabel, 0, SWT.RIGHT); formData_5.left = new FormAttachment(linkAsInternalLabel, 0, SWT.LEFT); linkAsText.setLayoutData(formData_5); win32BaseAddressLabel = toolkit.createLabel(container, Messages.LinkerSectionPart_win32BaseAddrLabel, SWT.NONE); formData_10.right = new FormAttachment(win32BaseAddressLabel, 0, SWT.RIGHT); final FormData formData_6 = new FormData(); formData_6.top = new FormAttachment(0, 175); formData_6.right = new FormAttachment(linkAsText, 0, SWT.RIGHT); formData_6.left = new FormAttachment(linkAsText, 0, SWT.LEFT); win32BaseAddressLabel.setLayoutData(formData_6); baseAddrText = toolkit.createText(container, null, SWT.NONE); baseAddrText.setToolTipText(Messages.LinkerSectionPart_baseAddrTooltip); final FormData formData_7 = new FormData(); formData_7.top = new FormAttachment(0, 192); formData_7.right = new FormAttachment(win32BaseAddressLabel, 0, SWT.RIGHT); formData_7.left = new FormAttachment(win32BaseAddressLabel, 0, SWT.LEFT); baseAddrText.setLayoutData(formData_7); browseButton = toolkit.createButton(container, Messages.LinkerSectionPart_browseBtn, SWT.NONE); final FormData formData_9 = new FormData(); formData_9.top = new FormAttachment(defFileCombo, -23, SWT.BOTTOM); formData_9.bottom = new FormAttachment(defFileCombo, 0, SWT.BOTTOM); formData_9.left = new FormAttachment(defFileCombo, 5, SWT.RIGHT); browseButton.setLayoutData(formData_9); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { browseForDefFile(); } }); hookControls(); refresh(); }
From source file:com.nokia.carbide.cpp.internal.project.ui.mmpEditor.OverviewPage.java
License:Open Source License
/** * Create contents of the form/*from ww w .j ava 2 s .c o m*/ * @param managedForm */ @Override protected void createFormContent(IManagedForm managedForm) { FormToolkit toolkit = managedForm.getToolkit(); ScrolledForm form = managedForm.getForm(); form.setText(Messages.OverviewPage_overviewFormTitle); Composite body = form.getBody(); final TableWrapLayout tableWrapLayout_2 = new TableWrapLayout(); tableWrapLayout_2.rightMargin = 20; tableWrapLayout_2.verticalSpacing = 8; tableWrapLayout_2.numColumns = 2; body.setLayout(tableWrapLayout_2); toolkit.paintBordersFor(body); FormUtilities.addHelpContextToolbarItem(form.getForm(), HelpContexts.OVERVIEW_PAGE, Messages.helpTooltip); FormText formText; formText = toolkit.createFormText(body, false); final TableWrapData tableWrapData_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP); tableWrapData_1.colspan = 2; formText.setLayoutData(tableWrapData_1); formText.setText(Messages.OverviewPage_editorExplanation + Messages.OverviewPage_editorExplanation2 + Messages.OverviewPage_editorExplanation3, false, false); activeBuildInfoComposite = toolkit.createComposite(body, SWT.NONE); final RowLayout rowLayout = new RowLayout(); rowLayout.fill = true; rowLayout.wrap = false; rowLayout.marginLeft = 20; activeBuildInfoComposite.setLayout(rowLayout); final TableWrapData tableWrapData_2 = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP); tableWrapData_2.maxWidth = 288; tableWrapData_2.colspan = 2; activeBuildInfoComposite.setLayoutData(tableWrapData_2); toolkit.paintBordersFor(activeBuildInfoComposite); final Label buildConfigStaticLabel = toolkit.createLabel(activeBuildInfoComposite, Messages.OverviewPage_activeBuildConfigLabel, SWT.NONE); buildConfigStaticLabel.setLocation(27, 10); buildConfigStaticLabel.setFont(SWTResourceManager.getFont("Arial", 8, SWT.BOLD)); //$NON-NLS-1$ activeBuildConfigLabel = toolkit.createLabel(activeBuildInfoComposite, "", SWT.NONE); //$NON-NLS-1$ activeBuildConfigLabel.setToolTipText(Messages.OverviewPage_activeBuildConfigTooltip); activeBuildConfigLabel.setLocation(10, 10); final Section targetInformationSection = toolkit.createSection(body, Section.DESCRIPTION | Section.TITLE_BAR); final TableWrapData tableWrapData_3 = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP); tableWrapData_3.maxWidth = 250; tableWrapData_3.heightHint = 150; targetInformationSection.setLayoutData(tableWrapData_3); targetInformationSection.setDescription(Messages.OverviewPage_targetInfoDescription); targetInformationSection.setText(Messages.OverviewPage_targetInfoTitle); final Composite composite = toolkit.createComposite(targetInformationSection, SWT.NONE); final GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; composite.setLayout(gridLayout); toolkit.adapt(composite); targetInformationSection.setClient(composite); toolkit.paintBordersFor(composite); targetNameLabel = toolkit.createLabel(composite, Messages.OverviewPage_targetNameLabel, SWT.NONE); targetNameText = toolkit.createText(composite, null); targetNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); targetNameText.setToolTipText(Messages.OverviewPage_targetTooltip); toolkit.createLabel(composite, Messages.OverviewPage_targetTypeLabel, SWT.NONE); targetTypeViewer = new ComboViewer(composite, SWT.READ_ONLY); targetTypeViewer.setContentProvider(new ArrayContentProvider()); targetTypeViewer.setLabelProvider(new LabelProvider()); targetTypeViewer.setSorter(new ViewerSorter()); targetTypeViewer.setInput(new Object()); Combo targetTypeCombo = targetTypeViewer.getCombo(); targetTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); targetTypeCombo.setToolTipText(Messages.OverviewPage_targetTypeTooltip); toolkit.adapt(targetTypeCombo, true, true); targetPathLabel = toolkit.createLabel(composite, Messages.OverviewPage_targetPathLabel, SWT.NONE); // set default layout data so we have the exclude flag available later targetPathLabel.setLayoutData(new GridData()); targetPathText = toolkit.createText(composite, null); targetPathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); targetPathText.setToolTipText(Messages.OverviewPage_targetPathTooltip); uid2Label = toolkit.createLabel(composite, Messages.OverviewPage_uid2Label, SWT.NONE); uid2Text = toolkit.createText(composite, null); uid2Text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); uid2Text.setToolTipText(Messages.OverviewPage_uid2Tooltip); uid3Label = toolkit.createLabel(composite, Messages.OverviewPage_uid3Label, SWT.NONE); uid3Text = toolkit.createText(composite, null); uid3Text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); uid3Text.setToolTipText(Messages.OverviewPage_uid3Tooltip); final Section projectDefinitionSection = toolkit.createSection(body, Section.TITLE_BAR); final TableWrapData tableWrapData_4 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP); tableWrapData_4.grabHorizontal = true; tableWrapData_4.heightHint = 140; tableWrapData_4.maxWidth = 276; projectDefinitionSection.setLayoutData(tableWrapData_4); projectDefinitionSection.setText(Messages.OverviewPage_projectDefSectionTitle); final Composite composite_1 = toolkit.createComposite(projectDefinitionSection, SWT.NONE); final TableWrapLayout tableWrapLayout_1 = new TableWrapLayout(); tableWrapLayout_1.numColumns = 2; composite_1.setLayout(tableWrapLayout_1); toolkit.paintBordersFor(composite_1); projectDefinitionSection.setClient(composite_1); sourceFilesImageHyperlink = toolkit.createImageHyperlink(composite_1, SWT.NONE); sourceFilesImageHyperlink .setImage(ResourceManager.getPluginImage(ProjectUIPlugin.getDefault(), "icons/pencil.png")); //$NON-NLS-1$ sourceFilesImageHyperlink.setText(Messages.OverviewPage_sourcesLinkTitle); sourceFilesImageHyperlink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { editorContext.editor.setActivePage(MMPEditorContext.SOURCES_PAGE_ID); } }); toolkit.createLabel(composite_1, Messages.OverviewPage_sourcesLinkDescription, SWT.WRAP); librariesImageHyperlink = toolkit.createImageHyperlink(composite_1, SWT.NONE); librariesImageHyperlink .setImage(ResourceManager.getPluginImage(ProjectUIPlugin.getDefault(), "icons/pencil.png")); //$NON-NLS-1$ librariesImageHyperlink.setText(Messages.OverviewPage_libsLinktitle); librariesImageHyperlink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { editorContext.editor.setActivePage(MMPEditorContext.LIBRARIES_PAGE_ID); } }); toolkit.createLabel(composite_1, Messages.OverviewPage_libsLinkDescription, SWT.WRAP); optionsImageHyperlink = toolkit.createImageHyperlink(composite_1, SWT.NONE); optionsImageHyperlink .setImage(ResourceManager.getPluginImage(ProjectUIPlugin.getDefault(), "icons/pencil.png")); //$NON-NLS-1$ optionsImageHyperlink.setText(Messages.OverviewPage_optionsLinkTitle); optionsImageHyperlink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { editorContext.editor.setActivePage(MMPEditorContext.OPTIONS_PAGE_ID); } }); toolkit.createLabel(composite_1, Messages.OverviewPage_optionsLinkDescription, SWT.WRAP); final Section commonTasksSection = toolkit.createSection(body, Section.TITLE_BAR); final TableWrapData tableWrapData_5 = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP); tableWrapData_5.maxWidth = 250; commonTasksSection.setLayoutData(tableWrapData_5); commonTasksSection.setText(Messages.OverviewPage_commonTasksTitle); final Composite composite_2 = toolkit.createComposite(commonTasksSection, SWT.NONE); composite_2.setLayout(new FormLayout()); toolkit.paintBordersFor(composite_2); commonTasksSection.setClient(composite_2); addAUserHyperlink = toolkit.createHyperlink(composite_2, Messages.OverviewPage_addUserPathLink, SWT.NONE); final FormData formData_6 = new FormData(); formData_6.top = new FormAttachment(0, 5); formData_6.left = new FormAttachment(0, 5); addAUserHyperlink.setLayoutData(formData_6); addAUserHyperlink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { doAddInclude(EMMPListSelector.USER_INCLUDES); } }); addASystemHyperlink = toolkit.createHyperlink(composite_2, Messages.OverviewPage_addSysPathLink, SWT.NONE); final FormData formData_7 = new FormData(); formData_7.top = new FormAttachment(addAUserHyperlink, 5, SWT.BOTTOM); formData_7.left = new FormAttachment(addAUserHyperlink, 0, SWT.LEFT); addASystemHyperlink.setLayoutData(formData_7); addASystemHyperlink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { doAddInclude(EMMPListSelector.SYS_INCLUDES); } }); hookControls(); }
From source file:com.nokia.carbide.cpp.internal.project.ui.mmpEditor.RuntimeSectionPart.java
License:Open Source License
/** * Fill the section//www . j a v a 2s. com */ private void createClient(Section section, FormToolkit toolkit) { section.setText(Messages.RuntimeSectionPart_runtimeSectionTitle); Composite container = toolkit.createComposite(section); toolkit.paintBordersFor(container); final FormLayout formLayout = new FormLayout(); formLayout.marginHeight = 2; formLayout.marginWidth = 2; container.setLayout(formLayout); // section.setClient(container); capabilitiesLabel = toolkit.createLabel(container, Messages.RuntimeSectionPart_capabilitiesLabel, SWT.NONE); final FormData formData = new FormData(); formData.right = new FormAttachment(0, 70); formData.top = new FormAttachment(0, 5); formData.bottom = new FormAttachment(0, 25); capabilitiesLabel.setLayoutData(formData); capabilitiesText = toolkit.createText(container, null, SWT.V_SCROLL | SWT.WRAP); capabilitiesText.setToolTipText(Messages.RuntimeSectionPart_editCapabilitiesTooltip); final FormData formData_1 = new FormData(); formData_1.right = new FormAttachment(0, 245); formData_1.left = new FormAttachment(capabilitiesLabel, 0, SWT.LEFT); capabilitiesText.setLayoutData(formData_1); chooseButton = toolkit.createButton(container, Messages.RuntimeSectionPart_chooseCapabilitiesBtn, SWT.NONE); formData_1.bottom = new FormAttachment(chooseButton, 37, SWT.BOTTOM); formData_1.top = new FormAttachment(chooseButton, 5, SWT.DEFAULT); chooseButton.setToolTipText(Messages.RuntimeSectionPart_chooseCapabilitiesTooltip); final FormData formData_2 = new FormData(); formData_2.bottom = new FormAttachment(capabilitiesLabel, 23, SWT.TOP); formData_2.top = new FormAttachment(capabilitiesLabel, 0, SWT.TOP); formData_2.left = new FormAttachment(0, 130); formData_2.right = new FormAttachment(capabilitiesText, 0, SWT.RIGHT); chooseButton.setLayoutData(formData_2); chooseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { doChooseCapabilities(); } }); minHeapSizeLabel = toolkit.createLabel(container, Messages.RuntimeSectionPart_minHeapLabel, SWT.NONE); final FormData formData_3 = new FormData(); formData_3.top = new FormAttachment(capabilitiesText, 10, SWT.DEFAULT); formData_3.right = new FormAttachment(0, 130); formData_3.left = new FormAttachment(0, 7); minHeapSizeLabel.setLayoutData(formData_3); minHeapSizeText = toolkit.createText(container, null, SWT.NONE); minHeapSizeText.setToolTipText(Messages.RuntimeSectionPart_minHeapTooltip); final FormData formData_4 = new FormData(); formData_4.top = new FormAttachment(minHeapSizeLabel, -2, SWT.TOP); formData_4.right = new FormAttachment(capabilitiesText, 0, SWT.RIGHT); minHeapSizeText.setLayoutData(formData_4); maxHeapSizeLabel = toolkit.createLabel(container, Messages.RuntimeSectionPart_maxHeapLabel, SWT.NONE); formData_4.left = new FormAttachment(maxHeapSizeLabel, 5, SWT.RIGHT); final FormData formData_5 = new FormData(); formData_5.top = new FormAttachment(minHeapSizeLabel, 12, SWT.DEFAULT); formData_5.right = new FormAttachment(minHeapSizeLabel, 0, SWT.RIGHT); formData_5.left = new FormAttachment(minHeapSizeLabel, 0, SWT.LEFT); maxHeapSizeLabel.setLayoutData(formData_5); maxHeapSizeText = toolkit.createText(container, null, SWT.NONE); maxHeapSizeText.setToolTipText(Messages.RuntimeSectionPart_maxHeapTooltip); final FormData formData_6 = new FormData(); formData_6.left = new FormAttachment(minHeapSizeText, 0, SWT.LEFT); formData_6.top = new FormAttachment(maxHeapSizeLabel, 0, SWT.TOP); formData_6.right = new FormAttachment(minHeapSizeText, 0, SWT.RIGHT); maxHeapSizeText.setLayoutData(formData_6); stackSizeLabel = toolkit.createLabel(container, Messages.RuntimeSectionPart_stackSizeLabel, SWT.NONE); final FormData formData_7 = new FormData(); formData_7.top = new FormAttachment(0, 125); formData_7.right = new FormAttachment(maxHeapSizeLabel, 0, SWT.RIGHT); formData_7.left = new FormAttachment(maxHeapSizeLabel, 0, SWT.LEFT); stackSizeLabel.setLayoutData(formData_7); stackSizeText = toolkit.createText(container, null, SWT.NONE); stackSizeText.setToolTipText(Messages.RuntimeSectionPart_stackSizeTooltip); final FormData formData_8 = new FormData(); formData_8.left = new FormAttachment(maxHeapSizeText, 0, SWT.LEFT); formData_8.top = new FormAttachment(stackSizeLabel, 0, SWT.TOP); formData_8.right = new FormAttachment(maxHeapSizeText, 0, SWT.RIGHT); stackSizeText.setLayoutData(formData_8); Label processPriorityLabel; processPriorityLabel = toolkit.createLabel(container, Messages.RuntimeSectionPart_processPriorityLabel, SWT.NONE); final FormData formData_9 = new FormData(); formData_9.right = new FormAttachment(stackSizeLabel, 83, SWT.LEFT); formData_9.left = new FormAttachment(stackSizeLabel, 0, SWT.LEFT); processPriorityLabel.setLayoutData(formData_9); processPriorityViewer = new ComboViewer(container, SWT.READ_ONLY | SWT.FLAT); processPriorityViewer.setContentProvider(new ArrayContentProvider()); processPriorityViewer.setLabelProvider(new ProcessPriorityLabelProvider()); processPriorityViewer.setInput(PROCESS_PRIORITIES); Combo processPriorityCombo; processPriorityCombo = processPriorityViewer.getCombo(); formData_9.top = new FormAttachment(processPriorityCombo, -18, SWT.TOP); formData_9.bottom = new FormAttachment(processPriorityCombo, -5, SWT.TOP); processPriorityCombo.setToolTipText(Messages.RuntimeSectionPart_processPriorityTooltip); final FormData formData_10 = new FormData(); formData_10.top = new FormAttachment(0, 164); formData_10.bottom = new FormAttachment(0, 185); formData_10.right = new FormAttachment(stackSizeText, 0, SWT.RIGHT); formData_10.left = new FormAttachment(processPriorityLabel, 0, SWT.LEFT); processPriorityCombo.setLayoutData(formData_10); toolkit.adapt(processPriorityCombo, true, true); secureIDLabel = toolkit.createLabel(container, Messages.RuntimeSectionPart_secureIDLabel, SWT.NONE); final FormData formData_11 = new FormData(); formData_11.top = new FormAttachment(0, 200); formData_11.left = new FormAttachment(processPriorityCombo, 0, SWT.LEFT); secureIDLabel.setLayoutData(formData_11); toolkit.adapt(secureIDLabel, true, true); secureIDText = toolkit.createText(container, null, SWT.NONE); secureIDText.setToolTipText(Messages.RuntimeSectionPart_secureIDTooltip); final FormData formData_12 = new FormData(); formData_12.top = new FormAttachment(secureIDLabel, 0, SWT.TOP); formData_12.right = new FormAttachment(processPriorityCombo, 0, SWT.RIGHT); formData_12.left = new FormAttachment(stackSizeText, 0, SWT.LEFT); secureIDText.setLayoutData(formData_12); vendorIDLabel = toolkit.createLabel(container, Messages.RuntimeSectionPart_vendorIDLabel, SWT.NONE); formData.left = new FormAttachment(vendorIDLabel, 0, SWT.LEFT); FormData formData_13; formData_13 = new FormData(); formData_13.top = new FormAttachment(0, 230); formData_13.right = new FormAttachment(secureIDLabel, 54, SWT.LEFT); formData_13.left = new FormAttachment(secureIDLabel, 0, SWT.LEFT); vendorIDLabel.setLayoutData(formData_13); vendorIDText = toolkit.createText(container, null, SWT.NONE); vendorIDText.setToolTipText(Messages.RuntimeSectionPart_vendorIDTooltip); final FormData formData_14 = new FormData(); formData_14.top = new FormAttachment(vendorIDLabel, 0, SWT.TOP); formData_14.left = new FormAttachment(secureIDText, 0, SWT.LEFT); formData_14.right = new FormAttachment(secureIDText, 0, SWT.RIGHT); vendorIDText.setLayoutData(formData_14); debuggableButton = toolkit.createButton(container, Messages.RuntimeSectionPart_debuggableButton, SWT.CHECK); debuggableButton.setToolTipText(Messages.RuntimeSectionPart_debuggableToolTip); final FormData formData_15 = new FormData(); formData_15.top = new FormAttachment(0, 260); formData_15.left = new FormAttachment(vendorIDLabel, 0, SWT.LEFT); debuggableButton.setLayoutData(formData_15); Label demandPagingLabel; demandPagingLabel = toolkit.createLabel(container, Messages.RuntimeSectionPart_pagingModeLabel, SWT.NONE); final FormData formData_16 = new FormData(); formData_16.left = new FormAttachment(stackSizeLabel, 0, SWT.LEFT); demandPagingLabel.setLayoutData(formData_16); pagingModeViewer = new ComboViewer(container, SWT.READ_ONLY | SWT.FLAT); pagingModeViewer.setContentProvider(new ArrayContentProvider()); pagingModeViewer.setLabelProvider(new LabelProvider()); pagingModeViewer.setInput(PAGING_MODE_VALUES); Combo pagingModeCombo; pagingModeCombo = pagingModeViewer.getCombo(); formData_16.top = new FormAttachment(pagingModeCombo, -18, SWT.TOP); formData_16.bottom = new FormAttachment(pagingModeCombo, -5, SWT.TOP); pagingModeCombo.setToolTipText(Messages.RuntimeSectionPart_pagingModeToolTip); final FormData formData_17 = new FormData(); formData_17.top = new FormAttachment(0, 300); formData_17.bottom = new FormAttachment(0, 320); formData_17.right = new FormAttachment(stackSizeText, 0, SWT.RIGHT); formData_17.left = new FormAttachment(demandPagingLabel, 0, SWT.LEFT); pagingModeCombo.setLayoutData(formData_17); toolkit.adapt(pagingModeCombo, true, true); hookControls(); refresh(); }
From source file:com.nokia.carbide.remoteconnections.internal.ui.ClientServiceSiteUI2.java
License:Open Source License
public void createComposite(Composite parent) { initializeDialogUnits(parent);/*from www.j a va 2 s . c o m*/ Group group = new Group(parent, SWT.NONE); group.setText(Messages.getString("ClientServiceSiteUI2.UseConnectionGroupLabel")); //$NON-NLS-1$ group.setLayout(new GridLayout()); group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); group.setData(UID, "useConnectionGroup"); //$NON-NLS-1$ viewer = new ComboViewer(group, SWT.READ_ONLY); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { Check.checkContract(element instanceof String); String id = (String) element; return connectionNames.get(id); } }); viewer.setContentProvider(new ArrayContentProvider()); GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); viewer.getCombo().setLayoutData(gd); viewer.getControl().setData(UID, "viewer"); //$NON-NLS-1$ viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); String connection = (String) selection.getFirstElement(); if (connection != null && !connection.equals(ClientServiceSiteUI2.this.connection)) { ClientServiceSiteUI2.this.connection = connection; fireConnectionSelected(); } } }); final Composite composite = new Composite(group, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.makeColumnsEqualWidth = true; layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); composite.setLayoutData(gd); composite.setFont(parent.getFont()); newButton = new Button(composite, SWT.PUSH); newButton.setText(Messages.getString("ClientServiceSiteUI2.NewButtonLabel")); //$NON-NLS-1$ newButton.setFont(JFaceResources.getDialogFont()); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); gd.widthHint = Math.max(widthHint, minSize.x); newButton.setLayoutData(gd); newButton.setData(UID, "newButton"); //$NON-NLS-1$ newButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { SettingsWizard wizard = new SettingsWizard(null, service); wizard.open(composite.getShell()); IConnection connection = wizard.getConnectionToEdit(); // note: refresh ASAP so the selection will be valid; but endure a listener event // which will redo this refreshUI(); setViewerInput(connection); } }); editButton = new Button(composite, SWT.PUSH); editButton.setText(Messages.getString("ClientServiceSiteUI2.EditButtonLabel")); //$NON-NLS-1$ editButton.setFont(JFaceResources.getDialogFont()); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); gd.widthHint = Math.max(widthHint, minSize.x); editButton.setLayoutData(gd); editButton.setData(UID, "editButton"); //$NON-NLS-1$ editButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); Object value = selection.getFirstElement(); if (value instanceof String) { IConnection editConnection = getActualConnection((String) value); SettingsWizard wizard = new SettingsWizard(editConnection, service); wizard.open(composite.getShell()); // leave the viewer the same, callback will refresh anything needed } } }); // attach listeners RemoteConnectionsActivator.getConnectionsManager().addConnectionListener(this); RemoteConnectionsActivator.getConnectionsManager().addConnectionStoreChangedListener(this); // remove listeners on dispose group.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { RemoteConnectionsActivator.getConnectionsManager() .removeConnectionListener(ClientServiceSiteUI2.this); RemoteConnectionsActivator.getConnectionsManager() .removeConnectionStoreChangedListener(ClientServiceSiteUI2.this); } }); setViewerInput(null); }
From source file:com.nokia.carbide.remoteconnections.settings.ui.ConnectionSettingsPage.java
License:Open Source License
private void createSetupTabComposite(TabFolder tabFolder) { TabItem tabItem = new TabItem(tabFolder, SWT.NONE); tabItem.setText(Messages.getString("ConnectionSettingsPage.SetupTabLabel")); //$NON-NLS-1$ tabItem.setData(UID, "setupTab"); //$NON-NLS-1$ setupTabComposite = new Composite(tabFolder, SWT.NONE); setupTabComposite.setLayout(new GridLayout(2, false)); tabItem.setControl(setupTabComposite); boolean canEditConnection = !settingsWizard.isConnectionToEditDynamic(); Label viewerLabel = new Label(setupTabComposite, SWT.NONE); viewerLabel.setText(Messages.getString("ConnectionTypePage.ViewerLabel")); //$NON-NLS-1$ connectionTypeViewer = new ComboViewer(setupTabComposite, SWT.READ_ONLY); connectionTypeViewer.setLabelProvider(new LabelProvider() { @Override/* w w w . ja va 2 s . c o m*/ public String getText(Object element) { Check.checkState(element instanceof IConnectionType); IConnectionType connectionType = (IConnectionType) element; return connectionType.getDisplayName() + " (" + getServicesString(connectionType) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } }); connectionTypeViewer.setContentProvider(new ArrayContentProvider()); connectionTypeViewer.setInput(getConnectionTypes()); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); connectionTypeViewer.getControl().setLayoutData(gd); connectionTypeViewer.getControl().setData(UID, "viewer"); //$NON-NLS-1$ connectionTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() { private IConnectionType previousSelection; public void selectionChanged(SelectionChangedEvent event) { Object currentSelection = ((IStructuredSelection) event.getSelection()).getFirstElement(); if (!currentSelection.equals(previousSelection)) { settingsWizard.connectionTypeChanged(); previousSelection = (IConnectionType) currentSelection; } } }); connectionTypeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { getWizard().getContainer().showPage(getNextPage()); } }); connectionTypeViewer.setSorter(new ViewerSorter() { @Override public int compare(Viewer viewer, Object e1, Object e2) { IConnectionType t1 = (IConnectionType) e1; IConnectionType t2 = (IConnectionType) e2; return t1.getDisplayName().compareToIgnoreCase(t2.getDisplayName()); } }); connectionTypeViewer.getCombo().select(getCurrentTypeIndex()); connectionTypeViewer.getCombo().setEnabled(canEditConnection); Label nameLabel = new Label(setupTabComposite, SWT.NONE); nameLabel.setText(Messages.getString("ConnectionTypePage.NameLabel")); //$NON-NLS-1$ nameText = new Text(setupTabComposite, SWT.BORDER); gd = new GridData(SWT.FILL, SWT.CENTER, true, false); nameText.setLayoutData(gd); nameText.setToolTipText(Messages.getString("ConnectionTypePage.NameTextToolTip")); //$NON-NLS-1$ nameText.setData(UID, "nameText"); //$NON-NLS-1$ nameText.setText(getInitialNameText()); nameText.selectAll(); nameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { modifiedName = true; setPageComplete(validatePage()); } }); nameText.setEnabled(canEditConnection); createSettingsGroup(setupTabComposite); }
From source file:com.nokia.carbide.remoteconnections.settings.ui.ConnectionSettingsPage.java
License:Open Source License
private void createDeviceOSCombo(Composite parent) { Composite comboComposite = new Composite(parent, SWT.NONE); GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false); gd_composite.horizontalSpan = 2;/*ww w . j a v a 2 s. c o m*/ comboComposite.setLayoutData(gd_composite); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; comboComposite.setLayout(gridLayout); Label deviceOSLabel = new Label(comboComposite, SWT.NONE); GridData gd_sdkLabel = new GridData(); deviceOSLabel.setLayoutData(gd_sdkLabel); deviceOSLabel.setText(Messages.getString("ConnectionSettingsPage.DeviceOSLabel")); //$NON-NLS-1$ deviceOSComboViewer = new ComboViewer(comboComposite, SWT.READ_ONLY); GridData gd_sdkcombo = new GridData(SWT.LEFT, SWT.CENTER, true, false); gd_sdkcombo.widthHint = 150; deviceOSComboViewer.getCombo().setLayoutData(gd_sdkcombo); deviceOSComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { @SuppressWarnings("unchecked") public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) deviceOSComboViewer.getSelection(); Pair<String, String> pair = (Pair<String, String>) selection.getFirstElement(); setSelectionToInstallComposite(pair); if (connectedService instanceof IConnectedService2) ((IConnectedService2) connectedService).setDeviceOS(pair.first, pair.second); } }); deviceOSComboViewer.setContentProvider(new ArrayContentProvider()); deviceOSComboViewer.setLabelProvider(new LabelProvider() { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public String getText(Object element) { Check.checkState(element instanceof Pair); Pair<String, Version> pair = (Pair) element; return MessageFormat.format("{0} {1}", pair.first, pair.second); //$NON-NLS-1$ } }); deviceOSComboViewer.getControl() .setToolTipText(Messages.getString("ConnectionSettingsPage.DeviceOSComboToolTip")); //$NON-NLS-1$ deviceOSComboViewer.getControl().setData(UID, "deviceOSComboViewer"); //$NON-NLS-1$ }
From source file:com.nokia.carbide.remoteconnections.ui.ClientServiceSiteUI.java
License:Open Source License
public void createComposite(Composite parent) { initializeDialogUnits(parent);/*from w w w. j a v a2 s .co m*/ Group group = new Group(parent, SWT.NONE); group.setText(Messages.getString("ClientServiceSiteUI.UseConnectionGroupLabel")); //$NON-NLS-1$ group.setLayout(new GridLayout()); group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); group.setData(UID, "useConnectionGroup"); //$NON-NLS-1$ viewer = new ComboViewer(group, SWT.READ_ONLY); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { Check.checkContract(element instanceof IConnection); return ((IConnection) element).getDisplayName(); } }); viewer.setContentProvider(new ArrayContentProvider()); GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); viewer.getCombo().setLayoutData(gd); viewer.getControl().setData(UID, "viewer"); //$NON-NLS-1$ viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); IConnection connection = (IConnection) selection.getFirstElement(); if (!connection.equals(ClientServiceSiteUI.this.connection)) { ClientServiceSiteUI.this.connection = connection; fireConnectionSelected(); } } }); final Composite composite = new Composite(group, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.makeColumnsEqualWidth = true; layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); composite.setLayoutData(gd); composite.setFont(parent.getFont()); newButton = new Button(composite, SWT.PUSH); newButton.setText(Messages.getString("ClientServiceSiteUI.NewButtonLabel")); //$NON-NLS-1$ newButton.setFont(JFaceResources.getDialogFont()); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); gd.widthHint = Math.max(widthHint, minSize.x); newButton.setLayoutData(gd); newButton.setData(UID, "newButton"); //$NON-NLS-1$ newButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { SettingsWizard wizard = new SettingsWizard(null, service); wizard.open(composite.getShell()); setViewerInput(wizard.getConnectionToEdit()); } }); editButton = new Button(composite, SWT.PUSH); editButton.setText(Messages.getString("ClientServiceSiteUI.EditButtonLabel")); //$NON-NLS-1$ editButton.setFont(JFaceResources.getDialogFont()); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); gd.widthHint = Math.max(widthHint, minSize.x); editButton.setLayoutData(gd); editButton.setData(UID, "editButton"); //$NON-NLS-1$ editButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); Object value = selection.getFirstElement(); if (value instanceof IConnection) { SettingsWizard wizard = new SettingsWizard((IConnection) value, service); wizard.open(composite.getShell()); setViewerInput(wizard.getConnectionToEdit()); } } }); setViewerInput(null); }
From source file:com.nokia.carbide.trk.support.connection.SerialConnectionFactory.java
License:Open Source License
private void createComboForSettings(Composite composite, String labelStr, final String key, String[] input) { Label label = new Label(composite, SWT.NONE); label.setText(labelStr);/*from w w w .jav a2 s. co m*/ final ComboViewer viewer = new ComboViewer(composite, SWT.READ_ONLY); viewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { int index = SerialConnectionSettings.toIndex(key, element.toString()); return SerialConnectionSettings.toDisplayString(key, index); } }); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { int index = viewer.getCombo().getSelectionIndex(); settings.setByIndex(key, index); } }); viewer.setInput(input); viewer.getControl().setData(".uid", "SerialConnectionFactory." + key); //$NON-NLS-1$ //$NON-NLS-2$ viewers.put(key, viewer); }
From source file:com.nokia.cdt.internal.debug.launch.newwizard.ConnectToDeviceDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent);//from ww w. ja v a2 s .c om final Composite composite = initDialogArea(parent, Messages.getString("ConnectToDeviceDialog.Title"), //$NON-NLS-1$ LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_CONNECTION); Group viewerGroup = new Group(composite, SWT.NONE); viewerGroup.setText(Messages.getString("ConnectToDeviceDialog.GroupLabel")); //$NON-NLS-1$ GridDataFactory.fillDefaults().applyTo(viewerGroup); GridLayoutFactory.swtDefaults().applyTo(viewerGroup); viewer = new ComboViewer(viewerGroup, SWT.READ_ONLY); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof IConnection) return ((IConnection) element).getDisplayName(); return Messages.getString("ConnectToDeviceDialog.NoCurrentItem"); //$NON-NLS-1$ } }); viewer.setContentProvider(new ArrayContentProvider()); Combo combo = viewer.getCombo(); GridDataFactory.defaultsFor(combo).grab(true, false).applyTo(combo); viewer.getControl().setData(UID, "combo_viewer"); //$NON-NLS-1$ viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (getDialogArea() != null) connectionSelected(getConnectionFromSelection(event.getSelection())); } }); manager.addConnectionListener(this); parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { manager.removeConnectionListener(ConnectToDeviceDialog.this); if (currentServiceListener != null) currentServiceListener.removeStatusChangedListener(ConnectToDeviceDialog.this); } }); final Composite buttonGroup = new Composite(viewerGroup, SWT.NONE); int w = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN); int h = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN); int hs = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING); int vs = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING); GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).margins(w, h).spacing(hs, vs) .applyTo(buttonGroup); GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).applyTo(buttonGroup); buttonGroup.setFont(parent.getFont()); newButton = new Button(buttonGroup, SWT.PUSH); newButton.setText(Messages.getString("ConnectToDeviceDialog.NewLabel")); //$NON-NLS-1$ newButton.setFont(JFaceResources.getDialogFont()); int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); widthHint = Math.max(widthHint, minSize.x); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).hint(widthHint, SWT.DEFAULT).applyTo(newButton); newButton.setData(UID, "newButton"); //$NON-NLS-1$ newButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { SettingsWizard wizard = new SettingsWizard(null, connectionData.getService()); wizard.open(composite.getShell()); IConnection connection = wizard.getConnectionToEdit(); setViewerInput(connection); } }); editButton = new Button(buttonGroup, SWT.PUSH); editButton.setText(Messages.getString("ConnectToDeviceDialog.EditLabel")); //$NON-NLS-1$ editButton.setFont(JFaceResources.getDialogFont()); widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); widthHint = Math.max(widthHint, minSize.x); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).hint(widthHint, SWT.DEFAULT).applyTo(editButton); editButton.setData(UID, "editButton"); //$NON-NLS-1$ editButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IConnection connection = getConnectionFromSelection(viewer.getSelection()); if (connection != null) { SettingsWizard wizard = new SettingsWizard(connection, connectionData.getService()); wizard.open(composite.getShell()); } } }); descriptionLabel = new Label(composite, SWT.WRAP); GridDataFactory.defaultsFor(descriptionLabel).grab(false, true).applyTo(descriptionLabel); composite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { descriptionLabel.pack(); } }); setViewerInput(connectionData.getConnection()); return composite; }
From source file:com.nokia.cdt.internal.debug.launch.newwizard.DebugRunProcessDialog.java
License:Open Source License
/** * Allow selecting an executable detected to be built by the program. * @param radioGroup// www . jav a 2 s . co m */ private void createProjectExecutableRadioButton(Composite radioGroup) { projectExecutableRadioButton = new Button(radioGroup, SWT.RADIO); GridDataFactory.fillDefaults().grab(false, false).applyTo(projectExecutableRadioButton); projectExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchProjectExeLabel")); //$NON-NLS-1$ projectExecutableRadioButton.setData(UID, "radio_project_executable"); //$NON-NLS-1$ projectExecutableRadioButton .setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchProjectExecutableRadioTooltip")); //$NON-NLS-1$ projectExecutableViewer = new ComboViewer(radioGroup, SWT.READ_ONLY); GridDataFactory.fillDefaults().grab(true, false).applyTo(projectExecutableViewer.getControl()); projectExecutableViewer.getControl().setData(UID, "combo_project_executable"); //$NON-NLS-1$ projectExecutableViewer.getControl() .setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchProjectExecutableSelectorTooltip")); //$NON-NLS-1$ projectExecutableViewer.setContentProvider(new ArrayContentProvider()); projectExecutableViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof IPath) return ((IPath) element).lastSegment(); return super.getText(element); } }); projectExecutableRadioButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleProjectExecutableRadioSelected(); } }); projectExecutableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { Object sel = ((IStructuredSelection) event.getSelection()).getFirstElement(); if (sel instanceof IPath) { if (projectExecutableRadioButton.getSelection()) { debugRunProcessWizardData.setExeSelectionPath((IPath) sel); } // track the default remote program from the executable, for easy editing if (remoteProgramViewer != null && !remoteExecutableRadioButton.getSelection()) { IPath exeSelectionPath = createSuggestedRemotePath( debugRunProcessWizardData.getExeSelectionPath()); // path should already be in model remoteProgramViewer.setSelection(new StructuredSelection(exeSelectionPath)); } validate(); } } }); }