annotations added; bookmark creation for revision removed

This commit is contained in:
Nadya Zabrodina
2013-06-20 18:31:04 +04:00
parent 312735d2a9
commit 5777012ccb
5 changed files with 15 additions and 37 deletions
@@ -154,7 +154,7 @@ public class HgBranchPopupActions {
if (bookmarkDialog.isOK()) {
try {
final String name = bookmarkDialog.getName();
new HgBookmarkCreateCommand(myProject, myPreselectedRepo, name, bookmarkDialog.getRevision(),
new HgBookmarkCreateCommand(myProject, myPreselectedRepo, name,
bookmarkDialog.isActive()).execute(new HgCommandResultHandler() {
@Override
public void process(@Nullable HgCommandResult result) {
@@ -19,18 +19,15 @@ public class HgBookmarkCreateCommand {
@NotNull private final Project myProject;
@NotNull private final VirtualFile myRepo;
@Nullable private final String myBookmarkName;
@Nullable private final String myRevisionNumber;
private final boolean isActive;
public HgBookmarkCreateCommand(@NotNull Project project,
@NotNull VirtualFile repo,
@Nullable String bookmarkName,
@Nullable String revisionNumber,
boolean active) {
myProject = project;
myRepo = repo;
myBookmarkName = bookmarkName;
myRevisionNumber = revisionNumber;
isActive = active;
}
@@ -40,10 +37,6 @@ public class HgBookmarkCreateCommand {
}
List<String> arguments = new ArrayList<String>();
arguments.add(myBookmarkName);
if (!StringUtil.isEmptyOrSpaces(myRevisionNumber)) {
arguments.add("--rev");
arguments.add(myRevisionNumber);
}
if (!isActive) {
arguments.add("--inactive");
}
@@ -13,7 +13,7 @@
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="2f1ad" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="2f1ad" layout-manager="GridLayoutManager" row-count="2" 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="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -26,7 +26,7 @@
<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 value="Bookmark name:"/>
<text value=" Bookmark name:"/>
</properties>
</component>
<component id="f1186" class="javax.swing.JTextField" binding="myBookmarkName">
@@ -37,27 +37,13 @@
</constraints>
<properties/>
</component>
<component id="444b4" 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 value="For Revision:"/>
</properties>
</component>
<component id="44d66" class="javax.swing.JTextField" binding="myRevision">
<constraints>
<grid row="1" 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>
<component id="70819" class="javax.swing.JCheckBox" binding="myActiveCheckbox">
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" 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>
<horizontalAlignment value="10"/>
<horizontalTextPosition value="10"/>
<text value="Inactive"/>
</properties>
</component>
@@ -13,10 +13,9 @@ import javax.swing.*;
* @author Nadya Zabrodina
*/
public class HgBookmarkDialog extends DialogWrapper {
private JPanel myContentPanel;
private JTextField myRevision;
private JTextField myBookmarkName;
private JCheckBox myActiveCheckbox;
@NotNull private JPanel myContentPanel;
@NotNull private JTextField myBookmarkName;
@NotNull private JCheckBox myActiveCheckbox;
public HgBookmarkDialog(@Nullable Project project) {
super(project, false);
@@ -31,33 +30,33 @@ public class HgBookmarkDialog extends DialogWrapper {
}
@Override
@NotNull
public JComponent getPreferredFocusedComponent() {
return myBookmarkName;
}
@Override
@NotNull
protected String getDimensionServiceKey() {
return HgBookmarkDialog.class.getName();
}
@NotNull
protected JComponent createCenterPanel() {
return myContentPanel;
}
@NotNull
public String getRevision() {
return myRevision.getText();
}
public boolean isActive() {
return !myActiveCheckbox.isSelected();
}
@Nullable
public String getName() {
return myBookmarkName.getText();
}
@Override
@Nullable
protected ValidationInfo doValidate() {
String message = "You have to specify bookmark name.";
if (StringUtil.isEmptyOrSpaces(getName())) {
@@ -98,7 +98,7 @@ public class HgRepositoryReaderTest extends HgPlatformTest {
assertEquals(myRepositoryReader.readCurrentBookmark(), "B_BookMark");
}
@NotNull
@NotNull
private Collection<String> readBookmarks() throws IOException {
Collection<String> bookmarks = new HashSet<String>();
File bookmarksFile = new File(myHgDir, "bookmarks");