use of org.eclipse.wst.server.core.IServer in project jbosstools-openshift by jbosstools.
the class OpenShiftServerUtilsTest method shouldFindTheFirstServerGivenListOfServersContainsSeveralServerWithSameService.
@Test
public void shouldFindTheFirstServerGivenListOfServersContainsSeveralServerWithSameService() throws CoreException {
// given
IServer os3Server1 = mockOS3Server("os3-1", "someService");
IServer os3Server2 = mockOS3Server("os3-2", "someService");
IServer[] servers = new IServer[] { mockServer("as7", mockServerType(IJBossToolingConstants.SERVER_AS_70)), os3Server1, os3Server2 };
// when
IServer serverFound = OpenShiftServerUtils.findServerForResource("someService", servers);
// then
assertThat(serverFound).isSameAs(os3Server1);
}
use of org.eclipse.wst.server.core.IServer in project jbosstools-openshift by jbosstools.
the class CDKActionProvider method fillContextMenu.
@Override
public void fillContextMenu(IMenuManager menu) {
ICommonViewerSite site = actionSite.getViewSite();
IStructuredSelection selection = null;
if (site instanceof ICommonViewerWorkbenchSite) {
ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site;
selection = (IStructuredSelection) wsSite.getSelectionProvider().getSelection();
}
// $NON-NLS-1$
IContributionItem quick = menu.find("org.eclipse.ui.navigate.showInQuickMenu");
if (quick != null && selection != null && selection.size() == 1) {
if (selection.getFirstElement() instanceof IServer) {
IServer server = (IServer) selection.getFirstElement();
if (acceptsServer(server)) {
if (menu instanceof MenuManager) {
((MenuManager) quick).add(showInDockerViewAction);
((MenuManager) quick).add(showInOpenshiftViewAction);
}
}
if (setupCDKAction.shouldRun()) {
menu.insertBefore(ServerActionProvider.TOP_SECTION_END_SEPARATOR, setupCDKAction);
}
}
}
}
use of org.eclipse.wst.server.core.IServer in project jbosstools-openshift by jbosstools.
the class LaunchCDKServerHandler method showCreateNewServerDialog.
private IServer showCreateNewServerDialog() {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
IServer created = showNewServerWizard(shell, "org.jboss.tools.openshift.cdk.server.type");
return created;
}
use of org.eclipse.wst.server.core.IServer in project jbosstools-openshift by jbosstools.
the class DebugLaunchConfigs method getRemoteDebuggerLaunchConfiguration.
public ILaunchConfiguration getRemoteDebuggerLaunchConfiguration(IServer server) throws CoreException {
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(ID_REMOTE_JAVA_APPLICATION);
ILaunchConfiguration[] launchConfigs = launchManager.getLaunchConfigurations(launchConfigurationType);
String name = getRemoteDebuggerLaunchConfigurationName(server);
Optional<ILaunchConfiguration> maybeLaunch = Stream.of(launchConfigs).filter(lc -> name.equals(lc.getName())).findFirst();
return maybeLaunch.orElse(null);
}
use of org.eclipse.wst.server.core.IServer in project jbosstools-openshift by jbosstools.
the class CDK3LaunchController method performOverrides.
@Override
protected void performOverrides(ILaunchConfigurationWorkingCopy workingCopy) throws CoreException {
// Overrides, things that should always match whats in server editor
final IServer s = getServerFromLaunch(workingCopy);
final CDKServer cdkServer = (CDKServer) s.loadAdapter(CDKServer.class, new NullProgressMonitor());
performOverrides(workingCopy, s, cdkServer);
}
Aggregations