本文整理汇总了Java中com.intellij.ui.TextFieldWithHistory类的典型用法代码示例。如果您正苦于以下问题:Java TextFieldWithHistory类的具体用法?Java TextFieldWithHistory怎么用?Java TextFieldWithHistory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextFieldWithHistory类属于com.intellij.ui包,在下文中一共展示了TextFieldWithHistory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void validate() {
Validator validator = new Validator();
TextFieldWithHistory exeComponent = stylintExeField.getChildComponent();
if (!ValidationUtils.validatePath(project, exeComponent.getText(), false)) {
validator.add(exeComponent.getTextEditor(), StylintBundle.message("stylint.settings.validate.exe"), StylintBundle.message("stylint.settings.validate.fix"));
}
TextFieldWithHistory configComponent = stylintConfigFile.getChildComponent();
if (!ValidationUtils.validatePath(project, configComponent.getText(), true)) {
validator.add(configComponent.getTextEditor(), StylintBundle.message("stylint.settings.validate.config"), StylintBundle.message("stylint.settings.validate.fix"));
}
if (validator.hasErrors()) {
versionLabel.setText("n.a.");
} else {
updateVersion();
}
packagesNotificationPanel.processErrors(validator);
}
示例2: createLogFileChooser
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void createLogFileChooser() {
myLogFile = new TextFieldWithHistory();
JPanel panel = GuiUtils.constructFieldWithBrowseButton(myLogFile, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
FileChooser.chooseFiles(descriptor, myProject, null, new Consumer<List<VirtualFile>>() {
@Override
public void consume(List<VirtualFile> files) {
myLogFile.setText(FileUtil.toSystemDependentName(files.get(files.size() - 1).getPath()));
}
});
}
});
myLogFileChooserPanel.setLayout(new BorderLayout());
myLogFileChooserPanel.add(panel, BorderLayout.CENTER);
}
示例3: createTextFieldWithHistoryWithBrowseButton
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
@NotNull
public static TextFieldWithHistoryWithBrowseButton createTextFieldWithHistoryWithBrowseButton(@Nullable Project project,
@NotNull String browseDialogTitle,
@NotNull FileChooserDescriptor fileChooserDescriptor,
@Nullable NotNullProducer<List<String>> historyProvider) {
TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton = new TextFieldWithHistoryWithBrowseButton();
TextFieldWithHistory textFieldWithHistory = textFieldWithHistoryWithBrowseButton.getChildComponent();
textFieldWithHistory.setHistorySize(-1);
textFieldWithHistory.setMinimumAndPreferredWidth(0);
if (historyProvider != null) {
addHistoryOnExpansion(textFieldWithHistory, historyProvider);
}
installFileCompletionAndBrowseDialog(
project,
textFieldWithHistoryWithBrowseButton,
browseDialogTitle,
fileChooserDescriptor
);
return textFieldWithHistoryWithBrowseButton;
}
示例4: createUIComponents
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void createUIComponents() {
mavenHomeField = new TextFieldWithHistory();
mavenHomeField.setHistorySize(-1);
final ArrayList<String> foundMavenHomes = new ArrayList<String>();
foundMavenHomes.add(MavenServerManager.BUNDLED_MAVEN_2);
foundMavenHomes.add(MavenServerManager.BUNDLED_MAVEN_3);
final File mavenHomeDirectory = MavenUtil.resolveMavenHomeDirectory(null);
if (mavenHomeDirectory != null) {
foundMavenHomes.add(FileUtil.toSystemIndependentName(mavenHomeDirectory.getPath()));
}
mavenHomeField.setHistory(foundMavenHomes);
mavenHomeComponent = LabeledComponent.create(
new ComponentWithBrowseButton<TextFieldWithHistory>(mavenHomeField, null), "Maven &home directory");
final JBLabel versionLabel = new JBLabel();
versionLabel.setOpaque(true);
versionLabel.setVerticalAlignment(SwingConstants.TOP);
versionLabel.setVerticalTextPosition(SwingConstants.TOP);
mavenVersionLabelComponent = LabeledComponent.create(versionLabel, "");
}
示例5: UseExistingBazelWorkspaceOption
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
public UseExistingBazelWorkspaceOption(BlazeNewProjectBuilder builder) {
this.directoryField = new TextFieldWithHistory();
this.directoryField.setName("workspace-directory-field");
this.directoryField.setHistory(builder.getWorkspaceHistory(BuildSystem.Bazel));
this.directoryField.setHistorySize(BlazeNewProjectBuilder.HISTORY_SIZE);
this.directoryField.setText(builder.getLastImportedWorkspace(BuildSystem.Bazel));
JButton button = new JButton("...");
button.addActionListener(action -> this.chooseDirectory());
int buttonSize = this.directoryField.getPreferredSize().height;
button.setPreferredSize(new Dimension(buttonSize, buttonSize));
JComponent box =
UiUtil.createHorizontalBox(
HORIZONTAL_LAYOUT_GAP,
getIconComponent(),
new JLabel("Workspace:"),
this.directoryField,
button);
UiUtil.setPreferredWidth(box, PREFERRED_COMPONENT_WIDTH);
this.component = box;
}
示例6: createLogFileChooser
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void createLogFileChooser() {
myLogFile = new TextFieldWithHistory();
JPanel panel = GuiUtils.constructFieldWithBrowseButton(myLogFile, new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
FileChooser.chooseFiles(descriptor, myProject, null, new Consumer<List<VirtualFile>>() {
@Override
public void consume(List<VirtualFile> files) {
myLogFile.setText(FileUtil.toSystemDependentName(files.get(files.size() - 1).getPath()));
}
});
}
});
myLogFileChooserPanel.setLayout(new BorderLayout());
myLogFileChooserPanel.add(panel, BorderLayout.CENTER);
}
示例7: configESLintBinField
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void configESLintBinField() {
TextFieldWithHistory textFieldWithHistory = stylintExeField.getChildComponent();
textFieldWithHistory.setHistorySize(-1);
textFieldWithHistory.setMinimumAndPreferredWidth(0);
SwingHelper.addHistoryOnExpansion(textFieldWithHistory, () -> FileUtils.toAbsolutePath(StylintFinder.findAllStylintExe()));
SwingHelper.installFileCompletionAndBrowseDialog(project, stylintExeField, "Select Stylint Exe", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
示例8: configStylintConfigField
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void configStylintConfigField() {
TextFieldWithHistory textFieldWithHistory = stylintConfigFile.getChildComponent();
textFieldWithHistory.setHistorySize(-1);
textFieldWithHistory.setMinimumAndPreferredWidth(0);
SwingHelper.addHistoryOnExpansion(textFieldWithHistory, () -> StylintFinder.searchForLintConfigFiles(new File(project.getBaseDir().getPath())));
SwingHelper.installFileCompletionAndBrowseDialog(project, stylintConfigFile, "Select Stylint Config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
示例9: configConfigFileField
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void configConfigFileField() {
TextFieldWithHistory textFieldWithHistory = configWithDefaults(sassLintConfigFile);
SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
@NotNull
public List<String> produce() {
return SassLintFinder.searchForConfigFiles(getProjectPath());
}
});
SwingHelper.installFileCompletionAndBrowseDialog(project, sassLintConfigFile, "Select Sass Lint Config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
示例10: configNodeField
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void configNodeField() {
TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField);
SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
@NotNull
public List<String> produce() {
List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters();
return FileUtils.toAbsolutePath(newFiles);
}
});
SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
示例11: setHistory
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
public static void setHistory(@NotNull TextFieldWithHistory textFieldWithHistory,
@NotNull List<String> history,
boolean mergeWithPrevHistory) {
Set<String> newHistorySet = ContainerUtil.newHashSet(history);
List<String> prevHistory = textFieldWithHistory.getHistory();
List<String> mergedHistory = ContainerUtil.newArrayListWithCapacity(history.size());
if (mergeWithPrevHistory) {
for (String item : prevHistory) {
if (!newHistorySet.contains(item)) {
mergedHistory.add(item);
}
}
}
mergedHistory.addAll(history);
String oldText = StringUtil.notNullize(textFieldWithHistory.getText());
String oldSelectedItem = ObjectUtils.tryCast(textFieldWithHistory.getSelectedItem(), String.class);
if (!mergedHistory.contains(oldSelectedItem)) {
oldSelectedItem = null;
}
textFieldWithHistory.setHistory(mergedHistory);
setLongestAsPrototype(textFieldWithHistory, mergedHistory);
if (oldSelectedItem != null) {
textFieldWithHistory.setSelectedItem(oldSelectedItem);
}
if (!oldText.equals(oldSelectedItem)) {
textFieldWithHistory.setText(oldText);
}
}
示例12: configNodeField
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void configNodeField() {
TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField);
SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
@NotNull
public List<String> produce() {
List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters();
return FileUtils.toAbsolutePath(newFiles);
}
});
SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
示例13: configConfigFileField
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void configConfigFileField() {
TextFieldWithHistory textFieldWithHistory = configWithDefaults(eslintrcFile);
SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
@NotNull
public List<String> produce() {
return CoffeeLintFinder.searchForConfigFiles(getProjectPath());
}
});
SwingHelper.installFileCompletionAndBrowseDialog(project, eslintrcFile, "Select CoffeeLint config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
示例14: configJscsRcField
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void configJscsRcField() {
TextFieldWithHistory textFieldWithHistory = configWithDefaults(jscsrcFile);
SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
@NotNull
public List<String> produce() {
return JscsFinder.searchForJscsRCFiles(getProjectPath());
}
});
SwingHelper.installFileCompletionAndBrowseDialog(project, jscsrcFile, "Select JSCS config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
示例15: configESLintRulesField
import com.intellij.ui.TextFieldWithHistory; //导入依赖的package包/类
private void configESLintRulesField() {
TextFieldWithHistory textFieldWithHistory = rulesPathField.getChildComponent();
SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
@NotNull
public List<String> produce() {
return ESLintFinder.tryFindRulesAsString(getProjectPath());
}
});
SwingHelper.installFileCompletionAndBrowseDialog(project, rulesPathField, "Select Built in rules", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}