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
;
18 import com
.intellij
.openapi
.vcs
.EditFileProvider
;
19 import com
.intellij
.openapi
.vcs
.VcsException
;
20 import com
.intellij
.openapi
.vfs
.VirtualFile
;
21 import org
.tmatesoft
.svn
.core
.SVNException
;
22 import org
.tmatesoft
.svn
.core
.SVNProperty
;
23 import org
.tmatesoft
.svn
.core
.wc
.SVNPropertyData
;
24 import org
.tmatesoft
.svn
.core
.wc
.SVNRevision
;
25 import org
.tmatesoft
.svn
.core
.wc
.SVNWCClient
;
32 public class SvnEditFileProvider
implements EditFileProvider
{
33 private final SvnVcs myVCS
;
35 public SvnEditFileProvider(SvnVcs vcs
) {
39 public void editFiles(VirtualFile
[] files
) throws VcsException
{
40 File
[] ioFiles
= new File
[files
.length
];
41 SVNWCClient client
= myVCS
.createWCClient();
42 for (int i
= 0; i
< files
.length
; i
++) {
43 ioFiles
[i
] = new File(files
[i
].getPath());
45 SVNPropertyData property
= client
46 .doGetProperty(ioFiles
[i
], SVNProperty
.NEEDS_LOCK
, SVNRevision
.WORKING
, SVNRevision
.WORKING
);
47 if (property
== null || property
.getValue() == null) {
48 throw new VcsException(SvnBundle
.message("exception.text.file.miss.svn", ioFiles
[i
].getName()));
51 catch (SVNException e
) {
52 throw new VcsException(e
);
55 SvnUtil
.doLockFiles(myVCS
.getProject(), myVCS
, ioFiles
);
58 public String
getRequestText() {
59 return SvnBundle
.message("confirmation.text.edit.file");