@Override public void init(IWorkbench workbench, IStructuredSelection selection) { if (model.getConnection() != null && model.getSelectedItem() != null) { return; } Connection connection = UIUtils.getFirstElement(selection, Connection.class); if (connection != null) { model.setConnection(connection); } else { IResource resource = UIUtils.getFirstElement(selection, IResource.class); if (resource != null) { setModelConnection(ConnectionsRegistryUtil.safeGetConnectionFor(resource)); model.setSelectedItem(resource); } else { IProject project = UIUtils.getFirstElement(selection, IProject.class); if (project != null) { setModelConnection(ConnectionsRegistryUtil.safeGetConnectionFor(project)); model.setSelectedItem(project); } else { ResourceGrouping grouping = UIUtils.getFirstElement(selection, ResourceGrouping.class); if (grouping != null) { setModelConnection(ConnectionsRegistryUtil.safeGetConnectionFor(grouping.getProject())); model.setSelectedItem(grouping.getProject()); } } } } }
private void showHideUserdocLink() { boolean signupUrlExists = !StringUtils.isEmpty(pageModel.getUserdocUrl()); if (signupUrlExists) { IConnectionFactory factory = pageModel.getConnectionFactory(); if (factory != null) { StyledTextUtils.emulateLinkWidget( NLS.bind( "New to OpenShift {0}? Explore the <a>getting started documentation</a>.", factory.getName()), userdocLink); } } UIUtils.setVisibleAndExclude(signupUrlExists, userdocLink); }