Java Code Examples for org.eclipse.swt.custom.CLabel#setLayoutData()

The following examples show how to use org.eclipse.swt.custom.CLabel#setLayoutData() . 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: ApiDocumentationResultView.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public ApiDocumentationResultView() {
	super(SWT.BORDER);
	setBackgroundMode(SWT.INHERIT_FORCE);
	setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	GridLayout gridLayout = new GridLayout(2, false);
	gridLayout.verticalSpacing = 0;
	setLayout(gridLayout);

	lblLabel = new CLabel(this, SWT.NONE);
	lblLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
	lblLabel.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
	lblLabel.setText("<Title of the API documentation>");
	new Label(this, SWT.NONE);

	textUrl = new Text(this, SWT.READ_ONLY | SWT.WRAP);
	textUrl.setEditable(false);
	textUrl.setForeground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
	textUrl.setText("<url>");
	textUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

}
 
Example 2
Source File: DeployRequiredControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public DeployRequiredControl(Composite parent, AbstractBdmFormPage formPage, GridData gridData) {
    super(parent, SWT.NONE);
    setLayout(GridLayoutFactory.fillDefaults().create());
    setLayoutData(gridData);
    formPage.getToolkit().adapt(this);

    Group group = new Group(this, SWT.NONE);
    group.setLayout(GridLayoutFactory.fillDefaults().create());
    group.setLayoutData(GridDataFactory.fillDefaults().create());

    CLabel label = new CLabel(group, SWT.WRAP);
    label.setLayoutData(GridDataFactory.fillDefaults().create());
    label.setText(Messages.bdmDeployRequired);
    label.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));

    boolean show = formPage.getEditorContribution().observeDeployRequired().getValue();
    gridData.exclude = !show;
    setVisible(show);
}
 
Example 3
Source File: SWTFactory.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>CLabel</code> that will wrap at the specified width and has the specified image
 * @param parent the parent to add this label to
 * @param text the text for the label
 * @param image the image for the label
 * @param hspan the h span to take up in the parent
 * @param wrapwidth the with to wrap at
 * @return a new <code>CLabel</code>
 * @since 3.3
 */
public static CLabel createWrapCLabel(Composite parent, String text, Image image, int hspan, int wrapwidth) {
	CLabel label = new CLabel(parent, SWT.NONE | SWT.WRAP);
	label.setFont(parent.getFont());
	if(text != null) {
		label.setText(text);
	}
	if(image != null) {
		label.setImage(image);
	}
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	gd.horizontalSpan = hspan;
	gd.widthHint = wrapwidth;
	label.setLayoutData(gd);
	return label;
}
 
Example 4
Source File: NewVariableEntryDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	initializeDialogUnits(parent);

	Composite composite= (Composite) super.createDialogArea(parent);
	GridLayout layout= (GridLayout) composite.getLayout();
	layout.numColumns= 2;

	fVariablesList.doFillIntoGrid(composite, 3);

	LayoutUtil.setHorizontalSpan(fVariablesList.getLabelControl(null), 2);

	GridData listData= (GridData) fVariablesList.getListControl(null).getLayoutData();
	listData.grabExcessHorizontalSpace= true;
	listData.heightHint= convertHeightInCharsToPixels(10);
	listData.widthHint= convertWidthInCharsToPixels(70);

	fWarning= new CLabel(composite, SWT.NONE);
	fWarning.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, fVariablesList.getNumberOfControls() - 1, 1));

	Composite lowerComposite= new Composite(composite, SWT.NONE);
	lowerComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

	layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	lowerComposite.setLayout(layout);

	fConfigButton.doFillIntoGrid(lowerComposite, 1);

	applyDialogFont(composite);
	return composite;
}
 
Example 5
Source File: GeneratePropertiesPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createMainComp(Composite parent) {
    GridData gridData12 = new GridData();
    gridData12.horizontalSpan = 2;
    GridData gridData11 = new GridData();
    gridData11.horizontalSpan = 2;
    GridLayout gridLayout2 = new GridLayout();
    gridLayout2.numColumns = 2;
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.FILL;
    mainComp = new Composite(parent, SWT.NONE);
    mainComp.setLayoutData(gridData);
    cLabel = new CLabel(mainComp, SWT.NONE);
    cLabel.setText(generatePropertiesSelect);
    cLabel.setLayoutData(gridData11);
    createTreeComp();
    createButtonComp();
    mainComp.setLayout(gridLayout2);

    createComboComp();

    createVisibilityGroup();

    return mainComp;
}
 
Example 6
Source File: OverrideMethodsPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createMainComp(Composite parent) {
    GridData gridData12 = new GridData();
    gridData12.horizontalSpan = 2;
    GridData gridData11 = new GridData();
    gridData11.horizontalSpan = 2;
    GridLayout gridLayout2 = new GridLayout();
    gridLayout2.numColumns = 2;
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.FILL;
    mainComp = new Composite(parent, SWT.NONE);
    mainComp.setLayoutData(gridData);
    cLabel = new CLabel(mainComp, SWT.NONE);
    cLabel.setText(Messages.overrideMethodsSelect);
    cLabel.setLayoutData(gridData11);
    createTreeComp();
    createButtonComp();
    mainComp.setLayout(gridLayout2);

    createComboComp();

    createCommentComp(mainComp);

    return mainComp;
}
 
Example 7
Source File: ChartCubeBindingDialogHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createMessageSection( Composite composite )
{
	messageLine = new CLabel( composite, SWT.NONE );
	GridData layoutData = new GridData( GridData.FILL_HORIZONTAL );
	layoutData.horizontalSpan = 3;
	messageLine.setLayoutData( layoutData );
}
 
Example 8
Source File: ComponentRiskThresholds.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a label
 * @param root
 * @param text
 */
private void createLabel(Composite root, String text) {

    // Label
    CLabel label = new CLabel(root, SWT.CENTER);
    label.setText(text);
    label.setLayoutData(SWTUtil.createFillHorizontallyGridData(true, 2));
    label.setToolTipText(text);
}
 
Example 9
Source File: ProcessActorsPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void createContent(final Composite parent) {
    final TabbedPropertySheetWidgetFactory widgetFactory = getWidgetFactory();
    final Composite mainComposite = widgetFactory.createComposite(parent, SWT.NONE);
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).extendedMargins(0, 20, 5, 15)
            .spacing(5, 2).create());
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 180).create());

    widgetFactory.createCLabel(mainComposite, "", SWT.NONE);
    final CLabel statusControl = widgetFactory.createCLabel(mainComposite, "", SWT.NONE);
    statusControl.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    final Composite buttonsComposite = widgetFactory.createComposite(mainComposite, SWT.NONE);
    buttonsComposite.setLayoutData(GridDataFactory.fillDefaults().create());
    buttonsComposite.setLayout(
            GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).margins(0, 0).spacing(0, 3).create());

    createAddButton(buttonsComposite, widgetFactory);
    initiatorButton = createInitiatorButton(buttonsComposite, widgetFactory);
    removeButton = createRemoveButton(buttonsComposite, widgetFactory);

    createTable(widgetFactory, mainComposite, statusControl);

    widgetFactory.createLabel(mainComposite, "");
    widgetFactory.createLabel(mainComposite, Messages.initiatorExplanation);

    updateButtons();

}
 
Example 10
Source File: VariableBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public Control createContents(Composite parent) {
	Composite composite= new Composite(parent, SWT.NONE);
	composite.setFont(parent.getFont());

	LayoutUtil.doDefaultLayout(composite, new DialogField[] { fVariablesList }, true, 0, 0);
	LayoutUtil.setHorizontalGrabbing(fVariablesList.getListControl(null));

	fWarning= new CLabel(composite, SWT.NONE);
	fWarning.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, fVariablesList.getNumberOfControls() - 1, 1));

	fControl= composite;
	updateDeprecationWarning();

	return composite;
}
 
Example 11
Source File: EditVariableEntryDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	initializeDialogUnits(parent);
	Composite composite= (Composite) super.createDialogArea(parent);

	GridLayout layout= (GridLayout) composite.getLayout();
	layout.numColumns= 3;

	int widthHint= convertWidthInCharsToPixels(50);

	GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	gd.horizontalSpan= 3;

	// archive name field
	fFileNameField.doFillIntoGrid(composite, 4);
	LayoutUtil.setHorizontalSpan(fFileNameField.getLabelControl(null), 3);
	LayoutUtil.setWidthHint(fFileNameField.getTextControl(null), widthHint);
	LayoutUtil.setHorizontalGrabbing(fFileNameField.getTextControl(null));

	// label that shows the resolved path for variable jars
	//DialogField.createEmptySpace(composite, 1);
	fFullPathResolvedLabel= new CLabel(composite, SWT.LEFT);
	fFullPathResolvedLabel.setText(getResolvedLabelString());
	fFullPathResolvedLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	DialogField.createEmptySpace(composite, 2);


	fFileNameField.postSetFocusOnDialogField(parent.getDisplay());

	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.SOURCE_ATTACHMENT_BLOCK);
	applyDialogFont(composite);
	return composite;
}
 
Example 12
Source File: RenameTypeWizardSimilarElementsPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void createSourceViewerLabel(Composite c) {
	fCurrentElementLabel= new CLabel(c, SWT.NONE);
	GridData gd= new GridData(GridData.FILL_HORIZONTAL);
	gd.heightHint= JavaElementImageProvider.SMALL_SIZE.x;
	fCurrentElementLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsPage_select_element_to_view_source);
	fCurrentElementLabel.setLayoutData(gd);
}
 
Example 13
Source File: ConnectionStateComposite.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
public ConnectionStateComposite(Composite parent, int style) {
  super(parent, style);

  SarosPluginContext.initComponent(this);

  setLayout(LayoutUtils.createGridLayout(1, false, 10, 3, 0, 0));
  stateLabel = new CLabel(this, SWT.NONE);
  stateLabel.setLayoutData(LayoutUtils.createFillHGrabGridData());
  FontUtils.makeBold(stateLabel);

  stateLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_WHITE));

  stateLabel.setBackground(getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));

  setBackground(getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));

  connectionHandler.addConnectionStateListener(connectionListener);

  accountStore.addListener(accountStoreListener);

  updateLabel(connectionHandler.getConnectionState(), connectionHandler.getConnectionError());

  addDisposeListener(
      new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
          connectionHandler.removeConnectionStateListener(connectionListener);
          accountStore.removeListener(accountStoreListener);
        }
      });
}
 
Example 14
Source File: EncodingLabel.java    From eclipse-encoding-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public EncodingLabel(ActiveDocumentAgent agent, Composite statusBar, int widthHint) {
	this.agent = agent;
	label = new CLabel(statusBar, SWT.LEFT);
	GridData gridData = new GridData();
	gridData.widthHint = widthHint;
	label.setLayoutData(gridData);
}
 
Example 15
Source File: ContractConstraintExpressionWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    final EMFDataBindingContext context = new EMFDataBindingContext();
    final Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());

    final Composite editorContainer = new Composite(container, SWT.NONE);
    editorContainer.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    editorContainer.setLayout(new FillLayout());
    final GroovyViewer viewer = createSourceViewer(editorContainer);

    getSourceViewer().getTextWidget().setData(ContractInputCompletionProposalComputer.INPUTS, inputs);
    getSourceViewer().getDocument().addDocumentListener(this);

    expressionContentObservable = EMFObservables.observeValue(constraint,
            ProcessPackage.Literals.CONTRACT_CONSTRAINT__EXPRESSION);

    final IObservableList inputsObservable = EMFObservables.observeList(constraint,
            ProcessPackage.Literals.CONTRACT_CONSTRAINT__INPUT_NAMES);
    inputIndexer = new ConstraintInputIndexer(constraint, inputs, viewer.getGroovyCompilationUnit());
    getSourceViewer().getDocument().set(expressionContentObservable.getValue().toString());
    context.addValidationStatusProvider(
            new ConstraintExpressionEditorValidator(expressionContentObservable, inputsObservable));

    final CLabel contentAssistHint = new CLabel(container, SWT.NONE);
    contentAssistHint.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).create());
    contentAssistHint.setText(Messages.contentAssistHint);
    contentAssistHint.setImage(Pics.getImage(PicsConstants.hint));

    setControl(container);
    WizardPageSupport.create(this, context);

}
 
Example 16
Source File: MigrationWarningWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void createControl(Composite parent) {
    final Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(10, 5, 0, 0).create());
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    
    final Label textArea = new Label(mainComposite,  SWT.WRAP );
    textArea.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).hint(600, SWT.DEFAULT).create());
    textArea.setText(Messages.bind(Messages.importWarningMessageContent, new Object[]{bosProductName}));
    
    final Composite captionComposite = new Composite(mainComposite,SWT.NONE);
    captionComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(10,15).create());
    captionComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    
    final CLabel noActionRequiredLabel = new CLabel(captionComposite,SWT.WRAP);
    noActionRequiredLabel.setText(Messages.noActionRequiredHelp);
    noActionRequiredLabel.setImage(Pics.getImage("valid.png",MigrationPlugin.getDefault()));
    noActionRequiredLabel.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create());
    
    final CLabel reviewRequiredLabel = new CLabel(captionComposite,SWT.WRAP);
    reviewRequiredLabel.setText(Messages.reviewRequiredHelp);
    reviewRequiredLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK));
    reviewRequiredLabel.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create());
    
    final CLabel actionRequiredLabel = new CLabel(captionComposite,SWT.WRAP);
    actionRequiredLabel.setText(Messages.actionRequiredHelp);
    actionRequiredLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
    actionRequiredLabel.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create());
    
    final Label textArea2 = new Label(mainComposite,  SWT.WRAP );
    textArea2.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).hint(600, SWT.DEFAULT).create());
    textArea2.setText(Messages.importWarningMessageContentAfterPart);
    final Composite buttonComposite = new Composite(mainComposite,SWT.NONE);
    buttonComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());
    buttonComposite.setLayoutData(GridDataFactory.swtDefaults().grab(true, true).create());
    final Button displayCheckbox = new Button(buttonComposite, SWT.CHECK);
    displayCheckbox.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).indent(0, 10).align(SWT.BEGINNING, SWT.BOTTOM).create());
    displayCheckbox.setText(Messages.doNotDisplayAtNextImport);
    displayCheckbox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
        	MigrationPlugin.getDefault().getPreferenceStore().setValue(BarImporterPreferenceConstants.DISPLAY_MIGRATION_WARNING, !displayCheckbox.getSelection());
        }
    });
    displayCheckbox.setSelection(!MigrationPlugin.getDefault().getPreferenceStore().getBoolean(BarImporterPreferenceConstants.DISPLAY_MIGRATION_WARNING));

    setControl(mainComposite);
}
 
Example 17
Source File: PickWorkspaceDialog.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
	setTitle("Choose a Workspace to store your models, settings, etc.");
	setMessage(strMsg);

	try {
		final Composite inner = new Composite(parent, SWT.NONE);
		final GridLayout l = new GridLayout(4, false);
		// double[][] layout =
		// new double[][] {
		// { 5, LatticeConstants.PREFERRED, 5, 250, 5,
		// LatticeConstants.PREFERRED, 5 },
		// { 5, LatticeConstants.PREFERRED, 5, LatticeConstants.PREFERRED,
		// 40 } };
		inner.setLayout(l);
		inner.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true));

		/* Label on the left */
		final CLabel label = new CLabel(inner, SWT.NONE);
		label.setText("GAMA Workspace");
		label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));

		/* Combo in the middle */
		workspacePathCombo = new Combo(inner, SWT.BORDER);
		final GridData data = new GridData(SWT.LEFT, SWT.CENTER, true, false);
		data.widthHint = 200;
		workspacePathCombo.setLayoutData(data);
		final String wsRoot = WorkspacePreferences.getLastSetWorkspaceDirectory();
		workspacePathCombo.setText(wsRoot);

		/* Checkbox below */
		rememberWorkspaceButton = new Button(inner, SWT.CHECK);
		rememberWorkspaceButton.setText("Remember");
		rememberWorkspaceButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
		rememberWorkspaceButton.setSelection(WorkspacePreferences.isRememberWorkspace());

		final String lastUsed = WorkspacePreferences.getLastUsedWorkspaces();
		lastUsedWorkspaces = new ArrayList<>();
		if ( lastUsed != null ) {
			final String[] all = lastUsed.split(splitChar);
			for ( final String str : all ) {
				lastUsedWorkspaces.add(str);
			}
		}
		for ( final String last : lastUsedWorkspaces ) {
			workspacePathCombo.add(last);
		}

		/* Browse button on the right */
		final Button browse = new Button(inner, SWT.PUSH);
		browse.setText("Browse...");
		browse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
		browse.addListener(SWT.Selection, event -> {
			final DirectoryDialog dd = new DirectoryDialog(getParentShell());
			dd.setText("Select Workspace Root");
			dd.setMessage(strInfo);
			dd.setFilterPath(workspacePathCombo.getText());
			final String pick = dd.open();
			if ( pick == null ) {
				if ( workspacePathCombo.getText().length() == 0 ) {
					setMessage(strError, IMessageProvider.ERROR);
				}
			} else {
				setMessage(strMsg);
				workspacePathCombo.setText(pick);
			}
		});
		return inner;
	} catch (final RuntimeException err) {
		err.printStackTrace();
		return null;
	}
}
 
Example 18
Source File: ResultSetPreviewPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Control createPageControl( Composite parent )
{
	Composite resultSetComposite = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.verticalSpacing = 15;
	resultSetComposite.setLayout( layout );
	resultSetComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	resultSetTable = new Table( resultSetComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL | SWT.BORDER );
	resultSetTable.setHeaderVisible( true );
	resultSetTable.setLinesVisible( true );
	resultSetTable.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	( (DataSetHandle) getContainer( ).getModel( ) ).addListener( this );

	resultSetTable.addMouseListener( new MouseAdapter( ) {

		public void mouseUp( MouseEvent e )
		{
			// if not mouse left button
			if ( e.button != 1 )
			{
				MenuManager menuManager = new MenuManager( );

				ResultSetTableAction copyAction = ResultSetTableActionFactory.createResultSetTableAction( resultSetTable,
						ResultSetTableActionFactory.COPY_ACTION );
				ResultSetTableAction selectAllAction = ResultSetTableActionFactory.createResultSetTableAction( resultSetTable,
						ResultSetTableActionFactory.SELECTALL_ACTION );
				menuManager.add( copyAction );
				menuManager.add( selectAllAction );

				menuManager.update( );

				copyAction.update( );
				selectAllAction.update( );

				Menu contextMenu = menuManager.createContextMenu( resultSetTable );

				contextMenu.setEnabled( true );
				contextMenu.setVisible( true );
			}
		}
	} );

	createResultSetTableViewer( );
	promptLabel = new CLabel( resultSetComposite, SWT.WRAP );
	GridData labelData = new GridData( GridData.FILL_HORIZONTAL );
	promptLabel.setLayoutData( labelData );
	
	return resultSetComposite;
}
 
Example 19
Source File: CascadingParametersDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	// Composite composite = (Composite) super.createDialogArea( parent );

	ScrolledComposite sc = new ScrolledComposite( (Composite) super.createDialogArea( parent ),
			SWT.H_SCROLL | SWT.V_SCROLL );
	sc.setLayout( new FillLayout( ) );
	sc.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	applyDialogFont( sc );

	mainContent = new Composite( sc, 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 );
	mainContent.setLayout( layout );

	UIUtil.bindHelp( parent, IHelpContextIds.CASCADING_PARAMETER_DIALOG_ID );

	GridData data = new GridData( GridData.FILL_BOTH );

	maxStrLengthProperty = getMaxStrLength( PROPERTY_LABEL_STRING,
			mainContent );

	maxStrLengthOption = getMaxStrLength( OPTION_LABEL_STRING, mainContent );

	mainContent.setLayoutData( data );

	createGeneralPart( mainContent );

	createChoicePart( mainContent );

	createDynamicParamsPart( mainContent );

	createPropertiesPart( mainContent );

	createSortingArea( mainContent );

	createOptionsPart( mainContent );

	createLabel( mainContent, null );
	errorMessageLine = new CLabel( mainContent, SWT.NONE );
	GridData msgLineGridData = new GridData( GridData.FILL_HORIZONTAL );
	msgLineGridData.horizontalSpan = 2;
	errorMessageLine.setLayoutData( msgLineGridData );

	sc.setContent( mainContent );
	sc.setExpandHorizontal( true );
	// sc.setExpandVertical( true );
	sc.setMinWidth( 500 );
	// sc.setMinHeight( 570 );

	Point size = mainContent.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	mainContent.setSize( size );

	return sc;
}
 
Example 20
Source File: ComponentRiskMonitor.java    From arx with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new instance
 * @param parent
 * @param controller
 * @param text
 * @param shortText
 */
public ComponentRiskMonitor(final Composite parent, 
                            final Controller controller,
                            final String text, 
                            final String shortText) {
    
    // Images
    imageLow = controller.getResources().getManagedImage("bullet_green.png"); //$NON-NLS-1$
    imageHigh = controller.getResources().getManagedImage("bullet_red.png"); //$NON-NLS-1$
    
    // Layout
    GridLayout layout = SWTUtil.createGridLayout(1);
    layout.marginHeight = 0;
    layout.marginTop = 0;
    layout.marginBottom = 0;
    layout.verticalSpacing = 0;
    
    // Root
    this.root = new Composite(parent, SWT.NONE);
    this.root.setLayout(layout);
    this.root.setToolTipText(text);
    
    // Caption
    this.caption = new CLabel(root, SWT.CENTER);
    this.caption.setText(shortText);
    this.caption.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    this.caption.setToolTipText(text);
    this.caption.setImage(imageHigh);
    SWTUtil.changeFont(caption, SWT.BOLD);
    
    // Content
    Composite content = new Composite(root, SWT.NONE);
    content.setLayoutData(SWTUtil.createFillGridData());
    content.setToolTipText(text);

    // Create meter
    Canvas canvas = new Canvas(content, SWT.DOUBLE_BUFFERED);
    canvas.setToolTipText(text);
    this.meter = new ComponentMeterFigure();
    this.meter.setNeedleColor(XYGraphMediaFactory.getInstance().getColor(0, 0, 0));
    this.meter.setValueLabelVisibility(true);
    this.meter.setRange(new Range(0, 100));
    this.meter.setLoLevel(0);
    this.meter.setLoColor(XYGraphMediaFactory.getInstance().getColor(0, 150, 0));
    this.meter.setLoloLevel(25);
    this.meter.setLoloColor(XYGraphMediaFactory.getInstance().getColor(255, 255, 0));
    this.meter.setHiLevel(50);
    this.meter.setHiColor(XYGraphMediaFactory.getInstance().getColor(255, 200, 25));
    this.meter.setHihiLevel(100);
    this.meter.setHihiColor(XYGraphMediaFactory.getInstance().getColor(255, 0, 0));
    this.meter.setMajorTickMarkStepHint(50);
    LightweightSystem lws = new LightweightSystem(canvas);
    lws.setContents(this.meter);
    
    // Create label
    label = new CLabel(content, SWT.CENTER);
    label.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    label.setToolTipText(text);
    
    // Create responsive layout
    new ComponentResponsiveLayout(content, 100, 50, canvas, label);
}