本文整理汇总了Java中org.eclipse.jface.viewers.ComboViewer.setContentProvider方法的典型用法代码示例。如果您正苦于以下问题:Java ComboViewer.setContentProvider方法的具体用法?Java ComboViewer.setContentProvider怎么用?Java ComboViewer.setContentProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.ComboViewer
的用法示例。
在下文中一共展示了ComboViewer.setContentProvider方法的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: createEmbeddedTypeScriptField
import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
private void createEmbeddedTypeScriptField(Composite parent, ITypeScriptRepository[] repositories) {
useEmbeddedTsRuntimeButton = new Button(parent, SWT.RADIO);
useEmbeddedTsRuntimeButton
.setText(TypeScriptUIMessages.WizardNewTypeScriptProjectCreationPage_useEmbeddedTsRuntime_label);
useEmbeddedTsRuntimeButton.addListener(SWT.Selection, this);
useEmbeddedTsRuntimeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateTsRuntimeMode();
}
});
embeddedTsRuntime = new Combo(parent, SWT.READ_ONLY);
embeddedTsRuntime.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ComboViewer viewer = new ComboViewer(embeddedTsRuntime);
viewer.setContentProvider(ArrayContentProvider.getInstance());
viewer.setLabelProvider(new TypeScriptRepositoryLabelProvider());
viewer.setInput(repositories);
}
示例5: 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);
}
});
}
示例6: addMappingBaseCombo
import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
/**
* Add the mapping base {@link ComboViewer} to the given header {@link Composite}.
*
* @param headerComposite
* the header {@link Composite}
* @return the mapping base {@link ComboViewer}
*/
private ComboViewer addMappingBaseCombo(Composite headerComposite) {
final Label selectMappingBaseLabel = new Label(headerComposite, SWT.NONE);
selectMappingBaseLabel.setToolTipText("Select a mapping base.");
selectMappingBaseLabel.setText("Mapping base:");
final ComboViewer mappingCombo = new ComboViewer(headerComposite, SWT.READ_ONLY);
Combo combo = mappingCombo.getCombo();
combo.setToolTipText("Select the mapping base to use.");
mappingCombo.setContentProvider(new MappingBaseRegistryContentProvider());
mappingCombo.setLabelProvider(new MappingLabelProvider(MappingLabelProvider.SOURCE));
mappingCombo.setComparator(new ViewerComparator());
mappingCombo.setInput(MappingUtils.getMappingRegistry());
mappingCombo.addSelectionChangedListener(new BaseComboSelectionChangedListener());
return mappingCombo;
}
示例7: 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);
}
示例8: MapChoiceControl
import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
public MapChoiceControl(Composite parent) {
super(parent, SWT.NONE);
setLayout(new FillLayout());
viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT);
viewer.setContentProvider(new ControlContentProvider());
viewer.setLabelProvider(CONTROL_LABEL_PROVIDER);
viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() {
@Override
public String getString(Object object) {
return CONTROL_LABEL_PROVIDER.getText(object);
}
}));
listener = new ControlSelectionChangedListener();
viewer.addSelectionChangedListener(listener);
}
示例9: 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);
}
示例10: addVersicherungstraegerComboSelector
import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
protected void addVersicherungstraegerComboSelector(Composite container){
Label lblSVT = new Label(container, SWT.NONE);
lblSVT.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblSVT.setText("Versicherungsträger");
comboViewerSVT = new ComboViewer(container, SWT.NONE);
comboViewerSVT.getCombo().setLayoutData(
new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
comboViewerSVT.setContentProvider(new ArrayContentProvider());
comboViewerSVT.setLabelProvider(new SvtPropertyComboLabelProvider());
SvtProperty[] sp = GINAStatus.getCurrentSVTList();
if (sp != null)
comboViewerSVT.setInput(sp);
comboViewerSVT.getCombo().setText(AUTOMATISCH_ERMITTELN);
comboViewerSVT.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event){
IStructuredSelection versicherungstraegerSelection =
(IStructuredSelection) event.getSelection();
selectedVersicherungstraegerCode =
((SvtProperty) versicherungstraegerSelection.getFirstElement()).getCode();
}
});
}
示例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: createComponentViewer
import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
private void createComponentViewer(Composite composite) {
UI.formLabel(composite, toolkit, M.Component);
componentViewer = new ComboViewer(composite);
UI.gridData(componentViewer.getControl(), false, false).widthHint = 250;
componentViewer.setContentProvider(ArrayContentProvider
.getInstance());
componentViewer.setLabelProvider(new ComponentLabel());
componentViewer.setInput(ReportComponent.values());
componentViewer.addSelectionChangedListener((evt) -> {
ReportComponent c = Viewers.getFirst(evt.getSelection());
if (c == null || c == ReportComponent.NONE)
model.componentId = null;
else
model.componentId = c.getId();
editor.setDirty(true);
});
if (model.componentId != null)
componentViewer.setSelection(new StructuredSelection(
ReportComponent.getForId(model.componentId)));
}
示例13: createControl
import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
public void createControl(Composite parent)
{
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout(2, false));
new Label(composite, SWT.NULL).setText(Localizer.getMessage("UNIVERSAL") + ": ");
universal = new ComboViewer(composite, SWT.BORDER | SWT.READ_ONLY);
universal.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
universal.setContentProvider(new UniversalContentProvider(universals));
universal.setLabelProvider(new LabelProvider());
universal.setInput(data);
new Label(composite, SWT.NULL).setText(Localizer.getMessage("TYPE") + ": ");
type = new ComboViewer(composite, SWT.BORDER | SWT.READ_ONLY);
type.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
type.setContentProvider(new AttributeContentProvider(false));
type.setLabelProvider(new LabelProvider());
setControl(composite);
this.bind(universal, "universal");
this.bind(type, "type");
}
示例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);
}