Package org.guvnor.tools.views.model

Examples of org.guvnor.tools.views.model.ResourceHistoryEntry


    @Override
    public int compare(Viewer viewer, Object e1, Object e2) {
        if (e1 instanceof ResourceHistoryEntry
           && e2 instanceof ResourceHistoryEntry) {
            ResourceHistoryEntry entry1 = (ResourceHistoryEntry)e1;
            ResourceHistoryEntry entry2 = (ResourceHistoryEntry)e2;
            return Integer.parseInt(entry2.getRevision()) - Integer.parseInt(entry1.getRevision());
        } else {
            return super.compare(viewer, e1, e2);
        }
    }
View Full Code Here


    public String getColumnText(Object element, int columnIndex) {
        if (!(element instanceof ResourceHistoryEntry)) {
            return element.toString();
        }
        ResourceHistoryEntry entry = (ResourceHistoryEntry) element;
        String res = null;
        switch (columnIndex) {
        case 0:
            res = entry.getRevision();
            break;
        case 1:
            res = entry.getDate();
            break;
        case 2:
            res = entry.getAuthor();
            break;
        case 3:
            res = entry.getComment();
            break;
        default:
            res = entry.toString();
            break;
        }
        return res;

    }
View Full Code Here

        String repository = repositoryLabel.getToolTipText();
        String fullPath = resourceLabel.getToolTipText();
        ISelection selection = viewer.getSelection();
        Object obj = ((IStructuredSelection)selection).getFirstElement();
        if (obj instanceof ResourceHistoryEntry) {
            ResourceHistoryEntry theEntry = (ResourceHistoryEntry)obj;
            try {
                IWebDavClient client = WebDavServerCache.getWebDavClient(repository);
                if (client == null) {
                    client = WebDavClientFactory.createClient(new URL(repository));
                    WebDavServerCache.cacheWebDavClient(repository, client);
                }
                String contents = null;
                try {
                    contents = client.getResourceVersionContents(fullPath, theEntry.getRevision());
                } 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(repository, client);
                    if (retry) {
                        contents = client.getResourceVersionContents(fullPath, theEntry.getRevision());
                    }
                }
                if (contents != null) {
                    String editorTitle = null;
                    int pos = fullPath.lastIndexOf("/"); //$NON-NLS-1$
                    if (pos != -1
                       && pos + 1 < fullPath.length()) {
                        editorTitle = fullPath.substring(pos + 1);
                    } else {
                        editorTitle = fullPath;
                    }
                    PlatformUtils.openEditor(contents, editorTitle + ", " + theEntry.getRevision()); //$NON-NLS-1$
                }
            } catch (Exception e) {
                Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true);
            }
        }
View Full Code Here

                author = tokens.nextToken();
                comment = tokens.nextToken();
            } catch (NoSuchElementException e) {
                // Don't care if some fields are missing
            }
            entries[i] = new ResourceHistoryEntry(oneRevision, verDate, author, comment);
        }
        return entries;
    }
View Full Code Here

TOP

Related Classes of org.guvnor.tools.views.model.ResourceHistoryEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.