public BlobExplorerFileEditor()

in PluginsAndFeatures/azure-toolkit-for-intellij/src/main/java/com/microsoft/intellij/helpers/storage/BlobExplorerFileEditor.java [102:302]


    public BlobExplorerFileEditor(Project project) {
        this.project = project;
        blobListTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

        DefaultTableModel model = new DefaultTableModel() {
            @Override
            public boolean isCellEditable(int i, int i1) {
                return false;
            }

            public Class getColumnClass(int column) {
                return (column == 0) ? Icon.class : String.class;
            }
        };

        model.addColumn("");
        model.addColumn("Name");
        model.addColumn("Size");
        model.addColumn("Last Modified (UTC)");
        model.addColumn("Content Type");
        model.addColumn("URL");

        blobListTable.setModel(model);
        blobListTable.getColumnModel().getColumn(0).setMinWidth(20);
        blobListTable.getColumnModel().getColumn(0).setMaxWidth(20);
        blobListTable.getColumnModel().getColumn(1).setPreferredWidth(100);
        blobListTable.getColumnModel().getColumn(2).setPreferredWidth(10);
        blobListTable.getColumnModel().getColumn(3).setPreferredWidth(15);
        blobListTable.getColumnModel().getColumn(4).setPreferredWidth(40);

        JTableHeader tableHeader = blobListTable.getTableHeader();
        Dimension headerSize = tableHeader.getPreferredSize();
        headerSize.setSize(headerSize.getWidth(), 18);
        tableHeader.setPreferredSize(headerSize);
        tableHeader.setReorderingAllowed(false);
        tableHeader.setResizingAllowed(true);

        fileEditorVirtualNode = createVirtualNode("");

        blobListTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent listSelectionEvent) {
                boolean directorySelected = isDirectorySelected() && blobListTable.getSelectedRow() >= 0;

                deleteButton.setEnabled(!directorySelected);
                openButton.setEnabled(!directorySelected);
                saveAsButton.setEnabled(!directorySelected);
            }
        });

        TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);

        sorter.setComparator(2, new Comparator<String>() {
            @Override
            public int compare(String f, String s) {
                String first = f;
                String second = s;
                if (first == null || first.isEmpty()) {
                    first = "0";
                }

                if (second == null || second.isEmpty()) {
                    second = "0";
                }

                return getValue(first).compareTo(getValue(second));
            }

            private Long getValue(String strValue) {
                if (strValue.endsWith("kB")) {
                    double l = Double.parseDouble(strValue.substring(0, strValue.length() - 2));
                    return (long) (l * 1024);
                } else if (strValue.endsWith("MB")) {
                    double l = Double.parseDouble(strValue.substring(0, strValue.length() - 2));
                    return (long) (l * 1024 * 1024);
                } else if (strValue.endsWith("GB")) {
                    double l = Double.parseDouble(strValue.substring(0, strValue.length() - 2));
                    return (long) (l * 1024 * 1024 * 1024);
                } else if (strValue.endsWith("TB")) {
                    double l = Double.parseDouble(strValue.substring(0, strValue.length() - 2));
                    return (long) (l * 1024 * 1024 * 1024 * 1024);
                } else {
                    String value = strValue.substring(0, strValue.length() - 1);

                    if (value.isEmpty()) {
                        return 0L;
                    }

                    double l = Double.parseDouble(value);
                    return (long) l;
                }
            }
        });

        blobListTable.setRowSorter(sorter);
        List<RowSorter.SortKey> sortKeys = new ArrayList<RowSorter.SortKey>();

        sortKeys.add(new RowSorter.SortKey(0, SortOrder.DESCENDING));
        sortKeys.add(new RowSorter.SortKey(1, SortOrder.ASCENDING));
        sorter.setSortKeys(sortKeys);
        sorter.sort();

        backButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                directoryQueue.pollLast();

                fillGrid();
            }
        });

        blobListTable.addMouseListener(new MouseAdapter() {
            public void mousePressed(MouseEvent me) {
                if (me.getComponent() instanceof JTable) {
                    int r = blobListTable.rowAtPoint(me.getPoint());

                    if (r >= 0 && r < blobListTable.getRowCount()) {
                        blobListTable.setRowSelectionInterval(r, r);
                    } else {
                        blobListTable.clearSelection();
                    }

                    int rowIndex = blobListTable.getSelectedRow();

                    if (rowIndex < 0) {
                        return;
                    }

                    if (me.getClickCount() == 2) {
                        tableSelection();
                    }

                    if (me.getButton() == 3) {
                        BlobFile fileSelection = getFileSelection();

                        if (fileSelection != null) {
                            JPopupMenu popup = createTablePopUp();
                            popup.show(me.getComponent(), me.getX(), me.getY());
                        }
                    }
                }
            }
        });

        blobListTable.addKeyListener(new KeyListener() {
            @Override
            public void keyTyped(KeyEvent keyEvent) {
            }

            @Override
            public void keyPressed(KeyEvent keyEvent) {
                if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
                    tableSelection();
                }
            }

            @Override
            public void keyReleased(KeyEvent keyEvent) {
            }
        });

        ActionListener queryAction = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                fileEditorVirtualNode.getNodeActionByName(QUERY).fireNodeActionEvent();
            }
        };

        refreshButton.addActionListener(queryAction);
        queryButton.addActionListener(queryAction);

        deleteButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                fileEditorVirtualNode.getNodeActionByName(DELETE).fireNodeActionEvent();
            }
        });

        saveAsButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                fileEditorVirtualNode.getNodeActionByName(SAVE_AS).fireNodeActionEvent();
            }
        });

        openButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                fileEditorVirtualNode.getNodeActionByName(OPEN).fireNodeActionEvent();
            }
        });

        uploadButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                fileEditorVirtualNode.getNodeActionByName(UPLOAD).fireNodeActionEvent();
            }
        });

        addSubscriptionSelectionListener();
    }