ItemPresentation (Project project, ServiceViewModel viewModel, ServiceViewState viewState) { if (viewModel instanceof ContributorModel) { return ((ContributorModel)viewModel).getContributor().getViewDescriptor(project).getContentPresentation(); } else if (viewModel instanceof GroupModel) { return ((GroupModel)viewModel).getGroup().getViewDescriptor().getContentPresentation(); } else if (viewModel instanceof SingeServiceModel) { return ((SingeServiceModel)viewModel).getService().getViewDescriptor().getContentPresentation(); } else if (viewModel instanceof ServiceListModel) { List<ServiceViewItem> items = ((ServiceListModel)viewModel).getItems(); if (items.size() == 1) { return items.get(0).getViewDescriptor().getContentPresentation(); } String name = viewState.id; if (StringUtil.isEmpty(name)) { name = Messages.showInputDialog(project, ExecutionBundle.message("service.view.group.label"), ExecutionBundle.message("service.view.group.title"), null, null, null); if (StringUtil.isEmpty(name)) return null; } return new PresentationData(name, null, AllIcons.Nodes.Folder, null); } return null; }