Search in sources :

Example 1 with CDK3Server

use of org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDK3Server in project jbosstools-openshift by jbosstools.

the class CDKActionProvider method isCDKInitialized.

private boolean isCDKInitialized(IServer server) {
    CDK3Server cdk3 = (CDK3Server) server.loadAdapter(CDK3Server.class, new NullProgressMonitor());
    if (cdk3 != null) {
        String home = cdk3.getMinishiftHome();
        File homeF = new File(home);
        if (homeF.exists() && homeF.isDirectory()) {
            File cdk = new File(homeF, "cdk");
            File config = new File(homeF, "config");
            File cache = new File(homeF, "cache");
            File configJSON = new File(config, "config.json");
            if (cdk.exists() && config.exists() && cache.exists() && configJSON.exists()) {
                return true;
            }
        }
    }
    return false;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) File(java.io.File) CDK3Server(org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDK3Server)

Example 2 with CDK3Server

use of org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDK3Server in project jbosstools-openshift by jbosstools.

the class CDK3ShutdownController method stop.

@Override
public void stop(boolean force) {
    getBehavior().setServerStopping();
    CDK3Server cdk3 = (CDK3Server) getServer().loadAdapter(CDK3Server.class, new NullProgressMonitor());
    String msHome = cdk3.getMinishiftHome();
    if (!(new File(msHome).exists())) {
        // The minishift home doesn't exist. We need to mark server as stopped and log an error
        String msg = "The minishift-home for server \"" + getServer().getName() + "\" does not exist: " + msHome + "\n\nPlease make sure that the virtual machine associated with this server has been properly shutdown.";
        IStatus err = new Status(IStatus.ERROR, CDKCoreActivator.PLUGIN_ID, msg, new Exception(msg));
        CDKCoreActivator.pluginLog().logStatus(err);
        getBehavior().setServerStopped();
        return;
    }
    pollState();
    if (getServer().getServerState() == IServer.STATE_STOPPED) {
        return;
    }
    issueShutdownCommand();
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) File(java.io.File) IOException(java.io.IOException) CoreException(org.eclipse.core.runtime.CoreException) CDK3Server(org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDK3Server)

Aggregations

File (java.io.File)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 CDK3Server (org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDK3Server)2 IOException (java.io.IOException)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1