本文整理匯總了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);
}
}