Java Code Examples for org.eclipse.swt.widgets.Combo

The following are top voted examples for showing how to use org.eclipse.swt.widgets.Combo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: convertigo-eclipse   File: DatabaseObjectFindDialogComposite.java   Source Code and License 8 votes vote down vote up
/**
 * 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");
}
 
Example 2
Project: Hydrograph   File: CategoriesDialogSourceComposite.java   Source Code and License 7 votes vote down vote up
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();
		}
	});
}
 
Example 3
Project: Hydrograph   File: GroupCombineExpressionComposite.java   Source Code and License 7 votes vote down vote up
/**
 * @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);
	}

}
 
Example 4
Project: android-uiautomatorviewer   File: ScreenshotAction.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 5
Project: neoscada   File: ConfigurationFormToolkit.java   Source Code and License 6 votes vote down vote up
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 );
}
 
Example 6
Project: neoscada   File: FilterAdvancedComposite.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 7
Project: gw4e.project   File: ExecutionContextSelectionUIPage.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 8
Project: Hydrograph   File: ELTDefaultCombo.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 9
Project: Hydrograph   File: TransformDialog.java   Source Code and License 6 votes vote down vote up
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();
		}
	});
}
 
Example 10
Project: Hydrograph   File: ELTSelectionListener.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 11
Project: Hydrograph   File: ELTCreateNewClassListener.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 12
Project: Hydrograph   File: OverWriteWidgetSelectionListener.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 13
Project: vertigo-chroma-kspplugin   File: VertigoPropertyPage.java   Source Code and License 6 votes vote down vote up
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());
}
 
Example 14
Project: BiglyBT   File: IntListParameter.java   Source Code and License 6 votes vote down vote up
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());
         }
       });

  }
 
Example 15
Project: bdf2   File: UpdateDialog.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 16
Project: bdf2   File: DbToolCreationWizardPage.java   Source Code and License 6 votes vote down vote up
public void createControl(Composite parent) {
	super.createControl(parent);
	Composite composite = (Composite) getControl();
	Group group = new Group(composite, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	group.setLayout(layout);
	group.setText("设置");
	group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));

	Label label = new Label(group, SWT.NULL);
	label.setText("数据库方言:");
	final Combo combo = new Combo(group, SWT.READ_ONLY);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	combo.setLayoutData(gd);
	DbType[] values = DbType.values();
	for (DbType type : values) {
		combo.add(type.name());
	}
	combo.select(0);
	currentDbType = combo.getText();
	setFileName("NewFile" + DEFAULT_EXTENSION);
	combo.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			currentDbType = combo.getText();
		}
	});
	setPageComplete(validatePage());
}
 
Example 17
Project: pandionj   File: StaticInvocationWidget.java   Source Code and License 6 votes vote down vote up
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();
		}
	}
}
 
Example 18
Project: pandionj   File: StaticInvocationWidget.java   Source Code and License 6 votes vote down vote up
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);
		}
	}
}
 
Example 19
Project: pandionj   File: StaticInvocationWidget.java   Source Code and License 6 votes vote down vote up
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;
	}
 
Example 20
Project: pandionj   File: StaticInvocationWidget.java   Source Code and License 6 votes vote down vote up
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);
	}
}
 
Example 21
Project: angular-eclipse   File: MainTab.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 22
Project: TuxGuitar-1.3.1-fork   File: JackChannelSettingsDialog.java   Source Code and License 6 votes vote down vote up
@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 );
		}
	}
}
 
Example 23
Project: team-explorer-everywhere   File: QueryEditorControl.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 24
Project: team-explorer-everywhere   File: ComboHelper.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 25
Project: ermasterr   File: RelationDialog.java   Source Code and License 6 votes vote down vote up
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);
    }
}
 
Example 26
Project: TranskribusSwtGui   File: SWTUtil.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 27
Project: fluentmark   File: CopyToClipboardAction.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 28
Project: subclipse   File: CommitCommentArea.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 29
Project: google-cloud-eclipse   File: AccountSelector.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 30
Project: http4e   File: ItemView.java   Source Code and License 6 votes vote down vote up
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));
      }
   });
}
 
Example 31
Project: texlipse   File: ViewerConfigDialog.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 32
Project: turnus   File: WidgetComboBox.java   Source Code and License 6 votes vote down vote up
@Override
protected void createWidgets(String text, String toolTip, String initialValue) {
	lbl = new Label(this, SWT.NONE);
	lbl.setText(text.concat(":"));
	lbl.setToolTipText(toolTip);

	comboBox = new Combo(this, SWT.READ_ONLY);
	comboBox.setToolTipText(toolTip);

	errorIcon = new Label(this, SWT.NONE);
	errorIcon.setImage(Icon.getImage(Icon.EXCLAMATION_RED));
	errorIcon.setVisible(false);
	comboBox.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			String value = comboBox.getText();
			if (value != getValue()) {
				setValue(comboBox.getText(), true);
			}
		}
	});
}
 
Example 33
Project: TranskribusSwtGui   File: SCSimpleDateTimeWidget.java   Source Code and License 6 votes vote down vote up
void init() {
//		this.setLayout(new GridLayout(2, false));
		this.setLayout(new FillLayout());
		
		day = new Combo(this, SWT.READ_ONLY);
		for (int i=1; i<=31; ++i)
			day.add(""+i);
		day.select(0);
		day.pack();
//		day.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		month = new Combo(this, SWT.READ_ONLY);
		for (int i=1; i<=12; ++i)
			month.add(""+i);
		month.select(0);
		month.pack();
//		month.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		year = new StyledText(this, SWT.SINGLE | SWT.CENTER | SWT.LEFT | SWT.BORDER);
		year.setText("2000");
//		year.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		this.pack();
		
		addListener();
	}
 
Example 34
Project: TuxGuitar-1.3.1-fork   File: GMChannelSettingsDialog.java   Source Code and License 6 votes vote down vote up
@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 );
		}
	}
}
 
Example 35
Project: n4js   File: AbstractExportToSingleFileWizardPage.java   Source Code and License 5 votes vote down vote up
/**
 * Create the export destination specification widgets
 */
protected void createDestinationGroup(Composite parent) {
	Font font = parent.getFont();
	// destination specification group
	Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 3;
	destinationSelectionGroup.setLayout(layout);
	destinationSelectionGroup.setLayoutData(new GridData(
			GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
	destinationSelectionGroup.setFont(font);

	Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
	destinationLabel.setText(getTargetLabel());
	destinationLabel.setFont(font);

	// destination name entry field
	destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE
			| SWT.BORDER);
	destinationNameField.addListener(SWT.Modify, this);
	destinationNameField.addListener(SWT.Selection, this);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.GRAB_HORIZONTAL);
	data.widthHint = SIZING_TEXT_FIELD_WIDTH;
	destinationNameField.setLayoutData(data);
	destinationNameField.setFont(font);

	// destination browse button
	destinationBrowseButton = new Button(destinationSelectionGroup,
			SWT.PUSH);
	destinationBrowseButton.setText(N4ExportMessages.DataTransfer_browse);
	destinationBrowseButton.addListener(SWT.Selection, this);
	destinationBrowseButton.setFont(font);
	setButtonLayoutData(destinationBrowseButton);

	// new Label(parent, SWT.NONE); // vertical spacer
}
 
Example 36
Project: n4js   File: NpmToolRunnerPage.java   Source Code and License 5 votes vote down vote up
@Override
protected void createOptionsGroupButtons(Group optionsGroup) {

	npmGoalSelection = new Combo(optionsGroup, SWT.SINGLE
			| SWT.BORDER);
	npmGoalSelection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	npmGoalSelection.addListener(SWT.Modify, this);
	npmGoalSelection.addListener(SWT.Selection, this);

}
 
Example 37
Project: EclipseMinifyBuilder   File: MinifyPropertyPage.java   Source Code and License 5 votes vote down vote up
private void addSecondSection(Composite parent, Preferences prefs) {
	Composite composite = createDefaultComposite(parent);

	// Label for owner field
	Label ownerLabel = new Label(composite, SWT.NONE);
	ownerLabel.setText(MINIFIER_TITLE);

	// Create a single-selection list
    selection = new Combo(composite, SWT.READ_ONLY);

    // Add the items, one by one
    for (int i = 0; i < options()[0].length; i++) {
    	selection.add(options()[1][i]);
    }
	selection.setText(options()[1][0]);

	// Set current selection
	String minifier = prefs.get(preferenceKey(MinifyBuilder.MINIFIER),
			MinifyBuilder.DONT_MINIFY);
	if (!minifier.equals(MinifyBuilder.DONT_MINIFY)) {
		for (int i = 0; i < options()[0].length; i++) {
			if (minifier.equals(options()[0][i])) {
				selection.setText(options()[1][i]);
				break;
			}
		}
	}
}
 
Example 38
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   Source Code and License 5 votes vote down vote up
/***
 * Create the Field where user enters the language used to execute
 * 
 * @param parent container composite
 * @param font used font
 * @return the created composite containing the fields
 */
public Composite createLanguageLayout(Composite parent, Font font) {
	// Language
	createTextLabelLayout(parent, "Melange languages");
	_languageCombo = new Combo(parent, SWT.NONE);
	_languageCombo.setLayoutData(createStandardLayout());

	List<String> languagesNames = MelangeHelper.getAllLanguages();
	String[] empty = {};
	_languageCombo.setItems(languagesNames.toArray(empty));
	_languageCombo.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			//String selection = _languageCombo.getText();
			//List<String> modelTypeNames = MelangeHelper.getModelTypes(selection);
			updateLaunchConfigurationDialog();
		}
	});
	createTextLabelLayout(parent, "");

	createTextLabelLayout(parent, "Melange resource adapter query");
	_melangeQueryText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_melangeQueryText.setLayoutData(createStandardLayout());
	_melangeQueryText.setFont(font);
	_melangeQueryText.setEditable(false);
	createTextLabelLayout(parent, "");
	
	return parent;
}
 
Example 39
Project: neoscada   File: FilterAdvancedComposite.java   Source Code and License 5 votes vote down vote up
private Combo createAttributeCombo ()
{
    final Combo c = new Combo ( this, SWT.NONE );
    c.add ( "sourceTimestamp" ); //$NON-NLS-1$
    c.add ( "entryTimestamp" ); //$NON-NLS-1$
    for ( final Event.Fields field : Event.Fields.values () )
    {
        c.add ( field.getName () );
    }
    c.add ( Messages.custom_field );
    c.select ( 0 );
    return c;
}
 
Example 40
Project: neoscada   File: FilterAdvancedComposite.java   Source Code and License 5 votes vote down vote up
private Combo createTypeCombo ()
{
    final Combo c = new Combo ( this, SWT.NONE );
    for ( final Type type : Type.values () )
    {
        c.add ( type.name () );
    }
    c.select ( 0 );
    return c;
}
 
Example 41
Project: convertigo-eclipse   File: HttpTriggerEditorComposite.java   Source Code and License 5 votes vote down vote up
/**
 * This method initializes type_trigger_combo	
 *
 */
private void createType_trigger_combo() {
	GridData gridData2 = new GridData();
	gridData2.horizontalAlignment = GridData.FILL;
	gridData2.verticalAlignment = GridData.CENTER;
	gridData2.grabExcessHorizontalSpace = true;
	type_trigger_combo = new Combo(commun_trigger, SWT.READ_ONLY);
	type_trigger_combo.setItems(customTriggers);
	type_trigger_combo
			.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
				public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
					int index = type_trigger_combo.getSelectionIndex();
					if (index == -1) {
						type_trigger_combo.select(0);
					} else if (index != last_index && custom_triggers != null) {
						help_label.setText(custom_triggers[index].getHelp());
				        stackLayout.topControl = custom_triggers[index];
				        custom_trigger.layout();
						last_index = index;
						if (index == 5) { // NoWait case
							timeout_label.setVisible(false);
							timeout_spin.setVisible(false);
						} else {
							timeout_label.setVisible(true);
							timeout_spin.setVisible(true);
						}
					}
				}
			});
	type_trigger_combo.setLayoutData(gridData2);
}
 
Example 42
Project: convertigo-eclipse   File: CariocaServiceCodeEditorComposite.java   Source Code and License 5 votes vote down vote up
/**
 * This method initializes comboConnectionType	
 *
 */
private void createComboConnectionType() {
	comboConnectionType = new Combo(this, SWT.NONE);
	comboConnectionType.add("");
	comboConnectionType.add("DIR");
	comboConnectionType.add("EIC");
	comboConnectionType.add("TCP");
}
 
Example 43
Project: convertigo-eclipse   File: EmulatorTechnologyWizardPage.java   Source Code and License 5 votes vote down vote up
public void createControl(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 2;
	layout.verticalSpacing = 9;

	Label label = new Label(container, SWT.NULL);
	label.setText("&Emulator technology:");

	emulatorTechnologyCombo = new Combo(container, SWT.NONE);
	String[] tags = EmulatorTechnologyEditor.getTags(null);
	for (int i = 0 ; i < tags.length ; i ++) {
		emulatorTechnologyCombo.add(tags[i]);
	}
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	emulatorTechnologyCombo.setLayoutData(gd);
	emulatorTechnologyCombo.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			dialogChanged();
		}
	});
	
	initialize();
	//dialogChanged();
	setControl(container);
}
 
Example 44
Project: Open_Source_ECOA_Toolset_AS5   File: CompImplDefPage.java   Source Code and License 5 votes vote down vote up
/**
 * @see IDialogPage#createControl(Composite)
 */
public void createControl(Composite parent) {
	root = new Composite(parent, SWT.NULL);
	GridLayout layout = new GridLayout();
	root.setLayout(layout);
	layout.numColumns = 2;
	layout.verticalSpacing = 9;
	Label label = new Label(root, SWT.NULL);
	label.setText("&Select Definition:");
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	nameText = new Combo(root, SWT.BORDER | SWT.SINGLE);
	nameText.setLayoutData(gd);
	setControl(root);
}
 
Example 45
Project: gw4e.project   File: GeneratorChoiceComposite.java   Source Code and License 5 votes vote down vote up
private void createAppendMode() {
	btnAppendRadioButton = new Button(this, SWT.RADIO);
	btnAppendRadioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	btnAppendRadioButton.setText(MessageUtil.getString("append_mode"));
	btnAppendRadioButton.setSelection(true);
	btnAppendRadioButton.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event e) {
			switch (e.type) {
			case SWT.Selection:
				updateUI();
				break;
			}
		}
	});
	btnAppendRadioButton.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_APPEND_CHECKBOX);

	Composite composite = new Composite(this, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	composite.setLayout(new GridLayout(12, false));

	lblAppendClassNameLabel = new Label(composite, SWT.NONE);
	lblAppendClassNameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblAppendClassNameLabel.setText("Class name");

	comboAppendClassnameViewer = new AncestorViewer(composite);
	comboAppendClassnameViewer.initialize(GW4E_CONVERSION_COMBO_ANCESTOR_EXTEND_TEST, false);
	comboAppendClassnameViewer.getCombo().setData(GW4E_CONVERSION_WIDGET_ID, GW4E_CONVERSION_COMBO_ANCESTOR_APPEND_TEST);
	Combo combo = comboAppendClassnameViewer.getCombo();
	combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
	combo.setEnabled(true);
}
 
Example 46
Project: gw4e.project   File: GW4ELaunchConfigurationTab.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 47
Project: pgcodekeeper   File: ProjectProperties.java   Source Code and License 5 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    panel.setLayout(layout);

    btnForceUnixNewlines = new Button(panel, SWT.CHECK);
    btnForceUnixNewlines.setText(Messages.ProjectProperties_force_unix_newlines);
    btnForceUnixNewlines.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
    btnForceUnixNewlines.setSelection(prefs.getBoolean(PROJ_PREF.FORCE_UNIX_NEWLINES, true));

    Label label = new Label(panel, SWT.NONE);
    label.setText(Messages.projectProperties_timezone_for_all_db_connections);

    cmbTimezone = new Combo(panel, SWT.BORDER | SWT.DROP_DOWN);
    cmbTimezone.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    cmbTimezone.setItems(UIConsts.TIME_ZONES.toArray(new String[UIConsts.TIME_ZONES.size()]));
    String tz = prefs.get(PROJ_PREF.TIMEZONE, ApgdiffConsts.UTC);
    cmbTimezone.setText(tz);
    cmbTimezone.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            checkSwitchWarnLbl();
        }
    });

    lblWarn = new CLabel(panel, SWT.NONE);
    lblWarn.setImage(Activator.getEclipseImage(ISharedImages.IMG_OBJS_WARN_TSK));
    lblWarn.setText(Messages.ProjectProperties_change_projprefs_warn);
    GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, false, false, 2, 1);
    gd.exclude = true;
    lblWarn.setLayoutData(gd);
    lblWarn.setVisible(false);

    return panel;
}
 
Example 48
Project: tap17-muggl-javaee   File: StepByStepExecutionComposite.java   Source Code and License 5 votes vote down vote up
/**
 * Wrapper method for the StepByStepExecutionRunner: set the steps that are
 * still to go.
 *
 * If multiple steps are executed in a row, the user will see the steps
 * beeing counted down until they reach zero.
 *
 * @param steps The next value for the steps.
 */
public synchronized void setStepsToGo(final int steps) {
	final Combo executeNextCombo = this.executeNextCombo;
	// Asynchronous access.
	this.display.asyncExec(new Runnable() {
		public void run() {
			executeNextCombo.setText(String.valueOf(steps));
		}
	});
}
 
Example 49
Project: Hydrograph   File: ExpressionEditorComposite.java   Source Code and License 5 votes vote down vote up
protected void createToolBar(Composite composite) {
	
	Button tltmWordWrap = new WordWrapToolCheckButton(composite, SWT.CHECK, expressionEditor);
	Combo tltmOperators = new OperatorToolCombo(composite, SWT.READ_ONLY, expressionEditor);
	Button tltmValidate = new ValidateExpressionToolButton(composite, SWT.NONE, expressionEditor);
	Button tltmTest = new EvaluateExpressionToolButton(composite, SWT.NONE, expressionEditor);
}
 
Example 50
Project: Hydrograph   File: CategoriesDialogSourceComposite.java   Source Code and License 5 votes vote down vote up
/**
 * Create the composite.
 * 
 * @param parent
 * @param addCategoreisDialog
 * @param style
 */
public CategoriesDialogSourceComposite(Composite parent, AddExternalJarPage addCategoreisDialog, int style) {
	super(parent, style);
	this.addCategoreisDialog = addCategoreisDialog;
	setLayout(new GridLayout(1, false));

	Composite headerComposite = new Composite(this, SWT.NONE);
	GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 0, 0);
	gd_composite.heightHint = 34;
	headerComposite.setLayoutData(gd_composite);
	headerComposite.setLayout(new GridLayout(3, false));

	comboJarList = new Combo(headerComposite, SWT.READ_ONLY);
	comboJarList.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 0, 1));
	loadComboJarListFromBuildPath(comboJarList,null);
	addListnersToCombo();
	
	createBrowseButton(headerComposite);
	createDelButton(headerComposite);

	sourcePackageList = new List(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
	GridData gd_packageList = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	gd_packageList.heightHint = 254;
	sourcePackageList.setLayoutData(gd_packageList);
	addDragSupport(sourcePackageList, comboJarList);
	addListenerToSourcePackageList(sourcePackageList);
}
 
Example 51
Project: Hydrograph   File: CategoriesDialogSourceComposite.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("restriction")
private void loadComboJarListFromBuildPath(Combo comboJarList, String newJarName) {
	comboJarList.removeAll();
	IProject iProject = BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject();
	IJavaProject iJavaProject=null;
	try {
		iJavaProject = JavaCore.create(iProject);
		PackageFragmentRoot srcfragmentRoot= BuildExpressionEditorDataSturcture.INSTANCE.getSrcPackageFragment(iJavaProject);
		comboJarList.add(hydrograph.ui.common.util.Constants.ProjectSupport_SRC);
		comboJarList.setData(String.valueOf(comboJarList.getItemCount() - 1), srcfragmentRoot);
		
		for (IPackageFragmentRoot iPackageFragmentRoot : iJavaProject.getAllPackageFragmentRoots()) {
			if (isJarPresentInLibFolder(iPackageFragmentRoot.getPath())
					&& iPackageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE) {
				comboJarList.add(iPackageFragmentRoot.getElementName());
				comboJarList.setData(String.valueOf(comboJarList.getItemCount() - 1), iPackageFragmentRoot);
			}
		}
		selectAndLoadJarData(newJarName);
	} catch (JavaModelException javaModelException) {
		LOGGER.error("Error occurred while loading engines-transform jar", javaModelException);
	}
	finally{
		if(iJavaProject!=null){
			try {
				iJavaProject.close();
			} catch (JavaModelException e) {
				LOGGER.warn("JavaModelException occurred while closing java-project"+e);
			}
		}
	}

}
 
Example 52
Project: Hydrograph   File: FTPWidgetUtility.java   Source Code and License 5 votes vote down vote up
/**
 * Create Combo Widget
 * @param control
 * @param widgetName
 * @return
 */
public Widget CreateCombo(Composite control, String[] widgetName){
	Combo combo = new Combo(control, SWT.READ_ONLY);
	combo.setItems(widgetName);
	combo.select(0);
	GridData gd_partitionKeyButton = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_partitionKeyButton.horizontalIndent = 10;
	combo.setLayoutData(gd_partitionKeyButton);
	
	return combo;
}
 
Example 53
Project: Hydrograph   File: FTPOperationConfigDialog.java   Source Code and License 5 votes vote down vote up
private Control addOperationGetPutFiles(Composite control){
	Composite composite = new Composite(control, SWT.BORDER);
	composite.setLayout(new GridLayout(3, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	
	FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
	Label pathLbl = (Label) ftpWidgetUtility.createLabel(composite, Messages.LOCAL_PATH);
	setPropertyHelpText(pathLbl, "Used to provide local path");
	text1 = (Text) ftpWidgetUtility.createText(composite, "", SWT.BORDER);
	Button localPathBrwsBtn = new Button(composite, SWT.NONE);
	localPathBrwsBtn.setText("...");
	selectionListener(localPathBrwsBtn, text1);
	
	Label remoteLbl = (Label) ftpWidgetUtility.createLabel(composite, Messages.REMOTE_PATH);
	setPropertyHelpText(remoteLbl, "Used to provide remote path");
	text2 = (Text) ftpWidgetUtility.createText(composite, "", SWT.BORDER);
	new Button(composite, SWT.NONE).setVisible(false);
	
	overWriteLabel = (Label) ftpWidgetUtility.createLabel(composite, Messages.WRITE_MODE);
	setPropertyHelpText(overWriteLabel, "Used to select OverWrite value");
	overwriteCombo = (Combo) ftpWidgetUtility.CreateCombo(composite, new String[]{Messages.OVERWRITE_IF_EXISTS, Messages.FAIL_IF_EXISTS});
	
	if(text1ControlDecoration == null){
		text1ControlDecoration = WidgetUtility.addDecorator(text1,Messages.EMPTYFIELDMESSAGE);
	}
	if(text2ControlDecoration == null){
		text2ControlDecoration = WidgetUtility.addDecorator(text2,Messages.EMPTYFIELDMESSAGE);
	}
	
	FTPWidgetUtility widgetUtility = new FTPWidgetUtility();
	widgetUtility.validateEmptyWidgetText(text1, propertyDialogButtonBar, cursor, text1ControlDecoration);
	widgetUtility.validateEmptyWidgetText(text2, propertyDialogButtonBar, cursor, text2ControlDecoration);
	
	return composite;
}
 
Example 54
Project: Hydrograph   File: ELTSWTWidgets.java   Source Code and License 5 votes vote down vote up
public Combo comboWidget(Composite parent, int style, int[] bounds,
		String[] items, int selectionIndex) {
	Combo comboBox = new Combo(parent, style);
	comboBox.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
	comboBox.setItems(items);
	comboBox.select(selectionIndex);

	return comboBox;
}
 
Example 55
Project: Hydrograph   File: JDBCDriverClassWidget.java   Source Code and License 5 votes vote down vote up
private boolean addComboSelectionListner() {
	combo.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			String str = ((Combo)event.getSource()).getText();
			if(dropDownConfig.getItems().contains(str)){
				jdbcDriverClassTextBoxDecorator.hide();
				jdbcDriverClassTextBox.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
				if(str.equalsIgnoreCase(Messages.ORACLE)){
					jdbcDriverClassTextBox.setText(Messages.ORACLE_DRIVER_CLASS);
				}else if(str.equalsIgnoreCase(Messages.REDSHIFT)){
					jdbcDriverClassTextBox.setText(Messages.REDSHIFT_DRIVER_CLASS);
				}else if(str.equalsIgnoreCase(Messages.MYSQL)){
					jdbcDriverClassTextBox.setText(Messages.MYSQL_DRIVER_CLASS);
				}else if(str.equalsIgnoreCase(Messages.TERADATA)){
					jdbcDriverClassTextBox.setText(Messages.TERADATA_DRIVER_CLASS);
				}else if(str.equalsIgnoreCase(Messages.OTHERS)){
					jdbcDriverClassTextBox.setText("");
					jdbcDriverClassTextBox.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 204));
					jdbcDriverClassTextBoxDecorator.setMarginWidth(3);
					jdbcDriverClassTextBoxDecorator.show();
				}
			}
		}
		
	});
	return true;
}
 
Example 56
Project: Hydrograph   File: AggregateCumulateExpressionComposite.java   Source Code and License 5 votes vote down vote up
/**
 * @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);
		textAccumulator.setEnabled(false);
		isParamAccumulator.setEnabled(false);
		comboDataTypes.setEnabled(false);
		super.disabledWidgetsifWholeExpressionIsParameter(isParamAccumulator, isWholeOperationParameter);
	}

}
 
Example 57
Project: Hydrograph   File: GridChangeListener.java   Source Code and License 5 votes vote down vote up
private void attachComboChangeListener(CellEditor cellEditor) {
	((Combo)cellEditor.getControl()).addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			propertyDialogButtonBar.enableApplyButton(true);
			super.widgetSelected(e);
		}
		
	});
}
 
Example 58
Project: Hydrograph   File: OperationClassComboChangeListener.java   Source Code and License 5 votes vote down vote up
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
		Widget... widgets) {
	final Widget[] widgetList = widgets;

	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			String comboValue = ((Combo) widgetList[0]).getText();
			propertyDialogButtonBar.enableApplyButton(true);
			if (Messages.CUSTOM.equalsIgnoreCase(comboValue) && !FilterOperationClassUtility.INSTANCE.isCheckBoxSelected()) {
				((Text) widgetList[1]).setText("");
				((Text) widgetList[1]).setEnabled(true);
				FilterOperationClassUtility.INSTANCE.enableAndDisableButtons(true, false);
			} else {
				if(FilterOperationClassUtility.INSTANCE.isCheckBoxSelected())
				{
					MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
					messageBox.setText(Messages.ERROR);
					messageBox.setMessage(Messages.CHECKBOX_DISABLE_MESSAGE);
					if (messageBox.open() == SWT.OK) {
						((Combo) widgetList[0]).setText(Messages.CUSTOM);
					} 
				}
				else
				{
					FilterOperationClassUtility.INSTANCE.setOperationClassNameInTextBox(comboValue, (Text)widgetList[1]);
					((Text) widgetList[1]).setEnabled(false);
					FilterOperationClassUtility.INSTANCE.enableAndDisableButtons(false, false);
					((Button) widgetList[2]).setEnabled(false);
				}
			}
		} 
	};
	return listener;
}
 
Example 59
Project: BiglyBT   File: SpeedTestSetLimitPanel.java   Source Code and License 5 votes vote down vote up
private void addDropElements(Combo combo, String[] elements){
    if(elements==null){
        return;
    }

    int n = elements.length;
    for(int i=0;i<n;i++){
        combo.add(elements[i]);
    }
}
 
Example 60
Project: bdf2   File: ColumnDialog.java   Source Code and License 5 votes vote down vote up
private Binding bindWidgetValue(Object obj, String property, Object objWidget, UpdateValueStrategy targetToModel,
		UpdateValueStrategy modelToTarget) {
	IObservableValue model = BeanProperties.value(obj.getClass(), property).observe(obj);
	IObservableValue widget = null;
	if (objWidget instanceof Text) {
		widget = WidgetProperties.text(SWT.Modify).observe(objWidget);
	} else if (objWidget instanceof Button || objWidget instanceof Combo) {
		widget = WidgetProperties.selection().observe(objWidget);
	}
	return dataBindingContext.bindValue(widget, model, targetToModel, modelToTarget);
}