Example usage for org.springframework.ide.eclipse.boot.core BootActivator log

List of usage examples for org.springframework.ide.eclipse.boot.core BootActivator log

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.core BootActivator log.

Prototype

@Deprecated
public static void log(Throwable e) 

Source Link

Document

Deprecated use Log .log() instead.

Usage

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudAppDashElement.java

/**
 * Set the project 'binding' for this element.
 * @return true if the element was changed by this operation.
 *//*from  w w  w  .  j  a v  a 2  s .  c o m*/
public boolean setProject(IProject project) {
    try {
        PropertyStoreApi props = getPersistentProperties();
        String oldValue = props.get(PROJECT_NAME);
        String newValue = project == null ? null : project.getName();
        if (!Objects.equals(oldValue, newValue)) {
            props.put(PROJECT_NAME, newValue);
            return true;
        }
        return false;
    } catch (Exception e) {
        BootActivator.log(e);
        return false;
    }
}

From source file:org.springframework.ide.eclipse.boot.core.internal.MavenSpringBootProject.java

/**
 * Determine the 'managed' version, if any, associate with a given dependency.
 * @return Version string or null.//from ww  w. j  av a2  s  . co  m
 */
private String getManagedVersion(IMavenCoordinates dep) {
    try {
        MavenProject mp = getMavenProject();
        if (mp != null) {
            DependencyManagement managedDeps = mp.getDependencyManagement();
            if (managedDeps != null) {
                List<Dependency> deps = managedDeps.getDependencies();
                if (deps != null && !deps.isEmpty()) {
                    for (Dependency d : deps) {
                        if ("jar".equals(d.getType())) {
                            if (dep.getArtifactId().equals(d.getArtifactId())
                                    && dep.getGroupId().equals(d.getGroupId())) {
                                return d.getVersion();
                            }
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        BootActivator.log(e);
    }
    return null;
}

From source file:org.springframework.ide.eclipse.boot.core.internal.MavenSpringBootProject.java

@Override
public void removeMavenDependency(final MavenId mavenId) {
    IFile file = getPomFile();//  w  w w.j  a v  a  2s. c o m
    try {
        performOnDOMDocument(new OperationTuple(file, new Operation() {
            @Override
            public void process(Document pom) {
                Element depsEl = getChild(pom.getDocumentElement(), DEPENDENCIES);
                if (depsEl != null) {
                    Element dep = findChild(depsEl, DEPENDENCY, childEquals(GROUP_ID, mavenId.getGroupId()),
                            childEquals(ARTIFACT_ID, mavenId.getArtifactId()));
                    if (dep != null) {
                        depsEl.removeChild(dep);
                    }
                }
            }
        }));
    } catch (Exception e) {
        BootActivator.log(e);
    }
}

From source file:org.springframework.ide.eclipse.boot.core.internal.MavenSpringBootProject.java

@Override
public String getBootVersion() {
    try {//from  w  w  w  .j  a va2  s .co  m
        MavenProject mp = getMavenProject();
        if (mp != null) {
            return getBootVersion(mp.getDependencies());
        }
    } catch (Exception e) {
        BootActivator.log(e);
    }
    return SpringBootCore.getDefaultBootVersion();
}

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.DevtoolsUtil.java

private static ILaunchConfiguration findConfig(IProject project, String host) {
    String remoteUrl = remoteUrl(host);
    try {/*from www . j  av  a  2  s.  co m*/
        for (ILaunchConfiguration c : getLaunchManager().getLaunchConfigurations(getConfigurationType())) {
            if (project.equals(BootLaunchConfigurationDelegate.getProject(c))
                    && remoteUrl.equals(BootDevtoolsClientLaunchConfigurationDelegate.getRemoteUrl(c))) {
                return c;
            }
        }
    } catch (CoreException e) {
        BootActivator.log(e);
    }
    return null;
}

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.DevtoolsUtil.java

private static List<ILaunch> findLaunches(IProject project, String host) {
    String remoteUrl = remoteUrl(host);
    List<ILaunch> launches = new ArrayList<ILaunch>();
    for (ILaunch l : getLaunchManager().getLaunches()) {
        try {/*from  ww  w. ja va2 s  .c o m*/
            ILaunchConfiguration c = l.getLaunchConfiguration();
            if (c != null) {
                if (project.equals(BootLaunchConfigurationDelegate.getProject(c))
                        && remoteUrl.equals(BootDevtoolsClientLaunchConfigurationDelegate.getRemoteUrl(c))) {
                    launches.add(l);
                }
            }
        } catch (Exception e) {
            BootActivator.log(e);
        }
    }
    return launches;
}

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.DevtoolsUtil.java

private static String getAttribute(ILaunch l, String name) {
    try {// www.ja v a 2  s.  co m
        ILaunchConfiguration c = l.getLaunchConfiguration();
        if (c != null) {
            return c.getAttribute(name, (String) null);
        }
    } catch (Exception e) {
        BootActivator.log(e);
    }
    return null;
}

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.DevtoolsUtil.java

private static String getAttribute(ILaunchConfiguration l, String name) {
    try {// www. j av a 2s  . c  o m
        return l.getAttribute(name, (String) null);
    } catch (CoreException e) {
        BootActivator.log(e);
        return null;
    }
}

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.DevtoolsUtil.java

public static void disconnectDevtoolsClientsFor(CloudDashElement e) {
    ILaunchManager lm = getLaunchManager();
    for (ILaunch l : lm.getLaunches()) {
        if (!l.isTerminated() && isLaunchFor(l, e)) {
            if (l.canTerminate()) {
                try {
                    l.terminate();/*www  . j  av a 2s .c o  m*/
                } catch (DebugException de) {
                    BootActivator.log(de);
                }
            }
        }
    }
}

From source file:org.springframework.ide.eclipse.boot.ui.EnableDisableBootDevtools.java

@Override
public void run(IAction action) {
    try {/*from www.j  a v  a2 s  .c o  m*/
        SpringBootStarter devtools = getAvaibleDevtools(bootProject);
        if (hasDevTools(bootProject)) {
            bootProject.removeMavenDependency(devtools.getMavenId());
        } else {
            if (devtools != null) {
                bootProject.addMavenDependency(devtools.getDependency(), /*preferManaged*/true);
            } else {
                MessageDialog.openError(activePart.getSite().getShell(),
                        "Boot Devtools Dependency could not be added", explainFailure());
            }
        }
    } catch (Exception e) {
        BootActivator.log(e);
        MessageDialog.openError(activePart.getSite().getShell(), "Unexpected failure",
                "The action to add/remove devtools unexpectedly failed with an error:\n"
                        + ExceptionUtil.getMessage(e) + "\n"
                        + "The error log may contain further information.");
    }
}