This commit is contained in:
Maxim.Mossienko
2009-11-26 18:16:58 +03:00
parent 353f8c0b7c
commit 73c151ef6d
3 changed files with 730 additions and 730 deletions
+25 -25
View File
@@ -1,25 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "breakgen", "breakgen.vcproj", "{AE14C87F-E99B-4363-BE34-917FAF98258F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Debug|Win32.ActiveCfg = Debug|Win32
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Debug|Win32.Build.0 = Debug|Win32
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Debug|x64.ActiveCfg = Debug|x64
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Release|Win32.ActiveCfg = Release|Win32
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Release|Win32.Build.0 = Release|Win32
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Release|x64.ActiveCfg = Release|x64
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "breakgen", "breakgen.vcproj", "{AE14C87F-E99B-4363-BE34-917FAF98258F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Debug|Win32.ActiveCfg = Debug|Win32
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Debug|Win32.Build.0 = Debug|Win32
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Debug|x64.ActiveCfg = Debug|x64
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Release|Win32.ActiveCfg = Release|Win32
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Release|Win32.Build.0 = Release|Win32
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Release|x64.ActiveCfg = Release|x64
{AE14C87F-E99B-4363-BE34-917FAF98258F}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+337 -337
View File
@@ -1,337 +1,337 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="breakgen"
ProjectGUID="{AE14C87F-E99B-4363-BE34-917FAF98258F}"
RootNamespace="breakgen"
Keyword="Win32Proj"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BREAKGEN_EXPORTS;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="C:\Java\jdk1.6.0_14\include;C:\Java\jdk1.6.0_14\include\win32"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BREAKGEN_EXPORTS;"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BREAKGEN_EXPORTS;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="C:\Java\jdk1.6.0_14\include;C:\Java\jdk1.6.0_14\include\win32"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BREAKGEN_EXPORTS;"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\AppMain.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="breakgen"
ProjectGUID="{AE14C87F-E99B-4363-BE34-917FAF98258F}"
RootNamespace="breakgen"
Keyword="Win32Proj"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BREAKGEN_EXPORTS;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="C:\Java\jdk1.6.0_14\include;C:\Java\jdk1.6.0_14\include\win32"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BREAKGEN_EXPORTS;"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BREAKGEN_EXPORTS;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="C:\Java\jdk1.6.0_14\include;C:\Java\jdk1.6.0_14\include\win32"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BREAKGEN_EXPORTS;"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\AppMain.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -1,368 +1,368 @@
/*
* 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.
*/
/*
* Created by IntelliJ IDEA.
* User: yole
* Date: 28.11.2006
* Time: 14:15:18
*/
package com.intellij.openapi.vcs.changes.ui;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.changes.actions.MoveChangesToAnotherListAction;
import com.intellij.openapi.vcs.changes.actions.RollbackDialogAction;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.EventDispatcher;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.*;
import java.util.List;
public class MultipleChangeListBrowser extends ChangesBrowser {
private final ChangeListChooser myChangeListChooser;
private final ChangeListListener myChangeListListener = new MyChangeListListener();
private final boolean myShowingAllChangeLists;
private final EventDispatcher<SelectedListChangeListener> myDispatcher = EventDispatcher.create(SelectedListChangeListener.class);
private Collection<Change> myAllChanges;
private Map<Change, LocalChangeList> myChangeListsMap;
private final ChangesBrowserExtender myExtender;
private final Runnable myRebuildListListener;
public MultipleChangeListBrowser(final Project project, final List<? extends ChangeList> changeLists, final List<Change> changes,
final ChangeList initialListSelection,
final boolean capableOfExcludingChanges,
final boolean highlightProblems, final Runnable rebuildListListener, @Nullable final Runnable inclusionListener) {
super(project, changeLists, changes, initialListSelection, capableOfExcludingChanges, highlightProblems, inclusionListener, MyUseCase.LOCAL_CHANGES);
myRebuildListListener = rebuildListListener;
myChangeListChooser = new ChangeListChooser(changeLists);
myHeaderPanel.add(myChangeListChooser, BorderLayout.EAST);
myShowingAllChangeLists = Comparing.haveEqualElements((List<LocalChangeList>) changeLists, ChangeListManager.getInstance(project).getChangeLists());
ChangeListManager.getInstance(myProject).addChangeListListener(myChangeListListener);
myExtender = new Extender(project, this);
}
@Override
protected void setInitialSelection(final List<? extends ChangeList> changeLists, final List<Change> changes, final ChangeList initialListSelection) {
myAllChanges = new ArrayList<Change>();
mySelectedChangeList = initialListSelection;
for (ChangeList list : changeLists) {
if (list instanceof LocalChangeList) {
myAllChanges.addAll(list.getChanges());
if (initialListSelection == null) {
for(Change c: list.getChanges()) {
if (changes.contains(c)) {
mySelectedChangeList = list;
break;
}
}
}
}
}
if (mySelectedChangeList == null) {
for(ChangeList list: changeLists) {
if (list instanceof LocalChangeList && ((LocalChangeList) list).isDefault()) {
mySelectedChangeList = list;
break;
}
}
if (mySelectedChangeList == null && !changeLists.isEmpty()) {
mySelectedChangeList = changeLists.get(0);
}
}
}
@Override
public void dispose() {
ChangeListManager.getInstance(myProject).removeChangeListListener(myChangeListListener);
}
public Collection<Change> getAllChanges() {
return myAllChanges;
}
public ChangesBrowserExtender getExtender() {
return myExtender;
}
public void addSelectedListChangeListener(SelectedListChangeListener listener) {
myDispatcher.addListener(listener);
}
public void removeSelectedListChangeListener(SelectedListChangeListener listener) {
myDispatcher.removeListener(listener);
}
private void setSelectedList(final ChangeList list) {
mySelectedChangeList = list;
rebuildList();
myDispatcher.getMulticaster().selectedListChanged();
}
private boolean myInRebuildList;
@Override
public void rebuildList() {
if (myInRebuildList) return;
try {
myInRebuildList = true;
if (myChangesToDisplay == null) {
// changes set not fixed === local changes
final ChangeListManager manager = ChangeListManager.getInstance(myProject);
myChangeListsMap = new HashMap<Change, LocalChangeList>();
final List<LocalChangeList> lists = manager.getChangeListsCopy();
Collection<Change> allChanges = new ArrayList<Change>();
for (LocalChangeList list : lists) {
final Collection<Change> changes = list.getChanges();
allChanges.addAll(changes);
for (Change change : changes) {
myChangeListsMap.put(change, list);
}
}
myAllChanges = allChanges;
// refresh selected list also
updateListsInChooser();
}
super.rebuildList();
if (myRebuildListListener != null) {
myRebuildListListener.run();
}
} finally {
myInRebuildList = false;
}
}
@Override
public List<Change> getCurrentDisplayedChanges() {
if (myChangesToDisplay == null) {
return sortChanges(filterBySelectedChangeList(myAllChanges));
}
return super.getCurrentDisplayedChanges();
}
@NotNull
public List<Change> getCurrentIncludedChanges() {
return filterBySelectedChangeList(myViewer.getIncludedChanges());
}
private List<Change> filterBySelectedChangeList(final Collection<Change> changes) {
List<Change> filtered = new ArrayList<Change>();
for (Change change : changes) {
if (Comparing.equal(getList(change), mySelectedChangeList)) {
filtered.add(change);
}
}
return filtered;
}
private ChangeList getList(final Change change) {
return myChangeListsMap.get(change);
}
@Override
protected void buildToolBar(final DefaultActionGroup toolBarGroup) {
super.buildToolBar(toolBarGroup);
final MoveChangesToAnotherListAction moveAction = new MoveChangesToAnotherListAction() {
public void actionPerformed(AnActionEvent e) {
super.actionPerformed(e);
rebuildList();
}
};
moveAction.registerCustomShortcutSet(CommonShortcuts.getMove(), myViewer);
toolBarGroup.add(moveAction);
}
@Override
protected List<AnAction> createDiffActions(final Change change) {
List<AnAction> actions = super.createDiffActions(change);
actions.add(new MoveAction(change));
return actions;
}
private class ChangeListChooser extends JPanel {
private final JComboBox myChooser;
private final static int MAX_LEN = 35;
public ChangeListChooser(List<? extends ChangeList> lists) {
super(new BorderLayout());
myChooser = new JComboBox() {
public Dimension getMinimumSize() {
return new Dimension(0, 0);
}
};
myChooser.setRenderer(new ColoredListCellRenderer() {
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
final LocalChangeList l = ((LocalChangeList)value);
if (l != null) {
String name = l.getName().trim();
if (name.length() > MAX_LEN) {
name = name.substring(0, MAX_LEN - 3) + "...";
}
append(name, l.isDefault() ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
});
myChooser.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
final LocalChangeList changeList = (LocalChangeList)myChooser.getSelectedItem();
setSelectedList(changeList);
myChooser.setToolTipText(changeList == null ? "" : (changeList.getName()));
}
}
});
updateLists(lists);
myChooser.setEditable(false);
add(myChooser, BorderLayout.CENTER);
JLabel label = new JLabel(VcsBundle.message("commit.dialog.changelist.label"));
label.setDisplayedMnemonic('l');
label.setLabelFor(myChooser);
add(label, BorderLayout.WEST);
}
public void updateLists(List<? extends ChangeList> lists) {
myChooser.setModel(new DefaultComboBoxModel(lists.toArray()));
myChooser.setEnabled(lists.size() > 1);
if (lists.contains(mySelectedChangeList)) {
myChooser.setSelectedItem(mySelectedChangeList);
} else {
if (myChooser.getItemCount() > 0) {
myChooser.setSelectedIndex(0);
}
}
mySelectedChangeList = (ChangeList) myChooser.getSelectedItem();
}
}
private class MyChangeListListener extends ChangeListAdapter {
public void changeListAdded(ChangeList list) {
updateListsInChooser();
}
}
private void updateListsInChooser() {
Runnable runnable = new Runnable() {
public void run() {
if (myChangeListChooser != null && myShowingAllChangeLists) {
myChangeListChooser.updateLists(ChangeListManager.getInstance(myProject).getChangeListsCopy());
}
}
};
if (SwingUtilities.isEventDispatchThread()) {
runnable.run();
}
else {
ApplicationManager.getApplication().invokeLater(runnable, ModalityState.stateForComponent(MultipleChangeListBrowser.this));
}
}
private class MoveAction extends MoveChangesToAnotherListAction {
private final Change myChange;
public MoveAction(final Change change) {
myChange = change;
}
public void actionPerformed(AnActionEvent e) {
askAndMove(myProject, new Change[]{myChange}, null);
}
}
private static class Extender implements ChangesBrowserExtender {
private final Project myProject;
private final MultipleChangeListBrowser myBrowser;
private Extender(final Project project, final MultipleChangeListBrowser browser) {
myProject = project;
myBrowser = browser;
}
public void addToolbarActions(final DialogWrapper dialogWrapper) {
final Icon icon = IconLoader.getIcon("/vcs/refresh.png");
if (myBrowser.myChangesToDisplay == null) {
myBrowser.addToolbarAction(new AnAction("Refresh Changes") {
@Override
public void actionPerformed(AnActionEvent e) {
myBrowser.rebuildList();
}
@Override
public void update(AnActionEvent e) {
e.getPresentation().setIcon(icon);
}
});
}
myBrowser.addToolbarAction(new RollbackDialogAction());
final EditSourceInCommitAction editSourceAction = new EditSourceInCommitAction(dialogWrapper);
editSourceAction.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myBrowser);
myBrowser.addToolbarAction(editSourceAction);
myBrowser.addToolbarAction(ActionManager.getInstance().getAction("Vcs.CheckinProjectToolbar"));
final List<AnAction> actions = AdditionalLocalChangeActionsInstaller.calculateActions(myProject, myBrowser.getAllChanges());
if (actions != null) {
for (AnAction action : actions) {
myBrowser.addToolbarAction(action);
}
}
}
public void addSelectedListChangeListener(final SelectedListChangeListener listener) {
myBrowser.addSelectedListChangeListener(listener);
}
public List<AbstractVcs> getAffectedVcses() {
Set<AbstractVcs> result = new HashSet<AbstractVcs>();
for (Change change : myBrowser.myAllChanges) {
final AbstractVcs vcs = ChangesUtil.getVcsForChange(change, myBrowser.myProject);
if (vcs != null) {
result.add(vcs);
}
}
return new ArrayList<AbstractVcs>(result);
}
public List<Change> getCurrentIncludedChanges() {
return myBrowser.getCurrentIncludedChanges();
}
}
}
/*
* 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.
*/
/*
* Created by IntelliJ IDEA.
* User: yole
* Date: 28.11.2006
* Time: 14:15:18
*/
package com.intellij.openapi.vcs.changes.ui;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.changes.actions.MoveChangesToAnotherListAction;
import com.intellij.openapi.vcs.changes.actions.RollbackDialogAction;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.EventDispatcher;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.*;
import java.util.List;
public class MultipleChangeListBrowser extends ChangesBrowser {
private final ChangeListChooser myChangeListChooser;
private final ChangeListListener myChangeListListener = new MyChangeListListener();
private final boolean myShowingAllChangeLists;
private final EventDispatcher<SelectedListChangeListener> myDispatcher = EventDispatcher.create(SelectedListChangeListener.class);
private Collection<Change> myAllChanges;
private Map<Change, LocalChangeList> myChangeListsMap;
private final ChangesBrowserExtender myExtender;
private final Runnable myRebuildListListener;
public MultipleChangeListBrowser(final Project project, final List<? extends ChangeList> changeLists, final List<Change> changes,
final ChangeList initialListSelection,
final boolean capableOfExcludingChanges,
final boolean highlightProblems, final Runnable rebuildListListener, @Nullable final Runnable inclusionListener) {
super(project, changeLists, changes, initialListSelection, capableOfExcludingChanges, highlightProblems, inclusionListener, MyUseCase.LOCAL_CHANGES);
myRebuildListListener = rebuildListListener;
myChangeListChooser = new ChangeListChooser(changeLists);
myHeaderPanel.add(myChangeListChooser, BorderLayout.EAST);
myShowingAllChangeLists = Comparing.haveEqualElements((List<LocalChangeList>) changeLists, ChangeListManager.getInstance(project).getChangeLists());
ChangeListManager.getInstance(myProject).addChangeListListener(myChangeListListener);
myExtender = new Extender(project, this);
}
@Override
protected void setInitialSelection(final List<? extends ChangeList> changeLists, final List<Change> changes, final ChangeList initialListSelection) {
myAllChanges = new ArrayList<Change>();
mySelectedChangeList = initialListSelection;
for (ChangeList list : changeLists) {
if (list instanceof LocalChangeList) {
myAllChanges.addAll(list.getChanges());
if (initialListSelection == null) {
for(Change c: list.getChanges()) {
if (changes.contains(c)) {
mySelectedChangeList = list;
break;
}
}
}
}
}
if (mySelectedChangeList == null) {
for(ChangeList list: changeLists) {
if (list instanceof LocalChangeList && ((LocalChangeList) list).isDefault()) {
mySelectedChangeList = list;
break;
}
}
if (mySelectedChangeList == null && !changeLists.isEmpty()) {
mySelectedChangeList = changeLists.get(0);
}
}
}
@Override
public void dispose() {
ChangeListManager.getInstance(myProject).removeChangeListListener(myChangeListListener);
}
public Collection<Change> getAllChanges() {
return myAllChanges;
}
public ChangesBrowserExtender getExtender() {
return myExtender;
}
public void addSelectedListChangeListener(SelectedListChangeListener listener) {
myDispatcher.addListener(listener);
}
public void removeSelectedListChangeListener(SelectedListChangeListener listener) {
myDispatcher.removeListener(listener);
}
private void setSelectedList(final ChangeList list) {
mySelectedChangeList = list;
rebuildList();
myDispatcher.getMulticaster().selectedListChanged();
}
private boolean myInRebuildList;
@Override
public void rebuildList() {
if (myInRebuildList) return;
try {
myInRebuildList = true;
if (myChangesToDisplay == null) {
// changes set not fixed === local changes
final ChangeListManager manager = ChangeListManager.getInstance(myProject);
myChangeListsMap = new HashMap<Change, LocalChangeList>();
final List<LocalChangeList> lists = manager.getChangeListsCopy();
Collection<Change> allChanges = new ArrayList<Change>();
for (LocalChangeList list : lists) {
final Collection<Change> changes = list.getChanges();
allChanges.addAll(changes);
for (Change change : changes) {
myChangeListsMap.put(change, list);
}
}
myAllChanges = allChanges;
// refresh selected list also
updateListsInChooser();
}
super.rebuildList();
if (myRebuildListListener != null) {
myRebuildListListener.run();
}
} finally {
myInRebuildList = false;
}
}
@Override
public List<Change> getCurrentDisplayedChanges() {
if (myChangesToDisplay == null) {
return sortChanges(filterBySelectedChangeList(myAllChanges));
}
return super.getCurrentDisplayedChanges();
}
@NotNull
public List<Change> getCurrentIncludedChanges() {
return filterBySelectedChangeList(myViewer.getIncludedChanges());
}
private List<Change> filterBySelectedChangeList(final Collection<Change> changes) {
List<Change> filtered = new ArrayList<Change>();
for (Change change : changes) {
if (Comparing.equal(getList(change), mySelectedChangeList)) {
filtered.add(change);
}
}
return filtered;
}
private ChangeList getList(final Change change) {
return myChangeListsMap.get(change);
}
@Override
protected void buildToolBar(final DefaultActionGroup toolBarGroup) {
super.buildToolBar(toolBarGroup);
final MoveChangesToAnotherListAction moveAction = new MoveChangesToAnotherListAction() {
public void actionPerformed(AnActionEvent e) {
super.actionPerformed(e);
rebuildList();
}
};
moveAction.registerCustomShortcutSet(CommonShortcuts.getMove(), myViewer);
toolBarGroup.add(moveAction);
}
@Override
protected List<AnAction> createDiffActions(final Change change) {
List<AnAction> actions = super.createDiffActions(change);
actions.add(new MoveAction(change));
return actions;
}
private class ChangeListChooser extends JPanel {
private final JComboBox myChooser;
private final static int MAX_LEN = 35;
public ChangeListChooser(List<? extends ChangeList> lists) {
super(new BorderLayout());
myChooser = new JComboBox() {
public Dimension getMinimumSize() {
return new Dimension(0, 0);
}
};
myChooser.setRenderer(new ColoredListCellRenderer() {
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
final LocalChangeList l = ((LocalChangeList)value);
if (l != null) {
String name = l.getName().trim();
if (name.length() > MAX_LEN) {
name = name.substring(0, MAX_LEN - 3) + "...";
}
append(name, l.isDefault() ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
});
myChooser.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
final LocalChangeList changeList = (LocalChangeList)myChooser.getSelectedItem();
setSelectedList(changeList);
myChooser.setToolTipText(changeList == null ? "" : (changeList.getName()));
}
}
});
updateLists(lists);
myChooser.setEditable(false);
add(myChooser, BorderLayout.CENTER);
JLabel label = new JLabel(VcsBundle.message("commit.dialog.changelist.label"));
label.setDisplayedMnemonic('l');
label.setLabelFor(myChooser);
add(label, BorderLayout.WEST);
}
public void updateLists(List<? extends ChangeList> lists) {
myChooser.setModel(new DefaultComboBoxModel(lists.toArray()));
myChooser.setEnabled(lists.size() > 1);
if (lists.contains(mySelectedChangeList)) {
myChooser.setSelectedItem(mySelectedChangeList);
} else {
if (myChooser.getItemCount() > 0) {
myChooser.setSelectedIndex(0);
}
}
mySelectedChangeList = (ChangeList) myChooser.getSelectedItem();
}
}
private class MyChangeListListener extends ChangeListAdapter {
public void changeListAdded(ChangeList list) {
updateListsInChooser();
}
}
private void updateListsInChooser() {
Runnable runnable = new Runnable() {
public void run() {
if (myChangeListChooser != null && myShowingAllChangeLists) {
myChangeListChooser.updateLists(ChangeListManager.getInstance(myProject).getChangeListsCopy());
}
}
};
if (SwingUtilities.isEventDispatchThread()) {
runnable.run();
}
else {
ApplicationManager.getApplication().invokeLater(runnable, ModalityState.stateForComponent(MultipleChangeListBrowser.this));
}
}
private class MoveAction extends MoveChangesToAnotherListAction {
private final Change myChange;
public MoveAction(final Change change) {
myChange = change;
}
public void actionPerformed(AnActionEvent e) {
askAndMove(myProject, new Change[]{myChange}, null);
}
}
private static class Extender implements ChangesBrowserExtender {
private final Project myProject;
private final MultipleChangeListBrowser myBrowser;
private Extender(final Project project, final MultipleChangeListBrowser browser) {
myProject = project;
myBrowser = browser;
}
public void addToolbarActions(final DialogWrapper dialogWrapper) {
final Icon icon = IconLoader.getIcon("/vcs/refresh.png");
if (myBrowser.myChangesToDisplay == null) {
myBrowser.addToolbarAction(new AnAction("Refresh Changes") {
@Override
public void actionPerformed(AnActionEvent e) {
myBrowser.rebuildList();
}
@Override
public void update(AnActionEvent e) {
e.getPresentation().setIcon(icon);
}
});
}
myBrowser.addToolbarAction(new RollbackDialogAction());
final EditSourceInCommitAction editSourceAction = new EditSourceInCommitAction(dialogWrapper);
editSourceAction.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myBrowser);
myBrowser.addToolbarAction(editSourceAction);
myBrowser.addToolbarAction(ActionManager.getInstance().getAction("Vcs.CheckinProjectToolbar"));
final List<AnAction> actions = AdditionalLocalChangeActionsInstaller.calculateActions(myProject, myBrowser.getAllChanges());
if (actions != null) {
for (AnAction action : actions) {
myBrowser.addToolbarAction(action);
}
}
}
public void addSelectedListChangeListener(final SelectedListChangeListener listener) {
myBrowser.addSelectedListChangeListener(listener);
}
public List<AbstractVcs> getAffectedVcses() {
Set<AbstractVcs> result = new HashSet<AbstractVcs>();
for (Change change : myBrowser.myAllChanges) {
final AbstractVcs vcs = ChangesUtil.getVcsForChange(change, myBrowser.myProject);
if (vcs != null) {
result.add(vcs);
}
}
return new ArrayList<AbstractVcs>(result);
}
public List<Change> getCurrentIncludedChanges() {
return myBrowser.getCurrentIncludedChanges();
}
}
}