Search in sources :

Example 1 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project tdi-studio-se by Talend.

the class MultiSchemasUI method createViewers.

private void createViewers(SashForm allContentForm) {
    allContentForm.setLayout(new FillLayout());
    allContentForm.setOrientation(SWT.VERTICAL);
    allContentForm.setSashWidth(ExternalMultiSchemasUIProperties.SASHFORM_WIDTH);
    createHeader(allContentForm);
    creatButtom(allContentForm);
    allContentForm.setWeights(ExternalMultiSchemasUIProperties.getAllSashformWeights());
}
Also used : FillLayout(org.eclipse.swt.layout.FillLayout)

Example 2 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project tdi-studio-se by Talend.

the class MultiSchemasUI method createHeaderSashForm.

private void createHeaderSashForm(Composite headerComposite) {
    GridLayout layout;
    headerSashForm = new SashForm(headerComposite, SWT.NONE);
    headerSashForm.setLayout(new FillLayout());
    headerSashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
    headerSashForm.setSashWidth(ExternalMultiSchemasUIProperties.SASHFORM_WIDTH);
    //
    multiSchemasFilePreview = new MultiSchemasShadowProcessPreview(this, headerSashForm);
    multiSchemasFilePreview.newTablePreview();
    Composite struComp = new Composite(headerSashForm, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    struComp.setLayout(layout);
    headerSashForm.setWeights(ExternalMultiSchemasUIProperties.getHeaderSashformWeights());
    //
    fetchBtn = new Button(struComp, SWT.PUSH);
    fetchBtn.setText(ExternalMultiSchemasUIProperties.FETCH_LABEL);
    fetchBtn.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    //
    schemaTreeViewer = new TreeViewer(struComp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    Tree tree = schemaTreeViewer.getTree();
    tree.setLayoutData(new GridData(GridData.FILL_BOTH));
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);
    schemaTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
    // SchemasTreeDnD dnd = new SchemasTreeDnD(schemaTreeViewer);
    // dnd.addDragAndDrop();
    schemaTreeViewer.setContentProvider(new SchemasTreeContentProvider());
    schemaTreeViewer.setLabelProvider(new SchemasTreeLabelProvider());
    // schemaTreeViewer.setSorter(new ViewerSorter() {
    //
    // @SuppressWarnings("unchecked")
    // @Override
    // public int compare(Viewer viewer, Object e1, Object e2) {
    // if (e1 instanceof SchemasKeyData && e2 instanceof SchemasKeyData) {
    // return getComparator().compare(((SchemasKeyData) e1).getKeyName(), ((SchemasKeyData) e2).getKeyName());
    // }
    // return super.compare(viewer, e1, e2);
    // }
    //
    // });
    TreeColumn column = new TreeColumn(tree, SWT.LEFT);
    column.setWidth(55);
    //$NON-NLS-1$
    column.setText("Schema");
    column.setResizable(true);
    column = new TreeColumn(tree, SWT.LEFT);
    column.setWidth(100);
    //$NON-NLS-1$
    column.setText("Record");
    column.setResizable(true);
    column = new TreeColumn(tree, SWT.LEFT);
    column.setWidth(20);
    //$NON-NLS-1$
    column.setText("Separator");
    column.setResizable(true);
    schemaTreeViewer.setColumnProperties(new String[] { ExternalMultiSchemasUIProperties.COLUMN_KEY, ExternalMultiSchemasUIProperties.COLUMN_RECORD, ExternalMultiSchemasUIProperties.COLUMN_SEPARATOR });
    // hywang for 10263
    int columnCount = schemaTreeViewer.getTree().getColumnCount();
    CellEditor[] editors = new CellEditor[columnCount];
    for (int i = 0; i < columnCount; i++) {
        editors[i] = new TextCellEditor(schemaTreeViewer.getTree());
    }
    schemaTreeViewer.setCellEditors(editors);
    schemaTreeViewer.setCellModifier(new ICellModifier() {

        public void modify(Object element, String property, Object value) {
            if (element != null) {
                if (element instanceof TreeItem) {
                    TreeItem item = (TreeItem) element;
                    if (item.getData() != null) {
                        if (item.getData() instanceof SchemasKeyData) {
                            SchemasKeyData key = (SchemasKeyData) item.getData();
                            if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_KEY)) {
                                final boolean flag = checkKeyValue(key.getUniqueRecord(), value.toString());
                                if (flag) {
                                    key.setUniqueRecord(value.toString());
                                }
                            }
                            if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_RECORD)) {
                                key.setRecordType(value.toString());
                            }
                            if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_SEPARATOR)) {
                                key.setSeparator(value.toString());
                            }
                        // Object input = schemaTreeViewer.getInput();
                        // SchemasKeyData in = (SchemasKeyData) input;
                        // if (in.getChildren().contains(key)) {
                        // in.getChildren().remove(in.getChildren().indexOf(key));
                        // List<MultiMetadataColumn> colums = multiSchemaManager.createPropertiesColumns(key);
                        // key.setMetadataColumns(colums);
                        // in.getChildren().add(key);
                        // }
                        }
                        schemaTreeViewer.refresh();
                    }
                }
            }
        }

        public Object getValue(Object element, String property) {
            String record = "";
            if (element != null) {
                if (element instanceof SchemasKeyData) {
                    SchemasKeyData key = (SchemasKeyData) element;
                    if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_KEY)) {
                        record = key.getUniqueRecord();
                    }
                    if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_RECORD)) {
                        record = key.getRecordType();
                    }
                    if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_SEPARATOR)) {
                        record = key.getSeparator();
                    }
                }
            }
            return record;
        }

        public boolean canModify(Object element, String property) {
            return true;
        }
    });
    Composite operateTreeComposite = new Composite(struComp, SWT.NONE);
    operateTreeComposite.setLayout(new GridLayout(3, false));
    operateTreeComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    addRow = new Button(operateTreeComposite, SWT.NONE);
    addRow.setText("Add");
    removeRow = new Button(operateTreeComposite, SWT.NONE);
    removeRow.setText("Remove");
    removeRow.setEnabled(false);
    editSchema = new Button(operateTreeComposite, SWT.NONE);
    editSchema.setText("Edit Columns");
    editSchema.setEnabled(false);
    Composite operation = new Composite(struComp, SWT.NONE);
    operation.setLayout(new GridLayout(2, false));
    operation.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    leftBtn = new Button(operation, SWT.PUSH);
    leftBtn.setToolTipText("Left");
    leftBtn.setImage(ImageProvider.getImage(EImage.LEFT_ICON));
    leftBtn.setEnabled(false);
    rightBtn = new Button(operation, SWT.PUSH);
    rightBtn.setToolTipText("Right");
    rightBtn.setImage(ImageProvider.getImage(EImage.RIGHT_ICON));
    rightBtn.setEnabled(false);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) CommandStackForComposite(org.talend.commons.ui.command.CommandStackForComposite) TreeItem(org.eclipse.swt.widgets.TreeItem) AbstractTreeViewer(org.eclipse.jface.viewers.AbstractTreeViewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) FillLayout(org.eclipse.swt.layout.FillLayout) SchemasTreeLabelProvider(org.talend.designer.filemultischemas.ui.provider.SchemasTreeLabelProvider) Point(org.eclipse.swt.graphics.Point) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SchemasTreeContentProvider(org.talend.designer.filemultischemas.ui.provider.SchemasTreeContentProvider) TreeColumn(org.eclipse.swt.widgets.TreeColumn) GridData(org.eclipse.swt.layout.GridData) ICellModifier(org.eclipse.jface.viewers.ICellModifier) Tree(org.eclipse.swt.widgets.Tree) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) MultiSchemasShadowProcessPreview(org.talend.designer.filemultischemas.ui.preview.MultiSchemasShadowProcessPreview) SchemasKeyData(org.talend.designer.filemultischemas.data.SchemasKeyData)

Example 3 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project tdi-studio-se by Talend.

the class CpuDumpEditor method createHotSpotsPage.

/**
     * Creates the hot spots page.
     */
private void createHotSpotsPage() {
    Composite panel = new Composite(getContainer(), SWT.NONE);
    panel.setLayout(new FillLayout());
    final HotSpotsFilteredTree hotSpotsFilteredTree = new HotSpotsFilteredTree(panel, getEditorSite().getActionBars());
    TreeViewer hotSpotsViewer = hotSpotsFilteredTree.getViewer();
    hotSpotsViewer.setContentProvider(new AbstractContentProvider() {

        @Override
        public Object[] getElements(Object inputElement) {
            if (inputElement instanceof ICpuModel) {
                return ((ICpuModel) inputElement).getHotSpotRoots();
            }
            return new Object[0];
        }
    });
    hotSpotsViewer.setLabelProvider(new HotSpotsLabelProvider(hotSpotsFilteredTree));
    hotSpotsViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            hotSpotsFilteredTree.updateStatusLine((IStructuredSelection) event.getSelection());
        }
    });
    hotSpotsViewer.setUseHashlookup(true);
    hotSpotsViewer.setInput(cpuModel);
    hotSpotsFilteredTree.sortColumn(hotSpotsViewer.getTree().getColumn(1));
    int page = addPage(panel);
    trees.put(hotSpotsFilteredTree, page);
    setPageText(page, Messages.hotSpotsPageLabel);
    setPageImage(page, getHotSpotsImage());
}
Also used : Composite(org.eclipse.swt.widgets.Composite) HotSpotsFilteredTree(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsFilteredTree) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) HotSpotsLabelProvider(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsLabelProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) FillLayout(org.eclipse.swt.layout.FillLayout) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel) AbstractContentProvider(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractContentProvider)

Example 4 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project tdi-studio-se by Talend.

the class AbstractJvmPropertySection method createControls.

/*
     * @see AbstractPropertySection#createControls(Composite, TabbedPropertySheetPage)
     */
@Override
public final void createControls(Composite parent, final TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);
    parent.setLayoutData(new GridData(GridData.FILL_BOTH));
    pageBook = new PageBook(parent, SWT.NONE);
    messagePage = createMessagePage(pageBook);
    contentPage = new Composite(pageBook, SWT.NONE);
    contentPage.setLayout(new FillLayout());
    pageBook.showPage(contentPage);
    propertySheet = getPropertySheet((PageSite) tabbedPropertySheetPage.getSite());
    createControls(contentPage);
    partListener = new PartListener(this, tabbedPropertySheetPage);
    perspectiveListener = new PerspectiveListener(this, tabbedPropertySheetPage.getSite(), propertySheet);
    JvmModel.getInstance().addJvmModelChangeListener(this);
    suspendRefresh = false;
}
Also used : PageSite(org.eclipse.ui.part.PageSite) PageBook(org.eclipse.ui.part.PageBook) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 5 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project tdi-studio-se by Talend.

the class CodeView method createPartControl.

@Override
public void createPartControl(Composite parent) {
    this.parent = parent;
    parent.setLayout(new FillLayout());
    ECodeLanguage language = LanguageManager.getCurrentLanguage();
    ISourceViewer viewer = null;
    final StyledText text;
    int styles = SWT.H_SCROLL | SWT.V_SCROLL;
    document = new Document();
    switch(language) {
        case JAVA:
            IPreferenceStore store = JavaPlugin.getDefault().getCombinedPreferenceStore();
            viewer = new JavaSourceViewer(parent, null, null, false, styles, store);
            viewer.setDocument(document);
            JavaTextTools tools = JavaPlugin.getDefault().getJavaTextTools();
            tools.setupJavaDocumentPartitioner(viewer.getDocument(), IJavaPartitions.JAVA_PARTITIONING);
            SimpleJavaSourceViewerConfiguration config = new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, true);
            viewer.configure(config);
            viewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
            document = viewer.getDocument();
            break;
        // empty since only have java
        default:
    }
    viewer.setEditable(false);
    text = viewer.getTextWidget();
    // getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
    IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
    IAction wrapAction = new Action() {

        @Override
        public void run() {
            text.setWordWrap(isChecked());
        }
    };
    //$NON-NLS-1$
    wrapAction.setToolTipText("wrap");
    wrapAction.setChecked(false);
    //$NON-NLS-1$
    wrapAction.setImageDescriptor(ImageDescriptor.createFromFile(DesignerPlugin.class, "/icons/wrap.gif"));
    tbm.add(wrapAction);
    createMenu();
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) StyledText(org.eclipse.swt.custom.StyledText) SimpleJavaSourceViewerConfiguration(org.eclipse.jdt.internal.ui.text.SimpleJavaSourceViewerConfiguration) IAction(org.eclipse.jface.action.IAction) JavaTextTools(org.eclipse.jdt.ui.text.JavaTextTools) FillLayout(org.eclipse.swt.layout.FillLayout) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) DesignerPlugin(org.talend.designer.core.DesignerPlugin) JavaSourceViewer(org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ECodeLanguage(org.talend.core.language.ECodeLanguage)

Aggregations

FillLayout (org.eclipse.swt.layout.FillLayout)688 Composite (org.eclipse.swt.widgets.Composite)444 GridData (org.eclipse.swt.layout.GridData)267 GridLayout (org.eclipse.swt.layout.GridLayout)187 Shell (org.eclipse.swt.widgets.Shell)164 Label (org.eclipse.swt.widgets.Label)150 SelectionEvent (org.eclipse.swt.events.SelectionEvent)140 Button (org.eclipse.swt.widgets.Button)118 Display (org.eclipse.swt.widgets.Display)99 Group (org.eclipse.swt.widgets.Group)95 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)89 Point (org.eclipse.swt.graphics.Point)89 Text (org.eclipse.swt.widgets.Text)84 Table (org.eclipse.swt.widgets.Table)80 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)77 Rectangle (org.eclipse.swt.graphics.Rectangle)77 TableColumn (org.eclipse.swt.widgets.TableColumn)65 SelectionListener (org.eclipse.swt.events.SelectionListener)61 Tree (org.eclipse.swt.widgets.Tree)60 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)54