Package com.volantis.mcs.eclipse.builder.editors.themes

Examples of com.volantis.mcs.eclipse.builder.editors.themes.StylePairEditor


            String firstName = EditorMessages.getString(RESOURCE_PREFIX +
                    identifier.getName() + ".first.label");
            String secondName = EditorMessages.getString(RESOURCE_PREFIX +
                    identifier.getName() + ".second.label");

            final StylePairEditor styleEditor = new StylePairEditor(this,
                    SWT.NONE, styleProperty, pairType, true, context,
                    firstName, secondName);

            data = new GridData(GridData.FILL_HORIZONTAL |
                    GridData.GRAB_HORIZONTAL);
            data.verticalSpan = 2;
            data.horizontalSpan = 2;
            styleEditor.setLayoutData(data);

            // Add the accessors for the values represented by this pair editor.
            accessors.put(identifier, new PropertyAccessor() {
                public Object getPropertyValue() {
                    String textValue = styleEditor.getStringValue();
                    final EditorPropertyParser parser = new EditorPropertyParser();
                    return parser.parsePropertyValue(styleProperty, textValue,
                            styleEditor.isImportant());
                }

                public void setPropertyValue(Object newValue) {
                    if (newValue instanceof PropertyValue) {
                        styleEditor.setValue((PropertyValue) newValue);
                    } else {
                        styleEditor.setValue(null);
                    }
                }
            });

            // Add a modification listener.
            styleEditor.addModifyListener(
                new ModifyListener() {
                    public void modifyText(ModifyEvent event) {
                        propertyChanged(descriptor, styleEditor.getValues());
                    }
                }
            );

            // Update the list of controls managed by this composite.
View Full Code Here


        } else {
            PropertyIdentifier identifier = descriptor.getIdentifier();

            // We pass the fraction type in as the second type (rather than the
            // denominator type) to guarantee that we are editing a fraction.
            final StylePairEditor styleEditor = new StylePairEditor(this,
                    SWT.NONE, styleProperty, type, fractionType, true, context);

            // Add accessors for the values which can be edited by this editor.
            accessors.put(identifier, new PropertyAccessor() {
                public Object getPropertyValue() {
                    return styleEditor.getPropertyValue();
                }

                public void setPropertyValue(Object newValue) {
                    if (newValue instanceof PropertyValue) {
                        styleEditor.setValue((PropertyValue) newValue);
                    } else {
                        styleEditor.setValue(null);
                    }
                }
            });

            // Plug in a change listener.
            styleEditor.addModifyListener(
                new ModifyListener() {
                    public void modifyText(ModifyEvent event) {
                        propertyChanged(descriptor, styleEditor.getValues());
                    }
                }
            );
            // Update the list of controls managed by this composite.
            addControls(identifier, styleEditor, otherControls);
View Full Code Here

TOP

Related Classes of com.volantis.mcs.eclipse.builder.editors.themes.StylePairEditor

Copyright © 2018 www.massapicom. 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.