Search in sources :

Example 91 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class BrowserViewPart method createBrowserArea.

private Composite createBrowserArea(Composite parent) {
    GridLayout gridLayout = new GridLayout(1, false);
    parent.setLayout(gridLayout);
    GridData gd_displayArea = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    parent.setLayoutData(gd_displayArea);
    tabFolder = new CTabFolder(parent, SWT.TOP | SWT.MULTI | SWT.FLAT);
    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    UIJob job = new UIJob(Display.getDefault(), "refresh browser") {

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {
            refreshTabContent();
            return Status.OK_STATUS;
        }

        /** (non-Javadoc)
			 * @see org.eclipse.core.runtime.jobs.Job#shouldRun()
			 */
        @Override
        public boolean shouldRun() {
            return !tabFolder.isDisposed();
        }
    };
    job.schedule();
    return parent;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CTabFolder(org.eclipse.swt.custom.CTabFolder) GridData(org.eclipse.swt.layout.GridData) UIJob(org.eclipse.ui.progress.UIJob)

Example 92 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class BrowserViewPart method createSearchArea.

private Composite createSearchArea(Composite parent) {
    GridLayout gridLayout = new GridLayout(3, false);
    parent.setLayout(gridLayout);
    GridData gd_seachArea = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
    parent.setLayoutData(gd_seachArea);
    keyWordForSearch = new Text(parent, SWT.SEARCH);
    GridData gd_keyWordForSearch = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
    gd_keyWordForSearch.heightHint = 20;
    keyWordForSearch.setLayoutData(gd_keyWordForSearch);
    keyWordForSearch.setText("");
    font = keyWordForSearch.getFont();
    FontData fontData = font.getFontData()[0];
    fontData.setStyle(fontData.getStyle());
    fontData.setHeight(12);
    font = new Font(Display.getDefault(), fontData);
    keyWordForSearch.setFont(font);
    keyWordForSearch.addKeyListener(new KeyListener() {

        @Override
        public void keyReleased(KeyEvent e) {
        // TODO Auto-generated method stub
        }

        @Override
        public void keyPressed(KeyEvent e) {
            // TODO Auto-generated method stub
            if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) {
                refreshKeyWordSearch(true);
            }
        }
    });
    Button searchBtn = new Button(parent, SWT.NONE);
    searchBtn.setText(Messages.getString("Websearch.browserViewPart.searchBtnLbl"));
    searchBtn.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    searchBtn.addSelectionListener(new SelectionAdapter() {

        /**
			 * (non-Javadoc)
			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
			 */
        @Override
        public void widgetSelected(SelectionEvent e) {
            refreshKeyWordSearch(true);
        }
    });
    Button settingBtn = new Button(parent, SWT.NONE);
    settingBtn.setText(Messages.getString("Websearch.browserViewPart.settingBtnLbl"));
    settingBtn.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    settingBtn.addSelectionListener(new SelectionAdapter() {

        /**
			 * (non-Javadoc)
			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
			 */
        @Override
        public void widgetSelected(SelectionEvent e) {
            PreferenceUtil.openPreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), WebSearchPreferencePage.ID);
        }
    });
    return parent;
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) FontData(org.eclipse.swt.graphics.FontData) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) KeyListener(org.eclipse.swt.events.KeyListener) Font(org.eclipse.swt.graphics.Font)

Example 93 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class AddSearchEntryDialog method createDialogArea.

/**
	 * Create contents of the dialog.
	 * @param parent
	 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    container.setLayout(new GridLayout(1, false));
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.heightHint = SWT.DEFAULT;
    gridData.widthHint = 450;
    container.setLayoutData(gridData);
    Composite nameSetArea = new Composite(container, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    nameSetArea.setLayout(gridLayout);
    nameSetArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label nameLable = new Label(nameSetArea, SWT.NONE);
    GridData gd_nameLable = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_nameLable.widthHint = 38;
    nameLable.setLayoutData(gd_nameLable);
    nameLable.setText(Messages.getString("Websearch.AddSearchEntryDialog.NameLable"));
    nameText = new Text(nameSetArea, SWT.BORDER);
    nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (style == EDIT) {
        nameText.setText(searEntry.getSearchName());
    }
    nameText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            setOkState();
        }
    });
    Composite urlSetArea = new Composite(container, SWT.NONE);
    GridLayout gridLayout2 = new GridLayout(2, false);
    urlSetArea.setLayout(gridLayout2);
    urlSetArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label urlLable = new Label(urlSetArea, SWT.NONE);
    GridData gd_urlLable = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_urlLable.widthHint = 38;
    urlLable.setLayoutData(gd_urlLable);
    urlLable.setText("URL");
    urlText = new Text(urlSetArea, SWT.BORDER);
    if (style == EDIT) {
        urlText.setText(searEntry.getSearchUrl());
    }
    urlText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    urlText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            setOkState();
        }
    });
    Composite setArea = new Composite(container, SWT.NONE);
    setArea.setLayout(new GridLayout(1, true));
    setArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Group group = new Group(setArea, SWT.NONE);
    group.setLayout(new GridLayout(2, true));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setText(Messages.getString("Websearch.AddSearchEntryDialog.GroupTitle"));
    btnYesRadioButton = new Button(group, SWT.RADIO);
    btnYesRadioButton.setText(Messages.getString("Websearch.AddSearchEntryDialog.GroupYes"));
    btnYesRadioButton.setSelection(true);
    btnYesRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnNoRadioButton = new Button(group, SWT.RADIO);
    btnNoRadioButton.setText(Messages.getString("Websearch.AddSearchEntryDialog.GroupNo"));
    btnNoRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (style == EDIT) {
        btnYesRadioButton.setSelection(searEntry.isChecked());
        btnNoRadioButton.setSelection(!searEntry.isChecked());
    }
    return container;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Example 94 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class WebSearchPreferencePage method createTableCmdArea.

private Composite createTableCmdArea(Composite parent) {
    Composite urlCmdArea = new Composite(parent, SWT.NONE);
    GridLayout urlCmdArea_layout = new GridLayout(1, true);
    urlCmdArea.setLayout(urlCmdArea_layout);
    urlCmdArea.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    addItemBtn = new Button(urlCmdArea, SWT.NONE);
    addItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    addItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.Add"));
    editItemBtn = new Button(urlCmdArea, SWT.NONE);
    editItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.edit"));
    editItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    editItemBtn.setEnabled(false);
    deleteItemBtn = new Button(urlCmdArea, SWT.NONE);
    deleteItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.delete"));
    deleteItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    deleteItemBtn.setEnabled(false);
    upItemBtn = new Button(urlCmdArea, SWT.NONE);
    upItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    upItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.upitem"));
    upItemBtn.setEnabled(false);
    downItemBtn = new Button(urlCmdArea, SWT.NONE);
    downItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    downItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.downitem"));
    downItemBtn.setEnabled(false);
    importItemsBtn = new Button(urlCmdArea, SWT.NONE);
    importItemsBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    importItemsBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.import"));
    exportItemsBtn = new Button(urlCmdArea, SWT.NONE);
    exportItemsBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    exportItemsBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.export"));
    return urlCmdArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 95 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class LicenseAgreementDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginTop = 5;
    layout.marginWidth = 10;
    tparent.setLayout(layout);
    GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
    parentData.heightHint = 380;
    tparent.setLayoutData(parentData);
    Label lbl = new Label(tparent, SWT.NONE);
    lbl.setText(Messages.getString("license.LicenseAgreementDialog.label"));
    lbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Text text = new Text(tparent, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    text.setEditable(false);
    text.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    text.setText(Messages.getString("license.LicenseAgreementDialog.agreement"));
    GridData textData = new GridData(GridData.FILL_BOTH);
    text.setLayoutData(textData);
    agreeBtn = new Button(tparent, SWT.CHECK);
    agreeBtn.setText(Messages.getString("license.LicenseAgreementDialog.agreeBtn"));
    agreeBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    agreeBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            getButton(IDialogConstants.OK_ID).setEnabled(agreeBtn.getSelection());
        }
    });
    return super.createDialogArea(parent);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text)

Aggregations

GridData (org.eclipse.swt.layout.GridData)2385 GridLayout (org.eclipse.swt.layout.GridLayout)1659 Composite (org.eclipse.swt.widgets.Composite)1448 Label (org.eclipse.swt.widgets.Label)982 Button (org.eclipse.swt.widgets.Button)732 SelectionEvent (org.eclipse.swt.events.SelectionEvent)719 Text (org.eclipse.swt.widgets.Text)578 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)577 Group (org.eclipse.swt.widgets.Group)509 Combo (org.eclipse.swt.widgets.Combo)234 ModifyListener (org.eclipse.swt.events.ModifyListener)225 ModifyEvent (org.eclipse.swt.events.ModifyEvent)214 SelectionListener (org.eclipse.swt.events.SelectionListener)213 Table (org.eclipse.swt.widgets.Table)196 Point (org.eclipse.swt.graphics.Point)167 TableViewer (org.eclipse.jface.viewers.TableViewer)162 FillLayout (org.eclipse.swt.layout.FillLayout)134 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)118 Control (org.eclipse.swt.widgets.Control)117 Image (org.eclipse.swt.graphics.Image)114