@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()); } }
@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()); } }
@Override public void onExtServerStopped(ExtServerStateEvent event) { currentProject = null; browserQueryFieldRenderer.setProjectName(""); }