/**
  * Adapts the behavior of the contained components to the change encoded in the given event.
  *
  * <p>Clients are not allowed to call this method if the old setup with text tools is in use.
  *
  * @param event the event to which to adapt
  * @see DartSourceViewerConfiguration#JavaSourceViewerConfiguration(IColorManager,
  *     IPreferenceStore, ITextEditor, String)
  */
 public void handlePropertyChangeEvent(PropertyChangeEvent event) {
   Assert.isTrue(isNewSetup());
   if (fCodeScanner.affectsBehavior(event)) {
     fCodeScanner.adaptToPreferenceChange(event);
   }
   if (fMultilineCommentScanner.affectsBehavior(event)) {
     fMultilineCommentScanner.adaptToPreferenceChange(event);
   }
   if (fSinglelineCommentScanner.affectsBehavior(event)) {
     fSinglelineCommentScanner.adaptToPreferenceChange(event);
   }
   if (fStringScanner.affectsBehavior(event)) {
     fStringScanner.adaptToPreferenceChange(event);
   }
   if (fMultilineStringScanner.affectsBehavior(event)) {
     fMultilineStringScanner.adaptToPreferenceChange(event);
   }
   if (fJavaDocScanner.affectsBehavior(event)) {
     fJavaDocScanner.adaptToPreferenceChange(event);
   }
   if (fJavaDoubleClickSelector != null
       && JavaScriptCore.COMPILER_SOURCE.equals(event.getProperty())) {
     if (event.getNewValue() instanceof String) {
       fJavaDoubleClickSelector.setSourceVersion((String) event.getNewValue());
     }
   }
 }
Ejemplo n.º 2
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
  */
 public void propertyChange(PropertyChangeEvent event) {
   count++;
   if (event.getProperty() == IEvaluationService.RESULT
       && event.getNewValue() instanceof Boolean) {
     currentValue = ((Boolean) event.getNewValue()).booleanValue();
   }
 }
Ejemplo n.º 3
0
 public void propertyChange(PropertyChangeEvent event) {
   if (event.getProperty().equals(TefkatPlugin.URIMAP_PREFERENCE)) {
     if (null != event.getOldValue()) {
       List list = TefkatPlugin.convertFromString((String) event.getOldValue());
       for (final Iterator itr = list.iterator(); itr.hasNext(); ) {
         URIMap map = (URIMap) itr.next();
         if (map.enabled) {
           URI uri = URI.createURI(map.source);
           URIConverter.URI_MAP.remove(uri);
         }
       }
     }
     if (null != event.getNewValue()) {
       List list = TefkatPlugin.convertFromString((String) event.getNewValue());
       for (final Iterator itr = list.iterator(); itr.hasNext(); ) {
         URIMap map = (URIMap) itr.next();
         if (map.enabled) {
           URI sourceUri = URI.createURI(map.source);
           URI targetUri = URI.createURI(map.target);
           URIConverter.URI_MAP.put(sourceUri, targetUri);
         }
       }
     }
   }
 }
Ejemplo n.º 4
0
 /** {@inheritDoc} */
 public void propertyChange(final PropertyChangeEvent event) {
   if (event.getProperty().equals("useWorkspaceAsRoot")) {
     if (event.getNewValue() instanceof Boolean) {
       _onlyWorkSpace = (Boolean) event.getNewValue();
       convertFileExtensions();
     }
   }
 }
  private void adaptToStyleChange(PropertyChangeEvent event) {
    boolean bold = false;
    // bold properties need to be converted to colors for the map
    String colorPlusStyle = event.getProperty();
    String colorName =
        colorPlusStyle.substring(
            0, colorPlusStyle.length() - ColorsPreferencePage.BOLD_SUFFIX.length());
    Token token = (Token) tokenMap.get(colorName);
    LToken lToken = (LToken) tokenMap.get(colorName + MARK_SUFFIX);
    if (token == null && lToken == null) return;
    Object value = event.getNewValue();
    bold = ((Boolean) value).booleanValue();

    Object data = token.getData();
    if (data instanceof TextAttribute) {
      TextAttribute oldAttr = (TextAttribute) data;
      TextAttribute newAttr =
          new TextAttribute(
              oldAttr.getForeground(), oldAttr.getBackground(), bold ? SWT.BOLD : SWT.NORMAL);
      boolean isBold = (oldAttr.getStyle() == SWT.BOLD);
      if (isBold != bold) {
        token.setData(newAttr);
        if (lToken != null) lToken.setData(newAttr);
      }
    }
  }
  private void adaptToTextForegroundChange(Highlighting highlighting, PropertyChangeEvent event) {
    RGB rgb = null;

    Object value = event.getNewValue();
    if (value instanceof RGB) rgb = (RGB) value;
    else if (value instanceof String) rgb = StringConverter.asRGB((String) value);

    if (rgb != null) {

      String property = event.getProperty();
      Color color = fColorManager.getColor(property);

      if ((color == null || !rgb.equals(color.getRGB()))
          && fColorManager instanceof IColorManagerExtension) {
        IColorManagerExtension ext = (IColorManagerExtension) fColorManager;
        ext.unbindColor(property);
        ext.bindColor(property, rgb);
        color = fColorManager.getColor(property);
      }

      TextAttribute oldAttr = highlighting.getTextAttribute();
      highlighting.setTextAttribute(
          new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle()));
    }
  }
 /** Reacts to any changes in the properties for the Mark Occurrences */
 public void propertyChange(PropertyChangeEvent event) {
   final String property = event.getProperty();
   boolean newBooleanValue = false;
   Object newValue = event.getNewValue();
   if (newValue != null) {
     newBooleanValue = Boolean.valueOf(newValue.toString()).booleanValue();
   }
   if (com.aptana.editor.common.preferences.IPreferenceConstants.EDITOR_MARK_OCCURRENCES.equals(
       property)) {
     if (newBooleanValue != fMarkOccurrenceAnnotations) {
       fMarkOccurrenceAnnotations = newBooleanValue;
       if (!fMarkOccurrenceAnnotations) {
         uninstallOccurrencesFinder();
       } else {
         installOccurrencesFinder(true);
       }
     }
     return;
   }
   if (PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES.equals(property)) {
     fMarkTypeOccurrences = newBooleanValue;
     return;
   }
   if (PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES.equals(property)) {
     fMarkMethodOccurrences = newBooleanValue;
     return;
   }
   if (PreferenceConstants.EDITOR_MARK_FUNCTION_OCCURRENCES.equals(property)) {
     fMarkFunctionOccurrences = newBooleanValue;
     return;
   }
   if (PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES.equals(property)) {
     fMarkConstantOccurrences = newBooleanValue;
     return;
   }
   if (PreferenceConstants.EDITOR_MARK_GLOBAL_VARIABLE_OCCURRENCES.equals(property)) {
     fMarkGlobalVariableOccurrences = newBooleanValue;
     return;
   }
   if (PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES.equals(property)) {
     fMarkLocalVariableOccurrences = newBooleanValue;
     return;
   }
   if (PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS.equals(property)) {
     fMarkMethodExitPoints = newBooleanValue;
     return;
   }
   if (PreferenceConstants.EDITOR_MARK_BREAK_CONTINUE_TARGETS.equals(property)) {
     fMarkBreakContinueTargets = newBooleanValue;
     return;
   }
   if (PreferenceConstants.EDITOR_MARK_IMPLEMENTORS.equals(property)) {
     fMarkImplementors = newBooleanValue;
     return;
   }
   if (PreferenceConstants.EDITOR_STICKY_OCCURRENCES.equals(property)) {
     fStickyOccurrenceAnnotations = newBooleanValue;
     return;
   }
 }
Ejemplo n.º 8
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
   */
  public void propertyChange(PropertyChangeEvent event) {
    if (event == null || !(event.getSource() instanceof IMemoryRendering)) {
      return;
    }

    // Do not handle any property changed event as the
    // sync service is being enabled.
    // Otheriwse, current sync info provider may overwrite
    // sync info unexpectedly.  We want to sync with the rendering
    // that is last changed.
    if (fEnableState == ENABLING) return;

    IMemoryRendering rendering = ((IMemoryRendering) event.getSource());
    IMemoryBlock memoryBlock = rendering.getMemoryBlock();
    String propertyId = event.getProperty();
    Object value = event.getNewValue();

    if (DEBUG_SYNC_SERVICE) {
      System.out.println("SYNC SERVICE RECEIVED CHANGED EVENT:"); // $NON-NLS-1$
      System.out.println("Source:  " + rendering); // $NON-NLS-1$
      System.out.println("Property:  " + propertyId); // $NON-NLS-1$
      System.out.println("Value:  " + value); // $NON-NLS-1$

      if (value instanceof BigInteger) {
        System.out.println("Value in hex:  " + ((BigInteger) value).toString(16)); // $NON-NLS-1$
      }
    }

    if (memoryBlock == null) return;

    if (propertyId == null) return;

    // find the synchronize info object for the memory block
    SynchronizeInfo info = (SynchronizeInfo) fSynchronizeInfo.get(memoryBlock);

    // if info is not available, need to create one to hold the property
    if (info == null) {
      info = new SynchronizeInfo(memoryBlock);
      fSynchronizeInfo.put(memoryBlock, info);
    }

    // get the value of the property
    Object oldValue = info.getProperty(propertyId);

    if (oldValue == null) {
      // if the value has never been added to the info object
      // set the property and fire a change event
      info.setProperty(propertyId, value);
      fLastChangedRendering = rendering;
      firePropertyChanged(event);
      return;
    } else if (!oldValue.equals(value)) {
      // if the value has changed
      // set the property and fire a change event
      info.setProperty(propertyId, value);
      fLastChangedRendering = rendering;
      firePropertyChanged(event);
    }
  }
  public static void checkXugglerInstallationOnPropertyChange(
      FieldEditorPreferencePage page, PropertyChangeEvent event) {
    if (event.getSource() instanceof FieldEditor) {
      FieldEditor field = (FieldEditor) event.getSource();

      if (field.getPreferenceName().equals(PreferenceConstants.ENCODING_CODEC)) {
        if (event.getNewValue() instanceof String) {
          String newValue = (String) event.getNewValue();
          if (newValue.equals(Codec.XUGGLER.name())) {
            checkXugglerInstallation(page);
          } else {
            page.setErrorMessage(null);
          }
        }
      }
    }
  }
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   super.propertyChange(event);
   if (event.getSource().equals(checkbox)) {
     boolean useDefault = ((Boolean) event.getNewValue()).booleanValue();
     editor.setEnabled(!useDefault, getFieldEditorParent());
   }
 }
Ejemplo n.º 11
0
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS)) {
     fHideRunningThreadsProperty = (Boolean) event.getNewValue();
     // Refresh the debug view to take in consideration this change
     getDMVMProvider().refresh();
   }
 }
 private void adaptToEnablementChange(Highlighting highlighting, PropertyChangeEvent event) {
   Object value = event.getNewValue();
   boolean eventValue;
   if (value instanceof Boolean) eventValue = ((Boolean) value).booleanValue();
   else if (IPreferenceStore.TRUE.equals(value)) eventValue = true;
   else eventValue = false;
   highlighting.setEnabled(eventValue);
 }
Ejemplo n.º 13
0
  @Override
  public void propertyChange(final PropertyChangeEvent event) {
    super.propertyChange(event);
    final Object source = event.getSource();

    if (source == this.projectComboList) {
      this.workingJavaProject = (String) event.getNewValue();
    }
  }
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   if (event.getSource() == disableResolvers) {
     updateFieldEnablement(disableResolvers.getBooleanValue());
   } else if (event.getSource() == resolutionScope) {
     updateScopeDescription((String) event.getNewValue());
   }
   super.propertyChange(event);
 }
 public void propertyChange(final PropertyChangeEvent event) {
   if (event.getProperty() == ISynchronizeModelElement.BUSY_PROPERTY) {
     Object source = event.getSource();
     if (source instanceof ISynchronizeModelElement)
       updateBusyState(
           (ISynchronizeModelElement) source,
           ((Boolean) event.getNewValue()).booleanValue());
   }
 }
Ejemplo n.º 16
0
 /**
  * @see
  *     org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
  */
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   String prop = event.getProperty();
   if (prop.equals(PreferenceConstants.OUTLINE_GROUP_INCLUDES)) {
     Object newValue = event.getNewValue();
     if (newValue instanceof Boolean) {
       boolean value = ((Boolean) newValue).booleanValue();
       if (areIncludesGroup() != value) {
         setIncludesGrouping(value);
         contentUpdated();
       }
     }
   } else if (prop.equals(PreferenceConstants.OUTLINE_GROUP_NAMESPACES)) {
     Object newValue = event.getNewValue();
     if (newValue instanceof Boolean) {
       boolean value = ((Boolean) newValue).booleanValue();
       if (areNamespacesGroup() != value) {
         setNamespacesGrouping(value);
         contentUpdated();
       }
     }
   } else if (prop.equals(PreferenceConstants.OUTLINE_GROUP_MEMBERS)) {
     Object newValue = event.getNewValue();
     if (newValue instanceof Boolean) {
       boolean value = ((Boolean) newValue).booleanValue();
       if (isMemberGroupingEnabled() != value) {
         setMemberGrouping(value);
         contentUpdated();
       }
     }
   } else if (prop.equals(PreferenceConstants.OUTLINE_GROUP_MACROS)) {
     Object newValue = event.getNewValue();
     if (newValue instanceof Boolean) {
       boolean value = ((Boolean) newValue).booleanValue();
       if (isMacroGroupingEnabled() != value) {
         setMacroGrouping(value);
         contentUpdated();
       }
     }
   }
 }
  public void propertyChange(PropertyChangeEvent event) {
    //		if (CxxTestPlugin.CXXTEST_PREF_TRACE_STACK.equals(
    //				event.getProperty()))
    {
      boolean oldValue = (Boolean) event.getOldValue();
      boolean newValue = (Boolean) event.getNewValue();

      if (oldValue != newValue) {
        stackTracingWasChanged(newValue);
      }
    }
  }
Ejemplo n.º 18
0
 public void propertyChange(PropertyChangeEvent event) {
   CustomFilters customFilters = weakCustomFilter.get();
   if (customFilters == null) {
     IPreferenceStore prefs = PydevPlugin.getDefault().getPreferenceStore();
     prefs.removePropertyChangeListener(this);
   } else {
     String property = event.getProperty();
     if (property.equals(PySetupCustomFilters.CUSTOM_FILTERS_PREFERENCE_NAME)) {
       customFilters.update((String) event.getNewValue());
     }
   }
 }
Ejemplo n.º 19
0
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   Object source = event.getSource();
   Object value = event.getNewValue();
   if (source instanceof RadioGroupFieldEditor
       && value instanceof String
       && !(value.equals(fChangedProperty) && source.equals(fProperty))) {
     fProperty = ((RadioGroupFieldEditor) source).getPreferenceName();
     fChangedProperty = (String) value;
     refresh();
   }
 }
  @Override
  public void propertyChange(final PropertyChangeEvent event) {
    super.propertyChange(event);
    final Object source = event.getSource();
    if (source == this.repositoryName) {
      final String newValue = (String) event.getNewValue();
      this.currentValueOfRepoName = newValue;
      /*this.repositoryBaseLocation.setStringValue(this.currentValueOfRepoName.toLowerCase() + COLON + FORWARD_SLASH + FORWARD_SLASH
      + LOCAL_HOST);*/
    }

    // this.currentValueOfRepoLoc = this.repositoryLocation.getStringValue(); -- uncomment this
    // after enabling browse in Rep Dialog
    // this.currentValueOfRepoUrl = this.repositoryUrl.getStringValue();
    this.currentValueOfUserName = this.userName.getStringValue();
    this.currentValueOfPassWord = this.passWord.getStringValue();
    if (isEmpty(this.currentValueOfUserName) || isEmpty(this.currentValueOfPassWord)) {
      this.addButton.setEnabled(false);
      this.editButton.setEnabled(false);
    } else {
      this.addButton.setEnabled(true);
      this.editButton.setEnabled(true);
    }
    if (source == this.enableAutoCheckin) {
      enableFields((Boolean) event.getNewValue());
      /*final IEvaluationService service = (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.class);
      service.requestEvaluation("org.fastcode.menus.versioncontrol");*/
    }

    /*if (source == this.repositoryUrl) {
    	final String prj = this.preferenceStore.getString(P_REPOSITORY_PROJECT);
    	if (isEmpty(prj)) {
    		resetProjectName();
    		if (!resetProjectName()) {
    			//return false; - to check this line
    		}
    	}

    }*/
  }
Ejemplo n.º 21
0
  @Override
  public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getProperty().equals(FieldEditor.VALUE)) {
      checkState();
    }

    if (event.getSource() == localTemplateEditor) {
      Activator.getDefault()
          .getIReportTemplateDirectoryService()
          .setDirectory((String) event.getNewValue());
    }
  }
  @Override
  public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);

    if (event.getSource() != versionsEditor) {
      checkState();
      return;
    }

    shouldUseGradleHome =
        event.getNewValue().equals(GradlePluginConstants.USE_GRADLE_HOME_VERSION_VALUE);
    gradleHomeField.setEmptyStringAllowed(!shouldUseGradleHome);
    checkState();
  }
  /**
   * The field editor preference page implementation of this <code>IPreferencePage</code> (and
   * <code>IPropertyChangeListener</code>) method intercepts <code>IS_VALID</code> events but passes
   * other events on to its superclass.
   */
  public void propertyChange(PropertyChangeEvent event) {

    if (event.getProperty().equals(FieldEditor.IS_VALID)) {
      boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
      // If the new value is true then we must check all field editors.
      // If it is false, then the page is invalid in any case.
      if (newValue) {
        checkState();
      } else {
        invalidFieldEditor = (FieldEditor) event.getSource();
        setValid(newValue);
      }
    }
  }
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   if (preferenceStoreAccess == null) {
     return;
   }
   if (org.eclipse.jdt.ui.PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION.equalsIgnoreCase(
       event.getProperty())) {
     preferenceStoreAccess
         .getWritablePreferenceStore()
         .setValue(
             PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION,
             Boolean.valueOf(event.getNewValue().toString()));
   }
 }
  private void adaptToTextStyleChange(
      Highlighting highlighting, PropertyChangeEvent event, int styleAttribute) {
    boolean eventValue = false;
    Object value = event.getNewValue();
    if (value instanceof Boolean) eventValue = ((Boolean) value).booleanValue();
    else if (IPreferenceStore.TRUE.equals(value)) eventValue = true;

    TextAttribute oldAttr = highlighting.getTextAttribute();
    boolean activeValue = (oldAttr.getStyle() & styleAttribute) == styleAttribute;

    if (activeValue != eventValue)
      highlighting.setTextAttribute(
          new TextAttribute(
              oldAttr.getForeground(),
              oldAttr.getBackground(),
              eventValue
                  ? oldAttr.getStyle() | styleAttribute
                  : oldAttr.getStyle() & ~styleAttribute));
  }
Ejemplo n.º 26
0
  /**
   * @see
   *     org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
   */
  public void propertyChange(PropertyChangeEvent event) {

    if (event.getProperty().equals(FieldEditor.IS_VALID)) {
      boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
      // If the new value is true then we must check all field editors.
      // If it is false, then the page is invalid in any case.
      if (newValue) {
        // if (fClientComPortEditor != null && event.getSource() != fClientComPortEditor) {
        // // fClientComPortEditor.refreshValidState();
        // }
        checkState();
      } else {
        super.propertyChange(event);
      }

    } else {
      super.propertyChange(event);
    }
  }
        public void propertyChange(PropertyChangeEvent event) {
          if (event.getProperty().equals(IThemeManager.CHANGE_CURRENT_THEME)) {
            ((ITheme) event.getOldValue()).removePropertyChangeListener(this);
            setTheme((ITheme) event.getNewValue());
          } else {
            IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
            ITheme theme = themeManager.getCurrentTheme();

            if (event.getProperty().equals(BACKGROUND))
              background = theme.getColorRegistry().get(event.getProperty());
            else if (event.getProperty().equals(FOREGROUND))
              foreground = theme.getColorRegistry().get(event.getProperty());
            else if (event.getProperty().equals(POSITIVE_FOREGROUND))
              positiveForeground = theme.getColorRegistry().get(event.getProperty());
            else if (event.getProperty().equals(NEGATIVE_FOREGROUND))
              negativeForeground = theme.getColorRegistry().get(event.getProperty());
          }

          updateView();
        }
 private void adaptToColorChange(PropertyChangeEvent event) {
   RGB rgb = null;
   Token token = (Token) tokenMap.get(event.getProperty());
   LToken lToken = (LToken) tokenMap.get(event.getProperty() + MARK_SUFFIX);
   if (token == null && lToken == null) {
     return;
   }
   Object value = event.getNewValue();
   if (value instanceof RGB) rgb = (RGB) value;
   else if (value instanceof String) rgb = StringConverter.asRGB((String) value);
   if (rgb != null) {
     String property = event.getProperty();
     Object data = token.getData();
     if (data instanceof TextAttribute) {
       TextAttribute oldAttr = (TextAttribute) data;
       TextAttribute newAttr =
           new TextAttribute(
               colorManager.getColor(property), oldAttr.getBackground(), oldAttr.getStyle());
       if (token != null) token.setData(newAttr);
       if (lToken != null) lToken.setData(newAttr);
     }
   }
 }
  /** @param event */
  @Override
  public void propertyChange(final PropertyChangeEvent event) {
    super.propertyChange(event);
    final Object source = event.getSource();
    final Object newValue = event.getNewValue();
    this.classSelected = false;
    this.fileSelected = false;
    this.pkgSelected = false;
    this.fldrSelected = false;
    this.enumSelected = false;
    final GlobalSettings globalSettings = GlobalSettings.getInstance();

    for (int i = 0; i < this.TEMPLATES_LIST.length; i++) {
      this.prefValueOf1stTemplateItem =
          getPreferenceStore()
              .getString(
                  getTemplatePreferenceKey(
                      this.templatePreferenceParts[i].templateName,
                      P_TEMPLATE_FIRST_TEMPLATE_ITEM));
      this.prefValueOf2ndTempalteItem =
          getPreferenceStore()
              .getString(
                  getTemplatePreferenceKey(
                      this.templatePreferenceParts[i].templateName,
                      P_TEMPLATE_SECOND_TEMPLATE_ITEM));
      if (source == this.templatePreferenceParts[i].enableTemplateCheckBox) {
        final boolean enbale = (Boolean) newValue;
        enableFields(this.templatePreferenceParts[i], enbale);
        break;
      } else if (source == this.templatePreferenceParts[i].allowMultipleVariationCheckBox) {
        this.templatePreferenceParts[i].templateVariationField.setEmptyStringAllowed(
            !(Boolean) newValue);
        if (FALSE_STR.equalsIgnoreCase(
            globalSettings.getPropertyValue(DEFAULT_TEMPLATE_VARIATION_FIELD, TRUE_STR))) {
          this.templatePreferenceParts[i].templateVariationFieldNameField.setEmptyStringAllowed(
              !(Boolean) newValue);
        }
        break;
      } else if (source == this.templatePreferenceParts[i].templateVariationField) {
        if (FALSE_STR.equalsIgnoreCase(
            globalSettings.getPropertyValue(DEFAULT_TEMPLATE_VARIATION_FIELD, TRUE_STR))) {
          this.templatePreferenceParts[i].templateVariationFieldNameField.setEmptyStringAllowed(
              isEmpty((String) newValue));
        }
        break;
      } else if (source == this.templatePreferenceParts[i].templateVariationFieldNameField) {
        final boolean isErr =
            ((String) newValue).endsWith(" ") || ((String) newValue).endsWith("\t");
        setErrorMessage(isErr ? "Variation Field cannot end with whitespace" : null);
        this.templatePreferenceParts[i].templateVariationField.setEmptyStringAllowed(
            isEmpty((String) newValue));
        break;
      } else if (source == this.templatePreferenceParts[i].firstTemplateRadioButton) {
        setErrorMessage(null);
        this.currentValueOf1stTemplateItem = (String) newValue;
        enableTemplateItems(this.templatePreferenceParts[i], newValue);

        validateSecondTemplateItem(this.currentValueOf2ndTemplateItem);
        break;
      } else if (source == this.templatePreferenceParts[i].secondTemplateRadioButton) {
        this.currentValueOf2ndTemplateItem = (String) newValue;

        if (newValue.equals(SECOND_TEMPLATE.field.getValue())
            || newValue.equals(SECOND_TEMPLATE.both.getValue())
            || newValue.equals(SECOND_TEMPLATE.custom.getValue())) {
          this.templatePreferenceParts[i].getterSetterRadioButton.setEnabled(
              true, getFieldEditorParent());
        } else if (newValue.equals(SECOND_TEMPLATE.method.getValue())
            || newValue.equals(SECOND_TEMPLATE.none.getValue())) {
          getPreferenceStore()
              .setValue(
                  getTemplatePreferenceKey(
                      this.templatePreferenceParts[i].templateName, P_TEMPLATE_GETTER_SETTER),
                  GETTER_SETTER.NONE.getValue());
          this.templatePreferenceParts[i].getterSetterRadioButton.setEnabled(
              false, getFieldEditorParent());
        }
        if (isEmpty(this.currentValueOf1stTemplateItem)) {
          this.currentValueOf1stTemplateItem = this.prefValueOf1stTemplateItem;
        }
        this.classSelected =
            this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.Class.getValue());
        this.fileSelected =
            this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.File.getValue());
        this.pkgSelected =
            this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.Package.getValue());
        this.fldrSelected =
            this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.Folder.getValue());
        this.enumSelected =
            this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.Enumeration.getValue());
        validateSecondTemplateItem(newValue);
        break;
      } else if (source == this.templatePreferenceParts[i].additionalParametersField) {
        if (!isEmpty(newValue.toString())) {
          try {
            parseAdditonalParam(newValue.toString());
          } catch (final FastCodeException ex) {
            // throw new Exception(ex);
          }
          /*final String addtnlParams[] = newValue.toString().split("\\s+");
          final Map<String, String> addtnParamMap = new HashMap<String, String>();
          for (final String params : addtnlParams) {
          	if (params.contains(COLON)) {
          		final String parseParam[] = params.split(COLON);
          		if (parseParam.length == 2) {
          			final String type = parseParam[1].trim().toLowerCase();
          			if (isEmpty(type)
          					|| !(type.equalsIgnoreCase(FIRST_TEMPLATE.Class.getValue())
          							|| type.equalsIgnoreCase(FIRST_TEMPLATE.File.getValue())
          							|| type.equalsIgnoreCase(FIRST_TEMPLATE.Package.getValue())
          							|| type.equalsIgnoreCase(FIRST_TEMPLATE.Folder.getValue())
          							|| type.equalsIgnoreCase(RETURN_TYPES.JAVAPROJECT.getValue())
          							|| type.equalsIgnoreCase(RETURN_TYPES.PROJECT.getValue())
          							|| type.equalsIgnoreCase(RETURN_TYPES.LOCALVAR.getValue()) || type
          								.equalsIgnoreCase(RETURN_TYPES.BOOLEAN.getValue()))) {
          				setErrorMessage("Additional Parameter type can be only class/file/package/folder/project/javaProject/localvar/boolean.");
          			} else {
          				setErrorMessage(null);
          			}
          			if (addtnParamMap.containsKey(parseParam[0])) {
          				setErrorMessage("Duplicate place holder name " + parseParam[0]);
          			}
          			addtnParamMap.put(parseParam[0], type);
          		} else if (parseParam.length == 1) {
          			setErrorMessage("Additional Parameter must have type class/file/package/folder/project/javaProject/localvar/boolean.");
          		}
          	}
          }*/
        }
      }
    }
  }
Ejemplo n.º 30
0
 private void handleChanges(PropertyChangeEvent event) {
   if (event.getProperty().equals(MDHTPreferences.CARDINALITY_STORE_VALUE)) {
     CDAModelUtil.cardinalityAfterElement = (Boolean) event.getNewValue();
   }
 }