Java 类com.intellij.uiDesigner.lw.LwInspectionSuppression 实例源码

项目:intellij-ce-playground    文件:ComponentTree.java   
public void deleteElement(@NotNull DataContext dataContext) {
  if (myEditor != null) {
    LwInspectionSuppression[] suppressions = LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY.getData(dataContext);
    if (suppressions != null) {
      if (!myEditor.ensureEditable()) return;
      for(LwInspectionSuppression suppression: suppressions) {
        myEditor.getRootContainer().removeInspectionSuppression(suppression);
      }
      myEditor.refreshAndSave(true);
    }
    else {
      DeleteProvider baseProvider = (DeleteProvider) myEditor.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getName());
      if (baseProvider != null) {
        baseProvider.deleteElement(dataContext);
      }
    }
  }
}
项目:tools-idea    文件:ComponentTree.java   
public void deleteElement(@NotNull DataContext dataContext) {
  if (myEditor != null) {
    LwInspectionSuppression[] suppressions = LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY.getData(dataContext);
    if (suppressions != null) {
      if (!myEditor.ensureEditable()) return;
      for(LwInspectionSuppression suppression: suppressions) {
        myEditor.getRootContainer().removeInspectionSuppression(suppression);
      }
      myEditor.refreshAndSave(true);
    }
    else {
      DeleteProvider baseProvider = (DeleteProvider) myEditor.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getName());
      if (baseProvider != null) {
        baseProvider.deleteElement(dataContext);
      }
    }
  }
}
项目:consulo-ui-designer    文件:ComponentTree.java   
@Override
public boolean canDeleteElement(@NotNull DataContext dataContext)
{
    if(myEditor != null)
    {
        LwInspectionSuppression[] suppressions = dataContext.getData(LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY);
        if(suppressions != null)
        {
            return true;
        }
        DeleteProvider baseProvider = myEditor.getDataUnchecked(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
        if(baseProvider != null)
        {
            return baseProvider.canDeleteElement(dataContext);
        }
    }
    return false;
}
项目:intellij-ce-playground    文件:RadRootContainer.java   
private void writeInspectionSuppressions(final XmlWriter writer) {
  if (myInspectionSuppressions.size() > 0) {
    writer.startElement(UIFormXmlConstants.ELEMENT_INSPECTION_SUPPRESSIONS);
    for(LwInspectionSuppression suppression: myInspectionSuppressions) {
      writer.startElement(UIFormXmlConstants.ELEMENT_SUPPRESS);
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_INSPECTION, suppression.getInspectionId());
      if (suppression.getComponentId() != null) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_ID, suppression.getComponentId());
      }
      writer.endElement();
    }
    writer.endElement();
  }
}
项目:intellij-ce-playground    文件:RadRootContainer.java   
public void suppressInspection(String inspectionId, @Nullable RadComponent component) {
  for(int i=myInspectionSuppressions.size()-1; i >= 0; i--) {
    LwInspectionSuppression suppression = myInspectionSuppressions.get(i);
    if (suppression.getInspectionId().equals(inspectionId)) {
      if (component != null && (component.getId().equals(suppression.getComponentId()) || suppression.getComponentId() == null)) {
        return;
      }
      if (component == null && suppression.getComponentId() != null) {
        myInspectionSuppressions.remove(i);
      }
    }
  }
  myInspectionSuppressions.add(new LwInspectionSuppression(inspectionId, component == null ? null : component.getId()));
}
项目:intellij-ce-playground    文件:RadRootContainer.java   
public boolean isInspectionSuppressed(final String inspectionId, final String componentId) {
  for(LwInspectionSuppression suppression: myInspectionSuppressions) {
    if ((suppression.getComponentId() == null || suppression.getComponentId().equals(componentId)) &&
        suppression.getInspectionId().equals(inspectionId)) {
      return true;
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:RadRootContainer.java   
public void removeInspectionSuppression(final LwInspectionSuppression suppression) {
  for(LwInspectionSuppression existing: myInspectionSuppressions) {
    if (existing.getInspectionId().equals(suppression.getInspectionId()) &&
      Comparing.equal(existing.getComponentId(), suppression.getComponentId())) {
      myInspectionSuppressions.remove(existing);
      break;
    }
  }
}
项目:intellij-ce-playground    文件:ComponentTreeStructure.java   
public Object getParentElement(final Object element){
  if (element instanceof ComponentTreeStructureRoot) {
    return null;
  }
  else if (element instanceof LwInspectionSuppression[] || element instanceof RadButtonGroup[]) {
    return myRootElement;
  }
  else if (element instanceof LwInspectionSuppression) {
    return myEditor.getRootContainer().getInspectionSuppressions();
  }
  else if (element instanceof RadButtonGroup) {
    return myEditor.getRootContainer().getButtonGroups();
  }
  else if (element instanceof ComponentPtr) { // RadContainer is also RadComponent
    final ComponentPtr ptr = (ComponentPtr)element;
    if (!ptr.isValid()) return myRootElement;
    final RadComponent component = ptr.getComponent();
    if (component instanceof RadRootContainer) {
      return myRootElement;
    }
    else {
      return component.getParent() != null ? new ComponentPtr(myEditor, component.getParent(), false) : null;
    }
  }
  else {
    throw new IllegalArgumentException("unknown element: " + element);
  }
}
项目:intellij-ce-playground    文件:ComponentTreeStructure.java   
@NotNull
public NodeDescriptor createDescriptor(final Object element,final NodeDescriptor parentDescriptor){
  if(element==myRootElement){
    return new RootDescriptor(parentDescriptor,myRootElement);
  }
  else if(element instanceof ComponentPtr){
    return new ComponentPtrDescriptor(parentDescriptor,(ComponentPtr)element);
  }
  else if (element instanceof LwInspectionSuppression[]) {
    return new SuppressionGroupDescriptor(parentDescriptor, (LwInspectionSuppression[]) element);
  }
  else if (element instanceof LwInspectionSuppression) {
    final LwInspectionSuppression suppression = (LwInspectionSuppression)element;
    RadComponent target = (RadComponent)(suppression.getComponentId() == null
                                         ? null
                                         : FormEditingUtil.findComponent(myEditor.getRootContainer(), suppression.getComponentId()));
    return new SuppressionDescriptor(parentDescriptor, target, suppression);
  }
  else if (element instanceof RadButtonGroup[]) {
    return new ButtonGroupListDescriptor(parentDescriptor, (RadButtonGroup[]) element);
  }
  else if (element instanceof RadButtonGroup) {
    return new ButtonGroupDescriptor(parentDescriptor, (RadButtonGroup) element);
  }
  else{
    throw new IllegalArgumentException("unknown element: "+element);
  }
}
项目:intellij-ce-playground    文件:ComponentTree.java   
public boolean canDeleteElement(@NotNull DataContext dataContext) {
  if (myEditor != null) {
    LwInspectionSuppression[] suppressions = LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY.getData(dataContext);
    if (suppressions != null) {
      return true;
    }
    DeleteProvider baseProvider = (DeleteProvider) myEditor.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getName());
    if (baseProvider != null) {
      return baseProvider.canDeleteElement(dataContext);
    }
  }
  return false;
}
项目:tools-idea    文件:RadRootContainer.java   
private void writeInspectionSuppressions(final XmlWriter writer) {
  if (myInspectionSuppressions.size() > 0) {
    writer.startElement(UIFormXmlConstants.ELEMENT_INSPECTION_SUPPRESSIONS);
    for(LwInspectionSuppression suppression: myInspectionSuppressions) {
      writer.startElement(UIFormXmlConstants.ELEMENT_SUPPRESS);
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_INSPECTION, suppression.getInspectionId());
      if (suppression.getComponentId() != null) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_ID, suppression.getComponentId());
      }
      writer.endElement();
    }
    writer.endElement();
  }
}
项目:tools-idea    文件:RadRootContainer.java   
public void suppressInspection(String inspectionId, @Nullable RadComponent component) {
  for(int i=myInspectionSuppressions.size()-1; i >= 0; i--) {
    LwInspectionSuppression suppression = myInspectionSuppressions.get(i);
    if (suppression.getInspectionId().equals(inspectionId)) {
      if (component != null && (component.getId().equals(suppression.getComponentId()) || suppression.getComponentId() == null)) {
        return;
      }
      if (component == null && suppression.getComponentId() != null) {
        myInspectionSuppressions.remove(i);
      }
    }
  }
  myInspectionSuppressions.add(new LwInspectionSuppression(inspectionId, component == null ? null : component.getId()));
}
项目:tools-idea    文件:RadRootContainer.java   
public boolean isInspectionSuppressed(final String inspectionId, final String componentId) {
  for(LwInspectionSuppression suppression: myInspectionSuppressions) {
    if ((suppression.getComponentId() == null || suppression.getComponentId().equals(componentId)) &&
        suppression.getInspectionId().equals(inspectionId)) {
      return true;
    }
  }
  return false;
}
项目:tools-idea    文件:RadRootContainer.java   
public void removeInspectionSuppression(final LwInspectionSuppression suppression) {
  for(LwInspectionSuppression existing: myInspectionSuppressions) {
    if (existing.getInspectionId().equals(suppression.getInspectionId()) &&
      Comparing.equal(existing.getComponentId(), suppression.getComponentId())) {
      myInspectionSuppressions.remove(existing);
      break;
    }
  }
}
项目:tools-idea    文件:ComponentTreeStructure.java   
public Object getParentElement(final Object element){
  if (element instanceof ComponentTreeStructureRoot) {
    return null;
  }
  else if (element instanceof LwInspectionSuppression[] || element instanceof RadButtonGroup[]) {
    return myRootElement;
  }
  else if (element instanceof LwInspectionSuppression) {
    return myEditor.getRootContainer().getInspectionSuppressions();
  }
  else if (element instanceof RadButtonGroup) {
    return myEditor.getRootContainer().getButtonGroups();
  }
  else if (element instanceof ComponentPtr) { // RadContainer is also RadComponent
    final ComponentPtr ptr = (ComponentPtr)element;
    if (!ptr.isValid()) return myRootElement;
    final RadComponent component = ptr.getComponent();
    if (component instanceof RadRootContainer) {
      return myRootElement;
    }
    else {
      return component.getParent() != null ? new ComponentPtr(myEditor, component.getParent(), false) : null;
    }
  }
  else {
    throw new IllegalArgumentException("unknown element: " + element);
  }
}
项目:tools-idea    文件:ComponentTreeStructure.java   
@NotNull
public NodeDescriptor createDescriptor(final Object element,final NodeDescriptor parentDescriptor){
  if(element==myRootElement){
    return new RootDescriptor(parentDescriptor,myRootElement);
  }
  else if(element instanceof ComponentPtr){
    return new ComponentPtrDescriptor(parentDescriptor,(ComponentPtr)element);
  }
  else if (element instanceof LwInspectionSuppression[]) {
    return new SuppressionGroupDescriptor(parentDescriptor, (LwInspectionSuppression[]) element);
  }
  else if (element instanceof LwInspectionSuppression) {
    final LwInspectionSuppression suppression = (LwInspectionSuppression)element;
    RadComponent target = (RadComponent)(suppression.getComponentId() == null
                                         ? null
                                         : FormEditingUtil.findComponent(myEditor.getRootContainer(), suppression.getComponentId()));
    return new SuppressionDescriptor(parentDescriptor, target, suppression);
  }
  else if (element instanceof RadButtonGroup[]) {
    return new ButtonGroupListDescriptor(parentDescriptor, (RadButtonGroup[]) element);
  }
  else if (element instanceof RadButtonGroup) {
    return new ButtonGroupDescriptor(parentDescriptor, (RadButtonGroup) element);
  }
  else{
    throw new IllegalArgumentException("unknown element: "+element);
  }
}
项目:tools-idea    文件:ComponentTree.java   
public boolean canDeleteElement(@NotNull DataContext dataContext) {
  if (myEditor != null) {
    LwInspectionSuppression[] suppressions = LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY.getData(dataContext);
    if (suppressions != null) {
      return true;
    }
    DeleteProvider baseProvider = (DeleteProvider) myEditor.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getName());
    if (baseProvider != null) {
      return baseProvider.canDeleteElement(dataContext);
    }
  }
  return false;
}
项目:consulo-ui-designer    文件:RadRootContainer.java   
private void writeInspectionSuppressions(final XmlWriter writer) {
  if (myInspectionSuppressions.size() > 0) {
    writer.startElement(UIFormXmlConstants.ELEMENT_INSPECTION_SUPPRESSIONS);
    for(LwInspectionSuppression suppression: myInspectionSuppressions) {
      writer.startElement(UIFormXmlConstants.ELEMENT_SUPPRESS);
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_INSPECTION, suppression.getInspectionId());
      if (suppression.getComponentId() != null) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_ID, suppression.getComponentId());
      }
      writer.endElement();
    }
    writer.endElement();
  }
}
项目:consulo-ui-designer    文件:RadRootContainer.java   
public void suppressInspection(String inspectionId, @Nullable RadComponent component) {
  for(int i=myInspectionSuppressions.size()-1; i >= 0; i--) {
    LwInspectionSuppression suppression = myInspectionSuppressions.get(i);
    if (suppression.getInspectionId().equals(inspectionId)) {
      if (component != null && (component.getId().equals(suppression.getComponentId()) || suppression.getComponentId() == null)) {
        return;
      }
      if (component == null && suppression.getComponentId() != null) {
        myInspectionSuppressions.remove(i);
      }
    }
  }
  myInspectionSuppressions.add(new LwInspectionSuppression(inspectionId, component == null ? null : component.getId()));
}
项目:consulo-ui-designer    文件:RadRootContainer.java   
public boolean isInspectionSuppressed(final String inspectionId, final String componentId) {
  for(LwInspectionSuppression suppression: myInspectionSuppressions) {
    if ((suppression.getComponentId() == null || suppression.getComponentId().equals(componentId)) &&
        suppression.getInspectionId().equals(inspectionId)) {
      return true;
    }
  }
  return false;
}
项目:consulo-ui-designer    文件:RadRootContainer.java   
public void removeInspectionSuppression(final LwInspectionSuppression suppression) {
  for(LwInspectionSuppression existing: myInspectionSuppressions) {
    if (existing.getInspectionId().equals(suppression.getInspectionId()) &&
      Comparing.equal(existing.getComponentId(), suppression.getComponentId())) {
      myInspectionSuppressions.remove(existing);
      break;
    }
  }
}
项目:consulo-ui-designer    文件:ComponentTreeStructure.java   
public Object getParentElement(final Object element){
  if (element instanceof ComponentTreeStructureRoot) {
    return null;
  }
  else if (element instanceof LwInspectionSuppression[] || element instanceof RadButtonGroup[]) {
    return myRootElement;
  }
  else if (element instanceof LwInspectionSuppression) {
    return myEditor.getRootContainer().getInspectionSuppressions();
  }
  else if (element instanceof RadButtonGroup) {
    return myEditor.getRootContainer().getButtonGroups();
  }
  else if (element instanceof ComponentPtr) { // RadContainer is also RadComponent
    final ComponentPtr ptr = (ComponentPtr)element;
    if (!ptr.isValid()) return myRootElement;
    final RadComponent component = ptr.getComponent();
    if (component instanceof RadRootContainer) {
      return myRootElement;
    }
    else {
      return component.getParent() != null ? new ComponentPtr(myEditor, component.getParent(), false) : null;
    }
  }
  else {
    throw new IllegalArgumentException("unknown element: " + element);
  }
}
项目:consulo-ui-designer    文件:ComponentTreeStructure.java   
@NotNull
public NodeDescriptor createDescriptor(final Object element,final NodeDescriptor parentDescriptor){
  if(element==myRootElement){
    return new RootDescriptor(parentDescriptor,myRootElement);
  }
  else if(element instanceof ComponentPtr){
    return new ComponentPtrDescriptor(parentDescriptor,(ComponentPtr)element);
  }
  else if (element instanceof LwInspectionSuppression[]) {
    return new SuppressionGroupDescriptor(parentDescriptor, (LwInspectionSuppression[]) element);
  }
  else if (element instanceof LwInspectionSuppression) {
    final LwInspectionSuppression suppression = (LwInspectionSuppression)element;
    RadComponent target = (RadComponent)(suppression.getComponentId() == null
                                         ? null
                                         : FormEditingUtil.findComponent(myEditor.getRootContainer(), suppression.getComponentId()));
    return new SuppressionDescriptor(parentDescriptor, target, suppression);
  }
  else if (element instanceof RadButtonGroup[]) {
    return new ButtonGroupListDescriptor(parentDescriptor, (RadButtonGroup[]) element);
  }
  else if (element instanceof RadButtonGroup) {
    return new ButtonGroupDescriptor(parentDescriptor, (RadButtonGroup) element);
  }
  else{
    throw new IllegalArgumentException("unknown element: "+element);
  }
}
项目:consulo-ui-designer    文件:ComponentTree.java   
@Override
public void deleteElement(@NotNull DataContext dataContext)
{
    if(myEditor != null)
    {
        LwInspectionSuppression[] suppressions = dataContext.getData(LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY);
        if(suppressions != null)
        {
            if(!myEditor.ensureEditable())
            {
                return;
            }
            for(LwInspectionSuppression suppression : suppressions)
            {
                myEditor.getRootContainer().removeInspectionSuppression(suppression);
            }
            myEditor.refreshAndSave(true);
        }
        else
        {
            DeleteProvider baseProvider = myEditor.getDataUnchecked(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
            if(baseProvider != null)
            {
                baseProvider.deleteElement(dataContext);
            }
        }
    }
}
项目:intellij-ce-playground    文件:RadRootContainer.java   
public LwInspectionSuppression[] getInspectionSuppressions() {
  return myInspectionSuppressions.toArray(new LwInspectionSuppression[myInspectionSuppressions.size()]);
}
项目:intellij-ce-playground    文件:RadRootContainer.java   
public void setInspectionSuppressions(final LwInspectionSuppression[] inspectionSuppressions) {
  myInspectionSuppressions.clear();
  Collections.addAll(myInspectionSuppressions, inspectionSuppressions);
}
项目:intellij-ce-playground    文件:ComponentTreeStructure.java   
public Object[] getChildElements(final Object element){
  if(element==myRootElement){
    ArrayList<Object> elements = new ArrayList<Object>();
    final RadRootContainer rootContainer=myEditor.getRootContainer();
    elements.add(new ComponentPtr(myEditor, rootContainer));
    final LwInspectionSuppression[] suppressions = rootContainer.getInspectionSuppressions();
    if (suppressions.length > 0) {
      elements.add(suppressions);
    }
    RadButtonGroup[] buttonGroups = rootContainer.getButtonGroups();
    if (buttonGroups.length > 0) {
      elements.add(buttonGroups);
    }
    return elements.toArray();
  }
  else if(element instanceof ComponentPtr){
    final ComponentPtr ptr=(ComponentPtr)element;
    LOG.assertTrue(ptr.isValid()); // pointer must be valid
    final RadComponent component=ptr.getComponent();
    if(component instanceof RadContainer){
      final RadContainer container=(RadContainer)component;
      final ComponentPtr[] ptrs=new ComponentPtr[container.getComponentCount()];
      for(int i=0;i<ptrs.length;i++){
        ptrs[i]=new ComponentPtr(myEditor,container.getComponent(i));
      }
      return ptrs;
    }else{
      return ourEmptyObjectArray;
    }
  }
  else if (element instanceof LwInspectionSuppression[]) {
    ArrayList<LwInspectionSuppression> result = new ArrayList<LwInspectionSuppression>();
    for(LwInspectionSuppression suppression: (LwInspectionSuppression[]) element) {
      if (suppression.getComponentId() == null ||
        FormEditingUtil.findComponent(myEditor.getRootContainer(), suppression.getComponentId()) != null) {
        result.add(suppression);
      }
    }
    return ArrayUtil.toObjectArray(result);
  }
  else if (element instanceof RadButtonGroup[]) {
    return (RadButtonGroup[]) element;
  }
  else if (element instanceof LwInspectionSuppression || element instanceof RadButtonGroup) {
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
  }
  else{
    throw new IllegalArgumentException("unknown element: "+element);
  }
}
项目:intellij-ce-playground    文件:SuppressionDescriptor.java   
public SuppressionDescriptor(final NodeDescriptor parentDescriptor, final RadComponent target, final LwInspectionSuppression inspectionSuppression) {
  super(null, parentDescriptor);
  myTarget = target;
  myInspectionSuppression = inspectionSuppression;
}
项目:intellij-ce-playground    文件:SuppressionDescriptor.java   
public LwInspectionSuppression getSuppression() {
  return myInspectionSuppression;
}
项目:intellij-ce-playground    文件:ComponentTree.java   
/**
 * Provides {@link PlatformDataKeys#NAVIGATABLE} to navigate to
 * binding of currently selected component (if any)
 */
public Object getData(final String dataId) {
  if (GuiEditor.DATA_KEY.is(dataId)) {
    return myEditor;
  }

  if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
    return myDeleteProvider;
  }

  if (PlatformDataKeys.COPY_PROVIDER.is(dataId) ||
      PlatformDataKeys.CUT_PROVIDER.is(dataId) ||
      PlatformDataKeys.PASTE_PROVIDER.is(dataId)) {
    return myEditor == null ? null : myEditor.getData(dataId);
  }

  if (LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY.is(dataId)) {
    Collection<LwInspectionSuppression> elements = getSelectedElements(LwInspectionSuppression.class);
    return elements.size() == 0 ? null : elements.toArray(new LwInspectionSuppression[elements.size()]);
  }

  if (PlatformDataKeys.HELP_ID.is(dataId)) {
    return ourHelpID;
  }

  if (PlatformDataKeys.FILE_EDITOR.is(dataId)) {
    return myFormEditor;
  }

  if (!CommonDataKeys.NAVIGATABLE.is(dataId)) {
    return null;
  }

  final RadComponent selectedComponent = getSelectedComponent();
  if (selectedComponent == null) {
    return null;
  }

  final String classToBind = myEditor.getRootContainer().getClassToBind();
  if (classToBind == null) {
    return null;
  }

  final PsiClass aClass = FormEditingUtil.findClassToBind(myEditor.getModule(), classToBind);
  if (aClass == null) {
    return null;
  }

  if (selectedComponent instanceof RadRootContainer) {
    return EditSourceUtil.getDescriptor(aClass);
  }

  final String binding = selectedComponent.getBinding();
  if (binding == null) {
    return null;
  }

  final PsiField[] fields = aClass.getFields();

  for (final PsiField field : fields) {
    if (binding.equals(field.getName())) {
      return EditSourceUtil.getDescriptor(field);
    }
  }

  return null;
}
项目:intellij-ce-playground    文件:SuppressionGroupDescriptor.java   
public SuppressionGroupDescriptor(final NodeDescriptor parentDescriptor, final LwInspectionSuppression[] lwInspectionSuppressions) {
  super(null, parentDescriptor);
  myInspectionSuppressions = lwInspectionSuppressions;
}
项目:tools-idea    文件:RadRootContainer.java   
public LwInspectionSuppression[] getInspectionSuppressions() {
  return myInspectionSuppressions.toArray(new LwInspectionSuppression[myInspectionSuppressions.size()]);
}
项目:tools-idea    文件:RadRootContainer.java   
public void setInspectionSuppressions(final LwInspectionSuppression[] inspectionSuppressions) {
  myInspectionSuppressions.clear();
  Collections.addAll(myInspectionSuppressions, inspectionSuppressions);
}
项目:tools-idea    文件:ComponentTreeStructure.java   
public Object[] getChildElements(final Object element){
  if(element==myRootElement){
    ArrayList<Object> elements = new ArrayList<Object>();
    final RadRootContainer rootContainer=myEditor.getRootContainer();
    elements.add(new ComponentPtr(myEditor, rootContainer));
    final LwInspectionSuppression[] suppressions = rootContainer.getInspectionSuppressions();
    if (suppressions.length > 0) {
      elements.add(suppressions);
    }
    RadButtonGroup[] buttonGroups = rootContainer.getButtonGroups();
    if (buttonGroups.length > 0) {
      elements.add(buttonGroups);
    }
    return elements.toArray();
  }
  else if(element instanceof ComponentPtr){
    final ComponentPtr ptr=(ComponentPtr)element;
    LOG.assertTrue(ptr.isValid()); // pointer must be valid
    final RadComponent component=ptr.getComponent();
    if(component instanceof RadContainer){
      final RadContainer container=(RadContainer)component;
      final ComponentPtr[] ptrs=new ComponentPtr[container.getComponentCount()];
      for(int i=0;i<ptrs.length;i++){
        ptrs[i]=new ComponentPtr(myEditor,container.getComponent(i));
      }
      return ptrs;
    }else{
      return ourEmptyObjectArray;
    }
  }
  else if (element instanceof LwInspectionSuppression[]) {
    ArrayList<LwInspectionSuppression> result = new ArrayList<LwInspectionSuppression>();
    for(LwInspectionSuppression suppression: (LwInspectionSuppression[]) element) {
      if (suppression.getComponentId() == null ||
        FormEditingUtil.findComponent(myEditor.getRootContainer(), suppression.getComponentId()) != null) {
        result.add(suppression);
      }
    }
    return ArrayUtil.toObjectArray(result);
  }
  else if (element instanceof RadButtonGroup[]) {
    return (RadButtonGroup[]) element;
  }
  else if (element instanceof LwInspectionSuppression || element instanceof RadButtonGroup) {
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
  }
  else{
    throw new IllegalArgumentException("unknown element: "+element);
  }
}
项目:tools-idea    文件:SuppressionDescriptor.java   
public SuppressionDescriptor(final NodeDescriptor parentDescriptor, final RadComponent target, final LwInspectionSuppression inspectionSuppression) {
  super(null, parentDescriptor);
  myTarget = target;
  myInspectionSuppression = inspectionSuppression;
}
项目:tools-idea    文件:SuppressionDescriptor.java   
public LwInspectionSuppression getSuppression() {
  return myInspectionSuppression;
}
项目:tools-idea    文件:ComponentTree.java   
/**
 * Provides {@link PlatformDataKeys#NAVIGATABLE} to navigate to
 * binding of currently selected component (if any)
 */
public Object getData(final String dataId) {
  if (GuiEditor.DATA_KEY.is(dataId)) {
    return myEditor;
  }

  if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
    return myDeleteProvider;
  }

  if (PlatformDataKeys.COPY_PROVIDER.is(dataId) ||
      PlatformDataKeys.CUT_PROVIDER.is(dataId) ||
      PlatformDataKeys.PASTE_PROVIDER.is(dataId)) {
    return myEditor == null ? null : myEditor.getData(dataId);
  }

  if (LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY.is(dataId)) {
    Collection<LwInspectionSuppression> elements = getSelectedElements(LwInspectionSuppression.class);
    return elements.size() == 0 ? null : elements.toArray(new LwInspectionSuppression[elements.size()]);
  }

  if (PlatformDataKeys.HELP_ID.is(dataId)) {
    return ourHelpID;
  }

  if (PlatformDataKeys.FILE_EDITOR.is(dataId)) {
    return myFormEditor;
  }

  if (!PlatformDataKeys.NAVIGATABLE.is(dataId)) {
    return null;
  }

  final RadComponent selectedComponent = getSelectedComponent();
  if (selectedComponent == null) {
    return null;
  }

  final String classToBind = myEditor.getRootContainer().getClassToBind();
  if (classToBind == null) {
    return null;
  }

  final PsiClass aClass = FormEditingUtil.findClassToBind(myEditor.getModule(), classToBind);
  if (aClass == null) {
    return null;
  }

  if (selectedComponent instanceof RadRootContainer) {
    return EditSourceUtil.getDescriptor(aClass);
  }

  final String binding = selectedComponent.getBinding();
  if (binding == null) {
    return null;
  }

  final PsiField[] fields = aClass.getFields();

  for (final PsiField field : fields) {
    if (binding.equals(field.getName())) {
      return EditSourceUtil.getDescriptor(field);
    }
  }

  return null;
}
项目:tools-idea    文件:SuppressionGroupDescriptor.java   
public SuppressionGroupDescriptor(final NodeDescriptor parentDescriptor, final LwInspectionSuppression[] lwInspectionSuppressions) {
  super(null, parentDescriptor);
  myInspectionSuppressions = lwInspectionSuppressions;
}
项目:consulo-ui-designer    文件:RadRootContainer.java   
public LwInspectionSuppression[] getInspectionSuppressions() {
  return myInspectionSuppressions.toArray(new LwInspectionSuppression[myInspectionSuppressions.size()]);
}
项目:consulo-ui-designer    文件:RadRootContainer.java   
public void setInspectionSuppressions(final LwInspectionSuppression[] inspectionSuppressions) {
  myInspectionSuppressions.clear();
  Collections.addAll(myInspectionSuppressions, inspectionSuppressions);
}