SVN auth
[fedora-idea.git] / plugins / svn4idea / src / org / jetbrains / idea / svn / dialogs / ShareDialog.java
blob428ccb03251b8b8b3e2bc30fbe3b21075259e771
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.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;
25 import javax.swing.*;
27 public class ShareDialog extends RepositoryBrowserDialog {
28 private String mySelectedURL;
30 public ShareDialog(Project project) {
31 super(project);
34 public void init() {
35 super.init();
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);
44 });
45 getOKAction().setEnabled(getRepositoryBrowser().getSelectedURL() != null);
46 ((RepositoryTreeModel) getRepositoryBrowser().getRepositoryTree().getModel()).setShowFiles(false);
49 @Override
50 protected void doOKAction() {
51 mySelectedURL = getRepositoryBrowser().getSelectedURL();
52 super.doOKAction();
55 public String getSelectedURL() {
56 return mySelectedURL;
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());
64 group.add(newGroup);
65 group.addSeparator();
66 group.add(new RefreshAction());
67 group.add(new DiscardLocationAction());
68 ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu("", group);
69 return menu.getComponent();