Search in sources :

Example 1 with PackageNameReferenceEditorCombo

use of com.intellij.refactoring.ui.PackageNameReferenceEditorCombo in project kotlin by JetBrains.

the class MoveKotlinNestedClassesToUpperLevelDialog method createUIComponents.

private void createUIComponents() {
    parameterField = new NameSuggestionsField(project);
    packageNameField = new PackageNameReferenceEditorCombo("", project, RECENTS_KEY, RefactoringBundle.message("choose.destination.package"));
}
Also used : NameSuggestionsField(com.intellij.refactoring.ui.NameSuggestionsField) PackageNameReferenceEditorCombo(com.intellij.refactoring.ui.PackageNameReferenceEditorCombo)

Example 2 with PackageNameReferenceEditorCombo

use of com.intellij.refactoring.ui.PackageNameReferenceEditorCombo in project kotlin by JetBrains.

the class MoveKotlinTopLevelDeclarationsDialog method createPackageChooser.

private ReferenceEditorComboWithBrowseButton createPackageChooser() {
    ReferenceEditorComboWithBrowseButton packageChooser = new PackageNameReferenceEditorCombo("", myProject, RECENTS_KEY, RefactoringBundle.message("choose.destination.package"));
    Document document = packageChooser.getChildComponent().getDocument();
    document.addDocumentListener(new DocumentAdapter() {

        @Override
        public void documentChanged(DocumentEvent e) {
            validateButtons();
        }
    });
    return packageChooser;
}
Also used : DocumentAdapter(com.intellij.openapi.editor.event.DocumentAdapter) Document(com.intellij.openapi.editor.Document) DocumentEvent(com.intellij.openapi.editor.event.DocumentEvent) ReferenceEditorComboWithBrowseButton(com.intellij.ui.ReferenceEditorComboWithBrowseButton) PackageNameReferenceEditorCombo(com.intellij.refactoring.ui.PackageNameReferenceEditorCombo)

Example 3 with PackageNameReferenceEditorCombo

use of com.intellij.refactoring.ui.PackageNameReferenceEditorCombo in project intellij-community by JetBrains.

the class WrapReturnValueDialog method createUIComponents.

private void createUIComponents() {
    final com.intellij.openapi.editor.event.DocumentAdapter adapter = new com.intellij.openapi.editor.event.DocumentAdapter() {

        public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
            validateButtons();
        }
    };
    packageTextField = new PackageNameReferenceEditorCombo("", myProject, RECENT_KEYS, RefactoringBundle.message("choose.destination.package"));
    packageTextField.getChildComponent().getDocument().addDocumentListener(adapter);
    existingClassField = new ReferenceEditorComboWithBrowseButton(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            final TreeClassChooser chooser = TreeClassChooserFactory.getInstance(getProject()).createWithInnerClassesScopeChooser(RefactorJBundle.message("select.wrapper.class"), GlobalSearchScope.allScope(myProject), null, null);
            final String classText = existingClassField.getText();
            final PsiClass currentClass = JavaPsiFacade.getInstance(myProject).findClass(classText, GlobalSearchScope.allScope(myProject));
            if (currentClass != null) {
                chooser.select(currentClass);
            }
            chooser.showDialog();
            final PsiClass selectedClass = chooser.getSelected();
            if (selectedClass != null) {
                existingClassField.setText(selectedClass.getQualifiedName());
            }
        }
    }, "", myProject, true, RECENT_KEYS);
    existingClassField.getChildComponent().getDocument().addDocumentListener(adapter);
    myDestinationCb = new DestinationFolderComboBox() {

        @Override
        public String getTargetPackage() {
            return getPackageName();
        }
    };
    ((DestinationFolderComboBox) myDestinationCb).setData(myProject, sourceMethod.getContainingFile().getContainingDirectory(), packageTextField.getChildComponent());
}
Also used : TreeClassChooser(com.intellij.ide.util.TreeClassChooser) ActionEvent(java.awt.event.ActionEvent) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) PackageNameReferenceEditorCombo(com.intellij.refactoring.ui.PackageNameReferenceEditorCombo) ReferenceEditorComboWithBrowseButton(com.intellij.ui.ReferenceEditorComboWithBrowseButton) ActionListener(java.awt.event.ActionListener) DestinationFolderComboBox(com.intellij.refactoring.move.moveClassesOrPackages.DestinationFolderComboBox)

Example 4 with PackageNameReferenceEditorCombo

use of com.intellij.refactoring.ui.PackageNameReferenceEditorCombo in project intellij-community by JetBrains.

the class MoveInnerDialog method createUIComponents.

private void createUIComponents() {
    if (!myInnerClass.hasModifierProperty(PsiModifier.STATIC)) {
        final PsiManager manager = myInnerClass.getManager();
        PsiType outerType = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createType(myInnerClass.getContainingClass());
        mySuggestedNameInfo = JavaCodeStyleManager.getInstance(myProject).suggestVariableName(VariableKind.PARAMETER, null, null, outerType);
        String[] variants = mySuggestedNameInfo.names;
        myParameterField = new NameSuggestionsField(variants, myProject);
    } else {
        myParameterField = new NameSuggestionsField(new String[] { "" }, myProject);
        myParameterField.getComponent().setEnabled(false);
    }
    myPackageNameField = new PackageNameReferenceEditorCombo("", myProject, RECENTS_KEY, RefactoringBundle.message("choose.destination.package"));
    PsiPackage psiPackage = getTargetPackage();
    if (psiPackage != null) {
        myPackageNameField.prependItem(psiPackage.getQualifiedName());
    }
}
Also used : NameSuggestionsField(com.intellij.refactoring.ui.NameSuggestionsField) PackageNameReferenceEditorCombo(com.intellij.refactoring.ui.PackageNameReferenceEditorCombo)

Example 5 with PackageNameReferenceEditorCombo

use of com.intellij.refactoring.ui.PackageNameReferenceEditorCombo in project intellij-community by JetBrains.

the class MoveClassesOrPackagesDialog method createPackageChooser.

private ReferenceEditorComboWithBrowseButton createPackageChooser() {
    final ReferenceEditorComboWithBrowseButton packageChooser = new PackageNameReferenceEditorCombo("", myProject, RECENTS_KEY, RefactoringBundle.message("choose.destination.package"));
    final Document document = packageChooser.getChildComponent().getDocument();
    document.addDocumentListener(new DocumentAdapter() {

        public void documentChanged(DocumentEvent e) {
            validateButtons();
        }
    });
    return packageChooser;
}
Also used : DocumentAdapter(com.intellij.openapi.editor.event.DocumentAdapter) Document(com.intellij.openapi.editor.Document) DocumentEvent(com.intellij.openapi.editor.event.DocumentEvent) ReferenceEditorComboWithBrowseButton(com.intellij.ui.ReferenceEditorComboWithBrowseButton) PackageNameReferenceEditorCombo(com.intellij.refactoring.ui.PackageNameReferenceEditorCombo)

Aggregations

PackageNameReferenceEditorCombo (com.intellij.refactoring.ui.PackageNameReferenceEditorCombo)9 ReferenceEditorComboWithBrowseButton (com.intellij.ui.ReferenceEditorComboWithBrowseButton)4 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4 Document (com.intellij.openapi.editor.Document)3 DocumentAdapter (com.intellij.openapi.editor.event.DocumentAdapter)3 DocumentEvent (com.intellij.openapi.editor.event.DocumentEvent)3 DestinationFolderComboBox (com.intellij.refactoring.move.moveClassesOrPackages.DestinationFolderComboBox)3 DocumentEvent (javax.swing.event.DocumentEvent)3 TreeClassChooser (com.intellij.ide.util.TreeClassChooser)2 NameSuggestionsField (com.intellij.refactoring.ui.NameSuggestionsField)2 DocumentAdapter (com.intellij.ui.DocumentAdapter)2 TreeJavaClassChooserDialog (com.intellij.ide.util.TreeJavaClassChooserDialog)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 CustomShortcutSet (com.intellij.openapi.actionSystem.CustomShortcutSet)1 DumbService (com.intellij.openapi.project.DumbService)1 Project (com.intellij.openapi.project.Project)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 JavaTestFramework (com.intellij.testIntegration.JavaTestFramework)1