本文整理汇总了Java中com.intellij.refactoring.ui.NameSuggestionsField类的典型用法代码示例。如果您正苦于以下问题:Java NameSuggestionsField类的具体用法?Java NameSuggestionsField怎么用?Java NameSuggestionsField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NameSuggestionsField类属于com.intellij.refactoring.ui包,在下文中一共展示了NameSuggestionsField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createRenameDialog
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
@Override
public RenameDialog createRenameDialog( Project project, PsiElement element, PsiElement nameSuggestionContext, Editor editor )
{
return new PsiFileRenameDialog( project, element, nameSuggestionContext, editor ) {
protected void createNewNameComponent() {
super.createNewNameComponent();
getNameSuggestionsField().selectNameWithoutExtension();
}
@Override
protected NameSuggestionsField getNameSuggestionsField()
{
return super.getNameSuggestionsField();
}
};
}
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:17,代码来源:RenameTypeManifoldFileProcessor.java
示例2: updateTargetClass
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
private void updateTargetClass() {
final PsiClass targetClass = getSelectedTargetClass();
PsiManager psiManager = myClass.getManager();
PsiType superType = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory().createType(targetClass);
SuggestedNameInfo suggestedNameInfo =
JavaCodeStyleManager.getInstance(psiManager.getProject()).suggestVariableName(VariableKind.FIELD, null, null, superType);
myFieldNameField.setSuggestions(suggestedNameInfo.names);
myInnerClassNameField.getComponent().setEnabled(InheritanceToDelegationUtil.isInnerClassNeeded(myClass, targetClass));
@NonNls final String suggestion = "My" + targetClass.getName();
myInnerClassNameField.setSuggestions(new String[]{suggestion});
myDataChangedListener = new NameSuggestionsField.DataChanged() {
public void dataChanged() {
validateButtons();
}
};
myInnerClassNameField.addDataChangedListener(myDataChangedListener);
myFieldNameField.addDataChangedListener(myDataChangedListener);
myMemberSelectionPanel.getTable().setMemberInfos(myBasesToMemberInfos.get(targetClass));
myMemberSelectionPanel.getTable().fireExternalDataChange();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:InheritanceToDelegationDialog.java
示例3: 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
示例4: 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
示例5: initializeName
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
private void initializeName() {
myNameLabel.setLabelFor(myNameField);
myPanel.registerKeyboardAction(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
myNameField.requestFocus();
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
myNameField.addDataChangedListener(new NameSuggestionsField.DataChanged() {
@Override
public void dataChanged() {
updateOkStatus();
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GrIntroduceConstantDialog.java
示例6: createUIComponents
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
private void createUIComponents() {
final GrExpression expression = myContext.getExpression();
final GrVariable var = myContext.getVar();
final StringPartInfo stringPart = myContext.getStringPart();
List<String> list = new ArrayList<String>();
if (var != null) {
list.add(var.getName());
}
ContainerUtil.addAll(list, suggestNames());
myNameField = new NameSuggestionsField(ArrayUtil.toStringArray(list), myContext.getProject(), GroovyFileType.GROOVY_FILE_TYPE);
if (expression != null) {
myTypeComboBox = GrTypeComboBox.createTypeComboBoxFromExpression(expression);
}
else if (stringPart != null) {
myTypeComboBox = GrTypeComboBox.createTypeComboBoxFromExpression(stringPart.getLiteral());
}
else {
myTypeComboBox = GrTypeComboBox.createTypeComboBoxWithDefType(var.getDeclaredType(), var);
}
GrTypeComboBox.registerUpDownHint(myNameField, myTypeComboBox);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GrIntroduceFieldDialog.java
示例7: 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
示例8: initializeName
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
private void initializeName() {
myNameLabel.setLabelFor(myNameField);
myPanel.registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
myNameField.requestFocus();
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
myNameField.addDataChangedListener(new NameSuggestionsField.DataChanged() {
@Override
public void dataChanged() {
updateOkStatus();
}
});
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:GrIntroduceConstantDialog.java
示例9: 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
示例10: 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
示例11: createNewNameComponent
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
private void createNewNameComponent() {
String flowName = this.myTag.getAttribute("name").getValue();
this.myNameSuggestionsField = new NameSuggestionsField(new String[]{ flowName }, this.myProject, FileTypes.PLAIN_TEXT, this.myEditor);
this.myNameChangedListener = new NameSuggestionsField.DataChanged() {
public void dataChanged() {
FlowRenameDialog.this.validateButtons();
}
};
this.myNameSuggestionsField.addDataChangedListener(this.myNameChangedListener);
this.myNameSuggestionsField.getComponent().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FlowRenameDialog.this.completeVariable(FlowRenameDialog.this.myNameSuggestionsField.getEditor());
}
}, KeyStroke.getKeyStroke(32, 2), 2);
}
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:16,代码来源:FlowRenameDialog.java
示例12: 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
示例13: createNorthPanel
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
protected JComponent createNorthPanel() {
myNameField = new NameSuggestionsField(myProject);
FormBuilder formBuilder = FormBuilder.createFormBuilder()
.addLabeledComponent(RefactoringBundle.message("anonymousToInner.class.name.label.text"), myNameField);
if(!myShowCanBeStatic) {
myCbMakeStatic = new NonFocusableCheckBox(RefactoringBundle.message("anonymousToInner.make.class.static.checkbox.text"));
myCbMakeStatic.setSelected(true);
formBuilder.addComponent(myCbMakeStatic);
}
return formBuilder.getPanel();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AnonymousToInnerDialog.java
示例14: 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
示例15: createNameField
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
private NameSuggestionsField createNameField(GrVariable var) {
List<String> names = new ArrayList<String>();
if (var != null) {
names.add(var.getName());
}
ContainerUtil.addAll(names, suggestNames());
return new NameSuggestionsField(ArrayUtil.toStringArray(names), myProject, GroovyFileType.GROOVY_FILE_TYPE);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GrIntroduceParameterDialog.java
示例16: 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
示例17: createNorthPanel
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
protected JComponent createNorthPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.WEST;
gbc.gridy = 0;
gbc.gridx = 0;
gbc.insets = new Insets(4, 0, 0, 8);
myClassCombo = new JComboBox(mySuperClasses);
myClassCombo.setRenderer(new ClassCellRenderer(myClassCombo.getRenderer()));
gbc.gridwidth = 2;
final JLabel classComboLabel = new JLabel();
panel.add(classComboLabel, gbc);
gbc.gridy++;
panel.add(myClassCombo, gbc);
classComboLabel.setText(RefactoringBundle.message("replace.inheritance.from"));
myClassComboItemListener = new MyClassComboItemListener();
myClassCombo.addItemListener(myClassComboItemListener);
gbc.gridy++;
gbc.gridwidth = 1;
gbc.insets = new Insets(4, 0, 4, 0);
final JLabel fieldNameLabel = new JLabel();
panel.add(fieldNameLabel, gbc);
myFieldNameField = new NameSuggestionsField(myProject);
gbc.gridx++;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.insets = new Insets(4, 0, 4, 8);
gbc.weightx = 1.0;
panel.add(myFieldNameField.getComponent(), gbc);
fieldNameLabel.setText(RefactoringBundle.message("field.name"));
// if(InheritanceToDelegationUtil.isInnerClassNeeded(myClass, mySuperClass)) {
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 1;
gbc.insets = new Insets(4, 0, 4, 0);
gbc.weightx = 0.0;
final JLabel innerClassNameLabel = new JLabel();
panel.add(innerClassNameLabel, gbc);
/*String[] suggestions = new String[mySuperClasses.length];
for (int i = 0; i < suggestions.length; i++) {
suggestions[i] = "My" + mySuperClasses[i].getName();
}*/
myInnerClassNameField = new NameSuggestionsField(myProject);
gbc.gridx++;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.insets = new Insets(4, 4, 4, 8);
gbc.weightx = 1.0;
panel.add(myInnerClassNameField.getComponent(), gbc);
innerClassNameLabel.setText(RefactoringBundle.message("inner.class.name"));
boolean innerClassNeeded = false;
for (PsiClass superClass : mySuperClasses) {
innerClassNeeded |= InheritanceToDelegationUtil.isInnerClassNeeded(myClass, superClass);
}
myInnerClassNameField.setVisible(innerClassNeeded);
innerClassNameLabel.setVisible(innerClassNeeded);
return panel;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:68,代码来源:InheritanceToDelegationDialog.java
示例18: getNameSuggestionsField
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
protected NameSuggestionsField getNameSuggestionsField() {
return myNameSuggestionsField;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:RenameDialog.java
示例19: setUpNameComboBox
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
private NameSuggestionsField setUpNameComboBox() {
LinkedHashSet<String> names = suggestNames();
return new NameSuggestionsField(names.toArray(new String[names.size()]), myProject, GroovyFileType.GROOVY_FILE_TYPE);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:GroovyIntroduceVariableDialog.java
示例20: ExtractMethodDialog
import com.intellij.refactoring.ui.NameSuggestionsField; //导入依赖的package包/类
public ExtractMethodDialog(Project project,
PsiClass targetClass,
final InputVariables inputVariables,
PsiType returnType,
PsiTypeParameterList typeParameterList,
PsiType[] exceptions,
boolean isStatic,
boolean canBeStatic,
final boolean canBeChainedConstructor,
String title,
String helpId,
Nullness nullness,
final PsiElement[] elementsToExtract)
{
super(project, true);
myProject = project;
myTargetClass = targetClass;
myReturnType = returnType;
myTypeParameterList = typeParameterList;
myExceptions = exceptions;
myStaticFlag = isStatic;
myCanBeStatic = canBeStatic;
myNullness = nullness;
myElementsToExtract = elementsToExtract;
myVariableData = inputVariables;
myHelpId = helpId;
mySignature = new MethodSignatureComponent("", project, JavaFileType.INSTANCE);
mySignature.setPreferredSize(JBUI.size(500, 100));
mySignature.setMinimumSize(JBUI.size(500, 100));
setTitle(title);
myNameField = new NameSuggestionsField(suggestMethodNames(), myProject);
myMakeStatic = new NonFocusableCheckBox();
myMakeStatic.setText(RefactoringBundle.message("declare.static.checkbox"));
if(canBeChainedConstructor)
{
myCbChainedConstructor = new NonFocusableCheckBox(RefactoringBundle.message("extract.chained.constructor.checkbox"));
}
init();
}
开发者ID:consulo,项目名称:consulo-java,代码行数:43,代码来源:ExtractMethodDialog.java
注:本文中的com.intellij.refactoring.ui.NameSuggestionsField类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论