コード例 #1
4
 /** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user changed the service filter option
   if (e.getSource() == service_box) {
     service_list.setEnabled(service_box.isSelected());
     service_list.clearSelection();
     remove_service_button.setEnabled(false);
     add_service_field.setEnabled(service_box.isSelected());
     add_service_field.setText("");
     add_service_button.setEnabled(false);
   }
   // Check if the user pressed the add service button
   if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) {
     String text = add_service_field.getText();
     if ((text != null) && (text.length() > 0)) {
       service_data.addElement(text);
       service_list.setListData(service_data);
     }
     add_service_field.setText("");
     add_service_field.requestFocus();
   }
   // Check if the user pressed the remove service button
   if (e.getSource() == remove_service_button) {
     Object[] sels = service_list.getSelectedValues();
     for (int i = 0; i < sels.length; i++) {
       service_data.removeElement(sels[i]);
     }
     service_list.setListData(service_data);
     service_list.clearSelection();
   }
 }
コード例 #2
0
  private void refreshSdkList() {
    final List<Sdk> pythonSdks = myInterpreterList.getAllPythonSdks(myProject);
    Sdk projectSdk = getSdk();
    if (!myShowOtherProjectVirtualenvs) {
      VirtualEnvProjectFilter.removeNotMatching(myProject, pythonSdks);
    }
    //noinspection unchecked
    mySdkList.setModel(new CollectionListModel<Sdk>(pythonSdks));

    mySdkListChanged = false;
    if (projectSdk != null) {
      projectSdk = myProjectSdksModel.findSdk(projectSdk.getName());
      mySdkList.clearSelection();
      mySdkList.setSelectedValue(projectSdk, true);
      mySdkList.updateUI();
    }
  }
コード例 #3
0
 private void editColorsAndFonts() {
   final String toConfigure = getSelectedType().getSeverity(null).myName;
   doOKAction();
   myOptionsList.clearSelection();
   final DataContext dataContext = DataManager.getInstance().getDataContext(myPanel);
   final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext);
   if (optionsEditor != null) {
     final ColorAndFontOptions colorAndFontOptions =
         optionsEditor.findConfigurable(ColorAndFontOptions.class);
     assert colorAndFontOptions != null;
     final SearchableConfigurable javaPage =
         colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class);
     LOG.assertTrue(javaPage != null);
     optionsEditor
         .clearSearchAndSelect(javaPage)
         .doWhenDone(
             new Runnable() {
               @Override
               public void run() {
                 final Runnable runnable = javaPage.enableSearch(toConfigure);
                 if (runnable != null) {
                   SwingUtilities.invokeLater(runnable);
                 }
               }
             });
   } else {
     ColorAndFontOptions colorAndFontOptions = new ColorAndFontOptions();
     final Configurable[] configurables = colorAndFontOptions.buildConfigurables();
     try {
       final SearchableConfigurable javaPage =
           colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class);
       LOG.assertTrue(javaPage != null);
       ShowSettingsUtil.getInstance()
           .editConfigurable(CommonDataKeys.PROJECT.getData(dataContext), javaPage);
     } finally {
       for (Configurable configurable : configurables) {
         configurable.disposeUIResources();
       }
       colorAndFontOptions.disposeUIResources();
     }
   }
 }
コード例 #4
0
    public void mouseClicked(MouseEvent evt) {
      // Note: we can't depend on evt.getSource() because of backward
      // compatability
      if (list != null && SwingUtilities.isLeftMouseButton(evt) && (evt.getClickCount() % 2 == 0)) {

        int index = SwingUtilities2.loc2IndexFileList(list, evt.getPoint());
        if (index >= 0) {
          File f = (File) list.getModel().getElementAt(index);
          try {
            // Strip trailing ".."
            f = ShellFolder.getNormalizedFile(f);
          } catch (IOException ex) {
            // That's ok, we'll use f as is
          }
          if (getFileChooser().isTraversable(f)) {
            list.clearSelection();
            changeDirectory(f);
          } else {
            getFileChooser().approveSelection();
          }
        }
      }
    }
コード例 #5
0
 public void setSelected(boolean isSelected) {
   _button.setEnabled(!isSelected);
   if (!isSelected) _courseList.clearSelection();
 }