cleanup (default impl)

This commit is contained in:
Vladimir Krivosheev
2017-05-16 16:40:13 +02:00
parent 6178888128
commit 51de0abc3f
4 changed files with 41 additions and 86 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -13,43 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.vcs.changes;
import com.intellij.openapi.ui.ValidationInfo;
import org.jetbrains.annotations.CalledInAwt;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Collection;
/**
* @author max
*/
public interface CommitSession {
CommitSession VCS_COMMIT = new CommitSession() {
public JComponent getAdditionalConfigurationUI() {
return null;
}
public JComponent getAdditionalConfigurationUI(Collection<Change> changes, String commitMessage) {
return null;
}
public boolean canExecute(Collection<Change> changes, String commitMessage) {
return true;
}
public void execute(Collection<Change> changes, String commitMessage) {
}
public void executionCanceled() {
}
@Override
public String getHelpId() {
return null;
public void execute(Collection<Change> changes, String commitMessage) {
}
};
@@ -57,21 +33,32 @@ public interface CommitSession {
* @deprecated Since version 7.0, {@link #getAdditionalConfigurationUI(java.util.Collection, String)} is called instead
*/
@Nullable
JComponent getAdditionalConfigurationUI();
default JComponent getAdditionalConfigurationUI() {
return null;
}
@Nullable
JComponent getAdditionalConfigurationUI(Collection<Change> changes, String commitMessage);
default JComponent getAdditionalConfigurationUI(Collection<Change> changes, String commitMessage) {
return null;
}
default boolean canExecute(Collection<Change> changes, String commitMessage) {
return true;
}
boolean canExecute(Collection<Change> changes, String commitMessage);
void execute(Collection<Change> changes, String commitMessage);
void executionCanceled();
default void executionCanceled() {
}
/**
* @return the ID of the help topic to show for the dialog
* @since 10.5
*/
@NonNls
String getHelpId();
@Nullable
default String getHelpId() {
return null;
}
@CalledInAwt
default ValidationInfo validateFields() {
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.vcs.changes.patch;
import com.intellij.CommonBundle;
@@ -55,7 +54,7 @@ import java.util.List;
import java.util.Set;
public class CreatePatchCommitExecutor extends LocalCommitExecutor implements ProjectComponent {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.patch.CreatePatchCommitExecutor");
private static final Logger LOG = Logger.getInstance(CreatePatchCommitExecutor.class);
private static final String VCS_PATCH_PATH_KEY = "vcs.patch.path";
private final Project myProject;
@@ -203,20 +202,11 @@ public class CreatePatchCommitExecutor extends LocalCommitExecutor implements Pr
}
}
@Override
public void executionCanceled() {
}
@Override
@Nullable
public ValidationInfo validateFields() {
return myPanel.validateFields();
}
@Override
public String getHelpId() {
return null;
}
}
@NotNull
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -26,9 +26,7 @@ import com.intellij.openapi.vcs.changes.*;
import com.intellij.util.WaitForProgressToShow;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Collection;
public class ShelveChangesCommitExecutor extends LocalCommitExecutor {
@@ -40,11 +38,13 @@ public class ShelveChangesCommitExecutor extends LocalCommitExecutor {
myProject = project;
}
@Override
@Nls
public String getActionText() {
return VcsBundle.message("shelve.changes.action");
}
@Override
@NotNull
public CommitSession createCommitSession() {
return new ShelveChangesCommitSession();
@@ -56,25 +56,16 @@ public class ShelveChangesCommitExecutor extends LocalCommitExecutor {
}
private class ShelveChangesCommitSession implements CommitSession, CommitSessionContextAware {
@Nullable
public JComponent getAdditionalConfigurationUI() {
return null;
}
@Override
public void setContext(CommitContext context) {
}
@Nullable
public JComponent getAdditionalConfigurationUI(final Collection<Change> changes, final String commitMessage) {
return null;
}
@Override
public boolean canExecute(Collection<Change> changes, String commitMessage) {
return changes.size() > 0;
}
@Override
public void execute(Collection<Change> changes, String commitMessage) {
if (changes.size() > 0 && !ChangesUtil.hasFileChanges(changes)) {
WaitForProgressToShow.runOrInvokeLaterAboveProgress(() -> Messages
@@ -102,6 +93,7 @@ public class ShelveChangesCommitExecutor extends LocalCommitExecutor {
}
}
@Override
public void executionCanceled() {
}
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2017 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.remoteServer.util;
import com.intellij.openapi.application.ApplicationManager;
@@ -34,7 +49,6 @@ import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -52,38 +66,10 @@ public class CloudGitDeploymentRuntime extends CloudDeploymentRuntime {
private static final String COMMIT_MESSAGE = "Deploy";
private static final CommitSession NO_COMMIT = new CommitSession() {
@Nullable
@Override
public JComponent getAdditionalConfigurationUI() {
return null;
}
@Nullable
@Override
public JComponent getAdditionalConfigurationUI(Collection<Change> changes, String commitMessage) {
return null;
}
@Override
public boolean canExecute(Collection<Change> changes, String commitMessage) {
return true;
}
@Override
public void execute(Collection<Change> changes, String commitMessage) {
}
@Override
public void executionCanceled() {
}
@Override
public String getHelpId() {
return null;
}
};
private static final List<CommitExecutor> ourCommitExecutors = Arrays.asList(