本文整理匯總了Java中org.eclipse.jface.viewers.ComboViewer.setLabelProvider方法的典型用法代碼示例。如果您正苦於以下問題:Java ComboViewer.setLabelProvider方法的具體用法?Java ComboViewer.setLabelProvider怎麽用?Java ComboViewer.setLabelProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.ComboViewer
的用法示例。
在下文中一共展示了ComboViewer.setLabelProvider方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createRuntimeField
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
@Override
protected void createRuntimeField(Composite composite) {
Label runtimeLabel = new Label(composite, SWT.LEAD);
runtimeLabel.setText(Messages.getString("app.engine.standard.project.runtimetype")); //$NON-NLS-1$
runtimeField = new ComboViewer(composite, SWT.READ_ONLY);
runtimeField.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((AppEngineRuntime) element).getLabel();
}
});
runtimeField.setContentProvider(ArrayContentProvider.getInstance());
runtimeField.setInput(AppEngineRuntime.STANDARD_RUNTIMES);
runtimeField.setSelection(new StructuredSelection(DEFAULT_RUNTIME), true);
runtimeField.addPostSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
revalidate();
}
});
}
示例2: create
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void create(Composite parent) {
displayExecutor = DisplayExecutor.create(parent.getDisplay());
comboViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
comboViewer.setComparator(new ViewerComparator());
comboViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof GcpProject) {
GcpProject project = (GcpProject) element;
return project.getName() + " (" + project.getId() + ")";
}
return super.getText(element);
}
});
comboViewer.setContentProvider(ArrayContentProvider.getInstance());
comboViewer.setInput(EMPTY_PROJECTS);
parent.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent event) {
cancelFetch();
}
});
fetch();
}
示例3: createUI
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
@Override
protected void createUI(Composite parent) {
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginHeight = 0;
this.setLayout(layout);
// itemsPerPageLabel = new Label(parent, SWT.NONE);
// itemsPerPageLabel.setText(Resources.getText(
// Resources.PaginationRenderer_itemsPerPage, getLocale()));
// itemsPerPageLabel.setLayoutData(new GridData());
comboViewer = new ComboViewer(parent, SWT.READ_ONLY);
comboViewer.setContentProvider(ArrayContentProvider.getInstance());
comboViewer.setLabelProvider(InternalLabelProvider.getInstance());
comboViewer.getCombo().setLayoutData(
new GridData(GridData.FILL_HORIZONTAL));
comboViewer.getCombo().addSelectionListener(this);
}
示例4: addProblemTypeRow
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void addProblemTypeRow(Composite categoryProblemsPanel, IGdtProblemType problemType) {
GridData problemLabelLayout = new GridData(SWT.FILL, SWT.CENTER, true, false);
Label problemLabel = new Label(categoryProblemsPanel, SWT.NONE);
problemLabel.setLayoutData(problemLabelLayout);
problemLabel.setText(problemType.getDescription());
ComboViewer severityCombo = new ComboViewer(categoryProblemsPanel, SWT.READ_ONLY);
GridData severityComboLayout = new GridData(SWT.FILL, SWT.CENTER, false, false);
severityCombo.getCombo().setLayoutData(severityComboLayout);
severityCombo.setContentProvider(new ArrayContentProvider());
severityCombo.setLabelProvider(severityLabelProvider);
severityCombo.setSorter(severityViewerSorter);
severityCombo.setInput(GdtProblemSeverity.values());
// Save the association between the problem type and this combo
problemSeverityCombos.put(problemType, severityCombo);
}
示例5: createRepositoryPart
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private ComboViewer createRepositoryPart(Composite container, final List<ITeamRepository> repos) {
Label repoLabel= new Label(container, SWT.NONE);
repoLabel.setText("Repository:");
Combo repoCombo= new Combo(container, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
repoCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
ComboViewer comboViewer= new ComboViewer(repoCombo);
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setLabelProvider(new RepositoryLabelProvider());
comboViewer.setInput(repos);
comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
withRepository((ITeamRepository)((IStructuredSelection)event.getSelection()).getFirstElement());
}
});
return comboViewer;
}
示例6: createEmbeddedTslintPluginField
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void createEmbeddedTslintPluginField(Composite parent) {
useEmbeddedTslintPluginButton = new Button(parent, SWT.RADIO);
useEmbeddedTslintPluginButton.setText(TypeScriptUIMessages.TSLintWizardPage_useEmbeddedTslintPlugin_label);
useEmbeddedTslintPluginButton.addListener(SWT.Selection, this);
useEmbeddedTslintPluginButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateTslintPluginMode();
}
});
embeddedTslintPlugin = new Combo(parent, SWT.READ_ONLY);
embeddedTslintPlugin.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ComboViewer viewer = new ComboViewer(embeddedTslintPlugin);
viewer.setContentProvider(ArrayContentProvider.getInstance());
viewer.setLabelProvider(new TypeScriptRepositoryLabelProvider(false, true));
List<ITypeScriptRepository> repositories = Arrays
.stream(TypeScriptCorePlugin.getTypeScriptRepositoryManager().getRepositories())
.filter(r -> r.getTslintLanguageServiceName() != null).collect(Collectors.toList());
viewer.setInput(repositories);
}
示例7: addBehandlungsfallComboSelector
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
protected void addBehandlungsfallComboSelector(Composite container){
Label lblBehandlungsfall = new Label(container, SWT.NONE);
lblBehandlungsfall.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblBehandlungsfall.setText("Behandlungsfall");
comboViewerBehandlungsfall = new ComboViewer(container, SWT.NONE);
comboViewerBehandlungsfall.getCombo().setLayoutData(
new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
comboViewerBehandlungsfall.getCombo().setEnabled(false);
comboViewerBehandlungsfall.setContentProvider(ArrayContentProvider.getInstance());
comboViewerBehandlungsfall.setLabelProvider(new BasePropertyComboLabelProvider());
comboViewerBehandlungsfall.setComparator(new BasePropertyViewerComparator());
comboViewerBehandlungsfall.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event){
IStructuredSelection behandlungsfallSelection =
(IStructuredSelection) event.getSelection();
selectedBehandlungsfallCode =
((BaseProperty) behandlungsfallSelection.getFirstElement()).getCode();
setExecuteOk(true);
}
});
}
示例8: createFieldEditors
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
/**
* Create contents of the preference page.
*/
@Override
protected void createFieldEditors() {
// Create the field editors
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.bbaw.bts.app");
Composite container = (Composite) this.getControl();
container.setLayout(new GridLayout(1, false));
Label activeConfigLB = new Label(container, SWT.NONE);
activeConfigLB.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false,
false, 1, 1));
activeConfigLB.setText("Currently active Configuration");
activeConfigcomboViewer = new ComboViewer(container, SWT.READ_ONLY);
activeConfigcomboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
false, 1, 1));
ComposedAdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider(factory);
activeConfigcomboViewer.setContentProvider(new AdapterFactoryContentProvider(factory));
activeConfigcomboViewer.setLabelProvider(labelProvider);
init(null);
loaded = true;
}
示例9: ContextValueControl
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
public ContextValueControl(Composite parent) {
super(parent, SWT.NONE);
setLayout(new FillLayout());
viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(CONTROL_LABEL_PROVIDER);
viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() {
@Override
public String getString(Object object) {
return CONTROL_LABEL_PROVIDER.getText(object);
}
}));
viewer.setInput(ContextKey.Base.values());
listener = new ControlSelectionChangedListener();
viewer.addSelectionChangedListener(listener);
}
示例10: ComposeModeControl
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
public ComposeModeControl(Composite parent) {
super(parent, SWT.NONE);
setLayout(new FillLayout());
viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(CONTROL_LABEL_PROVIDER);
viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() {
@Override
public String getString(Object object) {
return CONTROL_LABEL_PROVIDER.getText(object);
}
}));
viewer.setInput(ComposeMode.values());
listener = new ControlSelectionChangedListener();
viewer.addSelectionChangedListener(listener);
}
示例11: createDomainCombo
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
protected void createDomainCombo(Composite leftColumn) {
Label label = getToolkit().createLabel(leftColumn, "Statechart domain");
GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(label);
domainCombo = new ComboViewer(leftColumn);
GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
Label spacer = getToolkit().createLabel(leftColumn, "");
GridDataFactory.fillDefaults().applyTo(spacer);
domainCombo.setContentProvider(new ArrayContentProvider());
domainCombo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((IDomain) element).getName();
}
});
List<IDomain> domains = DomainRegistry.getDomains();
for (IDomain domainDescriptor : domains) {
domainCombo.add(domainDescriptor);
}
if (domains.size() <= 1) {
domainCombo.getControl().setEnabled(false);
}
}
示例12: createCurrencyRow
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void createCurrencyRow(Composite body, FormToolkit tk) {
Combo widget = UI.formCombo(body, tk, M.Currency);
currencyCombo = new ComboViewer(widget);
currencyCombo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object obj) {
if (!(obj instanceof Currency))
return super.getText(obj);
return ((Currency) obj).getName();
}
});
setCurrencyContent(currencyCombo);
currencyCombo.addSelectionChangedListener(e -> {
currency = Viewers.getFirst(e.getSelection());
exchange.currency = currency;
updateCurrencyLabels();
});
UI.filler(body, tk);
}
示例13: bindUniverseDefinition
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void bindUniverseDefinition(ComboViewer universeDefinitionCombo) {
universeDefinitionCombo.setContentProvider(new ArrayContentProvider());
universeDefinitionCombo.setLabelProvider(new ProjectUniverseLabelProvider());
universeDefinitionCombo.setComparator(new ViewerComparator());
Set<ProjectUniverse> projectUniverses = getProjectUniverses();
universeDefinitionCombo.setInput(projectUniverses);
IObservableValue selectedUniverseDefinition = ViewerProperties.singleSelection().observe(universeDefinitionCombo);
IObservableValue universeDefinition = BeansObservables.observeValue(editVersionModel, EditVersionModel.PN_PROJECT_UNIVERSE);
dbc.bindValue(selectedUniverseDefinition, universeDefinition);
ProjectUniverse projectUniverse = findUniverse(projectUniverses, getUniverseId());
if (projectUniverse == null) {
projectUniverse = findUniverse(projectUniverses, UniverseDefinitions.ALL_WORKSPACE_PROJECTS_UNIVERSE_ID);
}
/* We simply use the first element in the list as the initial selection. */
if (0 < universeDefinitionCombo.getCombo().getItemCount()) {
universeDefinitionCombo.setSelection(new StructuredSelection(projectUniverse));
}
}
示例14: setupAncestor
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void setupAncestor(ComboViewer comboViewer) {
comboViewer.setContentProvider(new IStructuredContentProvider() {
@Override
public Object[] getElements(Object inputElement) {
List<IFile> files = (List<IFile>) inputElement;
Object[] ret = new Object[files.size()];
int index = 0;
for (IFile file : files) {
ret[index++] = JavaCore.create(file);
}
return ret;
}
});
comboViewer.setLabelProvider(new JavaElementLabelProvider(
JavaElementLabelProvider.SHOW_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT));
comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection.size() > 0) {
ancestor = (ICompilationUnit) selection.getFirstElement();
}
}
});
comboViewer.getCombo().setData(GW4E_CONVERSION_WIDGET_ID, GW4E_CONVERSION_COMBO_ANCESTOR_EXTEND_TEST);
comboViewer.setInput(ancestors);
if (hasItems()) {
comboViewer.setSelection(new StructuredSelection(JavaCore.create(ancestors.get(0))));
}
}
示例15: createTestContainerSelectionGroup
import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void createTestContainerSelectionGroup (Composite parent) {
Label fTestLabel = new Label(parent, SWT.NONE);
GridData gd = new GridData( );
gd.horizontalAlignment = SWT.RIGHT;
gd.horizontalIndent = 25;
gd.verticalAlignment=SWT.TOP;
fTestLabel.setLayoutData(gd);
fTestLabel.setText(MessageUtil.getString("mainTestExecutionContext"));
fMainTestExecutionComboViewer = new ComboViewer(parent,SWT.DROP_DOWN);
Combo combo = fMainTestExecutionComboViewer.getCombo();
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
fMainTestExecutionComboViewer.setContentProvider(new IStructuredContentProvider(){
@Override
public Object[] getElements(Object inputElement) {
String projectName= (String) inputElement;
loadMainExecutionContextTests(projectName);
return mainExecutionContexts;
}
});
ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_QUALIFIED);
fMainTestExecutionComboViewer.setLabelProvider(labelProvider);
fMainTestExecutionComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
fAdditionalTestViewer.setInput(null);
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection.size() > 0){
resetDoHint();
IType type = (IType) selection.getFirstElement();
fAdditionalTestViewer.setInput(type);
validatePage();
}
}
});
combo.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4E_LAUNCH_TEST_CONFIGURATION_MAIN_TEST);
}