本文整理汇总了Java中org.eclipse.jface.viewers.ComboViewer类的典型用法代码示例。如果您正苦于以下问题:Java ComboViewer类的具体用法?Java ComboViewer怎么用?Java ComboViewer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComboViewer类属于org.eclipse.jface.viewers包,在下文中一共展示了ComboViewer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createControl
import org.eclipse.jface.viewers.ComboViewer; //导入依赖的package包/类
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
GridLayout gridLayout = new GridLayout();
container.setLayout(gridLayout);
skip(container);
Label explanation = new Label(container, SWT.NONE);
explanation.setText(MessageUtil.getString("choose_the_execution_context_you_want_to_extend"));
skip(container);
ComboViewer comboViewer = new ComboViewer(container, SWT.NONE);
Combo combo = comboViewer.getCombo();
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
loadAncestor(model);
setupAncestor(comboViewer);
setControl(container);
}
示例2: createControl
import org.eclipse.jface.viewers.ComboViewer; //导入依赖的package包/类
@Override
public void createControl(Composite parent) {
Composite area = new Composite(parent, SWT.NONE);
area.setLayout(new GridLayout(2, false));
area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
new Label(area, SWT.NONE).setText(Messages.PgObject_project_name);
viewerProject = new ComboViewer(area, SWT.READ_ONLY | SWT.DROP_DOWN);
new Label(area, SWT.NONE).setText(Messages.PgObject_object_type);
viewerType = new ComboViewer(area, SWT.READ_ONLY | SWT.DROP_DOWN);
new Label(area, SWT.NONE).setText(Messages.PgObject_object_name);
final Text txtName = new Text(area, SWT.BORDER);
txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
txtName.addModifyListener(e -> {
name = txtName.getText();
getWizard().getContainer().updateButtons();
});
fillProjects();
fillTypes();
setControl(area);
}
示例3: 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();
}
});
}
示例4: 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();
}
示例5: createUIConventional
import org.eclipse.jface.viewers.ComboViewer; //导入依赖的package包/类
public void createUIConventional(Composite parent) {
parent.setLayout(GridLayoutFactory.swtDefaults().numColumns(3).create());
Label label = new Label(parent, SWT.NONE);
label.setText("Selection");
ComboViewer viewer = new ComboViewer(parent, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
customizeComboViewer(viewer);
viewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Button button = new Button(parent, SWT.NONE);
button.setText("Apply");
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
text.setText("Selection: " + viewer.getCombo().getText());
}
});
text = new Text(parent, SWT.READ_ONLY | SWT.BORDER);
text.setLayoutData(
GridDataFactory.swtDefaults().span(3, 1).grab(true, true).align(SWT.FILL, SWT.FILL).create());
}
示例6: createUI
import org.eclipse.jface.viewers.ComboViewer; //导入依赖的package包/类
public void createUI(Composite parent) {
root = SwtUI.wrap(parent);
root.layout(GridLayoutFactory.swtDefaults().numColumns(3).create())//
.childControl(() -> SwtUI.create(Label::new)//
.text("Selection"))//
.childControl(() -> ViewerUI.createViewer(ComboViewer::new, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY)//
.id("selectionCombo")//
.customizeViewer(this::customizeComboViewer)//
.layoutData(new GridData(GridData.FILL_HORIZONTAL)))//
.childControl(() -> SwtUI.create(Button::new)//
.text("Apply")//
.on(SWT.Selection, this::onButtonClick))//
.childControl(() -> SwtUI.create(Text::new, SWT.READ_ONLY | SWT.BORDER)//
.id("textField")//
.layoutData(GridDataFactory.swtDefaults().span(3, 1).grab(true, true).align(SWT.FILL, SWT.FILL)
.create()));
}
示例7: 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);
}
示例8: 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);
}
示例9: createEmbeddedTslintField
import org.eclipse.jface.viewers.ComboViewer; //导入依赖的package包/类
private void createEmbeddedTslintField(Composite parent) {
useEmbeddedTslintRuntimeButton = new Button(parent, SWT.RADIO);
useEmbeddedTslintRuntimeButton.setText(TypeScriptUIMessages.TSLintWizardPage_useEmbeddedTslintRuntime_label);
useEmbeddedTslintRuntimeButton.addListener(SWT.Selection, this);
useEmbeddedTslintRuntimeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateTslintRuntimeMode();
}
});
embeddedTslintRuntime = new Combo(parent, SWT.READ_ONLY);
embeddedTslintRuntime.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ComboViewer viewer = new ComboViewer(embeddedTslintRuntime);
viewer.setContentProvider(ArrayContentProvider.getInstance());
viewer.setLabelProvider(new TypeScriptRepositoryLabelProvider(true, false));
List<ITypeScriptRepository> repositories = Arrays
.stream(TypeScriptCorePlugin.getTypeScriptRepositoryManager().getRepositories())
.filter(r -> r.getTslintFile() != null).collect(Collectors.toList());
viewer.setInput(repositories);
}
示例10: 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);
}
示例11: 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;
}
示例12: 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;
}
示例13: setConfigComboViewer
import org.eclipse.jface.viewers.ComboViewer; //导入依赖的package包/类
/**
* @param subtypeCMB_Main_viewer2
* @param string
*/
private void setConfigComboViewer(ComboViewer viewer, String inputString) {
Object input = viewer.getInput();
if (input instanceof BTSConfigItem) {
for (BTSConfig i : ((BTSConfig) input).getChildren()) {
if (i instanceof BTSConfigItem
&& inputString
.equals(((BTSConfigItem) i).getValue())) {
viewer.setSelection(new StructuredSelection(i));
return;
}
}
BTSConfigItem cci = BtsmodelFactory.eINSTANCE
.createBTSConfigItem();
cci.setLabel(BtsmodelFactory.eINSTANCE.createBTSTranslations());
cci.getLabel().setTranslation(inputString, "en");
cci.setValue(inputString);
((BTSConfig) input).getChildren().add(cci);
viewer.setSelection(new StructuredSelection( cci));
return;
}
}
示例14: createGeneratorCombo
import org.eclipse.jface.viewers.ComboViewer; //导入依赖的package包/类
private void createGeneratorCombo(Composite container) {
Label lblGenerator = new Label(container, SWT.NONE);
lblGenerator.setText("Generator");
generatorCombo = new ComboViewer(container, SWT.READ_ONLY);
generatorCombo.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
generatorCombo.setLabelProvider(new GeneratorDescriptorLabelProvider());
generatorCombo.setContentProvider(new ArrayContentProvider());
List<IGeneratorDescriptor> descriptors = Lists.newArrayList(GeneratorExtensions.getGeneratorDescriptors());
Collections.sort(descriptors, CoreGenerator.generatorOrder);
generatorCombo.setInput(descriptors);
generatorCombo.getCombo().select(0);
generatorCombo.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
refreshInput();
}
});
}
示例15: 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);
}
}