当前位置: 首页>>代码示例>>Java>>正文


Java TextFieldWithBrowseButton.setText方法代码示例

本文整理汇总了Java中com.intellij.openapi.ui.TextFieldWithBrowseButton.setText方法的典型用法代码示例。如果您正苦于以下问题:Java TextFieldWithBrowseButton.setText方法的具体用法?Java TextFieldWithBrowseButton.setText怎么用?Java TextFieldWithBrowseButton.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.ui.TextFieldWithBrowseButton的用法示例。


在下文中一共展示了TextFieldWithBrowseButton.setText方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makePathButton

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
private void makePathButton() {
        btnPath = new TextFieldWithBrowseButton();
        btnPath.setText(PackageTemplateHelper.getRootDirPath());
        btnPath.addBrowseFolderListener(Localizer.get("SelectPackageTemplate"), "", project, FileReaderUtil.getPackageTemplatesDescriptor());

//        panel.add(new SeparatorComponent(), new CC().growX().spanX().wrap());
        panel.add(btnPath, new CC().pushX().growX().spanX());
        addPathButtons();

        rbFromPath = new JBRadioButton(Localizer.get("label.FromPath"));
        rbFromPath.addItemListener(e -> {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                toggleSourcePath(
                        TemplateSourceType.PATH,
                        null,
                        btnPath
                );
            }
        });

        panel.add(rbFromPath, new CC().growX().spanX().wrap());
    }
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:23,代码来源:SelectPackageTemplateDialog.java

示例2: SdkVersionSelectionDialog

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
public SdkVersionSelectionDialog(JComponent parent, String title, String name, List<String> scalaVersions)
{
    super(parent, false);
    setTitle(title);
    //Create and populate the panel.
    centerPanel = new JPanel(new SpringLayout());

    versionLabel = new JLabel(name, JLabel.TRAILING);
    versionComboBox = new ComboBox(new DefaultComboBoxModel<>(scalaVersions.toArray()));
    versionLabel.setLabelFor(versionComboBox);

    centerPanel.add(versionLabel);
    centerPanel.add(versionComboBox);

    destination = new TextFieldWithBrowseButton();
    destination.addBrowseFolderListener("Select new Mule distribution destination", null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
    destinationLabel = new JLabel("Destination:", JLabel.TRAILING);
    destinationLabel.setLabelFor(destination);

    //By default, should be ~/mule-distro
    File distro = new File(SystemProperties.getUserHome(), "mule-distro");
    destination.setText(distro.getAbsolutePath());

    centerPanel.add(destinationLabel);
    centerPanel.add(destination);

    //Lay out the panel.
    SpringUtilities.makeCompactGrid(centerPanel,
            2, 2, //rows, cols
            6, 6,        //initX, initY
            6, 6);       //xPad, yPad

    init();
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:35,代码来源:SdkVersionSelectionDialog.java

示例3: register

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
protected void register(@NotNull String paramName, @NotNull final TextFieldWithBrowseButton field) {
  String value = (String)myTemplateState.get(paramName);
  if (value != null) {
    field.setText(value);
  } else {
    myTemplateState.put(paramName, field.getText());
  }
  myParamFields.put(paramName, (JComponent)field);
  field.addFocusListener(this);
  field.getTextField().getDocument().addDocumentListener(this);
  field.getTextField().addFocusListener(this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:TemplateWizardStep.java

示例4: register

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
/**
 * 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.
 */
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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ScopedDataBinder.java

示例5: chooseUrl

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
private boolean chooseUrl(final TextFieldWithBrowseButton textField, final SvnVcs vcs) {
  String url = textField.getText();
  SVNURL selectedUrl = SelectLocationDialog.selectLocation(vcs.getProject(), url);
  if (selectedUrl != null) {
    textField.setText(selectedUrl.toString());
    return true;
  } else {
    return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SvnIntegrateRootOptionsPanel.java

示例6: LocationNameFieldsBinding

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
public LocationNameFieldsBinding(@Nullable Project project,
                                 final TextFieldWithBrowseButton locationField,
                                 final JTextField nameField,
                                 String baseDir,
                                 String title) {
  myBaseDir = baseDir;
  File suggestedProjectDirectory = FileUtil.findSequentNonexistentFile(new File(baseDir), "untitled", "");
  locationField.setText(suggestedProjectDirectory.toString());
  nameField.setDocument(new NameFieldDocument(nameField, locationField));
  mySuggestedProjectName = suggestedProjectDirectory.getName();
  nameField.setText(mySuggestedProjectName);
  nameField.selectAll();

  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  BrowseFolderActionListener<JTextField> listener =
    new BrowseFolderActionListener<JTextField>(title, "", locationField, project, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
      @Override
      protected void onFileChosen(@NotNull VirtualFile chosenFile) {
        myBaseDir = chosenFile.getPath();
        if (isProjectNameChanged(nameField.getText()) && !nameField.getText().equals(chosenFile.getName())) {
          myExternalModify = true;
          locationField.setText(new File(chosenFile.getPath(), nameField.getText()).toString());
          myExternalModify = false;
        }
        else {
          myExternalModify = true;
          locationField.setText(chosenFile.getPath());
          nameField.setText(chosenFile.getName());
          myExternalModify = false;
        }
      }
    };
  locationField.addActionListener(listener);
  locationField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      if (myExternalModify) {
        return;
      }
      myModifyingLocation = true;
      String path = locationField.getText().trim();
      if (path.endsWith(File.separator)) {
        path = path.substring(0, path.length() - File.separator.length());
      }
      int ind = path.lastIndexOf(File.separator);
      if (ind != -1) {
        String projectName = path.substring(ind + 1, path.length());
        if (!nameField.getText().trim().isEmpty()) {
          myBaseDir = path.substring(0, ind);
        }
        if (!projectName.equals(nameField.getText())) {
          if (!myModifyingProjectName) {
            nameField.setText(projectName);
          }
        }
      }
      myModifyingLocation = false;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:61,代码来源:LocationNameFieldsBinding.java

示例7: createCenterPanel

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
@Override
protected JComponent createCenterPanel() {
  JPanel panel = new JPanel(new VerticalFlowLayout());

  JLabel nameLabel = new JLabel();
  panel.add(nameLabel);

  myNameField = new JTextField();
  nameLabel.setLabelFor(myNameField);
  myNameField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      validateOKButton();
    }
  });
  panel.add(myNameField);
  nameLabel.setText(getNameLabel());

  myTargetDirLabel = new JLabel();
  panel.add(myTargetDirLabel);

  myTargetDirectoryField = new TextFieldWithBrowseButton();
  myTargetDirectoryField.setText(myCurrentDirectory.getVirtualFile().getPresentableUrl());
  myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"),
                                                 RefactoringBundle.message("select.target.directory.description"),
                                                 null, FileChooserDescriptorFactory.createSingleFolderDescriptor());

  myTargetDirLabel.setText(RefactoringBundle.message("extract.to.directory"));
  panel.add(myTargetDirectoryField);

  myTargetDirectoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void textChanged(DocumentEvent event) {
      validateOKButton();
    }
  });

  validateOKButton();

  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:ExtractIncludeDialog.java

示例8: testRegisterTextFieldWithBrowseButton

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
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
    @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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:ScopedDataBinderTest.java

示例9: deduceServiceDirectory

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
private static void deduceServiceDirectory(@NotNull TextFieldWithBrowseButton serviceDirectoryPathField) {
  File gradleUserHomeDir = new BuildLayoutParameters().getGradleUserHomeDir();
  serviceDirectoryPathField.setText(FileUtil.toSystemIndependentName(gradleUserHomeDir.getPath()));
  serviceDirectoryPathField.getTextField().setForeground(LocationSettingType.DEDUCED.getColor());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:IdeaGradleSystemSettingsControlBuilder.java

示例10: createCenterPanel

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
@Nullable
protected JComponent createCenterPanel() {
  JPanel panel = new JPanel(new GridBagLayout());

  GridBagConstraints gc = new GridBagConstraints();
  gc.insets = new Insets(2, 2, 2, 2);
  gc.gridwidth = 1;
  gc.gridheight = 1;
  gc.gridx = 0;
  gc.gridy = 0;
  gc.anchor = GridBagConstraints.WEST;
  gc.fill = GridBagConstraints.NONE;
  gc.weightx = 0;
  gc.weighty = 0;

  panel.add(new JLabel("Export:"), gc);
  gc.gridx += 1;
  gc.gridwidth = 2;
  gc.weightx = 1;
  gc.fill = GridBagConstraints.HORIZONTAL;
  JLabel urlLabel = new JLabel(myURL.toString());
  urlLabel.setFont(urlLabel.getFont().deriveFont(Font.BOLD));
  panel.add(urlLabel, gc);

  gc.gridy += 1;
  gc.gridwidth = 1;
  gc.gridx = 0;
  gc.weightx = 0;
  gc.fill = GridBagConstraints.NONE;
  panel.add(new JLabel("Destination:"), gc);
  gc.gridx += 1;
  gc.gridwidth = 2;
  gc.weightx = 1;
  gc.fill = GridBagConstraints.HORIZONTAL;

  myPathField = new TextFieldWithBrowseButton(this);
  myPathField.setText(myFile.getAbsolutePath());
  myPathField.setEditable(false);
  panel.add(myPathField, gc);

  gc.gridy += 1;
  gc.gridx = 0;
  gc.weightx = 0;
  gc.gridwidth = 3;
  gc.fill = GridBagConstraints.NONE;

  // other options.
  final JLabel depthLabel = new JLabel(SvnBundle.message("label.depth.text"));
  depthLabel.setToolTipText(SvnBundle.message("label.depth.description"));
  panel.add(depthLabel, gc);
  ++ gc.gridx;
  myDepth = new DepthCombo(false);
  panel.add(myDepth, gc);
  depthLabel.setLabelFor(myDepth);

  gc.gridx = 0;
  gc.gridy += 1;
  myForceCheckbox = new JCheckBox("Replace existing files");
  myForceCheckbox.setSelected(true);
  panel.add(myForceCheckbox, gc);
  gc.gridy += 1;
  myExternalsCheckbox = new JCheckBox("Include externals locations");
  myExternalsCheckbox.setSelected(true);
  panel.add(myExternalsCheckbox, gc);
  gc.gridy += 1;
  gc.gridwidth = 2;
  panel.add(new JLabel("Override 'native' EOLs with:"), gc);
  gc.gridx += 2;
  gc.gridwidth = 1;
  myEOLStyleBox = new JComboBox(new Object[] {"None", "LF", "CRLF", "CR"});
  panel.add(myEOLStyleBox, gc);
  gc.gridy += 1;
  gc.gridwidth = 3;
  gc.gridx = 0;
  gc.weightx = 1;
  gc.weighty = 1;
  gc.anchor = GridBagConstraints.SOUTH;
  gc.fill = GridBagConstraints.HORIZONTAL;
  panel.add(new JSeparator(), gc);
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:82,代码来源:ExportOptionsDialog.java

示例11: setText

import com.intellij.openapi.ui.TextFieldWithBrowseButton; //导入方法依赖的package包/类
private static void setText(TextFieldWithBrowseButton tf, final String title) {
  if (title != null) {
    tf.setText(title.trim());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:JavaFxArtifactPropertiesEditor.java


注:本文中的com.intellij.openapi.ui.TextFieldWithBrowseButton.setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。