Exemplo n.º 1
0
 @Override
 protected void doOKAction() {
   apply((SeverityBasedTextAttributes) myOptionsList.getSelectedValue());
   final Collection<SeverityBasedTextAttributes> infoTypes =
       new HashSet<SeverityBasedTextAttributes>(
           SeverityUtil.getRegisteredHighlightingInfoTypes(mySeverityRegistrar));
   final ListModel listModel = myOptionsList.getModel();
   final List<HighlightSeverity> order = new ArrayList<HighlightSeverity>();
   for (int i = listModel.getSize() - 1; i >= 0; i--) {
     final SeverityBasedTextAttributes info =
         (SeverityBasedTextAttributes) listModel.getElementAt(i);
     order.add(info.getSeverity());
     if (!mySeverityRegistrar.isDefaultSeverity(info.getSeverity())) {
       infoTypes.remove(info);
       final Color stripeColor = info.getAttributes().getErrorStripeColor();
       mySeverityRegistrar.registerSeverity(
           info, stripeColor != null ? stripeColor : LightColors.YELLOW);
     }
   }
   for (SeverityBasedTextAttributes info : infoTypes) {
     mySeverityRegistrar.unregisterSeverity(info.getSeverity());
   }
   mySeverityRegistrar.setOrder(order);
   super.doOKAction();
 }
Exemplo n.º 2
0
 private void reset(SeverityBasedTextAttributes info) {
   final MyTextAttributesDescription description =
       new MyTextAttributesDescription(
           info.getType().toString(),
           null,
           info.getAttributes(),
           info.getType().getAttributesKey());
   @NonNls Element textAttributes = new Element("temp");
   try {
     info.getAttributes().writeExternal(textAttributes);
     description.getTextAttributes().readExternal(textAttributes);
   } catch (Exception e) {
     LOG.error(e);
   }
   myOptionsPanel.reset(description);
 }