Search in sources :

Example 1 with GradleEditorNotificationListener

use of com.android.tools.idea.gradle.editor.GradleEditorNotificationListener in project android by JetBrains.

the class GradleEditorCellComponentImpl method getValue.

@Override
@Nullable
public Object getValue(@NotNull Project project) {
    GradleEditorEntityTableModel model = myTable.getModel();
    if (myUis == null || myRow < 0 || myRow >= model.getRowCount()) {
        return null;
    }
    final GradleEditorEntity entity = (GradleEditorEntity) model.getValueAt(myRow, 0);
    GradleEditorNotificationListener publisher = project.getMessageBus().syncPublisher(GradleEditorNotificationListener.TOPIC);
    publisher.beforeChange();
    try {
        WriteCommandAction.runWriteCommandAction(project, new Runnable() {

            @SuppressWarnings("unchecked")
            @Override
            public void run() {
                for (GradleEditorEntityUi ui : myUis) {
                    ui.flush(entity);
                }
            }
        });
    } finally {
        publisher.afterChange();
    }
    return entity;
}
Also used : GradleEditorNotificationListener(com.android.tools.idea.gradle.editor.GradleEditorNotificationListener) GradleEditorEntity(com.android.tools.idea.gradle.editor.entity.GradleEditorEntity) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

GradleEditorNotificationListener (com.android.tools.idea.gradle.editor.GradleEditorNotificationListener)1 GradleEditorEntity (com.android.tools.idea.gradle.editor.entity.GradleEditorEntity)1 Nullable (org.jetbrains.annotations.Nullable)1