IDEA-47182 (No-named action between "Set property..." and "Rollback")
[fedora-idea.git] / plugins / svn4idea / src / org / jetbrains / idea / svn / actions / ShowPropertiesDiffAction.java
blobbce62783d92f4f0d72cbf1ee2dc88779fe8de342
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.jetbrains.idea.svn.actions;
18 import com.intellij.openapi.actionSystem.AnActionEvent;
19 import com.intellij.openapi.actionSystem.DataKey;
20 import com.intellij.openapi.vcs.VcsDataKeys;
21 import com.intellij.openapi.vcs.changes.Change;
22 import com.intellij.openapi.vcs.changes.ContentRevision;
23 import org.jetbrains.idea.svn.SvnBundle;
24 import org.jetbrains.idea.svn.SvnRevisionNumber;
25 import org.jetbrains.idea.svn.SvnVcs;
26 import org.tmatesoft.svn.core.SVNException;
27 import org.tmatesoft.svn.core.wc.SVNRevision;
29 public class ShowPropertiesDiffAction extends AbstractShowPropertiesDiffAction {
30 public ShowPropertiesDiffAction() {
31 super(SvnBundle.message("action.Subversion.properties.diff.name"));
34 @Override
35 public void update(final AnActionEvent e) {
36 super.update(e);
37 //e.getPresentation().setText(SvnBundle.message("action.Subversion.properties.diff.name"));
40 protected DataKey<Change[]> getChangesKey() {
41 return VcsDataKeys.CHANGE_LEAD_SELECTION;
44 protected SVNRevision getBeforeRevisionValue(final Change change, final SvnVcs vcs) throws SVNException {
45 final ContentRevision beforeRevision = change.getBeforeRevision();
46 if (beforeRevision != null) {
47 return ((SvnRevisionNumber) beforeRevision.getRevisionNumber()).getRevision();
48 } else {
49 return SVNRevision.create(((SvnRevisionNumber) change.getAfterRevision().getRevisionNumber()).getRevision().getNumber() - 1);
53 protected SVNRevision getAfterRevisionValue(final Change change, final SvnVcs vcs) throws SVNException {
54 final ContentRevision afterRevision = change.getAfterRevision();
55 if (afterRevision != null) {
56 return ((SvnRevisionNumber) afterRevision.getRevisionNumber()).getRevision();
57 } else {
58 return SVNRevision.create(((SvnRevisionNumber) change.getBeforeRevision().getRevisionNumber()).getRevision().getNumber() + 1);