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
.dialogs
;
18 import com
.intellij
.openapi
.project
.Project
;
19 import com
.intellij
.openapi
.actionSystem
.DefaultActionGroup
;
20 import com
.intellij
.openapi
.actionSystem
.ActionPopupMenu
;
21 import com
.intellij
.openapi
.actionSystem
.ActionManager
;
23 import javax
.swing
.event
.TreeSelectionListener
;
24 import javax
.swing
.event
.TreeSelectionEvent
;
27 public class ShareDialog
extends RepositoryBrowserDialog
{
28 private String mySelectedURL
;
30 public ShareDialog(Project project
) {
36 setTitle("Select Parent Location");
37 setOKButtonText("Share");
38 getRepositoryBrowser().addChangeListener(new TreeSelectionListener() {
39 public void valueChanged(TreeSelectionEvent e
) {
40 if (getOKAction() != null) {
41 getOKAction().setEnabled(getRepositoryBrowser().getSelectedURL() != null);
45 getOKAction().setEnabled(getRepositoryBrowser().getSelectedURL() != null);
46 ((RepositoryTreeModel
) getRepositoryBrowser().getRepositoryTree().getModel()).setShowFiles(false);
50 protected void doOKAction() {
51 mySelectedURL
= getRepositoryBrowser().getSelectedURL();
55 public String
getSelectedURL() {
59 protected JPopupMenu
createPopup(boolean toolWindow
) {
60 DefaultActionGroup group
= new DefaultActionGroup();
61 DefaultActionGroup newGroup
= new DefaultActionGroup("_New", true);
62 newGroup
.add(new AddLocationAction());
63 newGroup
.add(new MkDirAction());
66 group
.add(new RefreshAction());
67 group
.add(new DiscardLocationAction());
68 ActionPopupMenu menu
= ActionManager
.getInstance().createActionPopupMenu("", group
);
69 return menu
.getComponent();