src/intellijeval/toolwindow/RenameFileAction.java
private void updateTreeModel_HACK() {
				TreeModel model = fileSystemTree.getTree().getModel();
				Queue<DefaultMutableTreeNode> queue = new LinkedList<DefaultMutableTreeNode>();
				DefaultMutableTreeNode node = (DefaultMutableTreeNode) model.getRoot();
				queue.add(node);

				while (!queue.isEmpty()) {
					node = queue.remove();
					final Object userObject = node.getUserObject();
					boolean nodeContainsRenamedFile = userObject instanceof FileNodeDescriptor && file.equals(((FileNodeDescriptor) userObject).getElement().getFile());

					if (nodeContainsRenamedFile) {
						final DefaultMutableTreeNode finalNode = node;
						SwingUtilities.invokeLater(new Runnable() {
							@Override public void run() {
								FileNodeDescriptor nodeDescriptor = (FileNodeDescriptor) userObject;
								FileElement fileElement = new FileElement(file, newFileName);
								fileElement.setParent(nodeDescriptor.getElement().getParent());
								finalNode.setUserObject(new FileNodeDescriptor(
										nodeDescriptor.getProject(),
										fileElement,
										nodeDescriptor.getParentDescriptor(),
										nodeDescriptor.getIcon(),
										newFileName,
										nodeDescriptor.getComment()
								));
							}
						});

						return;
					}

					for (int i = 0; i < model.getChildCount(node); i++) {
						queue.add((DefaultMutableTreeNode) model.getChild(node, i));
					}
				}
			}
/**
			 * Couldn't find any way to update file chooser tree to show new file name, therefore this hack.
			 * There is still a problem with this except that it's a hack.
			 * If new file name is longer than previous name, it's not shown fully.
			 * The workaround is to collapse, expand parent tree node.
			 */
Couldn't find any way to update file chooser tree to show new file name, therefore this hack.
There is still a problem with this except that it's a hack.
If new file name is longer than previous name, it's not shown fully.
The workaround is to collapse, expand parent tree node.
Couldn ' t find any way to update file chooser tree to show new file name therefore this hack . There is still a problem with this except that it ' s a hack . If new file name is longer than previous name it ' s not shown fully . The workaround is to collapse expand parent tree node .
private void updateTreeModel_HACK() {
				TreeModel model = fileSystemTree.getTree().getModel();
				Queue<DefaultMutableTreeNode> queue = new LinkedList<DefaultMutableTreeNode>();
				DefaultMutableTreeNode node = (DefaultMutableTreeNode) model.getRoot();
				queue.add(node);
				while (!queue.isEmpty()) {
					node = queue.remove();
					final Object userObject = node.getUserObject();
					boolean nodeContainsRenamedFile = userObject instanceof FileNodeDescriptor && file.equals(((FileNodeDescriptor) userObject).getElement().getFile());
					if (nodeContainsRenamedFile) {
						final DefaultMutableTreeNode finalNode = node;
						SwingUtilities.invokeLater(new Runnable() {
							@Override public void run() {
								FileNodeDescriptor nodeDescriptor = (FileNodeDescriptor) userObject;
								FileElement fileElement = new FileElement(file, newFileName);
								fileElement.setParent(nodeDescriptor.getElement().getParent());
								finalNode.setUserObject(new FileNodeDescriptor(
										nodeDescriptor.getProject(),
										fileElement,
										nodeDescriptor.getParentDescriptor(),
										nodeDescriptor.getIcon(),
										newFileName,
										nodeDescriptor.getComment()
								));
							}
						});
						return;
					}
					for (int i = 0; i < model.getChildCount(node); i++) {
						queue.add((DefaultMutableTreeNode) model.getChild(node, i));
					}
				}
			}
private void updateTreeModel_HACK ( ) { TreeModel model = fileSystemTree . getTree ( ) . getModel ( ) ; Queue < DefaultMutableTreeNode > queue = new LinkedList < DefaultMutableTreeNode > ( ) ; DefaultMutableTreeNode node = ( DefaultMutableTreeNode ) model . getRoot ( ) ; queue . add ( node ) ; while ( ! queue . isEmpty ( ) ) { node = queue . remove ( ) ; final Object userObject = node . getUserObject ( ) ; boolean nodeContainsRenamedFile = userObject instanceof FileNodeDescriptor && file . equals ( ( ( FileNodeDescriptor ) userObject ) . getElement ( ) . getFile ( ) ) ; if ( nodeContainsRenamedFile ) { final DefaultMutableTreeNode finalNode = node ; SwingUtilities . invokeLater ( new Runnable ( ) { @ Override public void run ( ) { FileNodeDescriptor nodeDescriptor = ( FileNodeDescriptor ) userObject ; FileElement fileElement = new FileElement ( file , newFileName ) ; fileElement . setParent ( nodeDescriptor . getElement ( ) . getParent ( ) ) ; finalNode . setUserObject ( new FileNodeDescriptor ( nodeDescriptor . getProject ( ) , fileElement , nodeDescriptor . getParentDescriptor ( ) , nodeDescriptor . getIcon ( ) , newFileName , nodeDescriptor . getComment ( ) ) ) ; } } ) ; return ; } for ( int i = 0 ; i < model . getChildCount ( node ) ; i ++ ) { queue . add ( ( DefaultMutableTreeNode ) model . getChild ( node , i ) ) ; } } }
Couldn't find any way to update file chooser tree to show new file name, therefore this hack.
Couldn ' t find any way to update file chooser tree to show new file name therefore this hack .