Esempio n. 1
0
  protected void init() {
    super.init();

    java.util.List<Macro> macros = new ArrayList<Macro>(MacroManager.getInstance().getMacros());
    Collections.sort(
        macros,
        new Comparator<Macro>() {
          public int compare(Macro macro1, Macro macro2) {
            String name1 = macro1.getName();
            String name2 = macro2.getName();
            if (!StringUtil.startsWithChar(name1, '/')) {
              name1 = ZERO + name1;
            }
            if (!StringUtil.startsWithChar(name2, '/')) {
              name2 = ZERO + name2;
            }
            return name1.compareToIgnoreCase(name2);
          }

          private final String ZERO = new String(new char[] {0});
        });
    for (Macro macro : macros) {
      myMacrosModel.addElement(new MacroWrapper(macro));
    }

    addListeners();
    if (myMacrosModel.size() > 0) {
      myMacrosList.setSelectedIndex(0);
    } else {
      setOKActionEnabled(false);
    }
  }
 protected void init() {
   setTitle(myTitle);
   myTfUrl = new JTextField();
   myTfPath = new JTextField();
   myBtnBrowseLocalPath = new FixedSizeButton(myTfPath);
   super.init();
 }
 @Override
 protected void init() {
   createDocumentListener(txtName);
   createDocumentListener(txtThumb);
   myOKAction.setEnabled(false);
   super.init();
 }
 @Override
 protected void init() {
   super.init();
   final ButtonGroup buttonGroup = new ButtonGroup();
   buttonGroup.add(myCreateNewRepoButton);
   buttonGroup.add(myUseParentRepoButton);
 }
 @Override
 protected void init() {
   setTitle(waEndpt == null ? message("adRolEndPtTitle") : message("endptEditTitle"));
   comboType.setModel(new DefaultComboBoxModel(WindowsAzureEndpointType.values()));
   comboType.addItemListener(createComboTypeListener());
   lblName.setPreferredSize(lblPrivatePort.getPreferredSize());
   // Edit Endpoint scenario
   if (waEndpt != null) {
     txtName.setText(waEndpt.getName());
     // type
     WindowsAzureEndpointType type = null;
     try {
       type = waEndpt.getEndPointType();
       comboType.setSelectedItem(type);
     } catch (WindowsAzureInvalidProjectOperationException e) {
       PluginUtil.displayErrorDialog(message("dlgDbgEndPtErrTtl"), message("endPtTypeErr"));
     }
     // private port
     String prvPort = waEndpt.getPrivatePort();
     if (prvPort == null && !type.equals(WindowsAzureEndpointType.InstanceInput)) {
       txtPrivatePort.setText(AUTO);
     } else {
       String[] prvPortRange = prvPort.split("-");
       txtPrivatePort.setText(prvPortRange[0]);
       if (prvPortRange.length > 1) {
         txtPrivatePortRangeEnd.setText(prvPortRange[1]);
       }
     }
     // Public port
     String[] portRange = waEndpt.getPort().split("-");
     txtPublicPort.setText(portRange[0]);
     if (portRange.length > 1) {
       txtPublicPortRangeEnd.setText(portRange[1]);
     }
   } else {
     /*
      * Add Endpoint scenario.
      * Endpoint type is Internal for the first time.
      */
     txtPrivatePort.setText(AUTO);
   }
   enableControlsDependingOnEnpointType((WindowsAzureEndpointType) comboType.getSelectedItem());
   txtPrivatePort.addFocusListener(createPortFocusListener());
   txtPrivatePortRangeEnd.addFocusListener(createPortFocusListener());
   super.init();
 }
    public ColorPickerDialog(
        @NotNull Component parent,
        String caption,
        @Nullable Color preselectedColor,
        boolean enableOpacity,
        List<ColorPickerListener> listeners,
        boolean opacityInPercent) {
      super(parent, true);
      myListeners = listeners;
      myPreselectedColor = preselectedColor;
      myEnableOpacity = enableOpacity;
      myOpacityInPercent = opacityInPercent;

      setTitle(caption);
      setResizable(false);
      setOKButtonText("Choose");
      super.init();
    }
  @Override
  protected void init() {
    super.init();

    if (myTextSelected == Boolean.TRUE) {
      myRbSelectedText.setSelected(true);
    } else {
      if (myFile != null) {
        myRbFile.setSelected(true);
      } else {
        myRbDirectory.setSelected(true);
      }
    }

    myCbIncludeSubdirs.setSelected(true);
    // Loading previous state
    myCbOptimizeImports.setSelected(
        PropertiesComponent.getInstance()
            .getBoolean(LayoutCodeConstants.OPTIMIZE_IMPORTS_KEY, false));
    myCbArrangeEntries.setSelected(
        PropertiesComponent.getInstance()
            .getBoolean(LayoutCodeConstants.REARRANGE_ENTRIES_KEY, false));
    myCbOnlyVcsChangedRegions.setSelected(
        PropertiesComponent.getInstance()
            .getBoolean(LayoutCodeConstants.PROCESS_CHANGED_TEXT_KEY, false));

    ItemListener listener =
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            updateState();
          }
        };
    myRbFile.addItemListener(listener);
    myRbSelectedText.addItemListener(listener);
    myRbDirectory.addItemListener(listener);
    myCbIncludeSubdirs.addItemListener(listener);

    updateState();
  }
  public AddAdapterSupportDialog(
      @NotNull Project project,
      @NotNull PsiFile psiFileRequestor,
      @NotNull String assertionFrameworkName,
      @NotNull List<VirtualFile> adapterSourceFiles,
      @Nullable String adapterHomePageUrl) {
    super(project);
    myProject = project;
    myAssertFrameworkName = assertionFrameworkName;
    myAdapterSourceFiles = adapterSourceFiles;
    myFileRequestor = psiFileRequestor.getVirtualFile();

    setModal(true);
    setTitle("Add " + getAssertFrameworkAdapterName());

    myDirectoryTextField = new JTextField();
    VirtualFile initialDir = findInitialDir(psiFileRequestor);
    if (initialDir != null) {
      myDirectoryTextField.setText(FileUtil.toSystemDependentName(initialDir.getPath()));
    }
    // widen preferred size to fit dialog's title
    myDirectoryTextField.setPreferredSize(
        new Dimension(350, myDirectoryTextField.getPreferredSize().height));

    List<Component> components = Lists.newArrayList();
    components.add(createFilesViewPanel(adapterSourceFiles));
    components.add(Box.createVerticalStrut(10));
    components.add(createSelectDirectoryPanel(project, myDirectoryTextField));
    if (adapterHomePageUrl != null) {
      components.add(Box.createVerticalStrut(10));
      components.add(createInformationPanel(adapterHomePageUrl));
    }
    myContent = SwingHelper.newLeftAlignedVerticalPanel(components);

    setOKButtonText("Add");
    super.init();
  }
  @Override
  protected void init() {
    super.init();

    JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance();

    initReplaceFieldsWithGetters(settings);

    myDeclareFinalCheckBox.setSelected(hasFinalModifier());
    myDelegateViaOverloadingMethodCheckBox.setVisible(myInfo.getToSearchFor() != null);

    setTitle(RefactoringBundle.message("introduce.parameter.title"));

    myTable.init(myInfo);

    final GrParameter[] parameters = myInfo.getToReplaceIn().getParameters();
    toRemoveCBs.forEachEntry(
        new TObjectIntProcedure<JCheckBox>() {
          @Override
          public boolean execute(JCheckBox checkbox, int index) {
            checkbox.setSelected(true);

            final GrParameter param = parameters[index];
            final ParameterInfo pinfo = findParamByOldName(param.getName());
            if (pinfo != null) {
              pinfo.setPassAsParameter(false);
            }
            return true;
          }
        });

    updateSignature();

    if (myCanIntroduceSimpleParameter) {
      mySignaturePanel.setVisible(false);

      // action to hide signature panel if we have variants to introduce simple parameter
      myTypeComboBox.addItemListener(
          new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
              mySignaturePanel.setVisible(myTypeComboBox.isClosureSelected());
              pack();
            }
          });
    }

    final PsiType closureReturnType = inferClosureReturnType();
    if (PsiType.VOID.equals(closureReturnType)) {
      myForceReturnCheckBox.setEnabled(false);
      myForceReturnCheckBox.setSelected(false);
    } else {
      myForceReturnCheckBox.setSelected(isForceReturn());
    }

    if (myInfo.getToReplaceIn() instanceof GrClosableBlock) {
      myDelegateViaOverloadingMethodCheckBox.setEnabled(false);
      myDelegateViaOverloadingMethodCheckBox.setToolTipText(
          "Delegating is not allowed in closure context");
    }

    pack();
  }
 protected void init() {
   super.init();
   updateOkStatus();
 }
 protected void init() {
   super.init();
   updateStep();
 }