Search in sources :

Example 26 with Font

use of org.eclipse.swt.graphics.Font in project tdi-studio-se by Talend.

the class LibSelectionComposite method createControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
     */
public void createControl(Composite parent) {
    Font font = parent.getFont();
    // Composite comp = new Composite(parent, SWT.NONE);
    GridLayout topLayout = new GridLayout();
    topLayout.numColumns = 2;
    this.setLayout(topLayout);
    GridData gd;
    // Label label = new Label(this, SWT.NONE);
    // label.setText("Libraries Selection:");
    // gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    // gd.horizontalSpan = 2;
    // label.setLayoutData(gd);
    libListViewer = new LibListViewer(this);
    libListViewer.getControl().setFont(font);
    gd = new GridData(GridData.FILL_BOTH);
    // gd.horizontalSpan = 7;
    gd.heightHint = 100;
    gd.widthHint = 240;
    libListViewer.getControl().setLayoutData(gd);
    LibListProvider provider = new LibListProvider();
    libListViewer.setLabelProvider(provider);
    libListViewer.setContentProvider(provider);
    Composite pathButtonComp = new Composite(this, SWT.NONE);
    GridLayout pathButtonLayout = new GridLayout();
    pathButtonLayout.marginHeight = 0;
    pathButtonLayout.marginWidth = 0;
    pathButtonComp.setLayout(pathButtonLayout);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    // gd.horizontalSpan = 2;
    pathButtonComp.setLayoutData(gd);
    pathButtonComp.setFont(font);
    createPathButtons(pathButtonComp);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) LibListProvider(org.talend.componentdesigner.ui.composite.provider.LibListProvider) Font(org.eclipse.swt.graphics.Font)

Example 27 with Font

use of org.eclipse.swt.graphics.Font in project tdi-studio-se by Talend.

the class FontProviderMapper method getFont.

public static Font getFont(FontInfo fontInfo) {
    Font fontFromCache = fontsCache.get(fontInfo);
    if (fontFromCache != null) {
        return fontFromCache;
    }
    Font font = new Font(Display.getCurrent(), fontInfo.getFontDatas());
    fontsCache.put(fontInfo, font);
    return font;
}
Also used : Font(org.eclipse.swt.graphics.Font)

Example 28 with Font

use of org.eclipse.swt.graphics.Font in project tdi-studio-se by Talend.

the class FontProviderMapper method releaseFonts.

/**
     * DOC amaumont Comment method "release".
     */
public static void releaseFonts() {
    Collection<Font> fonts = fontsCache.values();
    for (Font font : fonts) {
        if (!font.isDisposed()) {
            font.dispose();
        }
    }
    fontsCache.clear();
}
Also used : Font(org.eclipse.swt.graphics.Font)

Example 29 with Font

use of org.eclipse.swt.graphics.Font in project tdi-studio-se by Talend.

the class LoginAgreementPage method createControl.

@Override
public void createControl(Composite parentCtrl) {
    Composite container = new Composite(parentCtrl, SWT.NONE);
    container.setLayout(new FormLayout());
    Label titleLabel = new Label(container, SWT.WRAP);
    titleLabel.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    titleLabel.setText(Messages.getString("LoginAgreementPage.title"));
    FormData titleLabelFormData = new FormData();
    titleLabelFormData.left = new FormAttachment(0, 0);
    titleLabelFormData.top = new FormAttachment(0, 0);
    titleLabel.setLayoutData(titleLabelFormData);
    acceptButton = new Button(container, SWT.CENTER);
    acceptButton.setBackground(backgroundColor);
    acceptButton.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    acceptButton.setText(Messages.getString("LoginAgreementPage.accept"));
    FormData acceptButtonFormLayoutData = new FormData();
    acceptButtonFormLayoutData.bottom = new FormAttachment(100, 0);
    acceptButtonFormLayoutData.right = new FormAttachment(100, 0);
    acceptButtonFormLayoutData.left = new FormAttachment(100, -1 * LoginDialogV2.getNewButtonSize(acceptButton).x);
    acceptButton.setLayoutData(acceptButtonFormLayoutData);
    boolean haveHtmlDesc = false;
    FileInputStream licenseInputStream = null;
    String licenseFileBasePath = Platform.getInstallLocation().getURL().getPath();
    if (Boolean.parseBoolean(System.getProperty("USE_BROWSER"))) {
        //$NON-NLS-1$
        File htmlFile = new File(licenseFileBasePath + LICENSE_FILE_PATH_HTML);
        if (htmlFile.exists()) {
            try {
                licenseInputStream = new FileInputStream(htmlFile);
                if (licenseInputStream != null) {
                    haveHtmlDesc = true;
                }
            } catch (FileNotFoundException e) {
                CommonExceptionHandler.process(e);
            }
        }
    }
    if (licenseInputStream == null) {
        try {
            licenseInputStream = new FileInputStream(licenseFileBasePath + LICENSE_FILE_PATH);
        } catch (FileNotFoundException e) {
            CommonExceptionHandler.process(e);
        }
    }
    FormData clufLayoutData = new FormData();
    clufLayoutData.top = new FormAttachment(titleLabel, LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.BOTTOM);
    clufLayoutData.left = new FormAttachment(0, 0);
    clufLayoutData.right = new FormAttachment(100, 0);
    clufLayoutData.bottom = new FormAttachment(acceptButton, -1 * LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
    if (haveHtmlDesc) {
        clufBrowser = new Browser(container, SWT.BORDER);
        clufBrowser.setText(getLicense(licenseInputStream));
        clufBrowser.setLayoutData(clufLayoutData);
    } else {
        clufText = new Text(container, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL | SWT.LEFT | SWT.BORDER);
        clufText.setBackground(new Color(null, 255, 255, 255));
        //$NON-NLS-1$
        Font font = new Font(DisplayUtils.getDisplay(), "courier", 10, SWT.NONE);
        clufText.setFont(font);
        clufText.setEditable(false);
        clufText.setText(getLicense(licenseInputStream));
        clufText.setLayoutData(clufLayoutData);
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) Label(org.eclipse.swt.widgets.Label) FileNotFoundException(java.io.FileNotFoundException) Text(org.eclipse.swt.widgets.Text) FileInputStream(java.io.FileInputStream) Font(org.eclipse.swt.graphics.Font) Button(org.eclipse.swt.widgets.Button) File(java.io.File) FormAttachment(org.eclipse.swt.layout.FormAttachment) Browser(org.eclipse.swt.browser.Browser)

Example 30 with Font

use of org.eclipse.swt.graphics.Font in project tdi-studio-se by Talend.

the class ReconcilerViewer method initializeViewer.

protected void initializeViewer(IDocument document) {
    fAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
    setDocument(document);
    installViewerConfiguration();
    setEditable(true);
    Font font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
    getTextWidget().setFont(font);
    Control control = getControl();
    GridData data = new GridData(GridData.FILL_BOTH);
    control.setLayoutData(data);
    prependVerifyKeyListener(new VerifyKeyListener() {

        @Override
        public void verifyKey(VerifyEvent event) {
            handleVerifyKeyPressed(event);
        }
    });
    addDocumentListener(document);
    addMenu();
}
Also used : IInformationControl(org.eclipse.jface.text.IInformationControl) SourceViewerInformationControl(org.eclipse.jdt.internal.ui.text.java.hover.SourceViewerInformationControl) Control(org.eclipse.swt.widgets.Control) VerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener) GridData(org.eclipse.swt.layout.GridData) VerifyEvent(org.eclipse.swt.events.VerifyEvent) Font(org.eclipse.swt.graphics.Font)

Aggregations

Font (org.eclipse.swt.graphics.Font)113 FontData (org.eclipse.swt.graphics.FontData)38 Composite (org.eclipse.swt.widgets.Composite)29 GridData (org.eclipse.swt.layout.GridData)27 GridLayout (org.eclipse.swt.layout.GridLayout)25 Color (org.eclipse.swt.graphics.Color)20 Label (org.eclipse.swt.widgets.Label)17 Point (org.eclipse.swt.graphics.Point)14 SelectionEvent (org.eclipse.swt.events.SelectionEvent)11 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)10 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 FormData (org.eclipse.swt.layout.FormData)9 Text (org.eclipse.swt.widgets.Text)9 Rectangle (org.eclipse.swt.graphics.Rectangle)8 FormAttachment (org.eclipse.swt.layout.FormAttachment)8 Button (org.eclipse.swt.widgets.Button)8 StyledText (org.eclipse.swt.custom.StyledText)6 CLabel (org.eclipse.swt.custom.CLabel)5 FillLayout (org.eclipse.swt.layout.FillLayout)5 ColorStyledText (org.talend.commons.ui.swt.colorstyledtext.ColorStyledText)5