Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2013-04-02 16:05:38 +04:00
27 changed files with 266 additions and 65 deletions
@@ -63,6 +63,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.event.HyperlinkEvent;
import java.awt.*;
import java.awt.event.ActionEvent;
@@ -206,6 +207,8 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
JPanel treePanel = myLayoutTreeComponent.getTreePanel();
if (UIUtil.isUnderDarcula()) {
treePanel.setBorder(new EmptyBorder(3, 0, 0, 0));
} else {
treePanel.setBorder(new LineBorder(UIUtil.getBorderColor()));
}
leftPanel.add(treePanel, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
@@ -219,8 +222,9 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
final JPanel rightPanel = new JPanel(new BorderLayout());
final JPanel rightTopPanel = new JPanel(new BorderLayout());
final JPanel labelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
labelPanel.add(new JLabel("Available Elements"));
final JPanel labelPanel = new JPanel();
labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.X_AXIS));
labelPanel.add(new JLabel("Available Elements "));
final HyperlinkLabel link = new HyperlinkLabel("");
link.setIcon(AllIcons.General.Help);
link.setUseIconAsLink(true);
@@ -235,12 +239,16 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
}
});
labelPanel.add(link);
rightTopPanel.add(labelPanel, BorderLayout.SOUTH);
rightTopPanel.add(labelPanel, BorderLayout.CENTER);
rightPanel.add(rightTopPanel, BorderLayout.NORTH);
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(mySourceItemsTree, UIUtil.isUnderDarcula());
JPanel scrollPaneWrap = new JPanel(new BorderLayout());
scrollPaneWrap.add(scrollPane, BorderLayout.CENTER);
scrollPaneWrap.setBorder(new EmptyBorder(3, 0, 0, 0));
if (UIUtil.isUnderDarcula()) {
scrollPaneWrap.setBorder(new EmptyBorder(3, 0, 0, 0));
} else {
scrollPaneWrap.setBorder(new LineBorder(UIUtil.getBorderColor()));
}
rightPanel.add(scrollPaneWrap, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
@@ -132,9 +132,7 @@ public class LayoutTreeComponent implements DnDTarget, Disposable {
emptyPanel.setPreferredSize(new Dimension(0, 0));
myPropertiesPanelWrapper = new JPanel(new CardLayout());
if (UIUtil.isUnderDarcula()) {
myPropertiesPanel.setBorder(new CustomLineBorder(UIUtil.getBorderColor(), 1, 0, 0, 0));
}
myPropertiesPanel.setBorder(new CustomLineBorder(UIUtil.getBorderColor(), 1, 0, 0, 0));
myPropertiesPanelWrapper.add(EMPTY_CARD, emptyPanel);
myPropertiesPanelWrapper.add(PROPERTIES_CARD, myPropertiesPanel);
}
@@ -614,7 +612,7 @@ public class LayoutTreeComponent implements DnDTarget, Disposable {
myCurrentPanel = element.getType().createElementPropertiesPanel(myElement, myContext);
myPropertiesPanel.removeAll();
if (myCurrentPanel != null) {
myPropertiesPanel.add(BorderLayout.CENTER, ScrollPaneFactory.createScrollPane(myCurrentPanel.createComponent(), UIUtil.isUnderDarcula()));
myPropertiesPanel.add(BorderLayout.CENTER, ScrollPaneFactory.createScrollPane(myCurrentPanel.createComponent(), true));
myCurrentPanel.reset();
myPropertiesPanel.revalidate();
}
@@ -3,8 +3,10 @@ package com.intellij.execution.console;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.ui.InputValidatorEx;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.AddEditDeleteListPanel;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
@@ -30,7 +32,8 @@ public class ConsoleFoldingConfigurable implements SearchableConfigurable, Confi
myMainComponent = new JPanel(new BorderLayout());
Splitter splitter = new Splitter(true);
myMainComponent.add(splitter);
myPositivePanel = new MyAddDeleteListPanel("Fold console lines that contain", "Enter a substring of a console line you'd like to see folded:");
myPositivePanel =
new MyAddDeleteListPanel("Fold console lines that contain", "Enter a substring of a console line you'd like to see folded:");
myNegativePanel = new MyAddDeleteListPanel("Exceptions", "Enter a substring of a console line you don't want to fold:");
splitter.setFirstComponent(myPositivePanel);
splitter.setSecondComponent(myNegativePanel);
@@ -101,7 +104,26 @@ public class ConsoleFoldingConfigurable implements SearchableConfigurable, Confi
@Nullable
private String showEditDialog(final String initialValue) {
return Messages.showInputDialog(this, myQuery, "Folding pattern", Messages.getQuestionIcon(), initialValue, null);
return Messages.showInputDialog(this, myQuery, "Folding pattern", Messages.getQuestionIcon(), initialValue, new InputValidatorEx() {
@Override
public boolean checkInput(String inputString) {
return !StringUtil.isEmpty(inputString);
}
@Override
public boolean canClose(String inputString) {
return !StringUtil.isEmpty(inputString);
}
@Nullable
@Override
public String getErrorText(String inputString) {
if (!checkInput(inputString)) {
return "Console folding rule string cannot be empty";
}
return null;
}
});
}
void resetFrom(List<String> patterns) {
@@ -15,13 +15,14 @@
*/
package com.intellij.execution.console;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.intellij.openapi.components.*;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
* @author peter
@@ -89,13 +90,19 @@ public class ConsoleFoldingSettings implements PersistentStateComponent<ConsoleF
return negated ? myNegativePatterns : myPositivePatterns;
}
private Collection<String> filterEmptyStringsFromCollection(Collection<String> collection) {
return Collections2.filter(collection, new Predicate<String>() {
@Override
public boolean apply(@Nullable String input) {
return !StringUtil.isEmpty(input);
}
});
}
public void loadState(MyBean state) {
myPositivePatterns.clear();
myNegativePatterns.clear();
myPositivePatterns.addAll(state.addedPositive);
myNegativePatterns.addAll(state.addedNegative);
Set<String> removedPositive = new HashSet<String>(state.removedPositive);
Set<String> removedNegative = new HashSet<String>(state.removedNegative);
@@ -104,6 +111,10 @@ public class ConsoleFoldingSettings implements PersistentStateComponent<ConsoleF
patternList(regexp.negate).add(regexp.substring);
}
}
myPositivePatterns.addAll(filterEmptyStringsFromCollection(state.addedPositive));
myNegativePatterns.addAll(filterEmptyStringsFromCollection(state.addedNegative));
}
public static class MyBean {
@@ -21,12 +21,12 @@ import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.VerticalFlowLayout;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.ui.*;
@@ -302,15 +302,13 @@ public class MemberChooser<T extends ClassMember> extends DialogWrapper implemen
ExpandAllAction expandAllAction = new ExpandAllAction();
expandAllAction.registerCustomShortcutSet(
new CustomShortcutSet(
KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK)),
new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_EXPAND_ALL)),
myTree);
group.add(expandAllAction);
CollapseAllAction collapseAllAction = new CollapseAllAction();
collapseAllAction.registerCustomShortcutSet(
new CustomShortcutSet(
KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK)),
new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_COLLAPSE_ALL)),
myTree);
group.add(collapseAllAction);
@@ -311,7 +311,7 @@
<referenceProviderType key="Schema references provider"
implementationClass="com.intellij.psi.impl.source.resolve.reference.impl.providers.SchemaReferencesProvider"/>
<renamePsiElementProcessor implementation="com.intellij.refactoring.rename.RenameXmlAttributeProcessor"/>
<renamePsiElementProcessor implementation="com.intellij.refactoring.rename.RenameXmlAttributeProcessor" id="xmlAttribute"/>
<lang.importOptimizer id="XML" language="XML" implementationClass="com.intellij.refactoring.XmlImportOptimizer"/>
<readWriteAccessDetector implementation="com.intellij.codeInsight.highlighting.XmlReadWriteAccessDetector"/>
@@ -73,6 +73,7 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.ClosureSyntheticPara
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightLocalVariable;
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GroovyScriptClass;
import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureParameterEnhancer;
import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
@@ -896,32 +897,37 @@ public class ExpressionGenerator extends Generator {
public void visitLiteralExpression(GrLiteral literal) {
final TypeConstraint[] constraints = GroovyExpectedTypesProvider.calculateTypeConstraints(literal);
final String text = literal.getText();
final Object value;
if (text.startsWith("'''") || text.startsWith("\"\"\"")) {
String string = ((String)literal.getValue());
LOG.assertTrue(string != null);
string = string.replace("\n", "\\n").replace("\r", "\\r");
value = string;
}
else {
value = literal.getValue();
}
boolean isChar = false;
for (TypeConstraint constraint : constraints) {
if (constraint instanceof SubtypeConstraint && TypesUtil.unboxPrimitiveTypeWrapper(constraint.getDefaultType()) == PsiType.CHAR) {
isChar = true;
}
}
if (isChar) {
builder.append('\'').append(StringUtil.escapeQuotes(String.valueOf(value))).append('\'');
final String text = literal.getText();
final Object value;
if (text.startsWith("'''") || text.startsWith("\"\"\"")) {
String string = GrStringUtil.removeQuotes(text).replace("\n", "\\n").replace("\r", "\\r");
builder.append('"').append(string).append('"');
}
else if (value instanceof String) {
builder.append('"').append(StringUtil.escapeQuotes((String)value)).append('"');
else if (text.startsWith("'")) {
if (isChar) {
builder.append(text);
}
else {
builder.append('"').append(StringUtil.escapeQuotes(StringUtil.trimEnd(text.substring(1, text.length()), "'"))).append('"');
}
}
else if (text.startsWith("\"")) {
if (isChar) {
builder.append('\'').append(StringUtil.escapeQuotes(StringUtil.trimEnd(text.substring(1, text.length()), "\""))).append('\'');
}
else {
builder.append(text);
}
}
else {
builder.append(value);
builder.append(text);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -189,4 +189,6 @@ public final class Matcher {
void testSelfNavigatingOperator() { doTest() }
void testComparisonToNull() { doTest() }
void testStringConverting() { doTest() }
}
@@ -0,0 +1,12 @@
print("a");
print("v");
char a = 'a';
java.lang.String s = "b";
java.lang.String x = "ab";
print("a\t\nabc");
print("a'b\tc");
print("a\"b\tc");
print(4);
print(4.5f);
print(4.5d);
print(-4.5d);
@@ -0,0 +1,12 @@
print("a");
print("v");
char a = 'a';
java.lang.String s = "b";
java.lang.String x = "ab";
print("a\t\nabc");
print("a'b\tc");
print("a\"b\tc");
print(4);
print(4.5f);
print(4.5d);
print(-4.5d);
@@ -1,4 +1,4 @@
java.util.Date date = new java.util.Date(2011, 4, 9);
java.util.Date date = new java.util.Date(2011, 04, 09);
if (org.codehaus.groovy.runtime.DefaultGroovyMethods.isCase(new java.util.Date(20, 11, 23), date)) {
print("aaa");
print("bbb");
@@ -1,4 +1,4 @@
java.util.Date date = new java.util.Date(2011, 4, 9);
java.util.Date date = new java.util.Date(2011, 04, 09);
if (org.codehaus.groovy.runtime.DefaultGroovyMethods.isCase(new java.util.Date(20, 11, 23), date)) {
print("aaa");
print("bbb");
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.javaFX.fxml;
import com.intellij.codeInsight.TargetElementUtilBase;
import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.rename.RenameProcessor;
import com.intellij.refactoring.rename.inplace.MemberInplaceRenameHandler;
@@ -51,7 +52,15 @@ public class JavaFXRenameTest extends DaemonAnalyzerTestCase {
public void testCustomComponentTag() throws Exception {
doTest("Foo", true);
}
public void testFromReference() throws Exception {
final String newName = "lbl1";
doTest(newName);
final PsiClass controllerClass = findClass(getTestName(false));
assertNotNull(controllerClass);
assertNotNull(controllerClass.findFieldByName(newName, false));
}
public void testIdWithRefs() throws Exception {
configureByFiles(null, getTestName(true) + ".fxml");
PsiElement element = TargetElementUtilBase
@@ -42,6 +42,7 @@
<packaging.artifactPropertiesProvider implementation="org.jetbrains.plugins.javaFX.packaging.preloader.JavaFxPreloaderArtifactPropertiesProvider"/>
<implicitUsageProvider implementation="org.jetbrains.plugins.javaFX.fxml.codeInsight.inspections.JavaFxImplicitUsageProvider"/>
<referencesSearch implementation="org.jetbrains.plugins.javaFX.fxml.refs.JavaFxControllerFieldSearcher"/>
<renamePsiElementProcessor implementation="org.jetbrains.plugins.javaFX.JavaFxRenameAttributeProcessor" order="before xmlAttribute"/>
</extensions>
<actions>
@@ -74,10 +74,23 @@ public class JavaFxIdsIndex extends FileBasedIndexExtension<String, Set<String>>
}
@NotNull
public static Collection<String> getAllRegisteredIds(Project project) {
public static Collection<String> getAllRegisteredIds(Project project, Set<String> fxmls) {
CommonProcessors.CollectUniquesProcessor<String> processor = new CommonProcessors.CollectUniquesProcessor<String>();
FileBasedIndex.getInstance().processAllKeys(KEY, processor, project);
return processor.getResults();
final Collection<String> results = new ArrayList<String>(processor.getResults());
final GlobalSearchScope searchScope = GlobalSearchScope.projectScope(project);
for (Iterator<String> iterator = results.iterator(); iterator.hasNext(); ) {
final String id = iterator.next();
final List<Set<String>> values = FileBasedIndex.getInstance().getValues(KEY, id, searchScope);
if (!values.isEmpty()) {
final Set<String> pathSet = values.get(0);
if (pathSet != null && !Collections.disjoint(pathSet, fxmls)) {
continue;
}
}
iterator.remove();
}
return results;
}
@NotNull
@@ -0,0 +1,58 @@
/*
* Copyright 2000-2013 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 org.jetbrains.plugins.javaFX;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiField;
import com.intellij.psi.PsiReference;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlAttributeValue;
import com.intellij.refactoring.rename.RenameXmlAttributeProcessor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.javaFX.fxml.FxmlConstants;
import org.jetbrains.plugins.javaFX.fxml.JavaFxFileTypeFactory;
import java.util.Map;
/**
* User: anna
* Date: 4/2/13
*/
public class JavaFxRenameAttributeProcessor extends RenameXmlAttributeProcessor {
@Override
public boolean canProcessElement(@NotNull PsiElement element) {
if (element instanceof XmlAttributeValue && JavaFxFileTypeFactory.isFxml(element.getContainingFile())) {
final PsiElement parent = element.getParent();
return parent instanceof XmlAttribute && FxmlConstants.FX_ID.equals(((XmlAttribute)parent).getName());
}
return false;
}
@Override
public void prepareRenaming(PsiElement element, String newName, Map<PsiElement, String> allRenames, SearchScope scope) {
if (element instanceof XmlAttributeValue) {
final XmlAttributeValue refId = (XmlAttributeValue)element;
final PsiReference refIdReference = refId.getReference();
if (refIdReference != null) {
final PsiElement resolveRefId = refIdReference.resolve();
if (resolveRefId instanceof PsiField) {
allRenames.put(resolveRefId, newName);
}
}
}
}
}
@@ -0,0 +1,4 @@
import javafx.control.Label;
public class FromReference {
public Label lb;
}
@@ -0,0 +1,8 @@
<?import javafx.scene.control.Label?>
<?import javafx.layout.*?>
<GridPane xmlns:fx="http://javafx.com/fxml" fx:controller="FromReference">
<fx:define>
<Label fx:id="lb"/>
</fx:define>
<fx:reference source="l<caret>b"/>
</GridPane>
@@ -0,0 +1,8 @@
<?import javafx.scene.control.Label?>
<?import javafx.layout.*?>
<GridPane xmlns:fx="http://javafx.com/fxml" fx:controller="FromReference">
<fx:define>
<Label fx:id="lbl1"/>
</fx:define>
<fx:reference source="lbl1"/>
</GridPane>
@@ -315,27 +315,25 @@ public class MavenDomProjectProcessorUtils {
SearchProcessor<MavenDomDependency, MavenDomDependencies> processor = new SearchProcessor<MavenDomDependency, MavenDomDependencies>() {
@Override
protected MavenDomDependency find(MavenDomDependencies mavenDomDependencies) {
if (!model.equals(mavenDomDependencies.getParentOfType(MavenDomProjectModel.class, true))) {
for (MavenDomDependency domDependency : mavenDomDependencies.getDependencies()) {
if (artifactId.equals(domDependency.getArtifactId().getStringValue()) &&
groupId.equals(domDependency.getGroupId().getStringValue())) {
return domDependency;
}
for (MavenDomDependency domDependency : mavenDomDependencies.getDependencies()) {
if (artifactId.equals(domDependency.getArtifactId().getStringValue()) &&
groupId.equals(domDependency.getGroupId().getStringValue())) {
return domDependency;
}
if ("import".equals(domDependency.getScope().getRawText())) {
GenericDomValue<String> version = domDependency.getVersion();
if (version.getXmlElement() != null) {
GenericDomValueReference reference = new GenericDomValueReference(version);
PsiElement resolve = reference.resolve();
if ("import".equals(domDependency.getScope().getRawText())) {
GenericDomValue<String> version = domDependency.getVersion();
if (version.getXmlElement() != null) {
GenericDomValueReference reference = new GenericDomValueReference(version);
PsiElement resolve = reference.resolve();
if (resolve instanceof XmlFile) {
MavenDomProjectModel dependModel = MavenDomUtil.getMavenDomModel((PsiFile)resolve, MavenDomProjectModel.class);
if (dependModel != null) {
for (MavenDomDependency dep : dependModel.getDependencyManagement().getDependencies().getDependencies()) {
if (artifactId.equals(dep.getArtifactId().getStringValue()) &&
groupId.equals(dep.getGroupId().getStringValue())) {
return domDependency;
}
if (resolve instanceof XmlFile) {
MavenDomProjectModel dependModel = MavenDomUtil.getMavenDomModel((PsiFile)resolve, MavenDomProjectModel.class);
if (dependModel != null) {
for (MavenDomDependency dep : dependModel.getDependencyManagement().getDependencies().getDependencies()) {
if (artifactId.equals(dep.getArtifactId().getStringValue()) &&
groupId.equals(dep.getGroupId().getStringValue())) {
return domDependency;
}
}
}
+15
View File
@@ -0,0 +1,15 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/tips.css">
</head>
<body>
<p>When working with a lengthy list of tasks, you don't need to delete them one by one.
Select several tasks, using <span class="control">Shift</span>
or <span class="control">Control</span> keys, click the right arrow, and then click
<span class="control">Remove<span>.
</p>
<p class="image"><img src="images/select_tasks.png"><p>
</body>
</html>
@@ -0,0 +1,16 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/tips.css">
</head>
<body>
<p>You can quickly review all styles currently applied to an HTML tag, by right-clicking the tag name and selecting
<span class="control">Show Applied Styles For Tag</span>
from the context menu:</p>
<p class="image"><img src="images/show_applied_styles.gif"></p>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

+2
View File
@@ -159,4 +159,6 @@
<tip file="RefactorThis.html"/>
<tip file="FavoritesToolWindow1.html"/>
<tip file="FavoritesToolWindow2.html"/>
<tip file="SelectTasks.html"/>
<tip file="ShowAppliedStyles.html"/>
</tips>