本文整理汇总了Java中com.intellij.ui.ComboboxWithBrowseButton类的典型用法代码示例。如果您正苦于以下问题:Java ComboboxWithBrowseButton类的具体用法?Java ComboboxWithBrowseButton怎么用?Java ComboboxWithBrowseButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComboboxWithBrowseButton类属于com.intellij.ui包,在下文中一共展示了ComboboxWithBrowseButton类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResDirFromUI
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
static PsiDirectory getResDirFromUI(Project project, ComboboxWithBrowseButton directoryCombo) {
PsiManager psiManager = PsiManager.getInstance(project);
Object selectedItem = directoryCombo.getComboBox().getEditor().getItem();
File selectedFile = null;
if (selectedItem instanceof File) {
selectedFile = (File) selectedItem;
} else if (selectedItem instanceof String) {
String selectedDir = (String) selectedItem;
if (!selectedDir.equals(PLACEHOLDER_TEXT)) {
selectedFile = new File(selectedDir);
}
}
if (selectedFile == null) {
return null;
}
final File finalSelectedFile = selectedFile;
return ApplicationManager.getApplication()
.runWriteAction(
new Computable<PsiDirectory>() {
@Override
public PsiDirectory compute() {
return DirectoryUtil.mkdirs(psiManager, finalSelectedFile.getPath());
}
});
}
示例2: getLanguageSettingsComponent
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
@Nullable
@Override
public LabeledComponent<JComponent> getLanguageSettingsComponent(@NotNull Course selectedCourse) {
myModel = ProjectStructureConfigurable.getInstance(ProjectManager.getInstance().getDefaultProject()).getProjectJdksModel();
myJdkComboBox = new JdkComboBox(myModel, sdkTypeId -> sdkTypeId instanceof JavaSdkType && !((JavaSdkType)sdkTypeId).isDependent(), sdk -> true, sdkTypeId -> sdkTypeId instanceof JavaSdkType && !((JavaSdkType)sdkTypeId).isDependent(), true);
ComboboxWithBrowseButton comboboxWithBrowseButton = new ComboboxWithBrowseButton(myJdkComboBox);
FixedSizeButton setupButton = comboboxWithBrowseButton.getButton();
myJdkComboBox.setSetupButton(setupButton, null, myModel, (JdkComboBox.JdkComboBoxItem) myJdkComboBox.getModel().getSelectedItem(), null, false);
return LabeledComponent.create(comboboxWithBrowseButton, "Jdk", BorderLayout.WEST);
}
示例3: AppEngineSdkEditor
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
public AppEngineSdkEditor(final @Nullable Project project) {
myPathEditor = new ComboboxWithBrowseButton(new ComboBox(100));
myPathEditor.addBrowseFolderListener(project, new ComponentWithBrowseButton.BrowseFolderActionListener<JComboBox>("Google App Engine SDK",
"Specify Google App Engine Java SDK home",
myPathEditor, project,
FileChooserDescriptorFactory.createSingleFolderDescriptor(),
TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT));
final JComboBox comboBox = myPathEditor.getComboBox();
comboBox.setEditable(true);
comboBox.removeAllItems();
for (AppEngineSdk sdk : AppEngineSdkManager.getInstance().getValidSdks()) {
comboBox.addItem(FileUtil.toSystemDependentName(sdk.getSdkHomePath()));
}
}
示例4: RunWithAntBinding
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
RunWithAntBinding(JRadioButton useDefaultAnt, JRadioButton useCustomAnt, ComboboxWithBrowseButton ants, final GlobalAntConfiguration antConfiguration) {
myAntConfiguration = antConfiguration;
myComponents.add(useDefaultAnt);
myUseCustomAnt = useCustomAnt;
myComponents.add(myUseCustomAnt);
myAnts = ants;
myUseDefaultAnt = useDefaultAnt;
ButtonGroup group = new ButtonGroup();
group.add(useDefaultAnt);
group.add(myUseCustomAnt);
myUseCustomAnt.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
updateEnableCombobox();
if (myUseCustomAnt.isSelected() && !myLoadingValues)
myAnts.getComboBox().requestFocusInWindow();
}
});
myAntsController = new ChooseAndEditComboBoxController<AntReference, AntReference>(myAnts, new ConvertingIterator.IdConvertor<AntReference>(), AntReference.COMPARATOR) {
public Iterator<AntReference> getAllListItems() {
return antConfiguration.getConfiguredAnts().keySet().iterator();
}
public AntReference openConfigureDialog(AntReference reference, JComponent parent) {
AntSetPanel antSetPanel = new AntSetPanel();
AntInstallation installation = myAntConfiguration.getConfiguredAnts().get(reference);
if (installation == null) installation = myAntConfiguration.getConfiguredAnts().get(AntReference.BUNDLED_ANT);
antSetPanel.reset();
antSetPanel.setSelection(installation);
AntInstallation antInstallation = antSetPanel.showDialog(parent);
return antInstallation != null ? antInstallation.getReference() : null;
}
};
myAntsController.setRenderer(new AntUIUtil.AntReferenceRenderer(myAntConfiguration));
}
示例5: ChooseAndEditComboBoxController
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
public ChooseAndEditComboBoxController(ComboboxWithBrowseButton combobox,
Convertor<Item, Ref> toRef,
Comparator<Ref> comparator) {
myCombobox = combobox;
myToString = toRef;
myCombobox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
resetList(openConfigureDialog(myItems.get(getSelectedString()), getCombobox()));
}
});
getCombobox().setModel(new SortedComboBoxModel<Ref>(comparator));
}
示例6: BrowserSelector
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
public BrowserSelector(boolean allowDefaultBrowser) {
myAllowDefaultBrowser = allowDefaultBrowser;
myBrowserComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox());
myBrowserComboWithBrowse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
util.editConfigurable(myBrowserComboWithBrowse, new BrowserSettings());
final BrowsersConfiguration.BrowserFamily selectedItem = getSelectedBrowser();
initBrowsersComboModel();
if (selectedItem != null) {
setSelectedBrowser(selectedItem);
}
}
});
final JComboBox comboBox = myBrowserComboWithBrowse.getComboBox();
comboBox.setRenderer(new ListCellRendererWrapper<BrowsersConfiguration.BrowserFamily>() {
@Override
public void customize(JList list,
BrowsersConfiguration.BrowserFamily value,
int index,
boolean selected,
boolean hasFocus) {
final Icon baseIcon = value != null ? value.getIcon() : PlatformIcons.WEB_ICON;
final Icon icon = myBrowserComboWithBrowse.isEnabled() ? baseIcon : IconLoader.getDisabledIcon(baseIcon);
setIcon(icon);
setText(value != null ? value.getName() : "Default");
}
});
initBrowsersComboModel();
}
示例7: AppEngineSdkEditor
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
public AppEngineSdkEditor(final @Nullable Project project) {
myPathEditor = new ComboboxWithBrowseButton();
final ComboboxWithBrowseButton pathEditor = myPathEditor;
myPathEditor.addBrowseFolderListener(project, new ComponentWithBrowseButton.BrowseFolderActionListener<JComboBox>("Google App Engine SDK",
"Specify Google App Engine Java SDK home",
pathEditor, project,
FileChooserDescriptorFactory.createSingleFolderDescriptor(),
TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT));
final JComboBox comboBox = myPathEditor.getComboBox();
comboBox.setEditable(true);
comboBox.removeAllItems();
for (AppEngineSdk sdk : AppEngineSdkManager.getInstance().getValidSdks()) {
comboBox.addItem(FileUtil.toSystemDependentName(sdk.getSdkHomePath()));
}
}
示例8: getTomcatField
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
public ComboboxWithBrowseButton getTomcatField() {
return tomcatField;
}
示例9: createEditor
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
@NotNull
@Override
protected JComponent createEditor() {
ComboboxWithBrowseButton tomcatField = runnerSetting.getTomcatField();
TextFieldWithBrowseButton docBaseField = runnerSetting.getDocBaseField();
JTextField contextPathField = runnerSetting.getContextPathField();
JFormattedTextField portField = runnerSetting.getPortField();
JXButton configrationButton = runnerSetting.getConfigrationButton();
configrationButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ShowSettingsUtil.getInstance().showSettingsDialog(project, TomcatSettingConfigurable.class);
}
});
docBaseField.addBrowseFolderListener("webapp", "Choose Web Folder", project, FileChooserDescriptorFactory.createSingleFolderDescriptor().withRoots(project.getBaseDir()));
docBaseField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent documentEvent) {
if (!documentEvent.getType().equals(DocumentEvent.EventType.REMOVE)) {
String text = docBaseField.getText();
if (text != null && !text.trim().equals("")) {
VirtualFile fileByIoFile = LocalFileSystem.getInstance().findFileByIoFile(new File(text));
Module module = ModuleUtilCore.findModuleForFile(fileByIoFile, project);
String contextPath = module == null ? "/" : "/" + module.getName();
contextPathField.setText(contextPath);
}
}
}
});
portField.setValue(8080);
DefaultFormatterFactory tf = new DefaultFormatterFactory();
NumberFormat format = NumberFormat.getInstance();
format.setGroupingUsed(false);
NumberFormatter formatter = new NumberFormatter(format);
formatter.setValueClass(Integer.class);
formatter.setMinimum(0);
formatter.setMaximum(65535);
tf.setDefaultFormatter(formatter);
portField.setFormatterFactory(tf);
return runnerSetting.getMainPanel();
}
示例10: BrowserSelector
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
public BrowserSelector(@NotNull final Condition<WebBrowser> browserCondition) {
myModel = createBrowsersComboModel(browserCondition);
myBrowserComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox(myModel));
myBrowserComboWithBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
WebBrowserManager browserManager = WebBrowserManager.getInstance();
long modificationCount = browserManager.getModificationCount();
ShowSettingsUtil.getInstance().editConfigurable(myBrowserComboWithBrowse, new BrowserSettings());
WebBrowser selectedItem = getSelected();
if (modificationCount != browserManager.getModificationCount()) {
myModel = createBrowsersComboModel(browserCondition);
//noinspection unchecked
myBrowserComboWithBrowse.getComboBox().setModel(myModel);
}
if (selectedItem != null) {
setSelected(selectedItem);
}
}
});
//noinspection unchecked
myBrowserComboWithBrowse.getComboBox().setRenderer(new ListCellRendererWrapper<WebBrowser>() {
@Override
public void customize(JList list,
WebBrowser value,
int index,
boolean selected,
boolean hasFocus) {
Icon baseIcon;
if (value == null) {
WebBrowser firstBrowser = WebBrowserManager.getInstance().getFirstActiveBrowser();
baseIcon = firstBrowser == null ? PlatformIcons.WEB_ICON : firstBrowser.getIcon();
}
else {
baseIcon = value.getIcon();
}
setIcon(myBrowserComboWithBrowse.isEnabled() ? baseIcon : IconLoader.getDisabledIcon(baseIcon));
setText(value != null ? value.getName() : "Default");
}
});
}
示例11: RunWithAntBinding
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
public RunWithAntBinding(JRadioButton useDefaultAnt, JRadioButton useCastomAnt, ComboboxWithBrowseButton ants)
{
this(useDefaultAnt, useCastomAnt, ants, GlobalAntConfiguration.getInstance());
}
示例12: BrowserSelector
import com.intellij.ui.ComboboxWithBrowseButton; //导入依赖的package包/类
public BrowserSelector(@NotNull final Condition<WebBrowser> browserCondition)
{
myModel = createBrowsersComboModel(browserCondition);
myBrowserComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox(myModel));
myBrowserComboWithBrowse.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
WebBrowserManager browserManager = WebBrowserManager.getInstance();
long modificationCount = browserManager.getModificationCount();
ShowSettingsUtil.getInstance().editConfigurable(myBrowserComboWithBrowse, new BrowserSettings());
WebBrowser selectedItem = getSelected();
if(modificationCount != browserManager.getModificationCount())
{
myModel = createBrowsersComboModel(browserCondition);
//noinspection unchecked
myBrowserComboWithBrowse.getComboBox().setModel(myModel);
}
if(selectedItem != null)
{
setSelected(selectedItem);
}
}
});
//noinspection unchecked
myBrowserComboWithBrowse.getComboBox().setRenderer(new ListCellRendererWrapper<WebBrowser>()
{
@Override
public void customize(JList list, WebBrowser value, int index, boolean selected, boolean hasFocus)
{
Icon baseIcon;
if(value == null)
{
WebBrowser defaultBrowser = WebBrowserManager.getInstance().getDefaultBrowser();
baseIcon = defaultBrowser == null ? AllIcons.Nodes.PpWeb : defaultBrowser.getIcon();
}
else
{
baseIcon = value.getIcon();
}
setIcon(myBrowserComboWithBrowse.isEnabled() ? baseIcon : IconLoader.getDisabledIcon(baseIcon));
setText(value != null ? value.getName() : "Default");
}
});
}