Search in sources :

Example 11 with IDoubleClickListener

use of org.eclipse.jface.viewers.IDoubleClickListener in project tesb-studio-se by Talend.

the class RouteResourceSelectionDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    final Composite container = (Composite) super.createDialogArea(parent);
    final RepositoryViewerProvider provider = new RepositoryViewerProvider() {

        @Override
        protected TreeViewer createTreeViewer(Composite parent, int style) {
            return new RepositoryTreeViewer(parent, style);
        }

        @Override
        protected ERepositoryObjectType getCheckingType() {
            return CamelRepositoryNodeType.repositoryRouteResourceType;
        }

        @Override
        protected int getStyle() {
            // http://jira.talendforge.org/browse/TESB-6582 Xiaopeng Li
            return SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL;
        }
    };
    repositoryTreeViewer = (RepositoryTreeViewer) provider.createViewer(container);
    repositoryTreeViewer.expandAll();
    repositoryTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            getButton(IDialogConstants.OK_ID).setEnabled(validateSelection((IStructuredSelection) event.getSelection()));
        }
    });
    repositoryTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            if (getButton(IDialogConstants.OK_ID).isEnabled()) {
                okPressed();
            }
        }
    });
    return container;
}
Also used : RepositoryViewerProvider(org.talend.repository.viewer.ui.provider.RepositoryViewerProvider) RepositoryTreeViewer(org.talend.repository.viewer.ui.viewer.RepositoryTreeViewer) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent)

Example 12 with IDoubleClickListener

use of org.eclipse.jface.viewers.IDoubleClickListener in project ACS by ACS-Community.

the class ChannelTreePart method postConstruct.

/**
	 * See http://www.vogella.com/articles/EclipseJFaceTree/article.html
	 */
@PostConstruct
public void postConstruct(Composite parent, final IEclipseContext context, EMenuService menuService, IEventBroker eventBroker) {
    try {
        eventModel = EventModel.getInstance();
    } catch (Throwable thr) {
        thr.printStackTrace();
        IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
        statusReporter.report(someStatus, StatusReporter.SHOW);
        throw new RuntimeException(thr);
    }
    //		eventModel.getLogger().info("ChannelTreePart got EventModel instance.");
    statusLineWriter = new StatusLineWriter(eventBroker);
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    viewer.setContentProvider(new ChannelTreeContentProvider());
    viewer.setLabelProvider(new ChannelTreeLabelProvider());
    // Expand the tree. '2' means to show only the visible top-level nodes.
    viewer.setAutoExpandLevel(2);
    viewer.setComparator(new ServiceViewerComparator());
    // Provide the root node to the ContentProvider
    viewer.setInput(eventModel.getNotifyServicesRoot());
    // Expand with doubleclick
    viewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection();
            Object selectedNode = thisSelection.getFirstElement();
            viewer.setExpandedState(selectedNode, !viewer.getExpandedState(selectedNode));
        }
    });
    // Attach a selection listener to our tree that will post selections to the ESelectionService
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            selectionService.setSelection(selection.size() == 1 ? selection.getFirstElement() : selection.toArray());
        }
    });
    // TODO: Take care of help system. Here's the E3 code:
    //		// Create the help context id for the viewer's control
    //		PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "alma.acs.eventbrowser.viewer");
    hookContextMenu(menuService);
    // TODO: this could be used by handlers etc, currently it's not
    context.set(ChannelTreePart.class, this);
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ChannelTreeContentProvider(alma.acs.eventbrowser.parts.ChannelTreeProviders.ChannelTreeContentProvider) StatusLineWriter(alma.acs.eventbrowser.status.StatusLineWriter) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ChannelTreeLabelProvider(alma.acs.eventbrowser.parts.ChannelTreeProviders.ChannelTreeLabelProvider) PostConstruct(javax.annotation.PostConstruct)

Example 13 with IDoubleClickListener

use of org.eclipse.jface.viewers.IDoubleClickListener in project cubrid-manager by CUBRID.

the class DataCompareEditorPart method createContent.

private void createContent(Composite parent) {
    compareTableViewer = new TableViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    compareTableViewer.setUseHashlookup(true);
    compareTableViewer.setColumnProperties(columnNames);
    CommonUITool.createGridLayout(compareTableViewer.getTable(), 1, 0, 10, 0, 10, 0, 0, 0, 0);
    compareTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    compareTableViewer.getTable().setLinesVisible(true);
    compareTableViewer.getTable().setHeaderVisible(true);
    sorter = new DataCompareSchemaListViewSorter();
    sorter.setSortType(DataCompareSchemaListViewSorter.SORT_TABLE);
    compareTableViewer.setSorter(sorter);
    makeContextMenu(compareTableViewer);
    final TableViewerColumn firstCol = new TableViewerColumn(compareTableViewer, SWT.NONE);
    firstCol.getColumn().setWidth(30);
    firstCol.getColumn().setResizable(false);
    firstCol.getColumn().setAlignment(SWT.CENTER);
    firstCol.getColumn().setImage(CommonUIPlugin.getImage("icons/unchecked.gif"));
    firstCol.getColumn().addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TableItem[] items = compareTableViewer.getTable().getItems();
            if (items == null) {
                return;
            }
            for (TableItem item : items) {
                DataCompare dataCompare = (DataCompare) item.getData();
                dataCompare.setUse(isSelectAll);
            }
            compareTableViewer.refresh();
            Image image = null;
            if (isSelectAll) {
                image = CommonUIPlugin.getImage("icons/checked.gif");
            } else {
                image = CommonUIPlugin.getImage("icons/unchecked.gif");
            }
            firstCol.getColumn().setImage(image);
            isSelectAll = !isSelectAll;
        }
    });
    TableViewerColumn col = new TableViewerColumn(compareTableViewer, SWT.NONE);
    col.getColumn().setWidth(200);
    col.getColumn().setText(Messages.lblDataCompareTable);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_TABLE);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordSource);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_SOURCE_RECORDS);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordTarget);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_TARGET_RECORDS);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordProgress);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_PROGRESS);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordMatch);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_MATCHES);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordNoMatch);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_NOT_MATCHES);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordNotExist);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_NOT_EXISTS);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(300);
    col.getColumn().setText(Messages.lblDataCompareRecordError);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_ERROR);
    CellEditor[] cellEditor = new CellEditor[1];
    cellEditor[0] = new CheckboxCellEditor(compareTableViewer.getTable());
    compareTableViewer.setCellEditors(cellEditor);
    compareTableViewer.setCellModifier(new DataCompareCellModifier(this));
    compareTableViewer.setContentProvider(new DataCompareSchemaListContentProvider());
    compareTableViewer.setLabelProvider(new DataCompareSchemaListLabelProvider());
    compareList = new ArrayList<DataCompare>();
    compareTableViewer.setInput(compareList);
    txtProgress = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    txtProgress.setEditable(false);
    txtProgress.setWordWrap(true);
    txtProgress.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 100));
    txtProgress.setBackground(txtProgress.getDisplay().getSystemColor(SWT.COLOR_BLACK));
    txtProgress.setForeground(txtProgress.getDisplay().getSystemColor(SWT.COLOR_GREEN));
    compareTableViewer.getTable().setToolTipText(Messages.msgYouCanSeeDetailDblclick);
    compareTableViewer.getTable().addKeyListener(new KeyAdapter() {

        public void keyReleased(KeyEvent e) {
            if (e.character == ' ') {
                TableItem[] items = compareTableViewer.getTable().getSelection();
                if (items == null) {
                    return;
                }
                for (TableItem item : items) {
                    DataCompare dataCompare = (DataCompare) item.getData();
                    dataCompare.setUse(!dataCompare.isUse());
                }
                compareTableViewer.refresh();
            }
        }
    });
    compareTableViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            if (!refreshedRecordCounts) {
                CommonUITool.openWarningBox(Messages.msgClickRefreshToEsimateDiff);
                return;
            }
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            DataCompare model = (DataCompare) selection.getFirstElement();
            if (!model.isSameSchema()) {
                CommonUITool.openWarningBox(Messages.msgTheSchemaDiff);
                return;
            }
            if (model.getRecordsTarget() == -1) {
                CommonUITool.openWarningBox(Messages.msgTargetNotFound);
                return;
            }
            if (model.getRecordsSource() == 0 && model.getRecordsTarget() > 0) {
                CommonUITool.openWarningBox(Messages.msgTargetNoData);
                return;
            }
            if (model.getRecordsSource() == 0) {
                CommonUITool.openWarningBox(Messages.msgNoDataToCompare);
                return;
            }
            if (model.getProgressPosition() == 0) {
                CommonUITool.openWarningBox(Messages.msgNotYetCompared);
                return;
            }
            if (model.getNotMatches() == 0 && model.getNotExists() == 0) {
                CommonUITool.openWarningBox(Messages.msgSameData);
                return;
            }
            showDataCompareDetailEditor(model.getSchemaInfo());
        }
    });
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) KeyAdapter(org.eclipse.swt.events.KeyAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Image(org.eclipse.swt.graphics.Image) KeyEvent(org.eclipse.swt.events.KeyEvent) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DataCompare(com.cubrid.common.ui.compare.data.model.DataCompare) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 14 with IDoubleClickListener

use of org.eclipse.jface.viewers.IDoubleClickListener in project cubrid-manager by CUBRID.

the class RunSQLFileViewPart method createPartControl.

/**
	 * Create part controls
	 * 
	 * @param parent of the controls
	 */
public void createPartControl(Composite parent) {
    Composite backPanel = new Composite(parent, SWT.NONE);
    backPanel.setLayout(new GridLayout(1, false));
    backPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Composite progressPanel = new Composite(backPanel, SWT.NONE);
    progressPanel.setLayout(new GridLayout(3, false));
    progressPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    pbTotal = new ProgressBar(progressPanel, SWT.NONE);
    pbTotal.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    btnStop = new Button(progressPanel, SWT.NONE);
    btnStop.setText(Messages.btnStop);
    btnStop.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_run_stop.png"));
    btnStop.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            processStop();
        }
    });
    openLogFolderButton = new Button(progressPanel, SWT.NONE);
    openLogFolderButton.setText(Messages.runSQLOpenBtn);
    openLogFolderButton.setEnabled(false);
    openLogFolderButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            try {
                java.awt.Desktop.getDesktop().open(new File(input.getLogFolderPath()));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
    Composite textComp = new Composite(backPanel, SWT.NONE);
    GridData textCompGd = new GridData(GridData.FILL_HORIZONTAL);
    textCompGd.heightHint = 50;
    textCompGd.exclude = true;
    textComp.setVisible(false);
    textComp.setLayoutData(textCompGd);
    textComp.setLayout(new GridLayout(1, false));
    Text errorText = new Text(textComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    errorText.setLayoutData(new GridData(GridData.FILL_BOTH));
    errorText.setEditable(false);
    tvProgress = new TableViewer(backPanel, SWT.BORDER | SWT.FULL_SELECTION);
    tvProgress.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
    tvProgress.getTable().setLinesVisible(true);
    tvProgress.getTable().setHeaderVisible(true);
    final TableViewerColumn fileName = new TableViewerColumn(tvProgress, SWT.NONE);
    final TableViewerColumn successCount = new TableViewerColumn(tvProgress, SWT.NONE);
    final TableViewerColumn failCount = new TableViewerColumn(tvProgress, SWT.NONE);
    final TableViewerColumn status = new TableViewerColumn(tvProgress, SWT.NONE);
    final TableViewerColumn elapsedTime = new TableViewerColumn(tvProgress, SWT.NONE);
    fileName.getColumn().setWidth(250);
    fileName.getColumn().setText(Messages.fileName);
    successCount.getColumn().setWidth(100);
    successCount.getColumn().setText(Messages.successCount);
    failCount.getColumn().setWidth(100);
    failCount.getColumn().setText(Messages.failCount);
    status.getColumn().setWidth(100);
    status.getColumn().setText(Messages.columnStatus);
    elapsedTime.getColumn().setWidth(130);
    elapsedTime.getColumn().setText(Messages.columnElapsedTime);
    tvProgress.setContentProvider(new RunSQLFileTableContentProvider());
    tvProgress.setLabelProvider(new RunSQLFileTableLabelProvider());
    tvProgress.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            SqlRunnerProgress po = (SqlRunnerProgress) selection.getFirstElement();
            new ViewSQLLogDialog(Display.getDefault().getActiveShell(), po.getFileName(), po.getFailList()).open();
        }
    });
    String errorMsg = testConnection();
    if (errorMsg != null) {
        pbTotal.setEnabled(false);
        btnStop.setEnabled(false);
        textCompGd.exclude = false;
        textComp.setVisible(true);
        errorText.setText("Can't get connection : " + errorMsg);
        textComp.getParent().layout();
        return;
    }
    initManager();
    intiTableView();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SqlRunnerProgress(com.cubrid.common.ui.common.sqlrunner.model.SqlRunnerProgress) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) RunSQLFileTableContentProvider(com.cubrid.common.ui.common.sqlrunner.RunSQLFileTableContentProvider) Text(org.eclipse.swt.widgets.Text) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IOException(java.io.IOException) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) RunSQLFileTableLabelProvider(com.cubrid.common.ui.common.sqlrunner.RunSQLFileTableLabelProvider) ProgressBar(org.eclipse.swt.widgets.ProgressBar) File(java.io.File) TableViewer(org.eclipse.jface.viewers.TableViewer) ViewSQLLogDialog(com.cubrid.common.ui.common.sqlrunner.dialog.ViewSQLLogDialog) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 15 with IDoubleClickListener

use of org.eclipse.jface.viewers.IDoubleClickListener in project cubrid-manager by CUBRID.

the class TableSchemaCompareInfoPart method createCommonColumnsOnTable.

public void createCommonColumnsOnTable(Composite parent) {
    final Composite tableComposite = new Composite(parent, SWT.NONE);
    tableComposite.setLayout(new FillLayout());
    tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    tablesSchemaCompareTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    tablesSchemaCompareTable.getTable().setHeaderVisible(true);
    tablesSchemaCompareTable.getTable().setLinesVisible(true);
    final TableViewerColumn statusColumn = new TableViewerColumn(tablesSchemaCompareTable, SWT.NONE);
    statusColumn.getColumn().setWidth(20);
    statusColumn.getColumn().setToolTipText(Messages.compareStatusTip);
    statusColumn.getColumn().setResizable(false);
    tablesSchemaCompareTable.setSorter(TableSchemaCompareTableViewerSorter.STATUS_DESC);
    statusColumn.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean asc = true;

        public void widgetSelected(SelectionEvent e) {
            tablesSchemaCompareTable.setSorter(asc ? TableSchemaCompareTableViewerSorter.STATUS_ASC : TableSchemaCompareTableViewerSorter.STATUS_DESC);
            tablesSchemaCompareTable.getTable().setSortColumn(statusColumn.getColumn());
            tablesSchemaCompareTable.getTable().setSortDirection(asc ? SWT.UP : SWT.DOWN);
            asc = !asc;
        }
    });
    final TableViewerColumn sourceDBColumn = new TableViewerColumn(tablesSchemaCompareTable, SWT.LEFT);
    sourceDBColumn.getColumn().setWidth(300);
    sourceDBColumn.getColumn().setText("  " + sourceDB.getDatabaseInfo().getBrokerIP() + "@" + sourceDB.getName() + " [" + Messages.sourceDatabase + "]");
    sourceDBColumn.getColumn().setToolTipText(Messages.sourceDatabaseTip);
    sourceDBColumn.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean asc = true;

        public void widgetSelected(SelectionEvent e) {
            tablesSchemaCompareTable.setSorter(asc ? TableSchemaCompareTableViewerSorter.SOURCE_DB_ASC : TableSchemaCompareTableViewerSorter.SOURCE_DB_DESC);
            tablesSchemaCompareTable.getTable().setSortColumn(sourceDBColumn.getColumn());
            tablesSchemaCompareTable.getTable().setSortDirection(asc ? SWT.UP : SWT.DOWN);
            asc = !asc;
        }
    });
    final TableViewerColumn targetDBColoum = new TableViewerColumn(tablesSchemaCompareTable, SWT.LEFT);
    targetDBColoum.getColumn().setWidth(300);
    if (targetDB.isVirtual()) {
        String targetDbName = Messages.erwinVirtualTable;
        if (StringUtil.isNotEmpty(targetDB.getName())) {
            targetDbName += " : " + targetDB.getName();
        }
        targetDBColoum.getColumn().setText(targetDbName);
    } else {
        targetDBColoum.getColumn().setText("  " + targetDB.getDatabaseInfo().getBrokerIP() + "@" + targetDB.getName() + " [" + Messages.targetDatabase + "]");
    }
    targetDBColoum.getColumn().setToolTipText(Messages.targetDatabaseTip);
    targetDBColoum.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean asc = true;

        public void widgetSelected(SelectionEvent e) {
            tablesSchemaCompareTable.setSorter(asc ? TableSchemaCompareTableViewerSorter.TARGET_DB_ASC : TableSchemaCompareTableViewerSorter.TARGET_DB_DESC);
            tablesSchemaCompareTable.getTable().setSortColumn(targetDBColoum.getColumn());
            tablesSchemaCompareTable.getTable().setSortDirection(asc ? SWT.UP : SWT.DOWN);
            asc = !asc;
        }
    });
    tablesSchemaCompareTable.setContentProvider(new TableSchemaCompareTableViewerContentProvider());
    tablesSchemaCompareTable.setLabelProvider(new TableSchemaCompareDetailTableViewerLabelProvider());
    tablesSchemaCompareTable.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            TableSchemaCompareModel compSchemaModel = (TableSchemaCompareModel) selection.getFirstElement();
            compSchemaModel.setSourceDB(sourceDB);
            compSchemaModel.setTargetDB(targetDB);
            TableSchema leftTableSchema = (TableSchema) compSchemaModel.getLeft();
            TableSchema rightTableSchema = (TableSchema) compSchemaModel.getRight();
            String tabItemText = leftTableSchema.getName();
            if (StringUtil.isEmpty(leftTableSchema.getName()) || StringUtil.isEmpty(tabItemText)) {
                tabItemText = rightTableSchema.getName();
            }
            //if had opend,set it selection and refresh the contents
            for (CTabItem tabItem : tabFolder.getItems()) {
                if (tabItem.getText().equals(tabItemText)) {
                    tableComp.setInput(compSchemaModel);
                    tableComp.refreshMergeViewer(tabItemText);
                    tabFolder.setSelection(tabItem);
                    return;
                }
            }
            tableComp.setInput(compSchemaModel);
            tableComp.initialize();
        }
    });
    registerContextMenu();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) TableSchema(com.cubrid.common.ui.compare.schema.model.TableSchema) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) FillLayout(org.eclipse.swt.layout.FillLayout) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) CTabItem(org.eclipse.swt.custom.CTabItem) TableSchemaCompareModel(com.cubrid.common.ui.compare.schema.model.TableSchemaCompareModel) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)49 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)49 TableViewer (org.eclipse.jface.viewers.TableViewer)33 SelectionEvent (org.eclipse.swt.events.SelectionEvent)29 GridData (org.eclipse.swt.layout.GridData)28 Composite (org.eclipse.swt.widgets.Composite)28 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)23 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)22 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)16 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)16 GridLayout (org.eclipse.swt.layout.GridLayout)16 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)14 Table (org.eclipse.swt.widgets.Table)13 TableColumn (org.eclipse.swt.widgets.TableColumn)12 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)11 Label (org.eclipse.swt.widgets.Label)11 Button (org.eclipse.swt.widgets.Button)10 ISelection (org.eclipse.jface.viewers.ISelection)8 FillLayout (org.eclipse.swt.layout.FillLayout)8 Event (org.eclipse.swt.widgets.Event)8