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


Java NameSuggestionsField.addDataChangedListener方法代码示例

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


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

示例1: createNewNameComponent

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
protected void createNewNameComponent() {
  String[] suggestedNames = getSuggestedNames();
  myOldName = UsageViewUtil.getShortName(myPsiElement);
  myNameSuggestionsField = new NameSuggestionsField(suggestedNames, myProject, FileTypes.PLAIN_TEXT, myEditor) {
    @Override
    protected boolean shouldSelectAll() {
      return myEditor == null || myEditor.getSettings().isPreselectRename();
    }
  };
  if (myPsiElement instanceof PsiFile && myEditor == null) {
    myNameSuggestionsField.selectNameWithoutExtension();
  }
  myNameChangedListener = new NameSuggestionsField.DataChanged() {
    @Override
    public void dataChanged() {
      processNewNameChanged();
    }
  };
  myNameSuggestionsField.addDataChangedListener(myNameChangedListener);

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:RenameDialog.java

示例2: createNewNameComponent

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
private void createNewNameComponent() {
  myNameSuggestionsField = new NameSuggestionsField(new String[] { myTag.getName() }, myProject, FileTypes.PLAIN_TEXT, myEditor);
  myNameChangedListener = new NameSuggestionsField.DataChanged() {
    @Override
    public void dataChanged() {
      validateButtons();
    }
  };
  myNameSuggestionsField.addDataChangedListener(myNameChangedListener);

  myNameSuggestionsField.getComponent().registerKeyboardAction(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      completeVariable(myNameSuggestionsField.getEditor());
    }
  }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:XmlTagRenameDialog.java

示例3: createNewNameComponent

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
private void createNewNameComponent() {
  String[] suggestedNames = getSuggestedNames();
  myOldName = suggestedNames.length > 0 ? suggestedNames[0] : null;
  myNameSuggestionsField = new NameSuggestionsField(suggestedNames, myProject, FileTypes.PLAIN_TEXT, myEditor) {
    @Override
    protected boolean shouldSelectAll() {
      return myEditor == null || myEditor.getSettings().isPreselectRename();
    }
  };
  if (myPsiElement instanceof PsiFile && myEditor == null) {
    myNameSuggestionsField.selectNameWithoutExtension();
  }
  myNameChangedListener = new NameSuggestionsField.DataChanged() {
    @Override
    public void dataChanged() {
      processNewNameChanged();
    }
  };
  myNameSuggestionsField.addDataChangedListener(myNameChangedListener);

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:RenameDialog.java

示例4: createNewNameComponent

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
protected void createNewNameComponent() {
  String[] suggestedNames = getSuggestedNames();
  myOldName = UsageViewUtil.getShortName(myPsiElement);
  myNameSuggestionsField = new NameSuggestionsField(suggestedNames, myProject, PlainTextFileType.INSTANCE, myEditor) {
    @Override
    protected boolean shouldSelectAll() {
      return myEditor == null || myEditor.getSettings().isPreselectRename();
    }
  };
  if (myPsiElement instanceof PsiFile && myEditor == null) {
    myNameSuggestionsField.selectNameWithoutExtension();
  }
  myNameChangedListener = new NameSuggestionsField.DataChanged() {
    @Override
    public void dataChanged() {
      processNewNameChanged();
    }
  };
  myNameSuggestionsField.addDataChangedListener(myNameChangedListener);

}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:RenameDialog.java

示例5: createNewNameComponent

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
private void createNewNameComponent()
{
	myNameSuggestionsField = new NameSuggestionsField(new String[]{myTag.getName()}, myProject, PlainTextFileType.INSTANCE, myEditor);
	myNameChangedListener = new NameSuggestionsField.DataChanged()
	{
		@Override
		public void dataChanged()
		{
			validateButtons();
		}
	};
	myNameSuggestionsField.addDataChangedListener(myNameChangedListener);

	myNameSuggestionsField.getComponent().registerKeyboardAction(new ActionListener()
	{
		@Override
		public void actionPerformed(ActionEvent e)
		{
			completeVariable(myNameSuggestionsField.getEditor());
		}
	}, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:23,代码来源:XmlTagRenameDialog.java

示例6: createNorthPanel

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
protected JComponent createNorthPanel() {
  JPanel panel = new JPanel(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.anchor = GridBagConstraints.WEST;
  gbc.fill = GridBagConstraints.BOTH;

  gbc.insets = new Insets(4, 0, 4, 8);
  gbc.gridwidth = 1;
  gbc.gridx = 0;
  gbc.gridy = 0;
  panel.add(new JLabel(RefactoringBundle.message("factory.method.name.label")), gbc);

  gbc.gridx++;
  gbc.weightx = 1.0;
  @NonNls final String[] nameSuggestions = new String[]{
    "create" + myContainingClass.getName(),
    "new" + myContainingClass.getName(),
    "getInstance",
    "newInstance"
    };
  myNameField = new NameSuggestionsField(nameSuggestions, getProject());
  myNameChangedListener = new NameSuggestionsField.DataChanged() {
    public void dataChanged() {
      validateButtons();
    }
  };
  myNameField.addDataChangedListener(myNameChangedListener);
  panel.add(myNameField.getComponent(), gbc);

  JPanel targetClassPanel = createTargetPanel();

  gbc.gridx = 0;
  gbc.gridy++;
  gbc.gridwidth = 2;
  panel.add(targetClassPanel, gbc);


  return panel;

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ReplaceConstructorWithFactoryDialog.java

示例7: createCenterPanel

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
protected JComponent createCenterPanel() {
  myFieldNamePanel.setLayout(new BorderLayout());

  myNameField = new NameSuggestionsField(myProject);
  myNameChangedListener = new NameSuggestionsField.DataChanged() {
    public void dataChanged() {
      updateOkStatus();
    }
  };
  myNameField.addDataChangedListener(myNameChangedListener);
  myNameField.setSuggestions(getSuggestions());

  myFieldNamePanel.add(myNameField, BorderLayout.CENTER);

  List<MavenDomProjectModel> projects = getProjects();

  ComboBoxUtil
    .setModel(myMavenProjectsComboBox, new DefaultComboBoxModel(), projects, new Function<MavenDomProjectModel, Pair<String, ?>>() {
      public Pair<String, ?> fun(MavenDomProjectModel model) {
        String projectName = model.getName().getStringValue();
        MavenProject mavenProject = MavenDomUtil.findProject(model);
        if (mavenProject != null) {
          projectName = mavenProject.getDisplayName();
        }
        if (StringUtil.isEmptyOrSpaces(projectName)) {
          projectName = "pom.xml";
        }
        return Pair.create(projectName, model);
      }
    });

  myMavenProjectsComboBox.setSelectedItem(myMavenDomProjectModel);

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

示例8: createNewNameComponent

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
private void createNewNameComponent() {
  myNameSuggestionsField = new NameSuggestionsField(new String[] { myTag.getName() }, myProject, FileTypes.PLAIN_TEXT, myEditor);
  myNameChangedListener = new NameSuggestionsField.DataChanged() {
    public void dataChanged() {
      validateButtons();
    }
  };
  myNameSuggestionsField.addDataChangedListener(myNameChangedListener);

  myNameSuggestionsField.getComponent().registerKeyboardAction(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      completeVariable(myNameSuggestionsField.getEditor());
    }
  }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:XmlTagRenameDialog.java

示例9: createNorthPanel

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
protected JComponent createNorthPanel() {

    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints gbConstraints = new GridBagConstraints();

    gbConstraints.insets = new Insets(4, 4, 4, 0);
    gbConstraints.anchor = GridBagConstraints.EAST;
    gbConstraints.fill = GridBagConstraints.BOTH;

    gbConstraints.gridwidth = 1;
    gbConstraints.weightx = 0;
    gbConstraints.weighty = 1;
    gbConstraints.gridx = 0;
    gbConstraints.gridy = 0;

    JLabel type = new JLabel(getTypeLabel());

    panel.add(type, gbConstraints);

    gbConstraints.gridx++;
    gbConstraints.insets = new Insets(4, 0, 4, 4);
    gbConstraints.weightx = 0;
    myTypeSelector = myTypeSelectorManager.getTypeSelector();
    panel.add(myTypeSelector.getComponent(), gbConstraints);

    gbConstraints.insets = new Insets(4, 4, 4, 0);
    gbConstraints.gridwidth = 1;
    gbConstraints.weightx = 0;
    gbConstraints.weighty = 1;
    gbConstraints.gridx = 0;
    gbConstraints.gridy = 1;
    JLabel namePrompt = new JLabel(RefactoringBundle.message("name.prompt"));
    panel.add(namePrompt, gbConstraints);

    gbConstraints.insets = new Insets(4, 0, 4, 4);
    gbConstraints.gridwidth = 1;
    gbConstraints.weightx = 1;
    gbConstraints.gridx = 1;
    gbConstraints.gridy = 1;
    myNameField = new NameSuggestionsField(myProject);
    panel.add(myNameField.getComponent(), gbConstraints);
    myNameField.addDataChangedListener(new NameSuggestionsField.DataChanged() {
      public void dataChanged() {
        updateButtons();
      }
    });
    namePrompt.setLabelFor(myNameField.getFocusableComponent());

    myNameSuggestionsManager = new NameSuggestionsManager(myTypeSelector, myNameField,
                                                          createGenerator(myWillBeDeclaredStatic, myLocalVariable, myInitializerExpression, myIsInvokedOnDeclaration, myEnteredName,
                                                                          myParentClass, myProject));
    myNameSuggestionsManager.setLabelsFor(type, namePrompt);

    return panel;
  }
 
开发者ID:consulo,项目名称:consulo-java,代码行数:56,代码来源:IntroduceFieldDialog.java

示例10: createNorthPanel

import com.intellij.refactoring.ui.NameSuggestionsField; //导入方法依赖的package包/类
protected JComponent createNorthPanel() {
  myNameField = new NameSuggestionsField(myProject);
  myNameChangedListener = new NameSuggestionsField.DataChanged() {
    public void dataChanged() {
      updateOkStatus();
    }
  };
  myNameField.addDataChangedListener(myNameChangedListener);

  JPanel panel = new JPanel(new GridBagLayout());
  GridBagConstraints gbConstraints = new GridBagConstraints();

  gbConstraints.insets = new Insets(4, 4, 4, 4);
  gbConstraints.anchor = GridBagConstraints.WEST;
  gbConstraints.fill = GridBagConstraints.BOTH;

  gbConstraints.gridwidth = 1;
  gbConstraints.weightx = 0;
  gbConstraints.weighty = 0;
  gbConstraints.gridx = 0;
  gbConstraints.gridy = 0;
  JLabel type = new JLabel(RefactoringBundle.message("variable.of.type"));
  panel.add(type, gbConstraints);

  gbConstraints.gridx++;
  myTypeSelector = myTypeSelectorManager.getTypeSelector();
  panel.add(myTypeSelector.getComponent(), gbConstraints);

  gbConstraints.gridwidth = 1;
  gbConstraints.weightx = 0;
  gbConstraints.weighty = 0;
  gbConstraints.gridx = 0;
  gbConstraints.gridy = 1;
  JLabel namePrompt = new JLabel(RefactoringBundle.message("name.prompt"));
  namePrompt.setLabelFor(myNameField.getComponent());
  panel.add(namePrompt, gbConstraints);

  gbConstraints.gridwidth = 1;
  gbConstraints.weightx = 1;
  gbConstraints.gridx = 1;
  gbConstraints.gridy = 1;
  panel.add(myNameField.getComponent(), gbConstraints);

  myNameSuggestionsManager = new NameSuggestionsManager(myTypeSelector, myNameField,
          new NameSuggestionsGenerator() {
            public SuggestedNameInfo getSuggestedNameInfo(PsiType type) {
              return IntroduceVariableBase.getSuggestedName(type, myExpression);
            }
          });
  myNameSuggestionsManager.setLabelsFor(type, namePrompt);

  return panel;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:54,代码来源:IntroduceVariableDialog.java


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