@Override
  public void onRemoveImport() {
    String selected = view.getSelected();
    if (selected == null) {
      view.showPleaseSelectAnImport();
    } else {
      final Import item = new Import(selected);
      view.removeImport(selected);
      resourceImports.removeImport(item);

      importRemovedEvent.fire(new ImportRemovedEvent(path, item));
    }
  }
  public void setImports(final Path path, final Imports resourceImports) {
    checkNotNull("path", path);
    checkNotNull("imports", resourceImports);
    checkNotNull("imports", resourceImports.getImports());

    this.path = path;
    this.resourceImports = resourceImports;

    for (Import item : resourceImports.getImports()) {
      view.addImport(item.getType());
    }
  }
 @Inject
 public ImportsWidgetPresenter(
     final ImportsWidgetView view,
     final FormPopup addImportPopup,
     final Event<ImportAddedEvent> importAddedEvent,
     final Event<ImportRemovedEvent> importRemovedEvent) {
   this.view = view;
   this.addImportPopup = addImportPopup;
   this.importAddedEvent = importAddedEvent;
   this.importRemovedEvent = importRemovedEvent;
   view.setPresenter(this);
 }
 @Override
 public void setNotDirty() {
   view.setNotDirty();
 }
 @Override
 public boolean isDirty() {
   return view.isDirty();
 }
 @Override
 public Widget asWidget() {
   return view.asWidget();
 }
  @Override
  public void setContent(final ProjectImports importTypes, final boolean isReadOnly) {
    checkNotNull("importTypes", importTypes);

    view.setContent(importTypes.getImports().getImports(), isReadOnly);
  }
 @Inject
 public ImportsWidgetPresenter(final ImportsWidgetView view) {
   this.view = view;
   view.init(this);
 }
 public void setReadOnly() {
   view.setupReadOnly();
 }