Java Code Examples for org.eclipse.swt.layout.GridLayout

The following examples show how to use org.eclipse.swt.layout.GridLayout. These examples are extracted from open source projects. 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 Project: nebula   Source File: SnippetDarkPanel.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private static void createButtons(final Shell shell) {
	final DarkPanel p = new DarkPanel(shell);

	final Composite composite = new Composite(shell, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
	composite.setLayout(new GridLayout(2, false));

	final Button ok = new Button(composite, SWT.PUSH);
	ok.setText("Ok");
	ok.setLayoutData(new GridData(SWT.END, SWT.END, true, true));
	ok.addListener(SWT.Selection, e -> {
		p.show();
		Dialog.isConfirmed("Confirmation", "Are you sure you want to save this form ?");
		p.hide();
	});

	final Button cancel = new Button(composite, SWT.PUSH);
	cancel.setText("Cancel");
	cancel.setLayoutData(new GridData(SWT.CENTER, SWT.END, false, true));
	cancel.addListener(SWT.Selection, e -> {
		shell.dispose();
	});
}
 
Example 2
Source Project: hop   Source File: DetailsDialog.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected Control createMessageArea( Composite composite ) {
  GridLayout gridLayout = (GridLayout) composite.getLayout();
  gridLayout.numColumns = 1;
  composite.setLayout( gridLayout );

  if ( this.message != null ) {
    this.messageLabel = new Label( composite, this.getMessageLabelStyle() );
    this.messageLabel.setText( this.message );
  }

  if ( this.details != null ) {
    this.detailsText = new Text( composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
    this.detailsText.pack();
    this.detailsText.setText( this.details );
    GridData gridData = new GridData();
    gridData.widthHint = 1024;
    gridData.heightHint = 300;
    this.detailsText.setLayoutData( gridData );
    this.detailsText.setSelection( this.details.length() );
  }

  return composite;
}
 
Example 3
Source Project: hop   Source File: UsernamePasswordDialog.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected Control createDialogArea( Composite parent ) {
  Composite comp = (Composite) super.createDialogArea( parent );

  GridLayout layout = (GridLayout) comp.getLayout();
  layout.numColumns = 2;

  Label usernameLabel = new Label( comp, SWT.RIGHT );
  usernameLabel.setText( "Username: " );
  usernameText = new Text( comp, SWT.SINGLE | SWT.BORDER );
  usernameText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );

  Label passwordLabel = new Label( comp, SWT.RIGHT );
  passwordLabel.setText( "Password: " );
  passwordText = new Text( comp, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD );
  passwordText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );

  return comp;
}
 
Example 4
@Override
public void createControl(Composite parent) {

	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(2, false));

	Label projectNameLabel = new Label(container, SWT.NULL);
	projectNameLabel.setText("Ghida module project:");
	projectCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	projectCombo.setLayoutData(gd);
	projectCombo.addModifyListener(evt -> validate());
	for (IJavaProject javaProject : GhidraProjectUtils.getGhidraProjects()) {
		if (GhidraProjectUtils.isGhidraModuleProject(javaProject.getProject())) {
			IProject project = javaProject.getProject();
			projectCombo.add(project.getName());
			if (project.equals(selectedProject)) {
				projectCombo.setText(project.getName());
			}
		}
	}

	validate();
	setControl(container);
}
 
Example 5
Source Project: nebula   Source File: FocusTests.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public void setUp2() throws Exception {
	Shell shell = getShell();
	shell.setLayout(new GridLayout(4, false));

	cdt1 = new CDateTime(shell, CDT.BORDER | CDT.SIMPLE);
	cdt1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	button1 = new Button(shell, SWT.TOGGLE);
	button1.setText("B1");
	button1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	cdt2 = new CDateTime(shell, CDT.BORDER | CDT.DROP_DOWN);
	cdt2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	button2 = new Button(shell, SWT.PUSH);
	button2.setText("B2");
	button2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
}
 
Example 6
Source Project: nebula   Source File: AbstractWidgetTest.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testAll() throws Exception {
	shell = new Shell();

	shell.open();
	shell.setLayout(new GridLayout(1, false));
	final Canvas canvas = new Canvas(shell, SWT.None);
	canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	text = new Text(shell, SWT.READ_ONLY);
	text.setFont(XYGraphMediaFactory.getInstance().getFont("default", 18,
			SWT.BOLD));
	text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
	final LightweightSystem lws = new LightweightSystem(canvas);
	lws.setContents(getTestBench());
	shell.setSize(800, 500);
	testGetBeanInfo();
	testWidget();
}
 
Example 7
@Override
public void createControl(Composite parent) {
	Composite outer = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	layout.horizontalSpacing = 5;
	layout.verticalSpacing = 7;
	outer.setLayout(layout);
	outer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	
	composite = new CodewindConnectionComposite(outer, this);
	GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
	data.widthHint = 250;
	composite.setLayoutData(data);
	setControl(outer);
}
 
Example 8
protected Control createDialogArea(Composite parent) {
	setTitleImage(CodewindUIPlugin.getImage(CodewindUIPlugin.CODEWIND_BANNER));
	setTitle(Messages.EditConnectionDialogTitle);
	setMessage(NLS.bind(Messages.EditConnectionDialogMessage, connection.getName()));
	
	Composite content = (Composite) super.createDialogArea(parent);
	content.setLayout(new GridLayout(1, false));
	content.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
	
	connectionComp = new CodewindConnectionComposite(content, this, connection);
	connectionComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	
	GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	layout.marginHeight = 10;
	layout.marginWidth = 20;
	progressMon = new ProgressMonitorPart(parent, layout, true);
	progressMon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	progressMon.setVisible(false);
	
	return parent;
}
 
Example 9
Source Project: nebula   Source File: PageContainer.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public PageContainer(Composite parent, int style) {
	super(parent, style);
	addDisposeListener(e -> PageContainer.this.widgetDisposed(e));
	adapt(this);
	GridLayout layout = new GridLayout(1, false);
	layout.marginWidth = layout.marginHeight = 0;
	setLayout(layout);

	stackLayout = new StackLayout();

	TitleControl title = new TitleControl(this, null);
	adapt(title);
	title.setLayoutData(
			new GridData(GridData.FILL, GridData.BEGINNING, true, false));
	title.setText("SWT MapWidget");

	content = new Composite(this, SWT.NONE);
	content.setLayout(stackLayout);
	content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	adapt(content);
}
 
Example 10
Source Project: nebula   Source File: Snippet8.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public Shell createShell() {
	printJob = new PrintJob("Snippet8.java", createPrint())
			.setMargins(108); // 1.5"

	shell = new Shell(display);
	shell.setText("Snippet8.java");
	shell.setBounds(100, 100, 800, 600);
	shell.setLayout(new GridLayout(1, false));

	createButtonPanel(shell).setLayoutData(
			new GridData(SWT.FILL, SWT.FILL, true, false));
	createScrollingPreview(shell).setLayoutData(
			new GridData(SWT.FILL, SWT.FILL, true, true));

	preview.setLazyPageLayout(true);
	preview.setPrintJob(printJob);
	updatePreviewSize();
	updatePageNumber();
	preview.startBackgroundLayout(() -> {
		updatePageNumber();
	});

	shell.setVisible(true);

	return shell;
}
 
Example 11
Source Project: nebula   Source File: FocusTests.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public void setUp4() throws Exception {
	Shell shell = getShell();
	shell.setLayout(new GridLayout(4, false));

	cdt1 = new CDateTime(shell, CDT.BORDER | CDT.DROP_DOWN);
	cdt1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	button1 = new Button(shell, SWT.TOGGLE);
	button1.setText("B1");
	button1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	cdt2 = new CDateTime(shell, CDT.BORDER | CDT.SIMPLE);
	cdt2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	button2 = new Button(shell, SWT.PUSH);
	button2.setText("B2");
	button2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
}
 
Example 12
Source Project: lapse-plus   Source File: SinkStatsDialog.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected Control createDialogArea(Composite parent) {
    Composite superComposite = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(superComposite, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    Text outputArea = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL);
    outputArea.setSize(500, 300);
    outputArea.setText(view.getStatisticsManager().getStatistics());
    outputArea.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
    return composite;
}
 
Example 13
Source Project: nebula   Source File: GridVirtualTableViewer.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new GridLayout());
	new GridVirtualTableViewer(shell);
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();

}
 
Example 14
public static void main(String[] args) {
	Display display = new Display();

	final Shell shell = new Shell(display);
	shell.setText("Rich Text Editor JFace viewer integration example");
	shell.setSize(800, 600);

	shell.setLayout(new GridLayout(1, true));

	JFaceViewerIntegrationExample example = new JFaceViewerIntegrationExample();
	example.createControls(shell);

	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
 
Example 15
Source Project: nebula   Source File: FocusTests.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public void setUp5() throws Exception {
	Shell shell = getShell();
	shell.setLayout(new GridLayout(4, false));

	button1 = new Button(shell, SWT.TOGGLE);
	button1.setText("B1");
	button1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	cdt1 = new CDateTime(shell, CDT.BORDER | CDT.DROP_DOWN | CDT.TAB_FIELDS);
	cdt1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	button2 = new Button(shell, SWT.PUSH);
	button2.setText("B2");
	button2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	cdt2 = new CDateTime(shell, CDT.BORDER | CDT.SIMPLE | CDT.TAB_FIELDS);
	cdt2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
}
 
Example 16
Source Project: nebula   Source File: FocusTests.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public void setUp3() throws Exception {
	Shell shell = getShell();
	shell.setLayout(new GridLayout(4, false));

	button1 = new Button(shell, SWT.TOGGLE);
	button1.setText("B1");
	button1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	cdt1 = new CDateTime(shell, CDT.BORDER | CDT.SIMPLE);
	cdt1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	button2 = new Button(shell, SWT.PUSH);
	button2.setText("B2");
	button2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

	cdt2 = new CDateTime(shell, CDT.BORDER | CDT.DROP_DOWN);
	cdt2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
}
 
Example 17
Source Project: nebula   Source File: DateChooserComboSnippet1.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
   Shell shell = new Shell(display);
   shell.setLayout(new GridLayout());
   shell.setSize(300, 200);

   DateChooserCombo combo = new DateChooserCombo(shell, SWT.BORDER);
   GridData data = new GridData();
	data.widthHint = 110;
	combo.setLayoutData(data);

   shell.open();
   while ( ! shell.isDisposed() ) {
   	if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
}
 
Example 18
Source Project: nebula   Source File: NumberFormatterSnippet2.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
   Shell shell = new Shell(display);
   shell.setLayout(new GridLayout());

   FormattedText text = new FormattedText(shell, SWT.BORDER | SWT.RIGHT);
   text.setFormatter(new NumberFormatter(Locale.FRENCH));
   GridData data = new GridData();
   data.widthHint = 100;
   text.getControl().setLayoutData(data);

   shell.open();
   while ( ! shell.isDisposed() ) {
   	if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
}
 
Example 19
Source Project: nebula   Source File: NumberFormatterSnippet3.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
   Shell shell = new Shell(display);
   shell.setLayout(new GridLayout());

   FormattedText text = new FormattedText(shell, SWT.BORDER | SWT.RIGHT);
   NumberFormatter formatter = new NumberFormatter();
   formatter.setFixedLengths(false, true);
   text.setFormatter(formatter);
   text.setValue(new Double(123.4));
   GridData data = new GridData();
   data.widthHint = 100;
   text.getControl().setLayoutData(data);

   shell.open();
   while ( ! shell.isDisposed() ) {
   	if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
}
 
Example 20
/**
 * Executes the GridPrintNoBreak example.
 * 
 * @param args
 *            the command line arguments.
 */
public static void main(String[] args) {
	final Display display = new Display();

	Shell shell = new Shell(display, SWT.SHELL_TRIM);
	shell.setLayout(new GridLayout());
	shell.setSize(600, 600);

	PrintJob job = new PrintJob("GridPrintNoBreakExample", createPrint());

	final PrintPreview preview = new PrintPreview(shell, SWT.BORDER);
	preview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	preview.setPrintJob(job);

	shell.open();

	while (!shell.isDisposed())
		if (!display.readAndDispatch())
			display.sleep();

	PaperClips.print(job, new PrinterData());
}
 
Example 21
Source Project: nebula   Source File: AbstractExampleTab.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private void createLinks(Composite parent) {
	parent.setLayout(new GridLayout());

	String[] links = createLinks();

	if (links == null) {
		return;
	}

	for (String link2 : links) {
		Link link = new Link(parent, SWT.NONE);
		link.setText(link2);
		link.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				Program.launch(e.text);
			}
		});
	}
}
 
Example 22
@Override
public Control createControl(Composite parent) {

	itemImage24 = new Image(PlatformUI.getWorkbench().getDisplay(), PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_WORKING).getImageData().scaledTo(24, 24));
	itemImage16 = new Image(PlatformUI.getWorkbench().getDisplay(), PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_WORKING).getImageData().scaledTo(16, 16));

	parent.setLayout(new FillLayout());

	Composite inner = new Composite(parent, SWT.NONE);
	GridLayout gl = new GridLayout(1, true);
	gl.marginBottom = 0;
	gl.marginHeight = 0;
	gl.marginWidth = 0;
	gl.marginHeight = 0;
	inner.setLayout(gl);

	collapsibleButtons = new CollapsibleButtons(inner, SWT.NONE, IColorManager.SKIN_OFFICE_2007);
	collapsibleButtons.setLayoutData(
			new GridData(GridData.GRAB_VERTICAL | GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END));

	for (int i = 0; i < 5; i++) {
		collapsibleButtons.addButton("Button " + i, "Tooltip " + i, itemImage24, itemImage16);
	}

	return collapsibleButtons;
}
 
Example 23
Source Project: nebula   Source File: Header.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Redraw the composite
 */
private void redrawComposite() {
	// Dispose previous content
	for (final Control c : getChildren()) {
		c.dispose();
	}

	int numberOfColumns = 1;
	if (image != null) {
		numberOfColumns++;
	}

	super.setLayout(new GridLayout(numberOfColumns, false));
	createContent();
	drawBackground();
}
 
Example 24
Source Project: nebula   Source File: PageSizeComboRenderer.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void createUI(Composite parent) {
	GridLayout layout = new GridLayout(2, false);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	this.setLayout(layout);

	itemsPerPageLabel = new Label(parent, SWT.NONE);
	itemsPerPageLabel.setText(Resources.getText(
			Resources.PaginationRenderer_itemsPerPage, getLocale()));
	itemsPerPageLabel.setLayoutData(new GridData());

	comboViewer = new ComboViewer(parent, SWT.READ_ONLY);
	comboViewer.setContentProvider(ArrayContentProvider.getInstance());
	comboViewer.setLabelProvider(InternalLabelProvider.getInstance());
	comboViewer.getCombo().setLayoutData(
			new GridData(GridData.FILL_HORIZONTAL));
	comboViewer.getCombo().addSelectionListener(this);

}
 
Example 25
Source Project: nebula   Source File: InternalCompositeTable.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialize the overall table UI.
 */
private void initialize() {
	GridLayout gl = new GridLayout();
	gl.numColumns = 2;
	gl.verticalSpacing = 0;
	gl.marginWidth = 0;
	gl.marginHeight = 0;
	// borderWidth times two, since border steals pixels from both sides
	int borderInPixels = getParent().getBorderWidth() * 2;
	gl.marginRight = borderInPixels;
	gl.marginBottom = borderInPixels;
	gl.horizontalSpacing = 0;
	this.setLayout(gl);
	createControlHolder();
	createVSliderHolder();
	createHSliderHolder();
}
 
Example 26
Source Project: nebula   Source File: PromptSupportSnippet.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setLayout(new GridLayout(2, true));

	createText(createGroup(shell));
	createStyledText(createGroup(shell));
	createCombo(createGroup(shell));
	createCCombo(createGroup(shell));

	shell.pack();
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();

}
 
Example 27
Source Project: nebula   Source File: ButtonFocusTests.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public void setUp1() throws Exception {
	Shell shell = getShell();
	shell.setLayout(new GridLayout(2, true));

	// row 1
	button1 = new Button(shell, SWT.PUSH);
	button1.setText("B1");
	button1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	VCanvas c1 = new VCanvas(shell, SWT.NONE);
	c1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	c1.getPanel().setLayout(new VSimpleLayout());
	
	vbutton1 = new VButton(c1.getPanel(), SWT.PUSH);
	vbutton1.setText("VB1");

	// row 2
	button2 = new Button(shell, SWT.PUSH);
	button2.setText("B2");
	button2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	VCanvas c2 = new VCanvas(shell, SWT.NONE);
	c2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	c2.getPanel().setLayout(new VSimpleLayout());

	vbutton2 = new VButton(c2.getPanel(), SWT.PUSH);
	vbutton2.setText("VB2");
}
 
Example 28
Source Project: MergeProcessor   Source File: WorkspaceMergeDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the text field showing the commit message.
 * 
 * @param parent the parent composite of the text field
 * @return the text field
 */
private static Text createCommitMessageText(final Composite parent) {
	final Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridDataFactory.fillDefaults().span(2, 1).applyTo(composite);
	new Label(composite, SWT.NONE).setText("Commit Message: ");
	final Text text = new Text(composite, SWT.BORDER);
	text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	text.setEditable(false);
	return text;
}
 
Example 29
Source Project: MergeProcessor   Source File: DirectorySelectionDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Control createDialogArea(Composite parent) {
	final Composite dialogComposite = (Composite) super.createDialogArea(parent);

	final Composite composite = new Composite(dialogComposite, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	composite.setLayout(new GridLayout(2, false));

	if (StringUtils.isNotEmpty(mergeFrom) && StringUtils.isNotEmpty(mergeTo)) {
		final Composite compMergeFromTo = new Composite(composite, SWT.NONE);
		compMergeFromTo.setLayout(new RowLayout(SWT.HORIZONTAL));
		compMergeFromTo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));

		new Label(compMergeFromTo, SWT.NONE).setText(Messages.DirectorySelectionDialog_mergeFrom);

		final Label labelFrom = new Label(compMergeFromTo, SWT.NONE);
		labelFrom.setFont(JFaceResources.getFontRegistry().getBold(""));
		labelFrom.setText(mergeFrom);

		new Label(compMergeFromTo, SWT.NONE).setText(Messages.DirectorySelectionDialog_mergeTo);

		final Label labelTo = new Label(compMergeFromTo, SWT.NONE);
		labelTo.setFont(JFaceResources.getFontRegistry().getBold(""));
		labelTo.setText(mergeTo);
	}

	textRepository = new Text(composite, SWT.BORDER);
	textRepository.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	if (selectedPath != null) {
		textRepository.setText(selectedPath.toString());
	}
	textRepository.addModifyListener(e -> setErrorMessage(null));

	final Button buttonBrowseRepository = new Button(composite, SWT.NONE);
	buttonBrowseRepository.setText(Messages.DirectorySelectionDialog_browse);
	buttonBrowseRepository.addListener(SWT.Selection, e -> openDirectoryDialog());

	return dialogComposite;
}
 
Example 30
/**
 * Create page links "Previous 1 2 ...10 Next" with SWT Link.
 *
 * @param parent
 */
private void createRightContainer(Composite parent) {
	Composite right = createComposite(parent, SWT.NONE);
	right.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	GridLayout layout = new GridLayout(3, false);
	layout.marginHeight = 0;
	right.setLayout(layout);

	// Previous link
	previousLink = createHyperlink(right, SWT.NONE);
	setLinkText(previousLink, Resources.getText(
			Resources.PaginationRenderer_previous, getLocale()));
	previousLink.setLayoutData(new GridData(SWT.RIGHT));
	previousLink.addSelectionListener(this);

	// Page links
	pageLinks = createHyperlink(right, SWT.NONE);
	pageLinks.setForeground(getColor());
	pageLinks.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	pageLinks.addSelectionListener(this);

	// Next link
	nextLink = createHyperlink(right, SWT.NONE);
	setLinkText(nextLink, Resources.getText(
			Resources.PaginationRenderer_next, getLocale()));
	nextLink.setLayoutData(new GridData(SWT.LEFT));
	nextLink.addSelectionListener(this);

}