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
;
30 * Created by IntelliJ IDEA.
34 * To change this template use File | Settings | File Templates.
36 public class SvnEditFileProvider
implements EditFileProvider
{
37 private final SvnVcs myVCS
;
39 public SvnEditFileProvider(SvnVcs vcs
) {
43 public void editFiles(VirtualFile
[] files
) throws VcsException
{
44 File
[] ioFiles
= new File
[files
.length
];
45 SVNWCClient client
= myVCS
.createWCClient();
46 for (int i
= 0; i
< files
.length
; i
++) {
47 ioFiles
[i
] = new File(files
[i
].getPath());
49 SVNPropertyData property
= client
50 .doGetProperty(ioFiles
[i
], SVNProperty
.NEEDS_LOCK
, SVNRevision
.WORKING
, SVNRevision
.WORKING
);
51 if (property
== null || property
.getValue() == null) {
52 throw new VcsException(SvnBundle
.message("exception.text.file.miss.svn", ioFiles
[i
].getName()));
55 catch (SVNException e
) {
56 throw new VcsException(e
);
59 SvnUtil
.doLockFiles(myVCS
.getProject(), myVCS
, ioFiles
);
62 public String
getRequestText() {
63 return SvnBundle
.message("confirmation.text.edit.file");