This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | [Hint] 'convert to switch' format problem | ||
---|---|---|---|
Product: | java | Reporter: | err <err> |
Component: | Hints | Assignee: | Svata Dedic <sdedic> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | ||
Priority: | P4 | ||
Version: | 7.4 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
err
2013-11-11 02:05:19 UTC
reproducible if the to-be-switch case entire statement list is wrapped in a block, as in the example in the if-true block. If the last statement stands alone, break is correctly aligned under it. Will solve as time permits, does not break the code / semantics. This seems to be more extensive problem than you first indicate. I've marked with XXX some lines of interest. === converted === switch(evt.getPropertyName()) { case TopComponent.Registry.PROP_ACTIVATED: { TopComponent tc = (TopComponent) evt.getOldValue(); if(tc != null) { tcDumpInfo(tc, "activated oldTC"); for (NbAppView av : NbAppView.fetchAvFromTC(tc)) { AppViews.deactivate(av); } XXX } tc = (TopComponent) evt.getNewValue(); XXX INDENT if(tc != null) { if(!tcChecked.containsKey(tc)) { // After first activation, look through the // GUI hierarchy again for jVi editors. Sigh. getOpenedPanes(tc); // force instantiation of editor panes boolean isEditor = isEditor(tc); List<JEditorPane> l = getDescendentJviJep(tc); for (JEditorPane ep : l) { NbAppView av = NbAppView.updateAppViewForTC( "P_ACTV", tc, ep, !isEditor); } tcChecked.put(tc, null); } tcDumpInfo(tc, "activated newTC"); } break; } case TopComponent.Registry.PROP_TC_OPENED: { TopComponent tc = (TopComponent) evt.getNewValue(); boolean isEditor = isEditor(tc); tcDumpInfo(tc, "open"); if(tc != null && "Output".equals(tc.getName())) { refOutput = new WeakReference<TopComponent>(tc); } boolean createdAppView = false; // When opened, traverse the GUI hierarchy looking for // JEP that have jVi installed. XXX List<JEditorPane> l = getDescendentJviJep(tc); for (JEditorPane ep : l) { // if TC is not an editor then start out like a nomad NbAppView av = NbAppView.updateAppViewForTC( "P_OPEN", tc, ep, !isEditor); createdAppView = true; XXX } if(isEditor && !createdAppView) { XXX NbAppView av = NbAppView.updateAppViewForTC( "P_OPEN_LAZY", tc, null); } break; } case TopComponent.Registry.PROP_TC_CLOSED: { TopComponent tc = (TopComponent) evt.getNewValue(); for (NbAppView av : NbAppView.fetchAvFromTC(tc)) { tcDumpInfo(tc, "close"); KeyBindings.removeKnownEditor(av.getEditor()); AppViews.close(av); } NbAppView.closeTC(tc); break; } } === original === if(evt.getPropertyName() .equals(TopComponent.Registry.PROP_ACTIVATED)) { TopComponent tc = (TopComponent) evt.getOldValue(); if(tc != null) { tcDumpInfo(tc, "activated oldTC"); for (NbAppView av : NbAppView.fetchAvFromTC(tc)) { AppViews.deactivate(av); } } tc = (TopComponent) evt.getNewValue(); if(tc != null) { if(!tcChecked.containsKey(tc)) { // After first activation, look through the // GUI hierarchy again for jVi editors. Sigh. getOpenedPanes(tc); // force instantiation of editor panes boolean isEditor = isEditor(tc); List<JEditorPane> l = getDescendentJviJep(tc); for (JEditorPane ep : l) { NbAppView av = NbAppView.updateAppViewForTC( "P_ACTV", tc, ep, !isEditor); } tcChecked.put(tc, null); } tcDumpInfo(tc, "activated newTC"); } } else if(evt.getPropertyName() .equals(TopComponent.Registry.PROP_TC_OPENED)) { TopComponent tc = (TopComponent) evt.getNewValue(); boolean isEditor = isEditor(tc); tcDumpInfo(tc, "open"); if(tc != null && "Output".equals(tc.getName())) { refOutput = new WeakReference<TopComponent>(tc); } boolean createdAppView = false; // When opened, traverse the GUI hierarchy looking for // JEP that have jVi installed. List<JEditorPane> l = getDescendentJviJep(tc); for (JEditorPane ep : l) { // if TC is not an editor then start out like a nomad NbAppView av = NbAppView.updateAppViewForTC( "P_OPEN", tc, ep, !isEditor); createdAppView = true; } if(isEditor && !createdAppView) { NbAppView av = NbAppView.updateAppViewForTC( "P_OPEN_LAZY", tc, null); } } else if(evt.getPropertyName() .equals(TopComponent.Registry.PROP_TC_CLOSED)) { TopComponent tc = (TopComponent) evt.getNewValue(); for (NbAppView av : NbAppView.fetchAvFromTC(tc)) { tcDumpInfo(tc, "close"); KeyBindings.removeKnownEditor(av.getEditor()); AppViews.close(av); } NbAppView.closeTC(tc); } This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss |