Java Code Examples for org.eclipse.swt.widgets.Label#setEnabled()

The following examples show how to use org.eclipse.swt.widgets.Label#setEnabled() . 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
Source File: ExportDBSettingDialog.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void initializeBody(Composite group) {
	GridData labelLayoutData = new GridData();
	// labelLayoutData.widthHint = 130;

	// DB
	Label label = new Label(group, SWT.NONE);
	label.setLayoutData(labelLayoutData);
	label.setText(ResourceString
			.getResourceString("label.tablespace.environment"));
	label.setEnabled(true);

	this.environmentCombo = new Combo(group, SWT.BORDER | SWT.READ_ONLY);
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.widthHint = 200;
	this.environmentCombo.setLayoutData(data);
	this.environmentCombo.setVisibleItemCount(20);
	this.environmentCombo.setEnabled(true);

	super.initializeBody(group);
}
 
Example 2
Source File: ExportDBSettingDialog.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeBody(Composite group) {
    final GridData labelLayoutData = new GridData();

    // DB
    final Label label = new Label(group, SWT.NONE);
    label.setLayoutData(labelLayoutData);
    label.setText(DisplayMessages.getMessage("label.tablespace.environment"));
    label.setEnabled(true);

    this.environmentCombo = new Combo(group, SWT.BORDER | SWT.READ_ONLY);
    final GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 200;
    environmentCombo.setLayoutData(data);
    environmentCombo.setVisibleItemCount(20);
    environmentCombo.setEnabled(true);

    super.initializeBody(group);
}
 
Example 3
Source File: MechanicStatusControlContribution.java    From workspacemechanic with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createControl(Composite parent) {
  parent.getParent().setRedraw(true);
  initImageCache();

  label = new Label(parent, SWT.CENTER);
  label.setSize(22, 22);
  label.setEnabled(false);

  setMechanicStatus(MechanicStatus.STOPPED);

  // observe mouse events
  registerClickHandlers();

  createContextMenu(label);

  // observe TaskService status changes
  service.addTaskStatusChangeListener(statusListener);

  // TODO(smckay): figure out why updateDisplay must be called here and now
  // or else, the widget contents (label) will *never* get displayed.
  updateDisplay();
  return label;
}
 
Example 4
Source File: NewProjectNameAndLocationWizardPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the project location specification controls.
 *
 * @param projectGroup the parent composite
 * @param enabled the initial enabled state of the widgets created
 */
private void createUserSpecifiedProjectLocationGroup(Composite projectGroup, boolean enabled) {
    Font font = projectGroup.getFont();
    // location label
    locationLabel = new Label(projectGroup, SWT.NONE);
    locationLabel.setFont(font);
    locationLabel.setText("Director&y");
    locationLabel.setEnabled(enabled);

    // project location entry field
    locationPathField = new Text(projectGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    locationPathField.setLayoutData(data);
    locationPathField.setFont(font);
    locationPathField.setEnabled(enabled);

    // browse button
    browseButton = new Button(projectGroup, SWT.PUSH);
    browseButton.setFont(font);
    browseButton.setText("B&rowse");
    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            handleLocationBrowseButtonPressed();
        }
    });

    browseButton.setEnabled(enabled);

    // Set the initial value first before listener
    // to avoid handling an event during the creation.
    if (initialLocationFieldValue != null) {
        locationPathField.setText(initialLocationFieldValue.toOSString());
    }
    locationPathField.addListener(SWT.Modify, locationModifyListener);
}
 
Example 5
Source File: CodeAssistConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void setControlEnabled(Key key, boolean enabled) {
	Control control= getControl(key);
	control.setEnabled(enabled);
	Label label= fLabels.get(control);
	if (label != null)
		label.setEnabled(enabled);
}
 
Example 6
Source File: FormatterControlManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void enableControl(Control control, boolean enabled)
{
	control.setEnabled(enabled);
	final Label label = labelAssociations.get(control);
	if (label != null)
	{
		label.setEnabled(enabled);
	}
	if (control instanceof Text)
	{
		IStatus status = bindingManager.validateText((Text) control);
		bindingManager.updateStatus(status);
	}
}
 
Example 7
Source File: MappingDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void setTabFlags( Button wMainPath, Label wlInputStep, Text wInputStep, Button wbInputStep,
                          Label wlOutputStep, Text wOutputStep, Button wbOutputStep, Label wlDescription,
                          Text wDescription ) {
  boolean mainPath = wMainPath.getSelection();
  wlInputStep.setEnabled( !mainPath );
  wInputStep.setEnabled( !mainPath );
  wbInputStep.setEnabled( !mainPath );
  wlOutputStep.setEnabled( !mainPath );
  wOutputStep.setEnabled( !mainPath );
  wbOutputStep.setEnabled( !mainPath );
  wlDescription.setEnabled( !mainPath );
  wDescription.setEnabled( !mainPath );
}
 
Example 8
Source File: AddAnalysisDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
protected void setErrorLabel(Label label, String errorMessage) {
    if (label != null && !label.isDisposed()) {
        label.setText(errorMessage == null ? " \n " : errorMessage); //$NON-NLS-1$
        final boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0;
        label.setEnabled(hasError);
        label.setVisible(hasError);
        label.getParent().update();
        Control button = getButton(IDialogConstants.OK_ID);

        if (button != null) {
            button.setEnabled(errorMessage == null);
        }
    }
}
 
Example 9
Source File: CodeRecommendationView.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create contents of the view part.
 * 
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {
	super.createPartControl(parent);

	Composite container = new Composite(parent, SWT.NONE);
	container.setBackgroundMode(SWT.INHERIT_FORCE);
	container.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	container.setLayout(new GridLayout(1, false));
	{
		SashForm sashForm = new SashForm(container, SWT.NONE);
		sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		{
			resultsComposite = new Composite(sashForm, SWT.NONE);
			resultsComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
			resultsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
			{
				Label lblInitiateACode = new Label(resultsComposite, SWT.NONE);
				lblInitiateACode.setText("Initiate a code recommendation request first, to see the results here");
			}
		}
		{
			previewComposite = new Composite(sashForm, SWT.NONE);
			StackLayout layout = new StackLayout();
			previewComposite.setLayout(layout);
			lblSelectAPattern = new Label(previewComposite, SWT.CENTER);
			lblSelectAPattern.setEnabled(false);
			lblSelectAPattern.setText("Select a pattern to open in preview");
			layout.topControl = lblSelectAPattern;
		}
		sashForm.setWeights(new int[] { 1, 1 });
	}

	createActions();
	initializeToolBar();
	initializeMenu();
}
 
Example 10
Source File: ConfigurationSettingsWizardPage.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
protected Composite createLeftColumn(Composite composite) {
  Group leftColumn = new Group(composite, SWT.NONE);
  leftColumn.setLayout(LayoutUtils.createGridLayout(5, 0));
  leftColumn.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_left_column_connection);

  /*
   * prepare network setting composite
   */
  Composite autoconnectComposite =
      new IllustratedComposite(leftColumn, SWT.TOP, ImageManager.ELCL_XMPP_CONNECTED);
  autoconnectComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
  autoconnectComposite.setLayout(LayoutUtils.createGridLayout(0, 5));
  autoconnectComposite.setBackgroundMode(SWT.INHERIT_NONE);

  /*
   * auto connect
   */
  Label autoConnectLabel = new Label(autoconnectComposite, SWT.WRAP);
  autoConnectLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  autoConnectLabel.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_label_autoconnect);

  this.autoConnectButton = new Button(autoconnectComposite, SWT.CHECK | SWT.LEFT);
  this.autoConnectButton.setText(
      saros.ui.Messages.ConfigurationSettingsWizardPage_button_autoconnect);

  /*
   * separator
   */
  new Label(leftColumn, SWT.SEPARATOR | SWT.HORIZONTAL)
      .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

  // Gateway port mapping setting
  Composite gatewayComposite =
      new IllustratedComposite(leftColumn, SWT.TOP, ImageManager.ICON_UPNP);
  gatewayComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
  gatewayComposite.setLayout(LayoutUtils.createGridLayout(0, 5));
  gatewayComposite.setBackgroundMode(SWT.INHERIT_NONE);

  portmappingLabel = new Label(gatewayComposite, SWT.WRAP);
  portmappingLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  portmappingLabel.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_label_portmapping);

  this.setupPortmappingButton = new Button(gatewayComposite, SWT.CHECK | SWT.LEFT | SWT.WRAP);
  this.setupPortmappingButton.setText(
      saros.ui.Messages.ConfigurationSettingsWizardPage_button_portmapping);
  this.setupPortmappingButton.setToolTipText(
      saros.ui.Messages.ConfigurationSettingsWizardPage_button_portmapping_tooltip);
  setupPortmappingButton.setEnabled(false);

  Composite comboCompo = new Composite(gatewayComposite, SWT.TOP | SWT.LEFT);
  RowLayout rowLayout = new RowLayout();
  rowLayout.marginLeft = 16;
  comboCompo.setLayout(rowLayout);
  gatewaysCombo = new Combo(comboCompo, SWT.DROP_DOWN | SWT.READ_ONLY);
  gatewayInfo = new Label(comboCompo, SWT.NONE);
  gatewayInfo.setEnabled(false);

  /*
   * separator
   */
  new Label(leftColumn, SWT.SEPARATOR | SWT.HORIZONTAL)
      .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

  /*
   * skype
   */
  Composite skypeComposite =
      new IllustratedComposite(leftColumn, SWT.TOP, ImageManager.ELCL_CONTACT_SKYPE_CALL);
  skypeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
  skypeComposite.setLayout(LayoutUtils.createGridLayout(2, false, 0, 5));
  skypeComposite.setBackgroundMode(SWT.INHERIT_NONE);

  Label skypeLabel = new Label(skypeComposite, SWT.WRAP);
  skypeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
  skypeLabel.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_label_skype);

  Composite skypeUsageComposite = new Composite(skypeComposite, SWT.NONE);
  skypeUsageComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
  skypeUsageComposite.setLayout(LayoutUtils.createGridLayout(2, false, 0, 5));

  this.skypeUsageButton = new Button(skypeUsageComposite, SWT.CHECK);
  this.skypeUsageButton.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_yes_use);

  this.skypeUsernameText = new Text(skypeComposite, SWT.BORDER);
  this.skypeUsernameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

  return leftColumn;
}
 
Example 11
Source File: NewReportPageSupport.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the project location specification controls.
 * 
 * @param group
 *            the parent composite
 * @param enabled
 *            the initial enabled state of the widgets created
 */
private void createUserSpecifiedProjectLocationGroup( Composite group,
		boolean enabled )
{
	Font font = group.getFont( );

	// location label
	locationLabel = new Label( group, SWT.NONE );
	locationLabel.setText( LABEL_DIRECTORY );
	locationLabel.setEnabled( enabled );
	locationLabel.setFont( font );

	// file location entry field
	locationPathField = new Text( group, SWT.BORDER );
	GridData data = new GridData( GridData.FILL_HORIZONTAL );
	data.widthHint = 250;
	locationPathField.setLayoutData( data );
	locationPathField.setEnabled( enabled );
	locationPathField.setFont( font );

	// browse button
	browseButton = new Button( group, SWT.PUSH );
	browseButton.setText( LABEL_BROWSE );
	browseButton.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent event )
		{
			handleLocationBrowseButtonPressed( );
		}
	} );

	browseButton.setEnabled( enabled );
	browseButton.setFont( font );
	setButtonLayoutData( browseButton );

	if ( defaultFileLocation != null )
	{
		locationPathField.setText( defaultFileLocation );
	}
	else
	{
		locationPathField.setText( "" );//$NON-NLS-1$
	}
}
 
Example 12
Source File: SortMembersMessageDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Control createMessageArea(Composite parent) {
	initializeDialogUnits(parent);

	Composite messageComposite= new Composite(parent, SWT.NONE);
	messageComposite.setFont(parent.getFont());
	GridLayout layout= new GridLayout();
	layout.numColumns= 1;
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	messageComposite.setLayout(layout);
	messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	createLinkControl(messageComposite);

	fNotSortAllRadio.doFillIntoGrid(messageComposite, 1);
	LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null));

	fSortAllRadio.doFillIntoGrid(messageComposite, 1);
	LayoutUtil.setHorizontalIndent(fSortAllRadio.getSelectionButton(null));

	final Composite warningComposite= new Composite(messageComposite, SWT.NONE);
	layout= new GridLayout();
	layout.numColumns= 2;
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	warningComposite.setLayout(layout);
	warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	warningComposite.setFont(messageComposite.getFont());

	Image image= Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
	final Label imageLabel1= new Label(warningComposite, SWT.LEFT | SWT.WRAP);
	imageLabel1.setImage(image);
	imageLabel1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

	final Label label= new Label(warningComposite, SWT.WRAP);
	label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label);
	GridData gridData= new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
	gridData.widthHint= convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
	label.setLayoutData(gridData);
	label.setFont(warningComposite.getFont());

	fNotSortAllRadio.setDialogFieldListener(new IDialogFieldListener() {
		public void dialogFieldChanged(DialogField field) {
			imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
			label.setEnabled(!fNotSortAllRadio.isSelected());
		}
	});
	imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
	label.setEnabled(!fNotSortAllRadio.isSelected());

	return messageComposite;
}
 
Example 13
Source File: NewDriverWizardPage.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
private Text createBrowseClassControl(final Composite composite,
    final String string, String browseButtonLabel,
    final String baseClassName, final String dialogTitle) {
  Label label = new Label(composite, SWT.NONE);
  GridData data = new GridData(GridData.FILL_HORIZONTAL);
  label.setText(string);
  label.setLayoutData(data);

  final Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
  GridData data2 = new GridData(GridData.FILL_HORIZONTAL);
  data2.horizontalSpan = 2;
  text.setLayoutData(data2);

  Button browse = new Button(composite, SWT.NONE);
  browse.setText(browseButtonLabel);
  GridData data3 = new GridData(GridData.FILL_HORIZONTAL);
  browse.setLayoutData(data3);
  browse.addListener(SWT.Selection, new Listener() {
    public void handleEvent(Event event) {
      IType baseType;
      try {
        baseType = getPackageFragmentRoot().getJavaProject().findType(
            baseClassName);

        // edit this to limit the scope
        SelectionDialog dialog = JavaUI.createTypeDialog(
            composite.getShell(), new ProgressMonitorDialog(composite
                .getShell()), SearchEngine.createHierarchyScope(baseType),
            IJavaElementSearchConstants.CONSIDER_CLASSES, false);

        dialog.setMessage("&Choose a type:");
        dialog.setBlockOnOpen(true);
        dialog.setTitle(dialogTitle);
        dialog.open();

        if ((dialog.getReturnCode() == Window.OK)
            && (dialog.getResult().length > 0)) {
          IType type = (IType) dialog.getResult()[0];
          text.setText(type.getFullyQualifiedName());
        }
      } catch (JavaModelException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  });

  if (!showContainerSelector) {
    label.setEnabled(false);
    text.setEnabled(false);
    browse.setEnabled(false);
  }

  return text;
}
 
Example 14
Source File: PlotClientAreaSheet.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void createClientArea( Group grpAreaWithin )
{
	// WithinAxes area is not supported in 3D
	boolean isNot3D = !ChartUIUtil.is3DType( getChart( ) );
	Label lblShadow = new Label( grpAreaWithin, SWT.NONE );
	{
		GridData gdLBLShadow = new GridData( );
		lblShadow.setLayoutData( gdLBLShadow );
		lblShadow.setText( Messages.getString( "ClientAreaAttributeComposite.Lbl.Shadow" ) ); //$NON-NLS-1$
		lblShadow.setEnabled( isNot3D );
	}

	int fillStyles = FillChooserComposite.ENABLE_TRANSPARENT
			| FillChooserComposite.ENABLE_TRANSPARENT_SLIDER
			| FillChooserComposite.DISABLE_PATTERN_FILL;
	fillStyles |= getContext( ).getUIFactory( ).supportAutoUI( ) ? FillChooserComposite.ENABLE_AUTO
			: fillStyles;
	fccShadow = new FillChooserComposite( grpAreaWithin,
			SWT.NONE,
			fillStyles,
			getContext( ),
			getBlockForProcessing( ).getClientArea( ).getShadowColor( ) );
	{
		GridData gdFCCShadow = new GridData( GridData.FILL_HORIZONTAL );
		fccShadow.setLayoutData( gdFCCShadow );
		fccShadow.addListener( this );
		fccShadow.setEnabled( isNot3D );
	}

	Group grpOutline = new Group( grpAreaWithin, SWT.NONE );
	{
		GridData gdGRPOutline = new GridData( GridData.FILL_HORIZONTAL );
		gdGRPOutline.horizontalSpan = 2;
		gdGRPOutline.verticalSpan = 2;
		grpOutline.setLayoutData( gdGRPOutline );
		grpOutline.setLayout( new FillLayout( ) );
		grpOutline.setText( Messages.getString( "MoreOptionsChartPlotSheet.Label.Outline" ) ); //$NON-NLS-1$
	}

	int lineStyles = LineAttributesComposite.ENABLE_STYLES
			| LineAttributesComposite.ENABLE_WIDTH
			| LineAttributesComposite.ENABLE_COLOR;
	lineStyles |= getContext( ).getUIFactory( ).supportAutoUI( ) ? LineAttributesComposite.ENABLE_AUTO_COLOR
			: lineStyles;
	outlineWithin = new LineAttributesComposite( grpOutline,
			SWT.NONE,
			lineStyles,
			getContext( ),
			getBlockForProcessing( ).getClientArea( ).getOutline( ),
			ChartDefaultValueUtil.getDefaultPlot( getChart( ) )
					.getClientArea( )
					.getOutline( ) );
	{
		outlineWithin.addListener( this );
		outlineWithin.setAttributesEnabled( ChartUIUtil.is3DWallFloorSet( getChart( ) ) );
	}

	icWithin = getContext( ).getUIFactory( )
			.createChartInsetsComposite( grpAreaWithin,
					SWT.NONE,
					2,
					getBlockForProcessing( ).getClientArea( ).getInsets( ),
					getChart( ).getUnits( ),
					getContext( ).getUIServiceProvider( ),
					getContext( ),
					ChartDefaultValueUtil.getDefaultPlot( getChart( ) )
							.getClientArea( )
							.getInsets( ) );
	{
		GridData gdInsets = new GridData( GridData.FILL_HORIZONTAL );
		gdInsets.horizontalSpan = 2;
		icWithin.setLayoutData( gdInsets );
		icWithin.setEnabled( isNot3D );
	}
}
 
Example 15
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
protected void setTextFieldEnabled(Key key, boolean enabled) {
	Text text= getTextControl(key);
	Label label= fLabels.get(text);
	text.setEnabled(enabled);
	label.setEnabled(enabled);
}
 
Example 16
Source File: MapRuleBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private int create2ValueComposite( Composite condition )
{
	if ( expressionValue1 != null && !expressionValue1.isDisposed( ) )
	{
		return 0;
	}
	if ( valueListComposite != null && !valueListComposite.isDisposed( ) )
	{
		valueListComposite.dispose( );
		valueListComposite = null;
	}

	GridData expgd = new GridData( GridData.FILL_HORIZONTAL );
	expgd.widthHint = 120;

	expressionValue1 = createExpressionValue( condition );
	expressionValue1.add( CHOICE_SELECT_VALUE );
	expressionValue1.setLayoutData( expgd );

	dummy1 = createDummy( condition, 3 );

	andLable = new Label( condition, SWT.NONE );
	andLable.setText( Messages.getString( "MapRuleBuilder.text.AND" ) ); //$NON-NLS-1$
	andLable.setEnabled( false );

	dummy2 = createDummy( condition, 3 );

	expressionValue2 = createExpressionValue( condition );
	expressionValue2.add( CHOICE_SELECT_VALUE );
	expressionValue2.setLayoutData( expgd );

	if ( operator.getItemCount( ) > 0
			&& operator.getSelectionIndex( ) == -1 )
	{
		operator.setText( getNameForOperator( DesignChoiceConstants.MAP_OPERATOR_EQ ) );
		operatorChange( );
	}
	condition.getParent( ).layout( true, true );
	if ( getButtonBar( ) != null )
		layout( );
	return 1;
}
 
Example 17
Source File: CustomFiltersDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Overrides method in Dialog
 *
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
 */
@Override
protected Control createDialogArea(Composite parent) {
	initializeDialogUnits(parent);
	// create a composite with standard margins and spacing
	Composite composite= new Composite(parent, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
	layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	composite.setLayout(layout);
	composite.setLayoutData(new GridData(GridData.FILL_BOTH));
	composite.setFont(parent.getFont());
	Composite group= composite;

	// Checkbox
	fEnableUserDefinedPatterns= new Button(group, SWT.CHECK);
	fEnableUserDefinedPatterns.setFocus();
	fEnableUserDefinedPatterns.setText(FilterMessages.CustomFiltersDialog_enableUserDefinedPattern);

	// Pattern	field
	fUserDefinedPatterns= new Text(group, SWT.SINGLE | SWT.BORDER);
	GridData  data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
	data.widthHint= convertWidthInCharsToPixels(59);
	fUserDefinedPatterns.setLayoutData(data);
	String patterns= convertToString(fPatterns, SEPARATOR);
	fUserDefinedPatterns.setText(patterns);
	SWTUtil.setAccessibilityText(fUserDefinedPatterns, FilterMessages.CustomFiltersDialog_name_filter_pattern_description);

	// Info text
	final Label info= new Label(group, SWT.LEFT);
	info.setText(FilterMessages.CustomFiltersDialog_patternInfo);

	// Enabling / disabling of pattern group
	fEnableUserDefinedPatterns.setSelection(fEnablePatterns);
	fUserDefinedPatterns.setEnabled(fEnablePatterns);
	info.setEnabled(fEnablePatterns);
	fEnableUserDefinedPatterns.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			boolean state= fEnableUserDefinedPatterns.getSelection();
			fUserDefinedPatterns.setEnabled(state);
			info.setEnabled(fEnableUserDefinedPatterns.getSelection());
			if (state)
				fUserDefinedPatterns.setFocus();
		}
	});

	// Filters provided by extension point
	if (fBuiltInFilters.length > 0)
		createCheckBoxList(group);

	applyDialogFont(parent);
	return parent;
}
 
Example 18
Source File: HighlightRuleBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private int create2ValueComposite( Composite condition )
{
	if ( expressionValue1 != null && !expressionValue1.isDisposed( ) )
	{
		return 0;
	}
	if ( valueListComposite != null && !valueListComposite.isDisposed( ) )
	{
		valueListComposite.dispose( );
		valueListComposite = null;
	}

	GridData expgd = new GridData( GridData.FILL_HORIZONTAL );
	expgd.widthHint = 120;

	expressionValue1 = createExpressionValue( condition );
	expressionValue1.add( CHOICE_SELECT_VALUE );
	expressionValue1.setLayoutData( expgd );

	dummy1 = createDummy( condition, 3 );

	andLabel = new Label( condition, SWT.NONE );
	andLabel.setText( Messages.getString( "HightlightRuleBuilder.text.AND" ) ); //$NON-NLS-1$
	andLabel.setEnabled( false );

	dummy2 = createDummy( condition, 3 );

	expressionValue2 = createExpressionValue( condition );
	expressionValue2.add( CHOICE_SELECT_VALUE );
	expressionValue2.setLayoutData( expgd );

	if ( operator.getItemCount( ) > 0
			&& operator.getSelectionIndex( ) == -1 )
	{
		operator.setText( getNameForOperator( DesignChoiceConstants.MAP_OPERATOR_EQ ) );
		operatorChange( );
	}
	condition.getParent( ).layout( true, true );
	if ( getButtonBar( ) != null )
		layout( );
	return 1;
}
 
Example 19
Source File: NewDriverWizardPage.java    From RDFS with Apache License 2.0 4 votes vote down vote up
private Text createBrowseClassControl(final Composite composite,
    final String string, String browseButtonLabel,
    final String baseClassName, final String dialogTitle) {
  Label label = new Label(composite, SWT.NONE);
  GridData data = new GridData(GridData.FILL_HORIZONTAL);
  label.setText(string);
  label.setLayoutData(data);

  final Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
  GridData data2 = new GridData(GridData.FILL_HORIZONTAL);
  data2.horizontalSpan = 2;
  text.setLayoutData(data2);

  Button browse = new Button(composite, SWT.NONE);
  browse.setText(browseButtonLabel);
  GridData data3 = new GridData(GridData.FILL_HORIZONTAL);
  browse.setLayoutData(data3);
  browse.addListener(SWT.Selection, new Listener() {
    public void handleEvent(Event event) {
      IType baseType;
      try {
        baseType = getPackageFragmentRoot().getJavaProject().findType(
            baseClassName);

        // edit this to limit the scope
        SelectionDialog dialog = JavaUI.createTypeDialog(
            composite.getShell(), new ProgressMonitorDialog(composite
                .getShell()), SearchEngine.createHierarchyScope(baseType),
            IJavaElementSearchConstants.CONSIDER_CLASSES, false);

        dialog.setMessage("&Choose a type:");
        dialog.setBlockOnOpen(true);
        dialog.setTitle(dialogTitle);
        dialog.open();

        if ((dialog.getReturnCode() == Window.OK)
            && (dialog.getResult().length > 0)) {
          IType type = (IType) dialog.getResult()[0];
          text.setText(type.getFullyQualifiedName());
        }
      } catch (JavaModelException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  });

  if (!showContainerSelector) {
    label.setEnabled(false);
    text.setEnabled(false);
    browse.setEnabled(false);
  }

  return text;
}
 
Example 20
Source File: CrosstabFilterConditionBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private int create2ValueComposite( Composite condition )
{
	if ( expressionValue1 != null && !expressionValue1.isDisposed( ) )
	{
		return 0;
	}

	// if ( valueListComposite != null && !valueListComposite.isDisposed( )
	// )
	// {
	// valueListComposite.dispose( );
	// valueListComposite = null;
	// }

	if ( valueListConList.size( ) > 0 )
	{
		int count = valueListConList.size( );
		for ( int i = 0; i < count; i++ )
		{
			Object obj = valueListConList.get( i );
			if ( obj != null
					&& obj instanceof Widget
					&& ( !( (Widget) obj ).isDisposed( ) ) )
			{
				( (Widget) obj ).dispose( );
			}
		}
	}
	valueListConList.clear( );

	expressionValue1 = createExpressionValue( condition );
	expressionValue1.setLayoutData( GridDataFactory.swtDefaults( )
			.hint( 150, SWT.DEFAULT )
			.create( ) );
	andLable = new Label( condition, SWT.NONE );
	andLable.setText( Messages.getString( "FilterConditionBuilder.text.AND" ) ); //$NON-NLS-1$
	// andLable.setVisible( false );
	andLable.setEnabled( false );
	andLable.setLayoutData( GridDataFactory.swtDefaults( )
			.span( 2, 1 )
			.create( ) );
	// dummy2 = createDummy( condition, 3 );

	expressionValue2 = createExpressionValue( condition );
	expressionValue2.setLayoutData( GridDataFactory.swtDefaults( )
			.hint( 150, SWT.DEFAULT )
			.create( ) );

	if ( operator.getItemCount( ) > 0
			&& operator.getSelectionIndex( ) == -1 )
	{
		operator.select( getIndexForOperatorValue( "eq" ) ); //$NON-NLS-1$
		operatorChange( );
	}

	parentComposite.layout( true, true );

	if ( getButtonBar( ) != null )
		condition.getShell( ).pack( );
	return 1;
}