當前位置: 首頁>>代碼示例>>Java>>正文


Java ComboBox.setEditor方法代碼示例

本文整理匯總了Java中com.intellij.openapi.ui.ComboBox.setEditor方法的典型用法代碼示例。如果您正苦於以下問題:Java ComboBox.setEditor方法的具體用法?Java ComboBox.setEditor怎麽用?Java ComboBox.setEditor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.ui.ComboBox的用法示例。


在下文中一共展示了ComboBox.setEditor方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: DebuggerExpressionComboBox

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public DebuggerExpressionComboBox(@NotNull Project project, @NotNull Disposable parentDisposable, @Nullable PsiElement context, @Nullable String recentsId, @NotNull CodeFragmentFactory factory) {
  super(project, factory, parentDisposable, context, recentsId);

  setLayout(new BorderLayout(0, 0));

  myComboBox = new ComboBox(new MyComboboxModel(getRecents()), 100);
  myComboBox.setSwingPopup(false);

  // Have to turn this off because when used in DebuggerTreeInplaceEditor, the combobox popup is hidden on every change of selection
  // See comment to SynthComboBoxUI.FocusHandler.focusLost()
  myComboBox.setLightWeightPopupEnabled(false);

  myEditor = new MyEditorComboBoxEditor(getProject(), getCurrentFactory().getFileType());
  //noinspection GtkPreferredJComboBoxRenderer
  myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor));

  myComboBox.setEditable(true);
  myComboBox.setEditor(myEditor);
  add(addChooseFactoryLabel(myComboBox, false));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:DebuggerExpressionComboBox.java

示例2: createTargetOptionsCombo

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private static ComboBox createTargetOptionsCombo() {
  final ComboBox combo = new ComboBox(new TargetLevelComboboxModel());
  //combo.setRenderer(new DefaultListCellRenderer() {
  //  @Override
  //  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
  //    try {
  //      return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
  //    }
  //    finally {
  //      //if ("".equals(value)) {
  //      //  setText(COMPILER_DEFAULT);
  //      //}
  //    }
  //  }
  //});
  combo.setEditable(true);
  combo.setEditor(new BasicComboBoxEditor() {
    @Override
    protected JTextField createEditorComponent() {
      return new HintTextField(COMPILER_DEFAULT, 12);
    }
  });
  return combo;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:TargetOptionsComponent.java

示例3: setupComboBox

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private void setupComboBox(final ComboBox combobox, FileType fileType) {
  final EditorComboBoxEditor comboEditor = new StringComboboxEditor(myProject, fileType, combobox) {
    @Override
    public void setItem(Object anObject) {
      myNonHumanChange = true;
      super.setItem(anObject);
    }
  };

  combobox.setEditor(comboEditor);
  combobox.setRenderer(new EditorComboBoxRenderer(comboEditor));

  combobox.setEditable(true);
  combobox.setMaximumRowCount(8);

  comboEditor.selectAll();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:NameSuggestionsField.java

示例4: DebuggerExpressionComboBox

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public DebuggerExpressionComboBox(Project project, PsiElement context, @NonNls String recentsId, final CodeFragmentFactory factory) {
  super(project, context, recentsId, factory);
  setLayout(new BorderLayout(0, 0));

  myComboBox = new ComboBox(new MyComboboxModel(getRecents()), 100);
  myComboBox.setSwingPopup(false);

  // Have to turn this off because when used in DebuggerTreeInplaceEditor, the combobox popup is hidden on every change of selection
  // See comment to SynthComboBoxUI.FocusHandler.focusLost()
  myComboBox.setLightWeightPopupEnabled(false);

  myEditor = new MyEditorComboBoxEditor(getProject(), getCurrentFactory().getFileType());
  //noinspection GtkPreferredJComboBoxRenderer
  myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor));

  myComboBox.setEditable(true);
  myComboBox.setEditor(myEditor);
  add(addChooseFactoryLabel(myComboBox, false));
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:20,代碼來源:DebuggerExpressionComboBox.java

示例5: createTargetOptionsCombo

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private static ComboBox createTargetOptionsCombo() {
  final ComboBox combo = new ComboBox(new TargetLevelComboboxModel());
  //combo.setRenderer(new DefaultListCellRenderer() {
  //  @Override
  //  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
  //    try {
  //      return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
  //    }
  //    finally {
  //      //if ("".equals(value)) {
  //      //  setText(COMPILER_DEFAULT);
  //      //}
  //    }
  //  }
  //});
  combo.setEditable(true);
  combo.setEditor(new BasicComboBoxEditor() {
    @Override
    protected JTextField createEditorComponent() {
      return new HintTextField(COMPILER_DEFAULT, 10);
    }
  });
  return combo;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:25,代碼來源:TargetOptionsComponent.java

示例6: createKeymapListPanel

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private JPanel createKeymapListPanel() {
  JPanel panel = new JPanel();
  panel.setLayout(new GridBagLayout());

  myKeymapList = new ComboBox(myKeymapListModel);
  myKeymapList.setEditor(new MyEditor());
  myKeymapList.setRenderer(new MyKeymapRenderer(myKeymapList.getRenderer()));
  JLabel keymapLabel = new JLabel(KeyMapBundle.message("keymaps.border.factory.title"));
  keymapLabel.setLabelFor(myKeymapList);
  panel.add(keymapLabel, new GridBagConstraints(0,0, 1, 1, 0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0));
  panel.add(myKeymapList, new GridBagConstraints(1,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,4,0,0),0,0));

  panel.add(createKeymapButtonsPanel(), new GridBagConstraints(2,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0),0,0));
  myKeymapList.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (myKeymapListModel.getSelectedItem() != mySelectedKeymap) processCurrentKeymapChanged(getCurrentQuickListIds());
    }
  });
  panel.add(createKeymapNamePanel(), new GridBagConstraints(3,0,1,1,1,0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,10,0,0),0,0));
  return panel;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:22,代碼來源:KeymapPanel.java

示例7: createKeymapListPanel

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private JPanel createKeymapListPanel() {
  JPanel panel = new JPanel();
  panel.setLayout(new GridBagLayout());

  myKeymapList = new ComboBox(myKeymapListModel);
  myKeymapList.setEditor(new MyEditor());
  myKeymapList.setRenderer(new MyKeymapRenderer(myKeymapList.getRenderer()));
  JLabel keymapLabel = new JLabel(KeyMapBundle.message("keymaps.border.factory.title"));
  keymapLabel.setLabelFor(myKeymapList);
  panel.add(keymapLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  panel.add(myKeymapList, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 4, 0, 0), 0, 0));

  panel.add(createKeymapButtonsPanel(),
            new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  myKeymapList.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (myKeymapListModel.getSelectedItem() != mySelectedKeymap) processCurrentKeymapChanged(getCurrentQuickListIds());
    }
  });
  panel.add(createKeymapNamePanel(),
            new GridBagConstraints(3, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
  return panel;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:25,代碼來源:KeymapPanel.java

示例8: ComboBoxModelEditor

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public ComboBoxModelEditor(@NotNull ListItemEditor<T> itemEditor) {
  super(itemEditor);

  comboBox = new ComboBox((ComboBoxModel)model);
  comboBox.setEditor(new NameEditor());
  comboBox.setRenderer(new MyListCellRenderer());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:ComboBoxModelEditor.java

示例9: createTargetOptionsCombo

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public static ComboBox createTargetOptionsCombo()
{
	final ComboBox combo = new ComboBox(new TargetLevelComboboxModel());
	//combo.setRenderer(new DefaultListCellRenderer() {
	//  @Override
	//  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
	//    try {
	//      return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
	//    }
	//    finally {
	//      //if ("".equals(value)) {
	//      //  setText(COMPILER_DEFAULT);
	//      //}
	//    }
	//  }
	//});
	combo.setEditable(true);
	combo.setEditor(new BasicComboBoxEditor()
	{
		@Override
		protected JTextField createEditorComponent()
		{
			return new HintTextField(COMPILER_DEFAULT, 10);
		}
	});
	return combo;
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:28,代碼來源:TargetOptionsComponent.java

示例10: JrePathEditor

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
/**
 * This constructor can be used in UI forms. <strong>Don't forget to call {@link #setDefaultJreSelector(DefaultJreSelector)}!</strong>
 */
public JrePathEditor() {
  myLabel = new JBLabel(ExecutionBundle.message("run.configuration.jre.label"));

  myComboBoxModel = new SortedComboBoxModel<JreComboBoxItem>(new Comparator<JreComboBoxItem>() {
    @Override
    public int compare(JreComboBoxItem o1, JreComboBoxItem o2) {
      int result = Comparing.compare(o1.getOrder(), o2.getOrder());
      if (result != 0) {
        return result;
      }
      return o1.getPresentableText().compareToIgnoreCase(o2.getPresentableText());
    }
  });
  myDefaultJreItem = new DefaultJreItem();
  myComboBoxModel.add(myDefaultJreItem);
  final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();
  for (Sdk sdk : allJDKs) {
    myComboBoxModel.add(new SdkAsJreItem(sdk));
  }

  final Set<String> jrePaths = new HashSet<String>();
  for (JreProvider provider : JreProvider.EP_NAME.getExtensions()) {
    String path = provider.getJrePath();
    if (!StringUtil.isEmpty(path)) {
      jrePaths.add(path);
      myComboBoxModel.add(new CustomJreItem(path));
    }
  }

  for (Sdk jdk : allJDKs) {
    String homePath = jdk.getHomePath();

    if (!SystemInfo.isMac) {
      final File jre = new File(jdk.getHomePath(), "jre");
      if (jre.isDirectory()) {
        homePath = jre.getPath();
      }
    }
    if (jrePaths.add(homePath)) {
      myComboBoxModel.add(new CustomJreItem(homePath));
    }
  }
  ComboBox comboBox = new ComboBox(myComboBoxModel);
  comboBox.setEditable(true);
  comboBox.setRenderer(new ColoredListCellRendererWrapper<JreComboBoxItem>() {
    @Override
    protected void doCustomize(JList list, JreComboBoxItem value, int index, boolean selected, boolean hasFocus) {
      value.render(this, selected);
    }
  });
  myComboboxEditor = new JreComboboxEditor(myComboBoxModel);
  myComboboxEditor.getEditorComponent().setTextToTriggerEmptyTextStatus(DEFAULT_JRE_TEXT);
  comboBox.setEditor(myComboboxEditor);
  myPathField = new ComboboxWithBrowseButton(comboBox);
  myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
                                      ExecutionBundle.message("run.configuration.select.jre.dir.label"),
                                      null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                      JreComboboxEditor.TEXT_COMPONENT_ACCESSOR);

  setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
  add(myLabel, "shrinkx");
  add(myPathField, "growx, pushx");

  InsertPathAction.addTo(myComboboxEditor.getEditorComponent());

  setAnchor(myLabel);

  updateUI();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:73,代碼來源:JrePathEditor.java

示例11: setUpDialog

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private void setUpDialog() {
  JComponent commandLineComponent;
  if (myHistory == null) {
    commandLineEditor = new EditorTextField("", myProject, PlainTextFileType.INSTANCE);
    commandLineComponent = commandLineEditor;

    commandLineLabel.setLabelFor(commandLineEditor);
  }
  else {
    commandLineComboBox = new ComboBox(ArrayUtilRt.toStringArray(myHistory));
    commandLineComponent = commandLineComboBox;

    commandLineLabel.setLabelFor(commandLineComboBox);

    commandLineComboBox.setLightWeightPopupEnabled(false);

    EditorComboBoxEditor editor = new StringComboboxEditor(myProject, PlainTextFileType.INSTANCE, commandLineComboBox);
    //noinspection GtkPreferredJComboBoxRenderer
    commandLineComboBox.setRenderer(new EditorComboBoxRenderer(editor));

    commandLineComboBox.setEditable(true);
    commandLineComboBox.setEditor(editor);
    commandLineComboBox.setFocusable(true);

    commandLineEditor = editor.getEditorComponent();
  }

  commandLinePanel.add(commandLineComponent);

  ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
  FileChooserDescriptor projectPathChooserDescriptor = null;
  if (manager instanceof ExternalSystemUiAware) {
    projectPathChooserDescriptor = ((ExternalSystemUiAware)manager).getExternalProjectConfigDescriptor();
  }
  if (projectPathChooserDescriptor == null) {
    projectPathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
  }

  String title = ExternalSystemBundle.message("settings.label.select.project", GradleConstants.SYSTEM_ID.getReadableName());
  myProjectPathField = new ExternalProjectPathField(myProject, GradleConstants.SYSTEM_ID, projectPathChooserDescriptor, title) {
    @Override
    public Dimension getPreferredSize() {
      return commandLinePanel == null ? super.getPreferredSize() : commandLinePanel.getPreferredSize();
    }
  };

  projectPathFieldPanel.add(myProjectPathField);

  new GradleArgumentsCompletionProvider(myProject, myProjectPathField).apply(commandLineEditor);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:51,代碼來源:GradleRunTaskDialog.java


注:本文中的com.intellij.openapi.ui.ComboBox.setEditor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。