diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/ErrorInfo.java b/platform/platform-impl/src/com/intellij/designer/model/ErrorInfo.java similarity index 67% rename from plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/ErrorInfo.java rename to platform/platform-impl/src/com/intellij/designer/model/ErrorInfo.java index 9054a3f4d8fe..78db9a73bad7 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/ErrorInfo.java +++ b/platform/platform-impl/src/com/intellij/designer/model/ErrorInfo.java @@ -13,16 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.designer.inspection; +package com.intellij.designer.model; import com.intellij.codeHighlighting.HighlightDisplayLevel; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.model.RadComponentVisitor; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.Collections; import java.util.List; /** @@ -73,27 +70,4 @@ public final class ErrorInfo { } return false; } - - public static List get(RadComponent component) { - List errorInfos = component.getClientProperty(KEY); - return errorInfos == null ? Collections.emptyList() : errorInfos; - } - - public static void add(RadComponent component, ErrorInfo errorInfo) { - List errorInfos = component.getClientProperty(KEY); - if (errorInfos == null) { - errorInfos = new ArrayList(); - component.setClientProperty(KEY, errorInfos); - } - errorInfos.add(errorInfo); - } - - public static void clear(RadComponent component) { - component.accept(new RadComponentVisitor() { - @Override - public void endVisit(RadComponent component) { - component.extractClientProperty(KEY); - } - }, true); - } } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/designer/model/PropertiesContainer.java b/platform/platform-impl/src/com/intellij/designer/model/PropertiesContainer.java new file mode 100644 index 000000000000..c2474b917b11 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/designer/model/PropertiesContainer.java @@ -0,0 +1,22 @@ +/* + * 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.model; + +import java.util.List; + +public abstract class PropertiesContainer { + public abstract List getProperties(); +} diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/Property.java b/platform/platform-impl/src/com/intellij/designer/model/Property.java similarity index 92% rename from plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/Property.java rename to platform/platform-impl/src/com/intellij/designer/model/Property.java index 0ac83af9ca0d..5e8b7b96bc41 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/Property.java +++ b/platform/platform-impl/src/com/intellij/designer/model/Property.java @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.designer.propertyTable; +package com.intellij.designer.model; -import com.intellij.designer.model.RadComponent; +import com.intellij.designer.propertyTable.PropertyEditor; +import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,7 +27,7 @@ import java.util.List; /** * @author Alexander Lobas */ -public abstract class Property { +public abstract class Property { private final Property myParent; private final String myName; private boolean myImportant; @@ -89,7 +90,7 @@ public abstract class Property { public void setDefaultValue(T component) throws Exception { } - public boolean availableFor(List components) { + public boolean availableFor(List components) { return true; } diff --git a/platform/platform-impl/src/com/intellij/designer/model/PropertyContext.java b/platform/platform-impl/src/com/intellij/designer/model/PropertyContext.java new file mode 100644 index 000000000000..fbe9e35361e9 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/designer/model/PropertyContext.java @@ -0,0 +1,19 @@ +/* + * 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.model; + +public interface PropertyContext { +} diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/QuickFix.java b/platform/platform-impl/src/com/intellij/designer/model/QuickFix.java similarity index 95% rename from plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/QuickFix.java rename to platform/platform-impl/src/com/intellij/designer/model/QuickFix.java index f617d9d44886..4bcbe4419e02 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/QuickFix.java +++ b/platform/platform-impl/src/com/intellij/designer/model/QuickFix.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.designer.inspection; +package com.intellij.designer.model; import javax.swing.*; diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/InplaceContext.java b/platform/platform-impl/src/com/intellij/designer/propertyTable/InplaceContext.java similarity index 100% rename from plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/InplaceContext.java rename to platform/platform-impl/src/com/intellij/designer/propertyTable/InplaceContext.java diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyEditor.java b/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyEditor.java similarity index 89% rename from plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyEditor.java rename to platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyEditor.java index 3ef33c0d9909..47717be3ca1f 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyEditor.java +++ b/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyEditor.java @@ -15,7 +15,8 @@ */ package com.intellij.designer.propertyTable; -import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -29,8 +30,8 @@ public abstract class PropertyEditor { private final EventListenerList myListenerList = new EventListenerList(); @NotNull - public abstract JComponent getComponent(@NotNull RadComponent rootComponent, - @Nullable RadComponent component, + public abstract JComponent getComponent(@Nullable PropertiesContainer container, + @Nullable PropertyContext context, Object value, @Nullable InplaceContext inplaceContext); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyEditorListener.java b/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyEditorListener.java similarity index 100% rename from plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyEditorListener.java rename to platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyEditorListener.java diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyRenderer.java b/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyRenderer.java similarity index 74% rename from plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyRenderer.java rename to platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyRenderer.java index c5750c4dfc86..ac45c2311983 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyRenderer.java +++ b/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyRenderer.java @@ -15,7 +15,8 @@ */ package com.intellij.designer.propertyTable; -import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,7 +27,8 @@ import javax.swing.*; */ public interface PropertyRenderer { @NotNull - JComponent getComponent(@Nullable RadComponent component, @Nullable Object value, boolean selected, boolean hasFocus); + JComponent getComponent(@Nullable PropertiesContainer container, + PropertyContext context, @Nullable Object value, boolean selected, boolean hasFocus); void updateUI(); } \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java b/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyTable.java similarity index 84% rename from plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java rename to platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyTable.java index 767986b4ed9b..9ebb8d25fe30 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java +++ b/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyTable.java @@ -15,16 +15,11 @@ */ package com.intellij.designer.propertyTable; -import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; -import com.intellij.designer.DesignerBundle; -import com.intellij.designer.designSurface.ComponentSelectionListener; -import com.intellij.designer.designSurface.DesignerEditorPanel; -import com.intellij.designer.designSurface.EditableArea; -import com.intellij.designer.inspection.ErrorInfo; -import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.ErrorInfo; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.Property; +import com.intellij.designer.model.PropertyContext; import com.intellij.lang.annotation.HighlightSeverity; -import com.intellij.openapi.actionSystem.DataProvider; -import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.TextAttributesKey; @@ -40,13 +35,11 @@ import com.intellij.util.ThrowableRunnable; import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.IndentedIcon; import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.event.ChangeEvent; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; import javax.swing.plaf.TableUI; import javax.swing.table.AbstractTableModel; import javax.swing.table.JTableHeader; @@ -57,17 +50,18 @@ import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.text.MessageFormat; import java.util.*; import java.util.List; /** * @author Alexander Lobas */ -public final class PropertyTable extends JBTable implements DataProvider, ComponentSelectionListener { +public abstract class PropertyTable extends JBTable { private static final Logger LOG = Logger.getInstance("#com.intellij.designer.propertyTable.PropertyTable"); private final AbstractTableModel myModel = new PropertyTableModel(); - private List myComponents = Collections.emptyList(); + private List myContainers = Collections.emptyList(); private List myProperties = Collections.emptyList(); private final Set myExpandedProperties = new HashSet(); @@ -78,15 +72,8 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon private final TableCellRenderer myCellRenderer = new PropertyCellRenderer(); private boolean mySkipUpdate; - private EditableArea myArea; - private DesignerEditorPanel myDesigner; - private Property myInitialSelection; - private boolean myShowExpert; - private QuickFixManager myQuickFixManager; - - private PropertyTablePanel myPropertyTablePanel; public PropertyTable() { setModel(myModel); @@ -94,14 +81,6 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon showColumns(false); addMouseListener(new MouseTableListener()); - getSelectionModel().addListSelectionListener(new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent e) { - if (myDesigner != null) { - myDesigner.setSelectionProperty(getSelectionProperty()); - } - } - }); // TODO: Updates UI after LAF updated } @@ -112,14 +91,6 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon tableHeader.setPreferredSize(value ? null : new Dimension()); } - public void initQuickFixManager(JViewport viewPort) { - myQuickFixManager = new QuickFixManager(this, viewPort); - } - - public void setPropertyTablePanel(PropertyTablePanel propertyTablePanel) { - myPropertyTablePanel = propertyTablePanel; - } - public void setUI(TableUI ui) { super.setUI(ui); @@ -160,56 +131,13 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon return myCellRenderer; } - @Override - public Object getData(@NonNls String dataId) { - if (PlatformDataKeys.FILE_EDITOR.is(dataId) && myDesigner != null) { - return myDesigner.getEditor(); - } - return null; - } - - ////////////////////////////////////////////////////////////////////////////////////////// - // - // - // - ////////////////////////////////////////////////////////////////////////////////////////// - - public void setArea(@Nullable DesignerEditorPanel designer, @Nullable EditableArea area) { - myDesigner = designer; - myInitialSelection = designer == null ? null : designer.getSelectionProperty(); - myQuickFixManager.setDesigner(designer); - - finishEditing(); - - if (myArea != null) { - myArea.removeSelectionListener(this); - } - - myArea = area; - - if (myArea != null) { - myArea.addSelectionListener(this); - } - - updateProperties(); - } - - public void updateInspections() { - myQuickFixManager.update(); - } - - @Override - public void selectionChanged(EditableArea area) { - updateProperties(); - } - public boolean isShowExpert() { return myShowExpert; } public void showExpert(boolean showExpert) { myShowExpert = showExpert; - updateProperties(); + update(); } public void restoreDefaultValue() { @@ -219,24 +147,26 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon cellEditor.stopCellEditing(); } - myDesigner.getToolProvider().execute(new ThrowableRunnable() { + doRestoreDefault(new ThrowableRunnable() { @Override public void run() throws Exception { - for (RadComponent component : myComponents) { + for (PropertiesContainer component : myContainers) { if (!property.isDefaultValue(component)) { property.setDefaultValue(component); } } } - }, DesignerBundle.message("designer.properties.restore_default"), false); + }); repaint(); } } + protected abstract boolean doRestoreDefault(ThrowableRunnable runnable); + @Nullable public ErrorInfo getErrorInfoForRow(int row) { - if (myComponents.size() != 1) { + if (myContainers.size() != 1) { return null; } @@ -245,7 +175,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon return null; } - for (ErrorInfo errorInfo : ErrorInfo.get(myComponents.get(0))) { + for (ErrorInfo errorInfo : getErrors(myContainers.get(0))) { if (property.getName().equals(errorInfo.getPropertyName())) { return errorInfo; } @@ -253,6 +183,8 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon return null; } + protected abstract List getErrors(@NotNull PropertiesContainer container); + @Override public String getToolTipText(MouseEvent event) { int row = rowAtPoint(event.getPoint()); @@ -277,7 +209,18 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon // ////////////////////////////////////////////////////////////////////////////////////////// - private void updateProperties() { + @Nullable + protected PropertyContext getPropertyContext() { + return null; + } + + public void update() { + doUpdate(myContainers, null); + } + + public void doUpdate(@NotNull List containers, @Nullable Property initialSelection) { + finishEditing(); + if (mySkipUpdate) { return; } @@ -288,28 +231,12 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon cellEditor.stopCellEditing(); } - if (myArea == null) { - myComponents = Collections.emptyList(); - myProperties = Collections.emptyList(); - myModel.fireTableDataChanged(); - } - else { - Property selection = getSelectionProperty(); - myComponents = new ArrayList(myArea.getSelection()); - fillProperties(); - myModel.fireTableDataChanged(); + Property selection = initialSelection != null ? initialSelection : getSelectionProperty(); + myContainers = new ArrayList(containers); + fillProperties(); + myModel.fireTableDataChanged(); - if (myInitialSelection != null && !myComponents.isEmpty()) { - selection = myInitialSelection; - myInitialSelection = null; - } - - restoreSelection(selection); - } - - if (myPropertyTablePanel != null) { - myPropertyTablePanel.updateActions(); - } + restoreSelection(selection); } finally { mySkipUpdate = false; @@ -349,21 +276,21 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon private void fillProperties() { myProperties = new ArrayList(); - int size = myComponents.size(); + int size = myContainers.size(); if (size > 0) { - fillProperties(myComponents.get(0), myProperties); + fillProperties(myContainers.get(0), myProperties); if (size > 1) { for (Iterator I = myProperties.iterator(); I.hasNext(); ) { - if (!I.next().availableFor(myComponents)) { + if (!I.next().availableFor(myContainers)) { I.remove(); } } for (int i = 1; i < size; i++) { List properties = new ArrayList(); - fillProperties(myComponents.get(i), properties); + fillProperties(myContainers.get(i), properties); for (Iterator I = myProperties.iterator(); I.hasNext(); ) { Property property = I.next(); @@ -401,7 +328,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon } } - private void fillProperties(RadComponent component, List properties) { + private void fillProperties(PropertiesContainer component, List properties) { for (Property property : component.getProperties()) { addProperty(property, properties); } @@ -503,8 +430,8 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon } @Nullable - private RadComponent getCurrentComponent() { - return myComponents.size() == 1 ? myComponents.get(0) : null; + private PropertiesContainer getCurrentComponent() { + return myContainers.size() == 1 ? myContainers.get(0) : null; } private List getChildren(Property property) { @@ -523,7 +450,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon } public boolean isDefault(Property property) throws Exception { - for (RadComponent component : myComponents) { + for (PropertiesContainer component : myContainers) { if (!property.isDefaultValue(component)) { return false; } @@ -533,14 +460,14 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon @Nullable private Object getValue(Property property) throws Exception { - int size = myComponents.size(); + int size = myContainers.size(); if (size == 0) { return null; } - Object value = property.getValue(myComponents.get(0)); + Object value = property.getValue(myContainers.get(0)); for (int i = 1; i < size; i++) { - if (!Comparing.equal(value, property.getValue(myComponents.get(i)))) { + if (!Comparing.equal(value, property.getValue(myContainers.get(i)))) { return null; } } @@ -608,7 +535,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon super.setValueAt(aValue, row, column); if (property.needRefreshPropertyList()) { - updateProperties(); + update(); } repaint(); @@ -700,41 +627,47 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon boolean isSetValue = true; if (isNewValue) { - isSetValue = myDesigner.getToolProvider().execute(new ThrowableRunnable() { + isSetValue = doSetValue(new ThrowableRunnable() { @Override public void run() throws Exception { - for (RadComponent component : myComponents) { + for (PropertiesContainer component : myContainers) { property.setValue(component, newValue); } } - }, DesignerBundle.message("command.set.property.value"), false); + }); } if (isSetValue) { if (property.needRefreshPropertyList()) { - updateProperties(); + update(); } - else if (myPropertyTablePanel != null) { - myPropertyTablePanel.updateActions(); + else { + myModel.fireTableRowsUpdated(row, row); } } return isSetValue; } + protected abstract boolean doSetValue(ThrowableRunnable runnable); + private static void showInvalidInput(Exception e) { Throwable cause = e.getCause(); String message = cause == null ? e.getMessage() : cause.getMessage(); if (message == null || message.length() == 0) { - message = DesignerBundle.message("designer.properties.no_message.error"); + message = "No message"; } - Messages.showMessageDialog(DesignerBundle.message("designer.properties.setting.error", message), - DesignerBundle.message("designer.properties.invalid_input"), + Messages.showMessageDialog(formatErrorGettingValueMesage(message), + "Invalid Input", Messages.getErrorIcon()); } + private static String formatErrorGettingValueMesage(String message) { + return MessageFormat.format("Error setting value: {0}", message); + } + ////////////////////////////////////////////////////////////////////////////////////////// // // @@ -893,8 +826,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon } private class PropertyTableModel extends AbstractTableModel { - private final String[] myColumnNames = - {DesignerBundle.message("designer.properties.column1"), DesignerBundle.message("designer.properties.column2")}; + private final String[] myColumnNames = {"Property", "Value"}; @Override public int getColumnCount() { @@ -974,7 +906,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { try { - JComponent component = myEditor.getComponent(myDesigner.getRootComponent(), getCurrentComponent(), getValue((Property)value), null); + JComponent component = myEditor.getComponent(getCurrentComponent(), getPropertyContext() , getValue((Property)value), null); if (component instanceof JComboBox) { component.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE); @@ -990,7 +922,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon LOG.debug(e); SimpleColoredComponent errComponent = new SimpleColoredComponent(); errComponent - .append(DesignerBundle.message("designer.properties.getting.error", e.getMessage()), SimpleTextAttributes.ERROR_ATTRIBUTES); + .append(MessageFormat.format("Error getting value: {0}", e.getMessage()), SimpleTextAttributes.ERROR_ATTRIBUTES); return errComponent; } } @@ -1017,6 +949,9 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon } } + @NotNull + protected abstract TextAttributesKey getErrorAttributes(@NotNull HighlightSeverity severity); + private class PropertyCellRenderer implements TableCellRenderer { private final Map myRegularAttributes = new HashMap(); private final Map myBoldAttributes = new HashMap(); @@ -1106,8 +1041,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon SimpleTextAttributes errorAttributes = cache.get(severity); if (errorAttributes == null) { - TextAttributesKey attributesKey = - SeverityRegistrar.getInstance(myDesigner.getProject()).getHighlightInfoTypeBySeverity(severity).getAttributesKey(); + TextAttributesKey attributesKey = getErrorAttributes(severity); TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attributesKey); if (property.isImportant()) { @@ -1168,7 +1102,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon else { try { PropertyRenderer renderer = property.getRenderer(); - JComponent component = renderer.getComponent(getCurrentComponent(), getValue(property), selected, hasFocus); + JComponent component = renderer.getComponent(getCurrentComponent(), getPropertyContext(), getValue(property), selected, hasFocus); if (!selected) { component.setBackground(background); @@ -1185,8 +1119,7 @@ public final class PropertyTable extends JBTable implements DataProvider, Compon catch (Throwable e) { LOG.debug(e); myErrorRenderer.clear(); - myErrorRenderer - .append(DesignerBundle.message("designer.properties.getting.error", e.getMessage()), SimpleTextAttributes.ERROR_ATTRIBUTES); + myErrorRenderer.append(formatErrorGettingValueMesage(e.getMessage()), SimpleTextAttributes.ERROR_ATTRIBUTES); return myErrorRenderer; } } diff --git a/plugins/android-designer/src/com/intellij/android/designer/componentTree/AndroidTreeDecorator.java b/plugins/android-designer/src/com/intellij/android/designer/componentTree/AndroidTreeDecorator.java index 605a71f23561..bc8e4dec7592 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/componentTree/AndroidTreeDecorator.java +++ b/plugins/android-designer/src/com/intellij/android/designer/componentTree/AndroidTreeDecorator.java @@ -20,10 +20,10 @@ import com.intellij.designer.componentTree.AttributeWrapper; import com.intellij.designer.componentTree.TreeComponentDecorator; import com.intellij.designer.model.IComponentDecorator; import com.intellij.designer.model.MetaModel; +import com.intellij.designer.model.Property; import com.intellij.designer.model.RadComponent; import com.intellij.designer.palette.DefaultPaletteItem; -import com.intellij.designer.propertyTable.Property; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.SimpleColoredComponent; import com.intellij.ui.SimpleTextAttributes; @@ -102,7 +102,7 @@ public final class AndroidTreeDecorator implements TreeComponentDecorator { component.getMetaModel().getTarget() + " without properties"); } - Property property = PropertyTable.findProperty(component.getProperties(), name); + Property property = RadPropertyTable.findProperty(component.getProperties(), name); if (property != null) { try { return String.valueOf(property.getValue(component)); diff --git a/plugins/android-designer/src/com/intellij/android/designer/inspection/ErrorAnalyzer.java b/plugins/android-designer/src/com/intellij/android/designer/inspection/ErrorAnalyzer.java index 42632f83859e..a9ca579da373 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/inspection/ErrorAnalyzer.java +++ b/plugins/android-designer/src/com/intellij/android/designer/inspection/ErrorAnalyzer.java @@ -25,11 +25,7 @@ import com.intellij.codeInspection.SuppressIntentionAction; import com.intellij.codeInspection.ex.DisableInspectionToolAction; import com.intellij.codeInspection.ex.EditInspectionToolsSettingsAction; import com.intellij.designer.inspection.AbstractQuickFixManager; -import com.intellij.designer.inspection.ErrorInfo; -import com.intellij.designer.inspection.QuickFix; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.model.RadComponentVisitor; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.*; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; @@ -48,7 +44,7 @@ import java.util.List; */ public final class ErrorAnalyzer { public static void load(final Project project, final XmlFile xmlFile, RadComponent rootComponent, ProgressIndicator progress) { - ErrorInfo.clear(rootComponent); + RadComponent.clearErrors(rootComponent); AndroidLintExternalAnnotator annotator = new AndroidLintExternalAnnotator(); State state = annotator.collectionInformation(xmlFile); @@ -80,7 +76,7 @@ public final class ErrorAnalyzer { if (startElement != null && endElement != null && !inspection.isSuppressedFor(startElement)) { Pair componentInfo = findComponent(rootComponent, startElement); ErrorInfo errorInfo = new ErrorInfo(message, componentInfo.second, pair.getSecond()); - ErrorInfo.add(componentInfo.first, errorInfo); + RadComponent.addError(componentInfo.first, errorInfo); Icon icon = errorInfo.getLevel() == HighlightDisplayLevel.ERROR ? AbstractQuickFixManager.ICON_ERROR : AbstractQuickFixManager.ICON; diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java index 03c66f4f60c2..e36b73b0a87e 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java @@ -18,12 +18,8 @@ package com.intellij.android.designer.model; import com.android.ide.common.rendering.api.ViewInfo; import com.android.sdklib.IAndroidTarget; import com.intellij.android.designer.propertyTable.*; -import com.intellij.designer.model.MetaManager; -import com.intellij.designer.model.MetaModel; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.model.RadLayout; -import com.intellij.designer.propertyTable.Property; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.model.*; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.openapi.module.Module; import org.jetbrains.android.dom.attrs.AttributeDefinition; import org.jetbrains.android.dom.attrs.AttributeDefinitions; @@ -205,7 +201,7 @@ public class PropertyParser { List superProperties = loadWidgetProperties(superComponentClass, superModel); for (Property superProperty : superProperties) { - if (PropertyTable.findProperty(properties, superProperty) == -1) { + if (RadPropertyTable.findProperty(properties, superProperty) == -1) { if (model == null) { properties.add(superProperty); } @@ -226,11 +222,11 @@ public class PropertyParser { if (model != null) { for (String topName : model.getTopProperties()) { - PropertyTable.moveProperty(properties, topName, properties, 0); + RadPropertyTable.moveProperty(properties, topName, properties, 0); } } - PropertyTable.moveProperty(properties, "style", properties, 0); + RadPropertyTable.moveProperty(properties, "style", properties, 0); } } @@ -317,7 +313,7 @@ public class PropertyParser { if (++index < components.length) { for (Property property : loadLayoutProperties(components, index, models)) { - if (PropertyTable.findProperty(properties, property) == -1) { + if (RadPropertyTable.findProperty(properties, property) == -1) { if (model == null) { properties.add(property); } @@ -337,10 +333,10 @@ public class PropertyParser { } }); - PropertyTable.moveProperty(properties, "layout:margin", properties, 0); - PropertyTable.moveProperty(properties, "layout:gravity", properties, 0); - PropertyTable.moveProperty(properties, "layout:height", properties, 0); - PropertyTable.moveProperty(properties, "layout:width", properties, 0); + RadPropertyTable.moveProperty(properties, "layout:margin", properties, 0); + RadPropertyTable.moveProperty(properties, "layout:gravity", properties, 0); + RadPropertyTable.moveProperty(properties, "layout:height", properties, 0); + RadPropertyTable.moveProperty(properties, "layout:width", properties, 0); } if (model != null) { @@ -357,7 +353,7 @@ public class PropertyParser { public static void moveProperties(List source, Property destination, String... names) { List children = destination.getChildren(null); for (int i = 0; i < names.length; i += 2) { - Property property = PropertyTable.extractProperty(source, names[i]); + Property property = RadPropertyTable.extractProperty(source, names[i]); if (property != null) { children.add(property.createForNewPresentation(destination, names[i + 1])); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadCustomViewComponent.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadCustomViewComponent.java index cff411d9b7ce..fdb604116252 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadCustomViewComponent.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadCustomViewComponent.java @@ -19,12 +19,8 @@ import com.intellij.android.designer.propertyTable.CustomViewProperty; import com.intellij.android.designer.propertyTable.editors.ChooseClassDialog; import com.intellij.designer.ModuleProvider; import com.intellij.designer.componentTree.AttributeWrapper; -import com.intellij.designer.model.IComponentDecorator; -import com.intellij.designer.model.MetaManager; -import com.intellij.designer.model.MetaModel; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.propertyTable.Property; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.model.*; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiClass; import com.intellij.psi.xml.XmlTag; @@ -137,13 +133,13 @@ public class RadCustomViewComponent extends RadViewComponent implements IConfigu properties.add(CLASS_PROPERTY); for (String name : metaModel.getInplaceProperties()) { - Property property = PropertyTable.findProperty(allProperties, name); + Property property = RadPropertyTable.findProperty(allProperties, name); if (property != null) { properties.add(property); } } - properties.add(PropertyTable.findProperty(allProperties, "id")); + properties.add(RadPropertyTable.findProperty(allProperties, "id")); return properties; } diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadFragment.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadFragment.java index b03031bf856e..ddad49c6d089 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadFragment.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadFragment.java @@ -21,8 +21,8 @@ import com.intellij.android.designer.propertyTable.JavadocParser; import com.intellij.android.designer.propertyTable.editors.ChooseClassDialog; import com.intellij.android.designer.propertyTable.editors.ResourceEditor; import com.intellij.designer.ModuleProvider; +import com.intellij.designer.model.Property; import com.intellij.designer.model.RadComponent; -import com.intellij.designer.propertyTable.Property; import com.intellij.designer.propertyTable.editors.TextEditor; import org.jetbrains.android.dom.attrs.AttributeFormat; import org.jetbrains.annotations.Nullable; diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadIncludeLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadIncludeLayout.java index 70a7b97b2225..5ff011ac849d 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadIncludeLayout.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadIncludeLayout.java @@ -22,8 +22,8 @@ import com.intellij.android.designer.propertyTable.IdProperty; import com.intellij.android.designer.propertyTable.IncludeLayoutProperty; import com.intellij.android.designer.propertyTable.editors.ResourceDialog; import com.intellij.designer.ModuleProvider; +import com.intellij.designer.model.Property; import com.intellij.designer.model.RadComponent; -import com.intellij.designer.propertyTable.Property; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadRequestFocus.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadRequestFocus.java index 53f17fdde687..edd47c0a9397 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadRequestFocus.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadRequestFocus.java @@ -15,7 +15,7 @@ */ package com.intellij.android.designer.model; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.Property; import java.util.Collections; import java.util.List; diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java index a8ef88b71866..a27ee91ba20d 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java @@ -17,12 +17,8 @@ package com.intellij.android.designer.model; import com.android.ide.common.rendering.api.ViewInfo; import com.android.sdklib.SdkConstants; -import com.intellij.designer.model.EmptyXmlTag; -import com.intellij.designer.model.MetaModel; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.model.RadVisualComponent; -import com.intellij.designer.propertyTable.Property; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.model.*; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.xml.XmlAttribute; @@ -210,7 +206,7 @@ public class RadViewComponent extends RadVisualComponent { @Override public List getInplaceProperties() throws Exception { List properties = super.getInplaceProperties(); - Property idProperty = PropertyTable.findProperty(myProperties, "id"); + Property idProperty = RadPropertyTable.findProperty(myProperties, "id"); if (idProperty != null) { properties.add(idProperty); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/CenterProperty.java b/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/CenterProperty.java index 8b95d525ed2a..424c2e96a4d8 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/CenterProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/CenterProperty.java @@ -19,8 +19,9 @@ import com.android.sdklib.SdkConstants; import com.intellij.android.designer.model.ModelParser; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.propertyTable.IXmlAttributeLocator; +import com.intellij.android.designer.propertyTable.JavadocParser; import com.intellij.android.designer.propertyTable.editors.StringsComboEditor; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.designer.propertyTable.renderers.LabelPropertyRenderer; @@ -28,7 +29,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlTag; import com.intellij.util.ArrayUtil; -import com.intellij.android.designer.propertyTable.JavadocParser; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/CompoundProperty.java b/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/CompoundProperty.java index d25594f28df7..00a7784c9c96 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/CompoundProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/CompoundProperty.java @@ -16,7 +16,7 @@ package com.intellij.android.designer.model.layout.relative; import com.intellij.android.designer.model.RadViewComponent; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.Property; import org.jetbrains.annotations.NotNull; /** diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/RadRelativeLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/RadRelativeLayout.java index 8b7f95c4cbd1..eb83f15da4c1 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/RadRelativeLayout.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/layout/relative/RadRelativeLayout.java @@ -24,14 +24,14 @@ import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.model.RadViewLayoutWithData; import com.intellij.android.designer.model.layout.actions.AllGravityAction; import com.intellij.android.designer.propertyTable.AttributeProperty; -import com.intellij.android.designer.propertyTable.RelativeIdAttributeProperty; import com.intellij.android.designer.propertyTable.JavadocParser; +import com.intellij.android.designer.propertyTable.RelativeIdAttributeProperty; import com.intellij.designer.componentTree.TreeEditOperation; import com.intellij.designer.designSurface.*; import com.intellij.designer.designSurface.selection.ResizeSelectionDecorator; +import com.intellij.designer.model.Property; import com.intellij.designer.model.RadComponent; -import com.intellij.designer.propertyTable.Property; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.openapi.actionSystem.DefaultActionGroup; import org.jetbrains.annotations.NotNull; @@ -89,9 +89,9 @@ public class RadRelativeLayout extends RadViewLayoutWithData implements ILayoutD "layout:alignWithParentIfMissing", "missing"); properties.add(alignParent); - PropertyTable.extractProperty(properties, "layout:centerInParent"); - PropertyTable.extractProperty(properties, "layout:centerHorizontal"); - PropertyTable.extractProperty(properties, "layout:centerVertical"); + RadPropertyTable.extractProperty(properties, "layout:centerInParent"); + RadPropertyTable.extractProperty(properties, "layout:centerHorizontal"); + RadPropertyTable.extractProperty(properties, "layout:centerVertical"); properties.add(new CenterProperty()); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java index 52e3430069e2..6cd40b41389a 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java @@ -21,7 +21,7 @@ import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.propertyTable.editors.ResourceEditor; import com.intellij.android.designer.propertyTable.editors.StringsComboEditor; import com.intellij.android.designer.propertyTable.renderers.ResourceRenderer; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.designer.propertyTable.editors.TextEditor; diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributePropertyWithDefault.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributePropertyWithDefault.java index 7d42fb382bb8..889d9b4619ea 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributePropertyWithDefault.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributePropertyWithDefault.java @@ -16,7 +16,7 @@ package com.intellij.android.designer.propertyTable; import com.intellij.android.designer.model.RadViewComponent; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.Property; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.android.dom.attrs.AttributeDefinition; import org.jetbrains.annotations.NotNull; diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundProperty.java index 7b6bd03570cc..d4aa717f8350 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundProperty.java @@ -17,8 +17,8 @@ package com.intellij.android.designer.propertyTable; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.designer.model.MetaModel; +import com.intellij.designer.model.Property; import com.intellij.designer.propertyTable.IPropertyDecorator; -import com.intellij.designer.propertyTable.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.designer.propertyTable.renderers.LabelPropertyRenderer; diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CustomViewProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CustomViewProperty.java index 9fd47609769c..bea2b944f906 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CustomViewProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CustomViewProperty.java @@ -19,8 +19,8 @@ import com.intellij.android.designer.model.PropertyParser; import com.intellij.android.designer.model.RadCustomViewComponent; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.propertyTable.editors.ResourceEditor; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.designer.propertyTable.renderers.LabelPropertyRenderer; @@ -103,7 +103,7 @@ public class CustomViewProperty extends Property impleme } @Override - public boolean availableFor(List components) { + public boolean availableFor(List components) { return false; } diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FlagProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FlagProperty.java index d1a8d0b35b50..74dde5d7b271 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FlagProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FlagProperty.java @@ -18,8 +18,8 @@ package com.intellij.android.designer.propertyTable; import com.android.sdklib.SdkConstants; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.designer.model.MetaModel; +import com.intellij.designer.model.Property; import com.intellij.designer.propertyTable.IPropertyDecorator; -import com.intellij.designer.propertyTable.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.designer.propertyTable.editors.BooleanEditor; diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FragmentProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FragmentProperty.java index 644efb550c12..d433652165ec 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FragmentProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FragmentProperty.java @@ -18,8 +18,8 @@ package com.intellij.android.designer.propertyTable; import com.android.sdklib.SdkConstants; import com.intellij.android.designer.model.ModelParser; import com.intellij.android.designer.model.RadViewComponent; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.designer.propertyTable.renderers.LabelPropertyRenderer; @@ -87,7 +87,7 @@ public class FragmentProperty extends Property implements IXml } @Override - public boolean availableFor(List components) { + public boolean availableFor(List components) { return false; } diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/GravityProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/GravityProperty.java index 6bea65dd5dd4..5162f25a5b57 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/GravityProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/GravityProperty.java @@ -18,7 +18,7 @@ package com.intellij.android.designer.propertyTable; import com.android.sdklib.SdkConstants; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.propertyTable.editors.StringsComboEditor; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.designer.propertyTable.renderers.LabelPropertyRenderer; diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IdProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IdProperty.java index 8c377430eb3d..2da628f93561 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IdProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IdProperty.java @@ -17,8 +17,8 @@ package com.intellij.android.designer.propertyTable; import com.intellij.android.designer.model.IdManager; import com.intellij.android.designer.model.RadViewComponent; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.Property; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.Pair; import org.jetbrains.android.dom.attrs.AttributeDefinition; @@ -83,7 +83,7 @@ public class IdProperty extends AttributeProperty { } @Override - public boolean availableFor(List components) { + public boolean availableFor(List components) { return false; } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IncludeLayoutProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IncludeLayoutProperty.java index ffc393233dcb..af04587fd01b 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IncludeLayoutProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IncludeLayoutProperty.java @@ -20,8 +20,8 @@ import com.intellij.android.designer.model.RadIncludeLayout; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.propertyTable.editors.ResourceEditor; import com.intellij.android.designer.propertyTable.renderers.ResourceRenderer; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.openapi.application.ApplicationManager; @@ -78,7 +78,7 @@ public class IncludeLayoutProperty extends Property implements } @Override - public boolean availableFor(List components) { + public boolean availableFor(List components) { return false; } diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/RelativeIdAttributeProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/RelativeIdAttributeProperty.java index 55242d7a16ac..8df0c5e1453f 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/RelativeIdAttributeProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/RelativeIdAttributeProperty.java @@ -19,6 +19,7 @@ import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.model.layout.relative.RadRelativeLayoutComponent; import com.intellij.android.designer.propertyTable.editors.ComponentEditor; import com.intellij.android.designer.propertyTable.renderers.ComponentRenderer; +import com.intellij.designer.model.PropertiesContainer; import com.intellij.designer.model.RadComponent; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; @@ -76,7 +77,7 @@ public class RelativeIdAttributeProperty extends AttributeProperty { } @Override - public boolean availableFor(List components) { + public boolean availableFor(List components) { return false; } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/StyleProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/StyleProperty.java index a92c102c846d..cbbd38b9fbe5 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/StyleProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/StyleProperty.java @@ -19,7 +19,7 @@ import com.android.resources.ResourceType; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.propertyTable.editors.ResourceEditor; import com.intellij.android.designer.propertyTable.renderers.ResourceRenderer; -import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.model.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; import com.intellij.openapi.application.ApplicationManager; diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/ComponentEditor.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/ComponentEditor.java index a73deae1ba40..bb38a3f16768 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/ComponentEditor.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/ComponentEditor.java @@ -17,6 +17,8 @@ package com.intellij.android.designer.propertyTable.editors; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.propertyTable.renderers.ComponentRenderer; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import com.intellij.designer.model.RadComponent; import com.intellij.designer.propertyTable.InplaceContext; import com.intellij.designer.propertyTable.editors.ComboEditor; @@ -57,17 +59,18 @@ public abstract class ComponentEditor extends ComboEditor { @NotNull @Override - public JComponent getComponent(@NotNull RadComponent rootComponent, - @Nullable RadComponent component, - Object value, + public JComponent getComponent(@Nullable PropertiesContainer container, + @Nullable PropertyContext context, Object value, @Nullable InplaceContext inplaceContext) { DefaultComboBoxModel model = new DefaultComboBoxModel(); myCombo.setModel(model); model.addElement(StringsComboEditor.UNSET); - for (RadComponent childComponent : getComponents(component)) { - model.addElement(childComponent); + if (container instanceof RadComponent) { + for (RadComponent childComponent : getComponents((RadComponent)container)) { + model.addElement(childComponent); + } + myCombo.setSelectedItem(myRenderer.getComponentById((RadComponent)container, (String)value)); } - myCombo.setSelectedItem(myRenderer.getComponentById(component, (String)value)); myCombo.setBorder(inplaceContext == null ? null : myComboBorder); return myCombo; } diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/ResourceEditor.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/ResourceEditor.java index 0a3cd6adbce9..526a7266f645 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/ResourceEditor.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/ResourceEditor.java @@ -20,7 +20,10 @@ import com.intellij.android.designer.model.ModelParser; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.propertyTable.renderers.ResourceRenderer; import com.intellij.designer.ModuleProvider; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.RadPropertyContext; import com.intellij.designer.propertyTable.InplaceContext; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.editors.ComboEditor; @@ -207,12 +210,13 @@ public class ResourceEditor extends PropertyEditor { @NotNull @Override - public JComponent getComponent(@NotNull RadComponent rootComponent, - @Nullable RadComponent component, + public JComponent getComponent(@Nullable PropertiesContainer container, + @Nullable PropertyContext context, Object object, @Nullable InplaceContext inplaceContext) { - myRootComponent = rootComponent; - myComponent = component; + myComponent = container instanceof RadComponent ? (RadComponent)container : null; + myRootComponent = context instanceof RadPropertyContext ? ((RadPropertyContext)context).getRootComponent() : null; + String value = (String)object; JTextField text = getComboText(); diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/StringsComboEditor.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/StringsComboEditor.java index c01367b5cc40..127989142fd2 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/StringsComboEditor.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/StringsComboEditor.java @@ -15,7 +15,8 @@ */ package com.intellij.android.designer.propertyTable.editors; -import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import com.intellij.designer.propertyTable.InplaceContext; import com.intellij.designer.propertyTable.editors.ComboEditor; import org.jetbrains.annotations.NotNull; @@ -54,9 +55,8 @@ public class StringsComboEditor extends ComboEditor { @NotNull @Override - public JComponent getComponent(@NotNull RadComponent rootComponent, - @Nullable RadComponent component, - Object value, + public JComponent getComponent(@Nullable PropertiesContainer container, + @Nullable PropertyContext context, Object value, @Nullable InplaceContext inplaceContext) { myCombo.setSelectedItem(value); myCombo.setBorder(inplaceContext == null ? null : myComboBorder); diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ComponentRenderer.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ComponentRenderer.java index 3eb7fdb562fc..7f37a27d62d2 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ComponentRenderer.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ComponentRenderer.java @@ -18,9 +18,11 @@ package com.intellij.android.designer.propertyTable.renderers; import com.intellij.android.designer.propertyTable.editors.StringsComboEditor; import com.intellij.designer.componentTree.AttributeWrapper; import com.intellij.designer.componentTree.TreeComponentDecorator; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import com.intellij.designer.model.RadComponent; import com.intellij.designer.propertyTable.PropertyRenderer; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.ColoredListCellRenderer; import com.intellij.ui.SimpleTextAttributes; @@ -36,7 +38,7 @@ public abstract class ComponentRenderer extends ColoredListCellRenderer implemen @Override protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { clear(); - PropertyTable.updateRenderer(this, selected); + RadPropertyTable.updateRenderer(this, selected); if (value == StringsComboEditor.UNSET) { append(StringsComboEditor.UNSET); @@ -54,12 +56,16 @@ public abstract class ComponentRenderer extends ColoredListCellRenderer implemen @NotNull @Override - public JComponent getComponent(@Nullable RadComponent component, @Nullable Object object, boolean selected, boolean hasFocus) { + public JComponent getComponent(@Nullable PropertiesContainer container, + PropertyContext context, + @Nullable Object object, + boolean selected, + boolean hasFocus) { clear(); - PropertyTable.updateRenderer(this, selected); + RadPropertyTable.updateRenderer(this, selected); String value = (String)object; - RadComponent idComponent = getComponentById(component, value); + RadComponent idComponent = container instanceof RadComponent ? getComponentById((RadComponent)container, value) : null; if (idComponent != null) { renderComponent(idComponent); diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java index 8c1e81bbee35..93e58f99c704 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java @@ -17,9 +17,11 @@ package com.intellij.android.designer.propertyTable.renderers; import com.intellij.android.designer.model.ModelParser; import com.intellij.designer.ModuleProvider; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import com.intellij.designer.model.RadComponent; import com.intellij.designer.propertyTable.PropertyRenderer; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.designer.propertyTable.renderers.BooleanRenderer; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.SimpleColoredComponent; @@ -36,8 +38,8 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.Set; /** * @author Alexander Lobas @@ -63,16 +65,20 @@ public class ResourceRenderer implements PropertyRenderer { @NotNull @Override - public JComponent getComponent(@Nullable RadComponent component, @Nullable Object object, boolean selected, boolean hasFocus) { + public JComponent getComponent(@Nullable PropertiesContainer container, + PropertyContext context, + @Nullable Object object, + boolean selected, + boolean hasFocus) { String value = (String)object; if (myBooleanRenderer != null && (StringUtil.isEmpty(value) || "false".equals(value) || "true".equals(value))) { - return myBooleanRenderer.getComponent(component, "true".equals(value), selected, hasFocus); + return myBooleanRenderer.getComponent(container, context, "true".equals(value), selected, hasFocus); } myColoredComponent.clear(); - PropertyTable.updateRenderer(myColoredComponent, selected); - formatValue(component, value); + RadPropertyTable.updateRenderer(myColoredComponent, selected); + if (container instanceof RadComponent) formatValue((RadComponent)container, value); return myColoredComponent; } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/DesignerToolWindowManager.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/DesignerToolWindowManager.java index 623e3b8a84be..af305bc0cc35 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/DesignerToolWindowManager.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/DesignerToolWindowManager.java @@ -18,7 +18,7 @@ package com.intellij.designer; import com.intellij.designer.componentTree.ComponentTree; import com.intellij.designer.componentTree.ComponentTreeBuilder; import com.intellij.designer.designSurface.DesignerEditorPanel; -import com.intellij.designer.propertyTable.PropertyTablePanel; +import com.intellij.designer.propertyTable.RadPropertyTablePanel; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; @@ -52,7 +52,7 @@ public final class DesignerToolWindowManager extends AbstractToolWindowManager { private Splitter myToolWindowPanel; private ComponentTree myComponentTree; private ComponentTreeBuilder myTreeBuilder; - private PropertyTablePanel myPropertyTablePanel; + private RadPropertyTablePanel myPropertyTablePanel; public DesignerToolWindowManager(Project project, FileEditorManager fileEditorManager) { super(project, fileEditorManager); @@ -129,7 +129,7 @@ public final class DesignerToolWindowManager extends AbstractToolWindowManager { treeScrollPane.setPreferredSize(new Dimension(250, -1)); myComponentTree.initQuickFixManager(treeScrollPane.getViewport()); - myPropertyTablePanel = new PropertyTablePanel(); + myPropertyTablePanel = new RadPropertyTablePanel(myProject); myToolWindowPanel = new Splitter(true, 0.42f); myToolWindowPanel.setFirstComponent(treeScrollPane); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/ComponentTree.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/ComponentTree.java index ae57adc24068..a819ebd248ed 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/ComponentTree.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/ComponentTree.java @@ -22,7 +22,7 @@ import com.intellij.designer.actions.StartInplaceEditing; import com.intellij.designer.designSurface.DesignerEditorPanel; import com.intellij.designer.designSurface.EditableArea; import com.intellij.designer.designSurface.FeedbackTreeLayer; -import com.intellij.designer.inspection.ErrorInfo; +import com.intellij.designer.model.ErrorInfo; import com.intellij.designer.model.RadComponent; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.actionSystem.DataProvider; @@ -151,7 +151,7 @@ public final class ComponentTree extends Tree implements DataProvider { if (path != null) { RadComponent component = extractComponent(path.getLastPathComponent()); if (component != null) { - List errorInfos = ErrorInfo.get(component); + List errorInfos = RadComponent.getError(component); if (!errorInfos.isEmpty()) { return errorInfos.get(0).getName(); } @@ -164,7 +164,7 @@ public final class ComponentTree extends Tree implements DataProvider { private static HighlightDisplayLevel getHighlightDisplayLevel(Project project, RadComponent component) { HighlightDisplayLevel displayLevel = null; SeverityRegistrar severityRegistrar = SeverityRegistrar.getInstance(project); - for (ErrorInfo errorInfo : ErrorInfo.get(component)) { + for (ErrorInfo errorInfo : RadComponent.getError(component)) { if (displayLevel == null || severityRegistrar.compare(errorInfo.getLevel().getSeverity(), displayLevel.getSeverity()) > 0) { displayLevel = errorInfo.getLevel(); } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/QuickFixManager.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/QuickFixManager.java index 1d445496e355..1cafdd2d17e1 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/QuickFixManager.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/QuickFixManager.java @@ -18,7 +18,7 @@ package com.intellij.designer.componentTree; import com.intellij.designer.designSurface.ComponentSelectionListener; import com.intellij.designer.designSurface.EditableArea; import com.intellij.designer.inspection.AbstractQuickFixManager; -import com.intellij.designer.inspection.ErrorInfo; +import com.intellij.designer.model.ErrorInfo; import com.intellij.designer.model.RadComponent; import org.jetbrains.annotations.NotNull; @@ -53,7 +53,7 @@ public final class QuickFixManager extends AbstractQuickFixManager implements Co protected List getErrorInfos() { List selection = myArea.getSelection(); if (selection.size() == 1) { - return ErrorInfo.get(selection.get(0)); + return RadComponent.getError(selection.get(0)); } return Collections.emptyList(); } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java index 89ac58cb12b5..a7fe24a6b32f 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java @@ -22,14 +22,11 @@ import com.intellij.designer.ModuleProvider; import com.intellij.designer.actions.DesignerActionPanel; import com.intellij.designer.componentTree.TreeComponentDecorator; import com.intellij.designer.designSurface.tools.*; -import com.intellij.designer.model.FindComponentVisitor; -import com.intellij.designer.model.RadComponent; -import com.intellij.designer.model.WrapInProvider; +import com.intellij.designer.model.*; import com.intellij.designer.palette.PaletteGroup; import com.intellij.designer.palette.PaletteItem; import com.intellij.designer.palette.PaletteToolWindowManager; import com.intellij.designer.propertyTable.InplaceContext; -import com.intellij.designer.propertyTable.Property; import com.intellij.diagnostic.LogMessageEx; import com.intellij.diagnostic.errordialog.Attachment; import com.intellij.openapi.actionSystem.ActionGroup; @@ -72,7 +69,7 @@ import java.util.List; /** * @author Alexander Lobas */ -public abstract class DesignerEditorPanel extends JPanel implements DataProvider, ModuleProvider { +public abstract class DesignerEditorPanel extends JPanel implements DataProvider, ModuleProvider, RadPropertyContext { private static final Logger LOG = Logger.getInstance("#com.intellij.designer.designSurface.DesignerEditorPanel"); protected static final Integer LAYER_COMPONENT = JLayeredPane.DEFAULT_LAYER; @@ -744,6 +741,7 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider return null; } + @Nullable public RadComponent getRootComponent() { return myRootComponent; } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/InplaceEditingLayer.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/InplaceEditingLayer.java index a593f3908721..04860dfebc0d 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/InplaceEditingLayer.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/InplaceEditingLayer.java @@ -17,9 +17,9 @@ package com.intellij.designer.designSurface; import com.intellij.designer.DesignerBundle; import com.intellij.designer.designSurface.feedbacks.LineMarginBorder; +import com.intellij.designer.model.Property; import com.intellij.designer.model.RadComponent; import com.intellij.designer.propertyTable.InplaceContext; -import com.intellij.designer.propertyTable.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyEditorListener; import com.intellij.openapi.actionSystem.AnAction; @@ -151,8 +151,7 @@ public class InplaceEditingLayer extends JComponent { PropertyEditor editor = property.getEditor(); myEditors.add(editor); - JComponent component = - editor.getComponent(myRadComponent.getRoot(), myRadComponent, property.getValue(myRadComponent), inplaceContext); + JComponent component = editor.getComponent(myRadComponent, myDesigner, property.getValue(myRadComponent), inplaceContext); myInplaceComponent.add(component, new GridConstraints(row++, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/QuickFixManager.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/QuickFixManager.java index f57f100283e4..37b30c128aa7 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/QuickFixManager.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/QuickFixManager.java @@ -16,7 +16,7 @@ package com.intellij.designer.designSurface; import com.intellij.designer.inspection.AbstractQuickFixManager; -import com.intellij.designer.inspection.ErrorInfo; +import com.intellij.designer.model.ErrorInfo; import com.intellij.designer.model.RadComponent; import org.jetbrains.annotations.NotNull; @@ -45,7 +45,7 @@ public final class QuickFixManager extends AbstractQuickFixManager implements Co protected List getErrorInfos() { List selection = myDesigner.getSurfaceArea().getSelection(); if (selection.size() == 1) { - return ErrorInfo.get(selection.get(0)); + return RadComponent.getError(selection.get(0)); } return Collections.emptyList(); } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/AbstractQuickFixManager.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/AbstractQuickFixManager.java index dc35521837d7..4f9544027470 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/AbstractQuickFixManager.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/inspection/AbstractQuickFixManager.java @@ -18,6 +18,8 @@ package com.intellij.designer.inspection; import com.intellij.codeHighlighting.HighlightDisplayLevel; import com.intellij.designer.DesignerBundle; import com.intellij.designer.designSurface.DesignerEditorPanel; +import com.intellij.designer.model.ErrorInfo; +import com.intellij.designer.model.QuickFix; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/MetaModel.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/MetaModel.java index 5bae3a767cdc..8b7bba95330d 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/MetaModel.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/MetaModel.java @@ -17,7 +17,6 @@ package com.intellij.designer.model; import com.intellij.designer.palette.DefaultPaletteItem; import com.intellij.designer.propertyTable.IPropertyDecorator; -import com.intellij.designer.propertyTable.Property; import com.intellij.openapi.util.IconLoader; import org.jetbrains.annotations.NotNull; diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java index 47413d23db5a..96c0a07d640d 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java @@ -21,8 +21,7 @@ import com.intellij.designer.designSurface.OperationContext; import com.intellij.designer.designSurface.StaticDecorator; import com.intellij.designer.designSurface.tools.DragTracker; import com.intellij.designer.designSurface.tools.InputTool; -import com.intellij.designer.propertyTable.Property; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.openapi.actionSystem.DefaultActionGroup; import org.jdom.Element; import org.jetbrains.annotations.NotNull; @@ -36,12 +35,19 @@ import java.util.List; /** * @author Alexander Lobas */ -public abstract class RadComponent { +public abstract class RadComponent extends PropertiesContainer { + private static final String ERROR_KEY = "Inspection.Errors"; + protected MetaModel myMetaModel; private RadComponent myParent; private RadLayout myLayout; private final Map myClientProperties = new HashMap(); + @Override + public List getProperties() { + return Collections.emptyList(); + } + ////////////////////////////////////////////////////////////////////////////////////////// // // MetaModel @@ -185,17 +191,13 @@ public abstract class RadComponent { // ////////////////////////////////////////////////////////////////////////////////////////// - public List getProperties() { - return Collections.emptyList(); - } - public List getInplaceProperties() throws Exception { List properties = new ArrayList(); if (myMetaModel != null) { List allProperties = getProperties(); for (String name : myMetaModel.getInplaceProperties()) { - Property property = PropertyTable.findProperty(allProperties, name); + Property property = RadPropertyTable.findProperty(allProperties, name); if (property != null) { properties.add(property); } @@ -276,6 +278,31 @@ public abstract class RadComponent { // ////////////////////////////////////////////////////////////////////////////////////////// + + public static List getError(RadComponent component) { + List errorInfos = component.getClientProperty(ERROR_KEY); + return errorInfos == null ? Collections.emptyList() : errorInfos; + } + + public static void addError(RadComponent component, ErrorInfo errorInfo) { + List errorInfos = component.getClientProperty(ERROR_KEY); + if (errorInfos == null) { + errorInfos = new ArrayList(); + component.setClientProperty(ERROR_KEY, errorInfos); + } + errorInfos.add(errorInfo); + } + + public static void clearErrors(RadComponent component) { + component.accept(new RadComponentVisitor() { + @Override + public void endVisit(RadComponent component) { + component.extractClientProperty(ERROR_KEY); + } + }, true); + } + + public static Set getParents(List components) { Set parents = new HashSet(); for (RadComponent component : components) { diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java index 0a967f1bd959..f83e7dab3795 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java @@ -16,7 +16,6 @@ package com.intellij.designer.model; import com.intellij.designer.designSurface.*; -import com.intellij.designer.propertyTable.Property; import com.intellij.openapi.actionSystem.DefaultActionGroup; import org.jetbrains.annotations.Nullable; diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadPropertyContext.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadPropertyContext.java new file mode 100644 index 000000000000..51b3c7bc2e89 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadPropertyContext.java @@ -0,0 +1,23 @@ +/* + * 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.model; + +import org.jetbrains.annotations.Nullable; + +public interface RadPropertyContext extends PropertyContext { + @Nullable + RadComponent getRootComponent(); +} diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/QuickFixManager.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/QuickFixManager.java index 18336dc1a4a9..534d3d5b3f3b 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/QuickFixManager.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/QuickFixManager.java @@ -16,7 +16,7 @@ package com.intellij.designer.propertyTable; import com.intellij.designer.inspection.AbstractQuickFixManager; -import com.intellij.designer.inspection.ErrorInfo; +import com.intellij.designer.model.ErrorInfo; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -45,7 +45,7 @@ public final class QuickFixManager extends AbstractQuickFixManager implements Li @NotNull @Override protected List getErrorInfos() { - PropertyTable component = (PropertyTable)myComponent; + RadPropertyTable component = (RadPropertyTable)myComponent; int selectedRow = component.getSelectedRow(); if (selectedRow < 0 || selectedRow >= component.getRowCount()) { @@ -61,7 +61,7 @@ public final class QuickFixManager extends AbstractQuickFixManager implements Li @Override protected Rectangle getErrorBounds() { - PropertyTable component = (PropertyTable)myComponent; + RadPropertyTable component = (RadPropertyTable)myComponent; int selectedRow = component.getSelectedRow(); if (selectedRow < 0 || selectedRow >= component.getRowCount()) { diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/RadPropertyTable.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/RadPropertyTable.java new file mode 100644 index 000000000000..f4942f20d959 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/RadPropertyTable.java @@ -0,0 +1,156 @@ +/* + * 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.codeInsight.daemon.impl.SeverityRegistrar; +import com.intellij.designer.DesignerBundle; +import com.intellij.designer.designSurface.ComponentSelectionListener; +import com.intellij.designer.designSurface.DesignerEditorPanel; +import com.intellij.designer.designSurface.EditableArea; +import com.intellij.designer.model.ErrorInfo; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; +import com.intellij.designer.model.RadComponent; +import com.intellij.lang.annotation.HighlightSeverity; +import com.intellij.openapi.actionSystem.DataProvider; +import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.editor.colors.TextAttributesKey; +import com.intellij.openapi.project.Project; +import com.intellij.util.ThrowableRunnable; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; +import java.util.Collections; +import java.util.List; + +public class RadPropertyTable extends PropertyTable implements DataProvider, ComponentSelectionListener { + private final Project myProject; + + private EditableArea myArea; + private DesignerEditorPanel myDesigner; + private QuickFixManager myQuickFixManager; + private RadPropertyTablePanel myPropertyTablePanel; + + + public RadPropertyTable(@NotNull Project project) { + myProject = project; + + getSelectionModel().addListSelectionListener(new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { + if (myDesigner != null) { + myDesigner.setSelectionProperty(getSelectionProperty()); + } + if (myPropertyTablePanel != null) { + myPropertyTablePanel.updateActions(); + } + } + }); + + getModel().addTableModelListener(new TableModelListener() { + @Override + public void tableChanged(TableModelEvent e) { + if (myPropertyTablePanel != null) { + myPropertyTablePanel.updateActions(); + } + } + }); + } + + public void initQuickFixManager(JViewport viewPort) { + myQuickFixManager = new QuickFixManager(this, viewPort); + } + + public void setPropertyTablePanel(RadPropertyTablePanel propertyTablePanel) { + myPropertyTablePanel = propertyTablePanel; + } + + @Override + public Object getData(@NonNls String dataId) { + if (PlatformDataKeys.FILE_EDITOR.is(dataId) && myDesigner != null) { + return myDesigner.getEditor(); + } + return null; + } + + @Override + protected List getErrors(@NotNull PropertiesContainer container) { + return container instanceof RadComponent ? RadComponent.getError((RadComponent)container) : Collections.emptyList(); + } + + @NotNull + protected TextAttributesKey getErrorAttributes(@NotNull HighlightSeverity severity) { + return SeverityRegistrar.getInstance(myProject).getHighlightInfoTypeBySeverity(severity).getAttributesKey(); + } + + ////////////////////////////////////////////////////////////////////////////////////////// + // + // + // + ////////////////////////////////////////////////////////////////////////////////////////// + + public void setArea(@Nullable DesignerEditorPanel designer, @Nullable EditableArea area) { + myDesigner = designer; + myQuickFixManager.setDesigner(designer); + + if (myArea != null) { + myArea.removeSelectionListener(this); + } + + myArea = area; + + if (myArea != null) { + myArea.addSelectionListener(this); + } + + update(); + } + + @Override + public void selectionChanged(EditableArea area) { + update(); + } + + public void updateInspections() { + myQuickFixManager.update(); + } + + @Override + public void update() { + doUpdate(myArea.getSelection(), myDesigner.getSelectionProperty()); + } + + @Override + protected boolean doRestoreDefault(ThrowableRunnable runnable) { + return myDesigner.getToolProvider().execute(runnable, DesignerBundle.message("designer.properties.restore_default"), false); + } + + @Override + protected boolean doSetValue(ThrowableRunnable runnable) { + return myDesigner.getToolProvider().execute(runnable, DesignerBundle.message("command.set.property.value"), false); + } + + @Override + protected PropertyContext getPropertyContext() { + return myDesigner; + } +} diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTablePanel.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/RadPropertyTablePanel.java similarity index 92% rename from plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTablePanel.java rename to plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/RadPropertyTablePanel.java index 22da4ac5ab3a..a32dad9a44b6 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTablePanel.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/RadPropertyTablePanel.java @@ -19,6 +19,7 @@ import com.intellij.designer.DesignerBundle; import com.intellij.designer.propertyTable.actions.*; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.impl.ActionButton; +import com.intellij.openapi.project.Project; import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.PopupHandler; import com.intellij.ui.ScrollPaneFactory; @@ -32,11 +33,13 @@ import java.awt.*; /** * @author Alexander Lobas */ -public final class PropertyTablePanel extends JPanel implements ListSelectionListener { - private final PropertyTable myPropertyTable = new PropertyTable(); +public final class RadPropertyTablePanel extends JPanel implements ListSelectionListener { + private final RadPropertyTable myPropertyTable; private final AnAction[] myActions; - public PropertyTablePanel() { + public RadPropertyTablePanel(Project project) { + myPropertyTable = new RadPropertyTable(project); + setLayout(new GridBagLayout()); setBorder(IdeBorderFactory.createBorder(SideBorder.TOP)); @@ -86,7 +89,7 @@ public final class PropertyTablePanel extends JPanel implements ListSelectionLis myPropertyTable.setPropertyTablePanel(this); } - public PropertyTable getPropertyTable() { + public RadPropertyTable getPropertyTable() { return myPropertyTable; } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/RestoreDefault.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/RestoreDefault.java index 6ff644d0019a..54303b0e6b67 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/RestoreDefault.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/RestoreDefault.java @@ -16,8 +16,8 @@ package com.intellij.designer.propertyTable.actions; import com.intellij.designer.DesignerBundle; -import com.intellij.designer.propertyTable.Property; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.model.Property; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; @@ -27,9 +27,9 @@ import com.intellij.openapi.actionSystem.Presentation; * @author Alexander Lobas */ public class RestoreDefault extends AnAction implements IPropertyTableAction { - private final PropertyTable myTable; + private final RadPropertyTable myTable; - public RestoreDefault(PropertyTable table) { + public RestoreDefault(RadPropertyTable table) { myTable = table; Presentation presentation = getTemplatePresentation(); @@ -49,7 +49,7 @@ public class RestoreDefault extends AnAction implements IPropertyTableAction { setEnabled(myTable, getTemplatePresentation()); } - private static void setEnabled(PropertyTable table, Presentation presentation) { + private static void setEnabled(RadPropertyTable table, Presentation presentation) { try { Property property = table.getSelectionProperty(); presentation.setEnabled(property != null && !table.isDefault(property)); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowColumns.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowColumns.java index 034b9111bbee..d2c82ac245a8 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowColumns.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowColumns.java @@ -16,7 +16,7 @@ package com.intellij.designer.propertyTable.actions; import com.intellij.designer.DesignerBundle; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.actionSystem.ToggleAction; @@ -25,9 +25,9 @@ import com.intellij.openapi.actionSystem.ToggleAction; * @author Alexander Lobas */ public class ShowColumns extends ToggleAction { - private final PropertyTable myTable; + private final RadPropertyTable myTable; - public ShowColumns(PropertyTable table) { + public ShowColumns(RadPropertyTable table) { myTable = table; Presentation presentation = getTemplatePresentation(); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowExpert.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowExpert.java index d355dfdae8bb..d4c1894ab77c 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowExpert.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowExpert.java @@ -16,7 +16,7 @@ package com.intellij.designer.propertyTable.actions; import com.intellij.designer.DesignerBundle; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.openapi.actionSystem.ActionPlaces; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Presentation; @@ -31,9 +31,9 @@ import javax.swing.*; public class ShowExpert extends ToggleAction { private static final Icon ICON = IconLoader.getIcon("/com/intellij/designer/icons/filter.png"); - private final PropertyTable myTable; + private final RadPropertyTable myTable; - public ShowExpert(PropertyTable table) { + public ShowExpert(RadPropertyTable table) { myTable = table; Presentation presentation = getTemplatePresentation(); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowJavadoc.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowJavadoc.java index 150670bf138e..b0059e0a1684 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowJavadoc.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/actions/ShowJavadoc.java @@ -18,8 +18,8 @@ package com.intellij.designer.propertyTable.actions; import com.intellij.codeInsight.documentation.DocumentationComponent; import com.intellij.codeInsight.documentation.DocumentationManager; import com.intellij.designer.DesignerBundle; -import com.intellij.designer.propertyTable.Property; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.model.Property; +import com.intellij.designer.propertyTable.RadPropertyTable; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; @@ -41,9 +41,9 @@ import java.awt.*; * @author Alexander Lobas */ public class ShowJavadoc extends AnAction implements IPropertyTableAction { - private final PropertyTable myTable; + private final RadPropertyTable myTable; - public ShowJavadoc(PropertyTable table) { + public ShowJavadoc(RadPropertyTable table) { myTable = table; Presentation presentation = getTemplatePresentation(); @@ -63,7 +63,7 @@ public class ShowJavadoc extends AnAction implements IPropertyTableAction { setEnabled(myTable, getTemplatePresentation()); } - private static void setEnabled(PropertyTable table, Presentation presentation) { + private static void setEnabled(RadPropertyTable table, Presentation presentation) { Property property = table.getSelectionProperty(); presentation.setEnabled(property != null && (property.getJavadocElement() != null || !StringUtil.isEmpty(property.getJavadocText()))); } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/editors/BooleanEditor.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/editors/BooleanEditor.java index b069d777add7..984eb245e62f 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/editors/BooleanEditor.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/editors/BooleanEditor.java @@ -15,7 +15,8 @@ */ package com.intellij.designer.propertyTable.editors; -import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import com.intellij.designer.propertyTable.InplaceContext; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.util.ui.UIUtil; @@ -59,9 +60,8 @@ public class BooleanEditor extends PropertyEditor { } @NotNull - public JComponent getComponent(@NotNull RadComponent rootComponent, - @Nullable RadComponent component, - Object value, + public JComponent getComponent(@Nullable PropertiesContainer container, + @Nullable PropertyContext context, Object value, @Nullable InplaceContext inplaceContext) { try { myInsideChange = true; diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/editors/TextEditor.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/editors/TextEditor.java index 592a859cd72f..9bb6052b77cb 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/editors/TextEditor.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/editors/TextEditor.java @@ -15,7 +15,8 @@ */ package com.intellij.designer.propertyTable.editors; -import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import com.intellij.designer.propertyTable.InplaceContext; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.ui.DocumentAdapter; @@ -52,11 +53,10 @@ public class TextEditor extends PropertyEditor { @NotNull @Override - public JComponent getComponent(@NotNull RadComponent rootComponent, - @Nullable RadComponent component, - Object value, + public JComponent getComponent(@Nullable PropertiesContainer container, + @Nullable PropertyContext context, Object value, @Nullable InplaceContext inplaceContext) { - setEditorValue(component, value); + setEditorValue(value); if (inplaceContext == null) { myTextField.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); } @@ -79,7 +79,7 @@ public class TextEditor extends PropertyEditor { return myTextField.getText(); } - protected void setEditorValue(@Nullable RadComponent component, Object value) { + protected void setEditorValue(Object value) { myTextField.setText(value == null ? "" : value.toString()); } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/BooleanRenderer.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/BooleanRenderer.java index 9c156c01eae2..05c8dc28f84d 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/BooleanRenderer.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/BooleanRenderer.java @@ -15,9 +15,10 @@ */ package com.intellij.designer.propertyTable.renderers; -import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import com.intellij.designer.propertyTable.PropertyRenderer; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.propertyTable.RadPropertyTable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -29,8 +30,12 @@ import javax.swing.*; */ public class BooleanRenderer extends JCheckBox implements PropertyRenderer { @NotNull - public JComponent getComponent(@Nullable RadComponent component, @Nullable Object value, boolean selected, boolean hasFocus) { - PropertyTable.updateRenderer(this, selected); + public JComponent getComponent(@Nullable PropertiesContainer container, + PropertyContext context, + @Nullable Object value, + boolean selected, + boolean hasFocus) { + RadPropertyTable.updateRenderer(this, selected); setSelected(value != null && (Boolean)value); return this; } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/LabelPropertyRenderer.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/LabelPropertyRenderer.java index 4bdde0ee4aaa..4e3ebfdbeb0b 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/LabelPropertyRenderer.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/LabelPropertyRenderer.java @@ -15,9 +15,10 @@ */ package com.intellij.designer.propertyTable.renderers; -import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.PropertiesContainer; +import com.intellij.designer.model.PropertyContext; import com.intellij.designer.propertyTable.PropertyRenderer; -import com.intellij.designer.propertyTable.PropertyTable; +import com.intellij.designer.propertyTable.RadPropertyTable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -41,13 +42,17 @@ public class LabelPropertyRenderer extends JLabel implements PropertyRenderer { } @NotNull - public JComponent getComponent(@Nullable RadComponent component, @Nullable Object value, boolean selected, boolean hasFocus) { + public JComponent getComponent(@Nullable PropertiesContainer container, + PropertyContext context, + @Nullable Object value, + boolean selected, + boolean hasFocus) { // Reset text and icon setText(null); setIcon(null); // Background and foreground - PropertyTable.updateRenderer(this, selected); + RadPropertyTable.updateRenderer(this, selected); if (value != null) { customize(value);