Skip to content

Commit d9c5787

Browse files
authored
Comment out the usage of the Flutter Outline view (#7779)
This resolves #7778
1 parent 0485342 commit d9c5787

File tree

2 files changed

+100
-87
lines changed

2 files changed

+100
-87
lines changed

flutter-idea/src/io/flutter/performance/FlutterPerformanceView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private void addPerformanceViewContent(FlutterApp app, ToolWindow toolWindow) {
194194
JTextPane text = new JTextPane();
195195
text.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
196196
text.setCharacterAttributes(StyleContext.getDefaultStyleContext().addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, new Color(234, 57, 35)), false);
197-
text.setText("The performance panel is being removed soon. Use the Flutter DevTools panel instead: View -> Tool windows -> Flutter DevTools");
197+
text.setText("The performance panel is being removed soon. Use the Flutter DevTools panel instead: View -> Tool Windows -> Flutter DevTools");
198198
text.setFont(UIManager.getFont("Label.font").deriveFont(Font.BOLD));
199199
warning.add(text);
200200
perfViewsPanel.add(warning);

flutter-idea/src/io/flutter/preview/PreviewView.java

Lines changed: 99 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
import javax.swing.*;
5656
import javax.swing.event.TreeSelectionEvent;
5757
import javax.swing.event.TreeSelectionListener;
58+
import javax.swing.text.SimpleAttributeSet;
59+
import javax.swing.text.StyleConstants;
60+
import javax.swing.text.StyleContext;
5861
import javax.swing.tree.DefaultMutableTreeNode;
5962
import javax.swing.tree.DefaultTreeModel;
6063
import javax.swing.tree.TreeNode;
@@ -192,92 +195,102 @@ public void initToolWindow(@NotNull ToolWindow toolWindow) {
192195
final ContentFactory contentFactory = ContentFactory.getInstance();
193196
final ContentManager contentManager = toolWindow.getContentManager();
194197

195-
final Content content = contentFactory.createContent(null, null, false);
196-
content.setCloseable(false);
197-
198-
windowPanel = new OutlineComponent(this);
199-
content.setComponent(windowPanel);
200-
201-
windowPanel.setToolbar(widgetEditToolbar.getToolbar().getComponent());
202-
203-
final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
204-
205-
tree = new OutlineTree(rootNode);
206-
tree.setCellRenderer(new OutlineTreeCellRenderer());
207-
tree.expandAll();
208-
209-
initTreePopup();
210-
211-
// Add collapse all, expand all, and show only widgets buttons.
212-
if (toolWindow instanceof ToolWindowEx toolWindowEx) {
213-
214-
final CommonActionsManager actions = CommonActionsManager.getInstance();
215-
final TreeExpander expander = new DefaultTreeExpander(tree);
216-
217-
final AnAction expandAllAction = actions.createExpandAllAction(expander, tree);
218-
expandAllAction.getTemplatePresentation().setIcon(AllIcons.Actions.Expandall);
219-
220-
final AnAction collapseAllAction = actions.createCollapseAllAction(expander, tree);
221-
collapseAllAction.getTemplatePresentation().setIcon(AllIcons.Actions.Collapseall);
222-
223-
final ShowOnlyWidgetsAction showOnlyWidgetsAction = new ShowOnlyWidgetsAction();
224-
225-
toolWindowEx.setTitleActions(Arrays.asList(expandAllAction, collapseAllAction, showOnlyWidgetsAction));
226-
}
227-
228-
new TreeSpeedSearch(tree) {
229-
@Override
230-
protected String getElementText(Object element) {
231-
final TreePath path = (TreePath)element;
232-
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
233-
final Object object = node.getUserObject();
234-
if (object instanceof OutlineObject) {
235-
return ((OutlineObject)object).getSpeedSearchString();
236-
}
237-
return null;
238-
}
239-
};
240-
241-
tree.addMouseListener(new MouseAdapter() {
242-
@Override
243-
public void mouseClicked(MouseEvent e) {
244-
if (e.getClickCount() > 1) {
245-
final TreePath selectionPath = tree.getSelectionPath();
246-
if (selectionPath != null) {
247-
selectPath(selectionPath, true);
248-
}
249-
}
250-
}
251-
});
252-
253-
tree.addTreeSelectionListener(treeSelectionListener);
254-
255-
scrollPane = ScrollPaneFactory.createScrollPane(tree);
256-
content.setPreferredFocusableComponent(tree);
257-
258-
contentManager.addContent(content);
259-
contentManager.setSelectedContent(content);
260-
261-
splitter = new Splitter(true);
262-
setSplitterProportion(getState().getSplitterProportion());
263-
getState().addListener(e -> {
264-
final float newProportion = getState().getSplitterProportion();
265-
if (splitter.getProportion() != newProportion) {
266-
setSplitterProportion(newProportion);
267-
}
268-
});
269-
//noinspection Convert2Lambda
270-
splitter.addPropertyChangeListener("proportion", new PropertyChangeListener() {
271-
@Override
272-
public void propertyChange(PropertyChangeEvent evt) {
273-
if (!isSettingSplitterProportion) {
274-
getState().setSplitterProportion(splitter.getProportion());
275-
}
276-
}
277-
});
278-
scrollPane.setMinimumSize(new Dimension(1, 1));
279-
splitter.setFirstComponent(scrollPane);
280-
windowPanel.setContent(splitter);
198+
final JPanel warning = new JPanel(new BorderLayout(50, 50));
199+
JTextPane text = new JTextPane();
200+
text.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
201+
text.setCharacterAttributes(
202+
StyleContext.getDefaultStyleContext().addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, new Color(234, 57, 35)), false);
203+
text.setText("The Flutter Outline window is being removed soon. Use the Structure view instead: View -> Tool Windows -> Structure");
204+
text.setFont(UIManager.getFont("Label.font").deriveFont(Font.BOLD));
205+
warning.add(text);
206+
contentManager.getComponent().add(warning);
207+
208+
//final Content content = contentFactory.createContent(null, null, false);
209+
//content.setCloseable(false);
210+
//
211+
//windowPanel = new OutlineComponent(this);
212+
//content.setComponent(windowPanel);
213+
//
214+
//windowPanel.setToolbar(widgetEditToolbar.getToolbar().getComponent());
215+
//
216+
//final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
217+
//
218+
//tree = new OutlineTree(rootNode);
219+
//tree.setCellRenderer(new OutlineTreeCellRenderer());
220+
//tree.expandAll();
221+
//
222+
//initTreePopup();
223+
//
224+
//// Add collapse all, expand all, and show only widgets buttons.
225+
//if (toolWindow instanceof ToolWindowEx toolWindowEx) {
226+
//
227+
// final CommonActionsManager actions = CommonActionsManager.getInstance();
228+
// final TreeExpander expander = new DefaultTreeExpander(tree);
229+
//
230+
// final AnAction expandAllAction = actions.createExpandAllAction(expander, tree);
231+
// expandAllAction.getTemplatePresentation().setIcon(AllIcons.Actions.Expandall);
232+
//
233+
// final AnAction collapseAllAction = actions.createCollapseAllAction(expander, tree);
234+
// collapseAllAction.getTemplatePresentation().setIcon(AllIcons.Actions.Collapseall);
235+
//
236+
// final ShowOnlyWidgetsAction showOnlyWidgetsAction = new ShowOnlyWidgetsAction();
237+
//
238+
// toolWindowEx.setTitleActions(Arrays.asList(expandAllAction, collapseAllAction, showOnlyWidgetsAction));
239+
//}
240+
//
241+
//new TreeSpeedSearch(tree) {
242+
// @Override
243+
// protected String getElementText(Object element) {
244+
// final TreePath path = (TreePath)element;
245+
// final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
246+
// final Object object = node.getUserObject();
247+
// if (object instanceof OutlineObject) {
248+
// return ((OutlineObject)object).getSpeedSearchString();
249+
// }
250+
// return null;
251+
// }
252+
//};
253+
//
254+
//tree.addMouseListener(new MouseAdapter() {
255+
// @Override
256+
// public void mouseClicked(MouseEvent e) {
257+
// if (e.getClickCount() > 1) {
258+
// final TreePath selectionPath = tree.getSelectionPath();
259+
// if (selectionPath != null) {
260+
// selectPath(selectionPath, true);
261+
// }
262+
// }
263+
// }
264+
//});
265+
//
266+
//tree.addTreeSelectionListener(treeSelectionListener);
267+
//
268+
//scrollPane = ScrollPaneFactory.createScrollPane(tree);
269+
//content.setPreferredFocusableComponent(tree);
270+
//
271+
//contentManager.addContent(content);
272+
//contentManager.setSelectedContent(content);
273+
//
274+
//splitter = new Splitter(true);
275+
//setSplitterProportion(getState().getSplitterProportion());
276+
//getState().addListener(e -> {
277+
// final float newProportion = getState().getSplitterProportion();
278+
// if (splitter.getProportion() != newProportion) {
279+
// setSplitterProportion(newProportion);
280+
// }
281+
//});
282+
////noinspection Convert2Lambda
283+
//splitter.addPropertyChangeListener("proportion", new PropertyChangeListener() {
284+
// @Override
285+
// public void propertyChange(PropertyChangeEvent evt) {
286+
// if (!isSettingSplitterProportion) {
287+
// getState().setSplitterProportion(splitter.getProportion());
288+
// }
289+
// }
290+
//});
291+
//scrollPane.setMinimumSize(new Dimension(1, 1));
292+
//splitter.setFirstComponent(scrollPane);
293+
//windowPanel.setContent(splitter);
281294
}
282295

283296
private void initTreePopup() {

0 commit comments

Comments
 (0)