List of usage examples for org.eclipse.jface.viewers CheckboxTableViewer newCheckList
public static CheckboxTableViewer newCheckList(Composite parent, int style)
From source file:org.pdtextensions.semanticanalysis.preferences.csfixer.PHPCSFixerConfigurationBlock.java
License:Open Source License
protected void createFixerOptions(Composite parent) { Composite fixerContent = new Composite(parent, SWT.NONE); GridLayout fixerLayout = new GridLayout(); fixerLayout.marginHeight = 10;/* w w w . j av a 2 s. com*/ fixerLayout.marginWidth = 0; fixerContent.setLayout(fixerLayout); Group fixerGroup = new Group(fixerContent, SWT.NONE); fixerGroup.setLayout(new GridLayout()); fixerGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fixerGroup.setText("CodingStandard Fixer Configuration"); addComboBox(fixerGroup, "Configuration", PREF_PHPCS_CONFIG, PEXPreferenceNames.getPHPCSFixerConfig(), PEXPreferenceNames.getPHPCSFixerConfigLabels()); final Button defaultFixers = addCheckBox(fixerGroup, "Use default PHP-CS fixer options", PREF_PHPCS_USE_DEFAULT_FIXERS, new String[] { "yes", "no" }, 0); defaultFixers.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fixerList.getTable().setEnabled(defaultFixers.getSelection() == false); } }); fixerList = CheckboxTableViewer.newCheckList(fixerGroup, SWT.BORDER); fixerList.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); fixerList.setContentProvider(new ArrayContentProvider()); fixerList.setLabelProvider(new FixerOptionLabelProvider()); fixerList.setCheckStateProvider(new ICheckStateProvider() { @Override public boolean isGrayed(Object element) { return false; } @Override public boolean isChecked(Object element) { FixerOption option = (FixerOption) element; return "true".equals(option.active); } }); fixerList.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { FixerOption option = (FixerOption) event.getElement(); Boolean bool = new Boolean(event.getChecked()); option.active = bool.toString(); setValue(getPEXKey(option.internal), packOption(option)); } }); fixerList.setInput(fixerOptions.toArray()); if ("yes".equals(getValue(PREF_PHPCS_USE_DEFAULT_FIXERS))) { fixerList.getTable().setEnabled(false); } }
From source file:org.polarsys.reqcycle.export.pages.PredicateSelectionPage.java
License:Open Source License
/** * Create contents of the wizard./*from ww w .j av a 2 s.c om*/ * * @param parent */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new FormLayout()); Composite composite = new Composite(container, SWT.NONE); FormData fd_composite = new FormData(); fd_composite.bottom = new FormAttachment(0, 305); fd_composite.right = new FormAttachment(0, 564); fd_composite.top = new FormAttachment(0, 10); fd_composite.left = new FormAttachment(0); composite.setLayoutData(fd_composite); composite.setLayout(new GridLayout(1, false)); Group grpPredicate = new Group(composite, SWT.NONE); grpPredicate.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); grpPredicate.setBounds(0, 0, 70, 82); grpPredicate.setLayout(new GridLayout(1, false)); grpPredicate.setText("Predicates"); final CheckboxTableViewer predicateTableViewer = CheckboxTableViewer.newCheckList(grpPredicate, SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION); predicateTableViewer.setLabelProvider(new PredicatesTableLabelProvider()); predicateTableViewer.setContentProvider(ProviderUtils.getArrayContentProvider()); predicateTableViewer.setInput(predicatesConfManager.getPredicates(false)); predicateTableViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { controller.addPredicateResult((IPredicate) event.getElement()); } else { controller.removePredicateResult((IPredicate) event.getElement()); } } }); table = predicateTableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); table.setBounds(0, 0, 85, 85); }
From source file:org.polarsys.reqcycle.export.pages.RequirementSourceSelectionPage.java
License:Open Source License
/** * Create contents of the wizard.//from w ww. j a va 2 s. com * * @param parent */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(1, false)); Composite composite = new Composite(container, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); composite.setLayout(new GridLayout(1, false)); Group grpDataSource = new Group(composite, SWT.NONE); grpDataSource.setLayout(new GridLayout(1, false)); grpDataSource.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); grpDataSource.setText("Data Sources"); reqSourceTableViewer = CheckboxTableViewer.newCheckList(grpDataSource, SWT.BORDER | SWT.FULL_SELECTION); reqSourceTableViewer.setLabelProvider(new RequirementSourceLabelProvider()); reqSourceTableViewer.setContentProvider(ProviderUtils.getArrayContentProvider()); reqSourceTableViewer.setInput(requirementSourceManager.getRequirementSources()); table = reqSourceTableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); reqSourceTableViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { controller.addReqProvider( new RequirementSourceReqProvider((RequirementSource) event.getElement())); } else { controller.removeReqProvider( new RequirementSourceReqProvider((RequirementSource) event.getElement())); } getWizard().getContainer().updateButtons(); getWizard().getContainer().updateMessage(); } }); Group grpScope = new Group(composite, SWT.NONE); grpScope.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); grpScope.setText("Scopes"); grpScope.setLayout(new GridLayout(2, false)); Label lblDataModel = new Label(grpScope, SWT.NONE); lblDataModel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblDataModel.setText("Data Model :"); ComboViewer modelComboViewer = new ComboViewer(grpScope, SWT.READ_ONLY); Combo combo = modelComboViewer.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); modelComboViewer.setContentProvider(ProviderUtils.getArrayContentProvider()); modelComboViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof IDataModel) { return ((IDataModel) element).getName(); } return ""; } }); modelComboViewer.setInput(dataManager.getCurrentDataModels()); modelComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object firstElement = ((IStructuredSelection) selection).getFirstElement(); if (firstElement instanceof IDataModel) { IDataModel selectedDataModel = (IDataModel) firstElement; if (selectedDataModel != dataModel) { dataModel = selectedDataModel; setScopes(dataManager.getScopes(dataModel)); } } } } }); reqScopeTableViewer = CheckboxTableViewer.newCheckList(grpScope, SWT.BORDER | SWT.FULL_SELECTION); reqScopeTableViewer.setContentProvider(ProviderUtils.getArrayContentProvider()); reqScopeTableViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof Scope) { return ((Scope) element).getName(); } return "a"; } }); reqScopeTableViewer.setInput(scopes); reqScopeTableViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { controller.addReqProvider(new ScopeReqProvider((Scope) event.getElement())); } else { controller.removeReqProvider(new ScopeReqProvider((Scope) event.getElement())); } getWizard().getContainer().updateButtons(); getWizard().getContainer().updateMessage(); } }); table_1 = reqScopeTableViewer.getTable(); table_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); for (RequirementSource s : selectedSources) { reqSourceTableViewer.setChecked(s, true); } doCreateGroup(composite); }
From source file:org.polarsys.reqcycle.export.rmf.wizard.RequirementSourceSelectionPage.java
License:Open Source License
/** * Create contents of the wizard./*from w ww. j a v a2s . c o m*/ * * @param parent */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(1, false)); Composite composite = new Composite(container, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); composite.setLayout(new GridLayout(1, false)); Group grpDataSource = new Group(composite, SWT.NONE); grpDataSource.setLayout(new GridLayout(1, false)); grpDataSource.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); grpDataSource.setText("Data Sources"); reqSourceTableViewer = CheckboxTableViewer.newCheckList(grpDataSource, SWT.BORDER | SWT.FULL_SELECTION); reqSourceTableViewer.setLabelProvider(new RequirementSourceLabelProvider()); reqSourceTableViewer.setContentProvider(ProviderUtils.getArrayContentProvider()); reqSourceTableViewer.setInput(requirementSourceManager.getRequirementSources()); table = reqSourceTableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); reqSourceTableViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { controller.addReqProvider( new RequirementSourceReqProvider((RequirementSource) event.getElement())); } else { controller.removeReqProvider( new RequirementSourceReqProvider((RequirementSource) event.getElement())); } getWizard().getContainer().updateButtons(); getWizard().getContainer().updateMessage(); } }); for (RequirementSource s : selectedSources) { reqSourceTableViewer.setChecked(s, true); } Group grpOutput = new Group(composite, SWT.NONE); grpOutput.setLayout(new GridLayout(2, false)); grpOutput.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); grpOutput.setText("Output"); text = new Text(grpOutput, SWT.BORDER); text.setEditable(false); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); if (controller.getOutputUri() != null) { text.setText(controller.getOutputUri().path()); checkExistingFile(); } Button btnNewButton = new Button(grpOutput, SWT.NONE); btnNewButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // URI.createPlatformResourceURI(pathName); ResourceDialog dialog = new ResourceDialog(getShell(), "blabla", SWT.SAVE | SWT.SINGLE); int res = dialog.open(); if (res == ResourceDialog.OK) { URI uri = dialog.getURIs().get(0); if (uri != null) { if (!"reqif".equals(uri.fileExtension())) { uri = uri.trimFileExtension().appendFileExtension("reqif"); } text.setText(uri.toString()); } controller.setOutputUri(uri); } checkExistingFile(); getWizard().getContainer().updateButtons(); getWizard().getContainer().updateMessage(); } }); btnNewButton.setText("..."); doCreateGroup(composite); }
From source file:org.polarsys.reqcycle.repository.connector.update.pages.DialogImpactAnalysis.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); composite.setLayout(new GridLayout(1, false)); cbReqSourceTv = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.FULL_SELECTION); tableReqSources = cbReqSourceTv.getTable(); GridData gd_tableReqSources = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1); gd_tableReqSources.heightHint = 92;//w w w .ja va2 s . com tableReqSources.setLayoutData(gd_tableReqSources); cbReqSourceTv.setContentProvider(ArrayContentProvider.getInstance()); cbReqSourceTv.setLabelProvider(new TableLabelProvider() { @Override public String getText(Object element) { if (element instanceof RequirementSource) { return ((RequirementSource) element).getName(); } return super.getText(element); } }); cbReqSourceTv.setInput(inputReqSourcesMap.keySet()); cbReqSourceTv.setAllChecked(true); cbReqSourceTv.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object obj = ((IStructuredSelection) selection).getFirstElement(); if (obj != null && obj instanceof RequirementSource) { for (Entry<RequirementSource, ImpactAnalysis> rsImpAna : reqSourceWithImpAnalysis .entrySet()) { if (rsImpAna.getKey().getName().equals(((RequirementSource) obj).getName())) { ImpactAnalysis impactAnalysis = rsImpAna.getValue(); impactComposites.setImpactResult(impactAnalysis.getRequirementsAdded(), impactAnalysis.getRequirementsDeleted(), impactAnalysis.getRequirementsModified()); } } } } } }); cbReqSourceTv.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { getSelectedElements(); } }); selections = new ArrayList<String>(); getSelectedElements(); Composite impactComposite = new Composite(composite, SWT.BORDER); impactComposite.setLayout(new GridLayout()); impactComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); impactComposites.createImpactComposite(impactComposite); Button btnSaveAnalysis = new Button(impactComposite, SWT.NONE); btnSaveAnalysis.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), true, "select location for save"); IPath path = null; if (Window.OK == dialog.open()) { Object[] result = dialog.getResult(); if (result != null && result.length > 0) { if (result[0] instanceof IPath) { path = (IPath) result[0]; } } } // transmit a selected requirements if (path != null) { finalMapReqSourcesWithImpactAna.clear(); finalMapReqSourcesWithImpactAna = getSelectedRequirementSrc(selections, reqSourceWithImpAnalysis); // save impact analysis of selected requirements sources for (Map.Entry<RequirementSource, ImpactAnalysis> finalMap : finalMapReqSourcesWithImpactAna .entrySet()) { String fileName = "/" + finalMap.getKey().getName() + suffixName; URI destinationPath = URI.createPlatformResourceURI(path.toString() + fileName, true); finalMap.getValue().saveAnalysis(destinationPath); } } } }); btnSaveAnalysis.setToolTipText(""); btnSaveAnalysis.setAlignment(SWT.RIGHT); btnSaveAnalysis.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1)); btnSaveAnalysis.setText("Save impacts analysis"); return composite; }
From source file:org.polarsys.reqcycle.traceability.builder.ui.preferences.AnalysersPreferencePage.java
License:Open Source License
/** * Create contents of the preference page. * //from www . ja v a 2 s .com * @param parent */ @Override public Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new FormLayout()); Label lblNewLabel = new Label(container, SWT.NONE); FormData fd_lblNewLabel = new FormData(); fd_lblNewLabel.right = new FormAttachment(0, 365); fd_lblNewLabel.top = new FormAttachment(0); fd_lblNewLabel.left = new FormAttachment(0, 5); lblNewLabel.setLayoutData(fd_lblNewLabel); lblNewLabel.setText("Checked analysers will be used for traceability analysis"); checkboxTableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER | SWT.FULL_SELECTION); table = checkboxTableViewer.getTable(); FormData fd_table = new FormData(); fd_table.top = new FormAttachment(lblNewLabel); fd_table.left = new FormAttachment(0, 5); fd_table.bottom = new FormAttachment(75); fd_table.right = new FormAttachment(100, -5); table.setLayoutData(fd_table); checkboxTableViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof LabelledVisitor) { LabelledVisitor visitor = (LabelledVisitor) element; return visitor.getLabel(); } return super.getText(element); } }); checkboxTableViewer.setContentProvider(ArrayContentProvider.getInstance()); checkboxTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { Object firstElement = ((IStructuredSelection) event.getSelection()).getFirstElement(); if (firstElement instanceof LabelledVisitor) { LabelledVisitor labelled = (LabelledVisitor) firstElement; descriptionLabel.setText(labelled.getDescription()); } } }); checkboxTableViewer.setCheckStateProvider(new ICheckStateProvider() { @Override public boolean isGrayed(Object element) { return false; } @Override public boolean isChecked(Object element) { if (element instanceof LabelledVisitor) { LabelledVisitor labelled = (LabelledVisitor) element; return !(Boolean.FALSE.equals(prefs.get(labelled.getVisitorClass().getName()))); } return true; } }); checkboxTableViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { Object element = event.getElement(); if (element instanceof LabelledVisitor) { LabelledVisitor labelled = (LabelledVisitor) element; prefs.put(labelled.getVisitorClass().getName(), event.getChecked()); } } }); checkboxTableViewer.setInput(LabelledVisitor.getRegisteredVisitors()); Group grpDescription = new Group(container, SWT.NONE); FormData fd_grpDescription = new FormData(); fd_grpDescription.top = new FormAttachment(table, 5); fd_grpDescription.bottom = new FormAttachment(100); fd_grpDescription.left = new FormAttachment(0, 5); fd_grpDescription.right = new FormAttachment(100, -5); grpDescription.setLayoutData(fd_grpDescription); grpDescription.setLayout(new GridLayout(1, false)); grpDescription.setText("Description"); descriptionLabel = new Label(grpDescription, SWT.WRAP); descriptionLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); return container; }
From source file:org.polarsys.reqcycle.traceability.builder.ui.preferences.TraceabilityBuildersPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite c = new Composite(parent, SWT.None); c.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); c.setLayout(new GridLayout(1, false)); Label lblTheCheckedProjects = new Label(c, SWT.NONE); lblTheCheckedProjects.setText("The checked projects will be analyzed by ReqCycle traceability engine"); CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(c, SWT.BORDER); Table table = checkboxTableViewer.getTable(); checkboxTableViewer.setLabelProvider(new WorkbenchLabelProvider()); checkboxTableViewer.setContentProvider(new BaseWorkbenchContentProvider()); checkboxTableViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); checkboxTableViewer.setCheckStateProvider(new ICheckStateProvider() { @Override/*from www . j av a 2s .c o m*/ public boolean isGrayed(Object element) { return false; } @Override public boolean isChecked(Object element) { if (element instanceof IProject) { IProject project = (IProject) element; return BuilderUtil.isBuilderInstalled(project); } return false; } }); checkboxTableViewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { return element instanceof IProject && ((IProject) element).isAccessible(); } }); checkboxTableViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { Object element = event.getElement(); if (element instanceof IProject) { IProject project = (IProject) element; if (event.getChecked()) { BuilderUtil.installBuilder(project); } else { BuilderUtil.removeBuilder(project); } } } }); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); return parent; }
From source file:org.polarsys.reqcycle.traceability.types.configuration.preferences.dialogs.NewRelationDialog.java
License:Open Source License
/** * Create contents of the dialog./* w w w . j av a 2 s. c om*/ * * @param parent */ @Override protected Control createDialogArea(Composite parent) { setTitle("Create a new Relation Type"); Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayout(new GridLayout(1, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite composite = new Composite(container, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); composite.setLayout(new GridLayout(2, false)); treeViewer = new TreeViewer(composite, SWT.BORDER); Tree tree = treeViewer.getTree(); tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite composite_1 = new Composite(composite, SWT.NONE); composite_1.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); composite_1.setLayout(new GridLayout(1, false)); Button btnSource = new Button(composite_1, SWT.NONE); btnSource.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Object firstElement = ((IStructuredSelection) treeViewer.getSelection()).getFirstElement(); if (firstElement instanceof Type) { Type type = (Type) firstElement; set(type, textSource, TypeconfigurationPackage.Literals.RELATION__UPSTREAM_TYPE); } } }); btnSource.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1)); btnSource.setText("Upstream"); Button btnTarget = new Button(composite_1, SWT.NONE); btnTarget.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { set((Type) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement(), textTarget, TypeconfigurationPackage.Literals.RELATION__DOWNSTREAM_TYPE); } }); btnTarget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnTarget.setText("Downstream"); Group grpProperties = new Group(container, SWT.NONE); grpProperties.setLayout(new GridLayout(3, false)); grpProperties.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); grpProperties.setText("Properties"); Label lblNewLabel_1 = new Label(grpProperties, SWT.NONE); lblNewLabel_1.setText("Name : "); textKind = new Text(grpProperties, SWT.BORDER); textKind.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); textKind.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { rel.setKind(textKind.getText()); } }); Label lblIcon = new Label(grpProperties, SWT.NONE); lblIcon.setText("Icon : "); iconLabel = new Label(grpProperties, SWT.NONE); iconLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); iconLabel.setText("No Icon selected"); Button btnNewButton = new Button(grpProperties, SWT.NONE); btnNewButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); btnNewButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // image serialization PictureChooserDialog d = new PictureChooserDialog(getShell()); if (d.open() == Window.OK) { rel.setIcon(d.imageSelected); iconLabel.setImage(IconRegistry.getImage(rel.getIcon())); } } }); btnNewButton.setText("..."); Label lblSource = new Label(grpProperties, SWT.NONE); lblSource.setText("Upstream :"); textSource = new Text(grpProperties, SWT.BORDER); textSource.setEditable(false); textSource.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); Label lblNewLabel = new Label(grpProperties, SWT.NONE); lblNewLabel.setText("Downstream :"); textTarget = new Text(grpProperties, SWT.BORDER); textTarget.setEditable(false); textTarget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); Group grpIncludedTraceability = new Group(container, SWT.NONE); grpIncludedTraceability.setText("Included Traceability"); grpIncludedTraceability.setLayout(new FillLayout(SWT.HORIZONTAL)); grpIncludedTraceability.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); listOfTTViewer = CheckboxTableViewer.newCheckList(grpIncludedTraceability, SWT.BORDER | SWT.V_SCROLL | SWT.CHECK); listOfTTViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { String id = ((TType) event.getElement()).getId(); if (event.getChecked()) { rel.getAgregatedTypes().add(id); } else { rel.getAgregatedTypes().remove(id); } } }); listOfTTViewer.setContentProvider(new ArrayContentProvider()); listOfTTViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof TType) { TType ttype = (TType) element; return ttype.getLabel(); } return super.getText(element); } }); listOfTTViewer.setInput(Lists.newArrayList(ttManager.getAllTTypes())); IContentProvider provider = new PreferenceDialogTypesContentProvider(adapterFactory, this.container); ILabelProvider labelProvider = new PreferenceDialogTypeLabelProvider(adapterFactory, new AdapterFactoryLabelProvider(adapterFactory)); ZigguratInject.inject(labelProvider, provider); treeViewer.setContentProvider(provider); treeViewer.setLabelProvider(labelProvider); treeViewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { return element instanceof TypeConfigContainer || element instanceof Type; } }); treeViewer.setInput(this.container.eResource()); return area; }
From source file:org.python.pydev.debug.ui.PyConfigureExceptionDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { // page group Composite composite = (Composite) super.createDialogArea(parent); initializeDialogUnits(composite);/* w ww . j a va2s.co m*/ createMessageArea(composite); listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER); GridData data = new GridData(GridData.FILL_BOTH); data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT; data.widthHint = SIZING_SELECTION_WIDGET_WIDTH; listViewer.getTable().setLayoutData(data); listViewer.setLabelProvider(labelProvider); listViewer.setContentProvider(contentProvider); createSelectionButtons(composite); initContent(); // initialize page if (!getInitialElementSelections().isEmpty()) { checkInitialSelections(); } Dialog.applyDialogFont(composite); getViewer().addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (getCheckBoxTableViewer().getChecked(element)) { addToSelectedElements(element); } return matchExceptionToShowInList(element); } }); getCheckBoxTableViewer().addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { addToSelectedElements(event.getElement()); } else { removeFromSelectedElements(event.getElement()); } } }); createCustomExceptionUI(composite); createDealingWithExceptionsOptions(composite); return composite; }
From source file:org.rubypeople.rdt.internal.ui.workingsets.WorkingSetConfigurationDialog.java
License:Open Source License
private void createTableViewer(Composite parent) { fTableViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI); fTableViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { updateButtonAvailability();//from w w w. j a v a 2s.com } }); GridData data = new GridData(GridData.FILL_BOTH); data.heightHint = convertHeightInCharsToPixels(20); data.widthHint = convertWidthInCharsToPixels(50); fTableViewer.getTable().setLayoutData(data); fTableViewer.getTable().setFont(parent.getFont()); fTableViewer.addFilter(new Filter()); fTableViewer.setLabelProvider(new WorkingSetLabelProvider()); fTableViewer.setContentProvider(new CollectionContentProvider()); fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { handleSelectionChanged(); } }); }