List of usage examples for com.intellij.openapi.ui TextFieldWithBrowseButton getText
@NotNull
@Override
public String getText()
From source file:com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard.ConfigureAndroidProjectStepFixture.java
License:Apache License
@NotNull public File getLocationInFileSystem() { final TextFieldWithBrowseButton locationField = robot().finder().findByType(target(), TextFieldWithBrowseButton.class); //noinspection ConstantConditions return execute(new GuiQuery<File>() { @Override/*www . ja va 2 s . co m*/ protected File executeInEDT() throws Throwable { String location = locationField.getText(); assertThat(location).isNotNull().isNotEmpty(); return new File(location); } }); }
From source file:com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard.FlutterProjectStepFixture.java
License:Open Source License
@NotNull public File getLocationInFileSystem() { final TextFieldWithBrowseButton locationField = getLocationField(); return execute(new GuiQuery<File>() { @Override/*from w w w . ja va 2s . com*/ protected File executeInEDT() throws Throwable { String location = locationField.getText(); assertThat(location).isNotEmpty(); return new File(location); } }); }
From source file:com.android.tools.idea.wizard.dynamic.ScopedDataBinder.java
License:Apache License
/** * Connects the given {@link TextFieldWithBrowseButton} to the given key and sets a listener to pick up * changes that need to trigger validation and UI updates. *///from w w w .j a va 2 s . co m public void register(@NotNull Key<String> key, @NotNull final TextFieldWithBrowseButton field) { myDocumentsToComponent.put(field.getTextField().getDocument(), field); String value = bindAndGet(key, field, null); if (value != null) { field.setText(value); } else { myState.put(key, field.getText()); } field.addFocusListener(this); field.getTextField().getDocument().addDocumentListener(this); field.getTextField().addFocusListener(this); }
From source file:com.android.tools.idea.wizard.dynamic.ScopedDataBinderTest.java
License:Apache License
public void testRegisterTextFieldWithBrowseButton() throws Exception { Key<String> textKey = myState.createKey("textField", String.class); Key<String> textKey2 = myState.createKey("boundSecond", String.class); final Key<String> triggerKey = myState.createKey("triggerKey", String.class); TextFieldWithBrowseButton textField = new TextFieldWithBrowseButton(); myScopedDataBinder.register(textKey, textField); myScopedDataBinder.register(textKey2, textField); // Test binding UI -> Store textField.setText("Hello World!"); assertEquals("Hello World!", myState.get(textKey)); assertEquals("Hello World!", myState.get(textKey2)); // Test binding Store -> UI myState.put(textKey, "Awesome"); assertEquals("Awesome", textField.getText()); assertEquals("Awesome", myState.get(textKey2)); myState.put(textKey2, "Goodbye"); assertEquals("Goodbye", textField.getText()); assertEquals("Goodbye", myState.get(textKey)); final AtomicBoolean respectsUserEdits = new AtomicBoolean(true); // Test value derivation myScopedDataBinder.registerValueDeriver(textKey, new ValueDeriver<String>() { @Nullable//from w ww . java 2 s . c o m @Override public Set<Key<?>> getTriggerKeys() { return makeSetOf(triggerKey); } @Override public boolean respectUserEdits() { return respectsUserEdits.get(); } @NotNull @Override public String deriveValue(ScopedStateStore state, Key changedKey, @Nullable String currentValue) { String trigger = state.get(triggerKey); if (trigger == null) { return "UNEXPECTED NULL!"; } else { return trigger.toUpperCase(); } } }); myState.put(triggerKey, "Some value to trigger update"); // The deriver does not fire because user edits are respected assertEquals("Goodbye", textField.getText()); respectsUserEdits.set(false); myState.put(triggerKey, "the quick brown fox"); // The deriver fires because user edits are not respected assertEquals("THE QUICK BROWN FOX", textField.getText()); }
From source file:com.android.tools.idea.wizard.ScopedDataBinder.java
License:Apache License
/** * Connects the given {@link TextFieldWithBrowseButton} to the given key and sets a listener to pick up * changes that need to trigger validation and UI updates. *///from ww w .j a v a 2 s .c om protected void register(@NotNull Key<String> key, @NotNull final TextFieldWithBrowseButton field) { myDocumentsToComponent.put(field.getTextField().getDocument(), field); String value = bindAndGet(key, field, null); if (value != null) { field.setText(value); } else { myState.put(key, field.getText()); } field.addFocusListener(this); field.getTextField().getDocument().addDocumentListener(this); field.getTextField().addFocusListener(this); }
From source file:com.android.tools.idea.wizard.template.TemplateWizardStep.java
License:Apache License
protected void register(@NotNull String paramName, @NotNull final TextFieldWithBrowseButton field) { String value = (String) myTemplateState.get(paramName); if (value != null) { field.setText(value);//from w w w . j a v a2 s .co m } else { myTemplateState.put(paramName, field.getText()); } myParamFields.put(paramName, (JComponent) field); field.addFocusListener(this); field.getTextField().getDocument().addDocumentListener(this); field.getTextField().addFocusListener(this); }
From source file:com.android.tools.idea.wizard.TemplateWizardStep.java
License:Apache License
protected void register(@NotNull String paramName, @NotNull final TextFieldWithBrowseButton field) { String value = (String) myTemplateState.get(paramName); if (value != null) { field.setText(value);//ww w. j a va 2 s .c om } else { myTemplateState.put(paramName, field.getText()); } myParamFields.put(paramName, (JComponent) field); field.addFocusListener(this); field.getTextField().getDocument().addDocumentListener(this); }
From source file:com.intellij.application.options.CodeStyleHtmlPanel.java
License:Apache License
private static void customizeField(final String title, final TextFieldWithBrowseButton uiField) { uiField.getTextField().setEditable(false); uiField.setButtonIcon(PlatformIcons.OPEN_EDIT_DIALOG_ICON); uiField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final TagListDialog tagListDialog = new TagListDialog(title); tagListDialog.setData(createCollectionOn(uiField.getText())); tagListDialog.show();/*from ww w . j av a 2 s .c o m*/ if (tagListDialog.isOK()) { uiField.setText(createStringOn(tagListDialog.getData())); } } private String createStringOn(final ArrayList<String> data) { return StringUtil.join(ArrayUtil.toStringArray(data), ","); } private ArrayList<String> createCollectionOn(final String data) { if (data == null) { return new ArrayList<String>(); } return new ArrayList<String>(Arrays.asList(data.split(","))); } }); }
From source file:com.intellij.compiler.options.ComparingUtils.java
License:Apache License
public static boolean isModified(TextFieldWithBrowseButton field, String value) { return !field.getText().equals(value); }
From source file:com.intellij.packaging.impl.ManifestFileUtil.java
License:Apache License
public static void setupMainClassField(final Project project, final TextFieldWithBrowseButton field) { field.addActionListener(new ActionListener() { @Override//from w w w.ja va 2 s. c om public void actionPerformed(ActionEvent e) { final PsiClass selected = selectMainClass(project, field.getText()); if (selected != null) { field.setText(selected.getQualifiedName()); } } }); }