예제 #1
0
  @Override
  public void onSelectionChanged(SelectionChangedEvent event) {
    final Selection<?> selection = event.getSelection();
    if (selection instanceof Selection.NoSelectionProvided) {
      return;
    }

    if (selection == null) {
      currentProject = null;
      browserQueryFieldRenderer.setProjectName("");
      return;
    }

    final Object headElement = selection.getHeadElement();
    if (headElement == null) {
      currentProject = null;
      browserQueryFieldRenderer.setProjectName("");
      return;
    }

    currentProject = new CurrentProject();

    if (headElement instanceof HasProjectConfig) {
      final HasProjectConfig hasProjectConfig = (HasProjectConfig) headElement;
      final ProjectConfigDto module = (hasProjectConfig).getProjectConfig();
      currentProject.setProjectConfig(module);
      eventBus.fireEvent(new CurrentProjectChangedEvent(module));
    }

    if (headElement instanceof Node) {
      ProjectConfigDto rootConfig = getRootConfig((Node) headElement);
      if (rootConfig == null) {
        rootConfig = currentProject.getProjectConfig();
      }
      currentProject.setRootProject(rootConfig);
      browserQueryFieldRenderer.setProjectName(rootConfig.getName());
    }
  }
예제 #2
0
  @Override
  public void onProjectUpdated(ProjectUpdatedEvent event) {
    final ProjectConfigDto updatedProjectDescriptor = event.getUpdatedProjectDescriptor();
    final String updatedProjectDescriptorPath = updatedProjectDescriptor.getPath();

    if (updatedProjectDescriptorPath.equals(currentProject.getProjectConfig().getPath())) {
      currentProject.setProjectConfig(updatedProjectDescriptor);
      eventBus.fireEvent(new CurrentProjectChangedEvent(updatedProjectDescriptor));
    }

    if (updatedProjectDescriptorPath.equals(currentProject.getRootProject().getPath())) {
      currentProject.setRootProject(updatedProjectDescriptor);
      browserQueryFieldRenderer.setProjectName(updatedProjectDescriptor.getName());
    }
  }
예제 #3
0
 @Override
 public void onExtServerStopped(ExtServerStateEvent event) {
   currentProject = null;
   browserQueryFieldRenderer.setProjectName("");
 }