List of usage examples for org.eclipse.jface.viewers LabelProvider LabelProvider
public LabelProvider()
From source file:com.salesforce.ide.ui.views.runtest.ProjectConfigurationTab.java
License:Open Source License
/** * Display a list of projects in the workspace and return the selected one. *//*from ww w .ja va 2 s . c o m*/ @VisibleForTesting public IProject chooseProject() { // Get all projects in workspace ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider() { @Override public String getText(Object element) { if (Utils.isNotEmpty(element) && element instanceof IProject) { return ((IProject) element).getName(); } return ""; } }); // Display the projects in dialog. If there is none, user cannot launch config. dialog.setTitle(Messages.Tab_ProjectDialogTitle); dialog.setMessage(Messages.Tab_ProjectDialogInstruction); dialog.setHelpAvailable(false); dialog.setElements(ContainerDelegate.getInstance().getServiceLocator().getProjectService() .getForceProjects().toArray()); if (dialog.open() == Window.OK) { return (IProject) dialog.getFirstResult(); } return null; }
From source file:com.salesforce.ide.ui.views.runtest.RunTestsTab.java
License:Open Source License
/** * Display a list of projects in the workspace and return the selected one. * @return IProject/* w w w . j a v a2s . c om*/ */ private IProject chooseProject() { // Get all projects in workspace ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider() { @Override public String getText(Object element) { if (element == null) return ""; if (element instanceof IProject) return ((IProject) element).getName(); return element.toString(); } }); // Display the projects in dialog. If there is none, user cannot launch config. dialog.setTitle(Messages.GenericTab_ProjectDialogTitle); dialog.setMessage(Messages.RunTestsTab_ProjectDialogInstruction); dialog.setElements(ContainerDelegate.getInstance().getServiceLocator().getProjectService() .getForceProjects().toArray()); if (dialog.open() == Window.OK) { return (IProject) dialog.getFirstResult(); } return null; }
From source file:com.salesforce.ide.ui.views.runtest.RunTestsTab.java
License:Open Source License
/** * Display a list of test classes in the project and return * the selected one.//www . j a v a 2 s.c o m * @return Name of test class */ private String chooseTestClass() { // Display the test classes in dialog ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider() { @Override public String getText(Object element) { if (element == null) return ""; if (element instanceof Test) return ((Test) element).getClassName(); return element.toString(); } }); dialog.setTitle(Messages.GenericTab_ClassDialogTitle); dialog.setMessage(Messages.RunTestsTab_ClassDialogInstruction); // We already got the test classes earlier so just display them if (allTests != null && allTests.getTests() != null && !allTests.getTests().isEmpty()) { dialog.setElements(allTests.getTests().toArray()); } if (dialog.open() == Window.OK) { return ((Test) dialog.getFirstResult()).getClassName(); } return null; }
From source file:com.salesforce.ide.ui.views.runtest.RunTestsTab.java
License:Open Source License
/** * Display a list of test methods in the test class and return * the selected one./*from ww w .j a va 2s .c om*/ * @return Name of test method */ private String chooseTestMethod() { // We already got test methods earlier so just display the ones // for previously specified test class List<String> testMethodNames = new ArrayList<String>(); for (Test test : allTests.getTests()) { if (test.getClassName().equals(classText.getText())) { testMethodNames = test.getTestMethods(); } } // Display the test methods in dialog ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider() { @Override public String getText(Object element) { if (element == null) return ""; return element.toString(); } }); dialog.setTitle(Messages.GenericTab_MethodDialogTitle); dialog.setMessage(Messages.RunTestsTab_MethodDialogInstruction); if (testMethodNames != null && !testMethodNames.isEmpty()) { dialog.setElements(testMethodNames.toArray()); } if (dialog.open() == Window.OK) { return dialog.getFirstResult().toString(); } return null; }
From source file:com.salesforce.ide.ui.views.runtest.TestConfigurationTab.java
License:Open Source License
/** * Display a list of test classes in the project and return * the selected one./*from w ww . j ava2 s.com*/ * @return Name of test class */ @VisibleForTesting public String chooseTestClass() { // Display the test classes in dialog ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider() { @Override public String getText(Object element) { if (Utils.isNotEmpty(element) && element instanceof Test) { return ((Test) element).getClassName(); } return ""; } }); dialog.setTitle(Messages.Tab_ClassDialogTitle); dialog.setMessage(Messages.Tab_ClassDialogInstruction); dialog.setHelpAvailable(false); IProject selectedProject = projectTab.getProjectFromName(); TestsHolder rt = allTests.get(selectedProject); // We already got the test classes earlier so just display them if (rt != null && rt.getTests() != null && !rt.getTests().isEmpty()) { dialog.setElements(rt.getTests().toArray()); } if (dialog.open() == Window.OK) { return ((Test) dialog.getFirstResult()).getClassName(); } return null; }
From source file:com.salesforce.ide.ui.views.runtest.TestConfigurationTab.java
License:Open Source License
/** * Display a list of test methods in the test class and return * the selected one./* ww w .j a va 2 s. com*/ * @return Name of test method */ @VisibleForTesting public String chooseTestMethod() { // We already got test methods earlier so just display the ones // for previously specified test class List<String> testMethodNames = Lists.newArrayList(); IProject selectedProject = projectTab.getProjectFromName(); TestsHolder rt = allTests.get(selectedProject); for (Test test : rt.getTests()) { if (test.getClassName().equals(getTestClassName())) { testMethodNames = test.getTestMethods(); } } // Display the test methods in dialog ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider() { @Override public String getText(Object element) { if (Utils.isEmpty(element)) { return ""; } return element.toString(); } }); dialog.setTitle(Messages.Tab_MethodDialogTitle); dialog.setMessage(Messages.Tab_MethodDialogInstruction); dialog.setHelpAvailable(false); if (testMethodNames != null && !testMethodNames.isEmpty()) { dialog.setElements(testMethodNames.toArray()); } if (dialog.open() == Window.OK) { return dialog.getFirstResult().toString(); } return null; }
From source file:com.sap.dirigible.ide.repository.ui.viewer.ArtifactPropertySource.java
License:Open Source License
private static IPropertyDescriptor createDescriptor(Entry<String, Object> entry) { PropertyDescriptor descriptor = new PropertyDescriptor(entry.getKey(), entry.getKey()); descriptor.setLabelProvider(new LabelProvider() { /**// ww w .j a v a2s . c o m * */ private static final long serialVersionUID = -4014575485655343006L; @Override public String getText(Object element) { return String.valueOf(element); } }); return descriptor; }
From source file:com.siteview.mde.internal.ui.editor.product.PluginConfigurationSection.java
License:Open Source License
private ILabelProvider getLabelProvider() { return new LabelProvider(); }
From source file:com.siteview.mde.internal.ui.editor.product.PropertiesSection.java
License:Open Source License
protected void createClient(Section section, FormToolkit toolkit) { section.setText(MDEUIMessages.PropertiesSection_PropertiesSectionTitle); section.setDescription(MDEUIMessages.PropertiesSection_PropertiesSectionDescription); GridData sectionData = new GridData(SWT.FILL, SWT.FILL, true, true); sectionData.horizontalSpan = 2;//from ww w . j ava 2 s . co m section.setLayoutData(sectionData); Composite container = createClientContainer(section, 3, toolkit); createViewerPartControl(container, SWT.MULTI | SWT.FULL_SELECTION, 3, toolkit); fPropertiesTable = getTablePart().getTableViewer(); fPropertiesTable.setSorter(new ViewerSorter()); fPropertiesTable.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { handleEdit(); } }); fPropertiesTable.getTable().addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.DEL) { handleRemove(); } } }); final Table table = fPropertiesTable.getTable(); final TableColumn nameColumn = new TableColumn(table, SWT.LEFT); nameColumn.setText(MDEUIMessages.PropertiesSection_NameColumn); nameColumn.setWidth(200); final TableColumn valueColumn = new TableColumn(table, SWT.LEFT); valueColumn.setText(MDEUIMessages.PropertiesSection_ValueColumn); valueColumn.setWidth(300); TextCellEditor cellEditor = new TextCellEditor(table); cellEditor.getControl().pack(); fPropertiesTable.setCellEditors(new CellEditor[] { null, cellEditor }); fPropertiesTable.setColumnProperties(new String[] { "0", "1" }); // You must enter column properties to have cell editors //$NON-NLS-1$//$NON-NLS-2$ fPropertiesTable.setCellModifier(new ValueCellModifier()); table.setHeaderVisible(true); toolkit.paintBordersFor(container); fPropertiesTable.setLabelProvider(new LabelProvider()); fPropertiesTable.setContentProvider(new ContentProvider()); fPropertiesTable.setInput(getProduct()); section.setClient(container); getModel().addModelChangedListener(this); getTablePart().setButtonEnabled(0, isEditable()); updateButtons(); }
From source file:com.siteview.mde.internal.ui.editor.schema.SchemaIdentifierAttributeDetails.java
License:Open Source License
protected void createTypeDetails(Composite parent, FormToolkit toolkit) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 40;/*from ww w. j a va 2 s . co m*/ gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT; fReferenceEntry = new FormEntry(parent, toolkit, MDEUIMessages.SchemaStringAttributeDetails_reference, MDEUIMessages.SchemaAttributeDetails_browseButton, false, 11); Color foreground = toolkit.getColors().getColor(IFormColors.TITLE); Label label = toolkit.createLabel(parent, MDEUIMessages.SchemaIdentifierAttributeDetails_additionalRestrictions); label.setForeground(foreground); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.horizontalIndent = 11; gd.verticalIndent = 2; label.setLayoutData(gd); // create restrictions Composite tableComp = toolkit.createComposite(parent); GridLayout layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; tableComp.setLayout(layout); tableComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Table table = toolkit.createTable(tableComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 40; gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT; table.setLayoutData(gd); fRestrictionsTable = new TableViewer(table); fRestrictionsTable.setContentProvider(new SchemaAttributeContentProvider()); fRestrictionsTable.setLabelProvider(new LabelProvider()); Composite resButtonComp = toolkit.createComposite(parent); layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; resButtonComp.setLayout(layout); resButtonComp.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); fAddRestriction = toolkit.createButton(resButtonComp, MDEUIMessages.SchemaAttributeDetails_addRestButton, SWT.NONE); fRemoveRestriction = toolkit.createButton(resButtonComp, MDEUIMessages.SchemaAttributeDetails_removeRestButton, SWT.NONE); fAddRestriction.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fRemoveRestriction.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); }