NPE; make title bold

This commit is contained in:
anna
2011-06-28 21:09:13 +04:00
parent 7e2c4e05f8
commit 3c60f1850c
4 changed files with 20 additions and 9 deletions
@@ -92,11 +92,14 @@ public class InplaceIntroduceFieldPopup extends AbstractJavaInplaceIntroducer {
new IntroduceFieldPopupPanel(parentClass, initializerExpression, localVariable, currentMethodConstructor, localVariable != null, aStatic,
myOccurrences, allowInitInMethod, allowInitInMethodIfAll, typeSelectorManager);
myWholePanel.add(myLabel, BorderLayout.NORTH);
final GridBagConstraints constraints =
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0);
myWholePanel.add(myLabel, constraints);
final JComponent centerPanel = myIntroduceFieldPanel.createCenterPanel();
myWholePanel.add(centerPanel, BorderLayout.WEST);
myWholePanel.add(centerPanel, constraints);
myIntroduceFieldPanel.initializeControls(initializerExpression, ourLastInitializerPlace);
}
@@ -227,8 +227,7 @@ public class InplaceIntroduceParameterPopup extends AbstractJavaInplaceIntroduce
}
myLabel.append(")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
myWholePanel.revalidate();
((BalloonImpl)myBalloon).revalidate(new PositionTracker.Static<Balloon>(myTarget));
revalidate();
}
@Override
@@ -125,6 +125,9 @@ public class InplaceIntroduceFieldTest extends LightCodeInsightTestCase {
state.gotoEnd(false);
checkResultByFile(BASE_PATH + name + "_after.java");
}
catch (Throwable e) {
e.printStackTrace();
}
finally {
myEditor.getSettings().setVariableInplaceRenameEnabled(enabled);
templateManager.setTemplateTesting(false);
@@ -48,6 +48,7 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.rename.inplace.VariableInplaceRenamer;
import com.intellij.ui.BalloonImpl;
import com.intellij.ui.SimpleColoredComponent;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.ui.PositionTracker;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -190,16 +191,21 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
protected void updateTitle(V variable, String value) {
myLabel.clear();
myLabel.append(variable.getText().replace(variable.getName(), value));
myWholePanel.revalidate();
((BalloonImpl)myBalloon).revalidate(new PositionTracker.Static<Balloon>(myTarget));
myLabel.append(variable.getText().replace(variable.getName(), value), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
revalidate();
}
protected void updateTitle(V variable) {
myLabel.clear();
myLabel.append(variable.getText());
myLabel.append(variable.getText(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
revalidate();
}
protected void revalidate() {
myWholePanel.revalidate();
((BalloonImpl)myBalloon).revalidate(new PositionTracker.Static<Balloon>(myTarget));
if (myTarget != null) {
((BalloonImpl)myBalloon).revalidate(new PositionTracker.Static<Balloon>(myTarget));
}
}
public void restartInplaceIntroduceTemplate() {