Search in sources :

Example 91 with ISelectionChangedListener

use of org.eclipse.jface.viewers.ISelectionChangedListener in project archi by archimatetool.

the class UserPropertiesSection method createTableControl.

private void createTableControl(Composite parent) {
    // Table Composite
    Composite tableComp = createTableComposite(parent, SWT.NULL);
    TableColumnLayout tableLayout = (TableColumnLayout) tableComp.getLayout();
    // Table Viewer
    fTableViewer = new TableViewer(tableComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
    fTableViewer.getTable().setHeaderVisible(true);
    fTableViewer.getTable().setLinesVisible(true);
    addDragSupport();
    addDropSupport();
    // Help ID on table
    PlatformUI.getWorkbench().getHelpSystem().setHelp(fTableViewer.getTable(), HELP_ID);
    // Columns
    TableViewerColumn columnBlank = new TableViewerColumn(fTableViewer, SWT.NONE, 0);
    tableLayout.setColumnData(columnBlank.getColumn(), new ColumnPixelData(24, false));
    TableViewerColumn columnKey = new TableViewerColumn(fTableViewer, SWT.NONE, 1);
    columnKey.getColumn().setText(Messages.UserPropertiesSection_0);
    tableLayout.setColumnData(columnKey.getColumn(), new ColumnWeightData(20, true));
    columnKey.setEditingSupport(new KeyEditingSupport(fTableViewer));
    // Click on Key Table Header
    columnKey.getColumn().addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            sortKeys();
        }
    });
    TableViewerColumn columnValue = new TableViewerColumn(fTableViewer, SWT.NONE, 2);
    columnValue.getColumn().setText(Messages.UserPropertiesSection_1);
    tableLayout.setColumnData(columnValue.getColumn(), new ColumnWeightData(80, true));
    columnValue.setEditingSupport(new ValueEditingSupport(fTableViewer));
    // Content Provider
    fTableViewer.setContentProvider(new IStructuredContentProvider() {

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }

        public void dispose() {
        }

        public Object[] getElements(Object inputElement) {
            return ((IProperties) inputElement).getProperties().toArray();
        }
    });
    // Label Provider
    fTableViewer.setLabelProvider(new LabelCellProvider());
    // Toolbar
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.VERTICAL);
    GridDataFactory.fillDefaults().align(SWT.END, SWT.TOP).applyTo(toolBar);
    ToolBarManager toolBarmanager = new ToolBarManager(toolBar);
    // New Property
    fActionNewProperty = new Action(Messages.UserPropertiesSection_2) {

        @Override
        public void run() {
            if (isAlive(fPropertiesElement)) {
                int index = -1;
                IProperty selected = (IProperty) ((IStructuredSelection) fTableViewer.getSelection()).getFirstElement();
                if (selected != null) {
                    index = fPropertiesElement.getProperties().indexOf(selected) + 1;
                }
                IProperty property = IArchimateFactory.eINSTANCE.createProperty();
                executeCommand(new NewPropertyCommand(fPropertiesElement.getProperties(), property, index));
                fTableViewer.editElement(property, 1);
            }
        }

        @Override
        public String getToolTipText() {
            return getText();
        }

        @Override
        public ImageDescriptor getImageDescriptor() {
            return IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_PLUS);
        }
    };
    // New Multiple Properties
    fActionNewMultipleProperty = new Action(Messages.UserPropertiesSection_3) {

        @Override
        public void run() {
            if (isAlive(fPropertiesElement)) {
                MultipleAddDialog dialog = new MultipleAddDialog(fPage.getSite().getShell());
                if (dialog.open() == Window.OK) {
                    executeCommand(dialog.getCommand());
                }
            }
        }

        @Override
        public String getToolTipText() {
            return getText();
        }

        @Override
        public ImageDescriptor getImageDescriptor() {
            return IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_MUTIPLE);
        }
    };
    // Remove Property
    fActionRemoveProperty = new Action(Messages.UserPropertiesSection_4) {

        @Override
        public void run() {
            if (isAlive(fPropertiesElement)) {
                CompoundCommand compoundCmd = new EObjectNonNotifyingCompoundCommand(fPropertiesElement) {

                    @Override
                    public String getLabel() {
                        return getCommands().size() > 1 ? Messages.UserPropertiesSection_5 : Messages.UserPropertiesSection_6;
                    }
                };
                for (Object o : ((IStructuredSelection) fTableViewer.getSelection()).toList()) {
                    Command cmd = new RemovePropertyCommand(fPropertiesElement.getProperties(), (IProperty) o);
                    compoundCmd.add(cmd);
                }
                executeCommand(compoundCmd);
            }
        }

        @Override
        public String getToolTipText() {
            return getText();
        }

        @Override
        public ImageDescriptor getImageDescriptor() {
            return IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_SMALL_X);
        }
    };
    fActionRemoveProperty.setEnabled(false);
    // Manage
    fActionShowKeyEditor = new Action(Messages.UserPropertiesSection_7) {

        @Override
        public void run() {
            if (isAlive(fPropertiesElement)) {
                UserPropertiesManagerDialog dialog = new UserPropertiesManagerDialog(fPage.getSite().getShell(), getArchimateModel());
                dialog.open();
            }
        }

        @Override
        public String getToolTipText() {
            return getText();
        }

        @Override
        public ImageDescriptor getImageDescriptor() {
            return IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_COG);
        }
    };
    toolBarmanager.add(fActionNewProperty);
    toolBarmanager.add(fActionNewMultipleProperty);
    toolBarmanager.add(fActionRemoveProperty);
    toolBarmanager.add(fActionShowKeyEditor);
    toolBarmanager.update(true);
    /*
         * Selection Listener
         */
    fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            fActionRemoveProperty.setEnabled(!event.getSelection().isEmpty());
        }
    });
    /*
         * Table Double-click on cell
         */
    fTableViewer.getTable().addListener(SWT.MouseDoubleClick, new Listener() {

        @Override
        public void handleEvent(Event event) {
            // Get Table item
            TableItem item = fTableViewer.getTable().getItem(new Point(event.x, event.y));
            // Double-click into empty table creates new Property
            if (item == null) {
                fActionNewProperty.run();
            } else // Handle selected item property double-clicked
            {
                if (item.getData() instanceof IProperty) {
                    handleDoubleClick((IProperty) item.getData());
                }
            }
        }
    });
    hookContextMenu();
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) EObjectNonNotifyingCompoundCommand(com.archimatetool.editor.model.commands.EObjectNonNotifyingCompoundCommand) IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IMenuListener(org.eclipse.jface.action.IMenuListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) DragSourceListener(org.eclipse.swt.dnd.DragSourceListener) Listener(org.eclipse.swt.widgets.Listener) DropTargetListener(org.eclipse.swt.dnd.DropTargetListener) TableItem(org.eclipse.swt.widgets.TableItem) TableViewer(org.eclipse.jface.viewers.TableViewer) ColumnViewer(org.eclipse.jface.viewers.ColumnViewer) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) Viewer(org.eclipse.jface.viewers.Viewer) IProperties(com.archimatetool.model.IProperties) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ToolBarManager(org.eclipse.jface.action.ToolBarManager) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) EObjectNonNotifyingCompoundCommand(com.archimatetool.editor.model.commands.EObjectNonNotifyingCompoundCommand) UpdatingTableColumnLayout(com.archimatetool.editor.ui.components.UpdatingTableColumnLayout) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) IProperty(com.archimatetool.model.IProperty) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ColumnPixelData(org.eclipse.jface.viewers.ColumnPixelData) Point(org.eclipse.swt.graphics.Point) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) Command(org.eclipse.gef.commands.Command) EObjectNonNotifyingCompoundCommand(com.archimatetool.editor.model.commands.EObjectNonNotifyingCompoundCommand) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) ToolBar(org.eclipse.swt.widgets.ToolBar) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) DragSourceEvent(org.eclipse.swt.dnd.DragSourceEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IArchimateModelObject(com.archimatetool.model.IArchimateModelObject) EObject(org.eclipse.emf.ecore.EObject) TableViewer(org.eclipse.jface.viewers.TableViewer) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer)

Example 92 with ISelectionChangedListener

use of org.eclipse.jface.viewers.ISelectionChangedListener in project archi by archimatetool.

the class TreeModelView method doCreatePartControl.

@Override
public void doCreatePartControl(Composite parent) {
    fParentComposite = parent;
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    parent.setLayout(layout);
    fTreeViewer = new TreeModelViewer(parent, SWT.NULL);
    fTreeViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    fTreeViewer.setInput(IEditorModelManager.INSTANCE);
    /*
         * Listen to Double-click and press Return Action
         */
    fTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            handleOpenAction();
        }
    });
    // Tree selection listener
    fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            // Update actions
            updateActions();
        }
    });
    // Register selections
    getSite().setSelectionProvider(getViewer());
    // Add Selection Sync
    TreeSelectionSynchroniser.INSTANCE.setTreeModelView(this);
    // Register us as a UIRequest Listener
    UIRequestManager.INSTANCE.addListener(this);
    // Search Filter
    fSearchFilter = new SearchFilter(fTreeViewer);
    fTreeViewer.addFilter(fSearchFilter);
    makeActions();
    hookContextMenu();
    registerGlobalActions();
    makeLocalToolBar();
    // Drag support
    new TreeModelViewerDragDropHandler(fTreeViewer);
    // Expand tree elements
    TreeStateHelper.INSTANCE.restoreExpandedTreeElements(fTreeViewer);
    // This will update previous Undo/Redo text if Tree was closed before
    updateActions();
    // Help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) SearchFilter(com.archimatetool.editor.views.tree.search.SearchFilter)

Example 93 with ISelectionChangedListener

use of org.eclipse.jface.viewers.ISelectionChangedListener in project xtext-eclipse by eclipse.

the class XtextEObjectSearchDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite container) {
    Composite parent = (Composite) super.createDialogArea(container);
    if (enableStyledLabels && labelProvider instanceof IStyledLabelProvider) {
        final Table table = getTableViewer().getTable();
        final IStyledLabelProvider styledLabelProvider = (IStyledLabelProvider) labelProvider;
        TableOwnerDrawSupport.install(table);
        Listener listener = new Listener() {

            @Override
            public void handleEvent(Event event) {
                handleSetData(event);
            }

            protected void handleSetData(Event event) {
                TableItem item = (TableItem) event.item;
                IEObjectDescription description = (IEObjectDescription) item.getData();
                if (description != null) {
                    StyledString styledString = styledLabelProvider.getStyledText(description);
                    String displayString = styledString.toString();
                    StyleRange[] styleRanges = styledString.getStyleRanges();
                    item.setText(displayString);
                    TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges);
                }
            }
        };
        table.addListener(SWT.SetData, listener);
    }
    messageLabel = new Label(parent, SWT.NONE);
    setDefaultGridData(messageLabel);
    EObjectDescriptionContentProvider contentProvider = new EObjectDescriptionContentProvider();
    getTableViewer().setContentProvider(contentProvider);
    getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            if (selection instanceof IStructuredSelection) {
                IStructuredSelection structuredSelection = (IStructuredSelection) selection;
                if (!structuredSelection.isEmpty()) {
                    Object firstElement = structuredSelection.getFirstElement();
                    if (firstElement instanceof IEObjectDescription) {
                        IEObjectDescription eObjectDescription = (IEObjectDescription) firstElement;
                        URI resourceURI = eObjectDescription.getEObjectURI().trimFragment();
                        if (resourceURI.isPlatform()) {
                            messageLabel.setText(resourceURI.toPlatformString(true));
                        } else if (resourceURI.isFile()) {
                            messageLabel.setText(resourceURI.toFileString());
                        } else {
                            messageLabel.setText(resourceURI.toString());
                        }
                        return;
                    }
                }
            }
            // $NON-NLS-1$
            messageLabel.setText("");
        }
    });
    applyFilter();
    return parent;
}
Also used : Table(org.eclipse.swt.widgets.Table) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) Composite(org.eclipse.swt.widgets.Composite) TableItem(org.eclipse.swt.widgets.TableItem) StyleRange(org.eclipse.swt.custom.StyleRange) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) URI(org.eclipse.emf.common.util.URI) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) IStyledLabelProvider(org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider) ISelection(org.eclipse.jface.viewers.ISelection) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Event(org.eclipse.swt.widgets.Event) KeyEvent(org.eclipse.swt.events.KeyEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent)

Example 94 with ISelectionChangedListener

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

the class ShardKeysPanel method initial.

private void initial() {
    insertKeyItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            addNewKey();
        }
    });
    deletekeyItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            keyListTable.forceFocus();
            deleteKey();
        }
    });
    keyListTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @SuppressWarnings("unchecked")
        public void selectionChanged(SelectionChangedEvent arg0) {
            int selectedItemCount = keyListTable.getSelectionCount();
            if (selectedItemCount > 0) {
                deletekeyItem.setEnabled(true);
            } else {
                deletekeyItem.setEnabled(false);
            }
            if (selectedItemCount == 1) {
                String keyName = ((Map<String, String>) keyListTable.getSelection()[0].getData()).get("0");
                keyInfoGroup.setText("Key Info: " + keyName);
                insertKeyInfoItem.setEnabled(true);
                saveShardKey();
                currentShardKey = module.getShardKeysFile().getKey(keyName);
                initKeyInfoList();
                keyInfoTableViewer.refresh();
                setKeyInfoColor();
            } else {
                insertKeyInfoItem.setEnabled(false);
            }
        }
    });
    setKeyListColor();
    linkEditorForKeyListTable();
    insertKeyInfoItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            addNewKeyInfo();
        }
    });
    deletekeyInfoItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            keyInfoTable.forceFocus();
            deleteKeyInfo();
        }
    });
    keyInfoTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent arg0) {
            int selectedItemCount = keyInfoTable.getSelectionCount();
            if (selectedItemCount > 0) {
                deletekeyInfoItem.setEnabled(true);
            } else {
                deletekeyInfoItem.setEnabled(false);
            }
        }
    });
    setKeyInfoColor();
    linkEditorForKeyInfoTable();
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent)

Example 95 with ISelectionChangedListener

use of org.eclipse.jface.viewers.ISelectionChangedListener in project sling by apache.

the class MVPEditor method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    // now add the node type dropbox-combo
    Composite header = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 3;
    header.setLayout(layout);
    Label label = new Label(header, SWT.WRAP);
    label.setText("Modify property " + property.getName() + ":");
    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(data);
    label.setFont(parent.getFont());
    ToolBar buttonBar = new ToolBar(header, SWT.NONE);
    ToolItem invisible = new ToolItem(buttonBar, SWT.NONE);
    ToolItem plus = new ToolItem(buttonBar, SWT.NONE);
    plus.setImage(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD).createImage());
    plus.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            plus();
        }
    });
    final ToolItem minus = new ToolItem(buttonBar, SWT.NONE);
    minus.setImage(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE).createImage());
    minus.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            minus();
        }
    });
    minus.setEnabled(false);
    Composite tableParent = new Composite(composite, SWT.NONE);
    final GridData layoutData = new GridData(GridData.FILL_BOTH);
    layoutData.heightHint = 150;
    tableParent.setLayoutData(layoutData);
    TableColumnLayout tableLayout = new TableColumnLayout();
    tableParent.setLayout(tableLayout);
    viewer = new TableViewer(tableParent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    viewer.getTable().setLinesVisible(true);
    viewer.getTable().setHeaderVisible(true);
    // accessing property here directly, instead of going via (JcrProperty)inputElement;
    String[] rawLines = property.getValuesAsString();
    // convert raw lines to Line objects for easier editing management
    for (int i = 0; i < rawLines.length; i++) {
        lines.add(new Line(rawLines[i]));
    }
    viewer.setContentProvider(new IStructuredContentProvider() {

        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }

        @Override
        public void dispose() {
        }

        @Override
        public Object[] getElements(Object inputElement) {
            return lines.toArray();
        }
    });
    TableViewerColumn column0 = new TableViewerColumn(viewer, SWT.NONE);
    column0.getColumn().setText("Type");
    column0.getColumn().setResizable(true);
    column0.getColumn().setWidth(100);
    tableLayout.setColumnData(column0.getColumn(), new ColumnWeightData(20, 100));
    column0.setLabelProvider(new CellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            try {
                cell.setText(property.getTypeAsString());
                cell.setForeground(greyColor);
            } catch (Exception e) {
                cell.setText("n/a");
                cell.setForeground(greyColor);
            }
        }
    });
    TableViewerColumn column1 = new TableViewerColumn(viewer, SWT.NONE);
    column1.getColumn().setText("Value");
    column1.getColumn().setResizable(true);
    column1.getColumn().setWidth(200);
    tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(80, 200));
    column1.setLabelProvider(new CellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            Line line = (Line) cell.getElement();
            cell.setText(line.getValue());
        }
    });
    column1.setEditingSupport(new EditingSupport(viewer) {

        @Override
        protected void setValue(Object element, Object value) {
            Line line = (Line) element;
            line.setValue(String.valueOf(value));
            // trigger a refresh:
            viewer.setInput(property);
        }

        @Override
        protected Object getValue(Object element) {
            final Line line = (Line) element;
            final String value = line.getValue();
            System.out.println("Value=" + value);
            return value;
        }

        @Override
        protected CellEditor getCellEditor(Object element) {
            return new TextCellEditor(viewer.getTable());
        }

        @Override
        protected boolean canEdit(Object element) {
            // all values are editable
            return true;
        }
    });
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            final ISelection selection = event.getSelection();
            if (selection instanceof IStructuredSelection) {
                IStructuredSelection iss = (IStructuredSelection) selection;
                if (iss.isEmpty()) {
                    minus.setEnabled(false);
                } else {
                    minus.setEnabled(true);
                }
            } else {
                minus.setEnabled(false);
            }
        }
    });
    viewer.setInput(property);
    return composite;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) Label(org.eclipse.swt.widgets.Label) EditingSupport(org.eclipse.jface.viewers.EditingSupport) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ISelection(org.eclipse.jface.viewers.ISelection) ToolItem(org.eclipse.swt.widgets.ToolItem) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) CellLabelProvider(org.eclipse.jface.viewers.CellLabelProvider) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ViewerCell(org.eclipse.jface.viewers.ViewerCell) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer)

Aggregations

ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)774 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)755 GridData (org.eclipse.swt.layout.GridData)419 Composite (org.eclipse.swt.widgets.Composite)333 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)302 GridLayout (org.eclipse.swt.layout.GridLayout)247 SelectionEvent (org.eclipse.swt.events.SelectionEvent)187 Label (org.eclipse.swt.widgets.Label)157 TableViewer (org.eclipse.jface.viewers.TableViewer)151 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)147 Button (org.eclipse.swt.widgets.Button)141 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)139 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)131 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)121 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)120 IPropertiesEditionEvent (org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)116 PropertiesEditionEvent (org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)116 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)116 Table (org.eclipse.swt.widgets.Table)93 ISelection (org.eclipse.jface.viewers.ISelection)87