Ejemplo n.º 1
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);
         }
       }
     }
   }
 }
  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()));
    }
  }
 /**
  * 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());
     }
   }
 }
 /** 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;
   }
 }
  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);
      }
    }
  }
Ejemplo n.º 6
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.º 7
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);
    }
  }
 @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.º 9
0
 /** {@inheritDoc} */
 public void propertyChange(final PropertyChangeEvent event) {
   if (event.getProperty().equals("useWorkspaceAsRoot")) {
     if (event.getNewValue() instanceof Boolean) {
       _onlyWorkSpace = (Boolean) event.getNewValue();
       convertFileExtensions();
     }
   }
 }
Ejemplo n.º 10
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();
   }
 }
Ejemplo n.º 11
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.º 14
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.º 15
0
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   if (event.getProperty().startsWith(IPreferenceConstants.DEFAULT_FILL_COLOR_PREFIX)
       || event
           .getProperty()
           .equals(
               IPreferenceConstants
                   .SAVE_USER_DEFAULT_COLOR)) { // This will affect the "Default" menu in
                                                // color chooser
     refreshControls();
   }
 }
Ejemplo n.º 16
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();
   }
 }
  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
  @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());
    }
  }
  /**
   * 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()));
   }
 }
 public void propertyChange(PropertyChangeEvent event) {
   if (activeEditor == null) {
     return;
   }
   if (event.getSource() == undoAction) {
     if (event.getProperty().equals("chosen")) {
       activeEditor.undo();
     }
   } else if (event.getSource() == redoAction) {
     if (event.getProperty().equals("chosen")) {
       activeEditor.redo();
     }
   }
 }
  @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();
  }
Ejemplo n.º 23
0
  /**
   * Callback that is invoked when a property in the compare configuration ( {@link
   * #getCompareConfiguration()} changes.
   *
   * @param event the property change event
   * @since 3.3
   */
  protected void handlePropertyChangeEvent(PropertyChangeEvent event) {

    String key = event.getProperty();

    if (key.equals(ICompareUIConstants.PROP_ANCESTOR_VISIBLE)) {
      fAncestorVisible =
          Utilities.getBoolean(
              getCompareConfiguration(),
              ICompareUIConstants.PROP_ANCESTOR_VISIBLE,
              fAncestorVisible);
      fComposite.layout(true);

      updateCursor(fLeftLabel, VERTICAL);
      updateCursor(fDirectionLabel, HORIZONTAL | VERTICAL);
      updateCursor(fRightLabel, VERTICAL);

      return;
    }

    if (key.equals(ICompareUIConstants.PROP_IGNORE_ANCESTOR)) {
      setAncestorVisibility(
          false,
          !Utilities.getBoolean(
              getCompareConfiguration(), ICompareUIConstants.PROP_IGNORE_ANCESTOR, false));
      return;
    }
  }
Ejemplo n.º 24
0
 @Override
 public void propertyChange(final PropertyChangeEvent event) {
   final String property = event.getProperty();
   if (property.equals(PREF_DETAIL_PANE_FONT) || property.equals(JFaceResources.DEFAULT_FONT)) {
     dispose();
   }
 }
 /**
  * Adapts the behavior of the contained components to the change encoded in the given event.
  *
  * @param event the event to which to adapt
  * @since 2.0
  */
 protected void adaptToPreferenceChange(PropertyChangeEvent event) {
   if (event.getOldValue() instanceof Boolean) {
     adaptToStyleChange(event);
   } else {
     adaptToColorChange(event);
   }
 }
Ejemplo n.º 26
0
  @Override
  protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer == null) return;

    String property = event.getProperty();

    AutoconfCodeScanner scanner = (AutoconfCodeScanner) getAutoconfCodeScanner();
    if (scanner != null) {
      if (scanner.affectsBehavior(event)) {
        scanner.adaptToPreferenceChange(event);
        sourceViewer.invalidateTextPresentation();
      }
    }

    if (AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION.equals(property)
        || AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION.equals(property)) {
      handleVersionChange(sourceViewer);
    } else if (AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) {
      if (sourceViewer instanceof ProjectionViewer) {
        ProjectionViewer projectionViewer = (ProjectionViewer) sourceViewer;
        if (fProjectionFileUpdater != null) fProjectionFileUpdater.uninstall();
        // either freshly enabled or provider changed
        fProjectionFileUpdater = new ProjectionFileUpdater();
        if (fProjectionFileUpdater != null) {
          fProjectionFileUpdater.install(this, projectionViewer);
        }
      }
      return;
    }

    super.handlePreferenceStoreChanged(event);
  }
Ejemplo n.º 27
0
 @Override
 public void propertyChange(final PropertyChangeEvent event) {
   if (event.getProperty().equals(IMPROVConstants.GV_SELECTION)) {
     final IDataSource ds = DataSourceManager.getInstance().getActiveDatasource();
     org.eclipse.swt.graphics.Rectangle bounds = mControl.getBounds();
     final int width = bounds.width;
     final int height = bounds.height;
     if (ds != null && ds instanceof TreeDBDataSource) {
       new UIJob("") {
         @Override
         public IStatus runInUIThread(IProgressMonitor monitor) {
           Object newValue = event.getNewValue();
           if (newValue != null) {
             StructuredSelection sSelection = (StructuredSelection) newValue;
             Iterator<?> iter = sSelection.iterator();
             int[] nodes = (int[]) iter.next();
             int[][] edges = (int[][]) iter.next();
             VisualItem item = (VisualItem) iter.next();
             int[] selection = new int[] {item.getInt("id")};
             mTreeView.clearView();
             mTreeView.setViewItems(nodes, edges, selection);
             mTreeView.setSize(width, height);
             mTreeView.repaint();
           }
           return Status.OK_STATUS;
         }
       }.schedule();
     }
   }
 }
Ejemplo n.º 28
0
 public void propertyChange(PropertyChangeEvent event) {
   if (event.getProperty() == PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS) {
     this.status = CJDTConfigSettings.isAnalyzeAnnotationsEnabled();
     if (this.action != null) {
       this.action.setChecked(this.status);
     }
   }
 }
 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.º 30
0
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   if (tableViewer != null) {
     if (FontPreferencePage.BASE_FONT_KEY.equals(event.getProperty())) {
       updateTableFont();
     }
   }
 }