Search in sources :

Example 31 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class ObjectInfoComposite method initDDLTabItem.

/**
	 * Initial ddl tab item
	 * 
	 */
private void initDDLTabItem() {
    CTabItem ddlTabItem = new CTabItem(objInfoFolder, SWT.NONE);
    ddlTabItem.setText(Messages.titleDDL);
    ddlTabItem.setShowClose(false);
    Composite composite = new Composite(objInfoFolder, SWT.NONE);
    ddlTabItem.setControl(composite);
    composite.setLayout(new FillLayout());
    sqlText = new StyledText(composite, SWT.V_SCROLL | SWT.READ_ONLY | SWT.H_SCROLL | SWT.BORDER | SWT.WRAP | SWT.MULTI);
    /*For bug TOOLS-996*/
    CommonUITool.registerCopyPasteContextMenu(sqlText, false);
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) FillLayout(org.eclipse.swt.layout.FillLayout) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 32 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class ObjectInfoComposite method initIndexTabItem.

/**
	 * Initial index tab index
	 * 
	 */
private void initIndexTabItem() {
    CubridDatabase database = schemaNode.getDatabase();
    CTabItem indexTabItem = new CTabItem(objInfoFolder, SWT.NONE);
    indexTabItem.setText(Messages.titleIndex);
    indexTabItem.setShowClose(false);
    Composite composite = new Composite(objInfoFolder, SWT.None);
    indexTabItem.setControl(composite);
    composite.setLayout(new FillLayout());
    final SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
    sashForm.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
    /*Index table composite*/
    Composite indexComposite = new Composite(sashForm, SWT.None);
    indexComposite.setLayout(new GridLayout());
    /*FK table composite*/
    Composite fkComposite = new Composite(sashForm, SWT.None);
    fkComposite.setLayout(new GridLayout());
    /*Set the sashform*/
    sashForm.setWeights(new int[] { 1, 1 });
    // create index table view
    final Label indexLabel = new Label(indexComposite, SWT.NONE);
    indexLabel.setText(Messages.lblIndexes);
    indexTableViewer = new TableViewer(indexComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    Table indexTable = indexTableViewer.getTable();
    indexTable.setLinesVisible(true);
    indexTable.setHeaderVisible(true);
    indexTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    TableColumn tblCol = new TableColumn(indexTable, SWT.NONE);
    tblCol.setWidth(150);
    tblCol.setText(Messages.tblColumnIndexName);
    TableColumn indexNameColumn = new TableColumn(indexTable, SWT.NONE);
    indexNameColumn.setWidth(78);
    indexNameColumn.setText(Messages.tblColumnIndexType);
    TableColumn indexTypeColumn = new TableColumn(indexTable, SWT.NONE);
    indexTypeColumn.setWidth(218);
    indexTypeColumn.setText(Messages.tblColumnOnColumns);
    TableColumn ruleColumn = new TableColumn(indexTable, SWT.NONE);
    ruleColumn.setWidth(282);
    ruleColumn.setText(Messages.tblColumnIndexRule);
    IndexTableViewerContentProvider indexContentProvider = new IndexTableViewerContentProvider();
    IndexTableViewerLabelProvider indexLabelProvider = new IndexTableViewerLabelProvider();
    indexTableViewer.setContentProvider(indexContentProvider);
    indexTableViewer.setLabelProvider(indexLabelProvider);
    // create the fk table viewer
    final Label fkLabel = new Label(fkComposite, SWT.NONE);
    fkLabel.setText(Messages.lblFK);
    fkTableViewer = new TableViewer(fkComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    Table fkTable = fkTableViewer.getTable();
    fkTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    fkTable.setLinesVisible(true);
    fkTable.setHeaderVisible(true);
    TableColumn fkNameColumn = new TableColumn(fkTable, SWT.NONE);
    fkNameColumn.setWidth(100);
    fkNameColumn.setText(Messages.tblColumnFK);
    TableColumn fkColumnName = new TableColumn(fkTable, SWT.NONE);
    fkColumnName.setWidth(119);
    fkColumnName.setText(Messages.tblColumnColumnName);
    TableColumn fTableColumn = new TableColumn(fkTable, SWT.NONE);
    fTableColumn.setWidth(93);
    fTableColumn.setText(Messages.tblColumnForeignTable);
    TableColumn fkColumnNameColumn = new TableColumn(fkTable, SWT.NONE);
    fkColumnNameColumn.setWidth(143);
    fkColumnNameColumn.setText(Messages.tblColumnForeignColumnName);
    TableColumn updateRuletblColumn = new TableColumn(fkTable, SWT.NONE);
    updateRuletblColumn.setWidth(84);
    updateRuletblColumn.setText(Messages.tblColumnUpdateRule);
    TableColumn deleteRuleColumn = new TableColumn(fkTable, SWT.NONE);
    deleteRuleColumn.setWidth(86);
    deleteRuleColumn.setText(Messages.tblColumnDeleteRule);
    TableColumn cacheColumn = new TableColumn(fkTable, SWT.NONE);
    cacheColumn.setWidth(100);
    cacheColumn.setText(Messages.tblColumnCacheColumn);
    fkTableViewer.setContentProvider(new FKTableViewerContentProvider());
    fkTableViewer.setLabelProvider(new FKTableViewerLabelProvider(database.getDatabaseInfo()));
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) IndexTableViewerContentProvider(com.cubrid.common.ui.cubrid.table.control.IndexTableViewerContentProvider) FillLayout(org.eclipse.swt.layout.FillLayout) FKTableViewerLabelProvider(com.cubrid.common.ui.cubrid.table.control.FKTableViewerLabelProvider) CTabItem(org.eclipse.swt.custom.CTabItem) TableColumn(org.eclipse.swt.widgets.TableColumn) IndexTableViewerLabelProvider(com.cubrid.common.ui.cubrid.table.control.IndexTableViewerLabelProvider) SashForm(org.eclipse.swt.custom.SashForm) FKTableViewerContentProvider(com.cubrid.common.ui.cubrid.table.control.FKTableViewerContentProvider) GridLayout(org.eclipse.swt.layout.GridLayout) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 33 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class CombinedQueryEditorComposite method createResultFolder.

/**
	 * Create the result folder including query result and query plan result
	 *
	 * @param topSash SashForm
	 * @param sqlEditorParentComp Composite
	 */
private void createResultFolder(final SashForm topSash, final Composite sqlEditorParentComp) {
    final Composite resultComp = new Composite(topSash, SWT.NONE);
    {
        GridLayout gridLayout = new GridLayout();
        gridLayout.horizontalSpacing = 0;
        gridLayout.verticalSpacing = 0;
        gridLayout.marginWidth = 0;
        gridLayout.marginHeight = 0;
        resultComp.setLayout(gridLayout);
        resultComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    }
    // result folder
    final CTabFolder resultTabFolder = new CTabFolder(resultComp, SWT.TOP);
    resultTabFolder.setLayout(new FillLayout());
    resultTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    resultTabFolder.setSimple(false);
    resultTabFolder.setUnselectedImageVisible(true);
    resultTabFolder.setUnselectedCloseVisible(true);
    resultTabFolder.setSelectionBackground(BACK_COLOR);
    resultTabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
    resultTabFolder.setMinimizeVisible(true);
    resultTabFolder.setMaximizeVisible(true);
    this.resultTabFolder = resultTabFolder;
    resultTabFolder.addCTabFolder2Listener(new CTabFolder2Listener() {

        public void close(CTabFolderEvent event) {
        }

        public void maximize(CTabFolderEvent event) {
            resultTabFolder.setMaximized(true);
            topSash.setMaximizedControl(resultComp);
            editor.getShowResultItem().setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_down.png"));
            topSash.layout(true);
        }

        public void minimize(CTabFolderEvent event) {
            resultTabFolder.setMinimized(true);
            topSash.setMaximizedControl(sqlEditorParentComp);
            editor.getShowResultItem().setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_up.png"));
            topSash.layout(true);
        }

        public void restore(CTabFolderEvent event) {
            resultTabFolder.setMinimized(false);
            resultTabFolder.setMaximized(false);
            topSash.setMaximizedControl(null);
            editor.getShowResultItem().setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_down.png"));
            topSash.layout(true);
        }

        public void showList(CTabFolderEvent event) {
        }
    });
    // query result tab area
    queryResultComp = new QueryResultComposite(resultTabFolder, SWT.NONE, editor);
    // query plan result tab area
    queryPlanResultComp = new QueryPlanCompositeWithHistory(resultTabFolder, SWT.NONE, editor);
    // recently Used SQL tab area
    recentlyUsedSQLComposite = new RecentlyUsedSQLComposite(resultTabFolder, SWT.NONE, editor);
    recentlyUsedSQLComposite.initialize();
    // create multiple query
    multiDBQueryComp = new MultiDBQueryComposite(resultTabFolder, SWT.NONE, editor);
    multiDBQueryComp.initialize();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) CTabFolder2Listener(org.eclipse.swt.custom.CTabFolder2Listener) GridData(org.eclipse.swt.layout.GridData) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 34 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class CombinedQueryEditorComposite method createTopSash.

/**
	 * Create the top sash for SQL editor and query result
	 */
private void createTopSash() {
    Composite topComp = new Composite(this, SWT.NONE);
    topComp.setLayout(new FillLayout());
    topSash = new SashForm(topComp, SWT.VERTICAL);
    topSash.setBackground(SASH_COLOR);
    topSash.setLayout(new FillLayout());
    /* set top sash width to 0, the black line (topSash's background) won't be display
		 * set the normal width when change the editor database(there's no better way to set width)
		 * for TOOLS-2375
		 */
    topSash.setSashWidth(0);
    Composite sqlEditorParentComp = createSQLEditor(topSash);
    createResultFolder(topSash, sqlEditorParentComp);
    topSash.setWeights(new int[] { QUERY_EDITOR_TOP_PCT, QUERY_EDITOR_BOTTOM_PCT });
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) Composite(org.eclipse.swt.widgets.Composite) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 35 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class BLOBCellPopupDialog method createImageCanvas.

/**
	 *
	 * Create the image canvas
	 *
	 */
private void createImageCanvas() {
    imageCanvas = new Composite(dataComposite, SWT.NONE);
    imageCanvas.setLayoutData(new GridData(GridData.FILL_BOTH));
    imageCanvas.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, -1));
    imageCanvas.setLayout(new FillLayout());
    InputStream in = null;
    try {
        if (currValue instanceof File) {
            in = new FileInputStream((File) currValue);
        } else if (currValue instanceof byte[]) {
            in = new ByteArrayInputStream((byte[]) currValue);
        }
        if (in == null) {
            imageCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
            return;
        }
        ImageLoader loader = new ImageLoader();
        ImageData[] imageDatas = loader.load(in);
        if (imageDatas == null || imageDatas.length == 0) {
            imageCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
            return;
        }
        imageViewer = new ImageViewer(imageCanvas);
        if (imageDatas.length == 1) {
            imageViewer.setImage(imageDatas[0]);
        } else {
            imageViewer.setImages(imageDatas, loader.repeatCount);
        }
        imageViewer.pack();
    } catch (Exception ex) {
        imageCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
    } finally {
        Closer.close(in);
    }
    dataComposite.layout();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FillLayout(org.eclipse.swt.layout.FillLayout) FileInputStream(java.io.FileInputStream) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) ByteArrayInputStream(java.io.ByteArrayInputStream) ImageData(org.eclipse.swt.graphics.ImageData) GridData(org.eclipse.swt.layout.GridData) ImageLoader(org.eclipse.swt.graphics.ImageLoader) File(java.io.File)

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