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

Examples of com.volantis.mcs.eclipse.builder.editors.themes.StyleValueEditor$EditorUpdater


        StylePropertyBrowseAction browseAction = StylePropertyMetadata.getBrowseAction(styleProperty);

        StyleType supportedStructure = styleProperty.getStandardDetails().
                getSupportedStructure();
        final StyleValueEditor styleEditor = new StyleValueEditor(this,
                SWT.NONE, styleProperty, supportedStructure, true,
                browseAction, context);

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

        if (isSpecialSynchronization) {
      // Special synchronization
      if (synchronizationGroup != null) {
        // Setting up a modify listener to update the properties
        // if the synchronization control is set
        styleEditor.addModifyListener(new ModifyListener() {
          public void modifyText(ModifyEvent event) {
            PropertyAccessor synchAccessor = (PropertyAccessor) accessors
                .get(synchronizationGroup);
            Object value = synchAccessor.getPropertyValue();
            PropertyDescriptor[] controlledProperties = synchronizationGroup
                .getControlledDescriptors();
            for (int i = 0; i < controlledProperties.length; i++) {
              PropertyIdentifier identifier = controlledProperties[i]
                  .getIdentifier();
              PropertyAccessor accessor = (PropertyAccessor) accessors
                  .get(identifier);
              accessor.setPropertyValue(value);
              propertyChanged(controlledProperties[i], value);
            }
          }
        });
      } else {
        // Synchronization group must not be null
        // when isSpecialSynchronization is set to true
        throw new IllegalArgumentException(
            "Synchronization group for special synchronization must not be null");
      }
    } else {
      // Normal synchronization
      if (synchronizationGroup != null) {
        // Setting up a modify listener to update the synchronization
        // control if one of the synchronized properties changes
        styleEditor.addModifyListener(new ModifyListener() {
          public void modifyText(ModifyEvent event) {
            propertyChanged(descriptor, styleEditor.getValue());
            updateSynchControl(synchronizationGroup);
          }
        });
      } else {
        // Setting up a normal modify listener
        styleEditor.addModifyListener(new ModifyListener() {
          public void modifyText(ModifyEvent event) {
            propertyChanged(descriptor, styleEditor.getValue());
          }
        });
      }
    }

        final Object key = isSpecialSynchronization ?
                (Object) synchronizationGroup : descriptor.getIdentifier();

        addControls(key, styleEditor, label);

        accessors.put(key, new PropertyAccessor() {
            public Object getPropertyValue() {
                String textValue = styleEditor.getValue();
                final EditorPropertyParser parser = new EditorPropertyParser();
                return parser.parsePropertyValue(styleProperty, textValue,
                        styleEditor.isImportant());
            }

            public void setPropertyValue(Object newValue) {
                if (newValue instanceof PropertyValue) {
                    styleEditor.setPropertyValue((PropertyValue) newValue);
                } else {
                    styleEditor.setPropertyValue(null);
                }
            }
        });
    }
View Full Code Here


    /**
     * Update the value of the synchronisation control if necessary.
     */
    private void updateSynchControl(SynchronizationGroup synchronizationGroup) {
        StyleValueEditor synchControl = (StyleValueEditor)
                getActiveControl(synchronizationGroup);
        if (synchControl != null) {
            PropertyDescriptor[] descriptors =
                    synchronizationGroup.getControlledDescriptors();
            StyleValueEditor firstControl = (StyleValueEditor)
                    getActiveControl(descriptors[0].getIdentifier());
            String firstValue = firstControl.getValue();
            boolean valuesEqual = true;
            for (int i = 1; valuesEqual && i < descriptors.length; i++) {
                StyleValueEditor control = (StyleValueEditor)
                        getActiveControl(descriptors[i].getIdentifier());
                if (!firstValue.equals(control.getValue()) ||
                        firstControl.isImportant() != control.isImportant()) {
                    valuesEqual = false;
                }
            }

            PropertyAccessor synchronizingAccessor = (PropertyAccessor)
View Full Code Here

TOP

Related Classes of com.volantis.mcs.eclipse.builder.editors.themes.StyleValueEditor$EditorUpdater

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.