use of com.intellij.refactoring.move.moveClassesOrPackages.DestinationFolderComboBox in project kotlin by JetBrains.
the class MoveKotlinTopLevelDeclarationsDialog method createUIComponents.
private void createUIComponents() {
classPackageChooser = createPackageChooser();
destinationFolderCB = new DestinationFolderComboBox() {
@Override
public String getTargetPackage() {
return MoveKotlinTopLevelDeclarationsDialog.this.getTargetPackage();
}
};
}
use of com.intellij.refactoring.move.moveClassesOrPackages.DestinationFolderComboBox 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());
}
use of com.intellij.refactoring.move.moveClassesOrPackages.DestinationFolderComboBox in project intellij-community by JetBrains.
the class IntroduceParameterObjectDialog method createClassDescriptor.
@Override
protected JavaIntroduceParameterObjectClassDescriptor createClassDescriptor() {
final boolean useExistingClass = useExistingClass();
final String className;
final String packageName;
final boolean createInnerClass = myCreateInnerClassRadioButton.isSelected();
if (createInnerClass) {
className = getInnerClassName();
packageName = "";
} else if (useExistingClass) {
final String existingClassName = getExistingClassName();
className = StringUtil.getShortName(existingClassName);
packageName = StringUtil.getPackageName(existingClassName);
} else {
packageName = getPackageName();
className = getClassName();
}
final String newVisibility = myEscalateVisibilityCheckBox.isEnabled() && myEscalateVisibilityCheckBox.isSelected() ? VisibilityUtil.ESCALATE_VISIBILITY : null;
final MoveDestination moveDestination = ((DestinationFolderComboBox) myDestinationCb).selectDirectory(new PackageWrapper(PsiManager.getInstance(myProject), packageName), false);
final PsiParameterList parameterList = mySourceMethod.getParameterList();
final List<ParameterInfoImpl> parameters = new ArrayList<>();
for (VariableData data : myParameterTablePanel.getVariableData()) {
if (data.passAsParameter) {
parameters.add(new ParameterInfoImpl(parameterList.getParameterIndex((PsiParameter) data.variable), data.name, data.type));
}
}
final ParameterInfoImpl[] infos = parameters.toArray(new ParameterInfoImpl[parameters.size()]);
return new JavaIntroduceParameterObjectClassDescriptor(className, packageName, moveDestination, useExistingClass, createInnerClass, newVisibility, infos, mySourceMethod, myGenerateAccessorsCheckBox.isSelected());
}
use of com.intellij.refactoring.move.moveClassesOrPackages.DestinationFolderComboBox in project intellij-community by JetBrains.
the class WrapReturnValueDialog method doAction.
protected void doAction() {
final boolean useExistingClass = useExistingClassButton.isSelected();
final boolean createInnerClass = myCreateInnerClassButton.isSelected();
final String existingClassName = existingClassField.getText().trim();
final String className;
final String packageName;
if (useExistingClass) {
className = StringUtil.getShortName(existingClassName);
packageName = StringUtil.getPackageName(existingClassName);
} else if (createInnerClass) {
className = getInnerClassName();
packageName = "";
} else {
className = getClassName();
packageName = getPackageName();
}
invokeRefactoring(new WrapReturnValueProcessor(className, packageName, ((DestinationFolderComboBox) myDestinationCb).selectDirectory(new PackageWrapper(sourceMethod.getManager(), packageName), false), sourceMethod, useExistingClass, createInnerClass, (PsiField) myFieldsCombo.getSelectedItem()));
}
use of com.intellij.refactoring.move.moveClassesOrPackages.DestinationFolderComboBox in project intellij-community by JetBrains.
the class ReplaceConstructorWithBuilderDialog 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();
}
};
myPackageTextField = new PackageNameReferenceEditorCombo(((PsiJavaFile) myConstructors[0].getContainingFile()).getPackageName(), myProject, RECENT_KEYS, RefactoringBundle.message("choose.destination.package"));
myPackageTextField.getChildComponent().getDocument().addDocumentListener(adapter);
myDestinationCb = new DestinationFolderComboBox() {
@Override
public String getTargetPackage() {
return myPackageTextField.getText().trim();
}
};
((DestinationFolderComboBox) myDestinationCb).setData(myProject, myConstructors[0].getContainingFile().getContainingDirectory(), myPackageTextField.getChildComponent());
myExistentClassTF = new ReferenceEditorComboWithBrowseButton(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final TreeClassChooser chooser = TreeClassChooserFactory.getInstance(getProject()).createWithInnerClassesScopeChooser("Select Builder Class", GlobalSearchScope.projectScope(myProject), null, null);
final String classText = myExistentClassTF.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) {
myExistentClassTF.setText(selectedClass.getQualifiedName());
}
}
}, "", myProject, true, RECENT_KEYS);
myExistentClassTF.getChildComponent().getDocument().addDocumentListener(adapter);
}
Aggregations