Examples of TextCellEditor


Examples of org.eclipse.jface.viewers.TextCellEditor

      propertiesTableValueColumn.setWidth(230);
      propertiesTableValueColumn.setText("Value");

      propertiesViewer.setColumnProperties(new String[] {KEY_PROPERTY, VALUE_PROPERTY});

      propertiesViewer.setCellEditors(new CellEditor[] {new TextCellEditor(propertiesTable, SWT.NONE),
          new TextCellEditor(propertiesTable, SWT.NONE)});
      propertiesViewer.setCellModifier(new ICellModifier() {
        public boolean canModify(Object element, String property) {
          return true;
        }
View Full Code Here

Examples of org.eclipse.jface.viewers.TextCellEditor

                return value;
            }
           
            @Override
            protected CellEditor getCellEditor(Object element) {
                return new TextCellEditor(viewer.getTable());
            }
           
            @Override
            protected boolean canEdit(Object element) {
                // all values are editable
View Full Code Here

Examples of org.eclipse.jface.viewers.TextCellEditor

            return null;
        }
        switch(columnId) {
        case NAME: {
            // no validator needed - any string is OK
            return new TextCellEditor(tableViewer.getTable());
        }
        case TYPE: {
            // using a dropdown editor
            final ComboBoxCellEditor editor = new ComboBoxCellEditor(tableViewer.getTable(),
                    PropertyTypeSupport.PROPERTY_TYPES, SWT.NONE);
            editor.setActivationStyle(ComboBoxCellEditor.DROP_DOWN_ON_KEY_ACTIVATION |
                    ComboBoxCellEditor.DROP_DOWN_ON_MOUSE_ACTIVATION |
                    ComboBoxCellEditor.DROP_DOWN_ON_TRAVERSE_ACTIVATION);
            return editor;
        }
        case VALUE: {
            final Field field = asField(element);
            if (getNode().getProperty(field.getPropertyName()).isMultiple()) {
                // then launch the MVPEditor instead of returning an editor here
                return new MVNCellEditor(tableViewer.getTable(), getNode(), field.getPropertyName());
            }
            if (field.getPropertyType()==PropertyType.DATE) {
                return new DateTimeCellEditor(tableViewer.getTable(), getNode(), field.getPropertyName());
            }
            if (field.getPropertyType()==PropertyType.BOOLEAN) {
                return new ComboBoxCellEditor(tableViewer.getTable(), new String[] {"false", "true"}, SWT.READ_ONLY);
            }
            CellEditor editor;
            if (field.getPropertyName().equals("jcr:primaryType")) {
                editor = new TextCellEditor(tableViewer.getTable()) {
                    @Override
                    protected Control createControl(Composite parent) {
                        Text text = (Text) super.createControl(parent);
                        Repository repository = ServerUtil.getDefaultRepository(getNode().getProject());
                        NodeTypeRegistry ntManager = (repository==null) ? null : repository.getNodeTypeRegistry();
                        if (ntManager == null) {
                            return text;
                        }
                        try {
                            Collection<String> types = ntManager.getAllowedPrimaryChildNodeTypes(getNode().getParent().getPrimaryType());
                            SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(types.toArray(new String[0]));
                            proposalProvider.setFiltering(true);
                            ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(),
                                    proposalProvider, null, null);
                            adapter.setPropagateKeys(true);
                            adapter
                                    .setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
                            return text;
                        } catch (RepositoryException e) {
                            return text;
                        }
                    }
                };
            } else {
                editor = new TextCellEditor(tableViewer.getTable());
            }
            // value might require a validator depending on the property type
            int propertyType = getNode().getPropertyType(field.getPropertyName());
            switch(propertyType) {
            case PropertyType.STRING:
View Full Code Here

Examples of org.eclipse.jface.viewers.TextCellEditor

    }

    public void addCellEditorsToViewer() {
        CellEditor[] cellEditors = new CellEditor[PROPS.length];
        for (int i = 0; i < PROPS.length; i++) {
            cellEditors[i] = new TextCellEditor(viewer.getTable());
        }
        viewer.setCellEditors(cellEditors);
    }
View Full Code Here

Examples of org.eclipse.jface.viewers.TextCellEditor

        private final CellEditor editor;

        public VersionEditingSupport(TableViewer viewer) {
            super(viewer);

            final CellEditor textEditor = new TextCellEditor(viewer.getTable());
            textEditor.setValidator(new ICellEditorValidator() {
                @Override
                public String isValid(Object value) {
                    String versionStr = String.valueOf(value);
                    Version v = Version.emptyVersion;

                    try {
                        v = Version.parseVersion(String.valueOf(value));
                    } catch (IllegalArgumentException iae) {
                        return MessageFormat.format(Messages.PackageInfoDialog_VersionInvalid, versionStr);
                    }

                    if (v == Version.emptyVersion) {
                        return Messages.PackageInfoDialog_VersionMissing;
                    }

                    return null;
                }
            });
            textEditor.addListener(new ICellEditorListener() {
                @Override
                public void editorValueChanged(boolean oldValidState, boolean newValidState) {
                    if (newValidState) {
                        validate();
                    } else {
                        setMessage(textEditor.getErrorMessage(), IMessageProvider.ERROR);
                    }
                }

                @Override
                public void cancelEditor() {
View Full Code Here

Examples of org.eclipse.jface.viewers.TextCellEditor

            exprs = new ArrayList<LiveExpr>(10);
            addExpr(new LiveExpr(backend, "erlang:now()"));
        }
        viewer.setInput(exprs);

        final TextCellEditor e = new TextCellEditor(t);
        viewer.setCellEditors(new CellEditor[] { e, null });
        viewer.setCellModifier(new LiveExprCellModifier(this));

        makeActions();
        hookContextMenu();
View Full Code Here

Examples of org.eclipse.jface.viewers.TextCellEditor

        // editors
        final CellEditor[] editors = new CellEditor[TracePatternColumn.values().length];
        editors[TracePatternColumn.ENABLED.ordinal()] = new CheckboxCellEditor(table);
        editors[TracePatternColumn.LOCAL.ordinal()] = new CheckboxCellEditor(table);
        editors[TracePatternColumn.MODULE_NAME.ordinal()] = new TextCellEditor(table);
        editors[TracePatternColumn.FUNCTION_NAME.ordinal()] = new TextCellEditor(table);
        editors[TracePatternColumn.ARITY.ordinal()] = new TextCellEditor(table);
        editors[TracePatternColumn.MATCH_SPEC.ordinal()] = new MatchSpecCellEditor(table);
        functionsTableViewer.setCellEditors(editors);
        functionsTableViewer.setCellModifier(new TracePatternCellModifier(
                functionsTableViewer));
    }
View Full Code Here

Examples of org.eclipse.jface.viewers.TextCellEditor

        nodesTableViewer.setInput(TraceBackend.getInstance());

        // editors
        final CellEditor[] editors = new CellEditor[TracePatternColumn.values().length];
        editors[NodeColumn.ENABLED.ordinal()] = new CheckboxCellEditor(table);
        editors[NodeColumn.NODE_NAME.ordinal()] = new TextCellEditor(table);
        editors[NodeColumn.COOKIE.ordinal()] = new TextCellEditor(table);
        nodesTableViewer.setCellEditors(editors);
        nodesTableViewer.setCellModifier(new NodeCellModifier(nodesTableViewer));
    }
View Full Code Here

Examples of org.eclipse.jface.viewers.TextCellEditor

          if (value.getFeature().getRange().getName().equals(CAS.TYPE_NAME_BOOLEAN)) {
            editor = new ComboBoxCellEditor(viewer.getTree(), new String[]{"false", "true"},
                    SWT.READ_ONLY);
          }
          else {
            editor = new TextCellEditor(viewer.getTree());
            editor.setValidator(CellEditorValidatorFacotory.createValidator(Primitives
                    .getPrimitiveClass(value.getFeature())));
          }

          return editor;
        }
        else {
          return null;
        }
      } else if (element instanceof ArrayValue) {

        ArrayValue arrayValue = (ArrayValue) element;

        FeatureStructure arrayFS = arrayValue.getFeatureStructure();

        CellEditor editor;

        if (arrayFS instanceof BooleanArrayFS) {
          editor = new ComboBoxCellEditor(viewer.getTree(), new String[]{"false", "true"},
                  SWT.READ_ONLY);
          editor.setStyle(SWT.READ_ONLY);
        }
        else {
          editor = new TextCellEditor(viewer.getTree());

          if (arrayFS instanceof ByteArrayFS) {
            editor.setValidator(CellEditorValidatorFacotory.createValidator(Byte.class));
          }
          else if (arrayFS instanceof ShortArrayFS) {
View Full Code Here

Examples of org.eclipse.jface.viewers.TextCellEditor

        tree.setHeaderVisible(true);
        tree.setLinesVisible(false);

        CellEditor[] editors = new CellEditor[PROPS.length];
        editors[0] = new TextCellEditor(tree);
        editors[1] = new TextCellEditor(tree);
        editors[2] = new TextCellEditor(tree);
        // CheckStyle:MagicNumber| OFF
        editors[3] = new TextCellEditor(tree);
        // CheckStyle:MagicNumber| ON

        viewer.setCellModifier(new CellModifier());
        viewer.setCellEditors(editors);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.