org.eclipse.jface.layout.GridLayoutFactory Java Examples

The following examples show how to use org.eclipse.jface.layout.GridLayoutFactory. 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: OpenApi3ValidationPreferences.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void createFieldEditors() {
    Composite parent = new Composite(getFieldEditorParent(), SWT.NONE);

    GridLayoutFactory.fillDefaults() //
            .numColumns(2) //
            .margins(5, 8) //
            .spacing(5, 20) //
            .applyTo(parent);

    // Should wrap the fields in a composite to allow use of spacing.
    {
        Composite composite = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults().span(2, 1).applyTo(composite);
        addField(new BooleanFieldEditor(ADVANCED_VALIDATION, "Enable advanced validation", composite));
    }

    Set<PreferenceProvider> providers = ExtensionUtils.getPreferenceProviders(VALIDATION_PREFERENCE_PAGE);
    providers.forEach(provider -> {
        for (FieldEditor field : provider.createFields(Version.OPENAPI, parent)) {
            addField(field);
        }
    });
}
 
Example #2
Source File: N4JSNewProjectWizardCreationPage.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private void createVendorIdControls(DataBindingContext dbc, Composite parent) {
	final Composite composite = new Composite(parent, SWT.NULL);
	composite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create());
	composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	final Label vendorIdLabel = new Label(composite, SWT.NONE);
	vendorIdLabel.setText("Vendor id:");

	Text vendorIdText = new Text(composite, SWT.BORDER);
	vendorIdText.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create());

	projectInfo.addPropertyChangeListener(event -> {
		if (event.getPropertyName().equals(N4JSProjectInfo.VENDOR_ID_PROP_NAME)) {
			setPageComplete(validatePage());
		}
	});

	dbc.bindValue(WidgetProperties.text(Modify).observe(vendorIdText),
			BeanProperties.value(N4JSProjectInfo.class, N4JSProjectInfo.VENDOR_ID_PROP_NAME).observe(projectInfo));

}
 
Example #3
Source File: SnippetCompositeTableDataBinding.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);

	Label lbName = new Label(composite, SWT.NONE);
	lbName.setText("Name :");

	txName = new Text(composite, SWT.BORDER);

	Label lbFirstname = new Label(composite, SWT.NONE);
	lbFirstname.setText("Firstname :");

	txFirstname = new Text(composite, SWT.BORDER);

	GridLayoutFactory.fillDefaults().generateLayout(composite);

	// binding
	Binding b = dbc.bindValue(SWTObservables.observeText(txFirstname, SWT.FocusOut), PojoObservables.observeValue(hero, "firstname"), null, null);
	b = dbc.bindValue(SWTObservables.observeText(txName, SWT.FocusOut), PojoObservables.observeValue(hero, "name"), null, null);
	return composite;
}
 
Example #4
Source File: AbapGitStagingView.java    From ADT_Frontend with MIT License 6 votes vote down vote up
/**
 * Adds a filter text box in the view toolbar
 */
private ControlContribution createObjectsFilterText() {
	//create filter text composite
	ControlContribution filterTextboxContribution = new ControlContribution("AbapGitStagingView.filterText") { //$NON-NLS-1$
		protected Control createControl(Composite parent) {
			Composite filterComposite = AbapGitStagingView.this.toolkit.createComposite(parent, 0);
			GridLayoutFactory.fillDefaults().numColumns(2).applyTo(filterComposite);
			filterComposite.setBackground(null);

			AbapGitStagingView.this.filterText = new Text(filterComposite, SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH);
			AbapGitStagingView.this.filterText.setMessage(Messages.AbapGitStaging_object_filter_text);
			GridData data = new GridData(SWT.LEFT, SWT.TOP, true, false);
			data.minimumWidth = 150;
			AbapGitStagingView.this.filterText.setLayoutData(data);

			AbapGitStagingView.this.filterText.addModifyListener(e -> applyFilter());
			return filterComposite;
		}
	};
	return filterTextboxContribution;
}
 
Example #5
Source File: AbapGitStagingView.java    From ADT_Frontend with MIT License 6 votes vote down vote up
private void createCommitMessageComposite(Composite parent) {
	Composite commitMessageComposite = this.toolkit.createComposite(parent);
	this.toolkit.paintBordersFor(commitMessageComposite);
	GridLayoutFactory.fillDefaults().numColumns(1).applyTo(commitMessageComposite);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(commitMessageComposite);

	this.commitMessageTextViewer = new TextViewer(commitMessageComposite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	this.commitMessageTextViewer.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(this.commitMessageTextViewer.getTextWidget());
	this.commitMessageTextViewer.getTextWidget().setAlwaysShowScrollBars(false);
	this.commitMessageTextViewer.getTextWidget().setFont(JFaceResources.getTextFont());
	SWTUtil.addTextEditMenu(this.commitMessageTextViewer.getTextWidget());
	//draw a line to hint the max commit line length
	createMarginPainter(this.commitMessageTextViewer);

	this.commitMessageTextViewer.getTextWidget().addModifyListener(e -> validateInputs());
}
 
Example #6
Source File: AbapGitStagingView.java    From ADT_Frontend with MIT License 6 votes vote down vote up
private void createStagedComposite(Composite parent) {
	this.stagedSection = this.toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);
	this.stagedSection.setText(Messages.AbapGitStaging_staged_changes_section_header + " (0)"); //$NON-NLS-1$
	this.stagedSection.clientVerticalSpacing = 0;

	//staged section toolbar
	this.createStagedSectionToolbar();

	Composite stagedComposite = this.toolkit.createComposite(this.stagedSection);
	this.toolkit.paintBordersFor(stagedComposite);
	GridLayoutFactory.fillDefaults().applyTo(stagedComposite);
	this.stagedSection.setClient(stagedComposite);

	//create the treeviewer
	this.stagedTreeViewer = this.createTreeViewer(stagedComposite, false);
	this.stagedTreeViewer.setInput(this.stagedTreeViewerInput);
	addDragAndDropSupport(this.stagedTreeViewer, false);

	//add context menu support to the tree viewer
	this.stagedMenuFactory = new AbapGitStagingObjectMenuFactory(this.stagedTreeViewer, false, this, this.stagingUtil);
}
 
Example #7
Source File: AbapGitStagingView.java    From ADT_Frontend with MIT License 6 votes vote down vote up
private void createUnstagedComposite(Composite parent) {
	this.unstagedSection = this.toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);
	this.unstagedSection.setText(Messages.AbapGitStaging_unstaged_changes_section_header + " (0)"); //$NON-NLS-1$
	this.unstagedSection.clientVerticalSpacing = 0;

	//unstaged section toolbar
	this.createUnstagedSectionToolbar();

	Composite unstagedComposite = this.toolkit.createComposite(this.unstagedSection);
	this.toolkit.paintBordersFor(unstagedComposite);
	GridLayoutFactory.fillDefaults().applyTo(unstagedComposite);
	this.unstagedSection.setClient(unstagedComposite);

	//create the treeviewer
	this.unstagedTreeViewer = this.createTreeViewer(unstagedComposite, true);
	this.unstagedTreeViewer.setInput(this.unstagedTreeViewerInput);
	addDragAndDropSupport(this.unstagedTreeViewer, true);

	//add context menu support to the tree viewer
	this.unstagedMenuFactory = new AbapGitStagingObjectMenuFactory(this.unstagedTreeViewer, true, this, this.stagingUtil);
}
 
Example #8
Source File: N4JSNewProjectWizardCreationPage.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private Composite initTestProjectUI(DataBindingContext dbc, Composite parent) {
	// Additional test project options
	final Group testProjectOptionsGroup = new Group(parent, NONE);
	testProjectOptionsGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());

	final Button createTestGreeterFileButton = new Button(testProjectOptionsGroup, CHECK);
	createTestGreeterFileButton.setText("Create a test project greeter file");

	final Button addNormalSourceFolderButton = new Button(testProjectOptionsGroup, CHECK);
	addNormalSourceFolderButton.setText("Also create a non-test source folder");

	Label nextPageHint = new Label(testProjectOptionsGroup, NONE);
	nextPageHint.setText("The projects which should be tested can be selected on the next page");
	nextPageHint.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

	initTestProjectBinding(dbc, addNormalSourceFolderButton, createTestGreeterFileButton);

	return testProjectOptionsGroup;
}
 
Example #9
Source File: PreviewableWizardPage.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
	paneComposite = new Composite(parent, SWT.NONE);
	paneComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).create());

	super.createControl(paneComposite);
	workspaceWizardControl.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

	createPreview(paneComposite);
	createBottomControls(paneComposite);

	setControl(paneComposite);

	boolean hidePreviewSetting = getDialogSettings().getBoolean(DIALOG_SETTING_HIDE_PREVIEW_KEY);

	if (hidePreviewSetting) {
		hideContentPreview();
	} else {
		// Otherwise just make sure the shell size is set
		getShell().setMinimumSize(PREVIEW_MINIMUM_SHELL_SIZE);
	}
}
 
Example #10
Source File: InstallNpmDependencyDialog.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private void createNameArea(Composite parent, String areaName, Consumer<String> textHandler) {
	final Group area = new Group(parent, SHADOW_ETCHED_IN);
	area.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
	area.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	area.setText(areaName);

	final Text txtPackageName = getSimpleTextArea(area);
	txtPackageName.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			Text textWidget = (Text) e.getSource();
			textHandler.accept(textWidget.getText());
		}
	});
}
 
Example #11
Source File: ColumnViewerBuilder.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Builds the new column viewer instance.
 *
 * @param parent
 *            the parent composite for the viewer.
 * @return the new new column viewer.
 */
public final CV build(final Composite parent) {

	final Composite container = new Composite(parent, NONE);
	container.setLayout(GridLayoutFactory.fillDefaults().create());
	container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(FILL, FILL).create());

	final Composite composite = new Composite(container, NONE);
	composite.setLayout(GridLayoutFactory.fillDefaults().create());
	composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(FILL, FILL).create());

	final AbstractColumnLayout layout = createColumnLayout();
	composite.setLayout(layout);

	final CV viewer = createViewer(composite, layout, NONE | V_SCROLL | H_SCROLL | getStyle());

	viewer.setContentProvider(contentProvider);
	viewer.setLabelProvider(labelProvider);
	viewer.setUseHashlookup(useHashlookup);

	return viewer;
}
 
Example #12
Source File: BinariesPreferencePage.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createContents(final Composite parent) {

	Composite body = new Composite(parent, NONE);
	body.setLayout(GridLayoutFactory.fillDefaults().create());
	body.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(FILL, FILL).create());

	final Iterable<Binary> binaries = binariesProvider.getRegisteredBinaries();

	for (final Binary binary : binaries) {
		final Group binaryGroup = new Group(body, SWT.SHADOW_ETCHED_IN);
		binaryGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(true).create());
		binaryGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(FILL, TOP).create());
		recursiveAddBinaryGroup(binaryGroup, binary);
	}

	refreshErrorMessage();

	return body;
}
 
Example #13
Source File: N4StatusAreaProvider.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public Control createSupportArea(final Composite parent, final StatusAdapter statusAdapter) {

	final IStatus status = statusAdapter.getStatus();

	if (status instanceof BinaryStatus) {
		final Binary binary = ((BinaryStatus) status).getBinary();
		final Composite control = new Composite(parent, SWT.NONE);
		control.setLayout(GridLayoutFactory.swtDefaults().margins(10, 10).create());
		control.setLayoutData(new GridData(FILL, FILL, true, true));
		return createCustomAreaWithLink(control, manager.getDialog(), binary);
	}

	return new DefaultDetailsArea(manager.getDialogState()).createSupportArea(parent, statusAdapter);
}
 
Example #14
Source File: FlexDeployPreferencesDialog.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
  Composite area = (Composite) super.createDialogArea(parent);

  Composite container = new Composite(area, SWT.NONE);
  Link flexPricing = new Link(container, SWT.WRAP);
  flexPricing.setText(Messages.getString("deploy.preferences.dialog.flex.pricing")); //$NON-NLS-1$
  flexPricing.addSelectionListener(
      new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
  FontUtil.convertFontToItalic(flexPricing);

  GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
  Point margins = LayoutConstants.getMargins();
  GridLayoutFactory.fillDefaults()
      .extendedMargins(margins.x, margins.x, 0 /* no upper margin */, margins.y)
      .generateLayout(container);

  return area;
}
 
Example #15
Source File: FlexDeployPreferencesPanel.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method to create a row of a {@link Label}, a {@link Text} for a file path input, and
 * a "browse" {@link Button} to open a {@link FileDialog}.
 *
 * @param fileFieldBasePath a base path that file input fields will treat as a prefix. The path is
 * for 1) relativizing absolute paths in file input fields; and 2) setting the default path for
 * the file chooser dialog.
 */
protected Text createBrowseFileRow(String labelText, String Tooltip,
    IPath fileFieldBasePath, String[] fileDialogfilterExtensions) {
  Label label = new Label(this, SWT.LEAD);
  label.setText(labelText);
  label.setToolTipText(Tooltip);

  Composite secondColumn = new Composite(this, SWT.NONE);
  Text fileField = new Text(secondColumn, SWT.SINGLE | SWT.BORDER);
  fileField.setToolTipText(Tooltip);

  Button browse = new Button(secondColumn, SWT.PUSH);
  browse.setText(Messages.getString("deploy.preferences.dialog.browse"));
  browse.addSelectionListener(
      new RelativeFileFieldSetter(fileField, fileFieldBasePath, fileDialogfilterExtensions));

  GridDataFactory.fillDefaults().applyTo(secondColumn);
  GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fileField);
  GridLayoutFactory.fillDefaults().numColumns(2).generateLayout(secondColumn);
  return fileField;
}
 
Example #16
Source File: DeployPreferencesDialog.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
  Composite area = (Composite) super.createDialogArea(parent);

  Composite container = new Composite(area, SWT.NONE);
  content = createDeployPreferencesPanel(container, project, loginService,
      this::handleLayoutChange, new ProjectRepository(googleApiFactory));
  GridDataFactory.fillDefaults().grab(true, false).applyTo(content);

  // we pull in Dialog's content margins which are zeroed out by TitleAreaDialog
  GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
  GridLayoutFactory.fillDefaults()
      .margins(LayoutConstants.getMargins().x, LayoutConstants.getMargins().y)
      .generateLayout(container);

  TitleAreaDialogSupport.create(this, content.getDataBindingContext())
      .setValidationMessageProvider(new ValidationMessageProvider() {
        @Override
        public int getMessageType(ValidationStatusProvider statusProvider) {
          int type = super.getMessageType(statusProvider);
          setValid(type != IMessageProvider.ERROR);
          return type;
        }
      });
  return area;
}
 
Example #17
Source File: AppEngineDeployPreferencesPanel.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
private Composite createBucketSection(Composite parent) {
  Composite bucketComposite = new Composite(parent, SWT.NONE);

  Label bucketLabel = new Label(bucketComposite, SWT.LEAD);
  bucketLabel.setText(Messages.getString("custom.bucket"));
  bucketLabel.setToolTipText(Messages.getString("tooltip.staging.bucket"));

  bucket = new Text(bucketComposite, SWT.LEAD | SWT.SINGLE | SWT.BORDER);
  bucket.setMessage(Messages.getString("custom.bucket.hint"));
  GridData bucketData = new GridData(SWT.FILL, SWT.CENTER, true, false);
  bucket.setLayoutData(bucketData);

  bucket.setToolTipText(Messages.getString("tooltip.staging.bucket"));

  GridLayoutFactory.fillDefaults().numColumns(2).generateLayout(bucketComposite);
  return bucketComposite;
}
 
Example #18
Source File: MavenCoordinatesUi.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
public MavenCoordinatesUi(Composite container, int style) {
  super(container, style);

  groupIdLabel = new Label(this, SWT.LEAD);
  groupIdLabel.setText(Messages.getString("GROUP_ID")); //$NON-NLS-1$
  groupIdField = new Text(this, SWT.BORDER);
  groupIdField.setToolTipText(Messages.getString("GROUP_ID_TOOLTIP")); //$NON-NLS-1$

  artifactIdLabel = new Label(this, SWT.LEAD);
  artifactIdLabel.setText(Messages.getString("ARTIFACT_ID")); //$NON-NLS-1$
  artifactIdField = new Text(this, SWT.BORDER);
  artifactIdField.setToolTipText(Messages.getString("ARTIFACT_ID_TOOLTIP")); //$NON-NLS-1$

  versionLabel = new Label(this, SWT.LEAD);
  versionLabel.setText(Messages.getString("ARTIFACT_VERSION")); //$NON-NLS-1$
  versionField = new Text(this, SWT.BORDER);
  versionField.setText(DEFAULT_VERSION);

  GridLayoutFactory.swtDefaults().numColumns(2).generateLayout(this);
}
 
Example #19
Source File: AppEngineWizardPage.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
  super.createControl(parent);

  Composite container = (Composite) getControl();
  setHelp(container);

  createCustomFields(container);

  mavenCoordinatesUi = new MavenCoordinatesWizardUi(container, SWT.NONE);
  mavenCoordinatesUi.addChangeListener(event -> revalidate());
  mavenCoordinatesUi.addGroupIdModifyListener(new AutoPackageNameSetterOnGroupIdChange());

  revalidate();
  // Show enter project name on opening
  setErrorMessage(null);
  setMessage(Messages.getString("enter.project.name")); //$NON-NLS-1$

  GridLayoutFactory.swtDefaults().generateLayout(container);
  Dialog.applyDialogFont(container);
}
 
Example #20
Source File: AccountsPanel.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
private void createButtons(Composite container) {
  Composite buttonArea = new Composite(container, SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(2).applyTo(buttonArea);

  Button addAccountButton = new Button(buttonArea, SWT.FLAT);
  addAccountButton.setText(Messages.getString("BUTTON_ACCOUNTS_PANEL_ADD_ACCOUNT"));
  addAccountButton.addSelectionListener(new LogInOnClick());
  GridDataFactory.defaultsFor(addAccountButton).applyTo(addAccountButton);

  if (loginService.hasAccounts()) {
    Button logOutButton = new Button(buttonArea, SWT.FLAT);
    logOutButton.setText(Messages.getString("BUTTON_ACCOUNTS_PANEL_LOGOUT"));
    logOutButton.addSelectionListener(new LogOutOnClick());
    GridDataFactory.defaultsFor(logOutButton).applyTo(logOutButton);
  }
}
 
Example #21
Source File: CloudLibrariesSelectionPage.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
protected final void createWidget(Composite parent, boolean restrictedEnvironment) {
  Preconditions.checkNotNull(libraryGroups, "Library groups must be set"); //$NON-NLS-1$
  Composite composite = new Composite(parent, SWT.NONE);

  // create the library selector libraryGroups
  for (Entry<String, String> group : libraryGroups.entrySet()) {
    LibrarySelectorGroup librariesSelector =
        new LibrarySelectorGroup(
            composite, group.getKey(), group.getValue(), restrictedEnvironment);
    librariesSelectors.add(librariesSelector);
  }
  setSelectedLibraries(initialSelection);

  GridLayoutFactory.fillDefaults().numColumns(libraryGroups.size()).generateLayout(composite);

  setControl(composite);
}
 
Example #22
Source File: ProjectSelector.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
public ProjectSelector(Composite parent) {
  super(parent, SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(this);

  Composite tableComposite = new Composite(this, SWT.NONE);
  TableColumnLayout tableColumnLayout = new TableColumnLayout();
  tableComposite.setLayout(tableColumnLayout);
  GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite);
  viewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
  createColumns(tableColumnLayout);
  viewer.getTable().setHeaderVisible(true);
  viewer.getTable().setLinesVisible(false);

  input = WritableList.withElementType(GcpProject.class);
  projectProperties = PojoProperties.values(new String[] {"name", "id"}); //$NON-NLS-1$ //$NON-NLS-2$
  ViewerSupport.bind(viewer, input, projectProperties);
  viewer.setComparator(new ViewerComparator());

  Composite linkComposite = new Composite(this, SWT.NONE);
  statusLink = new Link(linkComposite, SWT.WRAP);
  statusLink.addSelectionListener(
      new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
  statusLink.setText("");
  GridDataFactory.fillDefaults().span(2, 1).applyTo(linkComposite);
  GridLayoutFactory.fillDefaults().generateLayout(linkComposite);
}
 
Example #23
Source File: XMLAnalysesManagerPreferencePage.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
    getShell().setText(Messages.ManageXMLAnalysisDialog_ManageXmlAnalysesFiles);

    Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(new GridLayout(2, false));

    Composite tableContainer = new Composite(mainComposite, SWT.NONE);
    tableContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayoutFactory.fillDefaults().applyTo(tableContainer);

    // Create sub-contents
    createTable(tableContainer);
    createLabels(tableContainer);
    createImportButtons(mainComposite);
    createSelectionButtons(mainComposite);

    fillAnalysesTable();

    getShell().setMinimumSize(300, 275);

    return mainComposite;
}
 
Example #24
Source File: GenericInfoPopupDialog.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent)
{
	Composite main = new Composite(parent, SWT.NONE);
	main.setLayout(GridLayoutFactory.swtDefaults().create());
	main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	if (clickListener != null)
	{
		main.addMouseListener(clickListener);
	}

	Label infoLabel = new Label(main, SWT.WRAP);
	infoLabel.setText(message);
	infoLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	if (clickListener != null)
	{
		infoLabel.addMouseListener(clickListener);
	}

	return main;
}
 
Example #25
Source File: SudoPasswordPromptDialog.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected Control createButtonBar(Composite parent)
{
	new Label(parent, SWT.None);
	Composite buttonsComp = new Composite(parent, SWT.None);
	// Intentionally make the numOfColmnns to 0 as they will be incremented in createButton methods.
	buttonsComp.setLayout(GridLayoutFactory.fillDefaults().numColumns(0).equalWidth(true).create());
	buttonsComp
			.setLayoutData(GridDataFactory.swtDefaults().grab(true, true).align(SWT.END, SWT.BEGINNING).create());

	createButton(buttonsComp, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

	Button okBtn = createButton(buttonsComp, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
	okBtn.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).align(SWT.FILL, SWT.BEGINNING).create());
	return parent;
}
 
Example #26
Source File: SelectableControlList.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Do layout. Several magic #s in here...
 * 
 * @param scrolledComposite
 */
private void setupScrolledComposite() {
  setAlwaysShowScrollBars(true);

  scrolledCanvas = new Composite(this, SWT.NONE);
  GridLayoutFactory.fillDefaults().spacing(0, 0).applyTo(scrolledCanvas);

  setMinWidth(100);
  setMinHeight(100);
  setExpandHorizontal(true);
  setExpandVertical(true);
  setMinHeight(1);

  Point size = scrolledCanvas.computeSize(getParent().getSize().x,
      SWT.DEFAULT, true);
  scrolledCanvas.setSize(size);

  addControlListener(new ControlAdapter() {
    @Override
    public void controlResized(ControlEvent e) {
      doUpdateContentSize();
      updateScrollIncrements();
    }
  });
  setContent(scrolledCanvas);
}
 
Example #27
Source File: AbstractCargoLaunchConfigurationTab.java    From corrosion with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
	Composite container = new Composite(parent, SWT.NONE);
	setControl(container);
	GridLayoutFactory.swtDefaults().numColumns(4).applyTo(container);
	container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	projectInput = new InputComponent(container, Messages.LaunchUI_project, result -> {
		setDirty(true);
		setProject(projectInput.getValue());
		updateLaunchConfigurationDialog();
	});
	projectInput.createComponent();
	projectInput.createProjectSelection();

	createExtraControlsGroup(container);

	workingDirectoryInput = new OptionalDefaultInputComponent(container, Messages.LaunchUI_workingDirectory,
			result -> {
				setDirty(true);
				updateLaunchConfigurationDialog();
			}, () -> getDefaultWorkingDirectoryPath());
	workingDirectoryInput.createComponent();
	workingDirectoryInput.createContainerSelection(() -> project);
}
 
Example #28
Source File: N4JSNewProjectWizardCreationPage.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private Composite initDefaultOptionsUI(DataBindingContext dbc, Composite parent) {
	// A group for default options
	final Group defaultOptions = new Group(parent, NONE);
	defaultOptions.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());

	final Button createGreeterFileButton = new Button(defaultOptions, CHECK);
	createGreeterFileButton.setText("Create a greeter file");

	initDefaultCreateGreeterBindings(dbc, createGreeterFileButton);

	return defaultOptions;
}
 
Example #29
Source File: LibrarySelectorGroup.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void createContents(Composite parentContainer, String groupLabel) {
  ScrolledComposite scrolledComposite = new ScrolledComposite(parentContainer, SWT.V_SCROLL);

  Group apiGroup = new Group(scrolledComposite, SWT.NONE);
  apiGroup.setText(groupLabel);

  for (Library library : availableLibraries.values()) {
    Button libraryButton = new Button(apiGroup, SWT.CHECK);
    libraryButton.setText(getLibraryName(library));
    String toolTip = library.getToolTip();
    if (toolTip != null) {
      String stage = library.getLaunchStage();
      if (!"GA".equals(stage)) { //$NON-NLS-1
        toolTip += " (" + stage + ")";
      }
      libraryButton.setToolTipText(toolTip);
    }
    libraryButton.setData(library);
    libraryButton.addSelectionListener(new ManualSelectionTracker());
    libraryButtons.put(library, libraryButton);
  }
  GridLayoutFactory.swtDefaults().generateLayout(apiGroup);
  apiGroup.pack();

  scrolledComposite.setContent(apiGroup);
  scrolledComposite.setMinSize(apiGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));
  scrolledComposite.setShowFocusedControl(true);
  scrolledComposite.setExpandHorizontal(true);

  GridDataFactory.fillDefaults().grab(true, true).applyTo(scrolledComposite);
  GridLayoutFactory.fillDefaults().generateLayout(scrolledComposite);
}
 
Example #30
Source File: CustomSizeDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent)
{
	Composite main = new Composite(parent, SWT.NONE);
	main.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create());
	main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

	(new Label(main, SWT.NONE)).setText(Messages.WebBrowserViewer_LBL_Width);
	fWidthText = new Text(main, SWT.BORDER | SWT.SINGLE);
	fWidthText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
	ModifyListener listener = new ModifyListener()
	{

		public void modifyText(ModifyEvent e)
		{
			validate();
		}
	};
	fWidthText.addModifyListener(listener);

	(new Label(main, SWT.NONE)).setText(Messages.WebBrowserViewer_LBL_Height);
	fHeightText = new Text(main, SWT.BORDER | SWT.SINGLE);
	fHeightText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
	fHeightText.addModifyListener(listener);

	setTitle(Messages.WebBrowserViewer_CustomSize_Title);
	setMessage(Messages.WebBrowserViewer_CustomSize_Message);

	return main;
}