Search in sources :

Example 1 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project buck by facebook.

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuildEndThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuildEndThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeBuildEnd(0);
    assertFalse(listener.calledOnWrongThread);
}
Also used : MockTreeModelListener(com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Test(org.junit.Test)

Example 2 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project buck by facebook.

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeParseRuleEndThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeParseRuleEndThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeParseRuleEnd(0);
    assertFalse(listener.calledOnWrongThread);
}
Also used : MockTreeModelListener(com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Test(org.junit.Test)

Example 3 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project buck by facebook.

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeParseRuleStartThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeParseRuleStartThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeParseRuleStart(0);
    assertFalse(listener.calledOnWrongThread);
}
Also used : MockTreeModelListener(com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Test(org.junit.Test)

Example 4 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project buck by facebook.

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeCompilerErrorThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeCompilerErrorThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeCompilerError("", 0, "", ImmutableSet.<String>of());
    assertFalse(listener.calledOnWrongThread);
}
Also used : MockTreeModelListener(com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Test(org.junit.Test)

Example 5 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project buck by facebook.

the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuckBuildProgressUpdateThenFail.

@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuckBuildProgressUpdateThenFail() {
    DefaultTreeModel treeModel = new DefaultTreeModel(null);
    BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
    MockTreeModelListener listener = addListeners(treeModel);
    buckEventsConsumer.attach(null, treeModel);
    assertFalse(listener.calledOnWrongThread);
    assertTrue(buckEventsConsumer.isAttached());
    buckEventsConsumer.consumeBuckBuildProgressUpdate(0, 0);
    assertFalse(listener.calledOnWrongThread);
}
Also used : MockTreeModelListener(com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Test(org.junit.Test)

Aggregations

DefaultTreeModel (javax.swing.tree.DefaultTreeModel)362 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)204 TreePath (javax.swing.tree.TreePath)99 JTree (javax.swing.JTree)30 JScrollPane (javax.swing.JScrollPane)25 Test (org.junit.Test)24 Tree (com.intellij.ui.treeStructure.Tree)23 TreeNode (javax.swing.tree.TreeNode)22 ArrayList (java.util.ArrayList)21 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)20 TreeSelectionListener (javax.swing.event.TreeSelectionListener)18 MockTreeModelListener (com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener)16 MouseEvent (java.awt.event.MouseEvent)16 List (java.util.List)16 JPanel (javax.swing.JPanel)16 BorderLayout (java.awt.BorderLayout)14 DefaultTreeCellRenderer (javax.swing.tree.DefaultTreeCellRenderer)14 IOException (java.io.IOException)12 Dimension (java.awt.Dimension)11 ActionEvent (java.awt.event.ActionEvent)11