Merge remote-tracking branch 'origin/master'

This commit is contained in:
Konstantin Bulenkov
2013-10-27 19:18:09 +04:00
25 changed files with 77 additions and 100 deletions
@@ -116,23 +116,30 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
public Value getValue() {
// the following code makes sense only if we do not use ObjectReference.enableCollection() / disableCollection()
// to keep temporary objects
if (Patches.IBM_JDK_DISABLE_COLLECTION_BUG && myStoredEvaluationContext != null && !myStoredEvaluationContext.getSuspendContext().isResumed() &&
if (Patches.IBM_JDK_DISABLE_COLLECTION_BUG) {
final EvaluationContextImpl evalContext = myStoredEvaluationContext;
if (evalContext != null && !evalContext.getSuspendContext().isResumed() &&
myValue instanceof ObjectReference && VirtualMachineProxyImpl.isCollected((ObjectReference)myValue)) {
final Semaphore semaphore = new Semaphore();
semaphore.down();
myStoredEvaluationContext.getDebugProcess().getManagerThread().invoke(new SuspendContextCommandImpl(myStoredEvaluationContext.getSuspendContext()) {
public void contextAction() throws Exception {
// re-setting the context will cause value recalculation
try {
setContext(myStoredEvaluationContext);
final Semaphore semaphore = new Semaphore();
semaphore.down();
evalContext.getDebugProcess().getManagerThread().invoke(new SuspendContextCommandImpl(evalContext.getSuspendContext()) {
public void contextAction() throws Exception {
// re-setting the context will cause value recalculation
try {
setContext(myStoredEvaluationContext);
}
finally {
semaphore.up();
}
}
finally {
protected void commandCancelled() {
semaphore.up();
}
}
});
semaphore.waitFor();
});
semaphore.waitFor();
}
}
return myValue;
@@ -264,30 +271,20 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
private String getCustomLabel(String label) {
//translate only strings in quotes
final StringBuilder buf = StringBuilderSpinAllocator.alloc();
try {
final Value value = getValue();
if(isShowIdLabel()) {
Renderer lastRenderer = getLastRenderer();
final String idLabel = myStoredEvaluationContext != null && lastRenderer != null ?
((NodeRendererImpl)lastRenderer).getIdLabel(value, myStoredEvaluationContext.getDebugProcess()) :
null;
if(idLabel != null && !label.startsWith(idLabel)) {
buf.append(idLabel);
}
String customLabel = null;
final Value value = getValue();
if(isShowIdLabel()) {
Renderer lastRenderer = getLastRenderer();
final EvaluationContextImpl evalContext = myStoredEvaluationContext;
final String idLabel = evalContext != null && lastRenderer != null && !evalContext.getSuspendContext().isResumed()?
((NodeRendererImpl)lastRenderer).getIdLabel(value, evalContext.getDebugProcess()) :
null;
if(idLabel != null && !label.startsWith(idLabel)) {
customLabel = idLabel;
}
if(label == null) {
//noinspection HardCodedStringLiteral
buf.append("null");
}
else {
buf.append(label);
}
return buf.toString();
}
finally {
StringBuilderSpinAllocator.dispose(buf);
}
final String originalLabel = label == null ? "null" : label;
return customLabel == null? originalLabel : customLabel + originalLabel;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

@@ -447,7 +447,7 @@ public class VcsLogDataHolder implements Disposable {
}
});
}
}, "Retrieving filtered results from the VCS...");
}, "Looking for more results...");
}
@NotNull
@@ -55,7 +55,7 @@ public class VcsLogFilterer {
AbstractVcsLogTableModel model;
if (!detailsFilters.isEmpty()) {
List<VcsFullCommitDetails> filteredCommits = filterByDetails(graphModel, detailsFilters);
model = new NoGraphTableModel(myLogDataHolder, myUI, filteredCommits, myLogDataHolder.getDataPack().getRefsModel(), true);
model = new NoGraphTableModel(myUI, filteredCommits, myLogDataHolder.getDataPack().getRefsModel(), true);
}
else {
model = new GraphTableModel(myLogDataHolder, myUI);
@@ -69,12 +69,13 @@ public class VcsLogFilterer {
}
}
public void requestVcs(@NotNull Collection<VcsLogFilter> filters) {
public void requestVcs(@NotNull Collection<VcsLogFilter> filters, final Runnable onSuccess) {
myLogDataHolder.getFilteredDetailsFromTheVcs(filters, new Consumer<List<VcsFullCommitDetails>>() {
@Override
public void consume(List<VcsFullCommitDetails> details) {
myUI.setModel(new NoGraphTableModel(myLogDataHolder, myUI, details, myLogDataHolder.getDataPack().getRefsModel(), false));
myUI.setModel(new NoGraphTableModel(myUI, details, myLogDataHolder.getDataPack().getRefsModel(), false));
myUI.updateUI();
onSuccess.run();
}
});
}
@@ -42,6 +42,14 @@ public class VcsLogImpl implements VcsLog {
myUi = vcsLogManager.getLogUi();
}
/**
* Checks if the log is initialized.
* TODO Temporary method until the old Git log is switched off and removed
*/
public boolean isReady() {
return myDataHolder != null && myUi != null;
}
@NotNull
@Override
public List<VcsFullCommitDetails> getSelectedCommits() {
@@ -1,21 +0,0 @@
package com.intellij.vcs.log.ui;
import com.intellij.openapi.util.IconLoader;
import javax.swing.Icon;
public class GitLogIcons {
public static final Icon CHERRY_PICK = IconLoader.getIcon("/cherry-pick-32.png");
public static final Icon MOVE = IconLoader.getIcon("/move-32.png");
public static final Icon REBASE = IconLoader.getIcon("/arrow-32.png");
public static final Icon REBASE_INTERACTIVE = IconLoader.getIcon("/edit-32.png");
public static final Icon FIX_UP = IconLoader.getIcon("/fixup-32.png");
public static final Icon FORBIDDEN = IconLoader.getIcon("/forbidden-32.png");
public static final Icon APPLY = IconLoader.getIcon("/apply-16.png");
public static final Icon CANCEL = IconLoader.getIcon("/cancel-16.png");
//public static final Icon SPIDER = IconLoader.getIcon("/spider-16.png");
public static final Icon SPIDER = IconLoader.getIcon("/spider-1-16.png");
//public static final Icon SPIDER = IconLoader.getIcon("/spider-16-2.png");
public static final Icon WEB = IconLoader.getIcon("/web-16.png");
}
@@ -10,7 +10,6 @@ import com.intellij.ui.SeparatorComponent;
import com.intellij.ui.SeparatorOrientation;
import com.intellij.vcs.log.data.VcsLogDataHolder;
import com.intellij.vcs.log.data.VcsLogUiProperties;
import com.intellij.vcs.log.ui.GitLogIcons;
import com.intellij.vcs.log.ui.VcsLogUI;
import com.intellij.vcs.log.ui.filter.VcsLogClassicFilterUi;
import com.intellij.vcs.log.ui.filter.VcsLogFilterUi;
@@ -64,14 +63,14 @@ public class MainFrame {
}
private JComponent createActionsToolbar() {
AnAction hideBranchesAction = new DumbAwareAction("Collapse linear branches", "Collapse linear branches", GitLogIcons.SPIDER) {
AnAction hideBranchesAction = new DumbAwareAction("Collapse linear branches", "Collapse linear branches", AllIcons.Actions.Collapseall) {
@Override
public void actionPerformed(AnActionEvent e) {
myUI.hideAll();
}
};
AnAction showBranchesAction = new DumbAwareAction("Expand all branches", "Expand all branches", GitLogIcons.WEB) {
AnAction showBranchesAction = new DumbAwareAction("Expand all branches", "Expand all branches", AllIcons.Actions.Expandall) {
@Override
public void actionPerformed(AnActionEvent e) {
myUI.showAll();
@@ -90,8 +89,9 @@ public class MainFrame {
}
};
AnAction showFullPatchAction = new ToggleAction("Show full patch", "Expand all branches even if they occupy a lot of space",
AllIcons.Actions.Expandall) {
AnAction showFullPatchAction = new ToggleAction("Show long edges",
"Show long branch edges even if commits are invisible in the current view.",
AllIcons.Ide.UpDown) {
@Override
public boolean isSelected(AnActionEvent e) {
return !myUI.areLongEdgesHidden();
@@ -15,7 +15,6 @@ import com.intellij.vcs.log.graph.render.*;
import com.intellij.vcs.log.printmodel.GraphPrintCell;
import com.intellij.vcs.log.printmodel.SpecialPrintElement;
import com.intellij.vcs.log.ui.VcsLogUI;
import com.intellij.vcs.log.ui.render.AbstractPaddingCellRender;
import com.intellij.vcs.log.ui.render.CommitCellRender;
import com.intellij.vcs.log.ui.render.GraphCommitCellRender;
import com.intellij.vcs.log.ui.tables.AbstractVcsLogTableModel;
@@ -234,12 +233,7 @@ public class VcsLogGraphTable extends JBTable {
Component rendererComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Object commit = getValueAt(row, AbstractVcsLogTableModel.COMMIT_COLUMN);
if (commit instanceof GraphCommitCell) {
if (AbstractPaddingCellRender.isMarked(commit) && !isSelected) {
rendererComponent.setBackground(AbstractPaddingCellRender.MARKED_BACKGROUND);
}
else {
setBackground(isSelected ? table.getSelectionBackground() : JBColor.WHITE);
}
setBackground(isSelected ? table.getSelectionBackground() : JBColor.WHITE);
}
return rendererComponent;
}
@@ -55,12 +55,7 @@ public abstract class AbstractPaddingCellRender implements TableCellRenderer {
boolean isSelected, boolean hasFocus, int row, int column) {
myValue = value;
super.getTableCellRendererComponent(table, getCellText(value), isSelected, hasFocus, row, column);
if (isMarked(value) && !isSelected) {
setBackground(MARKED_BACKGROUND);
}
else {
setBackground(isSelected ? table.getSelectionBackground() : JBColor.WHITE);
}
setBackground(isSelected ? table.getSelectionBackground() : JBColor.WHITE);
Border paddingBorder = BorderFactory.createEmptyBorder(0, getLeftPadding(table, value), 0, 0);
setBorder(BorderFactory.createCompoundBorder(this.getBorder(), paddingBorder));
@@ -8,7 +8,6 @@ import com.intellij.vcs.log.VcsFullCommitDetails;
import com.intellij.vcs.log.VcsRef;
import com.intellij.vcs.log.VcsShortCommitDetails;
import com.intellij.vcs.log.data.RefsModel;
import com.intellij.vcs.log.data.VcsLogDataHolder;
import com.intellij.vcs.log.graph.render.CommitCell;
import com.intellij.vcs.log.ui.VcsLogUI;
import org.jetbrains.annotations.NotNull;
@@ -20,15 +19,13 @@ public class NoGraphTableModel extends AbstractVcsLogTableModel<CommitCell> {
private static final Logger LOG = Logger.getInstance(NoGraphTableModel.class);
@NotNull private final VcsLogDataHolder myLogDataHolder;
@NotNull private final VcsLogUI myUi;
@NotNull private final List<VcsFullCommitDetails> myCommits;
@NotNull private final RefsModel myRefsModel;
private final boolean myAllowLoadingMoreRequest;
private boolean myAllowLoadingMoreRequest;
public NoGraphTableModel(@NotNull VcsLogDataHolder logDataHolder, @NotNull VcsLogUI UI,
@NotNull List<VcsFullCommitDetails> commits, @NotNull RefsModel refsModel, boolean allowLoadingMoreRequest) {
myLogDataHolder = logDataHolder;
public NoGraphTableModel(@NotNull VcsLogUI UI, @NotNull List<VcsFullCommitDetails> commits, @NotNull RefsModel refsModel,
boolean allowLoadingMoreRequest) {
myUi = UI;
myCommits = commits;
myRefsModel = refsModel;
@@ -56,23 +53,14 @@ public class NoGraphTableModel extends AbstractVcsLogTableModel<CommitCell> {
return;
}
Runnable success = new Runnable() {
myUi.getTable().setPaintBusy(true);
myUi.getFilterer().requestVcs(myUi.collectFilters(), new Runnable() {
@Override
public void run() {
myUi.applyFiltersAndUpdateUi();
myUi.getTable().setPaintBusy(false);
}
};
VcsLogDataHolder.LoadingState state = myLogDataHolder.loadMoreDetails(success);
if (state == VcsLogDataHolder.LoadingState.LOADING) {
myUi.getTable().setPaintBusy(true);
}
else if (state == VcsLogDataHolder.LoadingState.LIMIT_REACHED) {
myUi.getFilterer().requestVcs(myUi.collectFilters());
}
else {
myUi.getTable().setPaintBusy(false);
}
});
myAllowLoadingMoreRequest = false; // Don't send the request to VCS twice
}
@Nullable
@@ -31,6 +31,7 @@ import com.intellij.vcs.log.Hash;
import com.intellij.vcs.log.VcsFullCommitDetails;
import com.intellij.vcs.log.VcsLog;
import com.intellij.vcs.log.VcsLogObjectsFactory;
import com.intellij.vcs.log.impl.VcsLogImpl;
import git4idea.GitLocalBranch;
import git4idea.GitPlatformFacade;
import git4idea.GitVcs;
@@ -174,7 +175,11 @@ public class GitCherryPickAction extends DumbAwareAction {
if (project == null) {
return null;
}
List<VcsFullCommitDetails> selectedCommits = getVcsLog(project).getSelectedCommits();
VcsLog log = getVcsLog(project);
if (log == null) {
return null;
}
List<VcsFullCommitDetails> selectedCommits = log.getSelectedCommits();
// don't allow to cherry-pick if a non-Git commit was selected
// we could cherry-pick just Git commits filtered from the list, but it might provide confusion
boolean nonGitCommitSelected = ContainerUtil.find(selectedCommits, new Condition<VcsFullCommitDetails>() {
@@ -207,7 +212,8 @@ public class GitCherryPickAction extends DumbAwareAction {
}
private static VcsLog getVcsLog(@NotNull Project project) {
return ServiceManager.getService(project, VcsLog.class);
VcsLog logService = ServiceManager.getService(project, VcsLog.class);
return logService != null && ((VcsLogImpl)logService).isReady() ? logService : null;
}
// TODO remove after removing the old Vcs Log implementation
@@ -220,7 +226,11 @@ public class GitCherryPickAction extends DumbAwareAction {
if (event.getProject() == null) {
return null;
}
return getVcsLog(event.getProject()).getContainingBranches(commit.getHash());
VcsLog log = getVcsLog(event.getProject());
if (log == null) {
return null;
}
return log.getContainingBranches(commit.getHash());
}
}
@@ -51,6 +51,11 @@ abstract public class EmmetAbbreviationCompletionProvider extends CompletionProv
return;
}
final ZenCodingGenerator generator = getGenerator();
if (!generator.isMyContext(parameters.getPosition(), false) || !generator.isAppliedByDefault(parameters.getPosition())) {
return;
}
final PsiFile file = parameters.getPosition().getContainingFile();
final Editor editor = parameters.getEditor();
@@ -78,7 +83,7 @@ abstract public class EmmetAbbreviationCompletionProvider extends CompletionProv
};
final Collection<SingleLineEmmetFilter> extraFilters = ContainerUtil.newLinkedList(new SingleLineEmmetFilter());
ZenCodingTemplate.expand(templatePrefix, callback, null, getGenerator(), extraFilters, false);
ZenCodingTemplate.expand(templatePrefix, callback, null, generator, extraFilters, false);
if (!generatedTemplate.isNull()) {
result = result.withPrefixMatcher(templatePrefix);
final TemplateImpl template = generatedTemplate.get();