drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/actions/ShowHistoryAction.java
public void run(IAction action) {
        String repositoryLoc = null;
        String fullPath = null;

        if (selectedNode != null) {
            repositoryLoc = selectedNode.getGuvnorRepository().getLocation();
            fullPath = selectedNode.getFullPath();
        } else {
            if (selectedFile == null
               || props == null) {
                return;
            }
            repositoryLoc = props.getRepository();
            fullPath = props.getFullpath();
        }

        IResponse response = null;
        try {
            IWebDavClient client = WebDavServerCache.getWebDavClient(repositoryLoc);
            if (client == null) {
                client = WebDavClientFactory.createClient(new URL(repositoryLoc));
                WebDavServerCache.cacheWebDavClient(repositoryLoc, client);
            }
            InputStream ins = null;
            try {
                response = client.getResourceVersions(fullPath);
                ins = response.getInputStream();
            } catch (WebDavException wde) {
                if (wde.getErrorCode() != IResponse.SC_UNAUTHORIZED) {
                    // If not an authentication failure, we don't know what to do with it
                    throw wde;
                }
                boolean retry = PlatformUtils.getInstance().
                                    authenticateForServer(repositoryLoc, client);
                if (retry) {
                    response = client.getResourceVersions(fullPath);
                    ins = response.getInputStream();
                }
            }
            if (ins != null) {
                Properties verProps = new Properties();
                verProps.load(ins);
                ResourceHistoryView view = PlatformUtils.getResourceHistoryView();
                if (view != null) {
                    view.setEntries(repositoryLoc, fullPath, verProps);
                }
            }
        } catch (Exception e) {
            Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true);
        } finally {
            if (response != null) {
                try {
                    response.close();
                } catch (IOException ioe) {
                    Activator.getDefault().writeLog(IStatus.ERROR, ioe.getMessage(), ioe);
                }
            }
        }
    }
public void run(IAction action) {
        String repositoryLoc = null;
        String fullPath = null;

        if (selectedNode != null) {
            repositoryLoc = selectedNode.getGuvnorRepository().getLocation();
            fullPath = selectedNode.getFullPath();
        } else {
            if (selectedFile == null
               || props == null) {
                return;
            }
            repositoryLoc = props.getRepository();
            fullPath = props.getFullpath();
        }

        IResponse response = null;
        try {
            IWebDavClient client = WebDavServerCache.getWebDavClient(repositoryLoc);
            if (client == null) {
                client = WebDavClientFactory.createClient(new URL(repositoryLoc));
                WebDavServerCache.cacheWebDavClient(repositoryLoc, client);
            }
            InputStream ins = null;
            try {
                response = client.getResourceVersions(fullPath);
                ins = response.getInputStream();
            } catch (WebDavException wde) {
                if (wde.getErrorCode() != IResponse.SC_UNAUTHORIZED) {
                    // If not an authentication failure, we don't know what to do with it
                    throw wde;
                }
                boolean retry = PlatformUtils.getInstance().
                                    authenticateForServer(repositoryLoc, client);
                if (retry) {
                    response = client.getResourceVersions(fullPath);
                    ins = response.getInputStream();
                }
            }
            if (ins != null) {
                Properties verProps = new Properties();
                verProps.load(ins);
                ResourceHistoryView view = PlatformUtils.getResourceHistoryView();
                if (view != null) {
                    view.setEntries(repositoryLoc, fullPath, verProps);
                }
            }
        } catch (Exception e) {
            Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true);
        } finally {
            if (response != null) {
                try {
                    response.close();
                } catch (IOException ioe) {
                    Activator.getDefault().writeLog(IStatus.ERROR, ioe.getMessage(), ioe);
                }
            }
        }
    }
public void run ( IAction action ) { String repositoryLoc = null ; String fullPath = null ; if ( selectedNode != null ) { repositoryLoc = selectedNode . getGuvnorRepository ( ) . getLocation ( ) ; fullPath = selectedNode . getFullPath ( ) ; } else { if ( selectedFile == null || props == null ) { return ; } repositoryLoc = props . getRepository ( ) ; fullPath = props . getFullpath ( ) ; } IResponse response = null ; try { IWebDavClient client = WebDavServerCache . getWebDavClient ( repositoryLoc ) ; if ( client == null ) { client = WebDavClientFactory . createClient ( new URL ( repositoryLoc ) ) ; WebDavServerCache . cacheWebDavClient ( repositoryLoc , client ) ; } InputStream ins = null ; try { response = client . getResourceVersions ( fullPath ) ; ins = response . getInputStream ( ) ; } catch ( WebDavException wde ) { if ( wde . getErrorCode ( ) != IResponse . SC_UNAUTHORIZED ) { // If not an authentication failure, we don't know what to do with it throw wde ; } boolean retry = PlatformUtils . getInstance ( ) . authenticateForServer ( repositoryLoc , client ) ; if ( retry ) { response = client . getResourceVersions ( fullPath ) ; ins = response . getInputStream ( ) ; } } if ( ins != null ) { Properties verProps = new Properties ( ) ; verProps . load ( ins ) ; ResourceHistoryView view = PlatformUtils . getResourceHistoryView ( ) ; if ( view != null ) { view . setEntries ( repositoryLoc , fullPath , verProps ) ; } } } catch ( Exception e ) { Activator . getDefault ( ) . displayError ( IStatus . ERROR , e . getMessage ( ) , e , true ) ; } finally { if ( response != null ) { try { response . close ( ) ; } catch ( IOException ioe ) { Activator . getDefault ( ) . writeLog ( IStatus . ERROR , ioe . getMessage ( ) , ioe ) ; } } } }
/*
(non-Javadoc)
@see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
/ * ( non - Javadoc )