Search in sources :

Example 1 with TableEntityForm

use of com.microsoft.intellij.forms.TableEntityForm in project azure-tools-for-java by Microsoft.

the class TableFileEditor method createFileEditorVirtualNode.

private FileEditorVirtualNode createFileEditorVirtualNode(final String name) {
    FileEditorVirtualNode fileEditorVirtualNode = new FileEditorVirtualNode(this, name);
    fileEditorVirtualNode.addAction(EDIT, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) {
            editEntity();
        }
    });
    fileEditorVirtualNode.addAction(DELETE, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) {
            deleteSelection();
        }
    });
    fileEditorVirtualNode.addAction(QUERY, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) {
            fillGrid();
        }
    });
    fileEditorVirtualNode.addAction(QUERY_DESIGNER, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) {
            final TablesQueryDesigner form = new TablesQueryDesigner(project);
            form.setOnFinish(new Runnable() {

                @Override
                public void run() {
                    queryTextField.setText(form.getQueryText());
                }
            });
            form.show();
        }
    });
    fileEditorVirtualNode.addAction(NEW_ENTITY, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) {
            final TableEntityForm form = new TableEntityForm(project);
            form.setTableName(table.getName());
            form.setStorageAccount(storageAccount);
            form.setTableEntity(null);
            form.setTableEntityList(tableEntities);
            form.setTitle("Add Entity");
            form.setOnFinish(new Runnable() {

                @Override
                public void run() {
                    tableEntities.add(form.getTableEntity());
                    refreshGrid();
                }
            });
            form.show();
        }
    });
    return fileEditorVirtualNode;
}
Also used : TableEntityForm(com.microsoft.intellij.forms.TableEntityForm) TablesQueryDesigner(com.microsoft.intellij.forms.TablesQueryDesigner) NodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener) NodeActionEvent(com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent)

Example 2 with TableEntityForm

use of com.microsoft.intellij.forms.TableEntityForm in project azure-tools-for-java by Microsoft.

the class TableFileEditor method editEntity.

private void editEntity() {
    TableEntity[] selectedEntities = getSelectedEntities();
    if (selectedEntities != null && selectedEntities.length > 0) {
        final TableEntity selectedEntity = selectedEntities[0];
        final TableEntityForm form = new TableEntityForm(project);
        form.setTableName(table.getName());
        form.setStorageAccount(storageAccount);
        form.setTableEntity(selectedEntity);
        form.setTitle("Edit Entity");
        form.setOnFinish(new Runnable() {

            @Override
            public void run() {
                tableEntities.set(entitiesTable.getSelectedRow(), form.getTableEntity());
                refreshGrid();
            }
        });
        form.show();
    }
}
Also used : TableEntityForm(com.microsoft.intellij.forms.TableEntityForm) TableEntity(com.microsoft.tooling.msservices.model.storage.TableEntity)

Aggregations

TableEntityForm (com.microsoft.intellij.forms.TableEntityForm)2 TablesQueryDesigner (com.microsoft.intellij.forms.TablesQueryDesigner)1 TableEntity (com.microsoft.tooling.msservices.model.storage.TableEntity)1 NodeActionEvent (com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent)1 NodeActionListener (com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener)1