Example usage for org.springframework.ide.eclipse.beans.ui.livegraph.model LiveBeansModelGenerator connectToModel

List of usage examples for org.springframework.ide.eclipse.beans.ui.livegraph.model LiveBeansModelGenerator connectToModel

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.beans.ui.livegraph.model LiveBeansModelGenerator connectToModel.

Prototype

public static LiveBeansModel connectToModel(final String serviceUrl, final String username,
        final String password, final String appName) throws CoreException 

Source Link

Document

This method will attempt to create a JMXConnector from the given parameters and will close it when it is finished.

Usage

From source file:com.vmware.vfabric.ide.eclipse.tcserver.livegraph.LiveBeansGraphEditorSection.java

private void connectToApplication(String appName) {
    try {/*ww w  . j a v  a2  s  .com*/
        String username = null;
        String password = null;
        String serviceUrl = JmxUtils.getJmxUrl(behaviour);
        JmxCredentials credentials = JmxUtils.getJmxCredentials(behaviour);
        if (credentials != null) {
            username = credentials.getUsername();
            password = credentials.getPassword();
        }

        LiveBeansModel model = LiveBeansModelGenerator.connectToModel(serviceUrl, username, password, appName);
        IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
                .showView(LiveBeansGraphView.VIEW_ID);
        if (part instanceof LiveBeansGraphView) {
            ((LiveBeansGraphView) part).setInput(model);
        }
    } catch (PartInitException e) {
        Status status = new Status(IStatus.INFO, TcServerLiveGraphPlugin.PLUGIN_ID,
                "An error occurred while opening the Live Beans Graph View.", e);
        openErrorDialogWithStatus(status);
    } catch (IOException e) {
        Status status = new Status(IStatus.INFO, TcServerLiveGraphPlugin.PLUGIN_ID, e.getMessage(), e);
        openErrorDialogWithStatus(status);
    } catch (CoreException e) {
        Status status = new Status(IStatus.INFO, TcServerLiveGraphPlugin.PLUGIN_ID, e.getMessage(), e);
        openErrorDialogWithStatus(status);
    }
}