Example usage for org.springframework.ide.eclipse.core SpringCore log

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

Introduction

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

Prototype

public static void log(Throwable exception) 

Source Link

Usage

From source file:org.eclipse.virgo.ide.ui.editors.PdeCompatibilityUtil.java

public static boolean isSystemFileEditorInput(IEditorInput input) {
    if (isEclipse34) {
        Class<?> systemFileEditorInputClass;
        try {/*from  w  w  w.j  a va2 s.  com*/
            systemFileEditorInputClass = Class
                    .forName("org.eclipse.pde.internal.ui.editor.SystemFileEditorInput");
            return systemFileEditorInputClass.isInstance(input);
        } catch (ClassNotFoundException e) {
            isEclipse34 = false;
        } catch (Throwable e) {
            SpringCore.log(new Status(IStatus.ERROR, ServerIdeUiPlugin.PLUGIN_ID,
                    "Failed to check fo instance of SystemFileEditorInput"));
            isEclipse34 = false;
        }
    }
    return false;
}

From source file:org.eclipse.virgo.ide.ui.editors.PdeCompatibilityUtil.java

public static IEditorInput createSystemFileEditorInput(File file) {
    if (isEclipse34) {
        Class<?> systemFileEditorInputClass;
        try {//ww  w .j av  a  2s  .c o  m
            systemFileEditorInputClass = Class
                    .forName("org.eclipse.pde.internal.ui.editor.SystemFileEditorInput");
            Constructor<?> constructor = systemFileEditorInputClass.getConstructor(File.class);
            return (IEditorInput) constructor.newInstance(file);
        } catch (ClassNotFoundException e) {
            isEclipse34 = false;
        } catch (Throwable e) {
            SpringCore.log(new Status(IStatus.ERROR, ServerIdeUiPlugin.PLUGIN_ID,
                    "Failed to create instance of SystemFileEditorInput"));
            isEclipse34 = false;
        }
    }
    return null;
}

From source file:org.eclipse.virgo.ide.runtime.internal.core.command.AbstractJmxServerDeployerCommand.java

/**
 * Create a {@link URI} from the given <code>path</code>. 
 *///w w  w. j av a  2 s  .c o m
static final URI getUri(IPath path) {
    // we can't use path.toFile().toURI() as this will use OS specific paths and will fail
    // miserable if you run for VMware
    try {
        if (path.toString().startsWith("/")) {
            return new URI(FILE_SCHEME, path.toString(), null);
        } else {
            return new URI(FILE_SCHEME, "/" + path.toString(), null);
        }
    } catch (URISyntaxException e) {
        SpringCore.log(e);
    }
    return null;
}

From source file:org.eclipse.virgo.ide.runtime.internal.core.command.AbstractJmxServerCommand.java

protected final Object execute(final JmxServerCommandTemplate template) throws TimeoutException {

    Callable<Object> deployOperation = new Callable<Object>() {

        public Object call() throws Exception {
            JMXConnector connector = null;
            try {
                connector = getJmxConnector();
                return template.invokeOperation(connector.getMBeanServerConnection());
            } finally {
                if (connector != null) {
                    try {
                        connector.close();
                    } catch (IOException e) {
                        SpringCore.log(e);
                    }//from  www.  j  ava 2s.  c om
                }
            }
        }
    };

    FutureTask<Object> task = new FutureTask<Object>(deployOperation);
    ServerCorePlugin.EXECUTOR.submit(task);

    try {
        return task.get(30, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        // swallow exception here
    } catch (ExecutionException e) {
        // swallow exception here
    }

    return null;
}

From source file:org.eclipse.virgo.ide.bundlor.ui.internal.actions.AutomaticRunBundlorActionDelegate.java

public void run(IAction action) {
    final Set<IJavaProject> projects = new LinkedHashSet<IJavaProject>();
    Iterator<IProject> iter = selected.iterator();
    while (iter.hasNext()) {
        IProject project = iter.next();/* w ww  .  j  av  a 2 s . c o m*/
        if (FacetUtils.isBundleProject(project)) {
            projects.add(JdtUtils.getJavaProject(project));
        }
    }
    IRunnableWithProgress op = new WorkspaceModifyOperation() {
        protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
            for (final IJavaProject javaProject : projects) {
                try {
                    if (BundlorUiPlugin.isBundlorBuilderEnabled(javaProject.getProject())) {
                        SpringCoreUtils.removeProjectBuilder(javaProject.getProject(),
                                BundlorCorePlugin.BUILDER_ID, new NullProgressMonitor());
                    } else {
                        SpringCoreUtils.addProjectBuilder(javaProject.getProject(),
                                BundlorCorePlugin.BUILDER_ID, new NullProgressMonitor());
                    }
                } catch (CoreException e) {
                    SpringCore.log(e);
                }
            }
        }
    };

    try {
        PlatformUI.getWorkbench().getProgressService().runInUI(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow(), op,
                ResourcesPlugin.getWorkspace().getRoot());
    } catch (InvocationTargetException e) {
        SpringCore.log(e);
    } catch (InterruptedException e) {
    }

}

From source file:org.eclipse.virgo.ide.runtime.core.ServerUtils.java

/**
 * Creates a {@link DependencyLocator} instance suitable for the given project.
 * @param project the project/*  w w  w.j  a va2 s  .  c o m*/
 * @param additionalSearchPaths any additional search paths.
 */
public static IDependencyLocator createDependencyLocator(IProject project, String[] additionalSearchPaths) {
    try {
        IRuntime[] serverRuntimes = getTargettedRuntimes(project);
        if (serverRuntimes == null || serverRuntimes.length == 0) {
            return null;
        }
        return createDependencyLocator(serverRuntimes[0], getServerHome(serverRuntimes), additionalSearchPaths,
                getCacheDirectoryPath(), getJavaVersion(project));
    } catch (IOException e) {
        SpringCore.log(e);
    }
    return null;
}

From source file:org.eclipse.virgo.ide.runtime.core.ServerUtils.java

/**
 * Creates a {@link DependencyLocator} instance suitable for the given runtime.
 * @param project the project/*w w w.j a va 2s  .  c  om*/
 * @param additionalSearchPaths any additional search paths.
 */
public static IDependencyLocator createDependencyLocator(IRuntime serverRuntime) {
    try {
        // Create DependencyLocator with path to server.config and server.profile
        return createDependencyLocator(serverRuntime, getServerHome(serverRuntime), NO_ADDITIONAL_SEARCH_PATHS,
                getCacheDirectoryPath(), null);
    } catch (IOException e) {
        SpringCore.log(e);
    }
    return null;
}

From source file:org.eclipse.virgo.ide.ui.wizards.NewParProjectWizard.java

private void addFacetsToProject(final IProject project) {
    WorkspaceModifyOperation oper = new WorkspaceModifyOperation() {
        @Override/*  w ww  .  j  av a 2  s  . c o  m*/
        protected void execute(IProgressMonitor monitor)
                throws CoreException, InvocationTargetException, InterruptedException {
            SpringCoreUtils.addProjectNature(project.getProject(), SpringCore.NATURE_ID, monitor);
            IFacetedProject fProject = ProjectFacetsManager.create(project.getProject(), true, monitor);

            // WST 3.0 only
            // fProject.createWorkingCopy().addProjectFacet(
            // ProjectFacetsManager.getProjectFacet("jst.java").
            // getLatestVersion());
            // fProject.createWorkingCopy().addProjectFacet(
            // ProjectFacetsManager.getProjectFacet(FacetCorePlugin.
            // BUNDLE_FACET_ID).getLatestVersion());

            fProject.installProjectFacet(
                    ProjectFacetsManager.getProjectFacet(FacetCorePlugin.PAR_FACET_ID).getDefaultVersion(),
                    null, monitor);
            IRuntime runtime = (IRuntime) model
                    .getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
            if (runtime != null
                    && runtime.supports(ProjectFacetsManager.getProjectFacet(FacetCorePlugin.PAR_FACET_ID))) {
                fProject.setTargetedRuntimes(Collections.singleton(runtime), monitor);
            }
        }
    };

    try {
        getContainer().run(true, true, oper);
    } catch (InvocationTargetException e) {
        SpringCore.log(e);
    } catch (InterruptedException e) {
        SpringCore.log(e);
    }
}

From source file:org.eclipse.virgo.ide.ui.wizards.NewBundleProjectWizard.java

private void addFacetsToProject(final IJavaProject project) {
    WorkspaceModifyOperation oper = new WorkspaceModifyOperation() {
        @Override/*w  ww .  j a  v  a2  s .  c  o m*/
        protected void execute(IProgressMonitor monitor)
                throws CoreException, InvocationTargetException, InterruptedException {

            SpringCoreUtils.addProjectNature(project.getProject(), SpringCore.NATURE_ID, monitor);
            IFacetedProject fProject = ProjectFacetsManager.create(project.getProject(), true, monitor);

            // WST 3.0 only

            if (model.getBooleanProperty(BundleFacetInstallDataModelProvider.ENABLE_WEB_BUNDLE)) {
                fProject.installProjectFacet(
                        ProjectFacetsManager.getProjectFacet("jst.java").getDefaultVersion(), null, monitor);
                fProject.installProjectFacet(
                        ProjectFacetsManager.getProjectFacet(FacetCorePlugin.WEB_FACET_ID).getVersion("2.5"),
                        null, monitor);

                // wanna uninstall JavaScript facet, but it doesn't seem to
                // be there yet
                // fProject.uninstallProjectFacet(ProjectFacetsManager
                // .getProjectFacet(FacetCorePlugin.WEB_JS_FACET_ID).getDefaultVersion(),
                // null, monitor);

                removeFromClasspath(project, "org.eclipse.jst.j2ee.internal.web.container", monitor);
                removeFromClasspath(project, "org.eclipse.jst.j2ee.internal.module.container", monitor);
            }

            fProject.installProjectFacet(
                    ProjectFacetsManager.getProjectFacet(FacetCorePlugin.BUNDLE_FACET_ID).getDefaultVersion(),
                    null, monitor);
            IRuntime runtime = (IRuntime) model
                    .getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
            if (runtime != null && runtime.supports(ProjectFacetsManager
                    .getProjectFacet(FacetCorePlugin.BUNDLE_FACET_ID).getDefaultVersion())) {
                fProject.setTargetedRuntimes(Collections.singleton(runtime), monitor);
            }
            if (model.getBooleanProperty(
                    BundleFacetInstallDataModelProvider.ENABLE_SERVER_CLASSPATH_CONTAINER)) {
                addToClasspath(project, JavaCore.newContainerEntry(FacetCorePlugin.CLASSPATH_CONTAINER_PATH),
                        monitor);
            }
        }
    };

    try {
        getContainer().run(true, true, oper);
    } catch (InvocationTargetException e) {
        SpringCore.log(e);
    } catch (InterruptedException e) {
        SpringCore.log(e);
    }
}

From source file:org.eclipse.virgo.ide.jdt.internal.core.classpath.ServerClasspathContainerUpdateJob.java

private static void log(int level, String message) {
    SpringCore.log(new Status(level, "com.springsource.server.ide.jdt.core", message));
}