private void updateControlsEnabled() { myClassPackageChooser.setEnabled(myToPackageRadioButton.isSelected()); myInnerClassChooser.setEnabled(myMakeInnerClassOfRadioButton.isSelected()); UIUtil.setEnabled( myTargetPanel, isMoveToPackage() && getSourceRoots().length > 1 && !myTargetDirectoryFixed, true); validateButtons(); }
private void updateEnabledState() { myLabelEditor.setEnabled(myRbExpressionLabel.isSelected()); final boolean isChildrenExpression = myRbExpressionChildrenRenderer.isSelected(); myChildrenExpandedEditor.setEnabled(isChildrenExpression); myExpandedLabel.setEnabled(isChildrenExpression); myChildrenEditor.setEnabled(isChildrenExpression); myTable.setEnabled(myRbListChildrenRenderer.isSelected()); }
private String generateSignatureText() { String name = getNewName(); String type = myReturnTypeField.getText().trim(); StringBuilder builder = new StringBuilder(); if (myPublicRadioButton.isSelected() && type.length() == 0) { builder.append(GrModifier.DEF); } if (myPrivateRadioButton.isSelected()) { builder.append(GrModifier.PRIVATE).append(' '); } else if (myProtectedRadioButton.isSelected()) { builder.append(GrModifier.PROTECTED).append(' '); } builder.append(type).append(' '); builder.append(name).append('('); final List<GrTableParameterInfo> infos = myParameterModel.getParameterInfos(); if (infos.size() > 0) { final List<String> paramsText = ContainerUtil.map( infos, new Function<GrTableParameterInfo, String>() { public String fun(GrTableParameterInfo grParameterInfo) { return generateParameterText(grParameterInfo); } }); builder.append("\n").append(INDENT); builder.append(StringUtil.join(paramsText, ",\n" + INDENT)); builder.append('\n'); } builder.append(')'); final PsiTypeCodeFragment[] exceptions = myExceptionTableModel.getTypeCodeFragments(); if (exceptions.length > 0) { builder.append("\nthrows\n"); final List<String> exceptionNames = ContainerUtil.map( exceptions, new Function<PsiTypeCodeFragment, String>() { public String fun(PsiTypeCodeFragment fragment) { return fragment.getText(); } }); builder.append(INDENT).append(StringUtil.join(exceptionNames, ",\n" + INDENT)); } return builder.toString(); }
@Override protected void doAction() { if (!validateInputData()) { return; } stopEditing(); String modifier = ""; if (myPublicRadioButton.isSelected()) { modifier = GrModifier.PUBLIC; } else if (myPrivateRadioButton.isSelected()) { modifier = GrModifier.PRIVATE; } else if (myProtectedRadioButton.isSelected()) { modifier = GrModifier.PROTECTED; } PsiType returnType = null; try { returnType = myReturnTypeCodeFragment.getType(); } catch (PsiTypeCodeFragment.TypeSyntaxException ignored) { } catch (PsiTypeCodeFragment.NoTypeException ignored) { } String newName = getNewName(); final List<GrTableParameterInfo> tableParameterInfos = myParameterModel.getParameterInfos(); final List<GrParameterInfo> parameterInfos = ContainerUtil.map( tableParameterInfos, new Function<GrTableParameterInfo, GrParameterInfo>() { public GrParameterInfo fun(GrTableParameterInfo info) { return info.generateParameterInfo(); } }); final ThrownExceptionInfo[] exceptionInfos = myExceptionTableModel.getThrownExceptions(); invokeRefactoring( new GrChangeSignatureProcessor( myProject, new GrChangeInfoImpl( myMethod, modifier, returnType == null ? null : CanonicalTypes.createTypeWrapper(returnType), newName, parameterInfos, exceptionInfos, myDelegateRadioButton.isSelected()))); }
private void flushDataTo(final CompoundReferenceRenderer renderer) { // label LabelRenderer labelRenderer = null; if (myRbExpressionLabel.isSelected()) { labelRenderer = new LabelRenderer(); labelRenderer.setLabelExpression(myLabelEditor.getText()); } renderer.setLabelRenderer(labelRenderer); // children ChildrenRenderer childrenRenderer = null; if (myRbExpressionChildrenRenderer.isSelected()) { childrenRenderer = new ExpressionChildrenRenderer(); ((ExpressionChildrenRenderer) childrenRenderer) .setChildrenExpression(myChildrenEditor.getText()); ((ExpressionChildrenRenderer) childrenRenderer) .setChildrenExpandable(myChildrenExpandedEditor.getText()); } else if (myRbListChildrenRenderer.isSelected()) { childrenRenderer = new EnumerationChildrenRenderer(getTableModel().getExpressions()); } renderer.setChildrenRenderer(childrenRenderer); // classname renderer.setClassName(myClassNameField.getText()); }
protected boolean isMoveToPackage() { return myHavePackages || myToPackageRadioButton.isSelected(); }