Java Code Examples for org.eclipse.swt.SWT#DROP_DOWN

The following examples show how to use org.eclipse.swt.SWT#DROP_DOWN . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void createControl(Composite parent) {

	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(2, false));

	Label projectNameLabel = new Label(container, SWT.NULL);
	projectNameLabel.setText("Java project:");
	projectCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	projectCombo.setLayoutData(gd);
	projectCombo.addModifyListener(evt -> validate());
	for (IJavaProject javaProject : GhidraProjectUtils.getJavaProjects()) {
		IProject project = javaProject.getProject();
		projectCombo.add(project.getName());
		if (project.equals(selectedProject)) {
			projectCombo.setText(project.getName());
		}
	}

	validate();
	setControl(container);
}
 
Example 2
Source Project: nebula   File: CDateTime.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private static int convertStyle(int style) {
	int rstyle = SWT.NONE;
	if ((style & CDT.DROP_DOWN) != 0) {
		rstyle |= SWT.DROP_DOWN;
	}
	if ((style & CDT.SIMPLE) != 0) {
		rstyle |= SWT.SIMPLE;
	}
	if ((style & CDT.READ_ONLY) != 0) {
		rstyle |= SWT.READ_ONLY;
	}
	if ((style & CDT.BUTTON_LEFT) != 0) {
		rstyle |= SWT.LEFT;
	}
	if ((style & CDT.TEXT_LEAD) != 0) {
		rstyle |= SWT.LEAD;
	}
	if ((style & CDT.BORDER) != 0) {
		rstyle |= SWT.BORDER;
	}
	if (win32) {
		rstyle |= SWT.DOUBLE_BUFFERED;
	}
	return rstyle;
}
 
Example 3
Source Project: uima-uimaj   File: TypeCombo.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Instantiates a new type combo.
 *
 * @param parent the parent
 */
public TypeCombo(Composite parent) {
  super(parent, SWT.NONE);

  setLayout(new FillLayout());

  typeCombo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.BORDER);
  
  typeCombo.addModifyListener(new ModifyListener() {
    @Override
    public void modifyText(ModifyEvent e) {
      Type newType = getType();

      for (ITypePaneListener listener : listeners) {
        listener.typeChanged(newType);
      }
    }
  });
}
 
Example 4
Source Project: gama   File: DateEditor.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public Control createCustomParameterControl(final Composite compo) {
	edit = new Composite(compo, SWT.NONE);
	final GridLayout pointEditorLayout = new GridLayout(2, true);
	pointEditorLayout.horizontalSpacing = 10;
	pointEditorLayout.verticalSpacing = 0;
	pointEditorLayout.marginHeight = 0;
	pointEditorLayout.marginWidth = 0;
	edit.setLayout(pointEditorLayout);
	date = new DateTime(edit, SWT.DROP_DOWN | SWT.BORDER | SWT.DATE | SWT.LONG);
	time = new DateTime(edit, SWT.DROP_DOWN | SWT.BORDER | SWT.TIME | SWT.LONG);
	date.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color());
	date.addSelectionListener(this);
	time.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color());
	time.addSelectionListener(this);
	edit.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color());
	displayParameterValue();
	return edit;
}
 
Example 5
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setSize( 220, 80 );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setLayout( new GridLayout( ) );

	Regression_141706_svg siv = new Regression_141706_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	Composite cBottom = new Composite( shell, SWT.NONE );
	cBottom.setLayoutData( new GridData( GridData.CENTER ) );
	cBottom.setLayout( new RowLayout( ) );

	Label la = new Label( cBottom, SWT.NONE );
	la.setText( "Choose: " );//$NON-NLS-1$

	cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY );
	cbType.add( "Show Tooltip" );//$NON-NLS-1$
	cbType.select( 0 );

	btn = new Button( cBottom, SWT.NONE );
	btn.setText( "Show" );//$NON-NLS-1$
	btn.addSelectionListener( siv );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 6
@Override
public void createControl(Composite parent) {
	Composite comp = new Group(parent, SWT.NONE);
	setControl(comp);

	GridLayoutFactory.swtDefaults().numColumns(2).applyTo(comp);

	Label labelProject = new Label(comp, SWT.NONE);
	labelProject.setText(Messages.Launch_Project);
	GridDataFactory.swtDefaults().applyTo(labelProject);

	comboProject = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
	for (IProject project : getProjectsInWorkspace()) {
		comboProject.add(project.getName());
	}
	GridDataFactory.fillDefaults().grab(true, false).applyTo(comboProject);
	comboProject.addModifyListener(event -> updateLaunchConfigurationDialog());

	Label labelSdkLocation = new Label(comp, SWT.NONE);
	labelSdkLocation.setText(Messages.Preference_SDKLocation_Dart);
	GridDataFactory.swtDefaults().applyTo(labelSdkLocation);

	textSdkLocation = new Text(comp, SWT.BORDER);
	textSdkLocation.setMessage(Messages.Launch_SDKLocation_Message);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(textSdkLocation);
	textSdkLocation.addModifyListener(event -> updateLaunchConfigurationDialog());

	Label labelMainClass = new Label(comp, SWT.NONE);
	labelMainClass.setText(Messages.Launch_MainClass);
	GridDataFactory.swtDefaults().applyTo(labelMainClass);

	textMainClass = new Text(comp, SWT.BORDER);
	textMainClass.setMessage(Messages.Launch_MainClass_Message);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(textMainClass);
	textMainClass.addModifyListener(event -> updateLaunchConfigurationDialog());
}
 
Example 7
Source Project: birt   File: JointDataSetPage.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * create left composite for page
 * 
 * @param composite
 */
private void createLeftGroup( Composite composite )
{
	leftGroup = new Group( composite, SWT.NONE );
	leftGroup.setLayout( new FormLayout( ) );
	leftGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	FormData data = new FormData( );

	data.top = new FormAttachment( 0, 5 );
	data.left = new FormAttachment( 0, 5 );
	data.right = new FormAttachment( 100, -5 );
	data.bottom = new FormAttachment( 10, -5 );

	leftDataSetChooser = new ComboViewer( leftGroup, SWT.DROP_DOWN
			| SWT.READ_ONLY );
	leftDataSetChooser.getCombo( ).setLayoutData( data );
	DataSetComboProvider provider = new DataSetComboProvider( );
	leftDataSetChooser.setContentProvider( provider );
	leftDataSetChooser.setLabelProvider( provider );
	leftDataSetChooser.setInput( dataSetList );
	leftDataSetChooser.addSelectionChangedListener( this );

	data = new FormData( );

	data.top = new FormAttachment( leftDataSetChooser.getCombo( ), 10 );
	data.left = new FormAttachment( 0, 5 );
	data.right = new FormAttachment( 100, -5 );
	data.bottom = new FormAttachment( 100, -5 );

	leftColumnList = new ListViewer( leftGroup, SWT.V_SCROLL
			| SWT.H_SCROLL
			| SWT.BORDER );
	leftColumnList.getControl( ).setLayoutData( data );
	ColumnProvider colProvider = new ColumnProvider( );
	leftColumnList.setContentProvider( colProvider );
	leftColumnList.setLabelProvider( colProvider );
	leftColumnList.addSelectionChangedListener( this );

}
 
Example 8
Source Project: nebula   File: GeoMapBrowser.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public void createMenu(Shell shell) {
	Menu bar = new Menu(shell, SWT.BAR);
	shell.setMenuBar(bar);
	MenuItem fileItem = new MenuItem(bar, SWT.CASCADE);
	fileItem.setText("&File");
	Menu submenu = new Menu(shell, SWT.DROP_DOWN);
	fileItem.setMenu(submenu);
	MenuItem item = new MenuItem(submenu, SWT.PUSH);
	item.addListener(SWT.Selection, e -> Runtime.getRuntime().halt(0));
	item.setText("E&xit\tCtrl+W");
	item.setAccelerator(SWT.MOD1 + 'W');
}
 
Example 9
/**
 * main() method for constructing the layout.
 * 
 * @param args
 */
public static void main( String[] args )
{
	Display display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setSize( 600, 400 );
	shell.setLayout( new GridLayout( ) );

	Regression_118773_swt siv = new Regression_118773_swt(
			shell,
			SWT.NO_BACKGROUND );
	siv.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	siv.addPaintListener( siv );

	Composite cBottom = new Composite( shell, SWT.NONE );
	cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cBottom.setLayout( new RowLayout( ) );

	Label la = new Label( cBottom, SWT.NONE );

	la.setText( "Choose: " );//$NON-NLS-1$
	cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY );
	cbType.add( "Bar Chart" );
	cbType.select( 0 );

	btn = new Button( cBottom, SWT.NONE );
	btn.setText( "Update" );//$NON-NLS-1$
	btn.addSelectionListener( siv );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 10
public BorderThicknessPicker(Composite parent) {
    super(parent, NONE);
    setLayout(new RowLayout());

    combo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN);
    combo.setItems(new String[] { "Thin", "Thick", "Very Thick" });
    combo.select(0);
}
 
Example 11
public HorizontalAlignmentPicker(Composite parent, HorizontalAlignmentEnum alignment) {
    super(parent, SWT.NONE);
    setLayout(new RowLayout());

    combo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN);
    combo.setItems(new String[] { "Center", "Left", "Right" });

    update(alignment);
}
 
Example 12
Source Project: nebula   File: RoundedToolItem.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private static int checkStyle(final int style) {
	if ((style & SWT.CHECK) != 0) {
		return SWT.CHECK;
	}
	if ((style & SWT.RADIO) != 0) {
		return SWT.RADIO;
	}
	if ((style & SWT.TOGGLE) != 0) {
		return SWT.TOGGLE;
	}
	if ((style & SWT.DROP_DOWN) != 0) {
		return SWT.DROP_DOWN;
	}
	return SWT.PUSH;
}
 
Example 13
public LineStylePicker(Composite parent) {
    super(parent, NONE);
    setLayout(new RowLayout());
    
    combo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN);
    combo.setItems(new String[] { "Solid", "Dashed", "Dotted", "Dashdot", "Dashdotdot" });
    combo.select(0);
}
 
Example 14
private SuppressedEditingSupport(TableViewer viewer) {
    super(viewer);
    this.viewer = viewer;
    this.editor = new ComboBoxCellEditor(viewer.getTable(), ArrayUtils.toArray("yes",
            "no"), SWT.DROP_DOWN | SWT.READ_ONLY);
}
 
Example 15
/**
 * main() method for constructing the layout.
 * 
 * @param args
 */
public static void main( String[] args )
{
	Display display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setSize( 600, 400 );
	shell.setLayout( new GridLayout( ) );

	SWTURLRedirectViewer siv = new SWTURLRedirectViewer(
			shell,
			SWT.NO_BACKGROUND );
	siv.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	siv.addPaintListener( siv );

	Composite cBottom = new Composite( shell, SWT.NONE );
	cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cBottom.setLayout( new RowLayout( ) );

	Label la = new Label( cBottom, SWT.NONE );

	la.setText( "Choose: " );//$NON-NLS-1$
	cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY );
	cbType.add( "Area Chart" );
	cbType.add( "Bar Chart" );
	cbType.add( "Line Chart" );
	cbType.add( "Meter Chart" );
	cbType.add( "Pie Chart" );
	cbType.add( "Scatter Chart" );
	cbType.add( "Stock Chart" );
	cbType.select( 0 );

	btn = new Button( cBottom, SWT.NONE );
	btn.setText( "Update" );//$NON-NLS-1$
	btn.addSelectionListener( siv );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 16
Source Project: birt   File: GroupDialog.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the group area
 * 
 * @param parent
 *            the parent composite
 */
private void createGroupArea( Composite parent )
{
	Composite composite = new Composite( parent, SWT.NONE );
	GridData layoutData = new GridData( GridData.FILL_HORIZONTAL
			| GridData.VERTICAL_ALIGN_BEGINNING );
	layoutData.verticalSpan = 2;
	composite.setLayoutData( layoutData );
	composite.setLayout( new GridLayout( ) );

	sortingGroup = new Group( composite, SWT.NONE );
	sortingGroup.setText( SORT_GROUP_TITLE );
	sortingGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	sortingGroup.setLayout( new FillLayout( SWT.VERTICAL ) );

	Composite sortingGroupComposite = new Composite( sortingGroup, SWT.NONE );
	sortingGroupComposite.setLayout( new GridLayout( ) );

	ascending = new Button( sortingGroupComposite, SWT.RADIO );
	// ascending.setText( sortByAscending.getDisplayName( ) );
	ascending.setText( Messages.getString( "GroupDialog.Button.Ascending" ) ); //$NON-NLS-1$
	descending = new Button( sortingGroupComposite, SWT.RADIO );
	// descending.setText( sortByDescending.getDisplayName( ) );
	descending.setText( Messages.getString( "GroupDialog.Button.Descending" ) ); //$NON-NLS-1$

	Group pagebreakGroup = new Group( composite, SWT.NONE );

	pagebreakGroup.setText( Messages.getString( "GroupDialog.PageBreak" ) ); //$NON-NLS-1$
	pagebreakGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	GridLayout layout = new GridLayout( );
	layout.numColumns = 3;
	pagebreakGroup.setLayout( layout );

	new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakBefore" ) ); //$NON-NLS-1$
	pagebreakBeforeCombo = new Combo( pagebreakGroup, SWT.READ_ONLY
			| SWT.DROP_DOWN );
	for ( int i = 0; i < pagebreakBeforeChoicesAll.length; i++ )
	{
		pagebreakBeforeCombo.add( pagebreakBeforeChoicesAll[i].getDisplayName( ) );
	}
	pagebreakBeforeCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	pagebreakBeforeCombo.setVisibleItemCount( 30 );
	WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true );
	pagebreakBeforeCombo.setData( pagebreakBeforeChoicesAll );

	new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakAfter" ) ); //$NON-NLS-1$
	pagebreakAfterCombo = new Combo( pagebreakGroup, SWT.READ_ONLY
			| SWT.DROP_DOWN );
	for ( int i = 0; i < pagebreakAfterChoicesAll.length; i++ )
	{
		pagebreakAfterCombo.add( pagebreakAfterChoicesAll[i].getDisplayName( ) );
	}
	pagebreakAfterCombo.setVisibleItemCount( 30 );
	pagebreakAfterCombo.setData( pagebreakAfterChoicesAll );
	pagebreakAfterCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true );

	new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakInside" ) ); //$NON-NLS-1$
	pagebreakInsideCombo = new Combo( pagebreakGroup, SWT.READ_ONLY
			| SWT.DROP_DOWN );
	for ( int i = 0; i < pagebreakInsideChoicesAll.length; i++ )
	{
		pagebreakInsideCombo.add( pagebreakInsideChoicesAll[i].getDisplayName( ) );
	}
	pagebreakInsideCombo.setVisibleItemCount( 30 );
	pagebreakInsideCombo.setData( pagebreakInsideChoicesAll );
	pagebreakInsideCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true );

	repeatHeaderButton = new Button( pagebreakGroup, SWT.CHECK );
	repeatHeaderButton.setText( Messages.getString( "GroupDialog.RepeatHeader" ) ); //$NON-NLS-1$
	GridData data = new GridData( );
	data.horizontalSpan = 3;
	repeatHeaderButton.setLayoutData( data );

	PropertyHandle propertyHandle = inputGroup.getPropertyHandle( TableHandle.SORT_PROP );
	if ( propertyHandle.iterator( ).hasNext( ) )
	{
		ascending.setEnabled( false );
		descending.setEnabled( false );
	}
}
 
Example 17
/**
 * Create contents of the wizard.
 *
 * @param parent
 */
@Override
public void createControl(final Composite parent) {
	this.container = new Composite(parent, SWT.NULL);
	this.container.setBounds(10, 10, 200, 300);
	final GridLayout layout = new GridLayout(3, false);
	this.container.setLayout(layout);
	final List<Primitive> primitives = PrimitiveJSONReader.getPrimitiveTypes(Utils.getResourceFromWithin(Constants.jsonPrimitiveTypesFile));

	setControl(this.container);
	new Label(this.container, SWT.NONE);
	new Label(this.container, SWT.NONE);
	new Label(this.container, SWT.NONE);

	final Label AlgorithmType = new Label(this.container, SWT.NONE);
	AlgorithmType.setText("What kind of algorithm do you want to integrate?       ");
	new Label(this.container, SWT.NONE);

	this.primitiveComboSelection = new ComboViewer(this.container, SWT.DROP_DOWN | SWT.READ_ONLY);
	final Combo combo = this.primitiveComboSelection.getCombo();
	final GridData gd_combo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
	gd_combo.widthHint = 140;
	combo.setLayoutData(gd_combo);
	this.primitiveComboSelection.setContentProvider(ArrayContentProvider.getInstance());
	this.primitiveComboSelection.setLabelProvider(new LabelProvider() {

		@Override
		public String getText(final Object primitive) {
			if (primitive instanceof Primitive) {
				final Primitive current = (Primitive) primitive;
				return current.getName();
			}
			return super.getText(primitive);
		}
	});
	// add primitives in combo
	this.primitiveComboSelection.setInput(primitives);

	this.primitiveComboSelection.addSelectionChangedListener(event -> {
		final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
		final Primitive selectedPrimitive = (Primitive) selection.getFirstElement();

		PrimitiveSelectionPage.this.primitiveComboSelection.refresh();
		setPageComplete(selectedPrimitive != null);
	});
	this.primitiveComboSelection.setSelection(new StructuredSelection(primitives.get(0)));
}
 
Example 18
@Override
public Composite createDataSelector( Composite parent )
{
	parentComposite = parent;
	// select the only data set
	if ( itemHandle.getDataBindingType( ) == ReportItemHandle.DATABINDING_TYPE_NONE
			&& itemHandle.getContainer( ) instanceof ModuleHandle )
	{
		DataSetInfo[] dataSets = dataProvider.getAllDataSets( );
		if ( dataProvider.getAllDataCubes( ).length == 0
				&& dataSets.length == 1 )
		{
			dataProvider.setDataSet( dataSets[0] );
		}
	}

	Composite cmpDataSet = ChartUIUtil.createCompositeWrapper( parent );
	{
		cmpDataSet.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	}

	Label label = new Label( cmpDataSet, SWT.NONE );
	{
		label.setText( Messages.getString( "StandardChartDataSheet.Label.SelectDataSet" ) ); //$NON-NLS-1$
		label.setFont( JFaceResources.getBannerFont( ) );
	}

	Composite cmpDetail = new Composite( cmpDataSet, SWT.NONE );
	{
		GridLayout gridLayout = new GridLayout( 2, false );
		gridLayout.marginWidth = 10;
		gridLayout.marginHeight = 0;
		cmpDetail.setLayout( gridLayout );
		cmpDetail.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	}

	Composite compRadios = ChartUIUtil.createCompositeWrapper( cmpDetail );
	{
		GridData gd = new GridData( );
		gd.verticalSpan = 2;
		compRadios.setLayoutData( gd );
	}

	btnInherit = new Button( compRadios, SWT.RADIO );
	btnInherit.setText( Messages.getString( "StandardChartDataSheet.Label.UseReportData" ) ); //$NON-NLS-1$
	btnInherit.addListener( SWT.Selection, this );

	btnUseData = new Button( compRadios, SWT.RADIO );
	btnUseData.setText( Messages.getString( "StandardChartDataSheet.Label.UseDataSet" ) ); //$NON-NLS-1$
	btnUseData.addListener( SWT.Selection, this );

	cmbInherit = new CCombo( cmpDetail, SWT.DROP_DOWN
			| SWT.READ_ONLY
			| SWT.BORDER );
	cmbInherit.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cmbInherit.addListener( SWT.Selection, this );

	cmbDataItems = new DataItemCombo( cmpDetail, SWT.DROP_DOWN
			| SWT.READ_ONLY
			| SWT.BORDER ) {

		@Override
		public boolean triggerSelection( int index )
		{
			int selectState = selectDataTypes.get( index ).intValue( );
			if ( selectState == SELECT_NEW_DATASET
					|| selectState == SELECT_NEW_DATACUBE )
			{
				return false;
			}
			return true;
		}

		@Override
		public boolean skipSelection( int index )
		{
			//skip out of boundary selection
			if(index>=0){
				int selectState = selectDataTypes.get( index ).intValue( );
				if ( selectState == SELECT_NEXT )
				{
					return true;
				}
			}
				
			return false;
		}
	};
	cmbDataItems.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cmbDataItems.addListener( SWT.Selection, this );
	cmbDataItems.setVisibleItemCount( 30 );

	initDataSelector( );
	updatePredefinedQueries( );
	checkDataBinding( );
	if ( dataProvider.checkState( IDataServiceProvider.IN_MULTI_VIEWS ) )
	{
		autoSelect( false );
	}
	return cmpDataSet;
}
 
Example 19
Source Project: birt   File: ChartPlotSheetImpl.java    License: Eclipse Public License 1.0 4 votes vote down vote up
protected void createControlForAreaWithinAxes( Composite cmpBasic,
		int fillStyles )
{
	Label lblWithinAxes = new Label( cmpBasic, SWT.NONE );
	{
		GridData gd = new GridData( );
		gd.horizontalSpan = 2;
		lblWithinAxes.setLayoutData( gd );
		lblWithinAxes.setFont( JFaceResources.getBannerFont( ) );
		lblWithinAxes.setText( getChart( ) instanceof ChartWithAxes ? Messages.getString( "ChartPlotSheetImpl.Label.AreaWithinAxes" ) : Messages.getString( "ChartPlotSheetImpl.Label.ClientArea" ) ); //$NON-NLS-1$ //$NON-NLS-2$
	}

	// WithinAxes area is not supported in 3D
	if ( enableAreaWithinAxesUI( ) )
	{
		new Label( cmpBasic, SWT.NONE ).setText( Messages.getString( "ChartPlotSheetImpl.Label.Background2" ) ); //$NON-NLS-1$

		cmbClientAreaColor = new FillChooserComposite( cmpBasic,
				SWT.DROP_DOWN | SWT.READ_ONLY,
				fillStyles,
				getContext( ),
				getChart( ).getPlot( ).getClientArea( ).getBackground( ) );
		{
			GridData gridData = new GridData( );
			gridData.widthHint = 200;
			cmbClientAreaColor.setLayoutData( gridData );
			cmbClientAreaColor.addListener( this );
		}
	}

	// Following settings only work in some criteria
	boolean is3DWallFloorSet = ChartUIUtil.is3DWallFloorSet( getChart( ) );
	lblVisibleWithin = new Label( cmpBasic, SWT.NONE );
	{
		lblVisibleWithin.setText( Messages.getString( "ChartPlotSheetImpl.Label.Outline" ) ); //$NON-NLS-1$
		lblVisibleWithin.setEnabled( is3DWallFloorSet );
	}

	btnWithinVisible = getContext( ).getUIFactory( )
			.createChartCheckbox( cmpBasic,
					SWT.NONE,
					DefaultValueProvider.defChartWithAxes( )
							.getPlot( )
							.getClientArea( )
							.getOutline( )
							.isVisible( ) );
	btnWithinVisible.setText( Messages.getString( "ChartPlotSheetImpl.Label.Visible2" ) ); //$NON-NLS-1$
	btnWithinVisible.setSelectionState( getChart( ).getPlot( )
			.getClientArea( )
			.getOutline( )
			.isSetVisible( ) ? ( getChart( ).getPlot( )
			.getClientArea( )
			.getOutline( )
			.isVisible( ) ? ChartCheckbox.STATE_SELECTED
			: ChartCheckbox.STATE_UNSELECTED )
			: ChartCheckbox.STATE_GRAYED );
	btnWithinVisible.setEnabled( is3DWallFloorSet );
	if ( !btnWithinVisible.getEnabled( ) )
	{
		// Hide for 3D
		btnWithinVisible.setSelectionState( ChartCheckbox.STATE_UNSELECTED );
	}
	btnWithinVisible.addSelectionListener( this );
}
 
Example 20
Source Project: BiglyBT   File: TagUIUtils.java    License: GNU General Public License v2.0 2 votes vote down vote up
private static void
createNonAutoMenuItems(
	Menu 		menu,
	Tag 		tag,
	TagType 	tag_type,
	Menu[] 		menuShowHide )
{

	if ( tag_type.hasTagTypeFeature( TagFeature.TF_PROPERTIES )){

		TagFeatureProperties props = (TagFeatureProperties)tag;

		boolean has_ut = props.getProperty( TagFeatureProperties.PR_UNTAGGED ) != null;

		if ( has_ut ){

			has_ut = false;

			for ( Tag t: tag_type.getTags()){

				props = (TagFeatureProperties)t;

				TagProperty prop = props.getProperty( TagFeatureProperties.PR_UNTAGGED );

				if ( prop != null ){

					Boolean b = prop.getBoolean();

					if ( b != null && b ){

						has_ut = true;

						break;
					}
				}
			}

			if  ( !has_ut ){

				if ( menuShowHide[0] == null ){

					menuShowHide[0] = new Menu(menu.getShell(), SWT.DROP_DOWN);

					MenuItem showhideitem = new MenuItem(menu, SWT.CASCADE);
					showhideitem.setText( MessageText.getString( "label.showhide.tag" ));
					showhideitem.setMenu(menuShowHide[0]);

				}else{

					new MenuItem( menuShowHide[0], SWT.SEPARATOR );
				}

				MenuItem showAll = new MenuItem(menuShowHide[0], SWT.PUSH);
				Messages.setLanguageText(showAll, "label.untagged");
				showAll.addListener(SWT.Selection, new Listener() {
					@Override
					public void handleEvent(Event event){
						try{
							String tag_name = MessageText.getString( "label.untagged" );

							Tag ut_tag = tag_type.getTag( tag_name, true );

							if ( ut_tag == null ){


								ut_tag = tag_type.createTag( tag_name, true );
							}

							TagFeatureProperties tp = (TagFeatureProperties)ut_tag;

							tp.getProperty( TagFeatureProperties.PR_UNTAGGED ).setBoolean( true );

						}catch( TagException e ){

							Debug.out( e );
						}
					}});
			}
		}
	}
	
	List<Tag> tags = new ArrayList<>();
	
	tags.add( tag );

	createTagGroupMenu( menu, tag_type, tags );
	
	MenuItem itemDelete = new MenuItem(menu, SWT.PUSH);

	Utils.setMenuItemImage(itemDelete, "delete");

	Messages.setLanguageText(itemDelete, "FileItem.delete");
	itemDelete.addListener(SWT.Selection, event -> removeTags(tag));
}