mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+21
-19
@@ -346,34 +346,31 @@ public class CodeStyleSchemesConfigurable extends SearchableConfigurable.Parent.
|
||||
String displayName = myProvider.getConfigurableDisplayName();
|
||||
if (displayName != null) return displayName;
|
||||
|
||||
return ensurePanel().getDisplayName(); // fallback for 8.0 API compatibility
|
||||
return myPanel != null ? myPanel.getDisplayName() : null; // fallback for 8.0 API compatibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpTopic() {
|
||||
return ensurePanel().getHelpTopic();
|
||||
}
|
||||
|
||||
private CodeStyleMainPanel ensurePanel() {
|
||||
if (myPanel == null) {
|
||||
myPanel = new CodeStyleMainPanel(ensureModel(), myLangSelector, myFactory);
|
||||
}
|
||||
return myPanel;
|
||||
return myPanel != null ? myPanel.getHelpTopic() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
return ensurePanel();
|
||||
myPanel = new CodeStyleMainPanel(ensureModel(), myLangSelector, myFactory);
|
||||
return myPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
boolean someSchemeModified = ensurePanel().isModified();
|
||||
if (someSchemeModified) {
|
||||
myApplyCompleted = false;
|
||||
myRevertCompleted = false;
|
||||
if (myPanel != null) {
|
||||
boolean someSchemeModified = myPanel.isModified();
|
||||
if (someSchemeModified) {
|
||||
myApplyCompleted = false;
|
||||
myRevertCompleted = false;
|
||||
}
|
||||
return someSchemeModified;
|
||||
}
|
||||
return someSchemeModified;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -428,20 +425,25 @@ public class CodeStyleSchemesConfigurable extends SearchableConfigurable.Parent.
|
||||
}
|
||||
|
||||
public boolean isPanelModified(CodeStyleScheme scheme) {
|
||||
return ensurePanel().isModified(scheme);
|
||||
return myPanel != null && myPanel.isModified(scheme);
|
||||
}
|
||||
|
||||
public boolean isPanelModified() {
|
||||
return ensurePanel().isModified();
|
||||
return myPanel != null && myPanel.isModified();
|
||||
}
|
||||
|
||||
public void applyPanel() throws ConfigurationException {
|
||||
ensurePanel().apply();
|
||||
if (myPanel != null) {
|
||||
myPanel.apply();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> processListOptions() {
|
||||
return ensurePanel().processListOptions();
|
||||
if (myPanel == null) {
|
||||
myPanel = new CodeStyleMainPanel(ensureModel(), myLangSelector, myFactory);
|
||||
}
|
||||
return myPanel.processListOptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-27
@@ -21,6 +21,7 @@ import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.ui.JBCardLayout;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -33,9 +34,9 @@ import java.util.List;
|
||||
public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionListener {
|
||||
private static final String BUTTONS = "BUTTONS";
|
||||
private static final String NOBUTTONS = "NOBUTTONS";
|
||||
private final JButton mySkipButton = new JButton("Skip All and Set Defaults");
|
||||
private final JButton myBackButton = new JButton("Back");
|
||||
private final JButton myNextButton = new JButton("Next");
|
||||
private final JButton myStartUsingButton = new JButton("Start using " + ApplicationNamesInfo.getInstance().getFullProductName());
|
||||
|
||||
private final JBCardLayout myCardLayout = new JBCardLayout();
|
||||
protected final List<AbstractCustomizeWizardStep> mySteps = new ArrayList<AbstractCustomizeWizardStep>();
|
||||
@@ -52,9 +53,9 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
|
||||
setTitle("Customize " + ApplicationNamesInfo.getInstance().getProductName());
|
||||
getPeer().setAppIcons();
|
||||
initSteps();
|
||||
mySkipButton.addActionListener(this);
|
||||
myBackButton.addActionListener(this);
|
||||
myNextButton.addActionListener(this);
|
||||
myStartUsingButton.addActionListener(this);
|
||||
myNavigationLabel.setEnabled(false);
|
||||
myFooterLabel.setEnabled(false);
|
||||
init();
|
||||
@@ -80,12 +81,6 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
|
||||
protected void initSteps() {
|
||||
provider.initSteps(this, mySteps);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createButtons(JPanel buttonPanel, GridBagConstraints gbc) {
|
||||
provider.addButtons(this, buttonPanel, gbc);
|
||||
super.createButtons(buttonPanel, gbc);
|
||||
}
|
||||
}.show();
|
||||
}
|
||||
|
||||
@@ -137,7 +132,17 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
createButtons(buttonPanel, gbc);
|
||||
if (!PlatformUtils.isCppIde()) {
|
||||
buttonPanel.add(mySkipButton, gbc);
|
||||
gbc.gridx++;
|
||||
}
|
||||
buttonPanel.add(myBackButton, gbc);
|
||||
gbc.gridx++;
|
||||
gbc.weightx = 1;
|
||||
buttonPanel.add(Box.createHorizontalGlue(), gbc);
|
||||
gbc.gridx++;
|
||||
gbc.weightx = 0;
|
||||
buttonPanel.add(myNextButton, gbc);
|
||||
buttonPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
|
||||
myButtonWrapper.add(buttonPanel, BUTTONS);
|
||||
myButtonWrapper.add(new JLabel(), NOBUTTONS);
|
||||
@@ -145,25 +150,13 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
|
||||
return myButtonWrapper;
|
||||
}
|
||||
|
||||
protected void createButtons(JPanel buttonPanel, GridBagConstraints gbc) {
|
||||
buttonPanel.add(myBackButton, gbc);
|
||||
gbc.gridx++;
|
||||
gbc.weightx = 1;
|
||||
buttonPanel.add(Box.createHorizontalGlue(), gbc);
|
||||
gbc.weightx = 0;
|
||||
gbc.gridx++;
|
||||
buttonPanel.add(myNextButton, gbc);
|
||||
gbc.gridx++;
|
||||
buttonPanel.add(myStartUsingButton, gbc);
|
||||
}
|
||||
|
||||
void setButtonsVisible(boolean visible) {
|
||||
myButtonWrapperLayout.show(myButtonWrapper, visible ? BUTTONS : NOBUTTONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == myStartUsingButton) {
|
||||
if (e.getSource() == mySkipButton) {
|
||||
doOKAction();
|
||||
return;
|
||||
}
|
||||
@@ -173,6 +166,10 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
|
||||
return;
|
||||
}
|
||||
if (e.getSource() == myNextButton) {
|
||||
if (myIndex >= mySteps.size() - 1) {
|
||||
doOKAction();
|
||||
return;
|
||||
}
|
||||
myIndex++;
|
||||
initCurrentStep(true);
|
||||
}
|
||||
@@ -209,12 +206,11 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
|
||||
if (myIndex > 0) {
|
||||
myBackButton.setText("Back to " + mySteps.get(myIndex - 1).getTitle());
|
||||
}
|
||||
mySkipButton.setText("Skip " + (myIndex > 0 ? "Remaining" : "All") + " and Set Defaults");
|
||||
|
||||
myNextButton.setVisible(myIndex < mySteps.size() - 1);
|
||||
if (myIndex < mySteps.size() - 1) {
|
||||
myNextButton.setText("Next: " + mySteps.get(myIndex + 1).getTitle());
|
||||
}
|
||||
|
||||
myNextButton.setText(myIndex < mySteps.size() - 1
|
||||
? "Next: " + mySteps.get(myIndex + 1).getTitle()
|
||||
: "Start using " + ApplicationNamesInfo.getInstance().getFullProductName());
|
||||
myHeaderLabel.setText(myCurrentStep.getHTMLHeader());
|
||||
myFooterLabel.setText(myCurrentStep.getHTMLFooter());
|
||||
StringBuilder navHTML = new StringBuilder("<html><body>");
|
||||
|
||||
-4
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.intellij.ide.customize;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -24,6 +22,4 @@ import java.util.List;
|
||||
*/
|
||||
public interface CustomizeIDEWizardStepsProvider {
|
||||
void initSteps(CustomizeIDEWizardDialog wizardDialog, List<AbstractCustomizeWizardStep> steps);
|
||||
|
||||
void addButtons(CustomizeIDEWizardDialog wizardDialog, JPanel buttonPanel, GridBagConstraints gbc);
|
||||
}
|
||||
@@ -1431,7 +1431,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T extends Comparable> List<T> sorted(@NotNull Collection<T> list) {
|
||||
public static <T extends Comparable<T>> List<T> sorted(@NotNull Collection<T> list) {
|
||||
return sorted(list, new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
|
||||
@@ -39,6 +39,9 @@ public interface VcsLogFilterCollection {
|
||||
@Nullable
|
||||
VcsLogTextFilter getTextFilter();
|
||||
|
||||
@Nullable
|
||||
VcsLogHashFilter getHashFilter();
|
||||
|
||||
@Nullable
|
||||
VcsLogStructureFilter getStructureFilter();
|
||||
|
||||
|
||||
@@ -15,10 +15,13 @@
|
||||
*/
|
||||
package com.intellij.vcs.log;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface VcsLogHashFilter {
|
||||
|
||||
Collection<Hash> getHashes();
|
||||
@NotNull
|
||||
Collection<String> getHashes();
|
||||
|
||||
}
|
||||
|
||||
@@ -48,11 +48,33 @@ public class VcsLogFilterer {
|
||||
@NotNull
|
||||
public AbstractVcsLogTableModel applyFiltersAndUpdateUi(@NotNull DataPack dataPack, @NotNull VcsLogFilterCollection filters) {
|
||||
resetFilters(dataPack);
|
||||
VcsLogHashFilter hashFilter = filters.getHashFilter();
|
||||
if (hashFilter != null && !hashFilter.getHashes().isEmpty()) { // hashes should be shown, no matter if they match other filters or not
|
||||
return applyHashFilter(dataPack, hashFilter.getHashes());
|
||||
}
|
||||
List<VcsLogDetailsFilter> detailsFilters = filters.getDetailsFilters();
|
||||
applyGraphFilters(dataPack, filters.getBranchFilter());
|
||||
return applyDetailsFilter(dataPack, detailsFilters);
|
||||
}
|
||||
|
||||
private GraphTableModel applyHashFilter(@NotNull DataPack dataPack, @NotNull Collection<String> hashes) {
|
||||
final List<Integer> indices = ContainerUtil.mapNotNull(hashes, new Function<String, Integer>() {
|
||||
@Override
|
||||
public Integer fun(String partOfHash) {
|
||||
Hash hash = myLogDataHolder.findHashByString(partOfHash);
|
||||
return hash != null ? myLogDataHolder.getCommitIndex(hash) : null;
|
||||
}
|
||||
});
|
||||
dataPack.getGraphFacade().setVisibleBranches(null);
|
||||
dataPack.getGraphFacade().setFilter(new Condition<Integer>() {
|
||||
@Override
|
||||
public boolean value(Integer integer) {
|
||||
return indices.contains(integer);
|
||||
}
|
||||
});
|
||||
return new GraphTableModel(dataPack, myLogDataHolder, myUI, LoadMoreStage.ALL_REQUESTED);
|
||||
}
|
||||
|
||||
private static void resetFilters(@NotNull DataPack dataPack) {
|
||||
GraphFacade facade = dataPack.getGraphFacade();
|
||||
facade.setVisibleBranches(null);
|
||||
|
||||
@@ -27,17 +27,20 @@ public class VcsLogFilterCollectionImpl implements VcsLogFilterCollection {
|
||||
|
||||
@Nullable private final VcsLogBranchFilter myBranchFilter;
|
||||
@Nullable private final VcsLogUserFilter myUserFilter;
|
||||
@Nullable private final VcsLogHashFilter myHashFilter;
|
||||
@Nullable private final VcsLogDateFilter myDateFilter;
|
||||
@Nullable private final VcsLogTextFilter myTextFilter;
|
||||
@Nullable private final VcsLogStructureFilter myStructureFilter;
|
||||
|
||||
public VcsLogFilterCollectionImpl(@Nullable VcsLogBranchFilter branchFilter,
|
||||
@Nullable VcsLogUserFilter userFilter,
|
||||
@Nullable VcsLogHashFilter hashFilter,
|
||||
@Nullable VcsLogDateFilter dateFilter,
|
||||
@Nullable VcsLogTextFilter textFilter,
|
||||
@Nullable VcsLogStructureFilter structureFilter) {
|
||||
myBranchFilter = branchFilter;
|
||||
myUserFilter = userFilter;
|
||||
myHashFilter = hashFilter;
|
||||
myDateFilter = dateFilter;
|
||||
myTextFilter = textFilter;
|
||||
myStructureFilter = structureFilter;
|
||||
@@ -49,6 +52,12 @@ public class VcsLogFilterCollectionImpl implements VcsLogFilterCollection {
|
||||
return myBranchFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public VcsLogHashFilter getHashFilter() {
|
||||
return myHashFilter;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public VcsLogUserFilter getUserFilter() {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.vcs.log.impl;
|
||||
|
||||
import com.intellij.vcs.log.VcsLogHashFilter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class VcsLogHashFilterImpl implements VcsLogHashFilter {
|
||||
|
||||
@NotNull private final Collection<String> myHashes;
|
||||
|
||||
public VcsLogHashFilterImpl(@NotNull Collection<String> hashes) {
|
||||
myHashes = hashes;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<String> getHashes() {
|
||||
return myHashes;
|
||||
}
|
||||
}
|
||||
+39
-2
@@ -20,15 +20,20 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ex.CustomComponentAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.SearchTextField;
|
||||
import com.intellij.ui.SearchTextFieldWithStoredHistory;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcs.log.*;
|
||||
import com.intellij.vcs.log.data.DataPack;
|
||||
import com.intellij.vcs.log.data.VcsLogDataHolder;
|
||||
import com.intellij.vcs.log.data.VcsLogUiProperties;
|
||||
import com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl;
|
||||
import com.intellij.vcs.log.impl.VcsLogHashFilterImpl;
|
||||
import com.intellij.vcs.log.ui.VcsLogUiImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -43,6 +48,9 @@ import java.util.List;
|
||||
*/
|
||||
public class VcsLogClassicFilterUi implements VcsLogFilterUi {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(VcsLogClassicFilterUi.class);
|
||||
private static final String HASH_PATTERN = "[a-fA-F0-9]{7,}";
|
||||
|
||||
@NotNull private final SearchTextField myTextFilter;
|
||||
@NotNull private final VcsLogUiImpl myUi;
|
||||
@NotNull private final DefaultActionGroup myActionGroup;
|
||||
@@ -104,9 +112,38 @@ public class VcsLogClassicFilterUi implements VcsLogFilterUi {
|
||||
@NotNull
|
||||
@Override
|
||||
public VcsLogFilterCollection getFilters() {
|
||||
VcsLogTextFilter textFilter = !myTextFilter.getText().isEmpty() ? new VcsLogTextFilterImpl(myTextFilter.getText().trim()) : null;
|
||||
Pair<VcsLogTextFilter, VcsLogHashFilter> filtersFromText = getFiltersFromTextArea(myTextFilter.getText().trim());
|
||||
return new VcsLogFilterCollectionImpl(myBranchFilterComponent.getFilter(), myUserFilterComponent.getFilter(),
|
||||
myDateFilterComponent.getFilter(), textFilter, myStructureFilterComponent.getFilter());
|
||||
filtersFromText.second, myDateFilterComponent.getFilter(),
|
||||
filtersFromText.first, myStructureFilterComponent.getFilter());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Pair<VcsLogTextFilter, VcsLogHashFilter> getFiltersFromTextArea(@NotNull String text) {
|
||||
if (text.isEmpty()) {
|
||||
return Pair.empty();
|
||||
}
|
||||
List<String> hashes = ContainerUtil.newArrayList();
|
||||
for (String word : StringUtil.split(text, " ")) {
|
||||
if (!StringUtil.isEmptyOrSpaces(word) && word.matches(HASH_PATTERN)) {
|
||||
hashes.add(word);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
VcsLogTextFilter textFilter;
|
||||
VcsLogHashFilterImpl hashFilter;
|
||||
if (!hashes.isEmpty()) { // text is ignored if there are hashes in the text
|
||||
textFilter = null;
|
||||
hashFilter = new VcsLogHashFilterImpl(hashes);
|
||||
}
|
||||
else {
|
||||
textFilter = new VcsLogTextFilterImpl(text);
|
||||
hashFilter = null;
|
||||
}
|
||||
return Pair.<VcsLogTextFilter, VcsLogHashFilter>create(textFilter, hashFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
@@ -27,6 +27,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.SimpleColoredText;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.xdebugger.frame.presentation.XValuePresentation;
|
||||
import com.intellij.xdebugger.impl.frame.XVariablesView;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
|
||||
@@ -79,6 +80,12 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter {
|
||||
} else {
|
||||
presentation.renderValue(renderer);
|
||||
}
|
||||
if (StringUtil.isEmpty(text.toString())) {
|
||||
final String type = value.getValuePresentation().getType();
|
||||
if (!StringUtil.isEmpty(type)) {
|
||||
text.append(type, SimpleTextAttributes.REGULAR_ATTRIBUTES);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -124,6 +124,12 @@ class GitBekParentFixer {
|
||||
return textFilter;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public VcsLogHashFilter getHashFilter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public VcsLogStructureFilter getStructureFilter() {
|
||||
|
||||
@@ -308,8 +308,9 @@ public class GitLogProvider implements VcsLogProvider {
|
||||
}
|
||||
|
||||
if (filterCollection.getTextFilter() != null) {
|
||||
String textFilter = StringUtil.escapeBackSlashes(filterCollection.getTextFilter().getText());
|
||||
String textFilter = filterCollection.getTextFilter().getText();
|
||||
filterParameters.add(prepareParameter("grep", textFilter));
|
||||
filterParameters.add("--extended-regexp");
|
||||
}
|
||||
|
||||
filterParameters.add("--regexp-ignore-case"); // affects case sensitivity of any filter (except file filter)
|
||||
|
||||
Reference in New Issue
Block a user