mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge commit 'origin/master'
This commit is contained in:
@@ -140,7 +140,7 @@ class GitManualPushToBranch extends JPanel {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Collection<GitRemote> getRemotesWithCommonNames(@NotNull Collection<GitRepository> repositories) {
|
||||
public static Collection<GitRemote> getRemotesWithCommonNames(@NotNull Collection<GitRepository> repositories) {
|
||||
if (repositories.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ public class GitPushDialog extends DialogWrapper {
|
||||
private final Object COMMITS_LOADING_LOCK = new Object();
|
||||
private final GitManualPushToBranch myRefspecPanel;
|
||||
private final AtomicReference<String> myDestBranchInfoOnRefresh = new AtomicReference<String>();
|
||||
|
||||
private final boolean myPushPossible;
|
||||
|
||||
public GitPushDialog(@NotNull Project project) {
|
||||
super(project);
|
||||
@@ -84,10 +86,20 @@ public class GitPushDialog extends DialogWrapper {
|
||||
|
||||
myListPanel = new GitPushLog(myProject, myRepositories, new RepositoryCheckboxListener());
|
||||
myRefspecPanel = new GitManualPushToBranch(myRepositories, new RefreshButtonListener());
|
||||
|
||||
|
||||
if (GitManualPushToBranch.getRemotesWithCommonNames(myRepositories).isEmpty()) {
|
||||
myRefspecPanel.setVisible(false);
|
||||
setErrorText("Can't push, because no remotes are defined");
|
||||
setOKActionEnabled(false);
|
||||
myPushPossible = false;
|
||||
} else {
|
||||
myPushPossible = true;
|
||||
}
|
||||
|
||||
init();
|
||||
setOKButtonText("Push");
|
||||
setTitle("Git Push");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +117,12 @@ public class GitPushDialog extends DialogWrapper {
|
||||
|
||||
private JComponent createCommitListPanel() {
|
||||
myLoadingPanel.add(myListPanel, BorderLayout.CENTER);
|
||||
loadCommitsInBackground();
|
||||
if (myPushPossible) {
|
||||
loadCommitsInBackground();
|
||||
} else {
|
||||
myLoadingPanel.startLoading();
|
||||
myLoadingPanel.stopLoading();
|
||||
}
|
||||
|
||||
JPanel commitListPanel = new JPanel(new BorderLayout());
|
||||
commitListPanel.add(myLoadingPanel, BorderLayout.CENTER);
|
||||
|
||||
@@ -19,8 +19,6 @@ import com.intellij.openapi.actionSystem.CommonShortcuts;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.openapi.actionSystem.DataSink;
|
||||
import com.intellij.openapi.actionSystem.TypeSafeDataProvider;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorFontType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.vcs.VcsDataKeys;
|
||||
@@ -276,18 +274,41 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
private static class MyTreeCellRenderer extends CheckboxTree.CheckboxTreeCellRenderer {
|
||||
|
||||
private int myDateMaxWidth;
|
||||
private int myHashMaxWidth;
|
||||
private static final int INSET = UIUtil.DEFAULT_HGAP;
|
||||
|
||||
void recalculateWidth(@NotNull Collection<GitCommit> commits) {
|
||||
for (GitCommit commit : commits) {
|
||||
int len = getDateString(commit).length();
|
||||
if (len > myDateMaxWidth) {
|
||||
myDateMaxWidth = len;
|
||||
int dateLen = calcWidth(getDateString(commit));
|
||||
if (dateLen > myDateMaxWidth) {
|
||||
myDateMaxWidth = dateLen;
|
||||
}
|
||||
int hashLen = calcWidth(getHashString(commit));
|
||||
if (hashLen > myHashMaxWidth) {
|
||||
myHashMaxWidth = hashLen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getHashString(@NotNull GitCommit commit) {
|
||||
return commit.getShortHash().toString();
|
||||
}
|
||||
|
||||
int calcWidth(String s) {
|
||||
SimpleTextAttributes attributes = new SimpleTextAttributes(getCommitTextAttributesStyle(), getTextRenderer().getForeground());
|
||||
Font initialFont = getTextRenderer().getFont();
|
||||
Font font = initialFont.deriveFont(attributes.getFontStyle(), attributes.isSmaller() ? UIUtil.getFontSize(UIUtil.FontSize.SMALL) : initialFont.getSize());
|
||||
FontMetrics metrics = getTextRenderer().getFontMetrics(font);
|
||||
return metrics.stringWidth(s);
|
||||
}
|
||||
|
||||
private static int getCommitTextAttributesStyle() {
|
||||
return SimpleTextAttributes.STYLE_SMALLER;
|
||||
}
|
||||
|
||||
private static String getDateString(GitCommit commit) {
|
||||
return DateFormatUtil.formatPrettyDateTime(commit.getAuthorTime());
|
||||
return DateFormatUtil.formatPrettyDateTime(commit.getAuthorTime()) + " ";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -302,16 +323,19 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
}
|
||||
|
||||
ColoredTreeCellRenderer renderer = getTextRenderer();
|
||||
Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN); // using probable monospace font to emulate table
|
||||
renderer.setFont(font);
|
||||
|
||||
SimpleTextAttributes smallGrey = new SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, UIUtil.getInactiveTextColor());
|
||||
if (userObject instanceof GitCommit) {
|
||||
GitCommit commit = (GitCommit)userObject;
|
||||
SimpleTextAttributes small = new SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, renderer.getForeground());
|
||||
renderer.append(commit.getShortHash().toString(), smallGrey);
|
||||
renderer.append(String.format(" %" + myDateMaxWidth + "s ", getDateString(commit)), smallGrey);
|
||||
renderer.append(commit.getSubject(), small);
|
||||
SimpleTextAttributes grey = new SimpleTextAttributes(getCommitTextAttributesStyle(), UIUtil.getInactiveTextColor());
|
||||
|
||||
String hash = getHashString(commit);
|
||||
renderer.append(hash, grey);
|
||||
renderer.appendAlign(myHashMaxWidth + INSET);
|
||||
|
||||
String date = getDateString(commit);
|
||||
renderer.append(date, grey);
|
||||
renderer.appendAlign(myDateMaxWidth + myHashMaxWidth + INSET * 2);
|
||||
|
||||
renderer.append(commit.getSubject(), new SimpleTextAttributes(getCommitTextAttributesStyle(), getTextRenderer().getForeground()));
|
||||
}
|
||||
else if (userObject instanceof GitRepository) {
|
||||
String repositoryPath = calcRootPath((GitRepository)userObject);
|
||||
@@ -345,7 +369,7 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
break;
|
||||
}
|
||||
renderer.append(text, attrs);
|
||||
renderer.append(additionalText, smallGrey);
|
||||
renderer.append(additionalText, new SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, UIUtil.getInactiveTextColor()));
|
||||
}
|
||||
else if (userObject instanceof FakeCommit) {
|
||||
int spaces = 6 + 15 + 3 + 30;
|
||||
|
||||
@@ -58,6 +58,7 @@ public class HgPullDialog extends DialogWrapper {
|
||||
};
|
||||
sourceTxt.getDocument().addDocumentListener(documentListener);
|
||||
setTitle("Pull");
|
||||
setOKButtonText("Pull");
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -106,4 +107,9 @@ public class HgPullDialog extends DialogWrapper {
|
||||
setOKActionEnabled(StringUtils.isNotBlank(sourceTxt.getText()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDimensionServiceKey() {
|
||||
return HgPullDialog.class.getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ public class MavenDomElementDescriptorHolder {
|
||||
public Result<XmlNSDescriptorImpl> compute() {
|
||||
return Result.create(doCreateDescriptor(kind), PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
|
||||
}
|
||||
});
|
||||
}, false);
|
||||
myDescriptorsMap.put(kind, result);
|
||||
}
|
||||
return result.getValue();
|
||||
|
||||
Reference in New Issue
Block a user