Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vladislav.Soroka
2013-10-02 19:24:09 +04:00
12 changed files with 109 additions and 121 deletions
@@ -59,7 +59,5 @@
<extensionPoint name="vcs.rootFinder" interface="com.intellij.openapi.vcs.VcsRootFinder" area="IDEA_PROJECT"/>
<extensionPoint name="logProvider" interface="com.intellij.vcs.log.VcsLogProvider" area="IDEA_PROJECT"/>
<extensionPoint name="beforeCommitDialog" interface="com.intellij.openapi.vcs.checkin.BeforeCommitDialogHandler"/>
</extensionPoints>
</idea-plugin>
@@ -38,8 +38,6 @@
<applicationService serviceInterface="com.intellij.openapi.vcs.impl.CheckinHandlersManager"
serviceImplementation="com.intellij.openapi.vcs.impl.CheckinHandlersManagerImpl"/>
<pathMacroFilter implementation="com.intellij.openapi.vcs.VcsPathMacroFilter"/>
<beforeCommitDialog implementation="com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog$MyBeforeCommitDialogHandler" order="last"/>
</extensions>
</idea-plugin>
@@ -16,7 +16,6 @@
package com.intellij.openapi.vcs;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.diff.impl.patch.formove.FilePathComparator;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.UnnamedConfigurable;
@@ -59,7 +58,6 @@ import java.util.List;
public abstract class AbstractVcs<ComList extends CommittedChangeList> extends StartedActivated {
// true is default
private static final String USE_ANNOTATION_CACHE = "vcs.use.annotation.cache";
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.AbstractVcs");
@NonNls protected static final String ourIntegerPattern = "\\d+";
@@ -27,7 +27,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.actions.VcsContextFactory;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
import org.jetbrains.annotations.NotNull;
@@ -40,7 +40,7 @@ import java.util.*;
* @author max
*/
public class ChangesUtil {
private static final Key<Boolean> INTERNAL_OPERATION_KEY = Key.<Boolean>create("internal vcs operation");
private static final Key<Boolean> INTERNAL_OPERATION_KEY = Key.create("internal vcs operation");
private ChangesUtil() {}
@@ -148,7 +148,7 @@ public class ChangesUtil {
}
}
}
return VfsUtil.toVirtualFileArray(files);
return VfsUtilCore.toVirtualFileArray(files);
}
public static Navigatable[] getNavigatableArray(final Project project, final VirtualFile[] selectedFiles) {
@@ -207,6 +207,7 @@ public class ChangesUtil {
public static FilePath getLocalPath(final Project project, final FilePath filePath) {
// check if the file has just been renamed (IDEADEV-15494)
Change change = ApplicationManager.getApplication().runReadAction(new Computable<Change>() {
@Override
@Nullable
public Change compute() {
if (project.isDisposed()) throw new ProcessCanceledException();
@@ -255,6 +256,7 @@ public class ChangesUtil {
private static VirtualFile getValidParentUnderReadAction(final FilePath filePath) {
return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
@Override
public VirtualFile compute() {
return findValidParent(filePath);
}
@@ -326,6 +328,7 @@ public class ChangesUtil {
final Map<AbstractVcs, List<T>> changesByVcs = new HashMap<AbstractVcs, List<T>>();
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
for (T item : items) {
final AbstractVcs vcs = separator.getVcsFor(item);
@@ -348,6 +351,7 @@ public class ChangesUtil {
public static void processChangesByVcs(final Project project, Collection<Change> changes, PerVcsProcessor<Change> processor) {
processItemsByVcs(changes, new VcsSeparator<Change>() {
@Override
public AbstractVcs getVcsFor(final Change item) {
return getVcsForChange(item, project);
}
@@ -356,6 +360,7 @@ public class ChangesUtil {
public static void processVirtualFilesByVcs(final Project project, Collection<VirtualFile> files, PerVcsProcessor<VirtualFile> processor) {
processItemsByVcs(files, new VcsSeparator<VirtualFile>() {
@Override
public AbstractVcs getVcsFor(final VirtualFile item) {
return getVcsForFile(item, project);
}
@@ -364,6 +369,7 @@ public class ChangesUtil {
public static void processFilePathsByVcs(final Project project, Collection<FilePath> files, PerVcsProcessor<FilePath> processor) {
processItemsByVcs(files, new VcsSeparator<FilePath>() {
@Override
public AbstractVcs getVcsFor(final FilePath item) {
return getVcsForFile(item.getIOFile(), project);
}
@@ -380,7 +386,7 @@ public class ChangesUtil {
public static boolean hasFileChanges(final Collection<Change> changes) {
for(Change change: changes) {
FilePath path = ChangesUtil.getFilePath(change);
FilePath path = getFilePath(change);
if (!path.isDirectory()) {
return true;
}
@@ -21,21 +21,12 @@ import com.intellij.openapi.vcs.changes.CommitContext;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author irengrig
* Date: 1/28/11
* Time: 3:09 PM
*
* just interface for checkin handlers creation
*/
public interface BaseCheckinHandlerFactory {
/**
* Creates a handler for a single Checkin Project or Checkin File operation.
*
*
* @param panel the class which can be used to retrieve information about the files to be committed,
* and to get or set the commit message.
* @param commitContext
* @return the handler instance.
*/
@NotNull
@@ -15,12 +15,28 @@
*/
package com.intellij.openapi.vcs.checkin;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.CommitExecutor;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public abstract class BeforeCheckinDialogHandler {
@Deprecated
/**
* @deprecated see {@link #beforeCommitDialogShown(com.intellij.openapi.project.Project, java.util.List, Iterable, boolean)}
* @return false to cancel commit
*/
public boolean beforeCommitDialogShownCallback(Iterable<CommitExecutor> executors, boolean showVcsCommit) {
throw new AbstractMethodError();
}
/**
* @return false to cancel commit
*/
public abstract boolean beforeCommitDialogShownCallback(Iterable<CommitExecutor> executors, boolean showVcsCommit);
public boolean beforeCommitDialogShown(@NotNull Project project, @NotNull List<Change> changes, @NotNull Iterable<CommitExecutor> executors, boolean showVcsCommit) {
//noinspection deprecation
return beforeCommitDialogShownCallback(executors, showVcsCommit);
}
}
@@ -1,36 +0,0 @@
/*
* Copyright 2000-2013 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.openapi.vcs.checkin;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.CommitExecutor;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public abstract class BeforeCommitDialogHandler {
public static final ExtensionPointName<BeforeCommitDialogHandler> EP_NAME = ExtensionPointName.create("com.intellij.beforeCommitDialog");
/**
* @return false to cancel commit
*/
public abstract boolean beforeCommitDialogShownCallback(@NotNull Project project,
@NotNull List<Change> changes,
@NotNull Iterable<CommitExecutor> executors,
boolean showVcsCommit);
}
@@ -31,7 +31,6 @@ import org.jetbrains.annotations.NotNull;
* and unregistered in {@link com.intellij.openapi.vcs.AbstractVcs#deactivate()}
*
* @author lesya
* @see com.intellij.openapi.vcs.ProjectLevelVcsManager#registerCheckinHandlerFactory(BaseCheckinHandlerFactory)
* @since 5.1
*/
public abstract class CheckinHandlerFactory implements BaseCheckinHandlerFactory {
@@ -44,6 +43,7 @@ public abstract class CheckinHandlerFactory implements BaseCheckinHandlerFactory
* and to get or set the commit message.
* @return the handler instance.
*/
@Override
@NotNull
public abstract CheckinHandler createHandler(final CheckinProjectPanel panel, CommitContext commitContext);
@@ -22,11 +22,6 @@ import com.intellij.openapi.vcs.VcsKey;
import com.intellij.openapi.vcs.changes.CommitContext;
import org.jetbrains.annotations.NotNull;
/**
* @author irengrig
* Date: 1/28/11
* Time: 3:49 PM
*/
public abstract class VcsCheckinHandlerFactory implements BaseCheckinHandlerFactory {
public static final ExtensionPointName<VcsCheckinHandlerFactory> EP_NAME = ExtensionPointName.create("com.intellij.vcsCheckinHandlerFactory");
@@ -23,11 +23,6 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author irengrig
* Date: 1/28/11
* Time: 6:00 PM
*/
public abstract class CheckinHandlersManager {
public static CheckinHandlersManager getInstance() {
return ServiceManager.getService(CheckinHandlersManager.class);
@@ -37,22 +32,34 @@ public abstract class CheckinHandlersManager {
* Returns the list of all registered factories which provide callbacks to run before and after
* VCS checkin operations.
*
* @return the list of registered factories.
* @param allActiveVcss
* @return the list of registered factories
*/
public abstract List<BaseCheckinHandlerFactory> getRegisteredCheckinHandlerFactories(AbstractVcs[] allActiveVcss);
public abstract List<BaseCheckinHandlerFactory> getRegisteredCheckinHandlerFactories(AbstractVcs<?>[] allActiveVcss);
public abstract List<VcsCheckinHandlerFactory> getMatchingVcsFactories(@NotNull final List<AbstractVcs> keys);
@SuppressWarnings("UnusedDeclaration")
@Deprecated
/**
* @deprecated to remove in IDEA 13
*/
public abstract List<VcsCheckinHandlerFactory> getMatchingVcsFactories(@NotNull final List<AbstractVcs> keys);
@SuppressWarnings("UnusedDeclaration")
@Deprecated
/**
* @deprecated to remove in IDEA 13, use EP {@link com.intellij.openapi.vcs.checkin.CheckinHandlerFactory#EP_NAME}
* Registers a factory which provides callbacks to run before and after VCS checkin operations.
*
* @param factory the factory to register.
*/
public abstract void registerCheckinHandlerFactory(BaseCheckinHandlerFactory factory);
@SuppressWarnings("UnusedDeclaration")
@Deprecated
/**
* Unregisters a factory which provides callbacks to run before and after VCS checkin operations.
* @deprecated to remove in IDEA 13, use EP {@link com.intellij.openapi.vcs.checkin.CheckinHandlerFactory#EP_NAME}
* Unregister a factory which provides callbacks to run before and after VCS checkin operations.
*
* @param factory the factory to unregister.
*/
public abstract void unregisterCheckinHandlerFactory(BaseCheckinHandlerFactory handler);
public abstract void unregisterCheckinHandlerFactory(BaseCheckinHandlerFactory factory);
}
@@ -48,6 +48,8 @@ import com.intellij.ui.SplitterWithSecondHideable;
import com.intellij.util.Alarm;
import com.intellij.util.Consumer;
import com.intellij.util.OnOffListener;
import com.intellij.util.containers.ContainerUtilRt;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -126,6 +128,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
myDialog = null;
}
@Override
public void run() {
if (myDialog != null) {
myDialog.updateButtons();
@@ -141,39 +144,19 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
private final MyUpdateButtonsRunnable myUpdateButtonsRunnable = new MyUpdateButtonsRunnable(this);
static final class MyBeforeCommitDialogHandler extends BeforeCommitDialogHandler {
@Override
public boolean beforeCommitDialogShownCallback(@NotNull Project project,
@NotNull List<Change> changes,
@NotNull Iterable<CommitExecutor> executors,
boolean showVcsCommit) {
List<VcsCheckinHandlerFactory> factoryList = CheckinHandlersManager.getInstance().getMatchingVcsFactories(
Arrays.asList(ProjectLevelVcsManager.getInstance(project).getAllActiveVcss()));
for (BaseCheckinHandlerFactory factory : factoryList) {
BeforeCheckinDialogHandler handler = factory.createSystemReadyHandler(project);
if (handler != null && !handler.beforeCommitDialogShownCallback(executors, showVcsCommit)) {
return false;
}
}
return true;
}
}
private static boolean commit(final Project project, final List<Change> changes, final LocalChangeList initialSelection,
final List<CommitExecutor> executors, final boolean showVcsCommit, final String comment,
@Nullable CommitResultHandler customResultHandler) {
for (BeforeCommitDialogHandler handler : BeforeCommitDialogHandler.EP_NAME.getExtensions()) {
if (!handler.beforeCommitDialogShownCallback(project, changes, executors, showVcsCommit)) {
for (BaseCheckinHandlerFactory factory : getCheckInFactories(project)) {
BeforeCheckinDialogHandler handler = factory.createSystemReadyHandler(project);
if (handler != null && !handler.beforeCommitDialogShown(project, changes, executors, showVcsCommit)) {
return false;
}
}
final ChangeListManager manager = ChangeListManager.getInstance(project);
final LocalChangeList defaultList = manager.getDefaultChangeList();
final ArrayList<LocalChangeList> changeLists = new ArrayList<LocalChangeList>(manager.getChangeListsCopy());
CommitChangeListDialog dialog =
new CommitChangeListDialog(project, changes, initialSelection, executors, showVcsCommit, defaultList, changeLists, null, false,
comment, customResultHandler);
CommitChangeListDialog dialog = new CommitChangeListDialog(project, changes, initialSelection, executors, showVcsCommit, manager.getDefaultChangeList(), manager.getChangeListsCopy(), null,
false, comment, customResultHandler);
if (!ApplicationManager.getApplication().isUnitTestMode()) {
dialog.show();
}
@@ -183,6 +166,11 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return dialog.isOK();
}
private static List<BaseCheckinHandlerFactory> getCheckInFactories(Project project) {
return CheckinHandlersManager.getInstance().getRegisteredCheckinHandlerFactories(
ProjectLevelVcsManager.getInstance(project).getAllActiveVcss());
}
public static void commitPaths(final Project project, Collection<FilePath> paths, final LocalChangeList initialSelection,
@Nullable final CommitExecutor executor, final String comment) {
final ChangeListManager manager = ChangeListManager.getInstance(project);
@@ -206,7 +194,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
public static List<CommitExecutor> collectExecutors(Project project, Collection<Change> changes) {
List<CommitExecutor> result = new ArrayList<CommitExecutor>();
for (AbstractVcs vcs : getAffectedVcses(project, changes)) {
for (AbstractVcs<?> vcs : getAffectedVcses(project, changes)) {
result.addAll(vcs.getCommitExecutors());
}
result.addAll(ChangeListManager.getInstance(project).getRegisteredExecutors());
@@ -276,11 +264,13 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
} else {
MultipleChangeListBrowser browser = new MultipleChangeListBrowser(project, changeLists, changes, getDisposable(), initialSelection, true, true,
new Runnable() {
@Override
public void run() {
updateWarning();
}
},
new Runnable() {
@Override
public void run() {
for (CheckinHandler handler : myHandlers) {
handler.includedChangesChanged();
@@ -333,15 +323,18 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
myBrowserExtender.addToolbarActions(this);
myBrowserExtender.addSelectedListChangeListener(new SelectedListChangeListener() {
@Override
public void selectedListChanged() {
updateOnListSelection();
}
});
myBrowser.setDiffExtendUIFactory(new DiffExtendUIFactory() {
@Override
public List<? extends AnAction> createActions(final Change change) {
return myBrowser.createDiffActions(change);
}
@Override
@Nullable
public JComponent createBottomComponent() {
return new DiffCommitMessageEditor(CommitChangeListDialog.this);
@@ -399,9 +392,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
boolean afterVisible = false;
Box beforeBox = Box.createVerticalBox();
Box afterBox = Box.createVerticalBox();
final List<BaseCheckinHandlerFactory> handlerFactories = CheckinHandlersManager.getInstance().getRegisteredCheckinHandlerFactories(
ProjectLevelVcsManager.getInstance(project).getAllActiveVcss());
for (BaseCheckinHandlerFactory factory : handlerFactories) {
for (BaseCheckinHandlerFactory factory : getCheckInFactories(project)) {
final CheckinHandler handler = factory.createHandler(this, myCommitContext);
if (CheckinHandler.DUMMY.equals(handler)) continue;
@@ -534,6 +525,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
// check for null since can be called from constructor before field initialization
if (myWarningLabel != null) {
myWarningLabel.setVisible(false);
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
final VcsException updateException = ((ChangeListManagerImpl)ChangeListManager.getInstance(myProject)).getUpdateException();
if (updateException != null) {
final String[] messages = updateException.getMessages();
@@ -547,8 +539,8 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
}
private void updateVcsOptionsVisibility() {
final List<AbstractVcs> affectedVcses = getAffectedVcses(myProject, myBrowser.getSelectedChangeList().getChanges());
for(Map.Entry<AbstractVcs, JPanel> entry: myPerVcsOptionsPanels.entrySet()) {
Collection<AbstractVcs<?>> affectedVcses = getAffectedVcses(myProject, myBrowser.getSelectedChangeList().getChanges());
for (Map.Entry<AbstractVcs, JPanel> entry : myPerVcsOptionsPanels.entrySet()) {
entry.getValue().setVisible(affectedVcses.contains(entry.getKey()));
}
}
@@ -583,15 +575,18 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
}
}
@Override
protected void doOKAction() {
if (!saveDialogState()) return;
saveComments(true);
final DefaultListCleaner defaultListCleaner = new DefaultListCleaner();
final Runnable callCommit = new Runnable() {
@Override
public void run() {
try {
runBeforeCommitHandlers(new Runnable() {
@Override
public void run() {
CommitChangeListDialog.super.doOKAction();
doCommit(myResultHandler);
@@ -618,6 +613,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return new CommitAction();
}
@Override
@NotNull
protected Action[] createActions() {
final List<Action> actions = new ArrayList<Action>();
@@ -673,11 +669,13 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
if (isOK) {
final DefaultListCleaner defaultListCleaner = new DefaultListCleaner();
runBeforeCommitHandlers(new Runnable() {
@Override
public void run() {
boolean success = false;
try {
final boolean completed = ProgressManager.getInstance().runProcessWithProgressSynchronously(
new Runnable() {
@Override
public void run() {
session.execute(getIncludedChanges(), getCommitMessage());
}
@@ -729,6 +727,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
final List<Change> list = getIncludedChanges();
final Ref<String> result = new Ref<String>();
ChangesUtil.processChangesByVcs(myProject, list, new ChangesUtil.PerVcsProcessor<Change>() {
@Override
public void process(final AbstractVcs vcs, final List<Change> items) {
if (result.isNull()) {
CheckinEnvironment checkinEnvironment = vcs.getCheckinEnvironment();
@@ -803,6 +802,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
PropertiesComponent.getInstance().setValue(DETAILS_SHOW_OPTION, String.valueOf(myDetailsSplitter.isOn()));
}
@Override
public String getCommitActionName() {
String name = null;
for (AbstractVcs vcs : getAffectedVcses()) {
@@ -856,6 +856,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
private void runBeforeCommitHandlers(final Runnable okAction, final CommitExecutor executor) {
Runnable proceedRunnable = new Runnable() {
@Override
public void run() {
FileDocumentManager.getInstance().saveAllDocuments();
@@ -980,6 +981,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
}
}
@Override
@Nullable
protected JComponent createCenterPanel() {
JPanel rootPane = new JPanel(new BorderLayout());
@@ -1088,17 +1090,15 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return myBrowserExtender.getAffectedVcses();
}
private static List<AbstractVcs> getAffectedVcses(Project project, final Collection<Change> changes) {
Set<AbstractVcs> result = new HashSet<AbstractVcs>();
private static Collection<AbstractVcs<?>> getAffectedVcses(Project project, final Collection<Change> changes) {
Set<AbstractVcs<?>> result = new THashSet<AbstractVcs<?>>();
for (Change change : changes) {
final AbstractVcs vcs = ChangesUtil.getVcsForChange(change, project);
if (vcs != null) {
result.add(vcs);
}
ContainerUtilRt.addIfNotNull(result, ChangesUtil.getVcsForChange(change, project));
}
return new ArrayList<AbstractVcs>(result);
return result;
}
@Override
public Collection<VirtualFile> getRoots() {
Set<VirtualFile> result = new HashSet<VirtualFile>();
for (Change change : myBrowser.getCurrentDisplayedChanges()) {
@@ -1111,14 +1111,17 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return result;
}
@Override
public JComponent getComponent() {
return mySplitter;
}
@Override
public boolean hasDiffs() {
return !getIncludedChanges().isEmpty();
}
@Override
public Collection<VirtualFile> getVirtualFiles() {
List<VirtualFile> result = new ArrayList<VirtualFile>();
for (Change change: getIncludedChanges()) {
@@ -1132,10 +1135,12 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return result;
}
@Override
public Collection<Change> getSelectedChanges() {
return new ArrayList<Change>(getIncludedChanges());
}
@Override
public Collection<File> getFiles() {
List<File> result = new ArrayList<File>();
for (Change change: getIncludedChanges()) {
@@ -1147,6 +1152,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return result;
}
@Override
public Project getProject() {
return myProject;
}
@@ -1162,6 +1168,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return false;
}
@Override
public void setCommitMessage(final String currentDescription) {
setCommitMessageText(currentDescription);
myCommitMessageArea.requestFocusInMessage();
@@ -1172,6 +1179,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return null;
}
@Override
public void setWarning(String s) {
// todo
}
@@ -1181,12 +1189,15 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
myCommitMessageArea.setText(currentDescription);
}
@Override
public String getCommitMessage() {
return myCommitMessageArea.getComment();
}
@Override
public void refresh() {
ChangeListManager.getInstance(myProject).invokeAfterUpdate(new Runnable() {
@Override
public void run() {
myBrowser.rebuildList();
for (RefreshableOnComponent component : myAdditionalComponents) {
@@ -1196,12 +1207,14 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
}, InvokeAfterUpdateMode.SILENT, "commit dialog", ModalityState.current()); // title not shown for silently
}
@Override
public void saveState() {
for (RefreshableOnComponent component : myAdditionalComponents) {
component.saveState();
}
}
@Override
public void restoreState() {
for (RefreshableOnComponent component : myAdditionalComponents) {
component.restoreState();
@@ -1235,15 +1248,18 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return myBrowserExtender.getCurrentIncludedChanges();
}
@Override
@NonNls
protected String getDimensionServiceKey() {
return "CommitChangelistDialog" + LAYOUT_VERSION;
}
@Override
public JComponent getPreferredFocusedComponent() {
return myCommitMessageArea.getEditorField();
}
@Override
public void calcData(DataKey key, DataSink sink) {
if (key == Refreshable.PANEL_KEY) {
sink.put(Refreshable.PANEL_KEY, this);
@@ -1278,8 +1294,10 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
}
}
@Override
public void actionPerformed(ActionEvent e) {
final Runnable callExecutor = new Runnable() {
@Override
public void run() {
execute(myCommitExecutor);
}
@@ -1307,6 +1325,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
});
}
@Override
public void dispose() {
if (myCommitDialog != null) {
myCommitDialog.setMessageConsumer(null);
@@ -1318,6 +1337,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
}
}
@Override
public Dimension getPreferredSize() {
// we don't want to be squeezed to one line
return new Dimension(400, 120);
@@ -29,11 +29,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* @author irengrig
* Date: 1/28/11
* Time: 5:21 PM
*/
public class CheckinHandlersManagerImpl extends CheckinHandlersManager {
private final List<BaseCheckinHandlerFactory> myRegisteredBeforeCheckinHandlers;
private final MultiMap<VcsKey, VcsCheckinHandlerFactory> myVcsMap;
@@ -48,13 +43,13 @@ public class CheckinHandlersManagerImpl extends CheckinHandlersManager {
}
@Override
public List<BaseCheckinHandlerFactory> getRegisteredCheckinHandlerFactories(AbstractVcs[] allActiveVcss) {
final ArrayList<BaseCheckinHandlerFactory> list =
public List<BaseCheckinHandlerFactory> getRegisteredCheckinHandlerFactories(AbstractVcs<?>[] allActiveVcss) {
final List<BaseCheckinHandlerFactory> list =
new ArrayList<BaseCheckinHandlerFactory>(myRegisteredBeforeCheckinHandlers.size() + allActiveVcss.length);
list.addAll(myRegisteredBeforeCheckinHandlers);
for (AbstractVcs vcs : allActiveVcss) {
final Collection<VcsCheckinHandlerFactory> factories = myVcsMap.get(vcs.getKeyInstanceMethod());
if (! factories.isEmpty()) {
if (!factories.isEmpty()) {
list.addAll(factories);
}
}
@@ -63,10 +58,10 @@ public class CheckinHandlersManagerImpl extends CheckinHandlersManager {
@Override
public List<VcsCheckinHandlerFactory> getMatchingVcsFactories(@NotNull List<AbstractVcs> vcsList) {
final SmartList<VcsCheckinHandlerFactory> result = new SmartList<VcsCheckinHandlerFactory>();
final List<VcsCheckinHandlerFactory> result = new SmartList<VcsCheckinHandlerFactory>();
for (AbstractVcs vcs : vcsList) {
final Collection<VcsCheckinHandlerFactory> factories = myVcsMap.get(vcs.getKeyInstanceMethod());
if (! factories.isEmpty()) {
if (!factories.isEmpty()) {
result.addAll(factories);
}
}