diff options
Diffstat (limited to 'plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs')
7 files changed, 4 insertions, 943 deletions
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchConfigurationDialog.form b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchConfigurationDialog.form deleted file mode 100644 index a416aa145505..000000000000 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchConfigurationDialog.form +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.idea.svn.dialogs.BranchConfigurationDialog"> - <grid id="27dc6" binding="myTopPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> - <margin top="0" left="0" bottom="0" right="0"/> - <constraints> - <xy x="20" y="20" width="500" height="400"/> - </constraints> - <properties/> - <border type="none"/> - <children> - <component id="c5128" class="javax.swing.JLabel"> - <constraints> - <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <text resource-bundle="org/jetbrains/idea/svn/SvnBundle" key="configure.branches.branch.locations"/> - </properties> - </component> - <grid id="67204" binding="myListPanel" layout-manager="BorderLayout" hgap="0" vgap="0"> - <constraints> - <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> - </constraints> - <properties/> - <border type="none"/> - <children/> - </grid> - <grid id="a677f" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> - <margin top="0" left="0" bottom="0" right="0"/> - <constraints> - <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> - </constraints> - <properties/> - <border type="none"/> - <children> - <component id="86684" class="javax.swing.JLabel"> - <constraints> - <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <text resource-bundle="org/jetbrains/idea/svn/SvnBundle" key="configure.branches.trunk.location"/> - </properties> - </component> - <component id="9d545" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myTrunkLocationTextField"> - <constraints> - <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> - <preferred-size width="150" height="-1"/> - </grid> - </constraints> - <properties/> - </component> - </children> - </grid> - <component id="f6743" class="javax.swing.JLabel" binding="myErrorPrompt"> - <constraints> - <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <text value="Label"/> - </properties> - </component> - </children> - </grid> -</form> diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchConfigurationDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchConfigurationDialog.java deleted file mode 100644 index 50ddd9615d41..000000000000 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchConfigurationDialog.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.idea.svn.dialogs; - -import com.intellij.openapi.actionSystem.ActionToolbarPosition; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.DialogWrapper; -import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.ui.MultiLineLabelUI; -import com.intellij.openapi.ui.TextFieldWithBrowseButton; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.vcs.VcsException; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.ui.*; -import com.intellij.ui.components.JBList; -import com.intellij.util.ObjectUtils; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.idea.svn.*; -import org.jetbrains.idea.svn.branchConfig.InfoReliability; -import org.jetbrains.idea.svn.branchConfig.InfoStorage; -import org.jetbrains.idea.svn.branchConfig.SvnBranchConfigManager; -import org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew; -import org.jetbrains.idea.svn.commandLine.SvnBindException; -import org.jetbrains.idea.svn.integrate.SvnBranchItem; -import org.tmatesoft.svn.core.SVNURL; -import org.tmatesoft.svn.core.internal.util.SVNURLUtil; - -import javax.swing.*; -import javax.swing.event.DocumentEvent; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -/** - * @author yole - */ -public class BranchConfigurationDialog extends DialogWrapper { - private JPanel myTopPanel; - private TextFieldWithBrowseButton myTrunkLocationTextField; - private JList myLocationList; - private JPanel myListPanel; - private JLabel myErrorPrompt; - private final SvnBranchConfigManager mySvnBranchConfigManager; - private final VirtualFile myRoot; - - public BranchConfigurationDialog(@NotNull final Project project, - @NotNull final SvnBranchConfigurationNew configuration, - final @NotNull SVNURL rootUrl, - @NotNull final VirtualFile root, - @NotNull String url) { - super(project, true); - myRoot = root; - init(); - setTitle(SvnBundle.message("configure.branches.title")); - - final String trunkUrl = configuration.getTrunkUrl(); - if (trunkUrl == null || trunkUrl.trim().length() == 0) { - configuration.setTrunkUrl(url); - } - - mySvnBranchConfigManager = SvnBranchConfigurationManager.getInstance(project).getSvnBranchConfigManager(); - - myTrunkLocationTextField.setText(configuration.getTrunkUrl()); - myTrunkLocationTextField.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - final String selectedUrl = SelectLocationDialog.selectLocation(project, myTrunkLocationTextField.getText()); - if (selectedUrl != null) { - myTrunkLocationTextField.setText(selectedUrl); - } - } - }); - - final TrunkUrlValidator trunkUrlValidator = new TrunkUrlValidator(rootUrl, configuration); - myTrunkLocationTextField.getTextField().getDocument().addDocumentListener(trunkUrlValidator); - trunkUrlValidator.textChanged(null); - - myErrorPrompt.setUI(new MultiLineLabelUI()); - myErrorPrompt.setForeground(SimpleTextAttributes.ERROR_ATTRIBUTES.getFgColor()); - - final MyListModel listModel = new MyListModel(configuration); - myLocationList = new JBList(listModel); - - myListPanel.add( - ToolbarDecorator.createDecorator(myLocationList) - .setAddAction(new AnActionButtonRunnable() { - - @Nullable private SVNURL usedRootUrl; - - @Override - public void run(AnActionButton button) { - Pair<String, SVNURL> result = SelectLocationDialog.selectLocation(project, ObjectUtils.notNull(usedRootUrl, rootUrl)); - if (result != null) { - String selectedUrl = result.getFirst(); - usedRootUrl = result.getSecond(); - if (selectedUrl != null) { - if (!configuration.getBranchUrls().contains(selectedUrl)) { - configuration - .addBranches(selectedUrl, new InfoStorage<List<SvnBranchItem>>(new ArrayList<SvnBranchItem>(), InfoReliability.empty)); - mySvnBranchConfigManager.reloadBranches(myRoot, selectedUrl, null); - listModel.fireItemAdded(); - myLocationList.setSelectedIndex(listModel.getSize() - 1); - } - } - } - } - }).setRemoveAction(new AnActionButtonRunnable() { - @Override - public void run(AnActionButton button) { - int selIndex = myLocationList.getSelectedIndex(); - Object[] selection = myLocationList.getSelectedValues(); - for (Object urlObj : selection) { - String url = (String)urlObj; - int index = configuration.getBranchUrls().indexOf(url); - configuration.removeBranch(url); - listModel.fireItemRemoved(index); - } - if (listModel.getSize() > 0) { - if (selIndex >= listModel.getSize()) - selIndex = listModel.getSize() - 1; - myLocationList.setSelectedIndex(selIndex); - } - } - }).disableUpDownActions().setToolbarPosition(ActionToolbarPosition.BOTTOM).createPanel(), BorderLayout.CENTER); - } - - private class TrunkUrlValidator extends DocumentAdapter { - private final SVNURL myRootUrl; - private final SvnBranchConfigurationNew myConfiguration; - - private TrunkUrlValidator(final SVNURL rootUrl, final SvnBranchConfigurationNew configuration) { - myRootUrl = rootUrl; - myConfiguration = configuration; - } - - protected void textChanged(final DocumentEvent e) { - SVNURL url = parseUrl(myTrunkLocationTextField.getText()); - - if (url != null) { - boolean isAncestor = SVNURLUtil.isAncestor(myRootUrl, url); - boolean areNotSame = isAncestor && !url.equals(myRootUrl); - - myTrunkLocationTextField.getButton().setEnabled(isAncestor); - if (areNotSame) { - myConfiguration.setTrunkUrl(url.toDecodedString()); - } - myErrorPrompt.setText(areNotSame ? "" : SvnBundle.message("configure.branches.error.wrong.url", myRootUrl)); - } - } - - @Nullable - private SVNURL parseUrl(@NotNull String url) { - SVNURL result = null; - - try { - result = SvnUtil.createUrl(url); - } - catch (SvnBindException e) { - myErrorPrompt.setText(e.getMessage()); - } - - return result; - } - } - - @Nullable - protected JComponent createCenterPanel() { - return myTopPanel; - } - - @Override - @NonNls - protected String getDimensionServiceKey() { - return "Subversion.BranchConfigurationDialog"; - } - - public static void configureBranches(final Project project, final VirtualFile file) { - configureBranches(project, file, false); - } - - public static void configureBranches(final Project project, final VirtualFile file, final boolean isRoot) { - final VirtualFile vcsRoot = (isRoot) ? file : getRoot(project, file); - if (vcsRoot == null) { - return; - } - - final VirtualFile directory = SvnUtil.correctRoot(project, file); - if (directory == null) { - return; - } - final RootUrlInfo wcRoot = SvnVcs.getInstance(project).getSvnFileUrlMapping().getWcRootForFilePath(new File(directory.getPath())); - if (wcRoot == null) { - return; - } - final SVNURL rootUrl = wcRoot.getRepositoryUrlUrl(); - if (rootUrl == null) { - Messages.showErrorDialog(project, SvnBundle.message("configure.branches.error.no.connection.title"), - SvnBundle.message("configure.branches.title")); - return; - } - - SvnBranchConfigurationNew configuration; - try { - configuration = SvnBranchConfigurationManager.getInstance(project).get(vcsRoot); - } - catch (VcsException ex) { - Messages.showErrorDialog(project, "Error loading branch configuration: " + ex.getMessage(), - SvnBundle.message("configure.branches.title")); - return; - } - - final SvnBranchConfigurationNew clonedConfiguration = configuration.copy(); - BranchConfigurationDialog dlg = new BranchConfigurationDialog(project, clonedConfiguration, rootUrl, vcsRoot, wcRoot.getUrl()); - dlg.show(); - if (dlg.isOK()) { - SvnBranchConfigurationManager.getInstance(project).setConfiguration(vcsRoot, clonedConfiguration); - } - } - - private static VirtualFile getRoot(Project project, VirtualFile file) { - RootUrlInfo path = SvnVcs.getInstance(project).getSvnFileUrlMapping().getWcRootForFilePath(new File(file.getPath())); - return path == null ? null : path.getVirtualFile(); - } - - private static class MyListModel extends AbstractListModel { - private final SvnBranchConfigurationNew myConfiguration; - private List<String> myBranchUrls; - - public MyListModel(final SvnBranchConfigurationNew configuration) { - myConfiguration = configuration; - myBranchUrls = myConfiguration.getBranchUrls(); - } - - public int getSize() { - return myBranchUrls.size(); - } - - public Object getElementAt(final int index) { - return myBranchUrls.get(index); - } - - public void fireItemAdded() { - final int index = myConfiguration.getBranchUrls().size() - 1; - myBranchUrls = myConfiguration.getBranchUrls(); - super.fireIntervalAdded(this, index, index); - } - - public void fireItemRemoved(final int index) { - myBranchUrls = myConfiguration.getBranchUrls(); - super.fireIntervalRemoved(this, index, index); - } - } -} diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java index 9ca5b89d517a..1b48f9d70e5b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java @@ -45,7 +45,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.*; import org.jetbrains.idea.svn.actions.CleanupWorker; -import org.jetbrains.idea.svn.actions.SelectBranchPopup; +import org.jetbrains.idea.svn.branchConfig.BranchConfigurationDialog; +import org.jetbrains.idea.svn.branchConfig.SelectBranchPopup; import org.jetbrains.idea.svn.api.ClientFactory; import org.jetbrains.idea.svn.api.Depth; import org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.form b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.form deleted file mode 100644 index 6dfcae6c9f6f..000000000000 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.form +++ /dev/null @@ -1,226 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.idea.svn.dialogs.CreateBranchOrTagDialog"> - <grid id="9287c" binding="myTopPanel" layout-manager="GridBagLayout"> - <constraints> - <xy x="10" y="10" width="561" height="502"/> - </constraints> - <properties/> - <border type="none"/> - <children> - <scrollpane id="57f3f" class="com.intellij.ui.components.JBScrollPane"> - <constraints> - <grid row="3" column="0" row-span="1" col-span="3" vsize-policy="6" hsize-policy="6" anchor="8" fill="3" indent="0" use-parent-layout="false"/> - <gridbag top="2" left="2" bottom="2" right="2" weightx="1.0" weighty="1.0"/> - </constraints> - <properties/> - <border type="none"/> - <children> - <component id="cdd55" class="javax.swing.JTextArea" binding="myCommentText"> - <constraints/> - <properties> - <columns value="25"/> - <lineWrap value="true"/> - <rows value="4"/> - <wrapStyleWord value="true"/> - </properties> - </component> - </children> - </scrollpane> - <grid id="9317" layout-manager="GridLayoutManager" row-count="7" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> - <margin top="0" left="0" bottom="0" right="0"/> - <constraints> - <grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> - <gridbag weightx="0.0" weighty="0.0"/> - </constraints> - <properties/> - <clientProperties> - <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/> - </clientProperties> - <border type="none" title="Copy From"/> - <children> - <component id="15c1b" class="javax.swing.JRadioButton" binding="myWorkingCopyRadioButton" default-binding="true"> - <constraints> - <grid row="0" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <selected value="true"/> - <text value="&Working Copy"/> - </properties> - </component> - <component id="643a9" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myWorkingCopyField"> - <constraints> - <grid row="1" column="0" row-span="1" col-span="4" vsize-policy="0" hsize-policy="6" anchor="0" fill="3" indent="2" use-parent-layout="false"/> - </constraints> - <properties/> - </component> - <component id="27881" class="javax.swing.JRadioButton" binding="myRepositoryRadioButton" default-binding="true"> - <constraints> - <grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <text value="&Repository Location:"/> - </properties> - </component> - <component id="d7ae0" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myRepositoryField"> - <constraints> - <grid row="5" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="6" anchor="0" fill="3" indent="2" use-parent-layout="false"/> - </constraints> - <properties/> - </component> - <component id="675da" class="javax.swing.JLabel"> - <constraints> - <grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/> - </constraints> - <properties> - <text value="Re&vision:"/> - </properties> - </component> - <nested-form id="23004" form-file="org/jetbrains/idea/svn/update/SvnRevisionPanel.form" binding="myRevisionPanel"> - <constraints> - <grid row="6" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> - </constraints> - </nested-form> - <hspacer id="b36ab"> - <constraints> - <grid row="6" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> - </constraints> - </hspacer> - <component id="13071" class="javax.swing.JButton" binding="myProjectButton"> - <constraints> - <grid row="5" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <margin top="2" left="2" bottom="2" right="2"/> - <text value=""/> - <toolTipText value="Use project location"/> - </properties> - </component> - <component id="658a" class="javax.swing.JLabel" binding="myUseThisVariantToLabel"> - <constraints> - <grid row="2" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/> - </constraints> - <properties> - <text resource-bundle="org/jetbrains/idea/svn/SvnBundle" key="dialog.create.branch.or.tag.from.working.copy.warning"/> - </properties> - </component> - <component id="ff73f" class="com.intellij.ui.components.JBCheckBox" binding="mySwitchOnCreate"> - <constraints> - <grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/> - </constraints> - <properties> - <margin top="0" left="-1" bottom="2" right="3"/> - <text resource-bundle="org/jetbrains/idea/svn/SvnBundle" key="create.branch.switch.on.create.title"/> - </properties> - </component> - </children> - </grid> - <grid id="a6551" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> - <margin top="0" left="0" bottom="0" right="0"/> - <constraints> - <grid row="1" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> - <gridbag weightx="0.0" weighty="0.0"/> - </constraints> - <properties/> - <clientProperties> - <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/> - </clientProperties> - <border type="none" title="Copy To"/> - <children> - <component id="f1672" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myToURLText"> - <constraints> - <grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="2" use-parent-layout="false"/> - </constraints> - <properties/> - </component> - <component id="adefb" class="javax.swing.JLabel"> - <constraints> - <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/> - </constraints> - <properties> - <labelFor value="6108c"/> - <text value="Base URL:"/> - </properties> - </component> - <component id="6108c" class="com.intellij.ui.ComboboxWithBrowseButton" binding="myBranchTagBaseComboBox" default-binding="true"> - <constraints> - <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/> - </constraints> - <properties/> - </component> - <component id="6d628" class="javax.swing.JLabel"> - <constraints> - <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/> - </constraints> - <properties> - <labelFor value="d3a1"/> - <text value="Name:"/> - </properties> - </component> - <component id="d3a1" class="javax.swing.JTextField" binding="myBranchTextField"> - <constraints> - <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> - <preferred-size width="90" height="-1"/> - </grid> - </constraints> - <properties> - <columns value="25"/> - <text value="new_branch"/> - </properties> - </component> - <component id="f3aad" class="javax.swing.JRadioButton" binding="myBranchOrTagRadioButton" default-binding="true"> - <constraints> - <grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <selected value="true"/> - <text value="Branch or Tag"/> - </properties> - </component> - <component id="2c5d3" class="javax.swing.JRadioButton" binding="myAnyLocationRadioButton" default-binding="true"> - <constraints> - <grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <text value="Any Location"/> - </properties> - </component> - </children> - </grid> - <component id="a28bf" class="javax.swing.JLabel" binding="myErrorLabel"> - <constraints> - <grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - <gridbag weightx="0.0" weighty="0.0"/> - </constraints> - <properties> - <foreground awt-color="red"/> - <text value=" "/> - </properties> - </component> - <component id="b34c" class="com.intellij.ui.TitledSeparator"> - <constraints> - <grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> - <gridbag weightx="0.0" weighty="0.0"/> - </constraints> - <properties> - <labelFor value="cdd55"/> - <text resource-bundle="org/jetbrains/idea/svn/SvnBundle" key="label.copy.comment"/> - </properties> - </component> - </children> - </grid> - <buttonGroups> - <group name="buttonGroup1"> - <member id="7c7ec"/> - <member id="9b927"/> - <member id="19731"/> - </group> - <group name="buttonGroup2"> - <member id="15c1b"/> - <member id="27881"/> - </group> - <group name="buttonGroup3"> - <member id="f3aad"/> - <member id="2c5d3"/> - </group> - </buttonGroups> -</form> diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.java deleted file mode 100644 index a09de54fdbc4..000000000000 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jetbrains.idea.svn.dialogs; - -import com.intellij.icons.AllIcons; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; -import com.intellij.openapi.help.HelpManager; -import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.DialogWrapper; -import com.intellij.openapi.ui.TextFieldWithBrowseButton; -import com.intellij.openapi.vcs.VcsException; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.ui.ComboboxWithBrowseButton; -import com.intellij.ui.DocumentAdapter; -import com.intellij.ui.components.JBCheckBox; -import com.intellij.util.ArrayUtil; -import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.idea.svn.RootUrlInfo; -import org.jetbrains.idea.svn.SvnBranchConfigurationManager; -import org.jetbrains.idea.svn.SvnBundle; -import org.jetbrains.idea.svn.SvnVcs; -import org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew; -import org.jetbrains.idea.svn.info.Info; -import org.jetbrains.idea.svn.update.SvnRevisionPanel; -import org.tmatesoft.svn.core.internal.util.SVNEncodingUtil; -import org.tmatesoft.svn.core.internal.util.SVNPathUtil; -import org.tmatesoft.svn.core.wc.SVNRevision; - -import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.DocumentEvent; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; - -/** - * Created by IntelliJ IDEA. - * User: alex - * Date: 05.07.2005 - * Time: 23:35:12 - */ -public class CreateBranchOrTagDialog extends DialogWrapper { - private static final Logger LOG = Logger.getInstance("org.jetbrains.idea.svn.dialogs.CopyDialog"); - - private final File mySrcFile; - private String mySrcURL; - private final Project myProject; - private String myURL; - - private TextFieldWithBrowseButton myToURLText; - - private JTextArea myCommentText; - private JPanel myTopPanel; - private JRadioButton myWorkingCopyRadioButton; - private JRadioButton myRepositoryRadioButton; - private TextFieldWithBrowseButton myWorkingCopyField; - private TextFieldWithBrowseButton myRepositoryField; - private SvnRevisionPanel myRevisionPanel; - private ComboboxWithBrowseButton myBranchTagBaseComboBox; - private JTextField myBranchTextField; - private JRadioButton myBranchOrTagRadioButton; - private JRadioButton myAnyLocationRadioButton; - private JButton myProjectButton; - private JLabel myErrorLabel; - private JLabel myUseThisVariantToLabel; - private JBCheckBox mySwitchOnCreate; - - @NonNls private static final String HELP_ID = "vcs.subversion.branch"; - private SvnBranchConfigurationNew myBranchConfiguration; - private final VirtualFile mySrcVirtualFile; - private final String myWcRootUrl; - - public CreateBranchOrTagDialog(final Project project, boolean canBeParent, File file) throws VcsException { - super(project, canBeParent); - mySrcFile = file; - myProject = project; - setResizable(true); - setTitle(SvnBundle.message("dialog.title.branch")); - getHelpAction().setEnabled(true); - myUseThisVariantToLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); - myProjectButton.setIcon(AllIcons.Nodes.IdeaProject); - myBranchTagBaseComboBox.setPreferredSize(new Dimension(myBranchTagBaseComboBox.getPreferredSize().width, - myWorkingCopyField.getPreferredSize().height)); - - myWorkingCopyField.addBrowseFolderListener("Select Working Copy Location", "Select Location to Copy From:", - project, FileChooserDescriptorFactory.createSingleFolderDescriptor()); - myWorkingCopyField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() { - protected void textChanged(final DocumentEvent e) { - updateControls(); - } - }); - myRepositoryField.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - String url = SelectLocationDialog.selectLocation(project, mySrcURL); - if (url != null) { - myRepositoryField.setText(url); - } - } - }); - myRepositoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() { - protected void textChanged(final DocumentEvent e) { - updateToURL(); - } - }); - myToURLText.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - String url = myToURLText.getText(); - String dstName = SVNPathUtil.tail(mySrcURL); - dstName = SVNEncodingUtil.uriDecode(dstName); - url = SelectLocationDialog.selectCopyDestination(myProject, SVNPathUtil.removeTail(url), - SvnBundle.message("label.copy.select.location.dialog.copy.as"), dstName, false); - if (url != null) { - myToURLText.setText(url); - } - } - }); - - VirtualFile srcVirtualFile; - RootUrlInfo root = SvnVcs.getInstance(myProject).getSvnFileUrlMapping().getWcRootForFilePath(file); - if (root == null) { - throw new VcsException("Can not find working copy for file: " + file.getPath()); - } - srcVirtualFile = root.getVirtualFile(); - if (srcVirtualFile == null) { - throw new VcsException("Can not find working copy for file: " + file.getPath()); - } - this.mySrcVirtualFile = srcVirtualFile; - myWcRootUrl = root.getUrl(); - - myRevisionPanel.setRoot(mySrcVirtualFile); - myRevisionPanel.setProject(myProject); - myRevisionPanel.setUrlProvider(new SvnRevisionPanel.UrlProvider() { - public String getUrl() { - return mySrcURL; - } - }); - updateBranchTagBases(); - - myRevisionPanel.addChangeListener(new ChangeListener() { - public void stateChanged(final ChangeEvent e) { - getOKAction().setEnabled(isOKActionEnabled()); - } - }); - - init(); - ActionListener listener = new ActionListener() { - public void actionPerformed(ActionEvent e) { - updateControls(); - } - }; - myWorkingCopyRadioButton.addActionListener(listener); - myRepositoryRadioButton.addActionListener(listener); - myBranchOrTagRadioButton.addActionListener(listener); - myAnyLocationRadioButton.addActionListener(listener); - updateControls(); - myBranchTextField.getDocument().addDocumentListener(new DocumentAdapter() { - protected void textChanged(final DocumentEvent e) { - updateToURL(); - } - }); - updateToURL(); - myProjectButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - myRepositoryField.setText(myWcRootUrl); - } - }); - myBranchTagBaseComboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - BranchConfigurationDialog.configureBranches(project, mySrcVirtualFile, true); - updateBranchTagBases(); - updateControls(); - } - }); - myBranchTagBaseComboBox.getComboBox().addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - updateToURL(); - updateControls(); - } - }); - } - - private void updateBranchTagBases() { - try { - myBranchConfiguration = SvnBranchConfigurationManager.getInstance(myProject).get(mySrcVirtualFile); - final String[] strings = ArrayUtil.toStringArray(myBranchConfiguration.getBranchUrls()); - myBranchTagBaseComboBox.getComboBox().setModel(new DefaultComboBoxModel(strings)); - } - catch (VcsException e) { - LOG.info(e); - myBranchTagBaseComboBox.setEnabled(false); - } - } - - private void updateToURL() { - if (myBranchConfiguration == null) { - return; - } - String relativeUrl; - if (myWorkingCopyRadioButton.isSelected()) { - relativeUrl = myBranchConfiguration.getRelativeUrl(mySrcURL); - } - else { - relativeUrl = myBranchConfiguration.getRelativeUrl(myRepositoryField.getText()); - } - - final Object selectedBranch = myBranchTagBaseComboBox.getComboBox().getSelectedItem(); - if (relativeUrl != null && selectedBranch != null) { - myToURLText.setText(selectedBranch.toString() + "/" + myBranchTextField.getText() + relativeUrl); - } - } - - private String getToURLTextFromBranch() { - final Object selectedBranch = myBranchTagBaseComboBox.getComboBox().getSelectedItem(); - if (selectedBranch != null) { - return selectedBranch + "/" + myBranchTextField.getText(); - } - return null; - } - - private void updateControls() { - myWorkingCopyField.setEnabled(myWorkingCopyRadioButton.isSelected()); - mySwitchOnCreate.setEnabled(myWorkingCopyRadioButton.isSelected()); - myRepositoryField.setEnabled(myRepositoryRadioButton.isSelected()); - myRevisionPanel.setEnabled(myRepositoryRadioButton.isSelected()); - myProjectButton.setEnabled(myRepositoryRadioButton.isSelected()); - - myBranchTagBaseComboBox.setEnabled(myBranchOrTagRadioButton.isSelected()); - myBranchTextField.setEnabled(myBranchOrTagRadioButton.isSelected()); - myToURLText.setEnabled(myAnyLocationRadioButton.isSelected()); - myUseThisVariantToLabel.setForeground(myWorkingCopyRadioButton.isSelected() ? UIUtil.getActiveTextColor() : UIUtil.getInactiveTextColor()); - - getOKAction().setEnabled(isOKActionEnabled()); - } - - @NotNull - protected Action[] createActions() { - return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; - } - - protected void doHelpAction() { - HelpManager.getInstance().invokeHelp(HELP_ID); - } - - protected void init() { - super.init(); - SvnVcs vcs = SvnVcs.getInstance(myProject); - String revStr = ""; - Info info = vcs.getInfo(mySrcFile); - if (info != null) { - mySrcURL = info.getURL() == null ? null : info.getURL().toString(); - revStr = String.valueOf(info.getRevision()); - myURL = mySrcURL; - } - if (myURL == null) { - return; - } - myWorkingCopyField.setText(mySrcFile.toString()); - myRepositoryField.setText(mySrcURL); - myToURLText.setText(myURL); - myRevisionPanel.setRevisionText(revStr); - updateControls(); - - myWorkingCopyRadioButton.setSelected(true); - } - - public String getComment() { - return myCommentText.getText(); - } - - public SVNRevision getRevision() { - if (myWorkingCopyRadioButton.isSelected()) { - return SVNRevision.WORKING; - } - else { - try { - return myRevisionPanel.getRevision(); - } - catch (ConfigurationException e) { - return SVNRevision.UNDEFINED; - } - } - } - - public String getToURL() { - if (myBranchOrTagRadioButton.isSelected()) { - return getToURLTextFromBranch(); - } - return myToURLText.getText(); - } - - protected JComponent createCenterPanel() { - return myTopPanel; - } - - public JComponent getPreferredFocusedComponent() { - return myToURLText; - } - - public boolean shouldCloseOnCross() { - return true; - } - - protected String getDimensionServiceKey() { - return "svn.copyDialog"; - } - - public boolean isOKActionEnabled() { - myErrorLabel.setText(" "); - if (myURL == null) { - return false; - } - if (myBranchOrTagRadioButton.isSelected() && myBranchTagBaseComboBox.getComboBox().getSelectedItem() == null) { - myErrorLabel.setText(SvnBundle.message("create.branch.no.base.location.error")); - return false; - } - String url = getToURL(); - if (url != null && url.trim().length() > 0) { - if (myRepositoryRadioButton.isSelected()) { - SVNRevision revision; - try { - revision = myRevisionPanel.getRevision(); - } - catch (ConfigurationException e) { - revision = SVNRevision.UNDEFINED; - } - if (!revision.isValid() || revision.isLocal()) { - myErrorLabel.setText(SvnBundle.message("create.branch.invalid.revision.error", myRevisionPanel.getRevisionText())); - return false; - } - return true; - } - else if (myWorkingCopyRadioButton.isSelected()) { - Info info = SvnVcs.getInstance(myProject).getInfo(mySrcFile); - String srcUrl = info != null && info.getURL() != null ? info.getURL().toString() : null; - if (srcUrl == null) { - myErrorLabel.setText(SvnBundle.message("create.branch.no.working.copy.error", myWorkingCopyField.getText())); - return false; - } - return true; - } - } - return false; - } - - public boolean isCopyFromWorkingCopy() { - return myWorkingCopyRadioButton.isSelected(); - } - - public String getCopyFromPath() { - return myWorkingCopyField.getText(); - } - - public String getCopyFromUrl() { - return myRepositoryField.getText(); - } - - public boolean isSwitchOnCreate() { - return mySwitchOnCreate.isSelected(); - } -} diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java index cd504be56077..437e7f57e464 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java @@ -41,7 +41,6 @@ import org.jetbrains.idea.svn.properties.PropertyConsumer; import org.jetbrains.idea.svn.properties.PropertyData; import org.jetbrains.idea.svn.properties.PropertyValue; import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNProperty; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.wc.SVNRevision; import org.tmatesoft.svn.core.wc2.SvnTarget; @@ -309,7 +308,7 @@ public class PropertiesComponent extends JPanel { PropertyValue propValue = null; try { propValue = myVcs.getFactory(myFile).createPropertyClient() - .getProperty(SvnTarget.fromFile(myFile), SVNProperty.KEYWORDS, false, SVNRevision.WORKING); + .getProperty(SvnTarget.fromFile(myFile), SvnPropertyKeys.SVN_KEYWORDS, false, SVNRevision.WORKING); } catch (VcsException e1) { // show erorr message diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java index 163be4922224..f7e54a64f0ad 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java @@ -266,7 +266,7 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Da if (entry.getName().lastIndexOf('.') > 0 && !manager.getFileTypeByFileName(name).isBinary()) { SVNURL url = node.getURL(); final SvnFileRevision revision = new SvnFileRevision(myVCS, SVNRevision.UNDEFINED, SVNRevision.HEAD, url.toString(), - entry.getAuthor(), entry.getDate(), null, null, null); + entry.getAuthor(), entry.getDate(), null, null); return new VcsVirtualFile(node.getSVNDirEntry().getName(), revision, VcsFileSystem.getInstance()); } else { |