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


Java DocumentAdapter类代码示例

本文整理汇总了Java中com.intellij.ui.DocumentAdapter的典型用法代码示例。如果您正苦于以下问题:Java DocumentAdapter类的具体用法?Java DocumentAdapter怎么用?Java DocumentAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createTextFieldLengthDocumentListener

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
/**
 * Listener updates label indicating remaining symbols number like in twitter.
 */
private static DocumentListener createTextFieldLengthDocumentListener(@NotNull TwitterDialogWrapper builder, @NotNull final StudyTwitterUtils.TwitterDialogPanel panel) {
  return new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      int length = e.getDocument().getLength();
      if (length > 140 || length == 0) {
        builder.setOKActionEnabled(false);
        panel.getRemainSymbolsLabel().setText("<html><font color='red'>" + String.valueOf(140 - length) + "</font></html>");
      } else {
        builder.setOKActionEnabled(true);
        panel.getRemainSymbolsLabel().setText(String.valueOf(140 - length));
      }

    }
  };
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:20,代码来源:StudyTwitterUtils.java

示例2: getEditor

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
@Override
public TableCellEditor getEditor(final RegExSampleSet item) {
    JTextField textField = new JTextField();

    textField.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            String sample = item.sample;
            item.sample = textField.getText();
            checkRegEx(myPattern, item);
            item.sample = sample;
            myTextTable.repaint();
        }
    });

    return new DefaultCellEditor(textField) {
        @Override
        public boolean isCellEditable(EventObject anEvent) {
            return true;
        }
    };
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:23,代码来源:RegExTestDialog.java

示例3: OptionsPanel

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
public OptionsPanel(final Set<String> headers) {
  super(new BorderLayout(5, 5));

  add(new JLabel(ManifestBundle.message("inspection.header.ui.label")), BorderLayout.NORTH);

  final JTextArea area = new JTextArea("");
  add(area, BorderLayout.CENTER);
  if (!headers.isEmpty()) {
    area.setText(StringUtil.join(new TreeSet<String>(headers), "\n"));
  }

  area.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      headers.clear();
      for (String line : StringUtil.split(area.getText(), "\n")) {
        String header = line.trim();
        if (!header.isEmpty()) {
          headers.add(header);
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MisspelledHeaderInspection.java

示例4: createAdditionalJavadocTagsPanel

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
public FieldPanel createAdditionalJavadocTagsPanel(){
  FieldPanel additionalTagsPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.label.text"), InspectionsBundle.message("inspection.javadoc.dialog.title"), null, null);
  additionalTagsPanel.setPreferredSize(new Dimension(150, additionalTagsPanel.getPreferredSize().height));
  additionalTagsPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      final Document document = e.getDocument();
      try {
        final String text = document.getText(0, document.getLength());
        if (text != null) {
          myAdditionalJavadocTags = text.trim();
        }
      }
      catch (BadLocationException e1) {
         LOG.error(e1);
      }
    }
  });
  additionalTagsPanel.setText(myAdditionalJavadocTags);
  return additionalTagsPanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaDocLocalInspection.java

示例5: ExtractArtifactDialog

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
public ExtractArtifactDialog(ArtifactEditorContext context, LayoutTreeComponent treeComponent, String initialName) {
  super(treeComponent.getLayoutTree(), true);
  myContext = context;
  setTitle(ProjectBundle.message("dialog.title.extract.artifact"));
  for (ArtifactType type : ArtifactType.getAllTypes()) {
    myTypeBox.addItem(type);
  }
  myTypeBox.setSelectedItem(PlainArtifactType.getInstance());
  myTypeBox.setRenderer(new ArtifactTypeCellRenderer(myTypeBox.getRenderer()));
  myNameField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      setOKActionEnabled(!StringUtil.isEmptyOrSpaces(getArtifactName()));
    }
  });
  myNameField.setText(initialName);
  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ExtractArtifactDialog.java

示例6: CompilerUIConfigurable

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
public CompilerUIConfigurable(@NotNull final Project project) {
  myProject = project;

  myPatternLegendLabel.setText(XmlStringUtil.wrapInHtml(
                                 "Use <b>;</b> to separate patterns and <b>!</b> to negate a pattern. " +
                                 "Accepted wildcards: <b>?</b> &mdash; exactly one symbol; <b>*</b> &mdash; zero or more symbols; " +
                                 "<b>/</b> &mdash; path separator; <b>/**/</b> &mdash; any number of directories; " +
                                 "<i>&lt;dir_name&gt;</i>:<i>&lt;pattern&gt;</i> &mdash; restrict to source roots with the specified name"
  ));
  myPatternLegendLabel.setForeground(new JBColor(Gray._50, Gray._130));
  tweakControls(project);
  myVMOptionsField.getDocument().addDocumentListener(new DocumentAdapter() {
    protected void textChanged(DocumentEvent e) {
      mySharedVMOptionsField.setEnabled(e.getDocument().getLength() == 0);
      myHeapSizeField.setEnabled(ContainerUtil.find(ParametersListUtil.parse(myVMOptionsField.getText()), new Condition<String>() {
        @Override
        public boolean value(String s) {
          return StringUtil.startsWithIgnoreCase(s, "-Xmx");
        }
      }) == null);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CompilerUIConfigurable.java

示例7: setupIntegerFieldTrackingValue

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
/**
 * Sets integer number format to JFormattedTextField instance,
 * sets value of JFormattedTextField instance to object's field value,
 * synchronizes object's field value with the value of JFormattedTextField instance.
 *
 * @param textField  JFormattedTextField instance
 * @param owner      an object whose field is synchronized with {@code textField}
 * @param property   object's field name for synchronization
 */
public static void setupIntegerFieldTrackingValue(final JFormattedTextField textField,
                                                  final InspectionProfileEntry owner,
                                                  final String property) {
    NumberFormat formatter = NumberFormat.getIntegerInstance();
    formatter.setParseIntegerOnly(true);
    textField.setFormatterFactory(new DefaultFormatterFactory(new NumberFormatter(formatter)));
    textField.setValue(getPropertyValue(owner, property));
    final Document document = textField.getDocument();
    document.addDocumentListener(new DocumentAdapter() {
        @Override
        public void textChanged(DocumentEvent e) {
            try {
                textField.commitEdit();
                setPropertyValue(owner, property,
                        ((Number) textField.getValue()).intValue());
            } catch (ParseException e1) {
                // No luck this time
            }
        }
    });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:SingleIntegerFieldOptionsPanel.java

示例8: NamedConfigurable

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
protected NamedConfigurable(boolean isNameEditable, @Nullable final Runnable updateTree) {
  myNameEditable = isNameEditable;
  myNamePanel.setVisible(myNameEditable);
  if (myNameEditable) {
    myNameField.getDocument().addDocumentListener(new DocumentAdapter() {
      protected void textChanged(DocumentEvent e) {
        setDisplayName(myNameField.getText());
        if (updateTree != null){
          updateTree.run();
        }
      }
    });
  }
  if (Registry.is("ide.new.project.settings")) {
    myNamePanel.setBorder(new EmptyBorder(10, 10, 6, 10));
  } else {
    myNamePanel.setBorder(new EmptyBorder(0,0,0,0));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:NamedConfigurable.java

示例9: createFileNamePanel

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
protected JComponent createFileNamePanel() {
  final JPanel panel = new JPanel(new BorderLayout());
  panel.add(new JLabel(UIBundle.message("file.chooser.save.dialog.file.name")), BorderLayout.WEST);
  myFileName.setText("");
  myFileName.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateOkButton();
    }
  });

  panel.add(myFileName, BorderLayout.CENTER);
  if (myExtensions.getModel().getSize() > 0) {
    myExtensions.setSelectedIndex(0);
    panel.add(myExtensions, BorderLayout.EAST);
  }
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FileSaverDialogImpl.java

示例10: NameEditor

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
public NameEditor() {
  getField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      if (item != null && itemEditor.isEditable(item)) {
        String newName = getField().getText();
        if (newName.equals(itemEditor.getName(item))) {
          return;
        }

        if (!mutated) {
          mutated = true;
          item = getMutable(item);
        }
        ((KeymapImpl)item).setName(newName);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ComboBoxModelEditor.java

示例11: createUIComponents

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
private void createUIComponents() {
  myRepositoryURL = new EditorComboBox("");
  final DvcsRememberedInputs rememberedInputs = getRememberedInputs();
  List<String> urls = new ArrayList<String>(rememberedInputs.getVisitedUrls());
  if (myDefaultRepoUrl != null) {
    urls.add(0, myDefaultRepoUrl);
  }
  myRepositoryURL.setHistory(ArrayUtil.toObjectArray(urls, String.class));
  myRepositoryURL.addDocumentListener(new com.intellij.openapi.editor.event.DocumentAdapter() {
    @Override
    public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
      // enable test button only if something is entered in repository URL
      final String url = getCurrentUrlText();
      myTestButton.setEnabled(url.length() != 0);
      if (myDefaultDirectoryName.equals(myDirectoryName.getText()) || myDirectoryName.getText().length() == 0) {
        // modify field if it was unmodified or blank
        myDefaultDirectoryName = defaultDirectoryName(url, myVcsDirectoryName);
        myDirectoryName.setText(myDefaultDirectoryName);
      }
      updateButtons();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CloneDvcsDialog.java

示例12: TextFieldBinding

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
private TextFieldBinding(final JTextField common, final List<JTextField> textFields) {
  LOG.assertTrue(!textFields.isEmpty());
  myCommon = common;
  myTextFields = textFields;
  String initialValue = myTextFields.get(0).getText();
  myInitialValues = new ArrayList<String>();
  for (JTextField field : myTextFields) {
    String value = field.getText();
    myInitialValues.add(value);
    if (initialValue != null && !initialValue.equals(value)) {
      initialValue = null;
    }
  }
  common.setText(initialValue != null ? initialValue : "");

  myListener = new DocumentAdapter() {
    @Override
    protected void textChanged(final DocumentEvent e) {
      TextFieldBinding.this.textChanged();
    }
  };
  myCommon.getDocument().addDocumentListener(myListener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:MultipleFacetEditorHelperImpl.java

示例13: init

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
@Override
protected void init() {
  super.init();
  // Set default name and select it
  myMethodNameTextField.setText(myDefaultName);
  myMethodNameTextField.setSelectionStart(0);
  myMethodNameTextField.setSelectionStart(myDefaultName.length());
  myMethodNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateOutputVariables();
      updateSignature();
      updateOkStatus();
    }
  });


  myVariableData = createVariableData(myArguments);
  myVariablesMap = createVariableMap(myVariableData);
  myParametersPanel.setVariableData(myVariableData);
  myParametersPanel.init();

  updateOutputVariables();
  updateSignature();
  updateOkStatus();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AbstractExtractMethodDialog.java

示例14: MyDialog

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
protected MyDialog(@NotNull AndroidFacet facet, @Nullable InputValidator validator) {
  super(facet.getModule().getProject());
  myValidator = validator;
  setTitle(AndroidBundle.message("new.typed.resource.dialog.title", myResourcePresentableName));
  final List<String> tagNames = getSortedAllowedTagNames(facet);
  myRootElementField = new TextFieldWithAutoCompletion<String>(
    facet.getModule().getProject(), new TextFieldWithAutoCompletion.StringsCompletionProvider(tagNames, null), true, null);
  myRootElementField.setText(myDefaultRootTag);
  myRootElementFieldWrapper.add(myRootElementField, BorderLayout.CENTER);
  myRootElementLabel.setLabelFor(myRootElementField);
  init();

  myFileNameField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void textChanged(DocumentEvent event) {
      final String text = myFileNameField.getText().trim();
      if (myValidator instanceof InputValidatorEx) {
        setErrorText(((InputValidatorEx) myValidator).getErrorText(text));
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CreateMultiRootResourceFileAction.java

示例15: setupSourceLocationControls

import com.intellij.ui.DocumentAdapter; //导入依赖的package包/类
private void setupSourceLocationControls(@Nullable VirtualFile importSource) {
  if (importSource == null) {
    FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor();
    descriptor.setTitle("Select Source Location");
    descriptor.setDescription("Select existing ADT or Gradle project to import as a new subproject");
    mySourceLocation.addBrowseFolderListener(new TextBrowseFolderListener(descriptor));
    mySourceLocation.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
      @Override
      protected void textChanged(DocumentEvent e) {
        invalidate();
      }
    });
  }
  else {
    mySourceLocation.setVisible(false);
    myLocationLabel.setVisible(false);
    mySourceLocation.setText(importSource.getPath());
  }
  applyBackgroundOperationResult(checkPath(mySourceLocation.getText()));
  myErrorWarning.setIcon(null);
  myErrorWarning.setText(null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ImportSourceLocationStep.java


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