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

The following examples show how to use org.eclipse.swt.SWT#FILL . 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: ValueDesign.java    From ldparteditor with MIT License 6 votes vote down vote up
/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite cmp_Container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) cmp_Container.getLayout();
    gridLayout.verticalSpacing = 10;
    gridLayout.horizontalSpacing = 10;

    BigDecimalSpinner spn_Value = new BigDecimalSpinner(cmp_Container, SWT.NONE);
    this.spn_Value[0] = spn_Value;
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    spn_Value.setLayoutData(gd);


    Label lbl_Unit = new Label(cmp_Container, SWT.NONE);
    this.lbl_Unit[0] = lbl_Unit;
    lbl_Unit.setText(unitText);

    cmp_Container.pack();
    return cmp_Container;
}
 
Example 2
Source File: MergeTermsDialog.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
        Composite container = (Composite) super.createDialogArea(parent);
        GridLayout layout = new GridLayout(2, false);
        layout.marginRight = 5;
        layout.marginLeft = 10;
        container.setLayout(layout);                  
        
        Label termPositionLabel = new Label(container, SWT.NONE);
        GridData termPositionGrid = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
        termPositionGrid.horizontalIndent = 1;
        termPositionLabel.setLayoutData(termPositionGrid);
        termPositionLabel.setText("Merge Terms Into: ");
        this.targetList = new List(container, SWT.SINGLE);
        GridData positionListGrid = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
        positionListGrid.horizontalAlignment = 1;
        this.targetList.setLayoutData(positionListGrid);
        this.selectedTerms.forEach(t -> this.targetList.add(t.getName()));
        
        return container;
}
 
Example 3
Source File: OverrideMethodDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createLinkControl(Composite composite) {
	Link link= new Link(composite, SWT.WRAP);
	link.setText(JavaUIMessages.OverrideMethodDialog_link_message);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.OVERRIDECOMMENT_ID);
		}
	});
	link.setToolTipText(JavaUIMessages.OverrideMethodDialog_link_tooltip);

	GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint= convertWidthInCharsToPixels(40); // only expand further if anyone else requires it
	link.setLayoutData(gridData);
	return link;
}
 
Example 4
Source File: AbstractSaveParticipantPreferenceConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Control createControl(Composite parent, IPreferencePageContainer container) {
	Composite composite= new Composite(parent, SWT.NONE);
	GridData gridData= new GridData(SWT.FILL, SWT.FILL, true, true);
	composite.setLayoutData(gridData);
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	composite.setLayout(layout);

	fEnableField= new SelectionButtonDialogField(SWT.CHECK);
	fEnableField.setLabelText(getPostSaveListenerName());
	fEnableField.doFillIntoGrid(composite, 1);

	createConfigControl(composite, container);

	return composite;
}
 
Example 5
Source File: PropertyEditor.java    From depan with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new {@link PropertyEditor}.
 *
 * @param parent parent Container.
 * @param style SWT style for the container.
 * @param swtTextStyle SWT style for textboxes. Useful to set them
 *        SWT.READ_ONLY for instance.
 */
public PropertyEditor(
    Composite parent, Integer style, Integer swtTextStyle) {
  super(parent, style, swtTextStyle);
  // widgets
  icon = new Label(this, SWT.NONE);
  Label labelName = new Label(this, SWT.NONE);
  path = new Text(this, swtTextStyle);

  // layout
  Layout layout = new GridLayout(3, false);
  this.setLayout(layout);

  GridData iconGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
  iconGridData.minimumHeight = 16;
  iconGridData.minimumWidth = 16;
  icon.setLayoutData(iconGridData);
  labelName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
  path.setLayoutData(
      new GridData(SWT.FILL, SWT.FILL, true, false));

  // content
  icon.setImage(MavenActivator.IMAGE_MAVEN);
  labelName.setText("Path");
}
 
Example 6
Source File: HoverInfoWithSpellingAnnotation.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
private void createAnnotationInformation(Composite parent, final Annotation annotation) {
    Composite composite= new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    GridLayout layout= new GridLayout(2, false);
    layout.marginHeight= 2;
    layout.marginWidth= 2;
    layout.horizontalSpacing= 0;
    composite.setLayout(layout);

    final Canvas canvas= new Canvas(composite, SWT.NO_FOCUS);
    GridData gridData= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    gridData.widthHint= 17;
    gridData.heightHint= 16;
    canvas.setLayoutData(gridData);
    canvas.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
            e.gc.setFont(null);
            fMarkerAnnotationAccess.paint(annotation, e.gc, canvas, new Rectangle(0, 0, 16, 16));
        }
    });

    StyledText text= new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
    GridData data= new GridData(SWT.FILL, SWT.FILL, true, true);
    text.setLayoutData(data);
    text.setText(annotation.getText());
}
 
Example 7
Source File: ExpandableItemsView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
public void createViewer(final Composite parent) {
	if (parent == null) { return; }
	if (viewer == null) {
		viewer = new ParameterExpandBar(parent, SWT.V_SCROLL, areItemsClosable(), areItemsPausable(), false, false,
				this);
		final Object layout = parent.getLayout();
		if (layout instanceof GridLayout) {
			final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
			viewer.setLayoutData(data);
		}
		viewer.computeSize(parent.getSize().x, SWT.DEFAULT);
		viewer.setSpacing(5);
	}
}
 
Example 8
Source File: FindAnnotateDialog.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
protected Control createContents(Composite parent) {

  Composite panel = new Composite(parent, SWT.NULL);
  GridLayout layout= new GridLayout();
  layout.numColumns= 1;
  layout.makeColumnsEqualWidth= true;
  panel.setLayout(layout);

  Composite inputPanel = createInputPanel(panel);
  GridData inputPanelData = new GridData();
  inputPanelData.horizontalAlignment =  SWT.FILL;
  inputPanelData.grabExcessHorizontalSpace = true;
  inputPanelData.verticalAlignment = SWT.TOP;
  inputPanelData.grabExcessVerticalSpace = false;
  inputPanel.setLayoutData(inputPanelData);

  createDirectionGroup(panel);

  createAnnotationButtons(panel);
  
  Composite buttonFindAnnotatePanel = createButtonSection(panel);
  GridData buttonFindAnnotatePanelData = new GridData();
  buttonFindAnnotatePanelData.horizontalAlignment = SWT.RIGHT;
  buttonFindAnnotatePanelData.grabExcessHorizontalSpace = true;
  buttonFindAnnotatePanel.setLayoutData(buttonFindAnnotatePanelData);

  Composite statusAndClosePanel = createStatusAndCloseButton(panel);
  GridData statusAndClosePanelData = new GridData();
  statusAndClosePanelData.horizontalAlignment = SWT.FILL;
  statusAndClosePanelData.grabExcessVerticalSpace = true;
  statusAndClosePanel.setLayoutData(statusAndClosePanelData);

  applyDialogFont(panel);

  return panel;
}
 
Example 9
Source File: SplitXliffWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 创建要分割文件的显示区
 * @param tparent
 */
public void createSplitXlfNameGroup(Composite tparent) {
	final Group xliffDataGroup = new Group(tparent, SWT.NONE);
	GridLayoutFactory.fillDefaults().numColumns(2).margins(8, 8).applyTo(xliffDataGroup);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(xliffDataGroup);
	xliffDataGroup.setText(Messages.getString("wizard.SplitXliffWizardPage.xliffDataGroup"));

	GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false);
	textData.widthHint = 200;

	Label xlfNameLbl = new Label(xliffDataGroup, SWT.RIGHT);
	xlfNameLbl.setText(Messages.getString("wizard.SplitXliffWizardPage.xlfNameLbl"));
	GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(xlfNameLbl);

	xliffNameTxt = new Text(xliffDataGroup, SWT.BORDER);
	xliffNameTxt.setText(splitFile.getFullPath().toOSString());
	GridDataFactory.fillDefaults().grab(true, false).applyTo(xliffNameTxt);
	xliffNameTxt.setEditable(false);

	Label targetFilsPathLbl = new Label(xliffDataGroup, SWT.RIGHT);
	targetFilsPathLbl.setText(Messages.getString("wizard.SplitXliffWizardPage.targetFilsPathLbl"));
	GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(targetFilsPathLbl);

	targetXlfPathTxt = new Text(xliffDataGroup, SWT.BORDER);
	targetXlfPathTxt.setLayoutData(textData);
	targetXlfPathTxt.setText(splitFile.getParent().getFullPath().append(splitFile.getName() + "_split")
			.toOSString());
	targetXlfPathTxt.setEditable(false);

	if ("\\".equals(System.getProperty("file.separator"))) {
		separator = "\\";
	} else {
		separator = "/";
	}

	validXliff();
}
 
Example 10
Source File: ProductSystemWizardPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createProcessTree(Composite composite) {
	processTree = NavigationTree.createViewer(composite);
	processTree.setInput(Navigator.findElement(ModelType.PROCESS));
	processTree.addFilter(new EmptyCategoryFilter());
	processTree.addFilter(new ModelTextFilter(filterText, processTree));
	GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
	gd.heightHint = 200;
	processTree.getTree().setLayoutData(gd);
	processTree.addSelectionChangedListener(this::processSelected);
}
 
Example 11
Source File: CorrosionPreferencePage.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
private void createRustupPart(Composite container) {

		Composite parent = new Composite(container, SWT.NULL);
		parent.setLayout(new GridLayout(4, false));
		parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));

		rustupToolchainLabel = new Label(parent, SWT.NONE);
		rustupToolchainLabel.setText(Messages.CorrosionPreferencePage_toolchain);
		GridData rustupToolchainGridData = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
		rustupToolchainGridData.horizontalIndent = 25;
		rustupToolchainLabel.setLayoutData(rustupToolchainGridData);

		rustupToolchainCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
		rustupToolchainCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		for (String toolchain : RUSTUP_TOOLCHAIN_OPTIONS) {
			rustupToolchainCombo.add(toolchain);
		}
		rustupToolchainCombo.addSelectionListener(widgetSelectedAdapter(e -> {
			setToolchainSelection(rustupToolchainCombo.getSelectionIndex());
			getShell().pack();
			getShell().layout();
			setValid(isPageValid());
		}));
		new Label(parent, SWT.NONE);

		new Label(parent, SWT.NONE);
		otherIdComposite = new Composite(parent, SWT.NULL);
		otherIdComposite.setLayout(new GridLayout(3, false));
		GridData otherIdData = new GridData(SWT.FILL, SWT.CENTER, true, false);
		otherIdData.exclude = false;
		otherIdComposite.setLayoutData(otherIdData);
		otherIdInput = new InputComponent(otherIdComposite, Messages.CorrosionPreferencePage_id,
				e -> setValid(isPageValid()));
		otherIdInput.createComponent();
		new Label(parent, SWT.NONE);
	}
 
Example 12
Source File: SelectRegistredTemplateDialog.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createCustomArea(Composite parent) {
    final Composite container = new Composite(parent, parent.getStyle());
    container.setLayout(new GridLayout(1, false));
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    final TableViewer templatesTreeViewer = new TableViewer(container, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    Table table = templatesTreeViewer.getTable();
    final GridData gdTable = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gdTable.minimumWidth = TABLE_MINIMUM_WIDTH;
    gdTable.minimumHeight = TABLE_MINIMUM_HEIGHT;
    table.setLayoutData(gdTable);
    templatesTreeViewer.setContentProvider(new CollectionContentProvider());
    templatesTreeViewer.setLabelProvider(new ColumnLabelProvider());
    final List<String> registeredTemplates = new ArrayList<>(TemplateRegistry.INSTANCE.getTemplates().keySet());
    Collections.sort(registeredTemplates);
    templatesTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            templateURI = TemplateRegistry.INSTANCE.getTemplates()
                    .get(((IStructuredSelection) event.getSelection()).getFirstElement());
        }
    });
    templatesTreeViewer.setInput(registeredTemplates);

    return container;
}
 
Example 13
Source File: CodeAssistConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected Composite createSubsection(Composite parent, String label) {
	Group group= new Group(parent, SWT.SHADOW_NONE);
	group.setText(label);
	GridData data= new GridData(SWT.FILL, SWT.CENTER, true, false);
	group.setLayoutData(data);
	GridLayout layout= new GridLayout();
	layout.numColumns= 3;
	group.setLayout(layout);

	return group;
}
 
Example 14
Source File: PullUpMemberPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void createStatusLine(final Composite composite) {
	fStatusLine= new Label(composite, SWT.NONE);
	final GridData data= new GridData(SWT.FILL, SWT.CENTER, false, false);
	data.horizontalSpan= 2;
	updateStatusLine();
	fStatusLine.setLayoutData(data);
}
 
Example 15
Source File: BTEditor.java    From jbt with Apache License 2.0 5 votes vote down vote up
/**
 * <code>initialValue</code> may be null.
 */
public ParameterComposite(Composite parent, int style,
		jbt.tools.bteditor.model.ConceptualBTNode.Parameter parameter, String initialValue,
		boolean initialFromContext) {
	super(parent, style);

	this.setLayout(new GridLayout(3, false));
	
	this.parameter = parameter;

	String tooltip = getTooltip(parameter);

	this.nameLabel = new Label(this, SWT.NONE);
	this.nameLabel.setText(this.parameter.getName() + " ("
			+ this.parameter.getType().getReadableType() + ")");
	this.nameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
	this.nameLabel.setToolTipText(tooltip);

	this.valueText = new Text(this, SWT.BORDER);
	this.valueText.setText(initialValue == null ? "" : initialValue);
	GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
	data.widthHint = DEFAULT_TEXT_FIELD_WIDTH;
	this.valueText.setLayoutData(data);
	this.valueText.setToolTipText(tooltip);

	if (this.parameter.getContextable()) {
		this.fromContextButton = new Button(this, SWT.CHECK);
		this.fromContextButton.setText("From context");
		this.fromContextButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
				false));
		this.fromContextButton.setSelection(initialFromContext);
		this.fromContextButton
				.setToolTipText("If activated, the specified value represents the place, in the context, where the value of the variable will be retrieved from");

		if (this.parameter.getType() == ParameterType.OBJECT) {
			this.fromContextButton.setEnabled(false);
			this.fromContextButton.setSelection(true);
		}
	}
}
 
Example 16
Source File: TreeExportDialog.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	var tk = mform.getToolkit();
	var body = UI.formBody(mform.getForm(), tk);

	// file selection
	var comp = tk.createComposite(body);
	UI.gridData(comp, true, false);
	UI.gridLayout(comp, 3, 10, 5);
	var fileText = UI.formText(comp, tk, "Export to file");
	fileText.setEditable(false);
	fileText.setBackground(Colors.white());
	var fileBtn = tk.createButton(comp, M.Browse, SWT.NONE);
	UI.gridData(fileBtn, false, false).horizontalAlignment = SWT.FILL;
	Controls.onSelect(fileBtn, e -> {
		File f = FileChooser.forExport(
				"*.xlsx", "contribution_tree.xlsx");
		if (f != null) {
			file = f;
			fileText.setText(file.getAbsolutePath());
			var ok = getButton(IDialogConstants.OK_ID);
			if (ok != null) {
				ok.setEnabled(true);
			}
		}
	});

	// number of levels
	UI.gridLayout(comp, 3, 10, 5);
	maxDepthText = UI.formText(comp, tk, "Max. number of levels");
	maxDepthText.setText("5");
	var maxDepthBtn = tk.createButton(comp, "Unlimited", SWT.CHECK);

	// minimum contribution
	minContrText = UI.formText(comp, tk, "Min. contribution %");
	minContrText.setText("1e-5");
	var contrBtn = tk.createButton(comp, "Unlimited", SWT.CHECK);
	Controls.onSelect(contrBtn, _e -> {
		minContrText.setEnabled(!minContrText.isEnabled());
	});

	// recursion limit
	maxRecurText = UI.formText(comp, tk, "Max. recursion depth");
	maxRecurText.setText("1");
	maxRecurText.setEnabled(false);
	UI.formLabel(comp, tk, "Repetitions");

	Controls.onSelect(maxDepthBtn, _e -> {
		boolean b = !maxDepthText.isEnabled();
		maxDepthText.setEnabled(b);
		maxRecurText.setEnabled(!b);
	});
}
 
Example 17
Source File: ControlWidgetBuilder.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Configure the {@link GridData} with a <em>SWT.FILL</em> alignment style.
 */
public T fill() {
    this.gridData.horizontalAlignment = SWT.FILL;
    this.gridData.verticalAlignment = SWT.FILL;
    return (T) this;
}
 
Example 18
Source File: SWTOtherEditor.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
 
Example 19
Source File: AbstractResouceWizardPage.java    From depan with Apache License 2.0 2 votes vote down vote up
/**
 * Provide a GridData instance that should expand to fill any available
 * horizontal space.
 */
protected GridData createHorzFillData() {
  return new GridData(SWT.FILL, SWT.FILL, true, false);
}
 
Example 20
Source File: Widgets.java    From depan with Apache License 2.0 2 votes vote down vote up
/**
 * Provide a GridData instance that should expand to fill any available
 * horizontal space.
 */
public static GridData buildHorzFillData() {
  return new GridData(SWT.FILL, SWT.FILL, true, false);
}