diff options
Diffstat (limited to 'platform/dvcs-api/src')
5 files changed, 49 insertions, 34 deletions
diff --git a/platform/dvcs-api/src/com/intellij/dvcs/push/PushSupport.java b/platform/dvcs-api/src/com/intellij/dvcs/push/PushSupport.java index fbf6f148c3b1..a1ffabfab844 100644 --- a/platform/dvcs-api/src/com/intellij/dvcs/push/PushSupport.java +++ b/platform/dvcs-api/src/com/intellij/dvcs/push/PushSupport.java @@ -19,12 +19,9 @@ import com.intellij.dvcs.repo.Repository; import com.intellij.dvcs.repo.RepositoryManager; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.vcs.AbstractVcs; -import com.intellij.ui.SimpleColoredText; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.List; - /** * Base class to provide vcs-specific info */ @@ -50,27 +47,12 @@ public abstract class PushSupport<Repo extends Repository, Source extends PushSo public abstract Target getDefaultTarget(@NotNull Repo repository); /** - * @return All remote destinations which will be proposed to user in the target field completion. - * They will be shown in the same order as they appear in the returned list. - */ - @NotNull - public abstract List<String> getTargetNames(@NotNull Repo repository); - - /** * @return current source(branch) for repository */ @NotNull public abstract Source getSource(@NotNull Repo repository); /** - * Parse user input string, and create the VALID target for push - * - * @see #validateSpec(Repository, PushSpec) - */ - @NotNull - public abstract Target createTarget(@NotNull Repo repository, @NotNull String targetName); - - /** * @return RepositoryManager for vcs */ @NotNull @@ -81,11 +63,7 @@ public abstract class PushSupport<Repo extends Repository, Source extends PushSo return null; } - /** - * @return null if target is valid for selected repository - */ - @Nullable - public abstract VcsError validate(@NotNull Repo repository, @Nullable String targetToValidate); + @NotNull + public abstract PushTargetPanel<Target> createTargetPanel(@NotNull Repo repository, @Nullable Target defaultTarget); - public abstract SimpleColoredText renderTarget(@Nullable Target target); } diff --git a/platform/dvcs-api/src/com/intellij/dvcs/push/PushTarget.java b/platform/dvcs-api/src/com/intellij/dvcs/push/PushTarget.java index d7ed69d0875c..df6bfaefa79b 100644 --- a/platform/dvcs-api/src/com/intellij/dvcs/push/PushTarget.java +++ b/platform/dvcs-api/src/com/intellij/dvcs/push/PushTarget.java @@ -15,15 +15,9 @@ */ package com.intellij.dvcs.push; -import org.jetbrains.annotations.NotNull; - - /** * Destination for push action. (Remote for git or push-path for mercurial). */ public interface PushTarget { - @NotNull - //todo rename - > getName or smth - String getPresentation(); } diff --git a/platform/dvcs-api/src/com/intellij/dvcs/push/PushTargetPanel.java b/platform/dvcs-api/src/com/intellij/dvcs/push/PushTargetPanel.java new file mode 100644 index 000000000000..ede2f17410ee --- /dev/null +++ b/platform/dvcs-api/src/com/intellij/dvcs/push/PushTargetPanel.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2014 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 com.intellij.dvcs.push; + +import com.intellij.openapi.ui.ValidationInfo; +import com.intellij.ui.ColoredTreeCellRenderer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; + +public abstract class PushTargetPanel<T extends PushTarget> extends JPanel { + + abstract public void render(@NotNull ColoredTreeCellRenderer renderer); + + @NotNull + abstract public T getValue(); + + public abstract void fireOnCancel(); + + public abstract void fireOnChange(); + + @Nullable + public abstract ValidationInfo verify(); +} diff --git a/platform/dvcs-api/src/com/intellij/dvcs/push/VcsError.java b/platform/dvcs-api/src/com/intellij/dvcs/push/VcsError.java index b76095629ccd..e6c0e210429a 100644 --- a/platform/dvcs-api/src/com/intellij/dvcs/push/VcsError.java +++ b/platform/dvcs-api/src/com/intellij/dvcs/push/VcsError.java @@ -42,6 +42,6 @@ public class VcsError { } public static VcsError createEmptyTargetError(@NotNull String name) { - return new VcsError("Please, specify remote push path for repository " + name + "."); + return new VcsError("Please, specify not empty remote push path for repository " + name + "."); } } diff --git a/platform/dvcs-api/src/com/intellij/dvcs/repo/Repository.java b/platform/dvcs-api/src/com/intellij/dvcs/repo/Repository.java index 47cc17866c08..a71df5c39307 100644 --- a/platform/dvcs-api/src/com/intellij/dvcs/repo/Repository.java +++ b/platform/dvcs-api/src/com/intellij/dvcs/repo/Repository.java @@ -48,12 +48,9 @@ import org.jetbrains.annotations.Nullable; * If one needs a really 100 % up-to-date value, one should call {@link #update()} and then get...(). * update() is a synchronous read from repository file (.git or .hg), so it is guaranteed to query the real value. * </p> - * - * @author Nadya Zabrodina */ public interface Repository extends Disposable { - /** * Current state of the repository. */ @@ -62,24 +59,29 @@ public interface Repository extends Disposable { * HEAD is on branch, no merge process is in progress (and no rebase as well). */ NORMAL, + /** * During merge (for instance, merge failed with conflicts that weren't immediately resolved). */ MERGING { + @NotNull @Override public String toString() { return "Merging"; } }, + /** * During rebase. */ REBASING { + @NotNull @Override public String toString() { return "Rebasing"; } }, + /** * Detached HEAD state, but not during rebase (for example, manual checkout of a commit hash). */ @@ -99,6 +101,9 @@ public interface Repository extends Disposable { State getState(); @Nullable + String getCurrentBranchName(); + + @Nullable AbstractVcs getVcs(); /** |