public void summaryRowSelection(final ReportEvent event) {
    if (rowbandingOnGroup == false) {
      return;
    }

    if (StringUtils.isEmpty(group)) {
      final Group group = event.getReport().getGroup(event.getState().getCurrentGroupIndex());
      if (group instanceof CrosstabRowGroup) {
        final GroupBody body = group.getBody();
        if (body instanceof CrosstabColumnGroupBody) {
          if (Boolean.TRUE.equals(
              group.getAttribute(
                  AttributeNames.Crosstab.NAMESPACE, AttributeNames.Crosstab.PRINT_SUMMARY))) {
            triggerVisibleStateCrosstab(event);
          }
        }
      }
    } else {
      if (FunctionUtilities.isDefinedGroup(group, event)) {
        final Group group = event.getReport().getGroup(event.getState().getCurrentGroupIndex());
        if (Boolean.TRUE.equals(
            group.getAttribute(
                AttributeNames.Crosstab.NAMESPACE, AttributeNames.Crosstab.PRINT_SUMMARY))) {
          triggerVisibleStateCrosstab(event);
        }
      }
    }
  }
  private void maybeShowFor(Component c, MouseEvent me) {
    if (!(c instanceof JComponent)) return;

    JComponent comp = (JComponent) c;
    Window wnd = SwingUtilities.getWindowAncestor(comp);
    if (wnd == null) return;

    if (!wnd.isActive()) {
      if (JBPopupFactory.getInstance().isChildPopupFocused(wnd)) return;
    }

    String tooltipText = comp.getToolTipText(me);
    if (tooltipText == null || tooltipText.trim().isEmpty()) return;

    boolean centerDefault =
        Boolean.TRUE.equals(comp.getClientProperty(UIUtil.CENTER_TOOLTIP_DEFAULT));
    boolean centerStrict =
        Boolean.TRUE.equals(comp.getClientProperty(UIUtil.CENTER_TOOLTIP_STRICT));
    int shift = centerStrict ? 0 : centerDefault ? 4 : 0;

    // Balloon may appear exactly above useful content, such behavior is rather annoying.
    if (c instanceof JTree) {
      TreePath path = ((JTree) c).getClosestPathForLocation(me.getX(), me.getY());
      if (path != null) {
        Rectangle pathBounds = ((JTree) c).getPathBounds(path);
        if (pathBounds != null && pathBounds.y + 4 < me.getY()) {
          shift += me.getY() - pathBounds.y - 4;
        }
      }
    }

    queueShow(comp, me, centerStrict || centerDefault, shift, -shift, -shift);
  }
  /**
   * Called before window creation, descendants should override to initialize the data, initialize
   * params.
   */
  void preInit(XCreateWindowParams params) {
    state_lock = new StateLock();
    initialising = InitialiseState.NOT_INITIALISED;
    embedded = Boolean.TRUE.equals(params.get(EMBEDDED));
    visible = Boolean.TRUE.equals(params.get(VISIBLE));

    Object parent = params.get(PARENT);
    if (parent instanceof XBaseWindow) {
      parentWindow = (XBaseWindow) parent;
    } else {
      Long parentWindowID = (Long) params.get(PARENT_WINDOW);
      if (parentWindowID != null) {
        parentWindow = XToolkit.windowToXWindow(parentWindowID);
      }
    }

    Long eventMask = (Long) params.get(EVENT_MASK);
    if (eventMask != null) {
      long mask = eventMask.longValue();
      mask |= SubstructureNotifyMask;
      params.put(EVENT_MASK, mask);
    }

    screen = -1;
  }
 public boolean loadInitialCheckBoxState() {
   PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
   return Boolean.TRUE
           .toString()
           .equals(propertiesComponent.getValue("GoToAction.toSaveAllIncluded"))
       && propertiesComponent.isTrueValue("GoToAction.allIncluded");
 }
  public static void importConfigsTo(@NotNull String newConfigPath) {
    ConfigImportSettings settings = getConfigImportSettings();

    File newConfigDir = new File(newConfigPath);
    File oldConfigDir = findOldConfigDir(newConfigDir, settings.getCustomPathsSelector());
    do {
      ImportOldConfigsPanel dialog = new ImportOldConfigsPanel(oldConfigDir, settings);
      dialog.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL);
      AppUIUtil.updateWindowIcon(dialog);
      dialog.setVisible(true);
      if (dialog.isImportEnabled()) {
        File installationHome = dialog.getSelectedFile();
        oldConfigDir = getOldConfigDir(installationHome, settings);
        if (!validateOldConfigDir(installationHome, oldConfigDir, settings)) {
          continue;
        }

        assert oldConfigDir != null;
        doImport(newConfigDir, oldConfigDir, settings, installationHome);
        settings.importFinished(newConfigPath);
        System.setProperty(CONFIG_IMPORTED_IN_CURRENT_SESSION_KEY, Boolean.TRUE.toString());
      }

      break;
    } while (true);
  }
  /**
   * Creates window using parameters <code>params</code> If params contain flag DELAYED doesn't do
   * anything. Note: Descendants can call this method to create the window at the time different to
   * instance construction.
   */
  protected final void init(XCreateWindowParams params) {
    awtLock();
    initialising = InitialiseState.INITIALISING;
    awtUnlock();

    try {
      if (!Boolean.TRUE.equals(params.get(DELAYED))) {
        preInit(params);
        create(params);
        postInit(params);
      } else {
        instantPreInit(params);
        delayedParams = params;
      }
      awtLock();
      initialising = InitialiseState.INITIALISED;
      awtLockNotifyAll();
      awtUnlock();
    } catch (RuntimeException re) {
      awtLock();
      initialising = InitialiseState.FAILED_INITIALISATION;
      awtLockNotifyAll();
      awtUnlock();
      throw re;
    } catch (Throwable t) {
      log.log(Level.WARNING, "Exception during peer initialization", t);
      awtLock();
      initialising = InitialiseState.FAILED_INITIALISATION;
      awtLockNotifyAll();
      awtUnlock();
    }
  }
 public static boolean isControlBand(final StyleSheet style) {
   if (style.getStyleProperty(BandStyleKeys.COMPUTED_SHEETNAME) != null) {
     return true;
   }
   if (style.getStyleProperty(BandStyleKeys.BOOKMARK) != null) {
     return true;
   }
   if (BandStyleKeys.LAYOUT_INLINE.equals(style.getStyleProperty(BandStyleKeys.LAYOUT)) == false) {
     if (Boolean.TRUE.equals(style.getStyleProperty(BandStyleKeys.PAGEBREAK_AFTER))) {
       return true;
     }
     if (Boolean.TRUE.equals(style.getStyleProperty(BandStyleKeys.PAGEBREAK_BEFORE))) {
       return true;
     }
   }
   return false;
 }
 private boolean enabledAndGettersFilled(final boolean ignoreEnabled) {
   if ((!ignoreEnabled) && (!Boolean.TRUE.equals(myEnabledHolder.get()))) {
     return false;
   }
   return (myRootGetter.get() != null)
       && (myBranchGetter.get() != null)
       && (myWcPathGetter.get() != null);
 }
 public void saveInitialCheckBoxState(boolean state) {
   PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
   if (Boolean.TRUE
       .toString()
       .equals(propertiesComponent.getValue("GoToAction.toSaveAllIncluded"))) {
     propertiesComponent.setValue("GoToAction.allIncluded", Boolean.toString(state));
   }
 }
Beispiel #10
0
 static boolean hasOpaqueBeenExplicitlySet(final JComponent c) {
   final Method method = getJComponentGetFlagMethod.get();
   if (method == null) return false;
   try {
     return Boolean.TRUE.equals(method.invoke(c, OPAQUE_SET_FLAG));
   } catch (final Throwable ignored) {
     return false;
   }
 }
 public void propertyChange(PropertyChangeEvent evt) {
   if (Boolean.TRUE.equals(evt.getNewValue())) {
     for (CollapsiblePane p : getCollapsiblePanes()) {
       if (p != evt.getSource()) {
         p.setEmphasized(false);
       }
     }
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see javax.swing.JComponent#addNotify()
  */
 @Override
 public void addNotify() {
   super.addNotify();
   if (Boolean.TRUE.equals(this.getClientProperty(UNINSTALLED))) {
     this.installTitlePane();
     // this.installListeners();
     this.putClientProperty(UNINSTALLED, null);
   }
 }
 private static boolean isHintsAllowed(Window window) {
   if (window instanceof RootPaneContainer) {
     final JRootPane pane = ((RootPaneContainer) window).getRootPane();
     if (pane != null) {
       return Boolean.TRUE.equals(pane.getClientProperty(AbstractPopup.SHOW_HINTS));
     }
   }
   return false;
 }
Beispiel #14
0
 /**
  * Checks whether the specified component or one of its ancestors has the specified client
  * property set to {@link Boolean#TRUE}.
  *
  * @param c Component.
  * @param clientPropName Client property name.
  * @return <code>true</code> if the specified component or one of its ancestors has the
  *     specified client property set to {@link Boolean#TRUE}, <code>false</code> otherwise.
  */
 private boolean hasClientPropertySetToTrue(Component c, String clientPropName) {
   while (c != null) {
     if (c instanceof JComponent) {
       JComponent jc = (JComponent) c;
       if (Boolean.TRUE.equals(jc.getClientProperty(clientPropName))) return true;
     }
     c = c.getParent();
   }
   return false;
 }
  /*
   * (non-Javadoc)
   *
   * @see javax.swing.JComponent#removeNotify()
   */
  @Override
  public void removeNotify() {
    super.removeNotify();

    // fix for defect 211 - internal frames that are iconified
    // programmatically should not uninstall the title panes.
    boolean isAlive =
        ((this.frame.isIcon() && !this.frame.isClosed())
            || Boolean.TRUE.equals(frame.getClientProperty(ICONIFYING)));
    if (!isAlive) {
      this.uninstall();
    }
  }
 public void writeExternal(final Element element) {
   element.setAttribute(ID_ATTR, myId);
   element.setAttribute(
       ACTIVE_ATTR, myActive ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
   element.setAttribute(ANCHOR_ATTR, myAnchor.toString());
   element.setAttribute(
       AUTOHIDE_ATTR, myAutoHide ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
   element.setAttribute(INTERNAL_TYPE_ATTR, myInternalType.toString());
   element.setAttribute(TYPE_ATTR, myType.toString());
   element.setAttribute(
       VISIBLE_ATTR, myVisible ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
   element.setAttribute(WEIGHT_ATTR, Float.toString(myWeight));
   element.setAttribute(SIDE_WEIGHT_ATTR, Float.toString(mySideWeight));
   element.setAttribute(ORDER_ATTR, Integer.toString(myOrder));
   element.setAttribute(SIDE_TOOL_ATTR, Boolean.toString(mySplitMode));
   element.setAttribute(CONTENT_UI_ATTR, myContentUiType.getName());
   if (myFloatingBounds != null) {
     element.setAttribute(X_ATTR, Integer.toString(myFloatingBounds.x));
     element.setAttribute(Y_ATTR, Integer.toString(myFloatingBounds.y));
     element.setAttribute(WIDTH_ATTR, Integer.toString(myFloatingBounds.width));
     element.setAttribute(HEIGHT_ATTR, Integer.toString(myFloatingBounds.height));
   }
 }
    // {{{ setValueAt() method
    @Override
    public void setValueAt(Object aValue, int row, int column) {
      if (column != 0) return;

      Object obj = filteredEntries.get(row);
      if (obj instanceof String) return;

      Entry entry = (Entry) obj;
      boolean before = entry.install;
      entry.install = Boolean.TRUE.equals(aValue);
      if (before == entry.install) return;
      if (!entry.install) deselectParents(entry);

      List<PluginList.Dependency> deps = entry.plugin.getCompatibleBranch().deps;

      for (int i = 0; i < deps.size(); i++) {
        PluginList.Dependency dep = deps.get(i);
        if ("plugin".equals(dep.what)) {
          boolean found = false;
          for (int j = 0; j < filteredEntries.size(); j++) {
            Entry temp = (Entry) filteredEntries.get(j);
            if (temp.plugin == dep.plugin) {
              found = true;
              if (entry.install) {
                temp.parents.add(entry);
                setValueAt(Boolean.TRUE, j, 0);
              } else temp.parents.remove(entry);

              break;
            }
          }
          if (!found) {
            // the dependency was not found in the filtered list so we search in
            // global list.
            for (int a = 0; a < entries.size(); a++) {
              Entry temp = (Entry) entries.get(a);
              if (temp.plugin == dep.plugin) {
                if (entry.install) {
                  temp.parents.add(entry);
                  temp.install = true;
                } else temp.parents.remove(entry);
                break;
              }
            }
          }
        }
      }
      updateFilteredEntries();
    } // }}}
  public boolean isToDrawMacCorner() {
    if (!SystemInfo.isMac || myComponent.getComponentCount() <= 0) {
      return false;
    }

    if (myComponent.getComponentCount() > 0) {
      Component component = myComponent.getComponent(0);
      if (component instanceof JComponent
          && Boolean.TRUE.equals(((JComponent) component).getClientProperty(SUPPRESS_MAC_CORNER))) {
        return false;
      }
    }

    return true;
  }
  public GeneralHighlightingPass(
      @NotNull Project project,
      @NotNull PsiFile file,
      @NotNull Document document,
      int startOffset,
      int endOffset,
      boolean updateAll,
      @NotNull ProperTextRange priorityRange,
      @Nullable Editor editor) {
    super(project, document, PRESENTABLE_NAME, file, true);
    myStartOffset = startOffset;
    myEndOffset = endOffset;
    myUpdateAll = updateAll;
    myPriorityRange = priorityRange;
    myEditor = editor;

    LOG.assertTrue(file.isValid());
    setId(Pass.UPDATE_ALL);
    myHasErrorElement =
        !isWholeFileHighlighting() && Boolean.TRUE.equals(myFile.getUserData(HAS_ERROR_ELEMENT));
    FileStatusMap fileStatusMap =
        ((DaemonCodeAnalyzerImpl) DaemonCodeAnalyzer.getInstance(myProject)).getFileStatusMap();
    myErrorFound = !isWholeFileHighlighting() && fileStatusMap.wasErrorFound(myDocument);

    myApplyCommand =
        new Runnable() {
          @Override
          public void run() {
            ProperTextRange range = new ProperTextRange(myStartOffset, myEndOffset);
            MarkupModel model = DocumentMarkupModel.forDocument(myDocument, myProject, true);
            UpdateHighlightersUtil.cleanFileLevelHighlights(myProject, Pass.UPDATE_ALL, myFile);
            final EditorColorsScheme colorsScheme = getColorsScheme();
            UpdateHighlightersUtil.setHighlightersInRange(
                myProject,
                myDocument,
                range,
                colorsScheme,
                myHighlights,
                (MarkupModelEx) model,
                Pass.UPDATE_ALL);
          }
        };

    // initial guess to show correct progress in the traffic light icon
    setProgressLimit(document.getTextLength() / 2); // approx number of PSI elements = file length/2
    myGlobalScheme = EditorColorsManager.getInstance().getGlobalScheme();
  }
    private void appendAction(@NotNull AnAction action) {
      Presentation presentation = getPresentation(action);
      AnActionEvent event = createActionEvent(action);

      ActionUtil.performDumbAwareUpdate(action, event, true);
      if ((myShowDisabled || presentation.isEnabled()) && presentation.isVisible()) {
        String text = presentation.getText();
        if (myShowNumbers) {
          if (myCurrentNumber < 9) {
            text = "&" + (myCurrentNumber + 1) + ". " + text;
          } else if (myCurrentNumber == 9) {
            text = "&" + 0 + ". " + text;
          } else if (myUseAlphaAsNumbers) {
            text = "&" + (char) ('A' + myCurrentNumber - 10) + ". " + text;
          }
          myCurrentNumber++;
        } else if (myHonorActionMnemonics) {
          text =
              Presentation.restoreTextWithMnemonic(
                  text, action.getTemplatePresentation().getMnemonic());
        }

        Icon icon = presentation.getIcon();
        if (icon == null) {
          @NonNls final String actionId = ActionManager.getInstance().getId(action);
          if (actionId != null && actionId.startsWith("QuickList.")) {
            icon = AllIcons.Actions.QuickList;
          } else if (action instanceof Toggleable) {
            boolean toggled =
                Boolean.TRUE.equals(presentation.getClientProperty(Toggleable.SELECTED_PROPERTY));
            icon = toggled ? new IconWrapper(PlatformIcons.CHECK_ICON) : myEmptyIcon;
          } else {
            icon = myEmptyIcon;
          }
        } else {
          icon = new IconWrapper(icon);
        }
        boolean prependSeparator =
            (!myListModel.isEmpty() || mySeparatorText != null) && myPrependWithSeparator;
        assert text != null : action + " has no presentation";
        myListModel.add(
            new ActionItem(
                action, text, presentation.isEnabled(), icon, prependSeparator, mySeparatorText));
        myPrependWithSeparator = false;
        mySeparatorText = null;
      }
    }
  public void reportAppendableHistory(
      FilePath path, final VcsAppendableHistorySessionPartner partner) throws VcsException {
    final FilePath committedPath = ChangesUtil.getCommittedPath(myVcs.getProject(), path);

    final LogLoader logLoader;
    if (path.isNonLocal()) {
      logLoader = new RepositoryLoader(myVcs, path);
    } else {
      logLoader = new LocalLoader(myVcs, path);
    }

    try {
      logLoader.preliminary();
    } catch (SVNCancelException e) {
      return;
    } catch (SVNException e) {
      throw new VcsException(e);
    }
    logLoader.initSupports15();

    final MyHistorySession historySession =
        new MyHistorySession(
            Collections.<VcsFileRevision>emptyList(),
            committedPath,
            Boolean.TRUE.equals(logLoader.mySupport15),
            null);

    final Ref<Boolean> sessionReported = new Ref<Boolean>();
    final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
    if (indicator != null) {
      indicator.setText(SvnBundle.message("progress.text2.collecting.history", path.getName()));
    }
    final Consumer<VcsFileRevision> consumer =
        new Consumer<VcsFileRevision>() {
          public void consume(VcsFileRevision vcsFileRevision) {
            if (!Boolean.TRUE.equals(sessionReported.get())) {
              partner.reportCreatedEmptySession(historySession);
              sessionReported.set(true);
            }
            partner.acceptRevision(vcsFileRevision);
          }
        };

    logLoader.setConsumer(consumer);
    logLoader.load();
    logLoader.check();
  }
  /** Bases on presence of notifications! */
  public ThreeState isAuthenticatedFor(final VirtualFile vf) {
    final WorkingCopy wcCopy = myRootsToWorkingCopies.getWcRoot(vf);
    if (wcCopy == null) return ThreeState.UNSURE;

    // check there's no cancellation yet
    final boolean haveCancellation = getStateFor(wcCopy.getUrl());
    if (haveCancellation) return ThreeState.NO;

    final Boolean keptResult = myCopiesPassiveResults.get(wcCopy.getUrl());
    if (Boolean.TRUE.equals(keptResult)) return ThreeState.YES;
    if (Boolean.FALSE.equals(keptResult)) return ThreeState.NO;

    // check have credentials
    final boolean calculatedResult = passiveValidation(myVcs.getProject(), wcCopy.getUrl());
    myCopiesPassiveResults.put(wcCopy.getUrl(), calculatedResult);
    return calculatedResult ? ThreeState.YES : ThreeState.NO;
  }
  public void assertIsDispatchThread(@Nullable final JComponent component) {
    if (component == null) return;

    Thread curThread = Thread.currentThread();
    if (ourDispatchThread == curThread) {
      return;
    }

    if (Boolean.TRUE.equals(component.getClientProperty(WAS_EVER_SHOWN))) {
      assertIsDispatchThread();
    } else {
      final JRootPane root = component.getRootPane();
      if (root != null) {
        component.putClientProperty(WAS_EVER_SHOWN, Boolean.TRUE);
        assertIsDispatchThread();
      }
    }
  }
  public void readDirectoryMappings(final Element element) {
    myMappings.clear();

    final List<VcsDirectoryMapping> mappingsList = new ArrayList<VcsDirectoryMapping>();
    boolean haveNonEmptyMappings = false;
    for (Element child : element.getChildren(ELEMENT_MAPPING)) {
      final String vcs = child.getAttributeValue(ATTRIBUTE_VCS);
      if (vcs != null && !vcs.isEmpty()) {
        haveNonEmptyMappings = true;
      }
      VcsDirectoryMapping mapping =
          new VcsDirectoryMapping(child.getAttributeValue(ATTRIBUTE_DIRECTORY), vcs);
      mappingsList.add(mapping);

      Element rootSettingsElement = child.getChild(ELEMENT_ROOT_SETTINGS);
      if (rootSettingsElement != null) {
        String className = rootSettingsElement.getAttributeValue(ATTRIBUTE_CLASS);
        AbstractVcs vcsInstance = findVcsByName(mapping.getVcs());
        if (vcsInstance != null && className != null) {
          final VcsRootSettings rootSettings = vcsInstance.createEmptyVcsRootSettings();
          if (rootSettings != null) {
            try {
              rootSettings.readExternal(rootSettingsElement);
              mapping.setRootSettings(rootSettings);
            } catch (InvalidDataException e) {
              LOG.error(
                  "Failed to load VCS root settings class "
                      + className
                      + " for VCS "
                      + vcsInstance.getClass().getName(),
                  e);
            }
          }
        }
      }
    }
    boolean defaultProject =
        Boolean.TRUE.toString().equals(element.getAttributeValue(ATTRIBUTE_DEFAULT_PROJECT));
    // run autodetection if there's no VCS in default project and
    if (haveNonEmptyMappings || !defaultProject) {
      myMappingsLoaded = true;
    }
    myMappings.setDirectoryMappings(mappingsList);
  }
 public void writeDirectoryMappings(final Element element) {
   if (myProject.isDefault()) {
     element.setAttribute(ATTRIBUTE_DEFAULT_PROJECT, Boolean.TRUE.toString());
   }
   for (VcsDirectoryMapping mapping : getDirectoryMappings()) {
     Element child = new Element(ELEMENT_MAPPING);
     child.setAttribute(ATTRIBUTE_DIRECTORY, mapping.getDirectory());
     child.setAttribute(ATTRIBUTE_VCS, mapping.getVcs());
     final VcsRootSettings rootSettings = mapping.getRootSettings();
     if (rootSettings != null) {
       Element rootSettingsElement = new Element(ELEMENT_ROOT_SETTINGS);
       rootSettingsElement.setAttribute(ATTRIBUTE_CLASS, rootSettings.getClass().getName());
       try {
         rootSettings.writeExternal(rootSettingsElement);
         child.addContent(rootSettingsElement);
       } catch (WriteExternalException e) {
         // don't add element
       }
     }
     element.addContent(child);
   }
 }
 private void updateIcon(AnAction action) {
   if (action instanceof Toggleable && myPresentation.getIcon() == null) {
     action.update(myEvent);
     if (Boolean.TRUE.equals(
         myEvent.getPresentation().getClientProperty(Toggleable.SELECTED_PROPERTY))) {
       setIcon(ourCheckedIcon);
       setDisabledIcon(IconLoader.getDisabledIcon(ourCheckedIcon));
     } else {
       setIcon(ourUncheckedIcon);
       setDisabledIcon(IconLoader.getDisabledIcon(ourUncheckedIcon));
     }
   } else {
     if (!SystemInfo.isMac || UISettings.getInstance().SHOW_ICONS_IN_MENUS) {
       Icon icon = myPresentation.getIcon();
       setIcon(icon);
       if (myPresentation.getDisabledIcon() != null) {
         setDisabledIcon(myPresentation.getDisabledIcon());
       } else {
         setDisabledIcon(IconLoader.getDisabledIcon(icon));
       }
     }
   }
 }
 private void updateIcon(AnAction action) {
   if (isToggleable()
       && (myPresentation.getIcon() == null
           || myInsideCheckedGroup
           || !UISettings.getInstance().SHOW_ICONS_IN_MENUS)) {
     action.update(myEvent);
     myToggled =
         Boolean.TRUE.equals(
             myEvent.getPresentation().getClientProperty(Toggleable.SELECTED_PROPERTY));
     if (ActionPlaces.MAIN_MENU.equals(myPlace) && SystemInfo.isMacSystemMenu
         || UIUtil.isUnderNimbusLookAndFeel()
         || UIUtil.isUnderWindowsLookAndFeel() && SystemInfo.isWin7OrNewer) {
       setState(myToggled);
     } else if (!(getUI() instanceof GtkMenuItemUI)) {
       if (myToggled) {
         setIcon(ourCheckedIcon);
         setDisabledIcon(IconLoader.getDisabledIcon(ourCheckedIcon));
       } else {
         setIcon(ourUncheckedIcon);
         setDisabledIcon(IconLoader.getDisabledIcon(ourUncheckedIcon));
       }
     }
   } else {
     if (UISettings.getInstance().SHOW_ICONS_IN_MENUS) {
       Icon icon = myPresentation.getIcon();
       if (action instanceof ToggleAction && ((ToggleAction) action).isSelected(myEvent)) {
         icon = new PoppedIcon(icon, 16, 16);
       }
       setIcon(icon);
       if (myPresentation.getDisabledIcon() != null) {
         setDisabledIcon(myPresentation.getDisabledIcon());
       } else {
         setDisabledIcon(IconLoader.getDisabledIcon(icon));
       }
     }
   }
 }
Beispiel #28
0
  @Override
  public void loadForm() {
    // get the current address, label and amount from the model
    String address =
        this.bitcoinController.getModel().getActiveWalletPreference(BitcoinModel.SEND_ADDRESS);
    String label =
        this.bitcoinController.getModel().getActiveWalletPreference(BitcoinModel.SEND_LABEL);
    String amountNotLocalised =
        this.bitcoinController.getModel().getActiveWalletPreference(BitcoinModel.SEND_AMOUNT);

    if (amountBTCTextField != null) {
      CurrencyConverterResult converterResult =
          CurrencyConverter.INSTANCE.parseToBTCNotLocalised(amountNotLocalised);

      if (converterResult.isBtcMoneyValid()) {
        parsedAmountBTC = converterResult.getBtcMoney();
        String amountLocalised =
            CurrencyConverter.INSTANCE.getBTCAsLocalisedString(converterResult.getBtcMoney());
        amountBTCTextField.setText(amountLocalised);
        if (notificationLabel != null) {
          notificationLabel.setText("");
        }
      } else {
        parsedAmountBTC = null;
        amountBTCTextField.setText("");
        if (notificationLabel != null) {
          notificationLabel.setText(converterResult.getBtcMessage());
        }
      }
    }

    if (address != null) {
      addressTextField.setText(address);
    } else {
      addressTextField.setText("");
    }
    if (label != null) {
      labelTextArea.setText(label);
    } else {
      labelTextArea.setText("");
    }

    // if there is a pending 'handleopenURI' that needs pasting into the
    // send form, do it
    String performPasteNow =
        this.bitcoinController
            .getModel()
            .getActiveWalletPreference(BitcoinModel.SEND_PERFORM_PASTE_NOW);
    if (Boolean.TRUE.toString().equalsIgnoreCase(performPasteNow)) {
      try {
        Address decodeAddress =
            new Address(this.bitcoinController.getModel().getNetworkParameters(), address);
        processDecodedString(
            com.google.bitcoin.uri.BitcoinURI.convertToBitcoinURI(
                decodeAddress, Utils.toNanoCoins(amountNotLocalised), label, null),
            null);
        this.bitcoinController
            .getModel()
            .setActiveWalletPreference(BitcoinModel.SEND_PERFORM_PASTE_NOW, "false");
        sendButton.requestFocusInWindow();

        mainFrame.bringToFront();
      } catch (AddressFormatException e) {
        throw new RuntimeException(e);
      }
    }
  }
  public HttpProxySettingsUi(@NotNull final HttpConfigurable settings) {
    ButtonGroup group = new ButtonGroup();
    group.add(myUseHTTPProxyRb);
    group.add(myAutoDetectProxyRb);
    group.add(myNoProxyRb);
    myNoProxyRb.setSelected(true);

    ButtonGroup proxyTypeGroup = new ButtonGroup();
    proxyTypeGroup.add(myHTTP);
    proxyTypeGroup.add(mySocks);
    myHTTP.setSelected(true);

    Boolean property = Boolean.getBoolean(JavaProxyProperty.USE_SYSTEM_PROXY);
    mySystemProxyDefined.setVisible(Boolean.TRUE.equals(property));
    if (Boolean.TRUE.equals(property)) {
      mySystemProxyDefined.setIcon(Messages.getWarningIcon());
      RelativeFont.BOLD.install(mySystemProxyDefined);
    }

    myProxyAuthCheckBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(@NotNull ActionEvent e) {
            enableProxyAuthentication(myProxyAuthCheckBox.isSelected());
          }
        });
    myPacUrlCheckBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(@NotNull ActionEvent e) {
            myPacUrlTextField.setEnabled(myPacUrlCheckBox.isSelected());
          }
        });

    ActionListener listener =
        new ActionListener() {
          @Override
          public void actionPerformed(@NotNull ActionEvent e) {
            enableProxy(myUseHTTPProxyRb.isSelected());
          }
        };
    myUseHTTPProxyRb.addActionListener(listener);
    myAutoDetectProxyRb.addActionListener(listener);
    myNoProxyRb.addActionListener(listener);

    myClearPasswordsButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(@NotNull ActionEvent e) {
            settings.clearGenericPasswords();
            //noinspection DialogTitleCapitalization
            Messages.showMessageDialog(
                myMainPanel,
                "Proxy passwords were cleared.",
                "Auto-detected Proxy",
                Messages.getInformationIcon());
          }
        });

    configureCheckButton();
  }
Beispiel #30
0
  @Override
  public void displayView(DisplayHint displayHint) {
    super.displayView(displayHint);

    if (DisplayHint.WALLET_TRANSACTIONS_HAVE_CHANGED == displayHint) {
      return;
    }

    JTextField aTextField = new JTextField();

    labelTextArea.setBorder(aTextField.getBorder());

    String bringToFront = controller.getModel().getUserPreference(BitcoinModel.BRING_TO_FRONT);
    if (Boolean.TRUE.toString().equals(bringToFront)) {
      controller.getModel().setUserPreference(BitcoinModel.BRING_TO_FRONT, "false");
      mainFrame.bringToFront();
    }

    // disable any new changes if another process has changed the wallet
    if (this.bitcoinController.getModel().getActivePerWalletModelData() != null
        && this.bitcoinController
            .getModel()
            .getActivePerWalletModelData()
            .isFilesHaveBeenChangedByAnotherProcess()) {
      // files have been changed by another process - disallow edits
      mainFrame.setUpdatesStoppedTooltip(addressTextField);
      addressTextField.setEditable(false);
      addressTextField.setEnabled(false);

      if (sendButton != null) {
        sendButton.setEnabled(false);
        mainFrame.setUpdatesStoppedTooltip(sendButton);
      }
      if (pasteAddressButton != null) {
        pasteAddressButton.setEnabled(false);
        mainFrame.setUpdatesStoppedTooltip(pasteAddressButton);
      }
      titleLabel.setText(
          controller
              .getLocaliser()
              .getString("sendBitcoinPanel.sendingAddressesTitle.mayBeOutOfDate"));
      mainFrame.setUpdatesStoppedTooltip(titleLabel);
    } else {
      addressTextField.setToolTipText(null);
      addressTextField.setEditable(true);
      addressTextField.setEnabled(true);

      if (sendButton != null) {
        if (SendBitcoinPanel.enableSendButton) {
          sendButton.setEnabled(true);
          sendButton.setToolTipText(
              HelpContentsPanel.createTooltipText(
                  controller.getLocaliser().getString("sendBitcoinAction.tooltip")));
        } else {
          sendButton.setEnabled(false);
          sendButton.setToolTipText(
              HelpContentsPanel.createTooltipText(
                  controller.getLocaliser().getString("sendBitcoinAction.pleaseWait.tooltip")));
        }
      }
      if (pasteAddressButton != null) {
        pasteAddressButton.setEnabled(true);
        pasteAddressButton.setToolTipText(
            HelpContentsPanel.createTooltipText(
                controller.getLocaliser().getString("pasteAddressAction.tooltip")));
      }
      titleLabel.setText(
          controller.getLocaliser().getString("sendBitcoinPanel.sendingAddressesTitle"));
      titleLabel.setToolTipText(null);
    }
    checkDeleteSendingEnabled();
    updateAmountPanel();
  }