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

The following examples show how to use org.eclipse.swt.SWT#WRAP . 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: MarkerIconDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void swtichToLocalType( )
{
	Composite buttonBar = new Composite( inputArea, SWT.NONE );

	GridLayout gl = new GridLayout( );
	gl.marginWidth = 0;
	gl.marginHeight = 0;
	buttonBar.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	buttonBar.setLayout( gl );

	Label description = new Label( buttonBar, SWT.WRAP );
	description.setLayoutData( new GridData( GridData.FILL_HORIZONTAL
			| GridData.HORIZONTAL_ALIGN_BEGINNING ) );
	description.setText( Messages.getString( "MarkerIconDialog.Lbl.Description" ) ); //$NON-NLS-1$

	btnBrowse = new Button( buttonBar, SWT.PUSH );
	btnBrowse.setText( Messages.getString( "MarkerIconDialog.Lbl.Browse" ) ); //$NON-NLS-1$
	GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_END );
	gd.grabExcessHorizontalSpace = true;
	btnBrowse.setLayoutData( gd );
	btnBrowse.addSelectionListener( this );
}
 
Example 2
Source File: ApplicationOverviewEditorPart.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public LinkEntry(Composite composite, FormToolkit toolkit, String name, LinkAction action) {
	Label label = new Label(composite, SWT.NONE);
	label.setFont(boldFont);
	label.setText(name);
       
	// If not available then use a text field
	text = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
	text.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
	text.setText(Messages.AppOverviewEditorNotAvailable);
	text.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
	IDEUtil.paintBackgroundToMatch(text, composite);
       
	link = toolkit.createHyperlink(composite, "", SWT.WRAP);
	link.setVisible(false);
	GridData data = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false);
	data.horizontalIndent = 2;
	data.exclude = true;
	link.setLayoutData(data);
	
	link.addHyperlinkListener(new HyperlinkAdapter() {
		@Override
		public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
			action.execute(linkUrl);
		}
	});
}
 
Example 3
Source File: CompositeFactory.java    From erflute with Apache License 2.0 6 votes vote down vote up
public static Text createTextArea(
        AbstractDialog dialog, Composite composite, String title, int width, int height, int span, boolean selectAll, boolean imeOn) {
    if (title != null) {
        final Label label = new Label(composite, SWT.NONE);
        label.setText(DisplayMessages.getMessage(title));
    }
    final GridData textAreaGridData = new GridData();
    textAreaGridData.heightHint = height;
    textAreaGridData.grabExcessHorizontalSpace = true;
    textAreaGridData.horizontalSpan = span;
    textAreaGridData.horizontalAlignment = GridData.FILL;
    textAreaGridData.widthHint = width;
    final Text text = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
    text.setLayoutData(textAreaGridData);
    ListenerAppender.addTextAreaListener(text, dialog, selectAll, imeOn);
    return text;
}
 
Example 4
Source File: RolesWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createDescriptionField(final Group group) {
    final Label descriptionLabel = new Label(group, SWT.NONE);
    descriptionLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).create());
    descriptionLabel.setText(Messages.description);

    final Text roleDescriptionText = new Text(group, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    roleDescriptionText
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 80).create());
    roleDescriptionText.setMessage(Messages.descriptionHint);
    roleDescriptionText.setTextLimit(255);

    final IObservableValue roleDescriptionValue = EMFObservables.observeDetailValue(Realm.getDefault(),
            roleSingleSelectionObservable, OrganizationPackage.Literals.ROLE__DESCRIPTION);
    context.bindValue(SWTObservables.observeText(roleDescriptionText, SWT.Modify), roleDescriptionValue);
    roleDescriptionValue.addValueChangeListener(new IValueChangeListener() {

        @Override
        public void handleValueChange(final ValueChangeEvent event) {
            handleRoleDescriptionChange(event);
        }
    });
}
 
Example 5
Source File: GenerateConstructorUsingFieldsSelectionDialog.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(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_template_link_message);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID);
		}
	});
	link.setToolTipText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_template_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 6
Source File: TestDatabaseConnectorOutputWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Composite createNRowsNColsOuputControl(final Composite parent,
		final EMFDataBindingContext context) {
	final Composite mainComposite = new Composite(parent, SWT.NONE) ;
	mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()) ;
	mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(20, 20).create());

	Operation singleModeOuputOperation = getOuputOperationFor(TABLE_RESULT_OUTPUT);
	if(singleModeOuputOperation == null){
		singleModeOuputOperation = createDefaultOutput(TABLE_RESULT_OUTPUT, getDefinition());
		getConnector().getOutputs().add(singleModeOuputOperation);
	}
	singleModeOuputOperation.getLeftOperand().setReturnType(Collection.class.getName());
	singleModeOuputOperation.getLeftOperand().setReturnTypeFixed(true);

	final Label expressionLabel = new Label(mainComposite, SWT.READ_ONLY);
	expressionLabel.setText(Messages.connectorExpressionViewerLabel);

	final Text nRowsNColumnsColumnText = new Text(mainComposite,SWT.BORDER | SWT.READ_ONLY) ;
	nRowsNColumnsColumnText.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).create());
	nRowsNColumnsColumnText.setText(singleModeOuputOperation.getRightOperand().getName());

	final Label hintLabel = new Label(mainComposite, SWT.WRAP);
	hintLabel.setLayoutData(GridDataFactory.swtDefaults().span(3, 1).create());
	hintLabel.setText(Messages.nRowsNColsOutputHint);

	return mainComposite;
}
 
Example 7
Source File: TaskSelectionPage.java    From CogniCrypt with Eclipse Public License 2.0 5 votes vote down vote up
private Button createImageButton(final Composite container, final Image startImage, String taskName) {
	final Button imageButton = new Button(container, SWT.WRAP | SWT.TOGGLE);
	final Rectangle bounds = startImage.getBounds();
	imageButton.setSize(bounds.width, bounds.height);
	imageButton.setImage(startImage);
	imageButton.setToolTipText(taskName);
	return imageButton;
}
 
Example 8
Source File: TriggerDataComposite.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private Label addDescriptionLabel( Composite parent, int horizontalSpan,
		String description )
{
	Label label = new Label( parent, SWT.WRAP );
	{
		GridData gd = new GridData( GridData.FILL_HORIZONTAL );
		gd.widthHint = 200;
		gd.horizontalSpan = horizontalSpan;
		label.setLayoutData( gd );
		label.setText( description );
	}
	return label;
}
 
Example 9
Source File: ToolkitControl.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private void initControl() {
  GridLayoutFactory.fillDefaults().numColumns(3).spacing(3, 2).applyTo(this);
  GridLayout layout = (GridLayout) this.getLayout();
  layout.marginLeft = 7;
  layout.marginTop = 2;
  layout.marginBottom = 2;

  Label iconLabel = new Label(this, SWT.NULL);
  iconLabel.setBackground(getBackground());
  GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.BEGINNING).span(1, 2).applyTo(
      iconLabel);
  listenTo(iconLabel);

  Link nameLabel = new Link(this, SWT.NONE);
  nameLabel.setText(wbToolkit.getName());
  nameLabel.setBackground(getBackground());
  nameLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  nameLabel.setFont(getBoldFont(getFont()));
  listenTo(nameLabel);

  Label providerLabel = new Label(this, SWT.NONE);
  providerLabel.setText(wbToolkit.getProviderDescription());
  providerLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
  providerLabel.setBackground(getBackground());
  providerLabel.setForeground(Display.getDefault().getSystemColor(
      SWT.COLOR_GRAY));
  listenTo(providerLabel);

  Label summaryLabel = new Label(this, SWT.WRAP);
  String description = stripCRLF(wbToolkit.getDescription());
  summaryLabel.setText(description);
  summaryLabel.setBackground(getBackground());
  GridDataFactory.fillDefaults().grab(true, false).span(2, 1).hint(100,
      SWT.DEFAULT).applyTo(summaryLabel);
  listenTo(summaryLabel);

  listenTo(this);
}
 
Example 10
Source File: AddAnalysisDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    final Composite composite = (Composite) super.createDialogArea(parent);

    // create label for name text
    createSubtitleLabel(composite, Messages.AddAnalysisDialog_Name);

    // create name text
    fNameText = new Text(composite, getInputTextStyle());
    fNameText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
            | GridData.HORIZONTAL_ALIGN_FILL));
    fNameText.addModifyListener(e -> validateInputs());

    // create name error text
    fNameErrorLabel = createErrorLabel(composite);

    // spacer
    new Label(composite, SWT.WRAP);

    // create label for command text
    createSubtitleLabel(composite, Messages.AddAnalysisDialog_Command);

    // create command text
    fCommandText = new Text(composite, getInputTextStyle());
    fCommandText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
            | GridData.HORIZONTAL_ALIGN_FILL));
    final Font mono = new Font(parent.getDisplay(), "Monospace", 9, SWT.NONE); //$NON-NLS-1$
    fCommandText.setFont(mono);
    fCommandText.addModifyListener(e -> validateInputs());
    fCommandText.addDisposeListener(e -> mono.dispose());

    // create command error text
    fCommandErrorLabel = createErrorLabel(composite);

    applyDialogFont(composite);
    return composite;
}
 
Example 11
Source File: EvalExpressionAction.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    GridData gd = new GridData(GridData.FILL_BOTH);
    StyledText text = new StyledText(parent,
            SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
    text.setLayoutData(gd);

    text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
    text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));

    text.setText(this.text);

    return text;
}
 
Example 12
Source File: ProblemSeveritiesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite= (Composite) super.createDialogArea(parent);
	initializeDialogUnits(parent);

	GridLayout layout= (GridLayout) composite.getLayout();
	layout.numColumns= 3;
	
	int fieldWidthHint= convertWidthInCharsToPixels(60);
	
	Label intro= new Label(composite, SWT.WRAP);
	intro.setText(PreferencesMessages.NullAnnotationsConfigurationDialog_null_annotations_description);
   	intro.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, layout.numColumns, 1));
	LayoutUtil.setWidthHint(intro, fieldWidthHint);
   	
	fNullableAnnotationDialogField.doFillIntoGrid(composite, 3);
	Text text= fNullableAnnotationDialogField.getTextControl(null);
	LayoutUtil.setWidthHint(text, fieldWidthHint);
	TextFieldNavigationHandler.install(text);

	fNonNullAnnotationDialogField.doFillIntoGrid(composite, 3);
	TextFieldNavigationHandler.install(fNonNullAnnotationDialogField.getTextControl(null));
	
	fNonNullByDefaultAnnotationDialogField.doFillIntoGrid(composite, 3);
	TextFieldNavigationHandler.install(fNonNullByDefaultAnnotationDialogField.getTextControl(null));
	
	fNullableAnnotationDialogField.postSetFocusOnDialogField(parent.getDisplay());

	applyDialogFont(composite);
	return composite;
}
 
Example 13
Source File: AddElementDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private void createNoteComposite(Composite compostie) {
	// 自定义属性名称
	Label lblNote = new Label(compostie, SWT.NONE);
	lblNote.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 2, 1));
	lblNote.setText(Messages.getString("tmxeditor.addElementDialog.noteContent"));
	txtNoteContent = new Text(compostie, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
	txtNoteContent.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			getButton(Dialog.OK).setEnabled(!txtNoteContent.getText().isEmpty());
		}
	});
	GridDataFactory.swtDefaults().hint(SWT.DEFAULT, 60).span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, true)
			.applyTo(txtNoteContent);
}
 
Example 14
Source File: WarningDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void open() {
  Shell parent = getParent();
  Display display = parent.getDisplay();

  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET | SWT.RESIZE );
  shell.setImage( GUIResource.getInstance().getImageSpoon() );
  shell.setLayout( new FormLayout() );
  shell.setText( title );
  props.setLook( shell );

  Label wlImage = new Label( shell, SWT.NONE );
  wlImage.setImage( GUIResource.getInstance().getImageWarning32() );
  FormData fdWarnImage = new FormData();
  fdWarnImage.left = new FormAttachment( 0, 15 );
  fdWarnImage.top = new FormAttachment( 0, 15 );
  fdWarnImage.height = 32;
  fdWarnImage.width = 32;
  wlImage.setLayoutData( fdWarnImage );
  props.setLook( wlImage );

  Label wlMessage = new Label( shell, SWT.FLAT  | SWT.WRAP );
  wlMessage.setText( message );
  FormData fdMessage = new FormData();
  fdMessage.left = new FormAttachment( wlImage, 15, SWT.RIGHT );
  fdMessage.right = new FormAttachment( 100, -15 );
  fdMessage.top = new FormAttachment( wlImage, 0, SWT.TOP );
  wlMessage.setLayoutData( fdMessage );
  props.setLook( wlMessage );


  Button spacer = new Button( shell, SWT.NONE );
  FormData fdSpacer = new FormData();
  fdSpacer.right = new FormAttachment( 100, 0 );
  fdSpacer.bottom = new FormAttachment( 100, -15 );
  fdSpacer.left = new FormAttachment( 100, -11 );
  fdSpacer.top = new FormAttachment( wlMessage, 15, SWT.BOTTOM );
  spacer.setLayoutData( fdSpacer );
  spacer.setVisible( false );
  props.setLook( spacer );

  Control attachTo = spacer;
  for ( String label : listenerMap.keySet() ) {
    Button wButton = new Button( shell, SWT.PUSH );
    wButton.setText( label );
    FormData fdButton = new FormData();
    fdButton.right = new FormAttachment( attachTo, -Const.MARGIN, SWT.LEFT );
    fdButton.bottom = new FormAttachment( attachTo, 0, SWT.BOTTOM );
    wButton.setLayoutData( fdButton );
    wButton.addListener( SWT.Selection, listenAndDispose( listenerMap.get( label ) ) );
    props.setLook( wButton );
    attachTo = wButton;
  }
  Point point = shell.computeSize( 436, SWT.DEFAULT );
  shell.setSize( point );
  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
}
 
Example 15
Source File: WorkspaceGeneratorWizardPage1.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl(Composite container) {
	Composite parent = new Composite(container, SWT.NULL);
	setControl(parent);
	parent.setLayout(new GridLayout(1, false));

	Composite projectNameGroup = new Composite(parent, SWT.NULL);
	projectNameGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
			false, 1, 1));
	projectNameGroup.setLayout(new GridLayout(2, false));

	Label lblProjectName = new Label(projectNameGroup, SWT.WRAP);
	lblProjectName.setText("Project name:");
	txtProjectName = new Text(projectNameGroup, SWT.SINGLE | SWT.BORDER);
	txtProjectName.addKeyListener(textBoxListener);
	txtProjectName.addMouseListener(mouseListener);
	GridDataFactory.fillDefaults().grab(true, false)
			.applyTo(txtProjectName);

	Label lblGeneratorClass = new Label(projectNameGroup, SWT.WRAP);
	lblGeneratorClass.setText("Generator class:");

	txtGeneratorClass = new Text(projectNameGroup, SWT.SINGLE | SWT.BORDER);
	txtGeneratorClass.addKeyListener(textBoxListener);
	txtGeneratorClass.addMouseListener(mouseListener);
	GridDataFactory.fillDefaults().grab(true, false)
			.applyTo(txtGeneratorClass);

	Composite generatorCheckboxGroup = new Composite(parent, SWT.NULL);
	generatorCheckboxGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP,
			true, false, 1, 1));
	generatorCheckboxGroup.setLayout(new GridLayout(2, false));

	cbXtend = new Button(generatorCheckboxGroup, SWT.CHECK);
	cbXtend.setText("Use Xtend");

	ValidateCallback callback = new ValidateCallback() {
		public void validate() {
			WorkspaceGeneratorWizardPage1.this.validate();
		}
	};
	generatorComposite = new GeneratorComposite(parent, SWT.NONE, callback);
	generatorComposite.disableGeneratorClass();

	generatorComposite.setGroupEnabled(false);

	setPageComplete(false);
}
 
Example 16
Source File: UpdateDialog.java    From offspring with MIT License 4 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
  Composite container = (Composite) super.createDialogArea(parent);

  GridLayout layout = new GridLayout(1, false);
  layout.horizontalSpacing = 15;
  layout.marginTop = 10;
  layout.marginLeft = 10;

  GridData gd = new GridData(GridData.FILL, GridData.FILL, false, true);
  gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);

  mainContainer = new Composite(container, SWT.NONE);
  mainContainer.setLayoutData(gd);
  mainContainer.setLayout(layout);

  messageLabel = new Label(mainContainer, SWT.WRAP);
  messageLabel.setText("...");
  GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, false)
      .applyTo(messageLabel);

  installButton = new Button(mainContainer, SWT.PUSH);
  installButton.setText("Install Updates");
  installButton.setVisible(false);
  installButton.addSelectionListener(new SelectionAdapter() {

    @Override
    public void widgetSelected(SelectionEvent e) {
      installUpdates = true;
      hideInstallButton();
    }
  });
  GridDataFactory.swtDefaults().exclude(true).applyTo(installButton);

  progressBarComposite = new Composite(mainContainer, SWT.NONE);
  progressBarComposite.setVisible(false);
  GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, true)
      .exclude(true).applyTo(progressBarComposite);
  GridLayoutFactory.fillDefaults().numColumns(1)
      .applyTo(progressBarComposite);

  progressBar = new ProgressIndicator(progressBarComposite, SWT.SMOOTH);
  GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL)
      .applyTo(progressBar);

  mainContainer.layout();
  return container;
}
 
Example 17
Source File: StatechartTextExpressionEditPart.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected int getEditorStyles() {
	return SWT.MULTI | SWT.V_SCROLL | SWT.WRAP;
}
 
Example 18
Source File: ConfigurationSettingsWizardPage.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
protected Composite createLeftColumn(Composite composite) {
  Group leftColumn = new Group(composite, SWT.NONE);
  leftColumn.setLayout(LayoutUtils.createGridLayout(5, 0));
  leftColumn.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_left_column_connection);

  /*
   * prepare network setting composite
   */
  Composite autoconnectComposite =
      new IllustratedComposite(leftColumn, SWT.TOP, ImageManager.ELCL_XMPP_CONNECTED);
  autoconnectComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
  autoconnectComposite.setLayout(LayoutUtils.createGridLayout(0, 5));
  autoconnectComposite.setBackgroundMode(SWT.INHERIT_NONE);

  /*
   * auto connect
   */
  Label autoConnectLabel = new Label(autoconnectComposite, SWT.WRAP);
  autoConnectLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  autoConnectLabel.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_label_autoconnect);

  this.autoConnectButton = new Button(autoconnectComposite, SWT.CHECK | SWT.LEFT);
  this.autoConnectButton.setText(
      saros.ui.Messages.ConfigurationSettingsWizardPage_button_autoconnect);

  /*
   * separator
   */
  new Label(leftColumn, SWT.SEPARATOR | SWT.HORIZONTAL)
      .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

  // Gateway port mapping setting
  Composite gatewayComposite =
      new IllustratedComposite(leftColumn, SWT.TOP, ImageManager.ICON_UPNP);
  gatewayComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
  gatewayComposite.setLayout(LayoutUtils.createGridLayout(0, 5));
  gatewayComposite.setBackgroundMode(SWT.INHERIT_NONE);

  portmappingLabel = new Label(gatewayComposite, SWT.WRAP);
  portmappingLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  portmappingLabel.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_label_portmapping);

  this.setupPortmappingButton = new Button(gatewayComposite, SWT.CHECK | SWT.LEFT | SWT.WRAP);
  this.setupPortmappingButton.setText(
      saros.ui.Messages.ConfigurationSettingsWizardPage_button_portmapping);
  this.setupPortmappingButton.setToolTipText(
      saros.ui.Messages.ConfigurationSettingsWizardPage_button_portmapping_tooltip);
  setupPortmappingButton.setEnabled(false);

  Composite comboCompo = new Composite(gatewayComposite, SWT.TOP | SWT.LEFT);
  RowLayout rowLayout = new RowLayout();
  rowLayout.marginLeft = 16;
  comboCompo.setLayout(rowLayout);
  gatewaysCombo = new Combo(comboCompo, SWT.DROP_DOWN | SWT.READ_ONLY);
  gatewayInfo = new Label(comboCompo, SWT.NONE);
  gatewayInfo.setEnabled(false);

  /*
   * separator
   */
  new Label(leftColumn, SWT.SEPARATOR | SWT.HORIZONTAL)
      .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

  /*
   * skype
   */
  Composite skypeComposite =
      new IllustratedComposite(leftColumn, SWT.TOP, ImageManager.ELCL_CONTACT_SKYPE_CALL);
  skypeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
  skypeComposite.setLayout(LayoutUtils.createGridLayout(2, false, 0, 5));
  skypeComposite.setBackgroundMode(SWT.INHERIT_NONE);

  Label skypeLabel = new Label(skypeComposite, SWT.WRAP);
  skypeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
  skypeLabel.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_label_skype);

  Composite skypeUsageComposite = new Composite(skypeComposite, SWT.NONE);
  skypeUsageComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
  skypeUsageComposite.setLayout(LayoutUtils.createGridLayout(2, false, 0, 5));

  this.skypeUsageButton = new Button(skypeUsageComposite, SWT.CHECK);
  this.skypeUsageButton.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_yes_use);

  this.skypeUsernameText = new Text(skypeComposite, SWT.BORDER);
  this.skypeUsernameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

  return leftColumn;
}
 
Example 19
Source File: ColumnThumbAndName.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
private void cellPaintName(TableCell cell, GC gc, Rectangle cellBounds,
		int textX, int originalBoundxsX ) {
	String name = null;
	Object ds = cell.getDataSource();
	if (ds instanceof DiskManagerFileInfo) {
		return;
	}
	DownloadManager dm = (DownloadManager) ds;
	if (dm != null)
		name = dm.getDisplayName();
	if (name == null)
		name = "";

	GCStringPrinter sp = new GCStringPrinter(gc, name, new Rectangle(textX,
			cellBounds.y, cellBounds.x + cellBounds.width - textX,
			cellBounds.height), true, true, getTableID().endsWith( ".big" )?SWT.WRAP:SWT.NULL );
	
	boolean fit = sp.printString();

	Point p = sp.getCalculatedPreferredSize();
		
	int pref = ( textX - originalBoundxsX ) +  p.x + 10;
	
	TableColumn tableColumn = cell.getTableColumn();
	if (tableColumn != null && tableColumn.getPreferredWidth() < pref) {
		tableColumn.setPreferredWidth(pref);
	}
	
	String tooltip = fit?"":name;

	if (dm != null) {
		try{
			String desc = PlatformTorrentUtils.getContentDescription( dm.getTorrent());

			if ( desc != null && desc.length() > 0 ){
				tooltip += (tooltip.length()==0?"":"\r\n") + desc;
			}
		}catch( Throwable e ){
		}
	}
	cell.setToolTip(tooltip.length()==0?null:tooltip);
}
 
Example 20
Source File: ConfigurationSummaryWizardPage.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
protected Composite createLeftColumn(Composite composite) {
  Composite leftColumn = new Composite(composite, SWT.NONE);
  leftColumn.setLayout(LayoutUtils.createGridLayout(5, 0));
  // leftColumn.setText("Complete");

  /*
   * auto connect
   */
  Composite autoConnectComposite = new Composite(leftColumn, SWT.NONE);
  autoConnectComposite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, true));
  autoConnectComposite.setLayout(LayoutUtils.createGridLayout(0, 5));

  Label successLabel = new Label(autoConnectComposite, SWT.WRAP);
  successLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  successLabel.setText(saros.ui.Messages.ConfigurationSummaryWizardPage_label_success);
  FontUtils.makeBold(successLabel);

  SimpleNoteComposite check =
      new SimpleNoteComposite(
          autoConnectComposite,
          SWT.BORDER,
          ImageManager.ELCL_PREFERENCES_OPEN,
          saros.ui.Messages.ConfigurationSummaryWizardPage_check_settings);
  check.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  check.setSpacing(5);

  SimpleNoteComposite addContacts =
      new SimpleNoteComposite(
          autoConnectComposite,
          SWT.BORDER,
          ImageManager.ELCL_CONTACT_ADD,
          saros.ui.Messages.ConfigurationSummaryWizardPage_addContacts);

  addContacts.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  addContacts.setSpacing(5);

  SimpleNoteComposite shareProjects =
      new SimpleNoteComposite(
          autoConnectComposite,
          SWT.BORDER,
          ImageManager.ELCL_SESSION,
          saros.ui.Messages.ConfigurationSummaryWizardPage_share_project);
  shareProjects.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  shareProjects.setSpacing(5);

  return leftColumn;
}