mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
annoying problem with <invalid>
This commit is contained in:
@@ -59,7 +59,7 @@ public class NavBarItem extends SimpleColoredComponent implements Disposable {
|
||||
openIcon = closedIcon = EmptyIcon.create(5);
|
||||
}
|
||||
final NavBarPresentation presentation = myPanel.getPresentation();
|
||||
myText = NavBarPresentation.getPresentableText(object, myPanel.getWindow());
|
||||
myText = NavBarPresentation.getPresentableText(object);
|
||||
myIcon = wrapIcon(openIcon, closedIcon, idx);
|
||||
myAttributes = presentation.getTextAttributes(object, false);
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class NavBarListCellRenderer extends ColoredListCellRenderer {
|
||||
|
||||
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
setFocusBorderAroundIcon(false);
|
||||
final String name = NavBarPresentation.getPresentableText(value, myPanel.getWindow());
|
||||
final String name = NavBarPresentation.getPresentableText(value);
|
||||
|
||||
Color color = list.getForeground();
|
||||
boolean isProblemFile = false;
|
||||
|
||||
@@ -159,6 +159,22 @@ public class NavBarModel {
|
||||
setModel(updatedModel);
|
||||
}
|
||||
|
||||
void revalidate() {
|
||||
final List<Object> objects = new ArrayList<Object>();
|
||||
boolean update = false;
|
||||
for (Object o : myModel) {
|
||||
if (isValid(o)) {
|
||||
objects.add(o);
|
||||
} else {
|
||||
update = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (update) {
|
||||
setModel(objects);
|
||||
}
|
||||
}
|
||||
|
||||
private void setModel(List<Object> model) {
|
||||
if (!model.equals(myModel)) {
|
||||
myModel = model;
|
||||
|
||||
@@ -336,6 +336,7 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
|
||||
}
|
||||
|
||||
boolean isRebuildUiNeeded() {
|
||||
myModel.revalidate();
|
||||
if (myList.size() == myModel.size()) {
|
||||
int index = 0;
|
||||
for (NavBarItem eachLabel : myList) {
|
||||
@@ -344,7 +345,7 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtil.equals(eachLabel.getText(), NavBarPresentation.getPresentableText(eachElement, null))) {
|
||||
if (!StringUtil.equals(eachLabel.getText(), NavBarPresentation.getPresentableText(eachElement))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ public class NavBarPopup extends LightweightHint implements Disposable{
|
||||
final JComponent component = ListWithFilter.wrap(list, new NavBarListWrapper(list), new Function<Object, String>() {
|
||||
@Override
|
||||
public String fun(Object o) {
|
||||
return NavBarPresentation.getPresentableText(o, panel.getWindow());
|
||||
return NavBarPresentation.getPresentableText(o);
|
||||
}
|
||||
});
|
||||
component.putClientProperty(JBLIST_KEY, list);
|
||||
|
||||
@@ -91,8 +91,10 @@ public class NavBarPresentation {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static String getPresentableText(final Object object, @Nullable Window window) {
|
||||
if (!NavBarModel.isValid(object)) return IdeBundle.message("node.structureview.invalid");
|
||||
protected static String getPresentableText(final Object object) {
|
||||
if (!NavBarModel.isValid(object)) {
|
||||
return IdeBundle.message("node.structureview.invalid");
|
||||
}
|
||||
for (NavBarModelExtension modelExtension : Extensions.getExtensions(NavBarModelExtension.EP_NAME)) {
|
||||
String text = modelExtension.getPresentableText(object);
|
||||
if (text != null) {
|
||||
|
||||
Reference in New Issue
Block a user