org.eclipse.swt.widgets.Label Java Examples

The following examples show how to use org.eclipse.swt.widgets.Label. 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: SpecProcessPage.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * (non-Javadoc) Method declared on IDialogPage.
 */
@Override
public void createControl(Composite parent) {
	setPageComplete(true);
	initializeDialogUnits(parent);

	Composite composite = new Composite(parent, SWT.NULL);
	composite.setLayout(new GridLayout());
	composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));

	new Label(composite, SWT.NONE).setText("Messages:");
	createErrorGroup(composite);

	Display display = getShell().getDisplay();
	highlightColor = display.getSystemColor(SWT.COLOR_RED);

	setControl(composite);
}
 
Example #2
Source File: DefaultJavaFoldingPreferenceBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public Control createControl(Composite composite) {
	fOverlayStore.load();
	fOverlayStore.start();

	Composite inner= new Composite(composite, SWT.NONE);
	GridLayout layout= new GridLayout(1, true);
	layout.verticalSpacing= 3;
	layout.marginWidth= 0;
	inner.setLayout(layout);

	Label label= new Label(inner, SWT.LEFT);
	label.setText(FoldingMessages.DefaultJavaFoldingPreferenceBlock_title);

	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_comments, PreferenceConstants.EDITOR_FOLDING_JAVADOC, 0);
	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_headers, PreferenceConstants.EDITOR_FOLDING_HEADERS, 0);
	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_innerTypes, PreferenceConstants.EDITOR_FOLDING_INNERTYPES, 0);
	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_methods, PreferenceConstants.EDITOR_FOLDING_METHODS, 0);
	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_imports, PreferenceConstants.EDITOR_FOLDING_IMPORTS, 0);

	return inner;
}
 
Example #3
Source File: FilterViewer.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
FilterTraceTypeNodeComposite(Composite parent, TmfFilterTraceTypeNode node) {
    super(parent, node);
    fNode = node;
    fTraceTypeMap = getTraceTypeMap(fNode.getTraceTypeId());

    Label label = new Label(this, SWT.NONE);
    label.setText(Messages.FilterViewer_TypeLabel);

    fTypeCombo = new CCombo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
    fTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    fTypeCombo.setItems(fTraceTypeMap.keySet().toArray(new String[0]));
    if (fNode.getTraceTypeId() != null) {
        fTypeCombo.setText(fNode.getName());
    }
    fTypeCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TraceTypeHelper helper = checkNotNull(fTraceTypeMap.get(fTypeCombo.getText()));
            fNode.setTraceTypeId(helper.getTraceTypeId());
            fNode.setTraceClass(helper.getTraceClass());
            fNode.setName(fTypeCombo.getText());
            fViewer.refresh(fNode);
        }
    });
}
 
Example #4
Source File: SVNAbstractCompareEditorInput.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public Control createContents(Composite parent) {
	if (getCompareResult() instanceof String) {		
		
		setMessage("Testing");
		
		Composite composite = new Composite(parent, SWT.NULL);
		GridLayout layout = new GridLayout();
		layout.numColumns = 2;
		composite.setLayout(layout);
		composite.setLayoutData(new GridData(GridData.FILL_BOTH));			
		Label iconLabel = new Label(composite, SWT.WRAP);
		iconLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));			
		Label errorLabel = new Label(composite, SWT.WRAP);
		GridData gd = new GridData();
		gd.widthHint = 500;
		errorLabel.setLayoutData(gd);
		errorLabel.setText((String)getCompareResult());
		parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
		composite.setBackground(parent.getBackground());
		errorLabel.setBackground(parent.getBackground());
		iconLabel.setBackground(parent.getBackground());
		return composite;
	}
	return super.createContents(parent);
}
 
Example #5
Source File: XLIFFEditorStatusLineItemWithProgressBar.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public void fill(Composite parent) {
	super.fill(parent);
	Composite container = new Composite(parent, SWT.NONE);
	GridLayout gl = new GridLayout(2, false);
	gl.marginWidth = 5;
	gl.marginHeight = 3;
	container.setLayout(gl);

	progressBar = new ProgressBar(container, SWT.SMOOTH);
	GridData gdPprogressBar = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
	gdPprogressBar.heightHint = 16;
	gdPprogressBar.widthHint = 130;
	progressBar.setLayoutData(gdPprogressBar);
	progressBar.setMinimum(0); // 最小值
	progressBar.setMaximum(100);// 最大值
	progressBar.setSelection(progressValue);
	progressBar.setToolTipText(defaultMessage);

	label = new Label(container, SWT.None);
	label.setText(progressValue + "%");

	StatusLineLayoutData data = new StatusLineLayoutData();
	container.setLayoutData(data);
}
 
Example #6
Source File: PrimitiveQuestionnairePage.java    From CogniCrypt with Eclipse Public License 2.0 6 votes vote down vote up
private void createNote(final Composite parent, final Question question) {
	final Group notePanel = new Group(parent, SWT.NONE);
	notePanel.setText("Note:");
	final Font boldFont = new Font(notePanel.getDisplay(), new FontData(Constants.ARIAL, 10, SWT.BOLD));
	notePanel.setFont(boldFont);

	this.note = new Text(notePanel, SWT.MULTI | SWT.WRAP);
	this.note.setLayoutData(new GridData(GridData.FILL_BOTH));
	this.note.setText(Constants.DESCRIPTION_KEYSIZES);
	this.note.setBounds(10, 20, 585, 60);
	this.note.setSize(this.note.computeSize(585, SWT.DEFAULT));
	setControl(notePanel);
	this.note.setEditable(false);
	this.note.setEnabled(true);
	new Label(parent, SWT.NULL);
}
 
Example #7
Source File: ChartManager.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public ChartManager ( final Composite parent, final int style )
{
    super ( parent, style );

    setLayout ( makeLayout () );

    // title row

    this.title = new Label ( this, SWT.NONE );
    this.title.setLayoutData ( new GridData ( GridData.CENTER, GridData.FILL, true, false, 1, 1 ) );

    // row 2

    this.chartArea = new ChartArea ( this, SWT.NONE );
    this.chartArea.setLayoutData ( makeMainLayoutData () );

    addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            onDispose ();
        }
    } );
}
 
Example #8
Source File: DocumentExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void createReturnTypeComposite(final Composite parent) {
    final Composite typeComposite = new Composite(parent, SWT.NONE);
    typeComposite.setLayoutData(GridDataFactory.fillDefaults()
            .grab(true, false).create());
    final GridLayout gl = new GridLayout(2, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    typeComposite.setLayout(gl);

    final Label typeLabel = new Label(typeComposite, SWT.NONE);
    typeLabel.setText(Messages.returnType);
    typeLabel.setLayoutData(GridDataFactory.fillDefaults()
            .align(SWT.FILL, SWT.CENTER).create());

    typeText = new Text(typeComposite, SWT.BORDER | SWT.READ_ONLY);
    typeText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false)
            .align(SWT.FILL, SWT.CENTER).indent(10, 0).create());
}
 
Example #9
Source File: MoveConnectorWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createExecutionEventControl(final EMFDataBindingContext dbc, final Composite parent) {
    final Label eventLabel = new Label(parent, SWT.NONE);
    eventLabel.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create());
    eventLabel.setText(Messages.connectorEventLabel);

    final Composite eventRadioGroup = new Composite(parent, SWT.NONE);
    eventRadioGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    eventRadioGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).extendedMargins(20, 0, 0, 15).create());

    final Button inRadio = createRadioButton(eventRadioGroup, Messages.bind(Messages.connectorInChoice, ConnectorEvent.ON_ENTER.name()));
    final Button outRadio = createRadioButton(eventRadioGroup, Messages.bind(Messages.connectorOutChoice, ConnectorEvent.ON_FINISH.name()));

    final SelectObservableValue eventObservable = new SelectObservableValue(String.class);
    eventObservable.addOption(ConnectorEvent.ON_ENTER.name(), SWTObservables.observeSelection(inRadio));
    eventObservable.addOption(ConnectorEvent.ON_FINISH.name(), SWTObservables.observeSelection(outRadio));
    dbc.bindValue(eventObservable, connectorEventObservable);
}
 
Example #10
Source File: ReportConfigurationTab.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void createPriorityGroup(Composite parent) {
    Composite prioGroup = new Composite(parent, SWT.NONE);
    prioGroup.setLayout(new GridLayout(2, false));

    Label minPrioLabel = new Label(prioGroup, SWT.NONE);
    minPrioLabel.setText(getMessage("property.minPriority"));
    minPrioLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    minPriorityCombo = new Combo(prioGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    minPriorityCombo.add(ProjectFilterSettings.HIGH_PRIORITY);
    minPriorityCombo.add(ProjectFilterSettings.MEDIUM_PRIORITY);
    minPriorityCombo.add(ProjectFilterSettings.LOW_PRIORITY);
    minPriorityCombo.setText(propertyPage.getOriginalUserPreferences().getFilterSettings().getMinPriority());
    minPriorityCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    minPriorityCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            String data = minPriorityCombo.getText();
            getCurrentProps().getFilterSettings().setMinPriority(data);
        }
    });


}
 
Example #11
Source File: AddMultiplikatorDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setLayout(new GridLayout(2, false));
	Label l1 = new Label(ret, SWT.NONE);
	l1.setText(Messages.AccountView_date);
	dpc = new CDateTime(ret, CDT.HORIZONTAL | CDT.DATE_SHORT | CDT.DROP_DOWN | SWT.BORDER | CDT.TAB_FIELDS);
	String value = java.time.LocalDate.now().format(DateTimeFormatter.ofPattern("01.01.y"));
	dpc.setSelection(new TimeTool(value).getTime());
	dpc.setToolTipText(Messages.MultiplikatorEditor_PleaseEnterBeginDate);
	Label label = new Label(ret, SWT.NONE);
	label.setText(Messages.Leistungscodes_multiplierLabel);
	multi = new Text(ret, SWT.BORDER);
	multi.setTextLimit(6);
	multi.setToolTipText(Messages.MultiplikatorEditor_NewMultipilcator);
	multi.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	return ret;
}
 
Example #12
Source File: MultiResourceSelectionDialogWithFlowOption.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
  Composite composite = (Composite) super.createDialogArea(parent);

  new Label(composite, SWT.WRAP).setText(""); //$NON-NLS-1$

  String sAddToFlowPrompt = Messages
          .getString("MultiResourceSelectionDialogWithFlowOption.addSelectedAEsToEndOfFlow"); //$NON-NLS-1$
  FormToolkit factory = new FormToolkit(TAEConfiguratorPlugin.getDefault().getFormColors(
          parent.getDisplay()));

  autoAddToFlowButton = factory.createButton(composite, sAddToFlowPrompt, SWT.CHECK);
  m_bAutoAddToFlow = "false".equals(CDEpropertyPage.getAddToFlow(editor.getProject())) ? false : true;
  autoAddToFlowButton.setSelection(m_bAutoAddToFlow);
  autoAddToFlowButton.setBackground(null);

  return composite;
}
 
Example #13
Source File: TextTemplatePreferences.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void createFieldEditors(){
	Label expl = new Label(getFieldEditorParent(), SWT.WRAP);
	expl.setText(Messages.TextTemplatePreferences_ExplanationLine1
		+ Messages.TextTemplatePreferences_ExplanationLine2
		+ Messages.TextTemplatePreferences_ExplanationLine3);
	expl.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false));
	addField(new StringFieldEditor(SUFFIX_STATION, SUFFIX_FOR_THIS_STATION,
		getFieldEditorParent()));
	/*
	 * IExtensionRegistry exr = Platform.getExtensionRegistry(); IExtensionPoint exp =
	 * exr.getExtensionPoint("ch.elexis.documentTemplates"); if (exp != null) { IExtension[]
	 * extensions = exp.getExtensions(); for (IExtension ex : extensions) {
	 * IConfigurationElement[] elems = ex.getConfigurationElements(); for (IConfigurationElement
	 * el : elems) { String n=el.getAttribute("name"); addField(new StringFieldEditor(BRANCH+n,
	 * n, getFieldEditorParent())); } }
	 * 
	 * }
	 */
}
 
Example #14
Source File: DetailsDialog.java    From hop with 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 #15
Source File: IntroduceParameterObjectWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createClassNameInput(Composite result) {
	Label label= new Label(result, SWT.LEAD);
	label.setText(RefactoringMessages.IntroduceParameterObjectWizard_classnamefield_label);
	final Text text= new Text(result, SWT.SINGLE | SWT.BORDER);
	text.setText(fProcessor.getClassName());
	text.selectAll();
	text.setFocus();
	text.addModifyListener(new ModifyListener() {

		public void modifyText(ModifyEvent e) {
			fProcessor.setClassName(text.getText());
			updateSignaturePreview();
			validateRefactoring();
		}

	});
	text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
 
Example #16
Source File: CreateOrUpdataSRXDialog.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);
	GridDataFactory.fillDefaults().grab(true, true).hint(300, 50).minSize(300, 50).applyTo(tparent);

	Composite nameCmp = new Composite(tparent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp);

	Label nameLbl = new Label(nameCmp, SWT.NONE);
	nameLbl.setText(Messages.getString("srx.CreateOrUpdataSRXDialog.nameLbl"));

	nameTxt = new Text(nameCmp, SWT.BORDER);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(nameTxt);

	return tparent;
}
 
Example #17
Source File: CompositeFactory.java    From erflute with Apache License 2.0 6 votes vote down vote up
public static Combo createCombo(AbstractDialog dialog, Composite composite, String title, int span) {
    if (title != null) {
        final Label label = new Label(composite, SWT.RIGHT);
        label.setText(DisplayMessages.getMessage(title));
    }

    final GridData gridData = new GridData();
    gridData.horizontalSpan = span;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    final Combo combo = new Combo(composite, SWT.NONE);
    combo.setLayoutData(gridData);

    ListenerAppender.addComboListener(combo, dialog, false);

    return combo;
}
 
Example #18
Source File: CogniCryptPreferencePage.java    From CogniCrypt with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	final Composite container = new Composite(parent, SWT.FILL);
	container.setLayout(new GridLayout(1, true));
	notifyBasicPreferenceListeners(container);

	new Label(container, SWT.NONE);
	final ExpandableComposite collap = new ExpandableComposite(container, SWT.Collapse);
	collap.setText("Advanced Options");

	final Composite advancedOptions = new Composite(collap, SWT.None);
	collap.setClient(advancedOptions);
	advancedOptions.setLayout(new RowLayout(SWT.VERTICAL));
	notifyAdvancedPreferenceListeners(advancedOptions);

	collap.setExpanded(true);
	return container;
}
 
Example #19
Source File: CompositeFactory.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
public static Label createExampleLabel(Composite composite, String title,
		int span) {
	Label label = new Label(composite, SWT.NONE);
	label.setText(ResourceString.getResourceString(title));

	if (span > 0) {
		GridData gridData = new GridData();
		gridData.horizontalSpan = span;
		label.setLayoutData(gridData);
	}

	FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
	Font font = new Font(Display.getCurrent(), fontData.getName(), 8,
			SWT.NORMAL);
	label.setFont(font);

	return label;
}
 
Example #20
Source File: FileSelectionPage.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl ( final Composite parent )
{
    final Composite wrapper = new Composite ( parent, SWT.NONE );

    wrapper.setLayout ( new GridLayout ( 3, false ) );

    final Label label = new Label ( wrapper, SWT.NONE );
    label.setText ( Messages.FileSelectionPage_Label_OutputFile );
    label.setLayoutData ( new GridData ( SWT.CENTER, SWT.CENTER, false, false ) );

    this.text = new Text ( wrapper, SWT.SINGLE | SWT.BORDER );
    this.text.setLayoutData ( new GridData ( SWT.FILL, SWT.CENTER, true, false ) );

    final Button button = new Button ( wrapper, SWT.PUSH );
    button.setText ( Messages.FileSelectionPage_Button_Browse );
    button.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            updateFile ();
        }
    } );
    setControl ( wrapper );

    update ();
}
 
Example #21
Source File: MapSection.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite root) {
	getShell().setText("Enter GeoJSON");
	Composite area = (Composite) super.createDialogArea(root);
	UI.gridLayout(area, 1);
	new Label(area, SWT.NONE).setText(
			"See e.g. http://geojson.io for examples");
	text = new StyledText(area, SWT.MULTI | SWT.BORDER
			| SWT.V_SCROLL | SWT.H_SCROLL);
	text.setAlwaysShowScrollBars(false);
	UI.gridData(text, true, true);
	text.setText(getJsonText());
	return area;
}
 
Example #22
Source File: SWTUtils.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Update the width of the label to take into account the error font. Only works for labels in a grid layout
 * 
 * @param label
 * @param errorFont
 */
public static void updateErrorLabelWidth(Label label, Font errorFont)
{
	Object layoutData = label.getLayoutData();
	if (layoutData instanceof GridData)
	{
		Font currentFont = label.getFont();
		label.setFont(errorFont);
		((GridData) layoutData).widthHint = label.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
		label.setFont(currentFont);
	}
}
 
Example #23
Source File: ExtractConstantWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addLabel(Composite result, RowLayouter layouter) {
	fLabel= new Label(result, SWT.WRAP);
	GridData gd= new GridData(GridData.FILL_BOTH);
	gd.widthHint= convertWidthInCharsToPixels(50);
	fLabel.setLayoutData(gd);
	updatePreviewLabel();
	layouter.perform(fLabel);
}
 
Example #24
Source File: From.java    From Rel with Apache License 2.0 5 votes vote down vote up
private void addRow(Composite parent, String name) {
	Label lblNewLabel = new Label(parent, SWT.NONE);
	lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	lblNewLabel.setText(name);

	Button radioButton = new Button(parent, SWT.RADIO);
	radioButton.setSelection(name.equals(operatorLabel.getText()));
	radioButton.addListener(SWT.Selection, e -> operatorLabel.setText(name));
}
 
Example #25
Source File: DataFileOption.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create the user interface for the option
 */
public void createControl(Composite parent, int span) {
	// Create the descriptive layer
	locationLabel = new Label(parent, SWT.NONE);
	locationLabel.setText(description);

	// Create the text entry area where the path to the file will be displayed
	locationPathField = new Text(parent, SWT.BORDER);
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.widthHint = 250;
	data.horizontalSpan = 2;
	locationPathField.setLayoutData(data);

	// Create the browse button and add a listener to open a file chooser
	browseButton = new Button(parent, SWT.PUSH);
	browseButton.setText("Browse");
	browseButton.addSelectionListener(new SelectionListener() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			fileChooser = new FileDialog(parent.getShell());
			fileChooser.setText("Select File");
			fileChooser.setFilterExtensions(new String[] {"*.*"});
			chosenFile = fileChooser.open();
			locationPathField.setText(chosenFile);
			setValue(chosenFile);
		}

		@Override public void widgetDefaultSelected(SelectionEvent e) {}
	});
}
 
Example #26
Source File: SvnWizardBranchTagPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void addBugtrackingArea(Composite composite) {
Composite bugtrackingComposite = new Composite(composite, SWT.NULL);
GridLayout bugtrackingLayout = new GridLayout();
bugtrackingLayout.numColumns = 2;
bugtrackingComposite.setLayout(bugtrackingLayout);

Label label = new Label(bugtrackingComposite, SWT.NONE);
label.setText(projectProperties.getLabel());
issueText = new Text(bugtrackingComposite, SWT.BORDER);
GridData data = new GridData();
data.widthHint = 150;
issueText.setLayoutData(data);
  }
 
Example #27
Source File: WizardUtils.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
public static Label createLabel(Composite parent, String text, int span, int indent, boolean bold, int fill) {
    Label label = createLabel(parent, text, span, SWT.NONE, fill);
    if (bold) {
        label.setFont(JFaceResources.getDialogFontDescriptor().withStyle(SWT.BOLD).createFont(null));
    }
    GridData gridData = (GridData) label.getLayoutData();
    gridData.horizontalIndent = indent;    

    return label;
}
 
Example #28
Source File: AbstractIntersectionExample.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 *
 */
public AbstractIntersectionExample(String title, String... infos) {
	Display display = new Display();

	shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED);
	shell.setText(title);
	shell.setBounds(0, 0, 640, 480);
	shell.setLayout(new FormLayout());
	shell.setBackground(
			Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

	Label infoLabel = new Label(shell, SWT.NONE);
	FormData infoLabelFormData = new FormData();
	infoLabelFormData.right = new FormAttachment(100, -10);
	infoLabelFormData.bottom = new FormAttachment(100, -10);
	infoLabel.setLayoutData(infoLabelFormData);

	String infoText = "You can...";
	for (int i = 0; i < infos.length; i++) {
		infoText += "\n..." + infos[i];
	}
	infoLabel.setText(infoText);

	// open the shell before creating the controllable shapes so that their
	// default coordinates are not changed due to the resize of their canvas
	shell.open();

	controllableShape1 = createControllableShape1(shell);
	controllableShape2 = createControllableShape2(shell);

	shell.addPaintListener(this);
	shell.redraw(); // triggers a PaintEvent platform independently

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
Example #29
Source File: TreeListDialogField.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private Label createSeparator(Composite parent) {
	Label separator= new Label(parent, SWT.NONE);
	separator.setFont(parent.getFont());
	separator.setVisible(false);
	GridData gd= new GridData();
	gd.horizontalAlignment= GridData.FILL;
	gd.verticalAlignment= GridData.BEGINNING;
	gd.heightHint= 4;
	separator.setLayoutData(gd);
	return separator;
}
 
Example #30
Source File: NewDiagramWizardPage2.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    final Composite composite = new Composite(parent, SWT.NULL);

    final GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    composite.setLayout(layout);

    final Label label = new Label(composite, SWT.NULL);
    label.setText(ResourceString.getResourceString("label.database"));

    databaseCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
    final GridData dbData = new GridData(GridData.FILL_HORIZONTAL);
    dbData.widthHint = 200;
    databaseCombo.setLayoutData(dbData);
    databaseCombo.setVisibleItemCount(10);

    for (final String db : DBManagerFactory.getAllDBList()) {
        databaseCombo.add(db);
    }

    databaseCombo.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(final ModifyEvent e) {
            validatePage();
        }
    });

    databaseCombo.setFocus();

    validatePage();

    setControl(composite);
}