actions are duplicated

I’ve got a table where I want to add context menu

[code]
@Component(“allProjectsTable”)
@Scope(“prototype”)
public class AllProjectsTable extends AbstractTable {

@Autowired
private ProjectService projectService;

@Autowired
private AllProjectTableActionHandler allProjectTableActionHandler;

@Autowired
private AllProjectTableItemClickListener allProjectTableItemClickListener;

@Override
public void attach() {
    if (filter) {
        setContainerDataSource(loadFilteredData());
    }
    else {
        setContainerDataSource(loadData());
    }
    setVisibleColumns(StringValues.ALL_PROJECTS_HEADERS);
    setSelectable(true);
    setImmediate(true);
    setCaption(StringValues.ALL_PROJECTS_TABLE_CAPTION);
    setWidth("700px");

    this.addActionHandler(allProjectTableActionHandler.addAction(new Action("+New...")));
    this.addItemClickListener(allProjectTableItemClickListener);
    super.attach();
}

@Override
public IndexedContainer loadData() {
    IndexedContainer indexedContainer = new IndexedContainer();

    for(String header: StringValues.ALL_PROJECTS_HEADERS) {
        indexedContainer.addContainerProperty(header, String.class, "");
    }

    List<Project> projects = projectService.findAllProjects();

    for(int i = 0; i < projects.size(); i++) {
        Object id = indexedContainer.addItem();
        Project item = projects.get(i);
        indexedContainer.getContainerProperty(id, StringValues.ALL_PROJECTS_HEADERS[1]

).setValue(item.getProjectName());
indexedContainer.getContainerProperty(id, StringValues.ALL_PROJECTS_HEADERS[2]
).setValue(item.getProjectOwner());
indexedContainer.getContainerProperty(id, StringValues.ALL_PROJECTS_HEADERS[0]
).setValue(item.getProjectId());
}

    return indexedContainer;
}

@Override
public IndexedContainer loadFilteredData() {
    // TODO Auto-generated method stub
    return null;
}

}
[/code]My
allProjectTableActionHandler
looks like this

[code]
@Component(“allProjectsTableActionHandler”)
public class AllProjectTableActionHandler implements Handler {

@Autowired
private NewProjectModalWindow newProjectModalWindow;

List<Action> actions = new ArrayList<>();
Action[] array = null;

public AllProjectTableActionHandler addAction(Action action) {
    actions.add(action);
    array = new Action[actions.size()]

;

    return this;
}

@Override
public Action[] getActions(Object target, Object sender) {
    return actions.toArray(array);
}

@Override
public void handleAction(Action action, Object sender, Object target) {
    switch(action.getCaption()) {
        case "+New...": {
            PmcUi.getCurrent().addWindow(newProjectModalWindow);
            break;
        }
    }
}

}
[/code]I add my table component to a tab

[code]
@org.springframework.stereotype.Component(“mainTab”)
@Scope(“prototype”)
public class MainTab extends TabSheet {

@Autowired
private AllProjectsTable allProjectsTable;

@Override
public void attach() {
    Component[] content = { allProjectsTable };
    for(int i = 0; i < content.length; i++) {
        addTab(content[i]

, StringValues.ALL_MAIN_PAGE_TABS[i]
);
}

    super.attach();
}

}
[/code]And this tab I add to my UI

[code]
@Title(“PMC”)
@Component(“pmcVaadin”)
@Scope(“prototype”)
public class PmcUi extends UI {

@Autowired
private MainTab mainTab;

@Override
protected void init(VaadinRequest request) {
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.addComponent(mainTab);
    setContent(mainLayout);
}

}
[/code]However when I do right click on the page - it at first shows two menu items.( It should be only one).
But when I refresh a table multiple times - it continue to add more and more duplicates to this.

What’s the problem?
17491.png