Package org.cloudfoundry.ide.eclipse.server.core.internal

Examples of org.cloudfoundry.ide.eclipse.server.core.internal.CloudFoundryServer


              prj = ((IJavaProject) modObj).getProject();
            }

            if (prj != null) {

              final CloudFoundryServer cloudServer = (CloudFoundryServer) editorPage.getServer()
                  .getOriginal().loadAdapter(CloudFoundryServer.class, monitor);

              if (cloudServer != null) {

                final String moduleName = prj.getName();

                // First of all, should make sure there is no
                // CloundApplicationModule
                // with the same name of the selected project,
                // otherwise it will cause
                // the CloundApplicationModule with the same
                // name and its related remote
                // application in CF to be deleted.
                if (cloudServer.getBehaviour().existCloudApplicationModule(moduleName)) {
                  Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                      MessageDialog.openError(
                          editorPage.getSite().getShell(),
                          Messages.ApplicationMasterPart_ERROR_DEPLOY_FAIL_TITLE,
                          NLS.bind(
                              Messages.ApplicationMasterPart_ERROR_DEPLOY_FAIL_BODY,
                              moduleName));
                    }

                  });
                  return Status.CANCEL_STATUS;
                }

                // Make sure parent performs the drop first to
                // create the IModule. Unsupported modules will
                // not proceed result in IModule creation
                // therefore checks on the IProject are not
                // necessary
                ApplicationViewersDropAdapter.super.performDrop(data);

                // Now do a publish AFTER the IModule is
                // created. If no IModule is created (either
                // user cancels or project
                // is not supported), the publish operation will
                // do nothing.
                Job job = new Job(jobName) {

                  @Override
                  protected IStatus run(IProgressMonitor monitor) {
                    cloudServer.getBehaviour().publishAdd(moduleName, monitor);
                    return Status.OK_STATUS;
                  }

                };
                job.setPriority(Job.INTERACTIVE);
View Full Code Here


    return "Unable to update and restart module"; //$NON-NLS-1$
  }
  public Object execute(ExecutionEvent event) throws ExecutionException {
    initializeSelection(event);
    String error = null;
    CloudFoundryServer cloudServer = selectedServer != null ? (CloudFoundryServer) selectedServer.loadAdapter(
        CloudFoundryServer.class, null) : null;
    CloudFoundryApplicationModule appModule = cloudServer != null && selectedModule != null ? cloudServer
        .getExistingCloudModule(selectedModule) : null;
    if (selectedServer == null) {
      error = "No Cloud Foundry server instance available to run the selected action."; //$NON-NLS-1$
    }
View Full Code Here

    return null;
  }
 
  protected void doRun(CloudFoundryServer server, CloudFoundryApplicationModule appModule) {
    final CloudFoundryServer cloudServer = server;
    Job job = new Job(getJobName()) {

      protected IStatus run(IProgressMonitor monitor) {

        try {
          // FIXNS: Disabled debug for CF 1.5.0 until v2 supports
          // debug
          // if
          // (CloudFoundryProperties.isApplicationRunningInDebugMode.testProperty(modules,
          // getCloudFoundryServer())) {
          // cloudServer.getBehaviour().updateRestartDebugModule(modules,
          // getIncrementalPublish(), monitor);
          // }
          // else {
          // }

          cloudServer.getBehaviour().getUpdateRestartOperation(new IModule[] {selectedModule}).run(monitor);

        }
        catch (CoreException e) {
          CloudFoundryPlugin.getDefault().getLog()
              .log(new Status(IStatus.ERROR, CloudFoundryPlugin.PLUGIN_ID, getFailureMessage(), e));
View Full Code Here

      this.server = server;
    }

    @Override
    protected IStatus run(final IProgressMonitor monitor) {
      CloudFoundryServer cf = (CloudFoundryServer) server.loadAdapter(CloudFoundryServer.class, monitor);
      if (cf.getPassword() == null) {
        // configuration has not been saved, yet, ignore
        return Status.CANCEL_STATUS;
      }

      if (cf != null && cf.getUsername().equals(originalServer.getUsername())
          && cf.getPassword().equals(originalServer.getPassword())
          && cf.getUrl().equals(originalServer.getUrl())) {

        boolean connect = false;

        if (cf.hasCloudSpace() && originalServer.hasCloudSpace()) {
          CloudFoundrySpace originalSpace = originalServer.getCloudFoundrySpace();
          CloudFoundrySpace space = cf.getCloudFoundrySpace();
          connect = space.getOrgName().equals(originalSpace.getOrgName())
              && space.getSpaceName().equals(originalSpace.getSpaceName());
        }

        if (connect) {
          CloudFoundryServerBehaviour behaviour = cf.getBehaviour();
          if (behaviour != null) {
            try {
              behaviour.connect(monitor);
            }
            catch (CoreException e) {
View Full Code Here

    }
  }

  @Override
  protected List<IAction> getActionsFromSelection(IServerModule serverModule) {
    CloudFoundryServer cloudFoundryServer = (CloudFoundryServer) serverModule.getServer().loadAdapter(
        CloudFoundryServer.class, null);
    if (cloudFoundryServer == null) {
      return Collections.emptyList();
    }
View Full Code Here

      setToolTipText(values.getToolTipText());
      setEnabled(true);
    }

    public void run() {
      final CloudFoundryServer cloudFoundryServer = descriptor.getCloudFoundryServer();
      final ApplicationAction debugAction = descriptor.getApplicationAction();
      Job job = new Job(debugAction.getDisplayName()) {

        protected IStatus run(IProgressMonitor monitor) {
View Full Code Here

   * @param server the server for that console
   * @param appModule the app for that console
   * @return the message console. Null if no corresponding console is found.
   */
  protected MessageConsole findCloudFoundryConsole(IServer server, CloudFoundryApplicationModule appModule) {
    CloudFoundryServer cfServer = (CloudFoundryServer)server.getAdapter(CloudFoundryServer.class);
    return ConsoleManagerRegistry.getConsoleManager(cfServer).findCloudFoundryConsole(server, appModule);
  }
View Full Code Here

        List<CloudSpace> spaces = orgsSpaces.getAllSpaces();
        if (spaces != null) {
          // Find a space that does not have a corresponding server
          // instance.
          for (CloudSpace space : spaces) {
            CloudFoundryServer existingServer = null;
            for (CloudFoundryServer cloudServer : cloudServers) {
              if (matchesExisting(space, cloudServer.getCloudFoundrySpace())) {
                existingServer = cloudServer;
                break;
              }
View Full Code Here

        int state = cloudModule.getState();
        // Based on property testers, this should already be started
        if (state == IServer.STATE_STARTED) {
          IURLProvider cloudServer = (IURLProvider)selectedServer.loadAdapter(IURLProvider.class, null);

          CloudFoundryServer cfs = (CloudFoundryServer)selectedServer.loadAdapter(CloudFoundryServer.class, null);
         
          String contextRoot = null;
          if (cfs != null){
            // IModule[][] because IModule[] is the correct representation of module structure
            IModule[][] launchables = cfs.getLaunchableModules(selectedModule);

            if (launchables != null){
              if (launchables.length == 1){
                contextRoot = cfs.getLaunchableModuleContextRoot(launchables[0]);
              }
              else if (launchables.length > 1 ){
               
                List<String> selectionOptions = new ArrayList<String>();
                Map<String, String> index = new HashMap<String, String>();
                for (int i = 0; i < launchables.length; i++){
                  String option = ""; //$NON-NLS-1$
                  for (int j = 0; j < launchables[i].length; j++){
                    option += launchables[i][j].getName() + "/"; //$NON-NLS-1$
                  }
                  if (option.endsWith("/")){ //$NON-NLS-1$
                    option = option.substring(0, option.length() - 1);
                  }
                  selectionOptions.add(option);
                  index.put(option, String.valueOf(i));
                }
               
                ElementListSelectionDialog dialog = new ElementListSelectionDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), new LabelProvider());
                dialog.setTitle(TITLE);
                dialog.setMessage(DESCRIPTION);
                dialog.setElements(selectionOptions.toArray());


                if (dialog.open() != Window.OK) {  
                  if (dialog.getReturnCode() == Window.CANCEL){
                    CloudFoundryPlugin.logWarning("User pressed cancel on selection dialog"); //$NON-NLS-1$
                    return null;
                  }
                  CloudFoundryPlugin.logError(("Failed to open the Open Home Page selection dialog")); //$NON-NLS-1$
                  return null;
                }

                Object[] result = dialog.getResult();
                contextRoot = cfs.getLaunchableModuleContextRoot(launchables[Integer.valueOf(index.get(result[0]))]);
              }
            }
          }
         
          try {
View Full Code Here

    }
    return null;
  }
 
  private CloudFoundryApplicationModule getSelectedCloudAppModule() {
    CloudFoundryServer cloudServer = (CloudFoundryServer) selectedServer
        .loadAdapter(CloudFoundryServer.class, null);
    return cloudServer.getExistingCloudModule(selectedModule);
  }
View Full Code Here

TOP

Related Classes of org.cloudfoundry.ide.eclipse.server.core.internal.CloudFoundryServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.