Search in sources :

Example 1 with HistorySearchDialog

use of org.tigris.subversion.subclipse.ui.dialogs.HistorySearchDialog in project subclipse by subclipse.

the class SVNHistoryPage method inputSet.

public boolean inputSet() {
    Object input = getInput();
    if (input instanceof IResource) {
        IResource res = (IResource) input;
        RepositoryProvider teamProvider = RepositoryProvider.getProvider(res.getProject(), SVNProviderPlugin.getTypeId());
        if (teamProvider != null) {
            try {
                ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(res);
                LocalResourceStatus localResourceStatus = (localResource != null) ? localResource.getStatus() : null;
                if (localResource != null && localResourceStatus.isManaged() && (!localResourceStatus.isAdded() || localResourceStatus.isCopied())) {
                    this.resource = res;
                    this.remoteResource = localResource.getBaseResource();
                    this.projectProperties = ProjectProperties.getProjectProperties(res);
                    boolean includeBugs = projectProperties != null;
                    boolean includeTags = tagsPropertySet(res);
                    if (includeTags != this.includeTags || this.includeBugs != includeBugs) {
                        this.includeTags = includeTags;
                        this.includeBugs = includeBugs;
                        refreshTable();
                    }
                    this.historyTableProvider.setRemoteResource(this.remoteResource);
                    this.historyTableProvider.setProjectProperties(this.projectProperties);
                    if (historySearchViewerFilter != null) {
                        // HistorySearchViewerFilter[] filters = { historySearchViewerFilter };
                        // this.tableHistoryViewer.setFilters(filters);
                        this.tableHistoryViewer.resetFilters();
                        this.tableHistoryViewer.addFilter(historySearchViewerFilter);
                        historySearchDialog = new HistorySearchDialog(getSite().getShell(), remoteResource);
                        historySearchDialog.setSearchAll(false);
                        historySearchDialog.setStartRevision(historySearchViewerFilter.getStartRevision());
                        historySearchDialog.setEndRevision(historySearchViewerFilter.getEndRevision());
                        historySearchViewerFilter = null;
                        getClearSearchAction().setEnabled(true);
                    } else {
                        this.tableHistoryViewer.resetFilters();
                        getClearSearchAction().setEnabled(false);
                    }
                    this.tableHistoryViewer.setInput(this.remoteResource);
                    // setTitleToolTip(baseResource.getRepositoryRelativePath());
                    return true;
                }
            } catch (TeamException e) {
                SVNUIPlugin.openError(getSite().getShell(), null, null, e);
            }
        }
    } else if (input instanceof ISVNRemoteResource) {
        this.resource = null;
        this.remoteResource = (ISVNRemoteResource) input;
        boolean includeTags = tagsPropertySet(remoteResource);
        if (includeTags != this.includeTags) {
            this.includeTags = includeTags;
            refreshTable();
        }
        try {
            this.projectProperties = ProjectProperties.getProjectProperties(this.remoteResource);
        } catch (SVNException e) {
            if (!e.operationInterrupted()) {
                SVNUIPlugin.openError(getSite().getShell(), null, null, e);
            }
        }
        boolean includeBugs = projectProperties != null;
        if (includeTags != this.includeTags || this.includeBugs != includeBugs) {
            this.includeTags = includeTags;
            this.includeBugs = includeBugs;
            refreshTable();
        }
        this.historyTableProvider.setRemoteResource(this.remoteResource);
        this.historyTableProvider.setProjectProperties(this.projectProperties);
        if (historySearchViewerFilter != null) {
            // HistorySearchViewerFilter[] filters = { historySearchViewerFilter };
            // this.tableHistoryViewer.setFilters(filters);
            this.tableHistoryViewer.resetFilters();
            this.tableHistoryViewer.addFilter(historySearchViewerFilter);
            historySearchDialog = new HistorySearchDialog(getSite().getShell(), remoteResource);
            historySearchDialog.setSearchAll(false);
            historySearchDialog.setStartRevision(historySearchViewerFilter.getStartRevision());
            historySearchDialog.setEndRevision(historySearchViewerFilter.getEndRevision());
            historySearchViewerFilter = null;
            getClearSearchAction().setEnabled(true);
        } else {
            this.tableHistoryViewer.resetFilters();
            getClearSearchAction().setEnabled(false);
        }
        this.tableHistoryViewer.setInput(this.remoteResource);
        // setTitleToolTip(remoteResource.getRepositoryRelativePath());
        return true;
    }
    return false;
}
Also used : TeamException(org.eclipse.team.core.TeamException) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNException(org.tigris.subversion.subclipse.core.SVNException) RepositoryProvider(org.eclipse.team.core.RepositoryProvider) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) HistorySearchDialog(org.tigris.subversion.subclipse.ui.dialogs.HistorySearchDialog) IResource(org.eclipse.core.resources.IResource)

Example 2 with HistorySearchDialog

use of org.tigris.subversion.subclipse.ui.dialogs.HistorySearchDialog in project subclipse by subclipse.

the class SVNHistoryPage method getSearchAction.

// Search action (toolbar)
private IAction getSearchAction() {
    if (searchAction == null) {
        SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
        searchAction = new Action(Policy.bind("HistoryView.search"), // $NON-NLS-1$
        plugin.getImageDescriptor(ISVNUIConstants.IMG_FILTER_HISTORY)) {

            public void run() {
                if (historySearchDialog == null) {
                    historySearchDialog = new HistorySearchDialog(getSite().getShell(), remoteResource);
                }
                historySearchDialog.setRemoteResource(remoteResource);
                if (historySearchDialog.open() == Window.OK) {
                    searchAction.setEnabled(false);
                    Utils.schedule(new SearchHistoryJob(), SVNUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite());
                }
            }
        };
        searchAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_FILTER_HISTORY_DISABLED));
    }
    return searchAction;
}
Also used : SVNUIPlugin(org.tigris.subversion.subclipse.ui.SVNUIPlugin) CompareRemoteResourcesAction(org.tigris.subversion.subclipse.ui.actions.CompareRemoteResourcesAction) ExportRemoteFolderAction(org.tigris.subversion.subclipse.ui.actions.ExportRemoteFolderAction) ShowDifferencesAsUnifiedDiffAction(org.tigris.subversion.subclipse.ui.actions.ShowDifferencesAsUnifiedDiffAction) TextViewerAction(org.tigris.subversion.subclipse.ui.console.TextViewerAction) ShowAnnotationAction(org.tigris.subversion.subclipse.ui.actions.ShowAnnotationAction) ShowHistoryAction(org.tigris.subversion.subclipse.ui.actions.ShowHistoryAction) WorkspaceAction(org.tigris.subversion.subclipse.ui.actions.WorkspaceAction) IAction(org.eclipse.jface.action.IAction) OpenRemoteFileAction(org.tigris.subversion.subclipse.ui.actions.OpenRemoteFileAction) GenerateChangeLogAction(org.tigris.subversion.subclipse.ui.actions.GenerateChangeLogAction) Action(org.eclipse.jface.action.Action) HistorySearchDialog(org.tigris.subversion.subclipse.ui.dialogs.HistorySearchDialog)

Aggregations

HistorySearchDialog (org.tigris.subversion.subclipse.ui.dialogs.HistorySearchDialog)2 IResource (org.eclipse.core.resources.IResource)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 RepositoryProvider (org.eclipse.team.core.RepositoryProvider)1 TeamException (org.eclipse.team.core.TeamException)1 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)1 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)1 SVNException (org.tigris.subversion.subclipse.core.SVNException)1 LocalResourceStatus (org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)1 SVNUIPlugin (org.tigris.subversion.subclipse.ui.SVNUIPlugin)1 CompareRemoteResourcesAction (org.tigris.subversion.subclipse.ui.actions.CompareRemoteResourcesAction)1 ExportRemoteFolderAction (org.tigris.subversion.subclipse.ui.actions.ExportRemoteFolderAction)1 GenerateChangeLogAction (org.tigris.subversion.subclipse.ui.actions.GenerateChangeLogAction)1 OpenRemoteFileAction (org.tigris.subversion.subclipse.ui.actions.OpenRemoteFileAction)1 ShowAnnotationAction (org.tigris.subversion.subclipse.ui.actions.ShowAnnotationAction)1 ShowDifferencesAsUnifiedDiffAction (org.tigris.subversion.subclipse.ui.actions.ShowDifferencesAsUnifiedDiffAction)1 ShowHistoryAction (org.tigris.subversion.subclipse.ui.actions.ShowHistoryAction)1 WorkspaceAction (org.tigris.subversion.subclipse.ui.actions.WorkspaceAction)1 TextViewerAction (org.tigris.subversion.subclipse.ui.console.TextViewerAction)1