org.eclipse.swt.widgets.Composite Java Examples

The following examples show how to use org.eclipse.swt.widgets.Composite. 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: BatchQADialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
	parentData.widthHint = 600;
	parentData.heightHint = 300;
	tparent.setLayoutData(parentData);

	GridLayoutFactory.fillDefaults().extendedMargins(-1, -1, -1, 8).numColumns(1).applyTo(tparent);

	createLogoArea(tparent);
	createFileDataGroup(tparent);
	tableViewer.getTable().setFocus();
	
	return tparent;
}
 
Example #2
Source File: JobEntryCopyFilesDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected Button createSettingsButton( Composite p, String text, String title, Control top, SelectionAdapter sa ) {
  Button button = new Button( p, SWT.CHECK );
  button.setText( BaseMessages.getString( PKG, text ) );
  button.setToolTipText( BaseMessages.getString( PKG, title ) );
  props.setLook( button );
  FormData fd = new FormData();
  fd.left = new FormAttachment( 0, Const.MARGIN * 2 );
  if ( top == null ) {
    fd.top = new FormAttachment( 0, 10 );
  } else {
    fd.top = new FormAttachment( top, 5 );
  }
  fd.right = new FormAttachment( 100, 0 );
  button.setLayoutData( fd );
  button.addSelectionListener( sa );
  return button;
}
 
Example #3
Source File: AbstractEditor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
protected Control createEditorControl(final Composite comp) {
	Control paramControl;
	try {
		paramControl = !isEditable ? createLabelParameterControl(comp)
				: isCombo ? createComboParameterControl(comp) : createCustomParameterControl(comp);
	} catch (final GamaRuntimeException e1) {
		e1.addContext("The editor for " + name + " could not be created");
		GAMA.reportError(GAMA.getRuntimeScope(), e1, false);
		return null;
	}

	final GridData data = getParameterGridData();
	paramControl.setLayoutData(data);
	paramControl.setBackground(comp.getBackground());
	addToolbarHiders(paramControl);
	return paramControl;
}
 
Example #4
Source File: FromViewDocListControl.java    From depan with Apache License 2.0 6 votes vote down vote up
public FromViewDocListControl(Composite parent) {
  super(parent);

  Map<String, FromViewDocContributor> byView =
      FromViewDocRegistry.getRegistryContributionMap();
  Map<String, FromGraphDocContributor> byNodes =
      FromGraphDocRegistry.getRegistryContributionMap();

  Map<String, Object> choices = Maps.newHashMap();
  choices.putAll(byView);
  for (Entry<String, FromGraphDocContributor> byNode : byNodes.entrySet()) {
    choices.put(byNode.getKey() + " (nodes)", byNode.getValue());
  }

  setInput(getBestFrom(choices), choices);
}
 
Example #5
Source File: TableLayoutComposite.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>TableLayoutComposite</code>.
 *
 * @param parent the parent composite
 * @param style the SWT style
 */
public TableLayoutComposite(Composite parent, int style) {
	super(parent, style);
       addControlListener(new ControlAdapter() {
           @Override
		public void controlResized(ControlEvent e) {
               Rectangle area= getClientArea();
               Table table= (Table)getChildren()[0];
               Point preferredSize= computeTableSize(table);
               int width= area.width - 2 * table.getBorderWidth();
               if (preferredSize.y > area.height) {
                   // Subtract the scrollbar width from the total column width
                   // if a vertical scrollbar will be required
                   Point vBarSize = table.getVerticalBar().getSize();
                   width -= vBarSize.x;
               }
               layoutTable(table, width, area, table.getSize().x < area.width);
           }
       });
}
 
Example #6
Source File: Expression.java    From Rel with Apache License 2.0 6 votes vote down vote up
@Override
protected void buildControlPanel(Composite container) {
	container.setLayout(new GridLayout(2, false));

	Label label = new Label(container, SWT.None);
	label.setText("Expression:");

	Text expression = new Text(container, SWT.None);
	expression.setText(operatorLabel.getText());
	expression.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	expression.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			operatorLabel.setText(expression.getText());
			Expression.this.pack();
		}
	});
}
 
Example #7
Source File: JarImportWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void createControl(final Composite parent) {
	initializeDialogUnits(parent);
	final Composite composite= new Composite(parent, SWT.NONE);
	composite.setLayout(new GridLayout());
	composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
	createLocationGroup(composite);
	if (fImportWizard)
		createInputGroup(composite);
	createRenameGroup(composite);
	setPageComplete(false);
	if (fImportWizard && !fTreeViewer.getControl().isEnabled())
		setMessage(JarImportMessages.JarImportWizardPage_no_jar_files, INFORMATION);
	setControl(composite);
	Dialog.applyDialogFont(composite);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.JARIMPORT_WIZARD_PAGE);
}
 
Example #8
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 #9
Source File: IndexTabWrapper.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
private void initTable(final Composite parent) {
    final GridData gridData = new GridData();
    gridData.horizontalSpan = 3;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.heightHint = 200;

    indexTable = new Table(parent, SWT.BORDER | SWT.HIDE_SELECTION);

    indexTable.setHeaderVisible(true);
    indexTable.setLayoutData(gridData);
    indexTable.setLinesVisible(true);

    CompositeFactory.createTableColumn(indexTable, "label.column.name", -1);
    final TableColumn separatorColumn = CompositeFactory.createTableColumn(indexTable, "", 3);
    separatorColumn.setResizable(false);
}
 
Example #10
Source File: Regression_118773_swt.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Get the connection with SWT device to render the graphics.
 */
Regression_118773_swt( Composite parent, int style )
{
	super( parent, style );

	contextMap = new HashMap( );

	final PluginSettings ps = PluginSettings.instance( );
	try
	{
		idr = ps.getDevice( "dv.SWT" );//$NON-NLS-1$
		idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER, this );
	}
	catch ( ChartException ex )
	{
		ex.printStackTrace( );
	}
	cm = Title.BarChart( );
}
 
Example #11
Source File: ExportToTranslationDictionaryDialog.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
private void createTable(final Composite parent) {
    final GridData gridData = new GridData();
    gridData.heightHint = 150;
    gridData.horizontalSpan = 2;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    dictionaryTable = new Table(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI);
    dictionaryTable.setHeaderVisible(true);
    dictionaryTable.setLinesVisible(true);
    dictionaryTable.setLayoutData(gridData);

    parent.pack();

    final int width = dictionaryTable.getBounds().width;

    final TableColumn physicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT);
    physicalNameTableColumn.setText(ResourceString.getResourceString("label.physical.name"));
    physicalNameTableColumn.setWidth(width / 2 - 5);

    final TableColumn logicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT);

    logicalNameTableColumn.setText(ResourceString.getResourceString("label.logical.name"));
    logicalNameTableColumn.setWidth(width / 2 - 5);
}
 
Example #12
Source File: CamelMultiPageTalendEditor.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
protected void createPages() {
    createPage0();
    createPage1();
    createPage2();

    if (getPageCount() == 1) {
        Composite container = getContainer();
        if (container instanceof CTabFolder) {
            ((CTabFolder) container).setTabHeight(0);
        }
    }

}
 
Example #13
Source File: SelectNameAndDescWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
    context = new EMFDataBindingContext() ;
    Composite composite = doCreateControl(parent,context);
    WizardPageSupport.create(this, context) ;
    setControl(composite);
}
 
Example #14
Source File: InstallNpmDependencyDialog.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	final Group customDialogArea = new Group(parent, SHADOW_ETCHED_IN);
	customDialogArea.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).create());
	customDialogArea.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(FILL, TOP).create());

	createNameArea(customDialogArea, PACKAGE_NAME, this::handlePackageNameInput);
	createVersionArea(customDialogArea, VERSION_OPTIONAL, this::handleVersionInput);

	return customDialogArea;
}
 
Example #15
Source File: AddGetterSetterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Composite createSelectionButtons(Composite composite) {
	Composite buttonComposite= super.createSelectionButtons(composite);

	GridLayout layout= new GridLayout();
	buttonComposite.setLayout(layout);

	createGetterSetterButtons(buttonComposite);

	layout.marginHeight= 0;
	layout.marginWidth= 0;
	layout.numColumns= 1;

	return buttonComposite;
}
 
Example #16
Source File: SocialIndicatorEditor.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createQuantityCombo(FormToolkit tk, Composite comp) {
	UI.formLabel(comp, tk, M.Quantity);
	quantityCombo = new FlowPropertyViewer(comp);
	quantityCombo.setInput(Database.get());
	FlowProperty aq = getModel().activityQuantity;
	if (aq != null) {
		quantityCombo.select(Descriptor.of(aq));
	}
	quantityCombo.addSelectionChangedListener(this::quantityChanged);
	new CommentControl(comp, getToolkit(), "activityQuantity", getComments());
}
 
Example #17
Source File: BindingDialogHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createCommonSection( Composite composite )
{
	new Label( composite, SWT.NONE ).setText( EXPRESSION );

	txtExpression = new Text( composite, SWT.BORDER | SWT.MULTI );
	GridData gd = new GridData( GridData.FILL_HORIZONTAL );
	gd.horizontalSpan = 2;
	gd.heightHint = txtExpression.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y
			- txtExpression.getBorderWidth( )
			* 2;
	txtExpression.setLayoutData( gd );
	createExpressionButton( composite, txtExpression );
	txtExpression.addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent e )
		{
			modifyDialogContent( );
			validate( );
		}

	} );
	if ( isRef )
	{
		txtDisplayName.setEnabled( false );
		txtDisplayNameID.setEnabled( false );
		btnDisplayNameID.setEnabled( false );
		cmbType.setEnabled( false );
		txtExpression.setEnabled( false );
	}
}
 
Example #18
Source File: ProxyDialog.java    From http4e with Apache License 2.0 5 votes vote down vote up
protected void createButtonsForButtonBar( Composite parent){
   Button okBtn = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
   okBtn.addSelectionListener(new SelectionAdapter() {

      public void widgetSelected( SelectionEvent e){
         CoreContext.getContext().putObject(CoreObjects.PROXY_ITEM, ProxyDialog.this.proxyItem);
         ((HdViewPart)ProxyDialog.this.viewPart).fireProxyEnable(ProxyDialog.this.proxyItem.isProxy());
         fireExecuteFolderItems();
      }
   });
}
 
Example #19
Source File: TestDataEditTest.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void initialize(Composite parent) {
	ERDiagram diagram = new ERDiagram(MySQLDBManager.ID);
	ERTable table = new ERTable();
	table.setPhysicalName("table1");
	table.setLogicalName("table1");
	TypeData typeData = new TypeData(null, null, false, null, false, null);

	Word word1 = new Word("a", "a", SqlType.valueOfId("bigint"), typeData,
			null, MySQLDBManager.ID);

	NormalColumn column1 = new NormalColumn(word1, true, true, true, true,
			null, null, null, null, null);

	Word word2 = new Word("a", "a", SqlType.valueOfId("bigint"), typeData,
			null, MySQLDBManager.ID);
	NormalColumn column2 = new NormalColumn(word2, true, true, true, true,
			null, null, null, null, null);
	table.addColumn(column1);
	table.addColumn(column2);

	diagram.addContent(table);

	TestDataDialog dialog = new TestDataDialog(shell, diagram,
			new TestData());

	dialog.open();
}
 
Example #20
Source File: XtendValidatorConfigurationBlock.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void fillSettingsPage(Composite composite, int nColumns, int defaultIndent) {
	super.fillSettingsPage(composite, nColumns, defaultIndent);
	fillDispatchSection(
			new ComboBoxBuilder(this, createSection("Dispatch methods", composite, nColumns), defaultIndent));
	fillJavaDocSection(new ComboBoxBuilder(this, createSection("Javadoc", composite, nColumns), defaultIndent));
	fillActiveAnnotationSection(
			new ComboBoxBuilder(this, createSection("Active Annotations", composite, nColumns), defaultIndent));
}
 
Example #21
Source File: LoginDialog.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createButtonBar ( final Composite parent )
{
    final Control control = super.createButtonBar ( parent );

    update ();
    loadFrom ();

    return control;
}
 
Example #22
Source File: ProjectBuildPathPropertyPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a button that will be located by the table.
 * 
 * @param parent
 * @param text
 * @param enabled
 * @return A {@link Button}
 */
private Button createButton(Composite parent, String text, boolean enabled)
{
	Button button = new Button(parent, SWT.PUSH);
	button.setText(text);
	button.addSelectionListener(buttonListener);
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.grabExcessHorizontalSpace = true;
	int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
	button.setLayoutData(GridDataFactory.fillDefaults().grab(true, false)
			.hint(Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x), SWT.DEFAULT).create());
	button.setEnabled(enabled);
	return button;
}
 
Example #23
Source File: DetailsView.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
private void insertRows(Composite parent, Iterable<Row> rows) {
	int num = 0;
	for (Row row : rows) {
		row.insert(parent, num++);
	}
	
	layout();
}
 
Example #24
Source File: FlowInfoPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void processButton(InfoSection infoSection) {
	Flow flow = getModel();
	if (flow.flowType != FlowType.PRODUCT_FLOW)
		return;
	Composite comp = infoSection.getContainer();
	toolkit.createLabel(comp, "");
	Button button = toolkit.createButton(comp, M.CreateProcess, SWT.NONE);
	button.setImage(Images.get(ModelType.PROCESS, Overlay.NEW));
	Controls.onSelect(button, e -> openProcessWizard());
}
 
Example #25
Source File: JavaMergeViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createControls(Composite composite) {
	super.createControls(composite);
	IWorkbenchPart workbenchPart = getCompareConfiguration().getContainer().getWorkbenchPart();
	if (workbenchPart != null) {
		IContextService service = (IContextService)workbenchPart.getSite().getService(IContextService.class);
		if (service != null) {
			service.activateContext("org.eclipse.jdt.ui.javaEditorScope"); //$NON-NLS-1$
		}
	}
}
 
Example #26
Source File: SVNPropertyPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void addSeparator(Composite parent) {
    Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    separator.setLayoutData(gridData);
}
 
Example #27
Source File: FormatSpecifierComposite.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createPlaceHolder( Composite parent, int horizontalSpan )
{
	Label label = new Label( parent, SWT.NONE );
	GridData gd = new GridData( );
	gd.horizontalSpan = horizontalSpan;
	gd.heightHint = 10;
	label.setLayoutData( gd );
}
 
Example #28
Source File: ChartCubeBindingDialogHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createMessageSection( Composite composite )
{
	messageLine = new CLabel( composite, SWT.NONE );
	GridData layoutData = new GridData( GridData.FILL_HORIZONTAL );
	layoutData.horizontalSpan = 3;
	messageLine.setLayoutData( layoutData );
}
 
Example #29
Source File: BuildPathsPropertyPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Control createWithoutJava(Composite parent) {
	Label label= new Label(parent, SWT.LEFT);
	label.setText(PreferencesMessages.BuildPathsPropertyPage_no_java_project_message);

	fBuildPathsBlock= null;
	setValid(true);
	return label;
}
 
Example #30
Source File: Tester.java    From ColorMixer with MIT License 5 votes vote down vote up
private void setResultColor(Color colorA, Color colorB, Composite resultColorComposite, Label resultColor){
	KMColor mix = new KMColor(new java.awt.Color(colorA.getRed(), colorA.getGreen(), colorA.getBlue()));
	mix.mix(new java.awt.Color(colorB.getRed(), colorB.getGreen(), colorB.getBlue()));
	java.awt.Color result = mix.getColor();
	resultColorComposite.setBackground(new Color(Display.getCurrent(), result.getRed(), result.getGreen(), result.getBlue()));
	resultColor.setText("R: " + result.getRed() + ", G: " + result.getGreen() + ", B: " + result.getBlue());
}