Examples of MavenRuntimeManager


Examples of org.eclipse.m2e.core.embedder.MavenRuntimeManager

        // ignore
      }
    }

    public boolean isRuntimeConfigured() throws IOException {
      MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();
      String path = location.getCanonicalPath();
      MavenRuntime runtime = runtimeManager.getRuntime(path);
      return (runtime != null && runtime.isAvailable());
    }
View Full Code Here

Examples of org.eclipse.m2e.core.embedder.MavenRuntimeManager

      return (runtime != null && runtime.isAvailable());
    }
   
    public IStatus configure(IProgressMonitor monitor) {
      try {
        MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();

        String path = location.getCanonicalPath();
        MavenRuntime runtime = runtimeManager.getRuntime(path);

        // Get the existing default runtime in case we need to revert later
        oldDefaultRuntime = runtimeManager.getDefaultRuntime();

        // If a runtime at the given path already exists make it the default
        if (runtime != null && runtime.isAvailable()) {
          if (!runtime.equals(oldDefaultRuntime)) {
            runtimeManager.setDefaultRuntime(runtime);
          }
          setConfigured(true);
          return new Status(IStatus.INFO, MavenCorePlugin.PLUGIN_ID, NLS.bind("Maven already configured at {0}", path));
        }
        else {
          // Create a new runtime; install it and make the default
          runtime = MavenRuntimeManager.createExternalRuntime(location.getCanonicalPath());
          List<MavenRuntime> runtimes = runtimeManager.getMavenRuntimes();
          runtimes.add(runtime);
          runtimeManager.setRuntimes(runtimes);
          runtimeManager.setDefaultRuntime(runtime);
          setConfigured(true);
          return new Status(IStatus.OK, MavenCorePlugin.PLUGIN_ID, NLS.bind("Maven successfully configured at {0}", location));
        }
      }
      catch (Exception e) {
View Full Code Here

Examples of org.eclipse.m2e.core.embedder.MavenRuntimeManager

      }
    }

    public IStatus unConfigure(IProgressMonitor monitor) {
      try {
        MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();

        String path = location.getCanonicalPath();
        MavenRuntime runtime = runtimeManager.getRuntime(path);

        // Remove the newly added runtime
        if (runtime != null) {
          List<MavenRuntime> runtimes = runtimeManager.getMavenRuntimes();
          runtimes.remove(runtime);
          runtimeManager.setRuntimes(runtimes);
        }

        // Revert the default runtime
        if (oldDefaultRuntime != null) {
          runtimeManager.setDefaultRuntime(oldDefaultRuntime);
        }
      }
      catch (Exception e) {
        MavenCorePlugin.getDefault().getLog().log(
            new Status(IStatus.ERROR, MavenCorePlugin.PLUGIN_ID, 1, e.getMessage(), e));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.