Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ilya.Kazakevich
2014-01-21 04:19:25 +04:00
6 changed files with 11 additions and 30 deletions
@@ -174,10 +174,7 @@ public class JavaLanguageInjectionSupport extends AbstractLanguageInjectionSuppo
}
public BaseInjection createInjection(final Element element) {
if (element.getName().equals(MethodParameterInjection.class.getSimpleName())) {
return new MethodParameterInjection();
}
else return new BaseInjection(JAVA_SUPPORT_ID);
return new BaseInjection(JAVA_SUPPORT_ID);
}
private static boolean doInjectInJava(final Project project,
@@ -15,8 +15,6 @@
*/
package org.intellij.plugins.intelliLang.inject.config.ui;
import com.intellij.openapi.editor.event.DocumentAdapter;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.project.Project;
import com.intellij.util.ui.UIUtil;
import org.intellij.plugins.intelliLang.inject.config.BaseInjection;
@@ -73,7 +71,6 @@ public abstract class AbstractInjectionPanel<T extends BaseInjection> implements
final InjectionPanel p = getField(panel);
p.init(copy);
}
reset();
}
public final boolean isModified() {
@@ -95,18 +92,22 @@ public abstract class AbstractInjectionPanel<T extends BaseInjection> implements
// auto-generated name should go last
apply(myOrigInjection);
myOrigInjection.generatePlaces();
myEditCopy.copyFrom(myOrigInjection);
if (!myOtherPanels.isEmpty()) {
myOrigInjection.generatePlaces();
myEditCopy.copyFrom(myOrigInjection);
}
}
protected abstract void apply(T other);
@SuppressWarnings({"unchecked"})
public final void reset() {
if (!myOtherPanels.isEmpty()) {
myEditCopy.copyFrom(myOrigInjection);
}
for (Field panel : myOtherPanels) {
getField(panel).reset();
}
myEditCopy.copyFrom(myOrigInjection);
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
public void run() {
resetImpl();
@@ -139,10 +140,4 @@ public abstract class AbstractInjectionPanel<T extends BaseInjection> implements
updater.run();
}
}
protected class TreeUpdateListener extends DocumentAdapter {
public void documentChanged(DocumentEvent e) {
updateTree();
}
}
}
@@ -102,14 +102,6 @@ public class XmlAttributeInjection extends AbstractTagInjection {
return this;
}
protected void readExternalImpl(Element e) {
super.readExternalImpl(e);
}
protected void writeExternalImpl(Element e) {
super.writeExternalImpl(e);
}
@SuppressWarnings({"RedundantIfStatement"})
public boolean equals(Object o) {
if (this == o) return true;
@@ -49,7 +49,6 @@ public class TagPanel extends AbstractInjectionPanel<AbstractTagInjection> {
$$$setupUI$$$();
myNamespace.setModel(createNamespaceUriModel(myProject));
myLocalName.getDocument().addDocumentListener(new TreeUpdateListener());
}
public static ComboBoxModel createNamespaceUriModel(Project project) {
@@ -48,9 +48,6 @@ public class XmlAttributePanel extends AbstractInjectionPanel<XmlAttributeInject
myNamespace.setModel(TagPanel.createNamespaceUriModel(project));
init(injection.copy());
// be sure to add the listener after initializing the textfield's value
myLocalName.getDocument().addDocumentListener(new TreeUpdateListener());
}
public JPanel getComponent() {
@@ -268,10 +268,11 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
}
public BaseInjection createInjection(Element element) {
if (element.getName().equals(XmlAttributeInjection.class.getSimpleName())) {
String place = StringUtil.notNullize(element.getChildText("place"), "");
if (place.startsWith("xmlAttribute")) {
return new XmlAttributeInjection();
}
else if (element.getName().equals(XmlTagInjection.class.getSimpleName())) {
else if (place.startsWith("xmlTag")) {
return new XmlTagInjection();
}
else {