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:
@@ -16,6 +16,7 @@
|
||||
package org.intellij.lang.regexp;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
@@ -25,5 +26,5 @@ import com.intellij.psi.PsiElement;
|
||||
public interface RegExpRangeProvider {
|
||||
ExtensionPointName<RegExpRangeProvider> EP_NAME = new ExtensionPointName<RegExpRangeProvider>("com.intellij.regExpRangeProvider");
|
||||
|
||||
TextRange getTextRange(PsiElement element);
|
||||
Pair<PsiElement, TextRange> getRangePair(PsiElement element);
|
||||
}
|
||||
|
||||
+15
-9
@@ -16,6 +16,7 @@
|
||||
package org.intellij.lang.regexp.intention;
|
||||
|
||||
import com.intellij.codeInsight.intention.impl.QuickEditAction;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -43,23 +44,28 @@ public class CheckRegExpIntentionAction extends QuickEditAction implements Icona
|
||||
@Override
|
||||
protected Pair<PsiElement, TextRange> getRangePair(PsiFile file, Editor editor) {
|
||||
Pair<PsiElement, TextRange> pair = super.getRangePair(file, editor);
|
||||
if (pair != null) return pair;
|
||||
RegExpRangeProvider[] rangeProviders = RegExpRangeProvider.EP_NAME.getExtensions();
|
||||
PsiElement element = PsiUtilBase.getElementAtCaret(editor);
|
||||
for (RegExpRangeProvider provider : rangeProviders) {
|
||||
TextRange range = provider.getTextRange(element);
|
||||
if (range != null) {
|
||||
return Pair.create(element, range);
|
||||
|
||||
if (pair == null) {
|
||||
RegExpRangeProvider[] rangeProviders = RegExpRangeProvider.EP_NAME.getExtensions();
|
||||
PsiElement element = PsiUtilBase.getElementAtCaret(editor);
|
||||
for (RegExpRangeProvider provider : rangeProviders) {
|
||||
pair = provider.getRangePair(element);
|
||||
if (pair != null) break;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return pair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
|
||||
final Pair<PsiElement, TextRange> pair = getRangePair(file, editor);
|
||||
/*super.isAvailable(project, editor, file) && */
|
||||
return pair != null && pair.first != null && pair.first.getLanguage() == RegExpLanguage.INSTANCE;
|
||||
if (pair != null && pair.first != null) {
|
||||
Language language = pair.first.getLanguage();
|
||||
Language baseLanguage = language.getBaseLanguage();
|
||||
return language == RegExpLanguage.INSTANCE || baseLanguage == RegExpLanguage.INSTANCE;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Mappings {
|
||||
private final TIntHashSet myDeletedClasses;
|
||||
private final Object myLock;
|
||||
|
||||
private void addDeletedClass (final int it) {
|
||||
private void addDeletedClass(final int it) {
|
||||
assert (myDeletedClasses != null);
|
||||
|
||||
myDeletedClasses.add(it);
|
||||
@@ -68,7 +68,7 @@ public class Mappings {
|
||||
}
|
||||
|
||||
private TIntHashSet getDeletedClasses() {
|
||||
return myDeletedClasses;
|
||||
return myDeletedClasses;
|
||||
}
|
||||
|
||||
private TIntHashSet getChangedClasses() {
|
||||
@@ -180,16 +180,21 @@ public class Mappings {
|
||||
myClassToSourceFile = new IntIntTransientMaplet();
|
||||
}
|
||||
else {
|
||||
myClassToSubclasses = new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_SUBCLASSES), INT_KEY_DESCRIPTOR);
|
||||
myClassToClassDependency = new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_CLASS), INT_KEY_DESCRIPTOR);
|
||||
myClassToSubclasses =
|
||||
new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_SUBCLASSES), INT_KEY_DESCRIPTOR);
|
||||
myClassToClassDependency =
|
||||
new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_CLASS), INT_KEY_DESCRIPTOR);
|
||||
mySourceFileToClasses = new IntObjectPersistentMultiMaplet<ClassRepr>(
|
||||
DependencyContext.getTableFile(myRootDir, SOURCE_TO_CLASS), INT_KEY_DESCRIPTOR, ClassRepr.externalizer(myContext), ourClassSetConstructor
|
||||
DependencyContext.getTableFile(myRootDir, SOURCE_TO_CLASS), INT_KEY_DESCRIPTOR, ClassRepr.externalizer(myContext),
|
||||
ourClassSetConstructor
|
||||
);
|
||||
mySourceFileToAnnotationUsages = new IntObjectPersistentMultiMaplet<UsageRepr.Usage>(
|
||||
DependencyContext.getTableFile(myRootDir, SOURCE_TO_ANNOTATIONS), INT_KEY_DESCRIPTOR, UsageRepr.externalizer(myContext), ourUsageSetConstructor
|
||||
DependencyContext.getTableFile(myRootDir, SOURCE_TO_ANNOTATIONS), INT_KEY_DESCRIPTOR, UsageRepr.externalizer(myContext),
|
||||
ourUsageSetConstructor
|
||||
);
|
||||
mySourceFileToUsages = new IntObjectPersistentMultiMaplet<UsageRepr.Cluster>(
|
||||
DependencyContext.getTableFile(myRootDir, SOURCE_TO_USAGES), INT_KEY_DESCRIPTOR, UsageRepr.Cluster.clusterExternalizer(myContext), ourUsageClusterSetConstructor
|
||||
DependencyContext.getTableFile(myRootDir, SOURCE_TO_USAGES), INT_KEY_DESCRIPTOR, UsageRepr.Cluster.clusterExternalizer(myContext),
|
||||
ourUsageClusterSetConstructor
|
||||
);
|
||||
myClassToSourceFile = new IntIntPersistentMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_SOURCE), INT_KEY_DESCRIPTOR);
|
||||
}
|
||||
@@ -289,6 +294,8 @@ public class Mappings {
|
||||
}
|
||||
|
||||
private void runPostPasses() {
|
||||
myChangedClasses.removeAll(myDeletedClasses.toArray());
|
||||
|
||||
for (final PostPass p : myPostPasses) {
|
||||
p.run();
|
||||
}
|
||||
@@ -689,7 +696,8 @@ public class Mappings {
|
||||
|
||||
debug("Affect method usage referenced of class ", p);
|
||||
|
||||
final UsageRepr.Usage usage = rootUsage instanceof UsageRepr.MetaMethodUsage ? method.createMetaUsage(myContext, p) : method.createUsage(myContext, p);
|
||||
final UsageRepr.Usage usage =
|
||||
rootUsage instanceof UsageRepr.MetaMethodUsage ? method.createMetaUsage(myContext, p) : method.createUsage(myContext, p);
|
||||
affectedUsages.add(usage);
|
||||
return true;
|
||||
}
|
||||
@@ -891,7 +899,12 @@ public class Mappings {
|
||||
boolean accept(File file);
|
||||
}
|
||||
|
||||
public boolean differentiate(final Mappings delta, final Collection<String> removed, final Collection<File> filesToCompile, final Collection<File> compiledFiles, final Collection<File> affectedFiles, DependentFilesFilter filter) {
|
||||
public boolean differentiate(final Mappings delta,
|
||||
final Collection<String> removed,
|
||||
final Collection<File> filesToCompile,
|
||||
final Collection<File> compiledFiles,
|
||||
final Collection<File> affectedFiles,
|
||||
DependentFilesFilter filter) {
|
||||
synchronized (myLock) {
|
||||
debug("Begin of Differentiate:");
|
||||
|
||||
@@ -1259,7 +1272,9 @@ public class Mappings {
|
||||
|
||||
if (source > 0) {
|
||||
final String f = myContext.getValue(source);
|
||||
debug( "Removed method is not abstract & overrides some abstract method which is not then over-overriden in subclass ", p);
|
||||
debug(
|
||||
"Removed method is not abstract & overrides some abstract method which is not then over-overriden in subclass ",
|
||||
p);
|
||||
debug("Affecting subclass source file ", f);
|
||||
affectedFiles.add(new File(f));
|
||||
}
|
||||
@@ -1286,7 +1301,8 @@ public class Mappings {
|
||||
debug("Class is annotation, default value is removed => adding annotation query");
|
||||
final TIntHashSet l = new TIntHashSet(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR);
|
||||
l.add(m.name);
|
||||
annotationQuery.add((UsageRepr.AnnotationUsage)UsageRepr.createAnnotationUsage(myContext, TypeRepr.createClassType( myContext, it.name), l, null));
|
||||
annotationQuery.add((UsageRepr.AnnotationUsage)UsageRepr
|
||||
.createAnnotationUsage(myContext, TypeRepr.createClassType(myContext, it.name), l, null));
|
||||
}
|
||||
}
|
||||
else if (d.base() != Difference.NONE || throwsChanged) {
|
||||
@@ -1389,7 +1405,8 @@ public class Mappings {
|
||||
final int outerClass = r.outerClassName;
|
||||
|
||||
if (!empty(outerClass) && u.fieldVisible(outerClass, f)) {
|
||||
debug("Affecting inner subclass (introduced field can potentially hide surrounding class fields): ", sourceFileName);
|
||||
debug("Affecting inner subclass (introduced field can potentially hide surrounding class fields): ",
|
||||
sourceFileName);
|
||||
affectedFiles.add(new File(myContext.getValue(sourceFileName)));
|
||||
}
|
||||
}
|
||||
@@ -1658,6 +1675,47 @@ public class Mappings {
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanupRemovedClass(final int className, ClassRepr cr, Collection<UsageRepr.Cluster> clusters) {
|
||||
if (cr == null) {
|
||||
cr = new Util().reprByName(className);
|
||||
}
|
||||
|
||||
if (cr != null) {
|
||||
for (final int superSomething : cr.getSupers()) {
|
||||
myClassToSubclasses.removeFrom(superSomething, cr.name);
|
||||
}
|
||||
|
||||
final int sourceFile = myClassToSourceFile.get(className);
|
||||
|
||||
if (sourceFile > 0) {
|
||||
if (clusters == null) {
|
||||
clusters = mySourceFileToUsages.get(sourceFile);
|
||||
}
|
||||
|
||||
if (clusters != null) {
|
||||
for (final UsageRepr.Cluster cluster : clusters) {
|
||||
final Set<UsageRepr.Usage> usages = cluster.getUsages();
|
||||
if (usages != null) {
|
||||
for (final UsageRepr.Usage u : usages) {
|
||||
if (u instanceof UsageRepr.ClassUsage) {
|
||||
final TIntHashSet residents = cluster.getResidence(u);
|
||||
|
||||
if (residents != null && residents.contains(cr.name)) {
|
||||
myClassToClassDependency.removeFrom(((UsageRepr.ClassUsage)u).className, cr.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myClassToClassDependency.remove(className);
|
||||
myClassToSubclasses.remove(className);
|
||||
myClassToSourceFile.remove(className);
|
||||
}
|
||||
|
||||
public void integrate(final Mappings delta, final Collection<File> compiled, final Collection<String> removed) {
|
||||
synchronized (myLock) {
|
||||
try {
|
||||
@@ -1671,30 +1729,7 @@ public class Mappings {
|
||||
|
||||
if (classes != null) {
|
||||
for (final ClassRepr cr : classes) {
|
||||
myClassToSubclasses.remove(cr.name);
|
||||
myClassToSourceFile.remove(cr.name);
|
||||
myClassToClassDependency.remove(cr.name);
|
||||
|
||||
for (final int superSomething : cr.getSupers()) {
|
||||
myClassToSubclasses.removeFrom(superSomething, cr.name);
|
||||
}
|
||||
|
||||
if (clusters != null) {
|
||||
for (final UsageRepr.Cluster cluster : clusters) {
|
||||
final Set<UsageRepr.Usage> usages = cluster.getUsages();
|
||||
if (usages != null) {
|
||||
for (final UsageRepr.Usage u : usages) {
|
||||
if (u instanceof UsageRepr.ClassUsage) {
|
||||
final TIntHashSet residents = cluster.getResidence(u);
|
||||
|
||||
if (residents != null && residents.contains(cr.name)) {
|
||||
myClassToClassDependency.removeFrom(((UsageRepr.ClassUsage)u).className, cr.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cleanupRemovedClass(cr.name, cr, clusters);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1708,9 +1743,7 @@ public class Mappings {
|
||||
delta.getDeletedClasses().forEach(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int value) {
|
||||
myClassToClassDependency.remove(value);
|
||||
myClassToSubclasses.remove(value);
|
||||
myClassToSourceFile.remove(value);
|
||||
cleanupRemovedClass(value, null, null);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
+57
-57
@@ -18,10 +18,7 @@ package com.intellij.android.designer.model;
|
||||
import com.android.ide.common.rendering.api.ViewInfo;
|
||||
import com.android.resources.ResourceType;
|
||||
import com.android.sdklib.IAndroidTarget;
|
||||
import com.intellij.android.designer.propertyTable.AttributeProperty;
|
||||
import com.intellij.android.designer.propertyTable.AttributePropertyWithDefault;
|
||||
import com.intellij.android.designer.propertyTable.CompoundProperty;
|
||||
import com.intellij.android.designer.propertyTable.FlagProperty;
|
||||
import com.intellij.android.designer.propertyTable.*;
|
||||
import com.intellij.android.designer.propertyTable.editors.ResourceDialog;
|
||||
import com.intellij.designer.model.MetaManager;
|
||||
import com.intellij.designer.model.MetaModel;
|
||||
@@ -138,7 +135,7 @@ public class PropertyParser {
|
||||
|
||||
StyleableDefinition definitions = myDefinitions.getStyleableByName(component);
|
||||
if (definitions != null) {
|
||||
Property padding = null;
|
||||
boolean padding = false;
|
||||
|
||||
for (AttributeDefinition definition : definitions.getAttributes()) {
|
||||
String name = definition.getName();
|
||||
@@ -146,10 +143,10 @@ public class PropertyParser {
|
||||
Property property;
|
||||
|
||||
if ("padding".equals(name) && "View".equals(component)) {
|
||||
property = padding = new CompoundProperty(name, definition);
|
||||
padding = true;
|
||||
}
|
||||
else if (formats.contains(AttributeFormat.Flag)) {
|
||||
property = new FlagProperty(name, definition, model);
|
||||
if (formats.contains(AttributeFormat.Flag)) {
|
||||
property = new FlagProperty(name, definition);
|
||||
}
|
||||
else {
|
||||
property = new AttributeProperty(name, definition);
|
||||
@@ -158,19 +155,21 @@ public class PropertyParser {
|
||||
if (model != null) {
|
||||
model.decorate(property, name);
|
||||
}
|
||||
|
||||
properties.add(property);
|
||||
}
|
||||
|
||||
if (padding != null) {
|
||||
List<Property> children = padding.getChildren(null);
|
||||
|
||||
children.add(PropertyTable.extractProperty(properties, "paddingLeft"));
|
||||
children.add(PropertyTable.extractProperty(properties, "paddingTop"));
|
||||
children.add(PropertyTable.extractProperty(properties, "paddingRight"));
|
||||
children.add(PropertyTable.extractProperty(properties, "paddingBottom"));
|
||||
children.add(PropertyTable.extractProperty(properties, "paddingStart"));
|
||||
children.add(PropertyTable.extractProperty(properties, "paddingEnd"));
|
||||
if (padding) {
|
||||
CompoundDimensionProperty paddingProperty = new CompoundDimensionProperty("padding");
|
||||
moveProperties(properties, paddingProperty,
|
||||
"padding", "all",
|
||||
"paddingLeft", "left",
|
||||
"paddingTop", "top",
|
||||
"paddingRight", "right",
|
||||
"paddingBottom", "bottom",
|
||||
"paddingStart", "start",
|
||||
"paddingEnd", "end");
|
||||
paddingProperty.decorate(model);
|
||||
properties.add(paddingProperty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,25 +187,7 @@ public class PropertyParser {
|
||||
properties.add(superProperty);
|
||||
}
|
||||
else {
|
||||
String name = superProperty.getName();
|
||||
boolean normal = model.isNormalProperty(name);
|
||||
boolean important = model.isImportantProperty(name);
|
||||
boolean expert = model.isExpertProperty(name);
|
||||
boolean deprecated = model.isDeprecatedProperty(name);
|
||||
|
||||
if ((normal && (superProperty.isImportant() || superProperty.isExpert())) ||
|
||||
(important && !superProperty.isImportant()) ||
|
||||
(expert && !superProperty.isExpert()) ||
|
||||
(deprecated && !superProperty.isDeprecated())) {
|
||||
Property property = superProperty.createForNewPresentation();
|
||||
property.setImportant(important);
|
||||
property.setExpert(expert);
|
||||
property.setDeprecated(deprecated);
|
||||
properties.add(property);
|
||||
}
|
||||
else {
|
||||
properties.add(superProperty);
|
||||
}
|
||||
properties.add(model.decorateWithOverride(superProperty));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,7 +217,7 @@ public class PropertyParser {
|
||||
|
||||
StyleableDefinition definitions = myDefinitions.getStyleableByName(component);
|
||||
if (definitions != null) {
|
||||
Property margin = null;
|
||||
boolean margin = false;
|
||||
|
||||
for (AttributeDefinition definition : definitions.getAttributes()) {
|
||||
String name = definition.getName();
|
||||
@@ -244,7 +225,7 @@ public class PropertyParser {
|
||||
Set<AttributeFormat> formats = definition.getFormats();
|
||||
Property property;
|
||||
|
||||
if (name.startsWith(LAYOUT_MARGIN_PREFIX) && name.length() > LAYOUT_MARGIN_PREFIX.length()) {
|
||||
if (name.startsWith(LAYOUT_MARGIN_PREFIX)) {
|
||||
name = name.substring(LAYOUT_PREFIX.length());
|
||||
important = false;
|
||||
}
|
||||
@@ -252,45 +233,54 @@ public class PropertyParser {
|
||||
name = "layout:" + name.substring(LAYOUT_PREFIX.length());
|
||||
}
|
||||
|
||||
if ("layout:margin".equals(name) && "ViewGroup_MarginLayout".equals(component)) {
|
||||
property = margin = new CompoundProperty(name, definition);
|
||||
if ("margin".equals(name) && "ViewGroup_MarginLayout".equals(component)) {
|
||||
margin = true;
|
||||
}
|
||||
else if ("layout:width".equals(name) || "layout:height".equals(name)) {
|
||||
if ("layout:width".equals(name) || "layout:height".equals(name)) {
|
||||
property = new AttributePropertyWithDefault(name, definition, "wrap_content");
|
||||
}
|
||||
else if (formats.contains(AttributeFormat.Flag)) {
|
||||
property = new FlagProperty(name, definition, model);
|
||||
property = new FlagProperty(name, definition);
|
||||
}
|
||||
else {
|
||||
property = new AttributeProperty(name, definition);
|
||||
}
|
||||
|
||||
if (model != null) {
|
||||
model.decorate(property, name);
|
||||
}
|
||||
property.setImportant(important);
|
||||
properties.add(property);
|
||||
}
|
||||
|
||||
if (margin != null) {
|
||||
List<Property> children = margin.getChildren(null);
|
||||
|
||||
PropertyTable.moveProperty(properties, "marginLeft", children, -1);
|
||||
PropertyTable.moveProperty(properties, "marginTop", children, -1);
|
||||
PropertyTable.moveProperty(properties, "marginRight", children, -1);
|
||||
PropertyTable.moveProperty(properties, "marginBottom", children, -1);
|
||||
PropertyTable.moveProperty(properties, "marginStart", children, -1);
|
||||
PropertyTable.moveProperty(properties, "marginEnd", children, -1);
|
||||
|
||||
if (margin) {
|
||||
CompoundDimensionProperty marginProperty = new CompoundDimensionProperty("layout:margin");
|
||||
moveProperties(properties, marginProperty,
|
||||
"margin", "all",
|
||||
"marginLeft", "left",
|
||||
"marginTop", "top",
|
||||
"marginRight", "right",
|
||||
"marginBottom", "bottom",
|
||||
"marginStart", "start",
|
||||
"marginEnd", "end");
|
||||
if (model != null) {
|
||||
for (Property child : children) {
|
||||
model.decorate(child, "layout:margin." + child.getName());
|
||||
}
|
||||
marginProperty.decorate(model);
|
||||
}
|
||||
marginProperty.setImportant(true);
|
||||
properties.add(marginProperty);
|
||||
}
|
||||
}
|
||||
|
||||
if (++index < components.length) {
|
||||
for (Property property : loadLayoutProperties(components, index, model)) {
|
||||
if (PropertyTable.findProperty(properties, property) == -1) {
|
||||
properties.add(property);
|
||||
if (model == null) {
|
||||
properties.add(property);
|
||||
}
|
||||
else {
|
||||
property = model.decorateWithOverride(property);
|
||||
properties.add(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,6 +303,16 @@ public class PropertyParser {
|
||||
return properties;
|
||||
}
|
||||
|
||||
private static void moveProperties(List<Property> source, Property destination, String... names) {
|
||||
List<Property> children = destination.getChildren(null);
|
||||
for (int i = 0; i < names.length; i += 2) {
|
||||
Property property = PropertyTable.extractProperty(source, names[i]);
|
||||
if (property != null) {
|
||||
children.add(property.createForNewPresentation(destination, names[i + 1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAssignableFrom(MetaModel base, MetaModel test) {
|
||||
try {
|
||||
Class<?> baseClass = myClassLoader.loadClass(base.getTarget());
|
||||
|
||||
+2
-2
@@ -1012,8 +1012,8 @@
|
||||
<palette title="FrameLayout" icon="/com/intellij/android/designer/icons/FrameLayout.png"
|
||||
tooltip="FrameLayout is designed to block out an area on the screen to display a single item."/>
|
||||
|
||||
<properties important="foreground foregroundGravity"
|
||||
expert="layout:gravity.fill layout:gravity.fill_horizontal layout:gravity.fill_vertical layout:gravity.clip_vertical layout:gravity.clip_horizontal layout:margin.marginStart layout:margin.marginEnd"
|
||||
<properties important="foreground foregroundGravity layout:margin"
|
||||
expert="layout:gravity.fill layout:gravity.fill_horizontal layout:gravity.fill_vertical layout:gravity.clip_vertical layout:gravity.clip_horizontal layout:margin.start layout:margin.end"
|
||||
/>
|
||||
|
||||
<creation>
|
||||
|
||||
+7
-3
@@ -45,7 +45,11 @@ public class AttributeProperty extends Property<RadViewComponent> {
|
||||
private final PropertyEditor myEditor;
|
||||
|
||||
public AttributeProperty(@NotNull String name, @NotNull AttributeDefinition definition) {
|
||||
super(null, name);
|
||||
this(null, name, definition);
|
||||
}
|
||||
|
||||
public AttributeProperty(@Nullable Property parent, @NotNull String name, @NotNull AttributeDefinition definition) {
|
||||
super(parent, name);
|
||||
myDefinition = definition;
|
||||
|
||||
Set<AttributeFormat> formats = definition.getFormats();
|
||||
@@ -76,8 +80,8 @@ public class AttributeProperty extends Property<RadViewComponent> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property createForNewPresentation() {
|
||||
return new AttributeProperty(getName(), myDefinition);
|
||||
public Property<RadViewComponent> createForNewPresentation(@Nullable Property parent, @NotNull String name) {
|
||||
return new AttributeProperty(parent, name, myDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+15
-1
@@ -16,9 +16,11 @@
|
||||
package com.intellij.android.designer.propertyTable;
|
||||
|
||||
import com.intellij.android.designer.model.RadViewComponent;
|
||||
import com.intellij.designer.propertyTable.Property;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.android.dom.attrs.AttributeDefinition;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
@@ -27,10 +29,22 @@ public class AttributePropertyWithDefault extends AttributeProperty {
|
||||
private final String myDefaultValue;
|
||||
|
||||
public AttributePropertyWithDefault(@NotNull String name, @NotNull AttributeDefinition definition, @NotNull String defaultValue) {
|
||||
super(name, definition);
|
||||
this(null, name, definition, defaultValue);
|
||||
}
|
||||
|
||||
public AttributePropertyWithDefault(@Nullable Property parent,
|
||||
@NotNull String name,
|
||||
@NotNull AttributeDefinition definition,
|
||||
@NotNull String defaultValue) {
|
||||
super(parent, name, definition);
|
||||
myDefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property<RadViewComponent> createForNewPresentation(@Nullable Property parent, @NotNull String name) {
|
||||
return new AttributePropertyWithDefault(parent, name, myDefinition, myDefaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultValue(RadViewComponent component) throws Exception {
|
||||
return myDefaultValue.equals(getValue(component));
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.android.designer.propertyTable;
|
||||
|
||||
import com.intellij.android.designer.propertyTable.renderers.ResourceRenderer;
|
||||
import com.intellij.designer.propertyTable.PropertyRenderer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import org.jetbrains.android.dom.attrs.AttributeFormat;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class CompoundDimensionProperty extends CompoundProperty {
|
||||
private ResourceRenderer myRenderer = new ResourceRenderer(EnumSet.of(AttributeFormat.Dimension)) {
|
||||
@Override
|
||||
protected void formatValue(String value) {
|
||||
myColoredComponent.append("[");
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
int index = 0;
|
||||
for (String childValue : StringUtil.split(value, ",")) {
|
||||
if (index++ > 0) {
|
||||
myColoredComponent.append(", ");
|
||||
}
|
||||
childValue = childValue.trim();
|
||||
if (childValue.length() > 0) {
|
||||
if (childValue.equals("?")) {
|
||||
myColoredComponent.append("?", SimpleTextAttributes.EXCLUDED_ATTRIBUTES);
|
||||
}
|
||||
else {
|
||||
super.formatValue(childValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
myColoredComponent.append("]");
|
||||
}
|
||||
};
|
||||
|
||||
public CompoundDimensionProperty(@NotNull String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompoundProperty createForNewPresentation(@NotNull String name) {
|
||||
return new CompoundDimensionProperty(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PropertyRenderer getRenderer() {
|
||||
return myRenderer;
|
||||
}
|
||||
}
|
||||
+74
-15
@@ -16,8 +16,11 @@
|
||||
package com.intellij.android.designer.propertyTable;
|
||||
|
||||
import com.intellij.android.designer.model.RadViewComponent;
|
||||
import com.intellij.designer.model.MetaModel;
|
||||
import com.intellij.designer.propertyTable.IPropertyDecorator;
|
||||
import com.intellij.designer.propertyTable.Property;
|
||||
import org.jetbrains.android.dom.attrs.AttributeDefinition;
|
||||
import com.intellij.designer.propertyTable.PropertyEditor;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -27,25 +30,81 @@ import java.util.List;
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class CompoundProperty extends AttributeProperty {
|
||||
private List<Property> myChildren = new ArrayList<Property>();
|
||||
public abstract class CompoundProperty extends Property<RadViewComponent> implements IPropertyDecorator {
|
||||
private List<Property<RadViewComponent>> myChildren = new ArrayList<Property<RadViewComponent>>();
|
||||
|
||||
public CompoundProperty(@NotNull String name, @NotNull AttributeDefinition definition) {
|
||||
super(name, definition);
|
||||
public CompoundProperty(@NotNull String name) {
|
||||
super(null, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Property> getChildren(@Nullable RadViewComponent component) {
|
||||
return myChildren;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property createForNewPresentation() {
|
||||
CompoundProperty property = new CompoundProperty(getName(), myDefinition);
|
||||
List<Property> children = property.getChildren(null);
|
||||
for (Property childProperty : myChildren) {
|
||||
children.add(childProperty.createForNewPresentation());
|
||||
public Property<RadViewComponent> createForNewPresentation(@Nullable Property parent, @NotNull String name) {
|
||||
CompoundProperty property = createForNewPresentation(name);
|
||||
List<Property<RadViewComponent>> children = property.getChildren(null);
|
||||
for (Property<RadViewComponent> childProperty : myChildren) {
|
||||
children.add(childProperty.createForNewPresentation(property, childProperty.getName()));
|
||||
}
|
||||
return property;
|
||||
}
|
||||
|
||||
public void decorate(@NotNull MetaModel model) {
|
||||
String name = getName();
|
||||
model.decorate0(this, name);
|
||||
for (Property<RadViewComponent> childProperty : myChildren) {
|
||||
model.decorate(childProperty, name + "." + childProperty.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Property<RadViewComponent>> getChildren(@Nullable RadViewComponent component) {
|
||||
return myChildren;
|
||||
}
|
||||
|
||||
protected abstract CompoundProperty createForNewPresentation(@NotNull String name);
|
||||
|
||||
@Override
|
||||
public Object getValue(RadViewComponent component) throws Exception {
|
||||
StringBuilder value = new StringBuilder();
|
||||
int index = 0;
|
||||
int empty = 0;
|
||||
for (Property<RadViewComponent> childProperty : myChildren) {
|
||||
if (index++ > 0) {
|
||||
value.append(", ");
|
||||
}
|
||||
String childValue = (String)childProperty.getValue(component);
|
||||
if (StringUtil.isEmpty(childValue)) {
|
||||
empty++;
|
||||
value.append("?");
|
||||
}
|
||||
else {
|
||||
value.append(childValue);
|
||||
}
|
||||
}
|
||||
if (empty == myChildren.size()) {
|
||||
return "";
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultValue(RadViewComponent component) throws Exception {
|
||||
for (Property<RadViewComponent> childProperty : myChildren) {
|
||||
if (!childProperty.isDefaultValue(component)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultValue(RadViewComponent component) throws Exception {
|
||||
for (Property<RadViewComponent> childProperty : myChildren) {
|
||||
childProperty.setDefaultValue(component);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyEditor getEditor() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+24
-15
@@ -17,6 +17,7 @@ package com.intellij.android.designer.propertyTable;
|
||||
|
||||
import com.intellij.android.designer.model.RadViewComponent;
|
||||
import com.intellij.designer.model.MetaModel;
|
||||
import com.intellij.designer.propertyTable.IPropertyDecorator;
|
||||
import com.intellij.designer.propertyTable.Property;
|
||||
import com.intellij.designer.propertyTable.PropertyEditor;
|
||||
import com.intellij.designer.propertyTable.PropertyRenderer;
|
||||
@@ -35,39 +36,41 @@ import java.util.*;
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class FlagProperty extends Property<RadViewComponent> {
|
||||
public class FlagProperty extends Property<RadViewComponent> implements IPropertyDecorator {
|
||||
private final PropertyRenderer myRenderer = new LabelPropertyRenderer(null);
|
||||
private final AttributeDefinition myDefinition;
|
||||
private final List<Property> myOptions = new ArrayList<Property>();
|
||||
private final List<Property<RadViewComponent>> myOptions = new ArrayList<Property<RadViewComponent>>();
|
||||
|
||||
public FlagProperty(@NotNull String name, @NotNull AttributeDefinition definition, @Nullable MetaModel model) {
|
||||
public FlagProperty(@NotNull String name, @NotNull AttributeDefinition definition) {
|
||||
super(null, name);
|
||||
myDefinition = definition;
|
||||
|
||||
for (String option : definition.getValues()) {
|
||||
myOptions.add(new OptionProperty(this, option, option));
|
||||
}
|
||||
}
|
||||
|
||||
if (model != null) {
|
||||
for (Property option : myOptions) {
|
||||
model.decorate(option, name + "." + option.getName());
|
||||
}
|
||||
@Override
|
||||
public Property<RadViewComponent> createForNewPresentation(@Nullable Property parent, @NotNull String name) {
|
||||
return new FlagProperty(name, myDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorate(@NotNull MetaModel model) {
|
||||
String name = getName();
|
||||
for (Property option : myOptions) {
|
||||
model.decorate(option, name + "." + option.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property createForNewPresentation() {
|
||||
return new FlagProperty(getName(), myDefinition, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Property> getChildren(@Nullable RadViewComponent component) {
|
||||
public List<Property<RadViewComponent>> getChildren(@Nullable RadViewComponent component) {
|
||||
return myOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(RadViewComponent component) throws Exception {
|
||||
StringBuffer value = new StringBuffer("[");
|
||||
StringBuilder value = new StringBuilder("[");
|
||||
Set<String> options = getOptions(component);
|
||||
int index = 0;
|
||||
for (Property option : myOptions) {
|
||||
@@ -158,6 +161,12 @@ public class FlagProperty extends Property<RadViewComponent> {
|
||||
});
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Option
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private class OptionProperty extends Property<RadViewComponent> {
|
||||
private PropertyRenderer myRenderer = new BooleanRenderer();
|
||||
private PropertyEditor myEditor = new BooleanEditor();
|
||||
@@ -173,7 +182,7 @@ public class FlagProperty extends Property<RadViewComponent> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property createForNewPresentation() {
|
||||
public Property<RadViewComponent> createForNewPresentation(@Nullable Property parent, @NotNull String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+7
-3
@@ -41,7 +41,7 @@ public class ResourceRenderer implements PropertyRenderer {
|
||||
|
||||
private final ColorIcon myColorIcon = new ColorIcon(10, 9);
|
||||
private BooleanRenderer myBooleanRenderer;
|
||||
private final SimpleColoredComponent myColoredComponent;
|
||||
protected final SimpleColoredComponent myColoredComponent;
|
||||
private final Set<AttributeFormat> myFormats;
|
||||
|
||||
public ResourceRenderer(Set<AttributeFormat> formats) {
|
||||
@@ -75,6 +75,12 @@ public class ResourceRenderer implements PropertyRenderer {
|
||||
myColoredComponent.setBackground(UIUtil.getTableBackground());
|
||||
}
|
||||
|
||||
formatValue(value);
|
||||
|
||||
return myColoredComponent;
|
||||
}
|
||||
|
||||
protected void formatValue(String value) {
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
int prefix = -1;
|
||||
if (value.startsWith("#")) {
|
||||
@@ -113,8 +119,6 @@ public class ResourceRenderer implements PropertyRenderer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return myColoredComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-1
@@ -21,6 +21,7 @@ import com.intellij.ide.wizard.CommitStepException;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -53,7 +54,8 @@ public class ExportSignedPackageWizard extends AbstractWizard<ExportSignedPackag
|
||||
myProject = project;
|
||||
mySigned = signed;
|
||||
assert facets.size() > 0;
|
||||
if (facets.size() > 1) {
|
||||
if (facets.size() > 1 ||
|
||||
SystemInfo.isMac /* wizards with only step are shown incorrectly on mac */) {
|
||||
addStep(new ChooseModuleStep(this, facets));
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -184,7 +184,7 @@ public class AndroidAddStringResourceAction extends AbstractIntentionAction impl
|
||||
final AndroidFacet facet = AndroidFacet.getInstance(file);
|
||||
assert facet != null;
|
||||
|
||||
value = value.replace("'", "\\'").replace("\"", "\\\"");
|
||||
value = AndroidResourceUtil.normalizeXmlResourceValue(value);
|
||||
|
||||
final String aPackage = getPackage(facet);
|
||||
if (aPackage == null) {
|
||||
|
||||
@@ -67,6 +67,7 @@ import org.jetbrains.android.sdk.AndroidPlatform;
|
||||
import org.jetbrains.android.sdk.AndroidSdkUtils;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
import org.jetbrains.android.util.AndroidCommonUtils;
|
||||
import org.jetbrains.android.util.AndroidResourceUtil;
|
||||
import org.jetbrains.android.util.AndroidUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -418,11 +419,13 @@ public class AndroidModuleBuilder extends JavaModuleBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
final String normalizedAppName = AndroidResourceUtil.normalizeXmlResourceValue(myApplicationName);
|
||||
|
||||
if (appNameResElement == null) {
|
||||
manager.addValueResource("string", appNameResource, myApplicationName);
|
||||
manager.addValueResource("string", appNameResource, normalizedAppName);
|
||||
}
|
||||
else {
|
||||
appNameResElement.setStringValue(myApplicationName);
|
||||
appNameResElement.setStringValue(normalizedAppName);
|
||||
}
|
||||
|
||||
final Manifest manifest = facet.getManifest();
|
||||
|
||||
@@ -60,6 +60,11 @@ public class AndroidResourceUtil {
|
||||
private AndroidResourceUtil() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String normalizeXmlResourceValue(@NotNull String value) {
|
||||
return value.replace("'", "\\'").replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
static {
|
||||
REFERRABLE_RESOURCE_TYPES.addAll(Arrays.asList(ResourceType.values()));
|
||||
REFERRABLE_RESOURCE_TYPES.remove(ResourceType.ATTR);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -26,6 +26,8 @@ import java.util.*;
|
||||
|
||||
public class CvsElement extends DefaultMutableTreeNode implements Comparable<CvsElement>{
|
||||
|
||||
public static final CvsElement[] EMPTY_ARRAY = {};
|
||||
|
||||
protected RemoteResourceDataProvider myDataProvider;
|
||||
protected String myPath;
|
||||
protected final String myName;
|
||||
@@ -70,18 +72,22 @@ public class CvsElement extends DefaultMutableTreeNode implements Comparable<Cvs
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreeNode getChildAt(int childIndex) {
|
||||
return (TreeNode)getMyChildren().get(childIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildCount() {
|
||||
return getMyChildren().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex(TreeNode node) {
|
||||
return getMyChildren().indexOf(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAllowsChildren() {
|
||||
if (children != null) {
|
||||
return getChildCount() > 0;
|
||||
@@ -91,6 +97,7 @@ public class CvsElement extends DefaultMutableTreeNode implements Comparable<Cvs
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration children() {
|
||||
return getMyChildren().elements();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -45,7 +45,7 @@ import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListener, ChildrenLoader<CvsElement> {
|
||||
private CvsElement[] myCurrentSelection = new CvsElement[0];
|
||||
private CvsElement[] myCurrentSelection = CvsElement.EMPTY_ARRAY;
|
||||
private Tree myTree;
|
||||
private DefaultTreeModel myModel;
|
||||
private CvsRootConfiguration myCvsRootConfiguration = null;
|
||||
@@ -60,8 +60,8 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
|
||||
@NonNls public static final String SELECTION_CHANGED = "Selection Changed";
|
||||
|
||||
public CvsTree(Project project, boolean allowRootSelection, @JdkConstants.TreeSelectionMode int selectionMode, boolean showModules, boolean showFiles,
|
||||
Consumer<VcsException> errorCallback) {
|
||||
public CvsTree(Project project, boolean allowRootSelection, @JdkConstants.TreeSelectionMode int selectionMode,
|
||||
boolean showModules, boolean showFiles, Consumer<VcsException> errorCallback) {
|
||||
super(new BorderLayout());
|
||||
myProject = project;
|
||||
mySelectionMode = selectionMode;
|
||||
@@ -75,6 +75,7 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
|
||||
private void addSelectionListener() {
|
||||
myTree.addTreeSelectionListener(new TreeSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
setCurrentSelection(myTree.getSelectionPaths());
|
||||
}
|
||||
@@ -91,12 +92,12 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
}
|
||||
|
||||
private void setCurrentSelection(TreePath[] paths) {
|
||||
ArrayList<CvsElement> selection = new ArrayList<CvsElement>();
|
||||
final ArrayList<CvsElement> selection = new ArrayList<CvsElement>();
|
||||
if (paths != null) {
|
||||
for (TreePath path : paths) {
|
||||
Object selectedObject = path.getLastPathComponent();
|
||||
final Object selectedObject = path.getLastPathComponent();
|
||||
if (!(selectedObject instanceof CvsElement)) continue;
|
||||
CvsElement cvsElement = (CvsElement)selectedObject;
|
||||
final CvsElement cvsElement = (CvsElement)selectedObject;
|
||||
if (cvsElement.getElementPath().equals(".") && !myAllowRootSelection) continue;
|
||||
selection.add(cvsElement);
|
||||
}
|
||||
@@ -109,8 +110,8 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
if (myCvsRootConfiguration == null) {
|
||||
return new DefaultMutableTreeNode();
|
||||
}
|
||||
String rootName = myCvsRootConfiguration.toString();
|
||||
CvsElement result = CvsElementFactory.FOLDER_ELEMENT_FACTORY.createElement(rootName, myCvsRootConfiguration, project);
|
||||
final String rootName = myCvsRootConfiguration.toString();
|
||||
final CvsElement result = CvsElementFactory.FOLDER_ELEMENT_FACTORY.createElement(rootName, myCvsRootConfiguration, project);
|
||||
result.setDataProvider(new RootDataProvider(myCvsRootConfiguration));
|
||||
result.setPath(".");
|
||||
result.cannotBeCheckedOut();
|
||||
@@ -135,7 +136,7 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
}
|
||||
|
||||
public void init() {
|
||||
TreeNode root = createRoot(myProject);
|
||||
final TreeNode root = createRoot(myProject);
|
||||
myModel = new DefaultTreeModel(root, true);
|
||||
myTree = new Tree(myModel);
|
||||
add(ScrollPaneFactory.createScrollPane(myTree), BorderLayout.CENTER);
|
||||
@@ -144,7 +145,7 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
myTree.setCellRenderer(new Cvs2Renderer());
|
||||
addSelectionListener();
|
||||
|
||||
TreeUIHelper uiHelper = TreeUIHelper.getInstance();
|
||||
final TreeUIHelper uiHelper = TreeUIHelper.getInstance();
|
||||
uiHelper.installTreeSpeedSearch(myTree);
|
||||
TreeUtil.installActions(myTree);
|
||||
|
||||
@@ -152,6 +153,7 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
}
|
||||
|
||||
private static class AlwaysNotifiedObservable extends Observable{
|
||||
@Override
|
||||
public void notifyObservers(Object arg) {
|
||||
setChanged();
|
||||
super.notifyObservers(arg);
|
||||
@@ -174,6 +176,7 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivated() {
|
||||
mySelectionObservable.deleteObservers();
|
||||
synchronized (myListeners) {
|
||||
@@ -191,6 +194,7 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
final ModalityState modalityState = application.getCurrentModalityState();
|
||||
application.executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final RemoteResourceDataProvider dataProvider = element.getDataProvider();
|
||||
dataProvider.fillContentFor(new MyGetContentCallback(element, modalityState, myProject), myErrorCallback);
|
||||
@@ -240,18 +244,22 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
return myModalityState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivated() {
|
||||
if (myListener != null) {
|
||||
myListener.indirectCancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useForCancel(final CvsListenerWithProgress listener) {
|
||||
myListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendDirectoryContent(final DirectoryContent directoryContent) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final TreePath selectionPath = myTree.getSelectionPath();
|
||||
if (selectionPath != null) {
|
||||
@@ -286,9 +294,11 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finished() {
|
||||
removeListener(this);
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myLoadingNodeManager.removeFrom(myParentNode);
|
||||
myParentNode.setLoading(false);
|
||||
|
||||
+2
-11
@@ -21,18 +21,9 @@ package com.intellij.cvsSupport2.cvsExecution;
|
||||
*/
|
||||
public interface CvsOperationExecutorCallback {
|
||||
|
||||
CvsOperationExecutorCallback EMPTY = new CvsOperationExecutorCallback(){
|
||||
public void executionFinished(boolean successfully) {
|
||||
}
|
||||
|
||||
public void executionFinishedSuccessfully() {
|
||||
}
|
||||
|
||||
public void executeInProgressAfterAction(ModalityContext modaityContext) {
|
||||
}
|
||||
};
|
||||
CvsOperationExecutorCallback EMPTY = new DefaultCvsOperationExecutorCallback();
|
||||
|
||||
void executionFinished(boolean successfully);
|
||||
void executionFinishedSuccessfully();
|
||||
void executeInProgressAfterAction(ModalityContext modaityContext);
|
||||
void executeInProgressAfterAction(ModalityContext modalityContext);
|
||||
}
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.cvsSupport2.cvsExecution;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class DefaultCvsOperationExecutorCallback implements CvsOperationExecutorCallback {
|
||||
|
||||
public void executionFinished(boolean successfully) {
|
||||
}
|
||||
|
||||
public void executionFinishedSuccessfully() {
|
||||
}
|
||||
|
||||
public void executeInProgressAfterAction(ModalityContext modaityContext) {
|
||||
}
|
||||
}
|
||||
+67
-43
@@ -297,38 +297,6 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
add(myErrorPanel, ERROR_CARD);
|
||||
}
|
||||
|
||||
private void createProgressPanel() {
|
||||
myProgressIcon = new AsyncProcessIcon("Designer progress");
|
||||
myProgressMessage = new JLabel();
|
||||
|
||||
JPanel progressBlock = new JPanel();
|
||||
progressBlock.add(myProgressIcon);
|
||||
progressBlock.add(myProgressMessage);
|
||||
progressBlock.setBorder(IdeBorderFactory.createRoundedBorder());
|
||||
|
||||
myProgressPanel = new JPanel(new GridBagLayout());
|
||||
myProgressPanel.add(progressBlock,
|
||||
new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0),
|
||||
0, 0));
|
||||
myProgressPanel.setOpaque(false);
|
||||
}
|
||||
|
||||
protected final void showProgress(String message) {
|
||||
myProgressMessage.setText(message);
|
||||
if (myProgressPanel.getParent() == null) {
|
||||
myGlassLayer.setEnabled(false);
|
||||
myProgressIcon.resume();
|
||||
myLayeredPane.add(myProgressPanel, LAYER_PROGRESS);
|
||||
myLayeredPane.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
protected final void hideProgress() {
|
||||
myGlassLayer.setEnabled(true);
|
||||
myProgressIcon.suspend();
|
||||
myLayeredPane.remove(myProgressPanel);
|
||||
}
|
||||
|
||||
public final void showError(@NonNls String message, Throwable e) {
|
||||
while (e instanceof InvocationTargetException) {
|
||||
e = e.getCause();
|
||||
@@ -375,7 +343,43 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
repaint();
|
||||
}
|
||||
|
||||
public abstract String getPlatformTarget();
|
||||
private void createProgressPanel() {
|
||||
myProgressIcon = new AsyncProcessIcon("Designer progress");
|
||||
myProgressMessage = new JLabel();
|
||||
|
||||
JPanel progressBlock = new JPanel();
|
||||
progressBlock.add(myProgressIcon);
|
||||
progressBlock.add(myProgressMessage);
|
||||
progressBlock.setBorder(IdeBorderFactory.createRoundedBorder());
|
||||
|
||||
myProgressPanel = new JPanel(new GridBagLayout());
|
||||
myProgressPanel.add(progressBlock,
|
||||
new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0),
|
||||
0, 0));
|
||||
myProgressPanel.setOpaque(false);
|
||||
}
|
||||
|
||||
protected final void showProgress(String message) {
|
||||
myProgressMessage.setText(message);
|
||||
if (myProgressPanel.getParent() == null) {
|
||||
myGlassLayer.setEnabled(false);
|
||||
myProgressIcon.resume();
|
||||
myLayeredPane.add(myProgressPanel, LAYER_PROGRESS);
|
||||
myLayeredPane.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
protected final void hideProgress() {
|
||||
myGlassLayer.setEnabled(true);
|
||||
myProgressIcon.suspend();
|
||||
myLayeredPane.remove(myProgressPanel);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@NotNull
|
||||
public Module getModule() {
|
||||
@@ -395,9 +399,24 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
return treeArea == null ? mySurfaceArea : treeArea;
|
||||
}
|
||||
|
||||
public void updateTreeArea(EditableArea area) {
|
||||
public ToolProvider getToolProvider() {
|
||||
return myToolProvider;
|
||||
}
|
||||
|
||||
public DesignerActionPanel getActionPanel() {
|
||||
return myActionPanel;
|
||||
}
|
||||
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myDesignerCard.isVisible() ? myGlassLayer : myErrorPanel;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// State
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Nullable
|
||||
public List<?> getExpandedComponents() {
|
||||
return myExpandedComponents;
|
||||
@@ -485,12 +504,15 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
}
|
||||
}
|
||||
|
||||
public ToolProvider getToolProvider() {
|
||||
return myToolProvider;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public DesignerActionPanel getActionPanel() {
|
||||
return myActionPanel;
|
||||
public abstract String getPlatformTarget();
|
||||
|
||||
public void updateTreeArea(EditableArea area) {
|
||||
}
|
||||
|
||||
protected abstract ComponentDecorator getRootSelectionDecorator();
|
||||
@@ -534,10 +556,6 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
Disposer.dispose(myProgressIcon);
|
||||
}
|
||||
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myDesignerCard.isVisible() ? myGlassLayer : myErrorPanel;
|
||||
}
|
||||
|
||||
public RadComponent getRootComponent() {
|
||||
return myRootComponent;
|
||||
}
|
||||
@@ -548,6 +566,12 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
|
||||
public abstract TreeComponentDecorator getTreeDecorator();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static final class FillLayout implements LayoutManager2 {
|
||||
@Override
|
||||
public void addLayoutComponent(Component comp, Object constraints) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.designer.model;
|
||||
|
||||
import com.intellij.designer.palette.Item;
|
||||
import com.intellij.designer.propertyTable.IPropertyDecorator;
|
||||
import com.intellij.designer.propertyTable.Property;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -114,10 +115,6 @@ public class MetaModel {
|
||||
myPaletteItem.setMetaModel(this);
|
||||
}
|
||||
|
||||
public boolean isNormalProperty(String name) {
|
||||
return myNormalProperties.contains(name);
|
||||
}
|
||||
|
||||
public void setNormalProperties(List<String> normalProperties) {
|
||||
myNormalProperties = normalProperties;
|
||||
}
|
||||
@@ -146,9 +143,31 @@ public class MetaModel {
|
||||
myDeprecatedProperties = deprecatedProperties;
|
||||
}
|
||||
|
||||
public void decorate(Property property, String name) {
|
||||
public void decorate0(Property property, String name) {
|
||||
property.setImportant(isImportantProperty(name));
|
||||
property.setExpert(isExpertProperty(name));
|
||||
property.setDeprecated(isDeprecatedProperty(name));
|
||||
}
|
||||
|
||||
public void decorate(Property property, String name) {
|
||||
decorate0(property, name);
|
||||
|
||||
if (property instanceof IPropertyDecorator) {
|
||||
((IPropertyDecorator)property).decorate(this);
|
||||
}
|
||||
}
|
||||
|
||||
public Property decorateWithOverride(Property property) {
|
||||
String name = property.getName();
|
||||
|
||||
if (myNormalProperties.contains(name) ||
|
||||
myImportantProperties.contains(name) ||
|
||||
myExpertProperties.contains(name) ||
|
||||
myDeprecatedProperties.contains(name)) {
|
||||
property = property.createForNewPresentation();
|
||||
decorate(property, name);
|
||||
}
|
||||
|
||||
return property;
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.designer.propertyTable;
|
||||
|
||||
import com.intellij.designer.model.MetaModel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public interface IPropertyDecorator {
|
||||
void decorate(@NotNull MetaModel model);
|
||||
}
|
||||
+6
-2
@@ -37,7 +37,11 @@ public abstract class Property<T extends RadComponent> {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
public abstract Property createForNewPresentation();
|
||||
public Property<T> createForNewPresentation() {
|
||||
return createForNewPresentation(myParent, myName);
|
||||
}
|
||||
|
||||
public abstract Property<T> createForNewPresentation(@Nullable Property parent, @NotNull String name);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Hierarchy
|
||||
@@ -48,7 +52,7 @@ public abstract class Property<T extends RadComponent> {
|
||||
return myParent;
|
||||
}
|
||||
|
||||
public List<Property> getChildren(@Nullable T component) {
|
||||
public List<Property<T>> getChildren(@Nullable T component) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user