Java Code Examples for org.eclipse.ui.forms.widgets.Section#setLayoutData()

The following examples show how to use org.eclipse.ui.forms.widgets.Section#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: ApplicationOverviewEditorPart.java    From codewind-eclipse with Eclipse Public License 2.0 7 votes vote down vote up
public ProjectInfoSection(Composite parent, FormToolkit toolkit, int hSpan, int vSpan) {
	Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
       section.setText(Messages.AppOverviewEditorProjectInfoSection);
       section.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true, false, hSpan, vSpan));
       section.setExpanded(true);

       Composite composite = toolkit.createComposite(section);
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       layout.marginHeight = 5;
       layout.marginWidth = 10;
       layout.verticalSpacing = 5;
       layout.horizontalSpacing = 10;
       composite.setLayout(layout);
       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
       toolkit.paintBordersFor(composite);
       section.setClient(composite);
       
       typeEntry = new StringEntry(composite, Messages.AppOverviewEditorTypeEntry);
       languageEntry = new StringEntry(composite, Messages.AppOverviewEditorLanguageEntry);
       projectIdEntry = new StringEntry(composite, Messages.AppOverviewEditorProjectIdEntry);
       locationEntry = new StringEntry(composite, Messages.AppOverviewEditorLocationEntry);
}
 
Example 2
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void createAuthorSection(Composite parent) {
	Section sctnAuthor = createSection(parent, "Author");
	sctnAuthor.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

	Composite composite = formToolkit.createComposite(sctnAuthor, SWT.WRAP);
	formToolkit.paintBordersFor(composite);
	sctnAuthor.setClient(composite);
	composite.setLayout(FormUtils.createSectionClientGridLayout(false, 2));

	createFormFieldLabel(composite, "Name:");

	txtAuthorname = formToolkit.createText(composite, "", SWT.WRAP);
	txtAuthorname.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	createFormFieldLabel(composite, "Email:");

	txtEmail = formToolkit.createText(composite, "", SWT.NONE);
	txtEmail.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	createFormFieldLabel(composite, "URL:");

	txtUrl = formToolkit.createText(composite, "", SWT.NONE);
	txtUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
}
 
Example 3
Source File: PageComponentSwitchBuilder.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public Section createGroupControl(final Composite composite, final Group object) {
    final String desc = getDescription(object.getId());
    int style = Section.NO_TITLE_FOCUS_BOX | Section.TWISTIE | Section.CLIENT_INDENT;
    if (desc != null && !desc.isEmpty()) {
        style = style | Section.DESCRIPTION;
    }
    final Section groupSection = new Section(composite, style);
    groupSection.setText(getLabel(object.getId()));
    groupSection.setFont(BonitaStudioFontRegistry.getBoldFont());
    if (desc != null && !desc.isEmpty()) {
        groupSection.setDescription(desc);
    }
    groupSection.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    groupSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
    return groupSection;
}
 
Example 4
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createConstraintDescriptionSection(Composite parent, DataBindingContext ctx) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.description);

    Composite client = formPage.getToolkit().createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    client.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());

    IObservableValue descriptionObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
            selectedConstraintObservable, BusinessDataModelPackage.Literals.UNIQUE_CONSTRAINT__DESCRIPTION);

    new TextAreaWidget.Builder()
            .widthHint(500)
            .heightHint(70)
            .bindTo(descriptionObservable)
            .inContext(ctx)
            .adapt(formPage.getToolkit())
            .createIn(client);

    section.setClient(client);
}
 
Example 5
Source File: QueryDetailsControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createContentSection() {
    Section section = formPage.getToolkit().createSection(this, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.queryContent);

    Composite client = formPage.getToolkit().createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    client.setLayout(
            GridLayoutFactory.fillDefaults().margins(10, 10).create());

    createLink(client);
    createQueryTextArea(client);
    createParametersComposite(client);
    createReturnTypeComposite(client);

    section.setClient(client);
}
 
Example 6
Source File: XSPEditorUtil.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
static public Section createSection(FormToolkit toolkit, Composite parent, String title, int hSpan, int vSpan) {

    	Section section = toolkit.createSection(parent, Section.SHORT_TITLE_BAR);
        GridData osectionGridData = new GridData(SWT.FILL, SWT.BEGINNING, false, false);
        osectionGridData.horizontalSpan = hSpan;
        osectionGridData.verticalSpan = vSpan;
        osectionGridData.horizontalIndent = 5;
        section.setLayoutData(osectionGridData);
        section.setText(title);
        
        GridLayout osectionGL = new GridLayout(1, true);
        osectionGL.marginHeight = 0;
        osectionGL.marginWidth = 0;
        section.setLayout(osectionGL);
        
        return section;
    }
 
Example 7
Source File: AttributeEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createDetailsSection() {
    Section detailsSection = formPage.getToolkit().createSection(this, Section.EXPANDED);
    detailsSection.setLayout(GridLayoutFactory.fillDefaults().create());
    detailsSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    detailsSection.setText(Messages.details);
    fieldDetailsControl = new FieldDetailsControl(detailsSection, formPage, selectedFieldObservable, ctx);
    detailsSection.setClient(fieldDetailsControl);
    ctx.bindValue(WidgetProperties.visible().observe(detailsSection), new ComputedValueBuilder<Boolean>()
            .withSupplier(() -> selectedFieldObservable.getValue() != null)
            .build());
}
 
Example 8
Source File: ResequencerPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.ResequencerPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example 9
Source File: EnricherPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.EnricherPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example 10
Source File: ContentFilterPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.ContentFilterPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example 11
Source File: TransformerPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.TransformerPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example 12
Source File: CompositeProcessorPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.CompositeProcessorPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example 13
Source File: OutputPage.java    From typescript.java with MIT License 5 votes vote down vote up
private void createJSXSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OutputPage_JSXSection_desc);
	section.setText(TsconfigEditorMessages.OutputPage_JSXSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite body = createBody(section);

	CCombo jsxCombo = createCombo(body, TsconfigEditorMessages.OutputPage_jsx_label,
			new JSONPath("compilerOptions.jsx"), new String[] { "", "preserve", "react" });
	Text reactNamespaceText = createText(body, TsconfigEditorMessages.OutputPage_reactNamespace_label,
			new JSONPath("compilerOptions.reactNamespace"), null, "jsxFactory");
}
 
Example 14
Source File: InvocableEndpointPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.InvocableEndpointPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example 15
Source File: ImportBosArchiveControlSupplier.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createTreeHeader(Composite parent, DataBindingContext ctx) {
    treeSection = new Section(parent, Section.TREE_NODE);
    treeSection.setLayout(GridLayoutFactory.fillDefaults().create());
    treeSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    treeSection.setText(Messages.importDetails);
    treeSection.addExpansionListener(new UpdateLayoutListener(parent));
    treeSection.setExpanded(false);
    descriptionLabel = new Label(treeSection, SWT.WRAP);
    archiveStatusObservable = PojoProperties.value("archiveStatus").observe(this);

    ctx.bindValue(WidgetProperties.text().observe(descriptionLabel), archiveStatusObservable,
            neverUpdateValueStrategy().create(), updateValueStrategy().withValidator(this::archiveStatusValidator)
                    .withConverter(createArchiveStatusConverter()).create());
    treeSection.setDescriptionControl(descriptionLabel);
}
 
Example 16
Source File: ConfigurationFormToolkit.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public Composite createStandardSection ( final Composite parent, final String sectionLabel, final boolean fillVeritcal )
{
    final Section section = this.toolkit.createSection ( parent, sectionLabel != null ? ExpandableComposite.TITLE_BAR : ExpandableComposite.NO_TITLE );
    if ( sectionLabel != null )
    {
        section.setText ( sectionLabel );
    }

    final Composite client = createStandardComposite ( section );
    section.setClient ( client );
    client.setLayout ( new GridLayout ( 3, false ) );
    section.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, true, fillVeritcal ) );

    return client;
}
 
Example 17
Source File: ImportWorkspaceControlSupplier.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Section createStatusSection(Composite parent) {
    final Section section = new Section(parent, Section.TREE_NODE | Section.CLIENT_INDENT);
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setText(Messages.importDetails);
    section.addExpansionListener(new UpdateLayoutListener(parent));
    section.setExpanded(false);
    return section;
}
 
Example 18
Source File: ICESectionPage.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * <p>
 * This operation creates ICEDataComponentSectionParts for each
 * DataComponent in the list of DataComponents and figures out exactly how
 * they should be arranged and span across the page based on their
 * properties.
 * </p>
 *
 */
private void createDataComponentSections() {

	// Get the parent form and the ToolKit to create decorated Sections.
	final ScrolledForm scrolledForm = managedFormRef.getForm();
	final FormToolkit formToolkit = managedFormRef.getToolkit();

	// Each DataComponent will get its own Section. These Sections will be
	// spread horizontally and will take all available horizontal (but not
	// vertical) space offered by the Form.

	// We want each DataComponent Section to be at least 100 pixels wide.
	// Compute the total width used by these Sections.
	int numDataComponents = dataComponents.size();
	int minWidth = numDataComponents * 100;

	// Create a Composite with horizontal GridLayout to contain the
	// Sections. Use the custom Composite with the computed min width so the
	// horizontal scroll bar is not used unless the width is less than the
	// computed min width.
	Composite dataGridComposite = new ScrollClientComposite(
			scrolledForm.getBody(), SWT.NONE, minWidth);
	// Since we cannot use the FormToolKit to create the custom Composite,
	// we must "adapt" the custom Composite.
	formToolkit.adapt(dataGridComposite);
	GridLayout layout = new GridLayout(numDataComponents, true);
	// Remove the margins from the layout.
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	dataGridComposite.setLayout(layout);

	// The DataComponent Sections should only grab what vertical space they
	// need, so set the containing Composite's GridData to only grab and
	// fill excess horizontal space.
	dataGridComposite
			.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

	// Create the DataComponent Sections.
	for (int i = 0; i < numDataComponents; i++) {
		// Create a new Section for the current DataComponent.
		DataComponent dataComponent = dataComponents.get(i);
		Section section = formToolkit.createSection(dataGridComposite,
				ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
						| ExpandableComposite.TWISTIE
						| ExpandableComposite.EXPANDED
						| ExpandableComposite.COMPACT);
		// Each Section should grab all available space it can get within
		// the containing Composite created above this loop.
		section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

		// To populate the Section, use a new ICEDataComponentSectionPart.
		ICEDataComponentSectionPart sectionPart;
		sectionPart = new ICEDataComponentSectionPart(section, editor,
				managedFormRef);
		sectionPart.setDataComponent(dataComponent);
		sectionPart.renderSection();
		// Add the part to the ManagedForm's update lifecycle.
		managedFormRef.addPart(sectionPart);
	}

	return;
}
 
Example 19
Source File: GeneralSectionBuilder.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @wbp.parser.entryPoint
 */
@Override
public void buildUI() {
	Section generalSection = formToolkit.createSection(composite,
			Section.TWISTIE | Section.TITLE_BAR);
	GridData gd_generalSection = new GridData(SWT.FILL, SWT.FILL, true,
			false, 1, 1);
	gd_generalSection.heightHint = 240;
	generalSection.setLayoutData(gd_generalSection);
	formToolkit.paintBordersFor(generalSection);
	generalSection.setText(Messages.BASICATTRIBUTE);
	generalSection.setExpanded(true);

	Composite generalComposite = new Composite(generalSection, SWT.NONE);
	formToolkit.adapt(generalComposite);
	formToolkit.paintBordersFor(generalComposite);
	generalSection.setClient(generalComposite);
	generalComposite.setLayout(new GridLayout(4, false));
	FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()  
               .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);  
       String decorationDescription = Messages.NULLERROR;  
       Image decorationImage = fieldDecoration.getImage(); 

	Label appNameLabel = formToolkit.createLabel(generalComposite,	Messages.APPNAME, SWT.NONE);
	appNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	appNameText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
	appNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,	false, 1, 1));
	appNameDecoration = createTextErrorDecoration(appNameText, decorationDescription, decorationImage);  
	
	Label lblNewLabel_1 = formToolkit.createLabel(generalComposite,	Messages.AUTHERNAME, SWT.NONE);
	lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	authorNameText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
	authorNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	authorNameDecoration = createTextErrorDecoration(authorNameText, decorationDescription, decorationImage);  

	Label lblNewLabel_2 = formToolkit.createLabel(generalComposite,Messages.AUTHEREMAIL, SWT.NONE);
	lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	authorEmailText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
	authorEmailText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	authorEmailDecoration = createTextErrorDecoration(authorEmailText, decorationDescription, decorationImage);  

	Label lblNewLabel_3 = formToolkit.createLabel(generalComposite,Messages.AUTHORIZEDCONNECTION, SWT.NONE);
	lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	authorHrefText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
	authorHrefText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, 	false, 1, 1));
	authorHrefDecoration = createTextErrorDecoration(authorHrefText, decorationDescription, decorationImage);

	Label lblNewLabel_4 = formToolkit.createLabel(generalComposite,Messages.STARTPAGE, SWT.NONE);
	lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
	ContentSrcText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
	ContentSrcText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
	ContentSrcDecoration = createTextErrorDecoration(ContentSrcText, decorationDescription, decorationImage);

	Label lblNewLabel_6 = new Label(generalComposite, SWT.NONE);
	lblNewLabel_6.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	formToolkit.adapt(lblNewLabel_6, true, true);
	lblNewLabel_6.setText("\u63CF\u8FF0");
	descriptionText = new Text(generalComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
	GridData gd_descriptionText = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_descriptionText.heightHint = 49;
	descriptionText.setLayoutData(gd_descriptionText);
	formToolkit.adapt(descriptionText, true, true);
}
 
Example 20
Source File: ApplicationOverviewEditorPart.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public ProjectStatusSection(Composite parent, FormToolkit toolkit, int hSpan, int vSpan) {
	Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
       section.setText(Messages.AppOverviewEditorProjectStatusSection);
       section.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true, false, hSpan, vSpan));
       section.setExpanded(true);
       
       Composite composite = toolkit.createComposite(section);
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       layout.marginHeight = 5;
       layout.marginWidth = 10;
       layout.verticalSpacing = 5;
       layout.horizontalSpacing = 10;
       composite.setLayout(layout);
       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
       toolkit.paintBordersFor(composite);
       section.setClient(composite);
       
       autoBuildEntry = new StringEntry(composite, Messages.AppOverviewEditorAutoBuildEntry);
       injectMetricsEntry = new StringEntry(composite, Messages.AppOverviewEditorInjectMetricsEntry);
       appStatusEntry = new StringEntry(composite, Messages.AppOverviewEditorAppStatusEntry);
       buildStatusEntry = new StringEntry(composite, Messages.AppOverviewEditorBuildStatusEntry);
       lastImageBuildEntry = new StringEntry(composite, Messages.AppOverviewEditorLastImageBuildEntry);
       lastBuildEntry = new StringEntry(composite, Messages.AppOverviewEditorLastBuildEntry);
       
	Label label = new Label(composite, SWT.NONE);
	label.setFont(boldFont);
	label.setText(Messages.AppOverviewEditorProjectLogs);
	label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
	projectLogs = new Link(composite, SWT.NONE);
	projectLogs.setText("");
	projectLogs.setVisible(false);
	GridData data = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false);
	data.horizontalIndent = 2;
	data.exclude = true;
	projectLogs.setLayoutData(data);
	IDEUtil.paintBackgroundToMatch(projectLogs, composite);
	projectLogs.addListener(SWT.Selection, event -> {
		CodewindEclipseApplication app = (CodewindEclipseApplication) getApp(getConn());
		if (app == null) {
			Logger.logError("A log link was selected but could not find the application for the " + connectionId //$NON-NLS-1$
					+ " connection with name: " + projectId); //$NON-NLS-1$
			return;
		}
		Optional<ProjectLogInfo> logInfo = app.getLogInfos().stream().filter(info -> info.logName.equals(event.text)).findFirst();
		if (logInfo.isPresent()) {
			try {
				SocketConsole console = app.getConsole(logInfo.get());
				if (console == null) {
					console = CodewindConsoleFactory.createLogFileConsole(app, logInfo.get());
					app.addConsole(console);
				}
				ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console);
			} catch (Exception e) {
				Logger.logError("An error occurred trying to open the " + logInfo.get().logName //$NON-NLS-1$
						+ "log file for application: " + projectId, e); //$NON-NLS-1$
				MessageDialog.openError(parent.getShell(), Messages.AppOverviewEditorOpenLogErrorTitle,
						NLS.bind(Messages.AppOverviewEditorOpenLogErrorMsg, new String[] {logInfo.get().logName, app.name, e.getMessage()}));
			}
		} else {
			Logger.logError("The " + event.text + " was selected but the associated log info could not be found for the " + projectId + " project."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		}
	});
	noProjectLogs = new Text(composite, SWT.READ_ONLY);
	noProjectLogs.setText(Messages.AppOverviewEditorNoProjectLogs);
	noProjectLogs.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
	noProjectLogs.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false));
	IDEUtil.paintBackgroundToMatch(noProjectLogs, composite);
}