Search in sources :

Example 76 with IServer

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);
}
Also used : IServer(org.eclipse.wst.server.core.IServer) Test(org.junit.Test)

Example 77 with IServer

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);
            }
        }
    }
}
Also used : IServer(org.eclipse.wst.server.core.IServer) IContributionItem(org.eclipse.jface.action.IContributionItem) ICommonViewerSite(org.eclipse.ui.navigator.ICommonViewerSite) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICommonViewerWorkbenchSite(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)

Example 78 with IServer

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;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IServer(org.eclipse.wst.server.core.IServer)

Example 79 with IServer

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);
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) ID_REMOTE_JAVA_APPLICATION(org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants.ID_REMOTE_JAVA_APPLICATION) DebugPlugin(org.eclipse.debug.core.DebugPlugin) Collection(java.util.Collection) IServer(org.eclipse.wst.server.core.IServer) HashMap(java.util.HashMap) CoreException(org.eclipse.core.runtime.CoreException) OpenShiftCoreActivator(org.jboss.tools.openshift.internal.core.OpenShiftCoreActivator) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ArrayList(java.util.ArrayList) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) Objects(java.util.Objects) DebugException(org.eclipse.debug.core.DebugException) List(java.util.List) IStatus(org.eclipse.core.runtime.IStatus) Stream(java.util.stream.Stream) ILaunch(org.eclipse.debug.core.ILaunch) IProject(org.eclipse.core.resources.IProject) Map(java.util.Map) Optional(java.util.Optional) IJavaLaunchConfigurationConstants(org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType)

Example 80 with IServer

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);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServer(org.eclipse.wst.server.core.IServer) CDKServer(org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDKServer)

Aggregations

IServer (org.eclipse.wst.server.core.IServer)183 CoreException (org.eclipse.core.runtime.CoreException)39 IModule (org.eclipse.wst.server.core.IModule)32 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)30 Test (org.junit.Test)30 IProject (org.eclipse.core.resources.IProject)25 IStatus (org.eclipse.core.runtime.IStatus)25 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)23 ArrayList (java.util.ArrayList)20 File (java.io.File)17 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)13 Status (org.eclipse.core.runtime.Status)12 Iterator (java.util.Iterator)11 IPath (org.eclipse.core.runtime.IPath)11 IServerType (org.eclipse.wst.server.core.IServerType)11 CDKServer (org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDKServer)11 IOException (java.io.IOException)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)10 Server (org.eclipse.wst.server.core.internal.Server)10 IFolder (org.eclipse.core.resources.IFolder)8