public WorkItemFloatParameterWidget(
      PortableFloatParameterDefinition ppd, IBindingProvider bindingProvider, boolean isReadOnly) {
    super(ppd, bindingProvider);
    this.parameterName.setText(ppd.getName());
    this.parameterEditor.setEnabled(!isReadOnly);

    // Setup widget to select a literal value
    if (ppd.getValue() != null) {
      this.parameterEditor.setText(Float.toString(ppd.getValue()));
    }

    // Setup widget to use bindings
    Set<String> bindings = bindingProvider.getBindings(ppd.getClassName());
    if (bindings.size() > 0) {
      lstAvailableBindings.clear();
      lstAvailableBindings.addItem(CommonConstants.INSTANCE.Choose());
      lstAvailableBindings.setEnabled(true && !isReadOnly);
      lstAvailableBindings.setVisible(true);
      int selectedIndex = 0;
      for (String binding : bindings) {
        lstAvailableBindings.addItem(binding);
        if (binding.equals(ppd.getBinding())) {
          selectedIndex = lstAvailableBindings.getItemCount() - 1;
        }
      }
      lstAvailableBindings.setSelectedIndex(selectedIndex);
      parameterEditor.setEnabled(selectedIndex == 0 && !isReadOnly);
    }
  }
 @Override
 public void onShowMetadata() {
   view.showBusyIndicator(CommonConstants.INSTANCE.Loading());
   metadataService
       .call(getMetadataSuccessCallback(), new HasBusyIndicatorDefaultErrorCallback(view))
       .getMetadata(path);
 }
  private ValidationPopup() {
    setTitle(CommonConstants.INSTANCE.ValidationErrors());
    setHideOthers(false);

    add(uiBinder.createAndBindUi(this));
    add(
        new ModalFooterOKButton(
            new Command() {
              @Override
              public void execute() {
                hide();
              }
            }));

    final ValidationMessageLevelColumn validationMessageLevelColumn =
        new ValidationMessageLevelColumn() {

          @Override
          public ValidationMessage.Level getValue(final ValidationMessage msg) {
            return msg.getLevel();
          }
        };
    table.addColumn(validationMessageLevelColumn);
    table.setColumnWidth(validationMessageLevelColumn, "32px");
    table.addColumn(
        new TextColumn<ValidationMessage>() {

          @Override
          public String getValue(final ValidationMessage msg) {
            return msg.getText();
          }
        });
  }
 public ResetPerspectivesMenuBuilder() {
   link.setIcon(IconType.MEDKIT);
   link.setTitle(CommonConstants.INSTANCE.ResetPerspectivesTooltip());
   link.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           if (Window.confirm(CommonConstants.INSTANCE.PromptResetPerspectives())) {
             final PerspectiveActivity currentPerspective =
                 perspectiveManager.getCurrentPerspective();
             perspectiveManager.removePerspectiveStates(
                 new Command() {
                   @Override
                   public void execute() {
                     if (currentPerspective != null) {
                       // Use ForcedPlaceRequest to force re-loading of the current Perspective
                       final PlaceRequest pr =
                           new ForcedPlaceRequest(
                               currentPerspective.getIdentifier(),
                               currentPerspective.getPlace().getParameters());
                       placeManager.goTo(pr);
                     }
                   }
                 });
           }
         }
       });
 }
 public void onRestore(@Observes RestoreEvent restore) {
   if (path == null || restore == null || restore.getPath() == null) {
     return;
   }
   if (path.equals(restore.getPath())) {
     loadContent();
     notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemRestored()));
   }
 }
  @Before
  public void setup() {
    ApplicationPreferences.setUp(new HashMap<String, String>());

    // The BuildOptions widget is manipulated in the Presenter so we need some nasty mocking
    when(view.getBuildOptionsButton()).thenReturn(buildOptions);
    when(buildOptions.getWidget(eq(0))).thenReturn(buildOptionsButton1);
    when(buildOptions.getWidget(eq(1))).thenReturn(buildOptionsMenu);
    when(buildOptionsMenu.getWidget(eq(0))).thenReturn(buildOptionsMenuButton1);
    when(buildOptionsMenu.getWidget(eq(1))).thenReturn(buildOptionsMenuButton1);

    constructProjectScreenPresenter(
        new CallerMock<BuildService>(buildService),
        new CallerMock<AssetManagementService>(assetManagementServiceMock));

    // Mock ProjectScreenService
    final POM pom = new POM(new GAV("groupId", "artifactId", "version"));
    model = new ProjectScreenModel();
    model.setPOM(pom);
    when(projectScreenService.load(any(org.uberfire.backend.vfs.Path.class))).thenReturn(model);

    // Mock BuildService
    when(buildService.buildAndDeploy(any(Project.class))).thenReturn(new BuildResults());

    // Mock LockManager initialisation
    final Path path = mock(Path.class);
    final Metadata pomMetadata = mock(Metadata.class);
    model.setPOMMetaData(pomMetadata);
    when(pomMetadata.getPath()).thenReturn(path);
    final Metadata kmoduleMetadata = mock(Metadata.class);
    model.setKModuleMetaData(kmoduleMetadata);
    when(kmoduleMetadata.getPath()).thenReturn(path);
    final Metadata importsMetadata = mock(Metadata.class);
    model.setProjectImportsMetaData(importsMetadata);
    when(importsMetadata.getPath()).thenReturn(path);

    // Mock ProjectContext
    final Repository repository = mock(Repository.class);
    when(context.getActiveRepository()).thenReturn(repository);
    when(repository.getAlias()).thenReturn("repository");
    when(repository.getCurrentBranch()).thenReturn("master");

    final Project project = mock(Project.class);
    when(project.getProjectName()).thenReturn("project");

    when(context.getActiveProject()).thenReturn(project);

    // Trigger initialisation of view. Unfortunately this is the only way to initialise a Project in
    // the Presenter
    context.onProjectContextChanged(
        new ProjectContextChangeEvent(mock(OrganizationalUnit.class), repository, project));

    verify(view, times(1)).showBusyIndicator(eq(CommonConstants.INSTANCE.Loading()));
    verify(view, times(1)).hideBusyIndicator();
  }
 public AboutMenuBuilder() {
   link.setIcon(IconType.INFO_CIRCLE);
   link.setTitle(CommonConstants.INSTANCE.About());
   link.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           popup.show();
         }
       });
 }
 @Override
 public void create(
     final Package pkg, final String baseFileName, final NewResourcePresenter presenter) {
   busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
   solverService
       .call(
           getSuccessCallback(presenter),
           new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView))
       .create(
           pkg.getPackageMainResourcesPath(), buildFileName(baseFileName, resourceType), "", "");
 }
  @OnStartup
  public void init(final Path path) {
    this.path = checkNotNull("path", path);

    makeMenuBar();

    view.showBusyIndicator(CommonConstants.INSTANCE.Loading());

    projectService
        .call(getModelSuccessCallback(), new HasBusyIndicatorDefaultErrorCallback(view))
        .load(path);
  }
  protected void addSourcePage() {

    addPage(
        new PageImpl(view.getSourceEditor(), CommonConstants.INSTANCE.SourceTabTitle()) {
          @Override
          public void onFocus() {
            onSourceTabSelected();
          }

          @Override
          public void onLostFocus() {}
        });
  }
  private void addSourceEditorPage() {
    addPage(
        new PageImpl(
            javaSourceEditor,
            org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE
                .SourceTabTitle()) {
          @Override
          public void onFocus() {
            if (uiStarted) {
              onSourceTabSelected();
            }
          }

          @Override
          public void onLostFocus() {}
        });
  }
 private void openDataObject(final DataObject dataObject) {
   final Path objectPath = getContext().getDataObjectPath(dataObject.getClassName());
   if (objectPath != null) {
     BusyPopup.showMessage(
         org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE
             .Loading());
     modelerService
         .call(
             new RemoteCallback<Boolean>() {
               @Override
               public void callback(Boolean exists) {
                 BusyPopup.close();
                 if (Boolean.TRUE.equals(exists)) {
                   placeManager.goTo(new PathPlaceRequest(objectPath));
                 } else {
                   YesNoCancelPopup yesNoCancelPopup =
                       YesNoCancelPopup.newYesNoCancelPopup(
                           CommonConstants.INSTANCE.Warning(),
                           Constants.INSTANCE.objectBrowser_message_file_not_exists_or_renamed(
                               objectPath.toURI()),
                           new Command() {
                             @Override
                             public void execute() {
                               // do nothing.
                             }
                           },
                           CommonConstants.INSTANCE.Close(),
                           ButtonType.WARNING,
                           null,
                           null,
                           null,
                           null,
                           null,
                           null);
                   yesNoCancelPopup.setClosable(false);
                   yesNoCancelPopup.show();
                 }
               }
             },
             new DataModelerErrorCallback(
                 CommonConstants.INSTANCE.ExceptionNoSuchFile0(objectPath.toURI())))
         .exists(objectPath);
   }
 }
  public TextBoxFormPopupViewImpl() {
    final ModalFooterOKCancelButtons footer =
        new ModalFooterOKCancelButtons(
            new Command() {
              @Override
              public void execute() {
                presenter.onOk();
                hide();
              }
            },
            new Command() {
              @Override
              public void execute() {
                hide();
              }
            });

    add(uiBinder.createAndBindUi(this));
    add(footer);
    setTitle(CommonConstants.INSTANCE.New());
  }
  @Override
  public void activeFolderItemSelected(final FolderItem item) {
    if (Utils.hasFolderItemChanged(item, activeFolderItem)) {
      activeFolderItem = item;
      fireContextChangeEvent();

      // Show busy popup. Once Items are loaded it is closed
      getView().showBusyIndicator(CommonConstants.INSTANCE.Loading());
      explorerService
          .call(
              new RemoteCallback<FolderListing>() {
                @Override
                public void callback(final FolderListing folderListing) {
                  loadContent(folderListing);
                  getView().setItems(folderListing);
                  getView().hideBusyIndicator();
                }
              },
              new HasBusyIndicatorDefaultErrorCallback(getView()))
          .getFolderListing(
              activeOrganizationalUnit, activeRepository, activeProject, item, getActiveOptions());
    }
  }
Beispiel #15
0
  public CopyPopup(
      final Path path,
      final Validator validator,
      final CommandWithFileNameAndCommitMessage command) {
    super(CommonImages.INSTANCE.edit(), CommonConstants.INSTANCE.CopyPopupTitle());

    checkNotNull("validator", validator);
    checkNotNull("path", path);
    checkNotNull("command", command);

    // Make sure it appears on top of other popups
    getElement().getStyle().setZIndex(Integer.MAX_VALUE);
    setGlassEnabled(true);

    nameTextBox.setTitle(CommonConstants.INSTANCE.NewName());
    nameTextBox.setWidth("200px");
    addAttribute(CommonConstants.INSTANCE.NewNameColon(), nameTextBox);

    checkInCommentTextBox.setTitle(CommonConstants.INSTANCE.CheckInComment());
    checkInCommentTextBox.setWidth("200px");
    addAttribute(CommonConstants.INSTANCE.CheckInCommentColon(), checkInCommentTextBox);

    final HorizontalPanel hp = new HorizontalPanel();
    final Button create = new Button(CommonConstants.INSTANCE.CopyPopupCreateACopy());
    create.addClickHandler(
        new ClickHandler() {
          public void onClick(final ClickEvent arg0) {

            final String baseFileName = nameTextBox.getText();
            final String originalFileName = path.getFileName();
            final String extension =
                (originalFileName.lastIndexOf(".") > 0
                    ? originalFileName.substring(originalFileName.lastIndexOf("."))
                    : "");
            final String fileName = baseFileName + extension;

            validator.validate(
                fileName,
                new ValidatorCallback() {
                  @Override
                  public void onSuccess() {
                    hide();
                    command.execute(
                        new FileNameAndCommitMessage(
                            baseFileName, checkInCommentTextBox.getText()));
                  }

                  @Override
                  public void onFailure() {
                    Window.alert(CommonConstants.INSTANCE.InvalidFileName0(baseFileName));
                  }
                });
          }
        });
    hp.add(create);

    final Button cancel = new Button(CommonConstants.INSTANCE.Cancel());
    cancel.addClickHandler(
        new ClickHandler() {
          public void onClick(final ClickEvent arg0) {
            hide();
          }
        });
    hp.add(new HTML("&nbsp"));
    hp.add(cancel);
    addAttribute("", hp);
  }
  private void doInitialiseViewForActiveContext(
      final OrganizationalUnit organizationalUnit,
      final Repository repository,
      final Project project,
      final Package pkg,
      final FolderItem folderItem,
      final boolean showLoadingIndicator) {

    if (showLoadingIndicator) {
      getView().showBusyIndicator(CommonConstants.INSTANCE.Loading());
    }

    explorerService
        .call(
            new RemoteCallback<ProjectExplorerContent>() {
              @Override
              public void callback(final ProjectExplorerContent content) {

                boolean signalChange = false;
                boolean buildSelectedProject = false;

                if (Utils.hasOrganizationalUnitChanged(
                    content.getOrganizationalUnit(), activeOrganizationalUnit)) {
                  signalChange = true;
                  activeOrganizationalUnit = content.getOrganizationalUnit();
                  getView().getExplorer().clear();
                }
                if (Utils.hasRepositoryChanged(content.getRepository(), activeRepository)) {
                  signalChange = true;
                  activeRepository = content.getRepository();
                  getView().getExplorer().clear();
                }
                if (Utils.hasProjectChanged(content.getProject(), activeProject)) {
                  signalChange = true;
                  buildSelectedProject = true;
                  activeProject = content.getProject();
                  getView().getExplorer().clear();
                }
                if (Utils.hasFolderItemChanged(
                    content.getFolderListing().getItem(), activeFolderItem)) {
                  signalChange = true;
                  activeFolderItem = content.getFolderListing().getItem();
                  if (activeFolderItem != null
                      && activeFolderItem.getItem() != null
                      && activeFolderItem.getItem() instanceof Package) {
                    activePackage = (Package) activeFolderItem.getItem();
                  } else if (activeFolderItem == null || activeFolderItem.getItem() == null) {
                    activePackage = null;
                  }
                }

                if (signalChange) {
                  fireContextChangeEvent();
                }

                if (buildSelectedProject) {
                  buildProject(activeProject);
                }

                activeContent = content.getFolderListing();

                getView()
                    .setContent(
                        content.getOrganizationalUnits(),
                        activeOrganizationalUnit,
                        content.getRepositories(),
                        activeRepository,
                        content.getProjects(),
                        activeProject,
                        content.getFolderListing());

                getView().hideBusyIndicator();
              }
            },
            new HasBusyIndicatorDefaultErrorCallback(getView()))
        .getContent(organizationalUnit, repository, project, pkg, folderItem, getActiveOptions());
  }
  @Override
  public boolean error(final Message message, final Throwable throwable) {
    try {
      throw throwable;

    } catch (org.uberfire.java.nio.file.AccessDeniedException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.AtomicMoveNotSupportedException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.ClosedWatchServiceException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.DirectoryNotEmptyException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.FileAlreadyExistsException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionFileAlreadyExists0(e.getFile()));

    } catch (PackageAlreadyExistsException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionPackageAlreadyExists0(e.getFile()));

    } catch (org.uberfire.java.nio.file.FileSystemAlreadyExistsException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.FileSystemNotFoundException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.InvalidPathException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionInvalidPath());

    } catch (org.uberfire.java.nio.file.NoSuchFileException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionNoSuchFile0(e.getFile()));

    } catch (org.uberfire.java.nio.file.NotDirectoryException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.NotLinkException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.PatternSyntaxException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.ProviderNotFoundException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (org.uberfire.java.nio.file.FileSystemException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (IOException e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));

    } catch (Throwable e) {
      ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));
    }
    return false;
  }
 public Image RuleAsset() {
   Image image = new Image(TestScenarioImages.INSTANCE.RuleAsset());
   image.setAltText(CommonConstants.INSTANCE.RuleAsset());
   return image;
 }
 @Override
 public void showLoadingIndicator() {
   showBusyIndicator(CommonConstants.INSTANCE.Loading());
 }
  @OnStartup
  public void onStartup(final ObservablePath path, final PlaceRequest place) {
    this.path = path;
    this.place = place;
    this.isReadOnly = place.getParameter("readOnly", null) == null ? false : true;
    this.version = place.getParameter("version", null);

    this.path.onRename(
        new Command() {
          @Override
          public void execute() {
            changeTitleNotification.fire(new ChangeTitleWidgetEvent(place, getTitle(), null));
          }
        });
    this.path.onConcurrentUpdate(
        new ParameterizedCommand<ObservablePath.OnConcurrentUpdateEvent>() {
          @Override
          public void execute(final ObservablePath.OnConcurrentUpdateEvent eventInfo) {
            concurrentUpdateSessionInfo = eventInfo;
          }
        });

    this.path.onConcurrentRename(
        new ParameterizedCommand<ObservablePath.OnConcurrentRenameEvent>() {
          @Override
          public void execute(final ObservablePath.OnConcurrentRenameEvent info) {
            newConcurrentRename(
                    info.getSource(),
                    info.getTarget(),
                    info.getIdentity(),
                    new Command() {
                      @Override
                      public void execute() {
                        disableMenus();
                      }
                    },
                    new Command() {
                      @Override
                      public void execute() {
                        reload();
                      }
                    })
                .show();
          }
        });

    this.path.onConcurrentDelete(
        new ParameterizedCommand<ObservablePath.OnConcurrentDelete>() {
          @Override
          public void execute(final ObservablePath.OnConcurrentDelete info) {
            newConcurrentDelete(
                    info.getPath(),
                    info.getIdentity(),
                    new Command() {
                      @Override
                      public void execute() {
                        disableMenus();
                      }
                    },
                    new Command() {
                      @Override
                      public void execute() {
                        placeManager.closePlace(place);
                      }
                    })
                .show();
          }
        });

    makeMenuBar();

    view.showBusyIndicator(CommonConstants.INSTANCE.Loading());

    multiPage.addWidget(view, DSLTextEditorConstants.INSTANCE.DSL());

    multiPage.addPage(
        new Page(metadataWidget, CommonConstants.INSTANCE.MetadataTabTitle()) {
          @Override
          public void onFocus() {
            metadataWidget.showBusyIndicator(CommonConstants.INSTANCE.Loading());
            metadataService
                .call(
                    new MetadataSuccessCallback(metadataWidget, isReadOnly),
                    new HasBusyIndicatorDefaultErrorCallback(metadataWidget))
                .getMetadata(path);
          }

          @Override
          public void onLostFocus() {
            // Nothing to do
          }
        });

    loadContent();
  }
 public Image MoveUp() {
   Image image = new Image(CommonImages.INSTANCE.shuffleUp());
   image.setAltText(CommonConstants.INSTANCE.MoveUp());
   return image;
 }
public class FactTypeBrowserWidget extends Composite implements UberView<DRLEditorPresenter> {

  private static final String LAZY_LOAD = CommonConstants.INSTANCE.Loading();

  private DRLEditorPresenter presenter;

  private final Tree tree;

  public FactTypeBrowserWidget(final ClickEvent ev) {
    this.tree = new Tree();

    final VerticalPanel panel = new VerticalPanel();
    final HorizontalPanel hpFactsAndHide = new HorizontalPanel();
    final HorizontalPanel hpShow = new HorizontalPanel();

    hpShow.add(
        new ClickableLabel(
            DRLTextEditorConstants.INSTANCE.ShowFactTypes(),
            new ClickHandler() {
              public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
                hpShow.setVisible(false);
                hpFactsAndHide.setVisible(true);
                tree.setVisible(true);
              }
            }));
    panel.add(hpShow);

    hpFactsAndHide.add(new SmallLabel(DRLTextEditorConstants.INSTANCE.FactTypes()));
    hpFactsAndHide.add(
        new ClickableLabel(
            DRLTextEditorConstants.INSTANCE.hide(),
            new ClickHandler() {
              public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
                hpShow.setVisible(true);
                hpFactsAndHide.setVisible(false);
                tree.setVisible(false);
              }
            }));
    panel.add(hpFactsAndHide);

    panel.add(tree);

    tree.setStyleName(DRLTextEditorResources.INSTANCE.CSS().categoryExplorerTree());
    tree.addSelectionHandler(
        new SelectionHandler<TreeItem>() {
          public void onSelection(SelectionEvent<TreeItem> event) {
            Object o = event.getSelectedItem().getUserObject();
            if (o instanceof ClassUserObject) {
              ev.selected(((ClassUserObject) o).textToInsert);
            } else if (o instanceof String) {
              ev.selected((String) o);
            }
          }
        });

    tree.addOpenHandler(
        new OpenHandler<TreeItem>() {
          @Override
          public void onOpen(final OpenEvent<TreeItem> event) {
            final TreeItem item = event.getTarget();
            if (needsLoading(item)) {
              final Object userObject = event.getTarget().getUserObject();
              presenter.loadClassFields(
                  ((ClassUserObject) userObject).fullyQualifiedClassName,
                  new Callback<List<String>>() {
                    @Override
                    public void callback(final List<String> fields) {
                      item.getChild(0).remove();
                      if (fields != null) {
                        for (String field : fields) {
                          final TreeItem fi = new TreeItem();
                          fi.setHTML(
                              AbstractImagePrototype.create(
                                          DRLTextEditorResources.INSTANCE.images().fieldImage())
                                      .getHTML()
                                  + "<small>"
                                  + field
                                  + "</small>");
                          fi.setUserObject(field);
                          item.addItem(fi);
                        }
                      }
                    }
                  });
            }
          }
        });

    tree.setVisible(false);
    hpFactsAndHide.setVisible(false);
    hpShow.setVisible(true);

    initWidget(panel);
  }

  @Override
  public void init(final DRLEditorPresenter presenter) {
    this.presenter = presenter;
  }

  public void setFullyQualifiedClassNames(final List<String> fullyQualifiedClassNames) {
    if (tree.getItem(0) != null) {
      tree.clear();
    }

    if (fullyQualifiedClassNames != null) {
      for (String type : fullyQualifiedClassNames) {
        final TreeItem it = new TreeItem();
        it.setHTML(
            AbstractImagePrototype.create(DRLTextEditorResources.INSTANCE.images().classImage())
                    .getHTML()
                + "<small>"
                + type
                + "</small>");
        it.setUserObject(new ClassUserObject(type + "( )", type));
        tree.addItem(it);
        it.addItem(Util.toSafeHtml(LAZY_LOAD));
      }
    }
  }

  private boolean needsLoading(final TreeItem item) {
    return item.getChildCount() == 1 && LAZY_LOAD.equals(item.getChild(0).getText());
  }

  public static interface ClickEvent {

    public void selected(String text);
  }

  private static class ClassUserObject {

    private String textToInsert;
    private String fullyQualifiedClassName;

    ClassUserObject(final String textToInsert, final String fullyQualifiedClassName) {
      this.textToInsert = textToInsert;
      this.fullyQualifiedClassName = fullyQualifiedClassName;
    }
  }
}
 public Image NewItemBelow() {
   Image image = new Image(CommonImages.INSTANCE.newItemBelow());
   image.setAltText(CommonConstants.INSTANCE.NewItemBelow());
   return image;
 }
 public Image DeleteItemSmall() {
   Image image = new Image(CommonImages.INSTANCE.DeleteItemSmall());
   image.setAltText(CommonConstants.INSTANCE.DeleteItem());
   return image;
 }
 public Image Edit() {
   final Image image = new Image(CommonImages.INSTANCE.edit());
   image.setAltText(CommonConstants.INSTANCE.Edit());
   return image;
 }
 @Override
 public void showFieldEmptyWarning() {
   ErrorPopup.showMessage(CommonConstants.INSTANCE.PleaseSetAName());
 }
 private void reload() {
   changeTitleNotification.fire(new ChangeTitleWidgetEvent(place, getTitle(), null));
   view.showBusyIndicator(CommonConstants.INSTANCE.Loading());
   loadContent();
 }