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:
Binary file not shown.
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -37,6 +37,7 @@ import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.options.ex.ConfigurableWrapper;
|
||||
import com.intellij.openapi.options.newEditor.OptionsEditor;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.InputValidator;
|
||||
@@ -231,7 +232,8 @@ public class SeverityEditorDialog extends DialogWrapper {
|
||||
final DataContext dataContext = DataManager.getInstance().getDataContext(myPanel);
|
||||
final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext);
|
||||
if (optionsEditor != null) {
|
||||
final ColorAndFontOptions colorAndFontOptions = optionsEditor.findConfigurable(ColorAndFontOptions.class);
|
||||
final ColorAndFontOptions colorAndFontOptions =
|
||||
(ColorAndFontOptions)((ConfigurableWrapper)optionsEditor.findConfigurableById("reference.settingsdialog.IDE.editor.colors")).getConfigurable();
|
||||
assert colorAndFontOptions != null;
|
||||
final SearchableConfigurable javaPage = colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class);
|
||||
LOG.assertTrue(javaPage != null);
|
||||
|
||||
-2
@@ -16,9 +16,7 @@
|
||||
package com.intellij.lang.properties.editor;
|
||||
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Dmitry Batkovich
|
||||
|
||||
@@ -60,7 +60,7 @@ class NewPropertyAction extends AnAction {
|
||||
prefix = null;
|
||||
separator = null;
|
||||
} else {
|
||||
final ResourceBundleEditorViewElement selectedElement = resourceBundleEditor.getSelectedElement();
|
||||
final ResourceBundleEditorViewElement selectedElement = resourceBundleEditor.getSelectedElementIfOnlyOne();
|
||||
if (selectedElement == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
+39
-19
@@ -57,7 +57,10 @@ import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.JBSplitter;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -129,7 +132,7 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
|
||||
@Override
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
// filter out temp unselect/select events
|
||||
if (getSelectedProperty() == null) return;
|
||||
if (Comparing.equal(e.getNewLeadSelectionPath(), e.getOldLeadSelectionPath()) || getSelectedProperty() == null) return;
|
||||
if (!arePropertiesEquivalent(selectedProperty, getSelectedProperty()) ||
|
||||
!Comparing.equal(selectedPropertiesFile, getSelectedPropertiesFile())) {
|
||||
|
||||
@@ -570,13 +573,21 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
|
||||
document.replaceString(0, document.getTextLength(), text);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private DefaultMutableTreeNode getSelectedNode() {
|
||||
@NotNull
|
||||
private Collection<DefaultMutableTreeNode> getSelectedNodes() {
|
||||
if (!isValid()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
JTree tree = myStructureViewComponent.getTree();
|
||||
if (tree == null) return null;
|
||||
TreePath selected = tree.getSelectionModel().getSelectionPath();
|
||||
if (selected == null) return null;
|
||||
return (DefaultMutableTreeNode)selected.getLastPathComponent();
|
||||
if (tree == null) return Collections.emptyList();
|
||||
TreePath[] selected = tree.getSelectionModel().getSelectionPaths();
|
||||
if (selected == null || selected.length == 0) return Collections.emptyList();
|
||||
return ContainerUtil.map(selected, new Function<TreePath, DefaultMutableTreeNode>() {
|
||||
@Override
|
||||
public DefaultMutableTreeNode fun(TreePath treePath) {
|
||||
return (DefaultMutableTreeNode)treePath.getLastPathComponent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -587,25 +598,34 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
|
||||
|
||||
@Nullable
|
||||
private IProperty getSelectedProperty() {
|
||||
final DefaultMutableTreeNode selectedNode = getSelectedNode();
|
||||
if (selectedNode == null) {
|
||||
final Collection<DefaultMutableTreeNode> selectedNode = getSelectedNodes();
|
||||
if (selectedNode.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
final ResourceBundleEditorViewElement element = getSelectedElement(selectedNode);
|
||||
final ResourceBundleEditorViewElement element = getSelectedElement(ContainerUtil.getFirstItem(selectedNode));
|
||||
return element instanceof ResourceBundlePropertyStructureViewElement ? ((ResourceBundlePropertyStructureViewElement)element).getProperty()
|
||||
: null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<ResourceBundleEditorViewElement> getSelectedElements() {
|
||||
final Collection<DefaultMutableTreeNode> selectedNodes = getSelectedNodes();
|
||||
return ContainerUtil.mapNotNull(selectedNodes, new NullableFunction<DefaultMutableTreeNode, ResourceBundleEditorViewElement>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceBundleEditorViewElement fun(DefaultMutableTreeNode selectedNode) {
|
||||
Object userObject = selectedNode.getUserObject();
|
||||
if (!(userObject instanceof AbstractTreeNode)) return null;
|
||||
Object value = ((AbstractTreeNode)userObject).getValue();
|
||||
return value instanceof ResourceBundleEditorViewElement ? (ResourceBundleEditorViewElement) value : null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ResourceBundleEditorViewElement getSelectedElement() {
|
||||
final DefaultMutableTreeNode selectedNode = getSelectedNode();
|
||||
if (selectedNode == null) {
|
||||
return null;
|
||||
}
|
||||
Object userObject = selectedNode.getUserObject();
|
||||
if (!(userObject instanceof AbstractTreeNode)) return null;
|
||||
Object value = ((AbstractTreeNode)userObject).getValue();
|
||||
return value instanceof ResourceBundleEditorViewElement ? (ResourceBundleEditorViewElement) value : null;
|
||||
public ResourceBundleEditorViewElement getSelectedElementIfOnlyOne() {
|
||||
final Collection<ResourceBundleEditorViewElement> selectedElements = getSelectedElements();
|
||||
return selectedElements.size() == 1 ? ContainerUtil.getFirstItem(selectedElements) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+14
-4
@@ -25,7 +25,6 @@ import com.intellij.lang.properties.psi.Property;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
@@ -34,10 +33,13 @@ import com.intellij.refactoring.safeDelete.SafeDeleteHandler;
|
||||
import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.usages.UsageTarget;
|
||||
import com.intellij.usages.UsageView;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -74,9 +76,17 @@ class ResourceBundleStructureViewComponent extends PropertiesGroupingStructureVi
|
||||
} else if (PlatformDataKeys.FILE_EDITOR.is(dataId)) {
|
||||
return getFileEditor();
|
||||
} else if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
|
||||
final ResourceBundleEditorViewElement selectedElement = ((ResourceBundleEditor)getFileEditor()).getSelectedElement();
|
||||
if (selectedElement != null) {
|
||||
return selectedElement.getPsiElements();
|
||||
final Collection<ResourceBundleEditorViewElement> selectedElements = ((ResourceBundleEditor)getFileEditor()).getSelectedElements();
|
||||
if (selectedElements.isEmpty()) {
|
||||
return null;
|
||||
} else if (selectedElements.size() == 1) {
|
||||
return ContainerUtil.getFirstItem(selectedElements).getPsiElements();
|
||||
} else {
|
||||
final List<PsiElement> psiElements = new ArrayList<PsiElement>();
|
||||
for (ResourceBundleEditorViewElement selectedElement : selectedElements) {
|
||||
Collections.addAll(psiElements, selectedElement.getPsiElements());
|
||||
}
|
||||
return psiElements.toArray(new PsiElement[psiElements.size()]);
|
||||
}
|
||||
} else if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
|
||||
final PsiElement[] psiElements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(this);
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class ResourceBundleFromEditorRenameHandler implements RenameHandler {
|
||||
public void invoke(final @NotNull Project project, Editor editor, final PsiFile file, DataContext dataContext) {
|
||||
final ResourceBundleEditor resourceBundleEditor = (ResourceBundleEditor)PlatformDataKeys.FILE_EDITOR.getData(dataContext);
|
||||
assert resourceBundleEditor != null;
|
||||
final ResourceBundleEditorViewElement selectedElement = resourceBundleEditor.getSelectedElement();
|
||||
final ResourceBundleEditorViewElement selectedElement = resourceBundleEditor.getSelectedElementIfOnlyOne();
|
||||
if (selectedElement != null) {
|
||||
CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -51,7 +51,7 @@ public class StudyDocumentListener extends DocumentAdapter {
|
||||
int change = event.getNewLength() - event.getOldLength();
|
||||
if (myTaskWindow != null) {
|
||||
int newLength = myTaskWindow.getLength() + change;
|
||||
myTaskWindow.setLength(newLength);
|
||||
myTaskWindow.setLength(newLength <= 0 ? 0 : newLength);
|
||||
}
|
||||
int newEnd = offset + event.getNewLength();
|
||||
int newLine = document.getLineNumber(newEnd);
|
||||
|
||||
@@ -113,7 +113,8 @@ public class TaskFile implements Stateful{
|
||||
for (TaskWindow tw : taskWindows) {
|
||||
if (tw.getLine() <= line) {
|
||||
int twStartOffset = tw.getRealStartOffset(document);
|
||||
int twEndOffset = twStartOffset + tw.getLength();
|
||||
final int length = tw.getLength() > 0 ? tw.getLength() : 0;
|
||||
int twEndOffset = twStartOffset + length;
|
||||
if (twStartOffset <= offset && offset <= twEndOffset) {
|
||||
return tw;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class XmlFormatterTestCase extends FormatterTestCase{
|
||||
public void testDontKeepLineBreaksInText() throws Throwable {
|
||||
final CodeStyleSettings settings = getSettings();
|
||||
final XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
|
||||
settings.RIGHT_MARGIN = 15;
|
||||
settings.setDefaultRightMargin(15);
|
||||
|
||||
settings.HTML_KEEP_LINE_BREAKS_IN_TEXT = false;
|
||||
xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT = false;
|
||||
|
||||
Reference in New Issue
Block a user