当前位置: 首页>>代码示例>>Java>>正文


Java CCombo类代码示例

本文整理汇总了Java中org.eclipse.swt.custom.CCombo的典型用法代码示例。如果您正苦于以下问题:Java CCombo类的具体用法?Java CCombo怎么用?Java CCombo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CCombo类属于org.eclipse.swt.custom包,在下文中一共展示了CCombo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initServerCombo

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
private void initServerCombo(Composite container) {
	Label serverLabel = new Label(container, SWT.FLAT);
	serverLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
	serverLabel.setText("Server: ");

	serverCombo = new CCombo(container, SWT.DROP_DOWN);
	serverCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
	for (String s : serverProposals)
		serverCombo.add(s);
	if (serverProposals.length > 0)
		serverCombo.select(0);
	if (defaultUriIndex >= 0 && defaultUriIndex < serverProposals.length)
		serverCombo.select(defaultUriIndex);

	// serverCombo.pack();
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:17,代码来源:LoginDialog.java

示例2: createControl

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
protected Control createControl() {
  m_Combo = new CCombo(m_Table, SWT.READ_ONLY);
  m_Combo.setBackground(Display.getCurrent().getSystemColor(
      SWT.COLOR_LIST_BACKGROUND));
  if (m_Items != null)
    m_Combo.setItems(m_Items);
  m_Combo.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
      try {
        onKeyPressed(e);
      } catch (Exception ex) {
      }
    }
  });
  /*
   * m_Combo.addTraverseListener(new TraverseListener() { public void
   * keyTraversed(TraverseEvent arg0) { onTraverse(arg0); } });
   */
  return m_Combo;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:21,代码来源:KTableCellEditorCombo.java

示例3: setCompressionTooltips

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
public static void setCompressionTooltips(CCombo wCompression, Class dialogClass)
{
    switch (ConnectionCompression.fromString(wCompression.getText())) {
        case NONE:
            wCompression.setToolTipText(BaseMessages.getString(dialogClass, "CompressionNone.TipText"));
            break;
        case SNAPPY:
            wCompression.setToolTipText(BaseMessages.getString(dialogClass, "CompressionSnappy.TipText"));
            break;
        case PIEDPIPER:
            wCompression.setToolTipText(BaseMessages.getString(dialogClass, "CompressionPiedPiper.TipText"));
            break;
        default:
            wCompression.setToolTipText(BaseMessages.getString(dialogClass, "CompressionNotAvailable.TipText"));
    }
}
 
开发者ID:bcolas,项目名称:pentaho-cassandra-plugin,代码行数:17,代码来源:CommonDialog.java

示例4: addComboInTable

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
private CCombo addComboInTable(TableViewer tableViewer, TableItem tableItem, String comboName, String comboPaneName, 
		String editorName, int columnIndex,	String[] relationalOperators, SelectionListener dropDownSelectionListener,
		ModifyListener modifyListener,FocusListener focusListener) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final CCombo combo = new CCombo(buttonPane, SWT.NONE);
	combo.setItems(relationalOperators);
	combo.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	tableItem.setData(comboName, combo);
	tableItem.setData(comboPaneName, buttonPane);
	combo.addSelectionListener(dropDownSelectionListener);
	combo.addModifyListener(modifyListener);
	combo.addFocusListener(focusListener);
	new AutoCompleteField(combo, new CComboContentAdapter(), combo.getItems());
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	combo.setData(editorName, editor);
	return combo;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:FilterConditionsDialog.java

示例5: getFieldNameModifyListener

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
/**
 * Gets the field name modify listener.
 * 
 * @param tableViewer
 *            the table viewer
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the field name modify listener
 */
public ModifyListener getFieldNameModifyListener(final TableViewer tableViewer, final List<Condition> conditionsList,
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	ModifyListener listener = new ModifyListener() {
		
		@Override
		public void modifyText(ModifyEvent e) {
			CCombo source = (CCombo) e.getSource();
			int index = (int) source.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			String fieldName = source.getText();
			filterConditions.setFieldName(fieldName);
			
			if(StringUtils.isNotBlank(fieldName)){
				String fieldType = fieldsAndTypes.get(fieldName);
				TableItem item = tableViewer.getTable().getItem(index);
				CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS);
				if(conditionalCombo != null && StringUtils.isNotBlank(fieldType)){
					conditionalCombo.setText(filterConditions.getConditionalOperator());
					conditionalCombo.setItems(FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType));
					new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems());
				}
			}
			validateCombo(source);
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:46,代码来源:FilterHelper.java

示例6: getConditionalOperatorModifyListener

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
/**
 * Gets the conditional operator modify listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the conditional operator modify listener
 */
public ModifyListener getConditionalOperatorModifyListener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	ModifyListener listener = new ModifyListener() {
		
		@Override
		public void modifyText(ModifyEvent e) {
			CCombo source = (CCombo) e.getSource();
			TableItem tableItem = getTableItem(source);
			Condition condition = (Condition) tableItem.getData();
			if (tableItem.getData(FilterConstants.VALUE2TEXTBOX) != null) {
				Text text = (Text) tableItem.getData(FilterConstants.VALUE2TEXTBOX);
				enableAndDisableValue2TextBox(condition.getConditionalOperator(), text);
			}
			processConditionalOperator(source, conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:34,代码来源:FilterHelper.java

示例7: insertControlContents

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
public void insertControlContents(Control control, String text,
		int cursorPosition) {
	CCombo combo = (CCombo) control;
	String contents = combo.getText();
	Point selection = combo.getSelection();
	StringBuffer sb = new StringBuffer();
	sb.append(contents.substring(0, selection.x));
	sb.append(text);
	if (selection.y < contents.length()) {
		sb.append(contents.substring(selection.y, contents.length()));
	}
	combo.setText(sb.toString());
	selection.x = selection.x + cursorPosition;
	selection.y = selection.x;
	combo.setSelection(selection);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:CComboContentAdapter.java

示例8: getInsertionBounds

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
public Rectangle getInsertionBounds(Control control) {
	// This doesn't take horizontal scrolling into affect. 
	// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=204599
	CCombo combo = (CCombo) control;
	int position = combo.getSelection().y;
	String contents = combo.getText();
	GC gc = new GC(combo);
	gc.setFont(combo.getFont());
	Point extent = gc.textExtent(contents.substring(0, Math.min(position,
			contents.length())));
	gc.dispose();
	if (COMPUTE_TEXT_USING_CLIENTAREA) {
		return new Rectangle(combo.getClientArea().x + extent.x, combo
			.getClientArea().y, 1, combo.getClientArea().height);
	}
	return new Rectangle(extent.x, 0, 1, combo.getSize().y);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:18,代码来源:CComboContentAdapter.java

示例9: createCombo

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
protected CCombo createCombo(Composite parent, String label, IJSONPath path, String[] values, String defaultValue) {
	FormToolkit toolkit = getToolkit();
	Composite composite = toolkit.createComposite(parent, SWT.NONE);
	composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	GridLayout layout = new GridLayout(2, false);
	layout.marginWidth = 0;
	layout.marginBottom = 0;
	layout.marginTop = 0;
	layout.marginHeight = 0;
	layout.verticalSpacing = 0;
	composite.setLayout(layout);

	toolkit.createLabel(composite, label);

	CCombo combo = new CCombo(composite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
	combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	combo.setItems(values);
	toolkit.adapt(combo, true, false);

	bind(combo, path, defaultValue);
	return combo;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:23,代码来源:AbstractFormPage.java

示例10: keyPressed

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
public void keyPressed(KeyEvent e) {
    if (e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER
        || e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER_SECOND) {
        CCombo combo = (CCombo) e.getSource();
        String text = combo.getText();

        try {
            final int value = new Integer(text).intValue();
            final Property property = this.property;
            if (value > 0) {

                DomainUtil.run(new TransactionalAction() {
                    @Override
                    public void doExecute() {
                        property.setLower(value);
                        property.setUpper(value);
                    }
                });
            }
        } catch (Exception e2) {
            // TODO: handle exception
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:AssociationGeneralSection.java

示例11: focusLost

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
public void focusLost(FocusEvent e) {
    CCombo combo = (CCombo) e.getSource();
    String text = combo.getText();

    try {
        final int value = new Integer(text).intValue();
        final Property property = this.property;
        if (value > 0) {

            DomainUtil.run(new TransactionalAction() {
                @Override
                public void doExecute() {
                    property.setLower(value);
                    property.setUpper(value);
                }
            });
        }
    } catch (Exception e2) {
        // TODO: handle exception
    }

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:23,代码来源:AssociationGeneralSection.java

示例12: widgetSelected

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
/**
 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
 */
public void widgetSelected(final SelectionEvent e) {
    DomainUtil.run(new TransactionalAction() {
        /**
         * @see nexcore.tool.uml.manager.transaction.TransactionalAction#doExecute()
         */
        @Override
        public void doExecute() {
            CCombo combo = (CCombo) e.getSource();
            String comboValue = combo.getText();
            if (comboValue.equals(MultiplicityType.SINGLE_STAR.toString())) {
                property.setLower(0);
                property.setUpper(LiteralUnlimitedNatural.UNLIMITED);
            } else if (comboValue.equals(MultiplicityType.ZERO_TO_UNIQUE.toString())) {
                property.setLower(0);
                property.setUpper(1);
            } else if (comboValue.equals(MultiplicityType.UNIQUE_TO_SINGLE_STAR.toString())) {
                property.setLower(1);
                property.setUpper(LiteralUnlimitedNatural.UNLIMITED);
            } else {
                property.setLower(1);
                property.setUpper(1);
            }
        }
    });
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:29,代码来源:AssociationGeneralSection.java

示例13: setMultiplicityOfPropertyToModel

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
/**
 * 속성 모델에 다중성 값을 세팅
 * 
 * @param combo
 *            void
 */
private void setMultiplicityOfPropertyToModel(CCombo combo) {
    if ((combo.getText()).equals(MultiplicityType.SINGLE_STAR.toString())) {
        // *
        this.getData().setLower(0);
        this.getData().setUpper(LiteralUnlimitedNatural.UNLIMITED);
    } else if ((combo.getText()).equals(MultiplicityType.ZERO_TO_UNIQUE.toString())) {
        // 0.. 1
        this.getData().setLower(0);
        this.getData().setUpper(1);
    } else if ((combo.getText()).equals(MultiplicityType.UNIQUE.toString())) {
        // 1
        this.getData().setLower(1);
        this.getData().setUpper(1);
    } else if ((combo.getText()).equals(MultiplicityType.UNIQUE_TO_SINGLE_STAR.toString())) {
        // 1.. *
        this.getData().setLower(1);
        this.getData().setUpper(LiteralUnlimitedNatural.UNLIMITED);
    } else if ((combo.getText()).equals(MultiplicityType.NONE.toString())) {
        // 1
        this.getData().setLower(1);
        this.getData().setUpper(1);
    } else {
        return;
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:32,代码来源:MultiplicityGeneralSection.java

示例14: createMatchModeCombo

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
private void createMatchModeCombo(Composite parent) {
    // draw label
    Label comboLabel = new Label(parent,SWT.LEFT);
    comboLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    comboLabel.setText(LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.label")); //$NON-NLS-1$
    // draw combo
    matchModeCombo = new CCombo(parent,SWT.BORDER);
    matchModeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    matchModeCombo.setEditable(false);
    String[] matchModes = {LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.find"), LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.match")};
    matchModeCombo.setItems(matchModes);
    if(edit) {
        String[] items = matchModeCombo.getItems();
        for(int i = 0 ; i < items.length ; i++) {
            if(items[i].toLowerCase().indexOf(this.data.getMatchMode())!=-1) {
            	matchModeCombo.select(i);
                return;
            }
        }
    }
}
 
开发者ID:anb0s,项目名称:LogViewer,代码行数:22,代码来源:RuleDialog.java

示例15: handleAddExceptionForControl

import org.eclipse.swt.custom.CCombo; //导入依赖的package包/类
private void handleAddExceptionForControl(final Control control, final ValidationException e) {

    if (control instanceof Text) {
      Text text = (Text) control;
      text.setBackground(new Color(control.getDisplay(), ERROR_COLOR));
      text.setToolTipText(e.getMessage());
    } else if (control instanceof CCombo) {
      CCombo combo = (CCombo) control;
      combo.setBackground(new Color(control.getDisplay(), ERROR_COLOR));
      combo.setToolTipText(e.getMessage());
    } else if (control instanceof Composite) {
      Composite composite = (Composite) control;
      composite.setBackground(new Color(control.getDisplay(), ERROR_COLOR));
      for (final Control childControl : composite.getChildren()) {
        childControl.setBackground(new Color(control.getDisplay(), ERROR_COLOR));
      }
      composite.setToolTipText(e.getMessage());
    }
  }
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:AbstractCustomPropertyField.java


注:本文中的org.eclipse.swt.custom.CCombo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。