Java Code Examples for org.eclipse.swt.widgets.Label.setFont()

The following are Jave code examples for showing how to use setFont() of the org.eclipse.swt.widgets.Label class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ide-plugins   File: PluginDialog.java   View Source Code Vote up 6 votes
protected void createTopContent(String title, InputStream imageName) {
    Composite top = new Composite(composite, SWT.NONE);

    top.setLayout(new GridLayout(2, false));
    top.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    top.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    
    final Image image = new Image(top.getDisplay(), imageName);
    Image resized = resizeImage(image, 48, 48);
    Label labelImage = new Label(top, SWT.CENTER);
    labelImage.setImage(resized);
    
    Label label = new Label(top, SWT.NONE);
    label.setText(title);
    final Font newFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
    label.setFont(newFont);
    label.setBackground(rowColorSelection);
    
    createLineContent();
    
    top.addDisposeListener(e -> {
        newFont.dispose();
        resized.dispose();
    });
}
 
Example 2
Project: convertigo-eclipse   File: SqlQueryEditorComposite.java   View Source Code Vote up 6 votes
private void initialize() {
	labelSyntaxe = new Label(this, SWT.NONE);
	
	labelSyntaxe.setText("SQL query syntax examples :\n");
	labelSyntaxe.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
	labelSQLQuery = new Label(this, SWT.NONE);
	labelSQLQuery.setFont(new Font(null,"Tahoma",8,1));
	labelSQLQuery.setText("SELECT * FROM EMPLOYEES WHERE (NAME='{parameter_name}')\n"
							+ "{? = CALL STORED_FUNCTION({parameter_name})}\n"
							+ "{CALL STORED_PROCEDURE({parameter_name})}\n\n");
	labelSQLQuery.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
	textAreaSQLQuery = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	textAreaSQLQuery.setFont(new Font(null,"Tahoma",10,0));
	textAreaSQLQuery.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
	GridLayout gridLayout = new GridLayout();
	this.setLayout(gridLayout);
	setSize(new org.eclipse.swt.graphics.Point(402,289));
}
 
Example 3
Project: APITools   File: ShortcutKeyExplain.java   View Source Code Vote up 6 votes
private void createContents(String str) {
	aboutToolsShell = new Shell(getParent(), getStyle());
	aboutToolsShell.setImage(SWTResourceManager.getImage(ShortcutKeyExplain.class, Resource.IMAGE_ICON));
	aboutToolsShell.setSize(400, 391);
	aboutToolsShell.setText(getText());
	PubUtils.setCenterinParent(getParent(), aboutToolsShell);

	Link link = new Link(aboutToolsShell, SWT.NONE);
	link.setBounds(143, 336, 108, 17);
	link.setText("<a>www.itlaborer.com</a>");
	link.addSelectionListener(new LinkSelection());

	StyledText readMeTextLabel = new StyledText(aboutToolsShell,
			SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL);
	readMeTextLabel.setBounds(3, 33, 389, 297);
	readMeTextLabel.setText(str);

	Label label_2 = new Label(aboutToolsShell, SWT.NONE);
	label_2.setFont(org.eclipse.wb.swt.SWTResourceManager.getFont("微软雅黑", 9, SWT.BOLD));
	label_2.setText("快捷键说明:");
	label_2.setBounds(3, 12, 136, 17);
}
 
Example 4
Project: ide-plugins   File: CodeSWT.java   View Source Code Vote up 5 votes
@Override
protected Control createButtonBar(Composite parent) {
    final Composite buttonBar = (Composite) super.createButtonBar(parent);

    errorLabel = new Label(buttonBar, SWT.LEFT);
    errorLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
    errorLabel.setText("There are no defined remote functions");
    errorLabel.setForeground(display.getSystemColor(SWT.COLOR_RED));
    errorLabel.setVisible(false);
    errorLabel.setFont(topFont);
    errorLabel.moveAbove(super.buttonControl);

    return buttonBar;
}
 
Example 5
Project: ide-plugins   File: AccountSWT.java   View Source Code Vote up 5 votes
@Override
protected Control createButtonBar(Composite parent) {
    final Composite buttonBar = (Composite) super.createButtonBar(parent);

    errorLabel = new Label(buttonBar, SWT.LEFT);
    errorLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
    errorLabel.setText("The provided credentials are invalid");
    errorLabel.setForeground(display.getSystemColor(SWT.COLOR_RED));
    errorLabel.setVisible(false);
    errorLabel.setFont(topFont);
    errorLabel.moveAbove(super.buttonControl);
    
    return buttonBar;
}
 
Example 6
Project: gemoc-studio-modeldebugging   File: AskLanguageNameWizardPage.java   View Source Code Vote up 5 votes
@Override
public void createControl(Composite parent) {
       // project specification group
       Composite composite = new Composite(parent, SWT.NONE);
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       composite.setLayout(layout);
       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

       // new project label
       Label label = new Label(composite, SWT.NONE);
       label.setText("Language name");
       label.setFont(parent.getFont());

       // new project name entry field
       _nameField = new Text(composite, SWT.BORDER);
       GridData data = new GridData(GridData.FILL_HORIZONTAL);
       data.widthHint = SIZING_TEXT_FIELD_WIDTH;
       _nameField.setLayoutData(data);
       _nameField.setFont(parent.getFont());

       // Set the initial value first before listener
       // to avoid handling an event during the creation.
       if (_initialLanguageName != null) {
		_nameField.setText(_initialLanguageName);
	}
       _nameField.addListener(SWT.Modify, nameModifyListener);
       BidiUtils.applyBidiProcessing(_nameField, BidiUtils.BTD_DEFAULT);	
       setControl(composite);
}
 
Example 7
Project: OCCI-Studio   File: NewConfigurationWizard.java   View Source Code Vote up 5 votes
@Override
protected WizardNewFileCreationPage createNewFilePage() {
	return new NewFilePage(getSelection(), fileExt) {
		@Override
		public void createControl(Composite parent) {
			super.createControl(parent);
			Composite control = (Composite) getControl();

			Composite extensionGroup = new Composite(control, SWT.NONE);
			GridLayout layout = new GridLayout();
			layout.numColumns = 2;
			extensionGroup.setLayout(layout);
			extensionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

			Label refOccieLabel = new Label(extensionGroup, SWT.NONE);
			refOccieLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
			refOccieLabel.setText(Messages.NewExtensionWizard_RefExtensionLabel);
			refOccieLabel.setFont(parent.getFont());

			Composite composite = new Composite(extensionGroup, SWT.NULL);
			GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
			composite.setLayoutData(layoutData);
			TableColumnLayout tableLayout = new TableColumnLayout();
			composite.setLayout(tableLayout);

			Table table = new Table(composite,
					SWT.CHECK | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
			refExtensionViewer = new CheckboxTableViewer(table);

			refExtensionViewer.setContentProvider(ArrayContentProvider.getInstance());

			Collection<String> registeredExtensions = new ArrayList<String>(
					OcciRegistry.getInstance().getRegisteredExtensions());
			refExtensionViewer.setInput(registeredExtensions);
		}
	};
}
 
Example 8
Project: Hydrograph   File: ParameterGridDialog.java   View Source Code Vote up 5 votes
private void attachNote(final Composite container) {
	Label lblParameterGridNote=new Label(container, SWT.NONE);
	FontData fontData = lblParameterGridNote.getFont().getFontData()[0];
	Font font = new Font(lblParameterGridNote.getDisplay(), new FontData(fontData.getName(), fontData
	    .getHeight(), SWT.ITALIC));
	lblParameterGridNote.setText("Note - New parameters will be visible only after you save the job.");
	lblParameterGridNote.setFont(font);
	
	if(!visibleParameterGirdNote)
		lblParameterGridNote.setVisible(false);
}
 
Example 9
Project: Hydrograph   File: JobRunPreferenceComposite.java   View Source Code Vote up 5 votes
/**
 * Create console buffer widget
 * @param bufferSize
 */
private void createConsoleBufferWidget(String bufferSize){
	HydroGroup hydroGroup = new HydroGroup(this, SWT.NONE);
	
	hydroGroup.setHydroGroupText(Messages.HYDROGRAPH_CONSOLE_PREFERANCE_PAGE_GROUP_NAME);
	hydroGroup.setLayout(new GridLayout(1, false));
	hydroGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	hydroGroup.getHydroGroupClientArea().setLayout(new GridLayout(2, false));
	
	Label label = new Label(hydroGroup.getHydroGroupClientArea(), SWT.NONE);
	
	label.setText(Messages.PREFERANCE_CONSOLE_BUFFER_SIZE);
	
	textWidget = new Text(hydroGroup.getHydroGroupClientArea(), SWT.BORDER);
	textWidget.setText(bufferSize);
	textWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	textWidget.setTextLimit(6);
	
	attachConsoleBufferValidator();
	
	Composite purgeComposite = new Composite(hydroGroup.getHydroGroupClientArea(), SWT.NONE);
	purgeComposite.setLayout(new GridLayout(2, false));
	purgeComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
	
	Label lblNote = new Label(purgeComposite, SWT.TOP | SWT.WRAP);
	lblNote.setText(Messages.PREFERANCE_PAGE_NOTE);
	FontData fontData = lblNote.getFont().getFontData()[0];
	Font font = new Font(purgeComposite.getDisplay(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
	lblNote.setFont(font);
	Label lblmsg = new Label(purgeComposite, SWT.TOP | SWT.WRAP);
	lblmsg.setText(Messages.UI_PERFORMANCE_NOTE_IN_CASE_OF_CHANGE_IN_BUFFER_SIZE);
	
}
 
Example 10
Project: BiglyBT   File: SubscriptionWizard.java   View Source Code Vote up 5 votes
private void populateHeader(Composite header) {
	header.setBackground(Colors.getSystemColor(display, SWT.COLOR_WHITE));
	title = new Label(header, SWT.WRAP);

	title.setFont(titleFont);

	FillLayout layout = new FillLayout();
	layout.marginHeight = 10;
	layout.marginWidth = 10;
	header.setLayout(layout);

}
 
Example 11
Project: openaudible   File: BookInfoPanel.java   View Source Code Vote up 5 votes
private GridComposite createStatsView(GridComposite parent) {
    GridComposite c = null;
    if (true) {
        c = new GridComposite(parent, SWT.BORDER_DOT);

        c.initLayout(2, false, GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
        c.noMargins();


        c.getGridData().horizontalIndent = 0;
        c.getGridData().verticalIndent = 0;
        // c.debugLayout(SWT.COLOR_BLUE);

    } else {
        c = parent;
    }

    for (BookElement s : elems) {


        String labelName = getName(s);
        Label l = c.newLabel();
        l.setText(Translate.getInstance().labelName(labelName) + ": ");
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        l.setFont(FontShop.tableFontBold());
        l.setBackground(bgColor);

        Label d = c.newLabel();
        d.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        d.setFont(FontShop.tableFont());
        d.setBackground(bgColor);
        d.setData(s);
        stats[s.ordinal()] = d;
    }
    return c;
}
 
Example 12
Project: openaudible   File: StatusPanel.java   View Source Code Vote up 5 votes
StatusPanel(Composite c) {
    super(c, SWT.NONE);
    initLayout(2, false, GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);

    BookNotifier.getInstance().addListener(this);
    ConnectionNotifier.getInstance().addListener(this);

    Status elems[] = Status.values();
    stats = new Label[elems.length];


    for (int x = 0; x < elems.length; x++) {
        if (!elems[x].display())
            continue;
        String labelName = elems[x].displayName();
        Label l = newLabel();
        l.setText(Translate.getInstance().labelName(labelName) + ": ");
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        l.setFont(FontShop.tableFontBold());
        l.setBackground(bgColor);

        Label d = newLabel();
        GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
        // gd.widthHint=120;
        d.setLayoutData(gd);

        d.setFont(FontShop.tableFont());
        d.setBackground(bgColor);
        d.setData(elems[x]);
        stats[x] = d;
    }

    _update();
}
 
Example 13
Project: n4js   File: N4IDEXpectView.java   View Source Code Vote up 4 votes
@Override
public void createPartControl(Composite parent) {

	FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
	fillLayout.marginHeight = 5;
	fillLayout.marginWidth = 5;
	parent.setLayout(fillLayout);

	// main container
	container = new Composite(parent, SWT.BORDER);
	container.setLayout(new FillLayout());

	// create container for stack trace data
	Composite stacktraceDataContainer = new Composite(parent, SWT.BORDER);

	FormLayout formLayout = new FormLayout();
	formLayout.marginHeight = 5;
	formLayout.marginWidth = 5;
	formLayout.spacing = 5;
	stacktraceDataContainer.setLayout(formLayout);

	Composite stackLabelContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackLabelContainer.setLayout(new GridLayout());

	FormData stackLabelFormData = new FormData();
	stackLabelFormData.top = new FormAttachment(0);
	stackLabelFormData.left = new FormAttachment(0);
	stackLabelFormData.right = new FormAttachment(100);
	stackLabelFormData.bottom = new FormAttachment(20);
	stackLabelContainer.setLayoutData(stackLabelFormData);

	Composite stackTraceContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackTraceContainer.setLayout(new FillLayout());

	FormData stackTraceFormData = new FormData();
	stackTraceFormData.top = new FormAttachment(stackLabelContainer);
	stackTraceFormData.left = new FormAttachment(0);
	stackTraceFormData.right = new FormAttachment(100);
	stackTraceFormData.bottom = new FormAttachment(100);
	stackTraceContainer.setLayoutData(stackTraceFormData);

	// Create viewer for test tree in main container
	testTreeViewer = new TreeViewer(container);
	testTreeViewer.setContentProvider(new XpectContentProvider());
	testTreeViewer.setLabelProvider(new XpectLabelProvider(this.testsExecutionStatus));
	testTreeViewer.setInput(null);

	// create stack trace label
	stacktraceLabel = new Label(stackLabelContainer, SWT.SHADOW_OUT);
	FontData fontData = stacktraceLabel.getFont().getFontData()[0];
	Display display = Display.getCurrent();
	// may be null if outside the UI thread
	if (display == null)
		display = Display.getDefault();
	Font font = new Font(display, new FontData(fontData.getName(), fontData
			.getHeight(), SWT.BOLD));
	// Make stack trace label bold
	stacktraceLabel.setFont(font);

	stacktraceLabel.setText(NO_TRACE_MSG);

	// create stack trace console
	MessageConsole messageConsole = new MessageConsole("trace", null);
	stacktraceConsole = new TraceConsole(messageConsole);
	stacktraceConsoleViewer = new TextConsoleViewer(stackTraceContainer, messageConsole);

	// context menu
	getSite().setSelectionProvider(testTreeViewer);
	MenuManager contextMenu = new MenuManager();
	contextMenu.setRemoveAllWhenShown(true);
	getSite().registerContextMenu(contextMenu, testTreeViewer);
	Control control = testTreeViewer.getControl();
	Menu menu = contextMenu.createContextMenu(control);
	control.setMenu(menu);
	activateContext();

	createSelectionActions();

}
 
Example 14
Project: n4js   File: AbstractN4JSPreferencePage.java   View Source Code Vote up 4 votes
/** copied from PropertyAndPreferencePage */
@Override
protected Label createDescriptionLabel(Composite parent) {
	parentComposite = parent;
	if (isProjectPreferencePage()) {
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setFont(parent.getFont());
		GridLayout layout = new GridLayout();
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		layout.numColumns = 2;
		composite.setLayout(layout);
		composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

		IDialogFieldListener listener = new IDialogFieldListener() {
			@Override
			public void dialogFieldChanged(DialogField dialogField) {
				boolean enabled = ((SelectionButtonDialogField) dialogField).isSelected();
				enableProjectSpecificSettings(enabled);
				projectSpecificChanged = true;

				if (enabled && getData() != null) {
					applyData(getData());
				}
			}
		};

		useProjectSettings = new SelectionButtonDialogField(SWT.CHECK);
		useProjectSettings.setDialogFieldListener(listener);
		useProjectSettings
				.setLabelText(org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_useprojectsettings_label);
		useProjectSettings.doFillIntoGrid(composite, 1);
		LayoutUtil.setHorizontalGrabbing(useProjectSettings.getSelectionButton(null));

		if (offerLink()) {
			changeWorkspaceSettings = createLink(composite,
					org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_useworkspacesettings_change);
			changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
		} else {
			LayoutUtil.setHorizontalSpan(useProjectSettings.getSelectionButton(null), 2);
		}

		Label horizontalLine = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
		horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
		horizontalLine.setFont(composite.getFont());
	} else if (supportsProjectSpecificOptions() && offerLink()) {
		changeWorkspaceSettings = createLink(
				parent,
				org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_showprojectspecificsettings_label);
		changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false));
	}

	return super.createDescriptionLabel(parent);
}
 
Example 15
Project: OCCI-Studio   File: NewConnectorWizard.java   View Source Code Vote up 4 votes
@Override
public void createControl(Composite parent) {
	super.createControl(parent);
	Composite control = (Composite) getControl();

	Composite extensionGroup = new Composite(control, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	extensionGroup.setLayout(layout);
	extensionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	Label refOccieLabel = new Label(extensionGroup, SWT.NONE);
	refOccieLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
	refOccieLabel.setText(Messages.NewConnectorWizard_RefExtensionLabel);
	refOccieLabel.setFont(parent.getFont());

	Composite composite = new Composite(extensionGroup, SWT.NULL);
	GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
	composite.setLayoutData(layoutData);
	TableColumnLayout tableLayout = new TableColumnLayout();
	composite.setLayout(tableLayout);

	Table table = new Table(composite,
			SWT.CHECK | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
	refExtensionViewer = new CheckboxTableViewer(table);

	refExtensionViewer.setContentProvider(ArrayContentProvider.getInstance());

	refExtensionViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			setPageComplete(validatePage());
		}
	});

	Collection<String> registeredExtensions = new ArrayList<String>(
			OcciRegistry.getInstance().getRegisteredExtensions());
	// removed the OCCI core extension as it is added by default.
	registeredExtensions.remove(OcciCoreConstants.OCCI_CORE_SCHEME);
	refExtensionViewer.setInput(registeredExtensions);
}
 
Example 16
Project: n4js   File: ExportSelectionPage.java   View Source Code Vote up 4 votes
/**
 * Create the export destination specification widgets
 *
 * @param parent
 *            org.eclipse.swt.widgets.Composite
 */
@SuppressWarnings("unused")
@Override
protected void createDestinationGroup(Composite parent) {

	Font font = parent.getFont();
	// destination specification group
	Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 3;
	destinationSelectionGroup.setLayout(layout);
	destinationSelectionGroup.setLayoutData(new GridData(
			GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
	destinationSelectionGroup.setFont(font);

	Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
	destinationLabel.setText("npm Target Folder");
	destinationLabel.setFont(font);

	// destination name entry field
	destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE
			| SWT.BORDER);
	destinationNameField.addListener(SWT.Modify, this);
	destinationNameField.addListener(SWT.Selection, this);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.GRAB_HORIZONTAL);
	data.widthHint = SIZING_TEXT_FIELD_WIDTH;
	destinationNameField.setLayoutData(data);
	destinationNameField.setFont(font);
	BidiUtils.applyBidiProcessing(destinationNameField, StructuredTextTypeHandlerFactory.FILE);

	// destination browse button
	destinationBrowseButton = new Button(destinationSelectionGroup,
			SWT.PUSH);
	destinationBrowseButton.setText(DataTransferMessages.DataTransfer_browse);
	destinationBrowseButton.addListener(SWT.Selection, this);
	destinationBrowseButton.setFont(font);
	setButtonLayoutData(destinationBrowseButton);

	new Label(parent, SWT.NONE); // vertical spacer
}
 
Example 17
Project: convertigo-eclipse   File: CouchVariablesComposite.java   View Source Code Vote up 4 votes
private void addToComposite(Group choosenGroup, final String name, final String description, final boolean isMultiValued) {
	boolean isNotChecked = true;
	
	if (allVariables != null) {
		isNotChecked = !isChecked(allVariables, name);
	}
	
	if (isNotChecked) {
		final Button checkBtn = new Button(choosenGroup, SWT.CHECK);	
		checkBtn.addListener(SWT.Selection, new Listener() {
			
			@Override
			public void handleEvent(Event event) {
				if (checkBtn.getSelection()) {
					selectedVariable.add(new CouchVariable(name, description, isMultiValued));
				} else {
					selectedVariable.remove(getIndex(name, selectedVariable));
				}
			}
		});
		
		Label labelName = new Label(choosenGroup, SWT.NONE);
		FontData fontData = labelName.getFont().getFontData()[0];
		Font font = new Font(this.getDisplay(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
		labelName.setFont(font);
		
		String label = name;
		if (label.startsWith("p_") || label.startsWith("q_")) {
			label = name.substring(2);
		}
		if (isMultiValued) {
			label += " [ ]";
		}			
		
		labelName.setText(label);
		
		C8oBrowser browserDescription = new C8oBrowser(choosenGroup, SWT.MULTI | SWT.WRAP);
		browserDescription.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
		browserDescription.setText("<html>" +
				"<head>" +
				"<script type=\"text/javascript\">"+
			        "document.oncontextmenu = new Function(\"return false\");"+
			    "</script>"+
						"<style type=\"text/css\">"+
							  "body {"+
							    "font-family: Tahoma new, sans-serif;" +
							    "font-size: 0.7em;"+
							    "margin-top: 5px;" +
							    "overflow-y: auto;" +
							    "background-color: #ECEBEB }"+
						"</style></head><p>" + description + "</p></html>");

		parametersCouch.add(name);
	}
}
 
Example 18
Project: APITools   File: AboutTools.java   View Source Code Vote up 4 votes
private void createContents(String exlplain, String version) {
	aboutToolsShell = new Shell(getParent(), getStyle());
	aboutToolsShell.setImage(SWTResourceManager.getImage(AboutTools.class, Resource.IMAGE_ICON));
	aboutToolsShell.setSize(400, 391);
	aboutToolsShell.setText(getText());
	PubUtils.setCenterinParent(getParent(), aboutToolsShell);

	Label copyRightlabel = new Label(aboutToolsShell, SWT.CENTER);
	copyRightlabel.setBounds(10, 311, 375, 17);
	copyRightlabel.setText(Resource.AUTHOR);

	Link link = new Link(aboutToolsShell, SWT.NONE);
	link.setBounds(143, 336, 108, 17);
	link.setText("<a>www.itlaborer.com</a>");
	link.addSelectionListener(new LinkSelection());

	Label versionLabel = new Label(aboutToolsShell, SWT.NONE);
	versionLabel.setAlignment(SWT.CENTER);
	versionLabel.setBounds(156, 288, 82, 17);
	versionLabel.setText(version);

	StyledText readMeTextLabel = new StyledText(aboutToolsShell,
			SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL);
	readMeTextLabel.setBounds(3, 33, 389, 114);
	readMeTextLabel.setText(exlplain);

	StyledText lblgplV = new StyledText(aboutToolsShell, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL);
	lblgplV.setText(
			"Copyright itlaborer.com\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.");
	lblgplV.setBounds(3, 176, 389, 106);

	Label label_1 = new Label(aboutToolsShell, SWT.NONE);
	label_1.setFont(org.eclipse.wb.swt.SWTResourceManager.getFont("微软雅黑", 9, SWT.BOLD));
	label_1.setText("Apache License:");
	label_1.setBounds(3, 155, 136, 17);

	Label label_2 = new Label(aboutToolsShell, SWT.NONE);
	label_2.setFont(org.eclipse.wb.swt.SWTResourceManager.getFont("微软雅黑", 9, SWT.BOLD));
	label_2.setText("软件说明:");
	label_2.setBounds(3, 12, 136, 17);
}
 
Example 19
Project: com.onpositive.prefeditor   File: FolderSelectionDialog.java   View Source Code Vote up 4 votes
protected Control createDialogArea(Composite parent) {
      // create composite
      Composite composite = (Composite) super.createDialogArea(parent);
      // create message
      if (message != null) {
          Label label = new Label(composite, SWT.WRAP);
          label.setText(message);
          GridData data = new GridData(GridData.GRAB_HORIZONTAL
                  | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
                  | GridData.VERTICAL_ALIGN_CENTER);
          data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
          label.setLayoutData(data);
          label.setFont(parent.getFont());
      }
      viewer = new ComboViewer(composite);
      viewer.setContentProvider(new ArrayContentProvider());
      viewer.addSelectionChangedListener(new ISelectionChangedListener() {
	
	@Override
	public void selectionChanged(
			SelectionChangedEvent event) {
		valueSelected(valueFromSelection(event.getSelection())); 
	}
});
      viewer.setLabelProvider(new LabelProvider() {
      	@Override
      	public String getText(Object element) {
      		if (element instanceof String) {
      			return PrefUIUtil.getFolderLabel((String) element, MAX_FOLDER_PATH_LEN);
      		}
      		return super.getText(element);
      	}
      });
      viewer.getControl().setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      
      createLink(composite, "From folder", ()->addFolder());
      
      createLink(composite, "From workspace prefs", ()->addWorkspace());
      
      createLink(composite, "From installation", ()->addInstallation());
      
      createLink(composite, "From launch config", ()->addLaunchCfg());
      
      errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
      errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      errorMessageText.setBackground(errorMessageText.getDisplay()
              .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
      // Set the error message text
      // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
      setErrorMessage(errorMessage);

      applyDialogFont(composite);
      return composite;
  }
 
Example 20
Project: Hydrograph   File: ImportEngineXmlWizardPage.java   View Source Code Vote up 4 votes
protected void createAdvancedControls(Composite parent) {
	LOGGER.debug("Creating Import Engine XML layout");
	Composite fileSelectionArea = new Composite(parent, SWT.NONE);
	fileSelectionArea.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));

	GridLayout fileSelectionLayout = new GridLayout();
	fileSelectionLayout.makeColumnsEqualWidth = false;
	fileSelectionLayout.marginWidth = 0;
	fileSelectionLayout.marginHeight = 0;
	fileSelectionArea.setLayout(fileSelectionLayout);

	editor = new FileFieldEditor("fileSelect", Messages.SELECT_FILE_LABEL_TEXT, fileSelectionArea);
	editor.getTextControl(fileSelectionArea).addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			IPath path = new Path(ImportEngineXmlWizardPage.this.editor.getStringValue());
			if (path.segment(0) != null) {
				targetxmlFilePath = editor.getStringValue();
				setFileName(path.lastSegment());
			} else {
				targetxmlFilePath = null;
				displayError();
			}
		}
	});
	String[] extensions = new String[] { ALLOWED_EXTENSIONS }; // NON-NLS-1
	editor.setFileExtensions(extensions);
	fileSelectionArea.moveAbove(null);

	Composite fileSelectionArea2 = new Composite(parent, SWT.NONE);
	fileSelectionArea2.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
	GridLayout fileSelectionLayout2 = new GridLayout();
	fileSelectionLayout2.numColumns = 2;

	fileSelectionLayout2.makeColumnsEqualWidth = false;
	fileSelectionLayout2.marginWidth = 0;
	fileSelectionLayout2.marginHeight = 0;
	fileSelectionArea2.setLayout(fileSelectionLayout2);
	Font fontNote = new Font(fileSelectionArea2.getDisplay(), TIMES_NEW_ROMAN_BALTIC_FONT, 9, SWT.BOLD);
	Label lblNoteHeader = new Label(fileSelectionArea2, SWT.NONE);
	lblNoteHeader.setText(Messages.NOTE_LABEL_HEADER_TEXT);
	lblNoteHeader.setFont(fontNote);
	Label lblNote = new Label(fileSelectionArea2, SWT.NONE);

	GridData gd_lblNote = new GridData(SWT.BOTTOM, SWT.CENTER, false, false, 1, 1);
	gd_lblNote.widthHint = 391;
	lblNote.setLayoutData(gd_lblNote);
	lblNote.setText(Messages.NOTE_MESSAGE_TEXT);

}