List<EntryInfo> entries = Lists.newArrayList();
// send palette broadcast
PaletteEventListener listener = frame.getBroadcast(PaletteEventListener.class);
listener.entries(category, entries);
// we should have exactly one entry
ToolEntryInfo toolEntry;
{
assertEquals(1, entries.size());
toolEntry = (ToolEntryInfo) entries.get(0);
}
// check Entry presentation
{
assertEquals(ObjectUtils.identityToString(prototype), toolEntry.getId());
assertThat(toolEntry.getName()).isEqualTo("first");
assertThat(toolEntry.getDescription()).contains("first()");
assertSame(prototype.getIcon(), toolEntry.getIcon());
}
// use this entry to create new Image widget
WidgetInfo newImage;
{
toolEntry.initialize(null, frame);
CreationTool creationTool = (CreationTool) toolEntry.createTool();
ICreationFactory creationFactory = creationTool.getFactory();
creationFactory.activate();
newImage = (WidgetInfo) creationFactory.getNewObject();
}
//