Search in sources :

Example 51 with IDoubleClickListener

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

the class JobAutoDashboardEditorPart method createBackupPlanInfoTable.

public void createBackupPlanInfoTable(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    ToolBar toolBar = new ToolBar(parent, SWT.RIGHT);
    toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
    refreshItem.setText(com.cubrid.common.ui.cubrid.table.Messages.tablesDetailInfoPartRefreshBtn);
    refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            refreshBackupPlan();
        }
    });
    ToolItem createItem = new ToolItem(toolBar, SWT.PUSH);
    createItem.setText(Messages.jobAutoInfoDetailPartCreateBackupBtn);
    createItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
    createItem.setEnabled(canAddOrEdit);
    createItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addBackupPlan();
        }
    });
    ToolItem editItem = new ToolItem(toolBar, SWT.PUSH);
    editItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
    editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
    editItem.setEnabled(canAddOrEdit);
    editItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            editBackupPlan();
        }
    });
    ToolItem deleteItem = new ToolItem(toolBar, SWT.PUSH);
    deleteItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
    deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
    deleteItem.setEnabled(canAddOrEdit);
    deleteItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            deleteBackupPlan();
        }
    });
    ToolItem openLogItem = new ToolItem(toolBar, SWT.PUSH);
    openLogItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
    openLogItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
    openLogItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            openBackupPlanLog();
        }
    });
    final Composite tableComposite = new Composite(parent, SWT.NONE);
    tableComposite.setLayout(new FillLayout());
    tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    backupPlanInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    backupPlanInfoTable.getTable().setHeaderVisible(true);
    backupPlanInfoTable.getTable().setLinesVisible(true);
    backupPlanInfoTable.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            editBackupPlan();
        }
    });
    final TableViewerColumn idColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    idColumn.getColumn().setWidth(80);
    idColumn.getColumn().setText(Messages.backupPlanInfoTableIDColumn);
    final TableViewerColumn levelColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    levelColumn.getColumn().setWidth(80);
    levelColumn.getColumn().setText(Messages.backupPlanInfoTableLevelColumn);
    final TableViewerColumn pathColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    pathColumn.getColumn().setWidth(200);
    pathColumn.getColumn().setText(Messages.backupPlanInfoTablePathColumn);
    final TableViewerColumn periodTypeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    periodTypeColumn.getColumn().setWidth(100);
    periodTypeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTypeColumn);
    final TableViewerColumn backupDetailColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    backupDetailColumn.getColumn().setWidth(150);
    backupDetailColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodDetailColumn);
    final TableViewerColumn backupTimeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    backupTimeColumn.getColumn().setWidth(90);
    backupTimeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTimeColumn);
    if (isSupportPeriodicAutoJob) {
        final TableViewerColumn backupIntervalColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
        backupIntervalColumn.getColumn().setWidth(100);
        backupIntervalColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodIntervalColumn);
    }
    final TableViewerColumn onOffLineColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    onOffLineColumn.getColumn().setWidth(100);
    onOffLineColumn.getColumn().setText(Messages.backupPlanInfoTableOnlineOfflineColumn);
    backupPlanInfoTable.setContentProvider(new BackupPlanTableViewerContentProvider());
    backupPlanInfoTable.setLabelProvider(new BackupPlanTableViewerLabelProvider());
    backupPlanInfoTable.getTable().addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent event) {
            ActionManager.getInstance().changeFocusProvider(backupPlanInfoTable.getTable());
        }
    });
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    Menu contextMenu = menuManager.createContextMenu(backupPlanInfoTable.getTable());
    backupPlanInfoTable.getTable().setMenu(contextMenu);
    Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
    final MenuItem createMenuItem = new MenuItem(menu, SWT.PUSH);
    createMenuItem.setText(Messages.jobAutoInfoDetailPartCreateBackupBtn);
    createMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
    createMenuItem.setEnabled(canAddOrEdit);
    createMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            addBackupPlan();
        }
    });
    final MenuItem editMenuItem = new MenuItem(menu, SWT.PUSH);
    editMenuItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
    editMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
    editMenuItem.setEnabled(canAddOrEdit);
    editMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            editBackupPlan();
        }
    });
    final MenuItem dropMenuItem = new MenuItem(menu, SWT.PUSH);
    dropMenuItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
    dropMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
    dropMenuItem.setEnabled(canAddOrEdit);
    dropMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            deleteBackupPlan();
        }
    });
    final MenuItem openLogMenuItem = new MenuItem(menu, SWT.PUSH);
    openLogMenuItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
    openLogMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
    openLogMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            openBackupPlanLog();
        }
    });
    backupPlanInfoTable.getTable().setMenu(menu);
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) FillLayout(org.eclipse.swt.layout.FillLayout) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) ToolItem(org.eclipse.swt.widgets.ToolItem) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 52 with IDoubleClickListener

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

the class ExtendedNodeReviewDialog method createDialogArea.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
     */
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    //$NON-NLS-1$
    TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "before createDialogArea...");
    GridData data = (GridData) container.getLayoutData();
    data.minimumHeight = 400;
    data.heightHint = 400;
    data.minimumWidth = 500;
    data.widthHint = 500;
    container.setLayoutData(data);
    textFilter = new ViewerTextFilter();
    createFilterField(container);
    treeViewer = provider.createViewer(container);
    treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            getButton(IDialogConstants.OK_ID).setEnabled(isValidSelection(event));
        }
    });
    treeViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            if (getButton(IDialogConstants.OK_ID).isEnabled()) {
                okPressed();
            }
        }
    });
    treeViewer.addFilter(textFilter);
    treeViewer.addFilter(new ViewerFilter() {

        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            return filterByType(viewer, parentElement, element);
        }
    });
    return container;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) Viewer(org.eclipse.jface.viewers.Viewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer)

Example 53 with IDoubleClickListener

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

the class TalendExportPage method createTreeViewer.

protected Composite createTreeViewer(Composite parent) {
    IWizardCategory root = WorkbenchPlugin.getDefault().getExportWizardRegistry().getRootCategory();
    // exportTree = new TalendCategorizedWizardSelectionTree(root,
    // WorkbenchMessages.ExportWizard_selectDestination);
    exportTree = new TalendCategorizedWizardSelectionTree(root, //$NON-NLS-1$
    Messages.getString("WorkbenchMessages.ExportWizard_selectDestination"));
    Composite exportComp = exportTree.createControl(parent);
    exportTree.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            listSelectionChanged(event.getSelection());
        }
    });
    exportTree.getViewer().addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            treeDoubleClicked(event);
        }
    });
    setTreeViewer(exportTree.getViewer());
    return exportComp;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) IWizardCategory(org.eclipse.ui.wizards.IWizardCategory) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent)

Example 54 with IDoubleClickListener

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

the class ListStringValueDialog method createDialogArea.

/**
     * Create contents of the dialog
     * 
     * @param parent
     */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    tableViewer = new TableViewer(container, SWT.FULL_SELECTION | SWT.BORDER);
    table = tableViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    TableLayout layout = new TableLayout();
    table.setLayout(layout);
    layout.addColumnData(new ColumnWeightData(100));
    final TableColumn tableColumn = new TableColumn(table, SWT.NONE);
    tableColumn.setAlignment(SWT.CENTER);
    tableColumn.setWidth(100);
    tableColumn.setText("column");
    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new ViewerLabelProvider());
    tableViewer.setInput(dataList);
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            selectObj = selection.getFirstElement();
        }
    });
    tableViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(final DoubleClickEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            selectObj = selection.getFirstElement();
            setReturnCode(0);
            close();
        }
    });
    //
    return container;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TableColumn(org.eclipse.swt.widgets.TableColumn) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 55 with IDoubleClickListener

use of org.eclipse.jface.viewers.IDoubleClickListener in project bndtools by bndtools.

the class PluginClassSelectionPage method createControl.

public void createControl(Composite parent) {
    setTitle("Plug-in Type");
    setDescription("Select from one of the following known plug-in types.");
    // Create controls
    Composite composite = new Composite(parent, SWT.NONE);
    table = new Table(composite, SWT.FULL_SELECTION | SWT.BORDER);
    viewer = new TableViewer(table);
    viewer.setContentProvider(ArrayContentProvider.getInstance());
    viewer.setSorter(new PluginClassSorter());
    viewer.setLabelProvider(new PluginDeclarationLabelProvider());
    // txtDescription = new ScrolledFormText(composite, true);
    // Load data
    IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(Plugin.PLUGIN_ID, "bndPlugins");
    viewer.setInput(elements);
    // Listeners
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            if (!programmaticChange) {
                try {
                    programmaticChange = true;
                    IStructuredSelection sel = (IStructuredSelection) viewer.getSelection();
                    setSelectedElement((IConfigurationElement) sel.getFirstElement());
                } finally {
                    programmaticChange = false;
                }
            }
        }
    });
    viewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            getContainer().showPage(getNextPage());
        }
    });
    // Layout
    GridLayout layout;
    GridData gd;
    layout = new GridLayout(1, false);
    composite.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    table.setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
    gd.heightHint = 150;
    // txtDescription.setLayoutData(gd);
    setControl(composite);
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) GridLayout(org.eclipse.swt.layout.GridLayout) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer)

Aggregations

DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)67 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)67 GridData (org.eclipse.swt.layout.GridData)40 TableViewer (org.eclipse.jface.viewers.TableViewer)37 Composite (org.eclipse.swt.widgets.Composite)33 SelectionEvent (org.eclipse.swt.events.SelectionEvent)32 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)28 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)25 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)25 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)23 GridLayout (org.eclipse.swt.layout.GridLayout)21 Table (org.eclipse.swt.widgets.Table)16 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)15 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)13 Button (org.eclipse.swt.widgets.Button)13 Label (org.eclipse.swt.widgets.Label)13 TableColumn (org.eclipse.swt.widgets.TableColumn)13 ISelection (org.eclipse.jface.viewers.ISelection)11 TreeViewer (org.eclipse.jface.viewers.TreeViewer)11 FillLayout (org.eclipse.swt.layout.FillLayout)10