@Override
protected Control createDialogArea(Composite parentShell) {
Composite parent = (Composite) super.createDialogArea(parentShell);
Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(2, false));
Label l = new Label(c, SWT.NONE);
l.setText("Select device: ");
final Combo combo = new Combo(c, SWT.BORDER | SWT.READ_ONLY);
combo.setItems(mDeviceNames);
int defaultSelection =
sSelectedDeviceIndex < mDevices.size() ? sSelectedDeviceIndex : 0;
combo.select(defaultSelection);
sSelectedDeviceIndex = defaultSelection;
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
sSelectedDeviceIndex = combo.getSelectionIndex();
}
});
return parent;
}
java类org.eclipse.swt.widgets.Combo的实例源码
ScreenshotAction.java 文件源码
项目:android-uiautomatorviewer
阅读 31
收藏 0
点赞 0
评论 0
ConfigurationFormToolkit.java 文件源码
项目:neoscada
阅读 24
收藏 0
点赞 0
评论 0
public void createStandardCombo ( final Composite parent, final String attributeName, final String label, final String[] items, final IObservableMap data, final Object valueType )
{
this.toolkit.createLabel ( parent, label + ":" );
final Combo combo = new Combo ( parent, SWT.DROP_DOWN );
combo.setItems ( items );
this.toolkit.adapt ( combo );
final GridData gd = new GridData ( GridData.FILL, GridData.BEGINNING, true, true );
gd.horizontalSpan = 2;
combo.setLayoutData ( gd );
final IObservableValue value = Observables.observeMapEntry ( data, attributeName, valueType );
this.dbc.bindValue ( WidgetProperties.text ().observe ( combo ), value );
}
FilterAdvancedComposite.java 文件源码
项目:neoscada
阅读 32
收藏 0
点赞 0
评论 0
private Combo createAssertionCombo ()
{
final Combo c = new Combo ( this, SWT.NONE );
for ( final Assertion assertion : Assertion.values () )
{
c.add ( assertion.toString () );
}
c.select ( 0 );
c.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent e )
{
AssertionComposite.this.orCondition.updateFilter ();
}
} );
final RowData rowData = new RowData ();
rowData.width = 75;
c.setLayoutData ( rowData );
return c;
}
DatabaseObjectFindDialogComposite.java 文件源码
项目:convertigo-eclipse
阅读 25
收藏 0
点赞 0
评论 0
/**
* This method initializes combo
*
*/
private void createCombo() {
GridData gridData1 = new GridData();
gridData1.grabExcessHorizontalSpace = false;
gridData1.verticalAlignment = GridData.CENTER;
gridData1.horizontalAlignment = GridData.BEGINNING;
combo = new Combo(this, SWT.NONE);
combo.setLayoutData(gridData1);
combo.add("*");
combo.add("Screen class");
combo.add("Criteria");
combo.add("Extraction rule");
combo.add("Sheet");
combo.add("Transaction");
combo.add("Statement");
combo.add("Sequence");
combo.add("Step");
}
ExecutionContextSelectionUIPage.java 文件源码
项目:gw4e.project
阅读 29
收藏 0
点赞 0
评论 0
@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);
}
CategoriesDialogSourceComposite.java 文件源码
项目:Hydrograph
阅读 27
收藏 0
点赞 0
评论 0
private void addDragSupport(final List sourcePackageList, final Combo comboJarList) {
DragSource dragSource = ExpressionEditorUtil.INSTANCE.getDragSource(sourcePackageList);
dragSource.addDragListener(new DragSourceAdapter() {
public void dragSetData(DragSourceEvent event) {
event.data = formatDataToTransfer(sourcePackageList.getSelection());
}
private Object formatDataToTransfer(String[] selection) {
StringBuffer buffer = new StringBuffer();
for (String field : selection) {
buffer.append(field + Constants.DOT + Constants.ASTERISK + SWT.SPACE + Constants.DASH + SWT.SPACE
+ comboJarList.getItem(comboJarList.getSelectionIndex())
+ Constants.FIELD_SEPRATOR_FOR_DRAG_DROP);
}
return buffer.toString();
}
});
}
ELTDefaultCombo.java 文件源码
项目:Hydrograph
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void attachWidget(Composite container) {
defaultELTcom = new Combo(container, SWT.READ_ONLY);
defaultELTcom.setItems(defaultTextMessage);
// defaultELTcom.setItems(new String[] {"True","false"});
// defaultELTcom.setItem(0, "");
GridData gd_defaultELTTextBox = new GridData(SWT.FILL, SWT.FILL, false,
false, 1, 1);
if (OSValidator.isMac()) {
gd_defaultELTTextBox.horizontalIndent=-1;
gd_defaultELTTextBox.widthHint = textboxWidth+50;
}
else{
gd_defaultELTTextBox.horizontalIndent=1;
gd_defaultELTTextBox.widthHint = textboxWidth;
}
defaultELTcom.setLayoutData(gd_defaultELTTextBox);
widget = defaultELTcom;
}
GroupCombineExpressionComposite.java 文件源码
项目:Hydrograph
阅读 26
收藏 0
点赞 0
评论 0
/**
* @param isParam
* @param isWholeOperationParameter
*/
private void disabledWidgetsifWholeExpressionIsParameterForAggregateCumulate(Button isParam,
boolean isWholeOperationParameter) {
if (isWholeOperationParameter) {
Text textAccumulator = (Text) isParam.getData(Messages.TEXT_ACCUMULATOR);
Button isParamAccumulator = (Button) isParam.getData(Messages.ISPARAM_ACCUMULATOR);
Combo comboDataTypes = (Combo) isParam.getData(Messages.COMBODATATYPES);
Button button =(Button) isParam.getData(Constants.EXPRESSION_EDITOR_BUTTON1);
button.setEnabled(false);
textAccumulator.setEnabled(false);
isParamAccumulator.setEnabled(false);
comboDataTypes.setEnabled(false);
super.disabledWidgetsifWholeExpressionIsParameter(isParamAccumulator, isWholeOperationParameter);
}
}
TransformDialog.java 文件源码
项目:Hydrograph
阅读 29
收藏 0
点赞 0
评论 0
private void addModifyListenerToComboDataTypes(Combo combo,final AbstractExpressionComposite expressionComposite,MappingSheetRow mappingSheetRow) {
combo.addModifyListener(new ModifyListener(){
@Override
public void modifyText(ModifyEvent e) {
Combo accumulatorDataType =(Combo)e.widget;
mappingSheetRow.setComboDataType( accumulatorDataType.getText());
boolean isValidValue = validate(expressionComposite.getTextAccumulator().getText(),accumulatorDataType.getText());
if(!isValidValue){
expressionComposite.getTextAccumulator().setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,000));
}else{
expressionComposite.getTextAccumulator().setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,255));
}
showHideValidationMessage();
}
});
}
ELTSelectionListener.java 文件源码
项目:Hydrograph
阅读 27
收藏 0
点赞 0
评论 0
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
final Widget[] widgetList = widgets;
if (helper != null) {
txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
}
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if (((Combo) widgetList[0]).getText().equals("Parameter") || ((Combo) widgetList[0]).getText().equals("Others")) {
((Text) widgetList[1]).setVisible(true);
((Text) widgetList[1]).setFocus();
txtDecorator.hide();
} else {
((Text) widgetList[1]).setVisible(false);
txtDecorator.hide();
}
propertyDialogButtonBar.enableApplyButton(true);
}
};
return listener;
}
ELTCreateNewClassListener.java 文件源码
项目:Hydrograph
阅读 32
收藏 0
点赞 0
评论 0
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, final ListenerHelper helpers, Widget... widgets) {
final Widget[] widgetList = widgets;
if (helpers != null) {
widgetConfig = (WidgetConfig) helpers.get(HelperType.WIDGET_CONFIG);
}
Listener listener=new Listener() {
@Override
public void handleEvent(Event event) {
String comboValue = ((Combo) widgetList[0]).getText();
if (comboValue.equals(Messages.CUSTOM)) {
FilterOperationClassUtility.INSTANCE.createNewClassWizard((Text) widgetList[1], widgetConfig);
if(helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL) instanceof OperationClassDialog)
{
OperationClassDialog operationClassDialog=(OperationClassDialog)helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL);
operationClassDialog.getShell().setFocus();
}
propertyDialogButtonBar.enableApplyButton(true);
}
}
};
return listener;
}
OverWriteWidgetSelectionListener.java 文件源码
项目:Hydrograph
阅读 29
收藏 0
点赞 0
评论 0
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
Widget... widgets) {
final Widget[] widgetList = widgets;
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if (StringUtils.equalsIgnoreCase(((Combo) widgetList[0]).getText(), String.valueOf(Boolean.TRUE))) {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.ICON_INFORMATION | SWT.OK);
messageBox.setText(INFORMATION);
messageBox.setMessage("All files at given location will be overwritten.");
messageBox.open();
}
}
};
return listener;
}
VertigoPropertyPage.java 文件源码
项目:vertigo-chroma-kspplugin
阅读 24
收藏 0
点赞 0
评论 0
private void addVersionSection(Composite parent) {
Composite composite = createDefaultComposite(parent);
// Label for owner field
Label ownerLabel = new Label(composite, SWT.NONE);
ownerLabel.setText(LEGACY_VERSION_TITLE);
// Owner text field
legacyVersionCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
GridData gd = new GridData();
gd.widthHint = convertWidthInCharsToPixels(COMBO_FIELD_WIDTH);
legacyVersionCombo.setLayoutData(gd);
// Populate owner text field
LegacyVersion legacyVersion = LegacyManager.getInstance().getVersion(getProject());
legacyVersionCombo.setItems(LegacyVersion.names());
legacyVersionCombo.setText(legacyVersion.name());
}
IntListParameter.java 文件源码
项目:BiglyBT
阅读 23
收藏 0
点赞 0
评论 0
public IntListParameter(Composite composite, final String name,
int defaultValue, final String labels[], final int values[]) {
super(name);
this.name = name;
this.values = values;
if(labels.length != values.length)
return;
int value = COConfigurationManager.getIntParameter(name,defaultValue);
int index = findIndex(value,values);
list = new Combo(composite,SWT.SINGLE | SWT.READ_ONLY);
for(int i = 0 ; i < labels.length ;i++) {
list.add(labels[i]);
}
setIndex(index);
list.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
setIndex(list.getSelectionIndex());
}
});
}
UpdateDialog.java 文件源码
项目:bdf2
阅读 35
收藏 0
点赞 0
评论 0
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
container.setLayout(layout);
// container.setLayoutData(new GridData(GridData.FILL_BOTH));
// TitleArea中的Title
setTitle("属性文件更新");
// TitleArea中的Message
setMessage("输入正确的url地址,以更新文件。\n可提示的属性数量会根据当前项目存在的jar包,对已有属性增加或者删除!");
Label label = new Label(container, SWT.NONE);
label.setText("项目URL: ");
combo = new Combo(container, SWT.DROP_DOWN);
String[] items = new String[getUrlMap().size()];
getUrlMap().values().toArray(items);
combo.setItems(items);
String url = getPreferedUrl(projectName);
combo.setText(url);
combo.setLayoutData(new RowData(400, 30));
return area;
}
StaticInvocationWidget.java 文件源码
项目:pandionj
阅读 25
收藏 0
点赞 0
评论 0
private void addRefCombovalues(Combo combo, String paramType) {
if(!PrimitiveType.isPrimitiveSig(paramType)) {
combo.add("null");
IType owner = (IType) method.getParent();
try {
IField[] fields = owner.getFields();
for(IField f : fields)
if(Flags.isStatic(f.getFlags()) && f.getTypeSignature().equals(paramType))
combo.add(f.getElementName());
} catch (JavaModelException e1) {
e1.printStackTrace();
}
}
}
StaticInvocationWidget.java 文件源码
项目:pandionj
阅读 24
收藏 0
点赞 0
评论 0
private void addCacheValues(Combo[] combos) {
String key = getMethodKey(method);
List<List<String>> list = cache.get(key);
if(list != null) {
assert list.size() == combos.length;
for(int i = 0; i < combos.length; i++) {
List<String> values = list.get(i);
for(String v : values)
if(!containsItem(combos[i], v))
combos[i].add(v);
if(values.size() > 0)
combos[i].select(combos[i].getItemCount()-1);
else if(combos[i].getItemCount() > 0)
combos[i].select(0);
}
}
else {
for(Combo combo : combos) {
int n = combo.getItemCount();
if(n > 0)
combo.select(n-1);
}
}
}
StaticInvocationWidget.java 文件源码
项目:pandionj
阅读 31
收藏 0
点赞 0
评论 0
private boolean validValue(String val, String pType, Combo combo) {
try {
if(pType.equals(String.class.getSimpleName())) return val.matches("(\"(.)*\")|null");
else if(pType.equals(char.class.getName())) return val.matches("'.'");
else if(pType.equals(boolean.class.getName())) return val.matches("true|false");
else if(pType.equals(byte.class.getName())) Byte.parseByte(val);
else if(pType.equals(short.class.getName())) Short.parseShort(val);
else if(pType.equals(int.class.getName())) Integer.parseInt(val);
else if(pType.equals(long.class.getName())) Long.parseLong(val);
else if(pType.equals(float.class.getName())) Float.parseFloat(val);
else if(pType.equals(double.class.getName())) Double.parseDouble(val);
else if(pType.equals(int.class.getName() + "[]")) return val.matches(regexIntArray);
else if(pType.equals(double.class.getName() + "[]")) return val.matches(regexDoubleArray);
else if(pType.equals(boolean.class.getName() + "[]")) return val.matches(regexBooleanArray);
else if(pType.equals(char.class.getName() + "[]")) return val.matches(regexCharArray);
// else if(pType.equals(int.class.getName() + "[][]")) return val.matches(regexIntMatrix);
else return false;
}
catch(RuntimeException e) {
return false;
}
return true;
}
StaticInvocationWidget.java 文件源码
项目:pandionj
阅读 26
收藏 0
点赞 0
评论 0
private void addCombovalues(Combo combo, String paramType) {
if(!PrimitiveType.isPrimitiveSig(paramType)) {
String sel = combo.getText();
combo.removeAll();
combo.add("null");
IType owner = (IType) method.getParent();
try {
IField[] fields = owner.getFields();
for(IField f : fields)
if(Flags.isStatic(f.getFlags()) && f.getTypeSignature().equals(paramType))
combo.add(f.getElementName());
} catch (JavaModelException e1) {
e1.printStackTrace();
}
if(sel.isEmpty())
combo.select(0);
else
combo.setText(sel);
}
}
MainTab.java 文件源码
项目:angular-eclipse
阅读 19
收藏 0
点赞 0
评论 0
private void createNgCommandComponent(Composite parent) {
Group group = new Group(parent, SWT.NONE);
String groupName = AngularCLIMessages.AngularCLILaunchTabGroup_MainTab_command;
group.setText(groupName);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
group.setLayout(layout);
group.setLayoutData(gridData);
commandsCommbo = new Combo(group, SWT.BORDER | SWT.H_SCROLL);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
commandsCommbo.setLayoutData(data);
String[] items = new String[NgCommand.values().length];
for (int i = 0; i < items.length; i++) {
items[i] = NgCommand.values()[i].getAliases()[0];
}
commandsCommbo.setItems(items);
commandsCommbo.addModifyListener(fListener);
}
JackChannelSettingsDialog.java 文件源码
项目:TuxGuitar-1.3.1-fork
阅读 22
收藏 0
点赞 0
评论 0
@SuppressWarnings("unchecked")
private void reloadChannelCombo(Combo combo, List<Integer> channels, int selected, String valueKey){
if(!(combo.getData() instanceof List) || isDifferentList(channels, (List<Integer>) combo.getData())){
combo.removeAll();
combo.setData(channels);
for( int i = 0 ; i < channels.size() ; i ++ ){
combo.add(TuxGuitar.getProperty(valueKey, new String[]{channels.get(i).toString()}));
}
}
for( int i = 0 ; i < channels.size() ; i ++ ){
Integer channel = (Integer)channels.get(i);
if( channel.intValue() == selected ){
combo.select( i );
}
}
}
QueryEditorControl.java 文件源码
项目:team-explorer-everywhere
阅读 33
收藏 0
点赞 0
评论 0
private Composite createTreeOptionsComposite() {
final Composite composite = new Composite(optionsComposite, SWT.NONE);
SWTUtil.gridLayout(composite, 2, false, 0, 8);
final Label label2 = new Label(composite, SWT.DROP_DOWN);
label2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
label2.setText(Messages.getString("QueryEditorControl.TreeTypeLabelText")); //$NON-NLS-1$
final Combo combo = new Combo(composite, SWT.NONE);
combo.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 1, 1));
AutomationIDHelper.setWidgetID(combo, TYPEOFTREE_COMBO_ID);
populateTreeOptionsCombo(combo, query.getTreeQueryLinkType());
return composite;
}
ComboHelper.java 文件源码
项目:team-explorer-everywhere
阅读 21
收藏 0
点赞 0
评论 0
/**
* Populates the combo with the specified values. The specified initial
* value is set as the initial selection it it appears in the array of
* values, otherwise the first value is selected.
*
* @param combo
* The combo to populate.
*
* @param values
* The values for the combo drop down.
*
* @param initialValue
* The value which should be the initial selected value.
*
* @return The index of the selected item.
*/
public static int populateCombo(final Combo combo, final String[] values, final String initialValue) {
Check.notNull(combo, "combo"); //$NON-NLS-1$
Check.notNull(values, "values"); //$NON-NLS-1$
if (values.length == 0) {
return -1;
}
int selectedIndex = 0;
for (int i = 0; i < values.length; i++) {
final String value = values[i];
if (value.equals(initialValue)) {
selectedIndex = i;
}
combo.add(value);
}
combo.select(selectedIndex);
setVisibleItemCount(combo);
return selectedIndex;
}
RelationDialog.java 文件源码
项目:ermasterr
阅读 17
收藏 0
点赞 0
评论 0
private void createParentMandatoryGroup(final Group parent) {
final GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 10;
final GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
final Group group = new Group(parent, SWT.NONE);
group.setLayout(gridLayout);
group.setLayoutData(gridData);
group.setText(ResourceString.getResourceString("label.mandatory"));
parentCardinalityCombo = new Combo(group, SWT.NONE);
parentCardinalityCombo.setLayoutData(gridData);
parentCardinalityCombo.setVisibleItemCount(5);
parentCardinalityCombo.add(Relation.PARENT_CARDINALITY_1);
if (!relation.getForeignKeyColumns().get(0).isPrimaryKey()) {
parentCardinalityCombo.add(Relation.PARENT_CARDINALITY_0_OR_1);
}
}
SWTUtil.java 文件源码
项目:TranskribusSwtGui
阅读 25
收藏 0
点赞 0
评论 0
public static void addSelectionListener(Widget w, SelectionListener l) {
if (w instanceof MenuItem)
addSelectionListener((MenuItem) w, l);
else if (w instanceof ToolItem)
addSelectionListener((ToolItem) w, l);
else if (w instanceof Button)
addSelectionListener((Button) w, l);
else if (w instanceof DropDownToolItem) {
addSelectionListener((DropDownToolItem) w, l);
}
else if (w instanceof CTabFolder) {
addSelectionListener((CTabFolder) w, l);
}
else if (w instanceof Combo){
addSelectionListener((Combo) w, l);
}
else
throw new RuntimeException("Widget type not supported for selection events: " + w);
}
CopyToClipboardAction.java 文件源码
项目:fluentmark
阅读 44
收藏 0
点赞 0
评论 0
@Override
public void runWithEvent(Event event) {
Shell shell = getActiveWorkbenchShell();
if (shell != null) {
String sel = null;
if (event.widget instanceof Combo) {
Combo combo = (Combo) event.widget;
sel = combo.getText();
Point selection = combo.getSelection();
sel = sel.substring(selection.x, selection.y);
} else if (event.widget instanceof Text) {
Text text = (Text) event.widget;
sel = text.getSelectionText();
}
if (sel != null) {
if (sel.length() > 0) {
copyToClipboard(sel, shell);
}
return;
}
}
run();
}
CommitCommentArea.java 文件源码
项目:subclipse
阅读 19
收藏 0
点赞 0
评论 0
public ComboBox(Composite composite, String message, String [] options,
String[] commentTemplates) {
fMessage= message;
fComments= options;
fCommentTemplates = commentTemplates;
fCombo = new Combo(composite, SWT.READ_ONLY);
fCombo.setLayoutData(SWTUtils.createHFillGridData());
fCombo.setVisibleItemCount(20);
// populate the previous comment list
populateList();
// We don't want to have an initial selection
// (see bug 32078: http://bugs.eclipse.org/bugs/show_bug.cgi?id=32078)
fCombo.addFocusListener(this);
fCombo.addSelectionListener(this);
}
AccountSelector.java 文件源码
项目:google-cloud-eclipse
阅读 17
收藏 0
点赞 0
评论 0
public AccountSelector(Composite parent, IGoogleLoginService loginService) {
super(parent, SWT.NONE);
this.loginService = loginService;
loginMessage = Messages.getString("ACCOUNT_SELECTOR_LOGIN");
combo = new Combo(this, SWT.READ_ONLY);
List<Account> sortedAccounts = new ArrayList<>(loginService.getAccounts());
Collections.sort(sortedAccounts, new Comparator<Account>() {
@Override
public int compare(Account o1, Account o2) {
return o1.getEmail().compareTo(o2.getEmail());
}
});
for (Account account : sortedAccounts) {
combo.add(account.getEmail());
combo.setData(account.getEmail(), account);
}
combo.add(loginMessage);
combo.addSelectionListener(logInOnSelect);
GridDataFactory.fillDefaults().grab(true, false).applyTo(combo);
GridLayoutFactory.fillDefaults().generateLayout(this);
}
ItemView.java 文件源码
项目:http4e
阅读 21
收藏 0
点赞 0
评论 0
private void initHttpCombo( Composite top){
httpCombo = new Combo(top, SWT.READ_ONLY);
httpCombo.setItems(CoreConstants.HTTP11_METHODS);
httpCombo.setText(model.getHttpMethod());
httpCombo.addSelectionListener(new SelectionAdapter() {
private String prevMethod = model.getHttpMethod();
public void widgetSelected( SelectionEvent e){
// becomes GET, HEAD, PUT, etc
if (CoreConstants.HTTP_POST.equals(prevMethod) && !CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
state.setState(ItemState.POST_DISABLED);
// becomes POST
} else if (!CoreConstants.HTTP_POST.equals(prevMethod) && CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
state.setState(ItemState.POST_ENABLED);
// no update
} else {
state.setState(ItemState.POST_NO_UPDATE);
}
prevMethod = httpCombo.getText();
model.fireExecute(new ModelEvent(ModelEvent.HTTP_METHOD_CHANGE, model));
}
});
}
ViewerConfigDialog.java 文件源码
项目:texlipse
阅读 19
收藏 0
点赞 0
评论 0
/**
* Creates the additional controls of the page.
* @param parent parent component
*/
private void addInverseChooser(Composite parent) {
Label label = new Label(parent, SWT.LEFT);
label.setText(TexlipsePlugin.getResourceString("preferenceViewerInverseLabel"));
label.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip"));
label.setLayoutData(new GridData());
String[] list = new String[] {
TexlipsePlugin.getResourceString("preferenceViewerInverseSearchNo"),
TexlipsePlugin.getResourceString("preferenceViewerInverseSearchRun"),
TexlipsePlugin.getResourceString("preferenceViewerInverseSearchStd")
};
// find out which option to choose by default
int index = inverseSearchValues.length - 1;
for (; index > 0 && !inverseSearchValues[index].equals(registry.getInverse()); index--) {}
inverseChooser = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
inverseChooser.setLayoutData(new GridData());
inverseChooser.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip"));
inverseChooser.setItems(list);
inverseChooser.select(index);
}