private void updateProjects() {
   try {
     myProjectCombobox.setModel(new DefaultComboBoxModel(myRepository.getProjects().toArray()));
     if (myRepository.getProject() != null)
       myProjectCombobox.setSelectedItem(myRepository.getProject());
     updateFilters();
   } catch (Exception e) {
     resetComboBoxes();
   }
 }
 private void fillComboBox() {
   myComboBox.removeAllItems();
   for (XExpression expression : getRecentExpressions()) {
     myComboBox.addItem(expression);
   }
   if (myComboBox.getItemCount() > 0) {
     myComboBox.setSelectedIndex(0);
   }
 }
Ejemplo n.º 3
1
 public Map<String, ?> getOptions() {
   final Map<String, Object> strings = new HashMap<String, Object>();
   if (myDisableAbstractElements.isSelected()) {
     strings.put(DISABLE_ABSTRACT_ELEMENTS, Boolean.TRUE);
   }
   strings.put(ANY_PROCESS_CONTENTS, myAnyProcessContents.getSelectedItem());
   strings.put(ANY_ATTRIBUTE_PROCESS_CONTENTS, myAnyAttributeProcessContents.getSelectedItem());
   return strings;
 }
 public AlternativeSourceNotificationPanel(
     ComboBoxClassElement[] alternatives,
     final PsiClass aClass,
     final Project project,
     final VirtualFile file) {
   setText(
       DebuggerBundle.message(
           "editor.notification.alternative.source", aClass.getQualifiedName()));
   final ComboBox switcher = new ComboBox(alternatives);
   switcher.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           FileEditorManager.getInstance(project).closeFile(file);
           PsiClass item = ((ComboBoxClassElement) switcher.getSelectedItem()).myClass;
           item = (PsiClass) item.getNavigationElement(); // go through compiled
           DebuggerUtilsEx.setAlternativeSource(file, item.getContainingFile().getVirtualFile());
           item.navigate(true);
           XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
           if (session != null) {
             session.updateExecutionPosition();
           }
         }
       });
   myLinksPanel.add(switcher);
 }
  private void initEditor() {
    myEditor =
        new EditorComboBoxEditor(getProject(), getEditorsProvider().getFileType()) {
          @Override
          public void setItem(Object anObject) {
            if (anObject == null) {
              anObject = XExpressionImpl.EMPTY_EXPRESSION;
            }
            XExpression expression = (XExpression) anObject;
            getEditorComponent()
                .setNewDocumentAndFileType(getFileType(expression), createDocument(expression));
          }

          @Override
          protected void onEditorCreate(EditorEx editor) {
            editor.putUserData(DebuggerCopyPastePreprocessor.REMOVE_NEWLINES_ON_PASTE, true);
            editor.getColorsScheme().setEditorFontSize(myComboBox.getFont().getSize());
          }
        };
    myEditor.getEditorComponent().setFontInheritedFromLAF(false);
    myComboBox.setEditor(myEditor);
    // myEditor.setItem(myExpression);
    myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor));
    myComboBox.setMaximumRowCount(XDebuggerHistoryManager.MAX_RECENT_EXPRESSIONS);
  }
 public FrameworkGroupOptionsComponent(
     final FrameworkGroup<?> group, final FrameworkSupportModelBase model) {
   JPanel panel = new JPanel(new VerticalFlowLayout());
   List<? extends FrameworkGroupVersion> versions = group.getGroupVersions();
   if (!versions.isEmpty()) {
     final ComboBox versionsBox = new ComboBox();
     versionsBox.setRenderer(
         new ListCellRendererWrapper<FrameworkGroupVersion>() {
           @Override
           public void customize(
               JList list,
               FrameworkGroupVersion value,
               int index,
               boolean selected,
               boolean hasFocus) {
             setText(value != null ? value.getPresentableName() : "");
           }
         });
     versionsBox.addActionListener(
         new ActionListener() {
           @Override
           public void actionPerformed(ActionEvent e) {
             model.setSelectedVersion(
                 group, (FrameworkGroupVersion) versionsBox.getSelectedItem());
           }
         });
     for (FrameworkGroupVersion version : versions) {
       versionsBox.addItem(version);
     }
     panel.add(
         FormBuilder.createFormBuilder().addLabeledComponent("Version:", versionsBox).getPanel());
   }
   myMainPanel = panel;
 }
 @Override
 public void reset() {
   myOSCombo.setSelectedItem(expandDefault(myBuildTargetSettings.getOS(), myDefaultOSValue));
   myArchCombo.setSelectedItem(expandDefault(myBuildTargetSettings.getArch(), myDefaultArchValue));
   myGoVersionCombo.setSelectedItem(
       expandDefault(myBuildTargetSettings.getGoVersion(), myDefaultGoVersion));
   myCgoCombo.setSelectedItem(expandDefault(cgo(myBuildTargetSettings.getCgo()), myDefaultCgo));
   myCompilerCombo.setSelectedItem(myBuildTargetSettings.getCompiler());
   myCustomFlagsField.setText(StringUtil.join(myBuildTargetSettings.getCustomFlags(), " "));
 }
  public BreakpointChooser(
      final Project project,
      Delegate delegate,
      Breakpoint baseBreakpoint,
      List<BreakpointItem> breakpointItems) {
    myDelegate = delegate;

    BreakpointItem breakpointItem = null;
    for (BreakpointItem item : breakpointItems) {
      if (item.getBreakpoint() == baseBreakpoint) {
        breakpointItem = item;
        break;
      }
    }
    myDetailController =
        new DetailController(
            new MasterController() {
              JLabel fake = new JLabel();

              @Override
              public ItemWrapper[] getSelectedItems() {
                return new ItemWrapper[] {((BreakpointItem) myList.getSelectedValue())};
              }

              @Override
              public JLabel getPathLabel() {
                return fake;
              }
            });

    final ItemWrapperListRenderer listRenderer = new ItemWrapperListRenderer(project, null);

    ComboBoxModel model = new CollectionComboBoxModel(breakpointItems, breakpointItem);
    myComboBox =
        new ComboBox(model) {
          @Override
          protected JBList createJBList(ComboBoxModel model) {
            myList = super.createJBList(model);
            myDetailController.setList(myList);
            myList.setCellRenderer(listRenderer);
            return myList;
          }
        };
    myComboBox.setRenderer(listRenderer);

    myComboBox.setSwingPopup(false);
    myComboBox.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent event) {
            myDelegate.breakpointChosen(project, ((BreakpointItem) myComboBox.getSelectedItem()));
          }
        });
  }
  @Override
  protected void doSetText(XExpression text) {
    if (myComboBox.getItemCount() > 0) {
      myComboBox.setSelectedIndex(0);
    }

    // if (myComboBox.isEditable()) {
    myEditor.setItem(text);
    // }
    myExpression = text;
  }
Ejemplo n.º 10
0
 public void setOptions(Map<String, ?> inputOptions) {
   myDisableAbstractElements.setSelected(
       inputOptions.get(DISABLE_ABSTRACT_ELEMENTS) == Boolean.TRUE);
   final Object o = inputOptions.get(ANY_PROCESS_CONTENTS);
   if (o != null) {
     myAnyProcessContents.setSelectedItem(o);
   }
   final Object o2 = inputOptions.get(ANY_ATTRIBUTE_PROCESS_CONTENTS);
   if (o2 != null) {
     myAnyAttributeProcessContents.setSelectedItem(o2);
   }
 }
Ejemplo n.º 11
0
  @NotNull
  private static JPanel createLayerConfigurationPanel(@NotNull final ModuleEditor moduleEditor) {
    BorderLayoutPanel panel = JBUI.Panels.simplePanel();

    ModifiableRootModel moduleRootModel = moduleEditor.getModifiableRootModelProxy();

    final MutableCollectionComboBoxModel<String> model =
        new MutableCollectionComboBoxModel<String>(
            new ArrayList<String>(moduleRootModel.getLayers().keySet()),
            moduleRootModel.getCurrentLayerName());

    final ComboBox comboBox = new ComboBox(model);
    comboBox.setEnabled(model.getSize() > 1);

    moduleEditor.addChangeListener(
        new ModuleEditor.ChangeListener() {
          @Override
          public void moduleStateChanged(ModifiableRootModel moduleRootModel) {
            model.update(new ArrayList<String>(moduleRootModel.getLayers().keySet()));
            model.setSelectedItem(moduleRootModel.getCurrentLayerName());
            model.update();

            comboBox.setEnabled(comboBox.getItemCount() > 1);
          }
        });

    comboBox.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              moduleEditor
                  .getModifiableRootModelProxy()
                  .setCurrentLayer((String) comboBox.getSelectedItem());
            }
          }
        });

    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new NewLayerAction(moduleEditor, false));
    group.add(new DeleteLayerAction(moduleEditor));
    group.add(new NewLayerAction(moduleEditor, true));

    ActionToolbar actionToolbar =
        ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
    JComponent toolbarComponent = actionToolbar.getComponent();
    toolbarComponent.setBorder(JBUI.Borders.empty());

    panel.addToLeft(LabeledComponent.left(comboBox, "Layer")).addToRight(toolbarComponent);
    return panel;
  }
 private void updateFilters() {
   try {
     final Object selectedItem = myProjectCombobox.getModel().getSelectedItem();
     if (selectedItem != null && selectedItem instanceof MantisProject) {
       myFilterCombobox.setModel(
           new DefaultComboBoxModel(
               myRepository.getFilters((MantisProject) selectedItem).toArray()));
       if (myRepository.getFilter() != null)
         myFilterCombobox.setSelectedItem(myRepository.getFilter());
       doApply();
     }
   } catch (Exception e) {
     resetComboBoxes();
   }
 }
 @NotNull
 private String selectedCompiler() {
   Object item = myCompilerCombo.getSelectedItem();
   return item != null && item instanceof String
       ? (String) item
       : GoBuildTargetSettings.ANY_COMPILER;
 }
  private JPanel createToolPanel() {
    configurationOverrideCombo.setModel(configurationOverrideModel);
    final int preferredHeight = configurationOverrideCombo.getPreferredSize().height;
    configurationOverrideCombo.setPreferredSize(new Dimension(250, preferredHeight));
    configurationOverrideCombo.setMaximumSize(new Dimension(350, preferredHeight));

    treeModel = new ResultTreeModel();

    resultsTree = new Tree(treeModel);
    resultsTree.setRootVisible(false);

    final TreeSelectionListener treeSelectionListener = new ToolWindowSelectionListener();
    resultsTree.addTreeSelectionListener(treeSelectionListener);
    final MouseListener treeMouseListener = new ToolWindowMouseListener();
    resultsTree.addMouseListener(treeMouseListener);
    resultsTree.setCellRenderer(new ResultTreeRenderer());

    progressLabel = new JLabel(" ");
    progressBar = new JProgressBar(JProgressBar.HORIZONTAL);
    progressBar.setMinimum(0);
    final Dimension progressBarSize = new Dimension(100, progressBar.getPreferredSize().height);
    progressBar.setMinimumSize(progressBarSize);
    progressBar.setPreferredSize(progressBarSize);
    progressBar.setMaximumSize(progressBarSize);

    progressPanel = new JToolBar(JToolBar.HORIZONTAL);
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.add(new JLabel(CheckStyleBundle.message("plugin.toolwindow.override")));
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.add(configurationOverrideCombo);
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.addSeparator();
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.add(progressLabel);
    progressPanel.add(Box.createHorizontalGlue());
    progressPanel.setFloatable(false);
    progressPanel.setBackground(UIManager.getColor("Panel.background"));
    progressPanel.setBorder(null);

    final JPanel toolPanel = new JPanel(new BorderLayout());
    toolPanel.add(new JBScrollPane(resultsTree), BorderLayout.CENTER);
    toolPanel.add(progressPanel, BorderLayout.NORTH);

    ToolTipManager.sharedInstance().registerComponent(resultsTree);

    return toolPanel;
  }
  @Nullable
  public String getFileTypeMask() {
    if (myEnableFileNameFilterCb.isSelected()) {
      return (String) myFileFilter.getSelectedItem();
    }

    return null;
  }
 @NotNull
 private static String selected(@NotNull ComboBox comboBox, @NotNull String defaultValue) {
   Object item = comboBox.getSelectedItem();
   if (item != null && item instanceof String) {
     return defaultValue.equals(item) ? GoBuildTargetSettings.DEFAULT : (String) item;
   }
   return GoBuildTargetSettings.DEFAULT;
 }
Ejemplo n.º 17
0
 @Nullable
 public String getName() {
   final Object item = myNameComboBox.getEditor().getItem();
   if ((item instanceof String) && ((String) item).length() > 0) {
     return ((String) item).trim();
   }
   return null;
 }
 public XDebuggerExpressionComboBox(
     @NotNull Project project,
     @NotNull XDebuggerEditorsProvider debuggerEditorsProvider,
     @Nullable @NonNls String historyId,
     @Nullable XSourcePosition sourcePosition,
     boolean showEditor) {
   super(project, debuggerEditorsProvider, EvaluationMode.EXPRESSION, historyId, sourcePosition);
   myComboBox = new ComboBox<>(100);
   myComboBox.setEditable(true);
   myExpression = XExpressionImpl.EMPTY_EXPRESSION;
   Dimension minimumSize = new Dimension(myComboBox.getMinimumSize());
   minimumSize.width = 100;
   myComboBox.setMinimumSize(minimumSize);
   initEditor();
   fillComboBox();
   myComponent = decorate(myComboBox, false, showEditor);
 }
 @TestOnly
 public String[] getVisibleFiles() {
   final ComboBoxModel model = myFileChooser.getModel();
   String[] result = new String[model.getSize()];
   for (int i = 0; i < model.getSize(); i++) {
     FileDescriptor o = (FileDescriptor) model.getElementAt(i);
     result[i] = o.getPresentableName(o.myFile.getVirtualFile());
   }
   return result;
 }
 @Override
 public void apply() {
   if (!myRepository.getUrl().equals(myURLText.getText())
       || !myRepository.getUsername().equals(myUserNameText.getText())
       || !myRepository.getPassword().equals(myPasswordText.getText())) {
     resetComboBoxes();
   } else {
     final Object selectedProjectObject = myProjectCombobox.getModel().getSelectedItem();
     final Object selectedFilterObject = myFilterCombobox.getModel().getSelectedItem();
     if (selectedProjectObject != null
         && selectedFilterObject != null
         && selectedProjectObject instanceof MantisProject
         && selectedFilterObject instanceof MantisFilter) {
       myRepository.setProject((MantisProject) selectedProjectObject);
       myRepository.setFilter((MantisFilter) selectedFilterObject);
     }
   }
   super.apply();
 }
    GitCheckinOptions(@NotNull final Project project, @NotNull CheckinProjectPanel panel) {
      super(project, panel);
      myVcs = GitVcs.getInstance(project);
      final Insets insets = new Insets(2, 2, 2, 2);
      // add authors drop down
      GridBagConstraints c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.anchor = GridBagConstraints.WEST;
      c.insets = insets;
      final JLabel authorLabel = new JLabel(GitBundle.message("commit.author"));
      myPanel.add(authorLabel, c);

      c = new GridBagConstraints();
      c.anchor = GridBagConstraints.CENTER;
      c.insets = insets;
      c.gridx = 1;
      c.gridy = 0;
      c.weightx = 1;
      c.fill = GridBagConstraints.HORIZONTAL;
      final List<String> usersList = getUsersList(project);
      final Set<String> authors =
          usersList == null ? new HashSet<String>() : new HashSet<String>(usersList);
      ContainerUtil.addAll(authors, mySettings.getCommitAuthors());
      List<String> list = new ArrayList<String>(authors);
      Collections.sort(list);
      list =
          ObjectsConvertor.convert(
              list,
              new Convertor<String, String>() {
                @Override
                public String convert(String o) {
                  return StringUtil.shortenTextWithEllipsis(o, 30, 0);
                }
              });
      myAuthor = new ComboBox(ArrayUtil.toObjectArray(list));
      myAuthor.insertItemAt("", 0);
      myAuthor.setSelectedItem("");
      myAuthor.setEditable(true);
      authorLabel.setLabelFor(myAuthor);
      myAuthor.setToolTipText(GitBundle.getString("commit.author.tooltip"));
      myPanel.add(myAuthor, c);
    }
 @Override
 public void onChangeListSelected(LocalChangeList list) {
   Object data = list.getData();
   if (data instanceof VcsFullCommitDetails) {
     VcsFullCommitDetails commit = (VcsFullCommitDetails) data;
     String author =
         String.format("%s <%s>", commit.getAuthor().getName(), commit.getAuthor().getEmail());
     myAuthor.getEditor().setItem(author);
     myAuthorDate = new Date(commit.getTime());
   }
 }
Ejemplo n.º 23
0
  @Override
  public void apply() {
    if (myJavaModuleFacet.getModule() instanceof Solution) {
      SolutionDescriptor descriptor =
          (SolutionDescriptor) myJavaModuleFacet.getModule().getModuleDescriptor();
      descriptor.setCompileInMPS(myCheckBox.isSelected());
      descriptor.setKind((SolutionKind) myComboBox.getSelectedItem());
    }

    myPathsTableModel.apply();
    myLibraryTableModel.apply();
  }
  public void setEnabled(boolean enable) {
    if (enable == myComboBox.isEnabled()) return;

    UIUtil.setEnabled(myComponent, enable, true);
    // myComboBox.setEditable(enable);

    if (enable) {
      // initEditor();
    } else {
      myExpression = getExpression();
    }
  }
Ejemplo n.º 25
0
  @Override
  public boolean isModified() {
    boolean solutionCheck = false;
    if (myJavaModuleFacet.getModule() instanceof Solution) {
      SolutionDescriptor descriptor =
          (SolutionDescriptor) myJavaModuleFacet.getModule().getModuleDescriptor();
      solutionCheck =
          descriptor.getCompileInMPS() != myCheckBox.isSelected()
              || descriptor.getKind() != myComboBox.getSelectedItem();
    }

    return myPathsTableModel.isModified() || myLibraryTableModel.isModified() || solutionCheck;
  }
  private void updateMaskWarning() {
    if (myEnableFileNameFilterCb.isSelected()) {
      String mask = (String) myFileFilter.getEditor().getItem();
      if (mask == null || !isMaskValid(mask)) {
        showWarningAndDisableOK();
        return;
      }
    }

    if (myMaskWarningLabel.isVisible()) {
      clearWarningAndEnableOK();
    }
  }
Ejemplo n.º 27
0
  private void setUpNameComboBox(Collection<String> possibleNames) {
    final EditorComboBoxEditor comboEditor =
        new StringComboboxEditor(myProject, HaxeFileType.HAXE_FILE_TYPE, myNameComboBox);

    myNameComboBox.setEditor(comboEditor);
    myNameComboBox.setRenderer(new EditorComboBoxRenderer(comboEditor));
    myNameComboBox.setEditable(true);
    myNameComboBox.setMaximumRowCount(8);

    myContentPane.registerKeyboardAction(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            myNameComboBox.requestFocus();
          }
        },
        KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.ALT_MASK),
        JComponent.WHEN_IN_FOCUSED_WINDOW);

    for (String possibleName : possibleNames) {
      myNameComboBox.addItem(possibleName);
    }
  }
 @Override
 public void saveState() {
   String author = (String) myAuthor.getEditor().getItem();
   myNextCommitAuthor = author.length() == 0 ? null : author;
   if (author.length() == 0) {
     myNextCommitAuthor = null;
   } else {
     myNextCommitAuthor = author;
     mySettings.saveCommitAuthor(author);
   }
   myNextCommitAmend = myAmend.isSelected();
   myNextCommitAuthorDate = myAuthorDate;
 }
 private void updateRenderer(final Project project) {
   myFileChooser.setRenderer(
       new ListCellRendererWrapper<FileDescriptor>() {
         @Override
         public void customize(
             JList list, FileDescriptor value, int index, boolean selected, boolean hasFocus) {
           final PsiFile file = value.myFile;
           setIcon(getIconForFile(file));
           final VirtualFile vFile = file.getVirtualFile();
           setForeground(FileStatusManager.getInstance(project).getStatus(vFile).getColor());
           //noinspection ConstantConditions
           setText(value.getPresentableName(vFile));
         }
       });
 }
 private void initFileTypeFilter() {
   FindDialog.initFileFilter(myFileFilter, myEnableFileNameFilterCb);
   myEnableFileNameFilterCb.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           updateMaskWarning();
         }
       });
   myFileFilter
       .getEditor()
       .getEditorComponent()
       .addKeyListener(
           new KeyAdapter() {
             @Override
             public void keyReleased(KeyEvent e) {
               updateMaskWarning();
             }
           });
 }