use of com.intellij.ui.NonFocusableCheckBox in project intellij-community by JetBrains.
the class ExtractMethodDialog method createOptionsPanel.
protected JPanel createOptionsPanel() {
final JPanel optionsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5));
if (myStaticFlag || myCanBeStatic) {
myMakeStatic.setEnabled(!myStaticFlag);
myMakeStatic.setSelected(myStaticFlag);
if (myVariableData.hasInstanceFields()) {
myMakeStatic.setText(RefactoringBundle.message("declare.static.pass.fields.checkbox"));
}
myMakeStatic.addItemListener(e -> {
if (myVariableData.hasInstanceFields()) {
myVariableData.setPassFields(myMakeStatic.isSelected());
myInputVariables = myVariableData.getInputVariables().toArray(new VariableData[myVariableData.getInputVariables().size()]);
updateVarargsEnabled();
createParametersPanel();
}
updateSignature();
});
optionsPanel.add(myMakeStatic);
} else {
myMakeStatic.setSelected(false);
myMakeStatic.setEnabled(false);
}
final Border emptyBorder = IdeBorderFactory.createEmptyBorder(5, 0, 5, 4);
myMakeStatic.setBorder(emptyBorder);
myFoldParameters.setSelected(myVariableData.isFoldingSelectedByDefault());
myFoldParameters.setVisible(myVariableData.isFoldable());
myVariableData.setFoldingAvailable(myFoldParameters.isSelected());
myInputVariables = myVariableData.getInputVariables().toArray(new VariableData[myVariableData.getInputVariables().size()]);
myFoldParameters.addActionListener(e -> {
myVariableData.setFoldingAvailable(myFoldParameters.isSelected());
myInputVariables = myVariableData.getInputVariables().toArray(new VariableData[myVariableData.getInputVariables().size()]);
updateVarargsEnabled();
createParametersPanel();
updateSignature();
});
optionsPanel.add(myFoldParameters);
myFoldParameters.setBorder(emptyBorder);
boolean canBeVarargs = false;
for (VariableData data : myInputVariables) {
canBeVarargs |= data.type instanceof PsiArrayType;
}
if (myVariableData.isFoldable()) {
canBeVarargs |= myVariableData.isFoldingSelectedByDefault();
}
if (canBeVarargs) {
myMakeVarargs = new NonFocusableCheckBox(RefactoringBundle.message("declare.varargs.checkbox"));
myMakeVarargs.setBorder(emptyBorder);
updateVarargsEnabled();
myMakeVarargs.addItemListener(e -> updateSignature());
myMakeVarargs.setSelected(false);
optionsPanel.add(myMakeVarargs);
}
if (myNullness != null && myNullness != Nullness.UNKNOWN) {
final boolean isSelected = PropertiesComponent.getInstance(myProject).getBoolean(EXTRACT_METHOD_GENERATE_ANNOTATIONS, true);
myGenerateAnnotations = new JCheckBox(RefactoringBundle.message("declare.generated.annotations"), isSelected);
myGenerateAnnotations.addItemListener(e -> updateSignature());
optionsPanel.add(myGenerateAnnotations);
}
if (myCbChainedConstructor != null) {
optionsPanel.add(myCbChainedConstructor);
myCbChainedConstructor.setBorder(emptyBorder);
myCbChainedConstructor.addItemListener(e -> {
if (myDefaultVisibility) {
myChangingVisibility = true;
try {
if (isChainedConstructor()) {
myVisibilityPanel.setVisibility(VisibilityUtil.getVisibilityModifier(myTargetClass.getModifierList()));
} else {
myVisibilityPanel.setVisibility(PsiModifier.PRIVATE);
}
} finally {
myChangingVisibility = false;
}
}
update();
});
}
return optionsPanel;
}
use of com.intellij.ui.NonFocusableCheckBox in project intellij-community by JetBrains.
the class AnonymousToInnerDialog method createNorthPanel.
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();
}
use of com.intellij.ui.NonFocusableCheckBox in project intellij-community by JetBrains.
the class IntroduceParameterSettingsUI method createRemoveParamsPanel.
protected void createRemoveParamsPanel(GridBagConstraints gbConstraints, JPanel panel) {
final JCheckBox[] removeParamsCb = new JCheckBox[myParametersToRemove.length];
for (int i = 0; i < myParametersToRemove.length; i++) {
PsiParameter parameter = myParametersToRemove[i];
if (parameter == null)
continue;
final NonFocusableCheckBox cb = new NonFocusableCheckBox(RefactoringBundle.message("remove.parameter.0.no.longer.used", parameter.getName()));
removeParamsCb[i] = cb;
cb.setSelected(true);
gbConstraints.gridy++;
panel.add(cb, gbConstraints);
final int i1 = i;
cb.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
myParametersToRemoveChecked[i1] = cb.isSelected();
}
});
myParametersToRemoveChecked[i] = true;
}
updateControls(removeParamsCb);
if (myCbReplaceAllOccurences != null) {
myCbReplaceAllOccurences.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
updateControls(removeParamsCb);
}
});
}
}
use of com.intellij.ui.NonFocusableCheckBox in project intellij-community by JetBrains.
the class IntroduceParameterSettingsUI method createOccurrencesCb.
protected void createOccurrencesCb(GridBagConstraints gbConstraints, JPanel panel, final int occurenceNumber) {
myCbReplaceAllOccurences = new NonFocusableCheckBox();
myCbReplaceAllOccurences.setText(RefactoringBundle.message("replace.all.occurences", occurenceNumber));
panel.add(myCbReplaceAllOccurences, gbConstraints);
myCbReplaceAllOccurences.setSelected(false);
}
use of com.intellij.ui.NonFocusableCheckBox in project intellij-community by JetBrains.
the class InplaceChangeSignature method showBalloon.
protected void showBalloon() {
NonFocusableCheckBox checkBox = new NonFocusableCheckBox(RefactoringBundle.message("delegation.panel.delegate.via.overloading.method"));
checkBox.addActionListener(e -> {
myDelegate = checkBox.isSelected();
updateCurrentInfo();
});
JPanel content = new JPanel(new BorderLayout());
content.add(new JBLabel("Performed signature modifications:"), BorderLayout.NORTH);
content.add(myPreview.getComponent(), BorderLayout.CENTER);
updateMethodSignature(myStableChange);
content.add(checkBox, BorderLayout.SOUTH);
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(content, null).setSmallVariant(true);
myBalloon = balloonBuilder.createBalloon();
myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
myBalloon.show(new PositionTracker<Balloon>(myEditor.getContentComponent()) {
@Override
public RelativePoint recalculateLocation(Balloon object) {
int offset = myStableChange.getMethod().getTextOffset();
VisualPosition visualPosition = myEditor.offsetToVisualPosition(offset);
Point point = myEditor.visualPositionToXY(new VisualPosition(visualPosition.line, visualPosition.column));
return new RelativePoint(myEditor.getContentComponent(), point);
}
}, Balloon.Position.above);
Disposer.register(myBalloon, () -> {
EditorFactory.getInstance().releaseEditor(myPreview);
myPreview = null;
});
}
Aggregations