Search in sources :

Example 61 with IStructuredContentProvider

use of org.eclipse.jface.viewers.IStructuredContentProvider in project tmdm-studio-se by Talend.

the class TisTableViewer method createViewer.

@Override
protected void createViewer() {
    super.createTable();
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    table.setLayoutData(gd);
    gd.heightHint = 80;
    // Up Down Delete button group
    Composite stepUpDownComposite = toolkit.createComposite(mainComposite, SWT.NONE);
    stepUpDownComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    GridLayout layout = new GridLayout(8, false);
    layout.marginTop = 0;
    layout.marginBottom = 0;
    layout.marginHeight = 0;
    stepUpDownComposite.setLayout(layout);
    // 
    // $NON-NLS-1$
    addButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    addButton.setToolTipText(Messages.Add);
    if (isXpath()) {
        addButton.setImage(ImageCache.getCreatedImage(EImage.ADD_NEWXPATH.getPath()));
    } else {
        addButton.setImage(ImageCache.getCreatedImage(EImage.ADD_OBJ.getPath()));
    }
    addButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            // check uniqueness by concatenating all the values
            List<Line> list = (List<Line>) getViewer().getInput();
            // Update the model
            Line line = new Line(columns.toArray(new ComplexTableViewerColumn[columns.size()]), getInitValues());
            list.add(line);
            viewer.setInput(list);
            // update the instances viewer
            viewer.setSelection(null);
            viewer.refresh();
            viewer.getTable().select(viewer.getTable().getItemCount() - 1);
            markDirty();
        }
    });
    // Add Multi
    if (isAddMulti()) {
        // $NON-NLS-1$
        Button selNewPathButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
        selNewPathButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
        selNewPathButton.setToolTipText(Messages.AddMultiple);
        selNewPathButton.setImage(ImageCache.getCreatedImage(EImage.SELECT_NEWXPATH.getPath()));
        selNewPathButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
            }

            @SuppressWarnings("unchecked")
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                xpathDialog = getNewXpathDlgInstance();
                xpathDialog.setConceptName(conceptName);
                xpathDialog.setBlockOnOpen(true);
                xpathDialog.open();
                if (xpathDialog.getReturnCode() == Window.OK) {
                    datamodelName = xpathDialog.getDataModelName();
                    // $NON-NLS-1$
                    String[] xpaths = xpathDialog.getXpath().split("&");
                    List<Line> list = new LinkedList<Line>();
                    for (String xpath : xpaths) {
                        // check uniqueness by concatenating all the values
                        list = (List<Line>) getViewer().getInput();
                        // Update the model
                        Line line = new Line(columns.toArray(new ComplexTableViewerColumn[columns.size()]), getLineValues(xpath, 0));
                        list.add(line);
                    }
                    viewer.setInput(list);
                    // update the instances viewer
                    viewer.setSelection(null);
                    viewer.refresh();
                    viewer.getTable().select(viewer.getTable().getItemCount() - 1);
                    markDirty();
                }
            }
        });
    }
    // $NON-NLS-1$
    deleteButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    deleteButton.setToolTipText(Messages.DeleteSelectedItem);
    deleteButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    deleteButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            List<Line> input = (List<Line>) viewer.getInput();
            TableItem[] items = viewer.getTable().getSelection();
            for (int i = 0; i < items.length; i++) {
                input.remove(items[i].getData());
            }
            viewer.setInput(input);
            markDirty();
        }
    });
    deleteButton.setImage(ImageCache.getCreatedImage(EImage.DELETE_OBJ.getPath()));
    // delete all
    // $NON-NLS-1$
    Button deleteAllButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    deleteAllButton.setToolTipText(Messages.DeleteAllItems);
    deleteAllButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    deleteAllButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            List<Line> items = (List<Line>) viewer.getInput();
            items.clear();
            viewer.setInput(items);
            viewer.refresh();
            markDirty();
        }
    });
    deleteAllButton.setImage(ImageCache.getCreatedImage(EImage.PROGRESS_REMALL.getPath()));
    // $NON-NLS-1$
    upButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    upButton.setToolTipText(Messages.MoveUpSelectedItem);
    upButton.setImage(ImageCache.getCreatedImage(EImage.PREV_NAV.getPath()));
    upButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    upButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            int index = viewer.getTable().getSelectionIndex();
            if (index > 0 && index < viewer.getTable().getItemCount()) {
                // commit as we go
                if (mainPage != null) {
                    mainPage.setComitting(true);
                }
                List<Line> items = (List<Line>) viewer.getInput();
                Line line = items.get(index);
                items.remove(index);
                items.add(index - 1, line);
                viewer.refresh();
                if (mainPage != null) {
                    mainPage.setComitting(false);
                }
                markDirty();
            }
        }
    });
    // $NON-NLS-1$
    downButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    downButton.setToolTipText(Messages.MovedownSelectedItem);
    downButton.setImage(ImageCache.getCreatedImage(EImage.NEXT_NAV.getPath()));
    downButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    downButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            int index = viewer.getTable().getSelectionIndex();
            if (index >= 0 && index < viewer.getTable().getItemCount() - 1) {
                // commit as we go
                if (mainPage != null) {
                    mainPage.setComitting(true);
                }
                List<Line> items = (List<Line>) viewer.getInput();
                Line line = items.get(index);
                items.remove(index);
                items.add(index + 1, line);
                // viewer.setInput(items);
                viewer.refresh();
                // TODO
                if (mainPage != null) {
                    mainPage.setComitting(false);
                }
                markDirty();
            }
        }
    });
    // $NON-NLS-1$
    copyButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    copyButton.setToolTipText(Messages.CopySelectedItems);
    copyButton.setImage(ImageCache.getCreatedImage(EImage.COPY.getPath()));
    copyButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    copyButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            int[] indexs = viewer.getTable().getSelectionIndices();
            List<Line> copyLines = new ArrayList<Line>();
            for (int index : indexs) {
                if (index >= 0 && index <= viewer.getTable().getItemCount() - 1) {
                    List<Line> items = (List<Line>) viewer.getInput();
                    Line line = items.get(index);
                    Line copyLine = line.clone();
                    copyLines.add(copyLine);
                }
            }
            if (indexs.length > 0) {
                // enable all paste buttons
                HashSet<Button> btns = pastBtns.get(String.valueOf(columns.size()));
                if (btns != null) {
                    for (Button btn : btns) {
                        if (btn != null) {
                            btn.setEnabled(true);
                        }
                    }
                }
                // add to workbenchclipboard
                WorkbenchClipboard.getWorkbenchClipboard().setLines(String.valueOf(columns.size()), copyLines);
            }
        }
    });
    // $NON-NLS-1$
    pastButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    pastButton.setToolTipText(Messages.PasteSelectedItem);
    pastButton.setImage(ImageCache.getCreatedImage(EImage.PASTE.getPath()));
    pastButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    pastButton.setEnabled(false);
    pastButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            if (mainPage != null) {
                mainPage.setComitting(true);
            }
            boolean dirty = false;
            List<Line> items = (List<Line>) viewer.getInput();
            List<Line> cacheLine = WorkbenchClipboard.getWorkbenchClipboard().getLines(String.valueOf(columns.size()));
            List<Line> coloneLine = new ArrayList<Line>();
            for (Line l : cacheLine) {
                coloneLine.add(l.clone());
            }
            if (cacheLine.size() > 0) {
                items.addAll(coloneLine);
                dirty = true;
            }
            viewer.refresh();
            // TODO
            if (mainPage != null) {
                mainPage.setComitting(false);
            }
            if (dirty) {
                markDirty();
            }
        }
    });
    HashSet<Button> btns = pastBtns.get(String.valueOf(columns.size()));
    if (btns == null) {
        btns = new HashSet<Button>();
        pastBtns.put(String.valueOf(columns.size()), btns);
    }
    btns.add(pastButton);
    // Create the cell editors --> We actually discard those later: not natural for an user
    CellEditor[] editors = new CellEditor[columns.size()];
    for (int i = 0; i < columns.size(); i++) {
        if (columns.get(i).isText()) {
            editors[i] = new TextCellEditor(table);
        } else if (columns.get(i).isCombo()) {
            editors[i] = new ComboBoxCellEditor(table, columns.get(i).getComboValues(), SWT.READ_ONLY);
        } else if (columns.get(i).isXPATH()) {
            editors[i] = new XpathCellEditor(table, validators.get(columns.get(i)));
        } else if (columns.get(i).isMultiMessage()) {
            editors[i] = new MultiMessageEditor(table);
            multiMsg.setColumn(table.getColumn(i));
        } else if (columns.get(i).isValidationRule()) {
            editors[i] = createValidationRuleEditor();
            validationRule.setColumn(table.getColumn(i));
        }
    }
    viewer.setCellEditors(editors);
    // set the content provider
    viewer.setContentProvider(new IStructuredContentProvider() {

        public void dispose() {
        }

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

        @SuppressWarnings("unchecked")
        public Object[] getElements(Object inputElement) {
            ArrayList<Line> lines = (ArrayList<Line>) inputElement;
            return lines.toArray(new Line[lines.size()]);
        }
    });
    // set the label provider
    viewer.setLabelProvider(new ITableLabelProvider() {

        public boolean isLabelProperty(Object element, String property) {
            return false;
        }

        public void dispose() {
        }

        public void addListener(ILabelProviderListener listener) {
        }

        public void removeListener(ILabelProviderListener listener) {
        }

        public String getColumnText(Object element, int columnIndex) {
            Line line = (Line) element;
            if (columnIndex >= 0 && columnIndex < columns.size()) {
                for (KeyValue keyvalue : line.keyValues) {
                    if (keyvalue.key.equals(columns.get(columnIndex).getName())) {
                        String val = keyvalue.value;
                        if (columns.get(columnIndex).isNillable()) {
                            if (columns.get(columnIndex).getNillValue().equals(val)) {
                                val = columns.get(columnIndex).getNillDisplay();
                            }
                        }
                        return val;
                    }
                }
            }
            // $NON-NLS-1$
            return "";
        }

        public Image getColumnImage(Object element, int columnIndex) {
            return null;
        }
    });
    // Set the column properties
    ArrayList<String> columnNames = new ArrayList<String>();
    for (ComplexTableViewerColumn column : columns) {
        columnNames.add(column.getName());
    }
    viewer.setColumnProperties(columnNames.toArray(new String[columnNames.size()]));
    // set the Cell Modifier
    viewer.setCellModifier(new ICellModifier() {

        public boolean canModify(Object element, String property) {
            return editable;
        }

        @SuppressWarnings("unchecked")
        public void modify(Object element, String property, Object value) {
            if (value instanceof Integer) {
                if (Integer.valueOf(value.toString()) == -1) {
                    return;
                }
            }
            // modify the text and combo cell value
            TableItem item = (TableItem) element;
            Line line = (Line) item.getData();
            int columnIndex = Arrays.asList(viewer.getColumnProperties()).indexOf(property);
            if (columnIndex >= 0 && columnIndex < viewer.getColumnProperties().length) {
                if (isAColumnWithCombo(columnIndex)) {
                    String[] attrs = columns.get(columnIndex).getComboValues();
                    value = attrs[Integer.parseInt(value.toString())];
                }
                KeyValue kv = line.keyValues.get(columnIndex);
                boolean noChange = kv.value.equals(value.toString());
                kv.value = value.toString();
                viewer.refresh();
                if (!noChange) {
                    markDirty();
                }
            }
        }

        public Object getValue(Object element, String property) {
            int columnIndex = Arrays.asList(viewer.getColumnProperties()).indexOf(property);
            Line line = (Line) element;
            // add getting value from combo
            if (isAColumnWithCombo(columnIndex)) {
                String value = line.keyValues.get(columnIndex).value;
                String[] attrs = columns.get(columnIndex).getComboValues();
                return Arrays.asList(attrs).indexOf(value);
            }
            for (KeyValue keyvalue : line.keyValues) {
                if (property.equals(keyvalue.key)) {
                    if (keyvalue.value.equals("")) {
                        // $NON-NLS-1$
                        return columns.get(columnIndex).getNillDisplay();
                    }
                    return keyvalue.value;
                }
            }
            return null;
        }

        private boolean isAColumnWithCombo(int columnIdx) {
            return columns.get(columnIdx).isCombo();
        }
    });
    // display for Delete Key events to delete an instance
    viewer.getTable().addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void keyReleased(KeyEvent e) {
            if ((e.stateMask == 0) && (e.character == SWT.DEL) && (viewer.getSelection() != null)) {
                Line line = (Line) ((IStructuredSelection) viewer.getSelection()).getFirstElement();
                // update the underlying role and refresh the table
                // update the underlying model
                List<Line> items = (List<Line>) viewer.getInput();
                items.remove(line);
                // refresh
                viewer.refresh();
                // mark for update
                markDirty();
            }
        }
    });
    // add dispose listener
    viewer.getTable().addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            HashSet<Button> btns = pastBtns.get(String.valueOf(columns.size()));
            btns.remove(pastButton);
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) KeyValue(com.amalto.workbench.models.KeyValue) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) TableItem(org.eclipse.swt.widgets.TableItem) ArrayList(java.util.ArrayList) Viewer(org.eclipse.jface.viewers.Viewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Image(org.eclipse.swt.graphics.Image) EImage(com.amalto.workbench.image.EImage) DisposeEvent(org.eclipse.swt.events.DisposeEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ICellModifier(org.eclipse.jface.viewers.ICellModifier) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) HashSet(java.util.HashSet) Composite(org.eclipse.swt.widgets.Composite) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) Line(com.amalto.workbench.models.Line) ILabelProviderListener(org.eclipse.jface.viewers.ILabelProviderListener) GridData(org.eclipse.swt.layout.GridData) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) KeyListener(org.eclipse.swt.events.KeyListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 62 with IStructuredContentProvider

use of org.eclipse.jface.viewers.IStructuredContentProvider in project tmdm-studio-se by Talend.

the class ComplexTableViewer method createViewer.

protected void createViewer() {
    createTable();
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, columns.size(), 1);
    table.setLayoutData(gd);
    gd.heightHint = 80;
    // Up Down Delete button group
    Composite stepUpDownComposite = toolkit.createComposite(mainComposite, SWT.NONE);
    stepUpDownComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    stepUpDownComposite.setLayout(new GridLayout(1, false));
    // $NON-NLS-1$
    upButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    upButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    upButton.setImage(ImageCache.getCreatedImage(EImage.PREV_NAV.getPath()));
    upButton.setToolTipText(Messages.ComplexTableViewer_UpBtnTip);
    upButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            int index = viewer.getTable().getSelectionIndex();
            if (index > 0 && index < viewer.getTable().getItemCount()) {
                // commit as we go
                if (mainPage != null) {
                    mainPage.setComitting(true);
                }
                List<Line> items = (List<Line>) viewer.getInput();
                Line line = items.get(index);
                items.remove(index);
                items.add(index - 1, line);
                viewer.refresh();
                if (mainPage != null) {
                    mainPage.setComitting(false);
                }
                markDirty();
            }
        }
    });
    // $NON-NLS-1$
    downButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    downButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    downButton.setImage(ImageCache.getCreatedImage(EImage.NEXT_NAV.getPath()));
    downButton.setToolTipText(Messages.ComplexTableViewer_DownBtnTip);
    downButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            int index = viewer.getTable().getSelectionIndex();
            if (index >= 0 && index < viewer.getTable().getItemCount() - 1) {
                // commit as we go
                if (mainPage != null) {
                    mainPage.setComitting(true);
                }
                List<Line> items = (List<Line>) viewer.getInput();
                Line line = items.get(index);
                items.remove(index);
                items.add(index + 1, line);
                // viewer.setInput(items);
                viewer.refresh();
                // TODO
                if (mainPage != null) {
                    mainPage.setComitting(false);
                }
                markDirty();
            }
        }
    });
    // $NON-NLS-1$
    deleteButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
    deleteButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    deleteButton.setToolTipText(Messages.ComplexTableViewer_DelBtnLabel);
    deleteButton.setImage(ImageCache.getCreatedImage(EImage.DELETE_OBJ.getPath()));
    deleteButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            int index = viewer.getTable().getSelectionIndex();
            if (index >= 0 && index < viewer.getTable().getItemCount()) {
                List<Line> items = (List<Line>) viewer.getInput();
                items.remove(index);
                viewer.refresh();
                int pos = index - 1;
                if (pos >= 0) {
                    viewer.getTable().select(pos);
                }
                markDirty();
            }
        }
    });
    // Create the cell editors --> We actually discard those later: not natural for an user
    CellEditor[] editors = new CellEditor[columns.size()];
    for (int i = 0; i < columns.size(); i++) {
        if (columns.get(i).isText()) {
            editors[i] = new TextCellEditor(table);
        } else if (columns.get(i).isCombo()) {
            editors[i] = new ComboBoxCellEditor(table, columns.get(i).getComboValues(), SWT.READ_ONLY);
        } else if (columns.get(i).isXPATH()) {
            editors[i] = new XpathCellEditor(table, validators.get(columns.get(i)));
        } else if (columns.get(i).isMultiMessage()) {
            editors[i] = new MultiMessageEditor(table);
            multiMsg.setColumn(table.getColumn(i));
        } else if (columns.get(i).isValidationRule()) {
            editors[i] = new ValidationRuleEditor(table);
            validationRule.setColumn(table.getColumn(i));
        }
    }
    viewer.setCellEditors(editors);
    // set the content provider
    viewer.setContentProvider(new IStructuredContentProvider() {

        public void dispose() {
        }

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

        @SuppressWarnings("unchecked")
        public Object[] getElements(Object inputElement) {
            List<Line> lines = (List<Line>) inputElement;
            return lines.toArray(new Line[lines.size()]);
        }
    });
    // set the label provider
    viewer.setLabelProvider(new ITableLabelProvider() {

        public boolean isLabelProperty(Object element, String property) {
            return false;
        }

        public void dispose() {
        }

        public void addListener(ILabelProviderListener listener) {
        }

        public void removeListener(ILabelProviderListener listener) {
        }

        public String getColumnText(Object element, int columnIndex) {
            Line line = (Line) element;
            if (columnIndex >= 0 && columnIndex < columns.size()) {
                for (KeyValue keyvalue : line.keyValues) {
                    if (keyvalue.key.equals(columns.get(columnIndex).getName())) {
                        String val = keyvalue.value;
                        if (columns.get(columnIndex).isNillable()) {
                            if (columns.get(columnIndex).getNillValue().equals(val)) {
                                val = columns.get(columnIndex).getNillDisplay();
                            }
                        }
                        return val;
                    }
                }
            }
            // $NON-NLS-1$
            return "";
        }

        public Image getColumnImage(Object element, int columnIndex) {
            return null;
        }
    });
    // Set the column properties
    ArrayList<String> columnNames = new ArrayList<String>();
    for (ComplexTableViewerColumn column : columns) {
        columnNames.add(column.getName());
    }
    viewer.setColumnProperties(columnNames.toArray(new String[columnNames.size()]));
    // set the Cell Modifier
    viewer.setCellModifier(new ICellModifier() {

        public boolean canModify(Object element, String property) {
            // if (INSTANCE_ACCESS.equals(property)) return true; Deactivated
            return editable;
        }

        @SuppressWarnings("unchecked")
        public void modify(Object element, String property, Object value) {
            if (value instanceof Integer) {
                if (Integer.valueOf(value.toString()) == -1) {
                    return;
                }
            }
            // modify the text and combo cell value
            TableItem item = (TableItem) element;
            Line line = (Line) item.getData();
            int columnIndex = Arrays.asList(viewer.getColumnProperties()).indexOf(property);
            if (!isForceTextCellEditor(columnIndex) && isAColumnWithCombo(columnIndex)) {
                String[] attrs = columns.get(columnIndex).getComboValues();
                value = attrs[Integer.parseInt(value.toString())];
            }
            KeyValue kv = line.keyValues.get(columnIndex);
            boolean noChange = kv.value.equals(value.toString());
            kv.value = value.toString();
            viewer.refresh();
            if (!noChange) {
                markDirty();
            }
        }

        public Object getValue(Object element, String property) {
            int columnIndex = Arrays.asList(viewer.getColumnProperties()).indexOf(property);
            Line line = (Line) element;
            // add getting value from combo
            if (isAColumnWithCombo(columnIndex)) {
                String value = line.keyValues.get(columnIndex).value;
                String[] attrs = columns.get(columnIndex).getComboValues();
                return Arrays.asList(attrs).indexOf(value);
            }
            for (KeyValue keyvalue : line.keyValues) {
                if (property.equals(keyvalue.key)) {
                    if (keyvalue.value.equals("")) {
                        // $NON-NLS-1$
                        return columns.get(columnIndex).getNillDisplay();
                    }
                    return keyvalue.value;
                }
            }
            return null;
        }

        private boolean isAColumnWithCombo(int columnIdx) {
            return columns.get(columnIdx).isCombo();
        }

        private boolean isForceTextCellEditor(int columnIdx) {
            return columns.get(columnIdx).isText();
        }
    });
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            Line line = (Line) ((IStructuredSelection) event.getSelection()).getFirstElement();
            for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
                if (line == null) {
                    Control control = columns.get(columnIndex).getControl();
                    if (control instanceof Text) {
                        // $NON-NLS-1$
                        ((Text) control).setText("");
                    }
                    if (control instanceof CCombo) {
                        ((CCombo) control).select(0);
                    }
                    if (control instanceof Combo) {
                        ((CCombo) control).select(0);
                    }
                } else {
                    for (KeyValue keyvalue : line.keyValues) {
                        if (keyvalue.key.equals(columns.get(columnIndex).getName())) {
                            String val = keyvalue.value;
                            Control control = columns.get(columnIndex).getControl();
                            if (control instanceof Text) {
                                ((Text) control).setText(val);
                            }
                            if (control instanceof CCombo) {
                                ((CCombo) control).setText(val);
                            }
                            if (control instanceof Combo) {
                                ((CCombo) control).setText(val);
                            }
                        }
                    }
                }
            }
        }
    });
    // display for Delete Key events to delete an instance
    viewer.getTable().addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
        }

        @SuppressWarnings("unchecked")
        public void keyReleased(KeyEvent e) {
            if ((e.stateMask == 0) && (e.character == SWT.DEL) && (viewer.getSelection() != null)) {
                Line line = (Line) ((IStructuredSelection) viewer.getSelection()).getFirstElement();
                // update the underlying role and refresh the table
                // update the underlying model
                List<Line> items = (List<Line>) viewer.getInput();
                items.remove(line);
                // refresh
                viewer.refresh();
                // mark for update
                markDirty();
            }
        }
    });
}
Also used : KeyValue(com.amalto.workbench.models.KeyValue) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) TableItem(org.eclipse.swt.widgets.TableItem) ArrayList(java.util.ArrayList) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) CCombo(org.eclipse.swt.custom.CCombo) Combo(org.eclipse.swt.widgets.Combo) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) EImage(com.amalto.workbench.image.EImage) Image(org.eclipse.swt.graphics.Image) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) Control(org.eclipse.swt.widgets.Control) ICellModifier(org.eclipse.jface.viewers.ICellModifier) List(java.util.List) ListenerList(org.eclipse.core.runtime.ListenerList) ArrayList(java.util.ArrayList) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) Text(org.eclipse.swt.widgets.Text) Line(com.amalto.workbench.models.Line) CCombo(org.eclipse.swt.custom.CCombo) ILabelProviderListener(org.eclipse.jface.viewers.ILabelProviderListener) GridData(org.eclipse.swt.layout.GridData) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) KeyListener(org.eclipse.swt.events.KeyListener) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 63 with IStructuredContentProvider

use of org.eclipse.jface.viewers.IStructuredContentProvider in project eclipse-integration-commons by spring-projects.

the class ConfiguratorPreferencesPage method createContents.

@Override
protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);
    Label label = new Label(composite, SWT.WRAP);
    label.setText("Configurable Extensions:");
    GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(label);
    extensionViewer = new TableViewer(composite, SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.SINGLE);
    extensionViewer.getTable().setHeaderVisible(true);
    extensionViewer.getTable().setLinesVisible(true);
    extensionViewer.setSorter(new ViewerSorter() {

        @SuppressWarnings("unchecked")
        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            String name1 = ((ConfigurableExtension) e1).getLabel();
            String name2 = ((ConfigurableExtension) e2).getLabel();
            return getComparator().compare(name1, name2);
        }
    });
    extensionViewer.setContentProvider(new IStructuredContentProvider() {

        Object[] elements;

        public void dispose() {
        // ignore
        }

        public Object[] getElements(Object inputElement) {
            return elements;
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            this.elements = (Object[]) newInput;
        }
    });
    GridDataFactory.fillDefaults().grab(true, true).applyTo(extensionViewer.getControl());
    TableViewerColumn statusColumn = new TableViewerColumn(extensionViewer, SWT.LEFT);
    statusColumn.getColumn().setText("");
    statusColumn.getColumn().setToolTipText("Configured");
    statusColumn.getColumn().setWidth(20);
    statusColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public Image getImage(Object element) {
            if (((ConfigurableExtension) element).isConfigured()) {
                return CommonImages.getImage(CommonImages.COMPLETE);
            }
            return null;
        }

        @Override
        public String getText(Object element) {
            return "";
        }
    });
    TableViewerColumn extensionColumn = new TableViewerColumn(extensionViewer, SWT.LEFT);
    extensionColumn.getColumn().setText("Extension");
    extensionColumn.getColumn().setWidth(250);
    extensionColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            return ((ConfigurableExtension) element).getLabel();
        }
    });
    TableViewerColumn locationColumn = new TableViewerColumn(extensionViewer, SWT.LEFT);
    locationColumn.getColumn().setText("Location");
    locationColumn.getColumn().setWidth(150);
    locationColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            return ((ConfigurableExtension) element).getLocation();
        }
    });
    extensionViewer.setInput(elements.toArray());
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    GridDataFactory.fillDefaults().grab(false, true).applyTo(buttonComposite);
    RowLayout layout = new RowLayout(SWT.VERTICAL);
    layout.fill = true;
    layout.marginLeft = 0;
    layout.marginTop = 0;
    layout.marginRight = 0;
    layout.marginBottom = 0;
    buttonComposite.setLayout(layout);
    configureButton = new Button(buttonComposite, SWT.NONE);
    configureButton.setText(" &Configure ");
    configureButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            ConfigurableExtension extension = getSelectedExtension(extensionViewer.getSelection());
            if (extension != null) {
                doConfigure(extension);
            }
        }
    });
    installButton = new Button(buttonComposite, SWT.NONE);
    installButton.setText(" &Install ");
    installButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            IStructuredSelection selection = (IStructuredSelection) extensionViewer.getSelection();
            ConfigurableExtension extension = (ConfigurableExtension) selection.getFirstElement();
            if (extension != null) {
                doInstall(extension);
            }
        }
    });
    Button refreshButton = new Button(buttonComposite, SWT.NONE);
    refreshButton.setText(" &Refresh ");
    refreshButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            doRefresh();
        }
    });
    extensionViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            updateSelection(event.getSelection());
        }
    });
    updateSelection(extensionViewer.getSelection());
    Group locationGroup = new Group(composite, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(locationGroup);
    locationGroup.setText("Runtime Locations");
    GridLayoutFactory.swtDefaults().numColumns(3).applyTo(locationGroup);
    File systemLocation = importer.getSystemLocation();
    if (systemLocation != null) {
        label = new Label(locationGroup, SWT.WRAP);
        label.setText("Search path for runtimes:");
        GridDataFactory.fillDefaults().grab(true, false).hint(100, SWT.DEFAULT).span(3, 1).applyTo(label);
        searchLocationsLabel = new Label(locationGroup, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, false).hint(100, SWT.DEFAULT).span(3, 1).applyTo(searchLocationsLabel);
    }
    useDefaultUserLocationButton = new Button(locationGroup, SWT.CHECK);
    GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(useDefaultUserLocationButton);
    useDefaultUserLocationButton.setText("Use Default");
    useDefaultUserLocationButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            userLocationText.setEnabled(!useDefaultUserLocationButton.getSelection());
            browseButton.setEnabled(!useDefaultUserLocationButton.getSelection());
            if (useDefaultUserLocationButton.getSelection()) {
                resetUserLocation();
            }
        }
    });
    label = new Label(locationGroup, SWT.WRAP);
    label.setText("Install Location:");
    userLocationText = new Text(locationGroup, SWT.BORDER);
    userLocationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    userLocationText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            try {
                File file = new File(userLocationText.getText());
                if (!file.canWrite()) {
                    setErrorMessage(NLS.bind("''{0}'' is not writeable. Please select a different directory.", userLocationText.getText()));
                    setInstallEnabled(false);
                } else {
                    setErrorMessage(null);
                    setInstallEnabled(true);
                }
            } catch (Exception e) {
                setErrorMessage(NLS.bind("''{0}'' is not a valid path.", userLocationText.getText()));
                setInstallEnabled(false);
            }
        }
    });
    browseButton = new Button(locationGroup, SWT.NONE);
    browseButton.setText("Directory...");
    browseButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setMessage("Select the root directory for installing extensions.");
            String path = userLocationText.getText();
            path = path.replaceAll("\\\\", "/");
            dialog.setFilterPath(path);
            path = dialog.open();
            if (path == null || path.equals("")) {
                // $NON-NLS-1$
                return;
            }
            path = path.replaceAll("\\\\", "/");
            userLocationText.setText(path);
        }
    });
    initWidgets();
    return composite;
}
Also used : Group(org.eclipse.swt.widgets.Group) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ViewerSorter(org.eclipse.jface.viewers.ViewerSorter) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Image(org.eclipse.swt.graphics.Image) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ConfigurableExtension(org.springsource.ide.eclipse.commons.configurator.ConfigurableExtension) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Text(org.eclipse.swt.widgets.Text) CoreException(org.eclipse.core.runtime.CoreException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) File(java.io.File)

Example 64 with IStructuredContentProvider

use of org.eclipse.jface.viewers.IStructuredContentProvider in project webtools.sourceediting by eclipse.

the class AddProcessorDialog method createDialogFields.

protected void createDialogFields(Composite parent) {
    GridData gd;
    Label label;
    label = new Label(parent, SWT.NONE);
    label.setText(Messages.AddProcessorDialog_processorName);
    processorNameField = new Text(parent, SWT.BORDER);
    gd = new GridData(SWT.NONE, SWT.NONE, false, false);
    gd.widthHint = convertWidthInCharsToPixels(50);
    gd.horizontalSpan = 2;
    processorNameField.setLayoutData(gd);
    label = new Label(parent, SWT.NONE);
    label.setText(Messages.AddProcessorDialog_processorType);
    processorTypeField = new ComboViewer(parent, SWT.READ_ONLY);
    gd = new GridData();
    gd.horizontalSpan = 2;
    processorTypeField.getCombo().setLayoutData(gd);
    processorTypeField.setContentProvider(new IStructuredContentProvider() {

        private Object input;

        public Object[] getElements(Object inputElement) {
            return (IProcessorType[]) input;
        }

        public void dispose() {
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            input = newInput;
        }
    });
    processorTypeField.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            return ((IProcessorType) element).getLabel();
        }
    });
}
Also used : ComboViewer(org.eclipse.jface.viewers.ComboViewer) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) Text(org.eclipse.swt.widgets.Text) ComboViewer(org.eclipse.jface.viewers.ComboViewer) Viewer(org.eclipse.jface.viewers.Viewer) IProcessorType(org.eclipse.wst.xsl.jaxp.launching.IProcessorType) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 65 with IStructuredContentProvider

use of org.eclipse.jface.viewers.IStructuredContentProvider in project webtools.sourceediting by eclipse.

the class ProcessorBlock method createControl.

public void createControl(Composite parent) {
    Font font = parent.getFont();
    Composite group = new Composite(parent, SWT.NULL);
    setControl(group);
    group.setLayout(new GridLayout(2, false));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setFont(font);
    // group.setText(ProcessorMessages.ProcessorBlock_0);
    usePreferencesRadio = new Button(group, SWT.RADIO);
    usePreferencesRadio.setText(ProcessorMessages.ProcessorBlock_1);
    usePreferencesRadio.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            preferencesSelected();
            updateLaunchConfigurationDialog();
        }
    });
    alterPreferencesButton = new Button(group, SWT.PUSH);
    alterPreferencesButton.setText(ProcessorMessages.ProcessorBlock_2);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
    gd.widthHint = 150;
    alterPreferencesButton.setLayoutData(gd);
    alterPreferencesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IPreferencePage page = new ProcessorsPreferencePage();
            // $NON-NLS-1$
            showPrefPage("org.eclipse.wst.xslt.launching.ui.preferences.ProcessorPreferencePage", page);
        }
    });
    overridePreferencesRadio = new Button(group, SWT.RADIO);
    overridePreferencesRadio.setText(ProcessorMessages.ProcessorBlock_4);
    overridePreferencesRadio.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            overrideSelected();
            updateLaunchConfigurationDialog();
        }
    });
    installedProcessorsButton = new Button(group, SWT.PUSH);
    installedProcessorsButton.setText(ProcessorMessages.ProcessorsComboBlock_1);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
    gd.widthHint = 150;
    installedProcessorsButton.setLayoutData(gd);
    installedProcessorsButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IPreferencePage page = new ProcessorsPreferencePage();
            // $NON-NLS-1$
            showPrefPage("org.eclipse.wst.xslt.launching.ui.preferences.ProcessorPreferencePage", page);
        }
    });
    Composite settingsComp = new Composite(group, SWT.NONE);
    GridLayout gl = new GridLayout(3, false);
    gl.marginHeight = 2;
    settingsComp.setLayout(gl);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalIndent = 15;
    gd.horizontalSpan = 2;
    settingsComp.setLayoutData(gd);
    settingsComp.setFont(font);
    Label label = new Label(settingsComp, SWT.NONE);
    label.setText(ProcessorMessages.ProcessorBlock_6);
    runCombo = new Combo(settingsComp, SWT.READ_ONLY | SWT.SINGLE);
    runCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    runComboViewer = new ComboViewer(runCombo);
    runComboViewer.setContentProvider(new ComboContentProvider());
    runComboViewer.setLabelProvider(new ComboLabelProvider());
    runComboViewer.setInput(JAXPRuntime.getProcessors());
    runComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sel = (IStructuredSelection) event.getSelection();
            if (!sel.isEmpty()) {
                IProcessorInstall processor = (IProcessorInstall) sel.getFirstElement();
                if (processor.getProcessorType().getTransformerFactories().length > 1)
                    factoryComboViewer.getCombo().setVisible(true);
                else
                    factoryComboViewer.getCombo().setVisible(false);
                factoryComboViewer.setInput(processor.getProcessorType());
                boolean found = false;
                for (ITransformerFactory tf : processor.getProcessorType().getTransformerFactories()) {
                    if (tf.equals(currentFactory)) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    currentFactory = processor.getProcessorType().getDefaultTransformerFactory();
                    if (currentFactory != null)
                        factoryComboViewer.setSelection(new StructuredSelection(currentFactory));
                }
            }
            updateLaunchConfigurationDialog();
        }
    });
    Combo factoryCombo = new Combo(settingsComp, SWT.READ_ONLY | SWT.SINGLE);
    factoryCombo.setLayoutData(new GridData(80, SWT.DEFAULT));
    factoryComboViewer = new ComboViewer(factoryCombo);
    factoryComboViewer.setContentProvider(new IStructuredContentProvider() {

        private IProcessorType type;

        public Object[] getElements(Object inputElement) {
            return type.getTransformerFactories();
        }

        public void dispose() {
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            this.type = (IProcessorType) newInput;
        }
    });
    factoryComboViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            ITransformerFactory f = (ITransformerFactory) element;
            // + " - " + f.getFactoryClass();
            return f.getName();
        }
    });
    factoryComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            currentFactory = (ITransformerFactory) ((IStructuredSelection) event.getSelection()).getFirstElement();
            updateLaunchConfigurationDialog();
        }
    });
// overridePreferencesButton = new Button(group,SWT.CHECK);
// overridePreferencesButton.setText("Override preferences");
// gd = new GridData(SWT.NONE,SWT.NONE,false,false);
// overridePreferencesButton.setLayoutData(gd);
// overridePreferencesButton.addSelectionListener(new SelectionListener(){
// public void widgetDefaultSelected(SelectionEvent e)
// {}
// 
// public void widgetSelected(SelectionEvent e)
// {
// firePreferenceProcessorChanged(overridePreferencesButton.getSelection());
// }
// });
}
Also used : Label(org.eclipse.swt.widgets.Label) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Combo(org.eclipse.swt.widgets.Combo) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ComboViewer(org.eclipse.jface.viewers.ComboViewer) Viewer(org.eclipse.jface.viewers.Viewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Font(org.eclipse.swt.graphics.Font) GridLayout(org.eclipse.swt.layout.GridLayout) ITransformerFactory(org.eclipse.wst.xsl.jaxp.launching.ITransformerFactory) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ProcessorsPreferencePage(org.eclipse.wst.xsl.jaxp.debug.ui.internal.preferences.ProcessorsPreferencePage) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall) IProcessorType(org.eclipse.wst.xsl.jaxp.launching.IProcessorType) ComboViewer(org.eclipse.jface.viewers.ComboViewer) GridData(org.eclipse.swt.layout.GridData) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) IPreferencePage(org.eclipse.jface.preference.IPreferencePage) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Aggregations

IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)99 Viewer (org.eclipse.jface.viewers.Viewer)77 Composite (org.eclipse.swt.widgets.Composite)58 GridData (org.eclipse.swt.layout.GridData)54 TableViewer (org.eclipse.jface.viewers.TableViewer)45 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)43 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)42 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)40 GridLayout (org.eclipse.swt.layout.GridLayout)40 LabelProvider (org.eclipse.jface.viewers.LabelProvider)32 Image (org.eclipse.swt.graphics.Image)29 Button (org.eclipse.swt.widgets.Button)28 Label (org.eclipse.swt.widgets.Label)28 SelectionEvent (org.eclipse.swt.events.SelectionEvent)26 Table (org.eclipse.swt.widgets.Table)24 ArrayList (java.util.ArrayList)23 ComboViewer (org.eclipse.jface.viewers.ComboViewer)19 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)19 ILabelProviderListener (org.eclipse.jface.viewers.ILabelProviderListener)18 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)18