Пример #1
0
  public boolean restoreSelection(TreeSelection treeSelection) {
    if (treeSelection.isEmpty()) return false;

    DefaultMutableTreeNode root = (DefaultMutableTreeNode) myTreeModel.getRoot();
    for (int i = 0; i < root.getChildCount(); i++) {
      TreeNode node = root.getChildAt(i);
      if (node instanceof MessageNode) {
        MessageNode messageNode = (MessageNode) node;
        String[] text = messageNode.getText();
        if (text.length == 0) continue;
        if (Comparing.equal(treeSelection.mySelectedTarget, text[0])) {
          TreePath pathToSelect = new TreePath(messageNode.getPath());
          for (Enumeration enumeration = messageNode.children(); enumeration.hasMoreElements(); ) {
            Object o = enumeration.nextElement();
            if (o instanceof MessageNode) {
              messageNode = (MessageNode) o;
              if (Comparing.equal(treeSelection.mySelectedTask, text[0])) {
                pathToSelect = new TreePath(messageNode.getPath());
                break;
              }
            }
          }
          TreeUtil.selectPath(myTree, pathToSelect);
          myTree.expandPath(pathToSelect);
          return true;
        }
      }
    }

    return false;
  }
Пример #2
0
  private static VirtualFile[] copyFiles(
      final VirtualFile[] fromFiles, final VirtualFile toDir, VirtualFile rawProjectRoot)
      throws IOException {
    final VirtualFile[] toFiles = new VirtualFile[fromFiles.length];
    final boolean rootSpecified = rawProjectRoot != null;
    for (int i = 0, n = fromFiles.length; i < n; i++) {
      VirtualFile fromFile = fromFiles[i];
      VirtualFile toP = toDir;
      if (rootSpecified) {
        final List<String> fromParents = new ArrayList<>(4);
        VirtualFile fromP = fromFile.getParent();
        if (!Comparing.equal(fromP, rawProjectRoot)) {
          do {
            fromParents.add(fromP.getName());
          } while (!Comparing.equal((fromP = fromP.getParent()), rawProjectRoot));

          for (int j = fromParents.size() - 1; j >= 0; j--) {
            toP = toP.createChildDirectory(null, fromParents.get(j));
          }
        }
      }
      final VirtualFile toFile = toP.createChildData(null, fromFile.getName());
      toFile.setBinaryContent(fromFile.contentsToByteArray());
      toFiles[i] = toFile;
    }

    return toFiles;
  }
  @Override
  public boolean isConfigurationFromContext(
      JUnitConfiguration unitConfiguration, ConfigurationContext context) {
    if (RunConfigurationProducer.getInstance(PatternConfigurationProducer.class)
        .isMultipleElementsSelected(context)) {
      return false;
    }
    final RunConfiguration predefinedConfiguration =
        context.getOriginalConfiguration(JUnitConfigurationType.getInstance());
    final Location contextLocation = context.getLocation();

    String paramSetName =
        contextLocation instanceof PsiMemberParameterizedLocation
            ? ((PsiMemberParameterizedLocation) contextLocation).getParamSetName()
            : null;
    assert contextLocation != null;
    Location location = JavaExecutionUtil.stepIntoSingleClass(contextLocation);
    if (location == null) {
      return false;
    }
    final PsiElement element = location.getPsiElement();
    final PsiClass testClass = JUnitUtil.getTestClass(element);
    final PsiMethod testMethod = JUnitUtil.getTestMethod(element, false);
    final PsiPackage testPackage;
    if (element instanceof PsiPackage) {
      testPackage = (PsiPackage) element;
    } else if (element instanceof PsiDirectory) {
      testPackage = JavaDirectoryService.getInstance().getPackage(((PsiDirectory) element));
    } else {
      testPackage = null;
    }
    PsiDirectory testDir = element instanceof PsiDirectory ? (PsiDirectory) element : null;
    RunnerAndConfigurationSettings template =
        RunManager.getInstance(location.getProject())
            .getConfigurationTemplate(getConfigurationFactory());
    final Module predefinedModule =
        ((JUnitConfiguration) template.getConfiguration()).getConfigurationModule().getModule();
    final String vmParameters =
        predefinedConfiguration instanceof JUnitConfiguration
            ? ((JUnitConfiguration) predefinedConfiguration).getVMParameters()
            : null;

    if (vmParameters != null
        && !Comparing.strEqual(vmParameters, unitConfiguration.getVMParameters())) return false;
    if (paramSetName != null
        && !Comparing.strEqual(paramSetName, unitConfiguration.getProgramParameters()))
      return false;
    final TestObject testobject = unitConfiguration.getTestObject();
    if (testobject != null) {
      if (testobject.isConfiguredByElement(
          unitConfiguration, testClass, testMethod, testPackage, testDir)) {
        final Module configurationModule = unitConfiguration.getConfigurationModule().getModule();
        if (Comparing.equal(location.getModule(), configurationModule)) return true;
        if (Comparing.equal(predefinedModule, configurationModule)) {
          return true;
        }
      }
    }
    return false;
  }
  public boolean isModified() {
    boolean isModified = false;
    HttpConfigurable httpConfigurable = myHttpConfigurable;
    if (!Comparing.equal(myProxyExceptions.getText().trim(), httpConfigurable.PROXY_EXCEPTIONS))
      return true;
    isModified |= httpConfigurable.USE_PROXY_PAC != myAutoDetectProxyRb.isSelected();
    isModified |= httpConfigurable.USE_PAC_URL != myPacUrlCheckBox.isSelected();
    isModified |= !Comparing.strEqual(httpConfigurable.PAC_URL, myPacUrlTextField.getText());
    isModified |= httpConfigurable.USE_HTTP_PROXY != myUseHTTPProxyRb.isSelected();
    isModified |= httpConfigurable.PROXY_AUTHENTICATION != myProxyAuthCheckBox.isSelected();
    isModified |=
        httpConfigurable.KEEP_PROXY_PASSWORD != myRememberProxyPasswordCheckBox.isSelected();
    isModified |= httpConfigurable.PROXY_TYPE_IS_SOCKS != mySocks.isSelected();

    isModified |=
        !Comparing.strEqual(httpConfigurable.PROXY_LOGIN, myProxyLoginTextField.getText());
    isModified |=
        !Comparing.strEqual(
            httpConfigurable.getPlainProxyPassword(),
            new String(myProxyPasswordTextField.getPassword()));

    try {
      isModified |=
          httpConfigurable.PROXY_PORT != Integer.valueOf(myProxyPortTextField.getText()).intValue();
    } catch (NumberFormatException e) {
      isModified = true;
    }
    isModified |= !Comparing.strEqual(httpConfigurable.PROXY_HOST, myProxyHostTextField.getText());
    return isModified;
  }
 @Override
 protected RunnerAndConfigurationSettings findExistingByElement(
     Location location,
     @NotNull RunnerAndConfigurationSettings[] existingConfigurations,
     ConfigurationContext context) {
   final PsiClass aClass = ApplicationConfigurationType.getMainClass(location.getPsiElement());
   if (aClass == null) {
     return null;
   }
   final Module predefinedModule =
       ((ApplicationConfiguration)
               ((RunManagerImpl) RunManagerEx.getInstanceEx(location.getProject()))
                   .getConfigurationTemplate(getConfigurationFactory())
                   .getConfiguration())
           .getConfigurationModule()
           .getModule();
   for (RunnerAndConfigurationSettings existingConfiguration : existingConfigurations) {
     final ApplicationConfiguration appConfiguration =
         (ApplicationConfiguration) existingConfiguration.getConfiguration();
     if (Comparing.equal(
         JavaExecutionUtil.getRuntimeQualifiedName(aClass), appConfiguration.MAIN_CLASS_NAME)) {
       if (Comparing.equal(
           location.getModule(), appConfiguration.getConfigurationModule().getModule())) {
         return existingConfiguration;
       }
       final Module configurationModule = appConfiguration.getConfigurationModule().getModule();
       if (Comparing.equal(location.getModule(), configurationModule))
         return existingConfiguration;
       if (Comparing.equal(predefinedModule, configurationModule)) {
         return existingConfiguration;
       }
     }
   }
   return null;
 }
Пример #6
0
 public boolean equals(Object object) {
   if (!(object instanceof TextWithImportsImpl)) {
     return false;
   }
   TextWithImportsImpl item = ((TextWithImportsImpl) object);
   return Comparing.equal(item.myText, myText) && Comparing.equal(item.myImports, myImports);
 }
 public boolean isModified() {
   return myManifestFileConfiguration != null
       && (!myManifestFileConfiguration.getClasspath().equals(getConfiguredClasspath())
           || !Comparing.equal(
               myManifestFileConfiguration.getMainClass(), getConfiguredMainClass())
           || !Comparing.equal(
               myManifestFileConfiguration.getManifestFilePath(), getConfiguredManifestPath()));
 }
 public boolean isModified() {
   if (myProperties.isEnabled() != myRunTargetCheckBox.isSelected()) return true;
   if (myTarget == null) {
     return myProperties.getFileUrl() != null;
   }
   if (!Comparing.equal(myTarget.getName(), myProperties.getTargetName())) return true;
   final VirtualFile file = myTarget.getModel().getBuildFile().getVirtualFile();
   return file != null && !Comparing.equal(file.getUrl(), myProperties.getFileUrl());
 }
 public static boolean isRoot(PsiFileSystemItem directory) {
   if (directory == null) return true;
   VirtualFile vFile = directory.getVirtualFile();
   if (vFile == null) return true;
   ProjectFileIndex fileIndex = ProjectFileIndex.SERVICE.getInstance(directory.getProject());
   return Comparing.equal(fileIndex.getClassRootForFile(vFile), vFile)
       || Comparing.equal(fileIndex.getContentRootForFile(vFile), vFile)
       || Comparing.equal(fileIndex.getSourceRootForFile(vFile), vFile);
 }
 public boolean equals(Object o) {
   if (o instanceof StructureViewTreeElementWrapper) {
     return Comparing.equal(
         unwrapValue(getValue()), unwrapValue(((StructureViewTreeElementWrapper) o).getValue()));
   } else if (o instanceof StructureViewTreeElement) {
     return Comparing.equal(unwrapValue(getValue()), ((StructureViewTreeElement) o).getValue());
   }
   return false;
 }
 @Override
 public int compare(VirtualFile file1, VirtualFile file2) {
   final VirtualFile r1 = getFileRoot(file1);
   final VirtualFile r2 = getFileRoot(file2);
   for (VirtualFile root : myEntries) {
     if (Comparing.equal(r1, root)) return 1;
     if (Comparing.equal(r2, root)) return -1;
   }
   return 0;
 }
Пример #12
0
 @Override
 public boolean equals(Object obj) {
   if (obj instanceof GrClosureParameter) {
     return Comparing.equal(myType, ((GrClosureParameter) obj).getType())
         && Comparing.equal(myOptional, ((GrClosureParameter) obj).isOptional())
         && Comparing.equal(
             myDefaultInitializer, ((GrClosureParameter) obj).getDefaultInitializer());
   }
   return super.equals(obj);
 }
 @Override
 public boolean deannotate(
     @NotNull final PsiModifierListOwner listOwner, @NotNull final String annotationFQN) {
   try {
     final List<XmlFile> files = findExternalAnnotationsXmlFiles(listOwner);
     if (files == null) {
       return false;
     }
     for (XmlFile file : files) {
       if (!file.isValid()) {
         continue;
       }
       final XmlDocument document = file.getDocument();
       if (document == null) {
         continue;
       }
       final XmlTag rootTag = document.getRootTag();
       if (rootTag == null) {
         continue;
       }
       final String externalName = getExternalName(listOwner, false);
       final String oldExternalName = getNormalizedExternalName(listOwner);
       for (final XmlTag tag : rootTag.getSubTags()) {
         final String className = tag.getAttributeValue("name");
         if (!Comparing.strEqual(className, externalName)
             && !Comparing.strEqual(className, oldExternalName)) {
           continue;
         }
         for (XmlTag annotationTag : tag.getSubTags()) {
           if (!Comparing.strEqual(annotationTag.getAttributeValue("name"), annotationFQN)) {
             continue;
           }
           if (ReadonlyStatusHandler.getInstance(myPsiManager.getProject())
               .ensureFilesWritable(file.getVirtualFile())
               .hasReadonlyFiles()) {
             return false;
           }
           try {
             annotationTag.delete();
             if (tag.getSubTags().length == 0) {
               tag.delete();
             }
           } catch (IncorrectOperationException e) {
             LOG.error(e);
           }
           return true;
         }
         return false;
       }
     }
     return false;
   } finally {
     dropCache();
   }
 }
Пример #14
0
  @SuppressWarnings("UnsafeVfsRecursion")
  @NotNull
  public static VirtualFileVisitor.Result visitChildrenRecursively(
      @NotNull VirtualFile file, @NotNull VirtualFileVisitor<?> visitor) throws VisitorException {
    boolean pushed = false;
    try {
      final boolean visited = visitor.allowVisitFile(file);
      if (visited) {
        VirtualFileVisitor.Result result = visitor.visitFileEx(file);
        if (result.skipChildren) return result;
      }

      Iterable<VirtualFile> childrenIterable = null;
      VirtualFile[] children = null;

      try {
        if (file.isValid() && visitor.allowVisitChildren(file) && !visitor.depthLimitReached()) {
          childrenIterable = visitor.getChildrenIterable(file);
          if (childrenIterable == null) {
            children = file.getChildren();
          }
        }
      } catch (InvalidVirtualFileAccessException e) {
        LOG.info("Ignoring: " + e.getMessage());
        return VirtualFileVisitor.CONTINUE;
      }

      if (childrenIterable != null) {
        visitor.saveValue();
        pushed = true;
        for (VirtualFile child : childrenIterable) {
          VirtualFileVisitor.Result result = visitChildrenRecursively(child, visitor);
          if (result.skipToParent != null && !Comparing.equal(result.skipToParent, child))
            return result;
        }
      } else if (children != null && children.length != 0) {
        visitor.saveValue();
        pushed = true;
        for (VirtualFile child : children) {
          VirtualFileVisitor.Result result = visitChildrenRecursively(child, visitor);
          if (result.skipToParent != null && !Comparing.equal(result.skipToParent, child))
            return result;
        }
      }

      if (visited) {
        visitor.afterChildrenVisited(file);
      }

      return VirtualFileVisitor.CONTINUE;
    } finally {
      visitor.restoreValue(pushed);
    }
  }
Пример #15
0
 public int hashCode() {
   return Comparing.hashcode(TEST_OBJECT)
       ^ Comparing.hashcode(getMainClassName())
       ^ Comparing.hashcode(getPackageName())
       ^ Comparing.hashcode(getMethodName())
       ^ Comparing.hashcode(getWorkingDirectory())
       ^ Comparing.hashcode(VM_PARAMETERS)
       ^ Comparing.hashcode(PARAMETERS)
       ^ Comparing.hashcode(myPattern)
       ^ Comparing.hashcode(FORK_MODE)
       ^ Comparing.hashcode(DIR_NAME);
 }
Пример #16
0
    public boolean isEqual(WCInfo val1, WCInfo val2) {
      if (val1 == val2) return true;
      if (val1 == null || val2 == null || val1.getClass() != val2.getClass()) return false;

      if (!Comparing.equal(val1.getFormat(), val2.getFormat())) return false;
      if (!Comparing.equal(val1.getPath(), val2.getPath())) return false;
      if (!Comparing.equal(val1.getStickyDepth(), val2.getStickyDepth())) return false;
      if (!Comparing.equal(val1.getType(), val2.getType())) return false;
      if (!Comparing.equal(val1.getUrl(), val2.getUrl())) return false;

      return true;
    }
Пример #17
0
  public boolean equalsByActualOffset(@NotNull HighlightInfo info) {
    if (info == this) return true;

    return info.getSeverity() == getSeverity()
        && info.getActualStartOffset() == getActualStartOffset()
        && info.getActualEndOffset() == getActualEndOffset()
        && Comparing.equal(info.type, type)
        && Comparing.equal(info.gutterIconRenderer, gutterIconRenderer)
        && Comparing.equal(info.forcedTextAttributes, forcedTextAttributes)
        && Comparing.equal(info.forcedTextAttributesKey, forcedTextAttributesKey)
        && Comparing.strEqual(info.getDescription(), getDescription());
  }
Пример #18
0
 public boolean equals(final Object object) {
   if (!(object instanceof Data)) return false;
   final Data second = (Data) object;
   return Comparing.equal(TEST_OBJECT, second.TEST_OBJECT)
       && Comparing.equal(getMainClassName(), second.getMainClassName())
       && Comparing.equal(getPackageName(), second.getPackageName())
       && Comparing.equal(getMethodName(), second.getMethodName())
       && Comparing.equal(getWorkingDirectory(), second.getWorkingDirectory())
       && Comparing.equal(VM_PARAMETERS, second.VM_PARAMETERS)
       && Comparing.equal(PARAMETERS, second.PARAMETERS)
       && Comparing.equal(myPattern, second.myPattern)
       && Comparing.equal(FORK_MODE, second.FORK_MODE)
       && Comparing.equal(DIR_NAME, second.DIR_NAME);
 }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    DirectoryInfo info = (DirectoryInfo) o;

    return sourceRootTypeData == info.sourceRootTypeData
        && Comparing.equal(contentRoot, info.contentRoot)
        && Comparing.equal(libraryClassRoot, info.libraryClassRoot)
        && Comparing.equal(module, info.module)
        && Arrays.equals(orderEntries, info.orderEntries)
        && Comparing.equal(sourceRoot, info.sourceRoot);
  }
Пример #20
0
  public boolean equals(Object obj) {
    if (obj == this) return true;
    if (!(obj instanceof HighlightInfo)) return false;
    HighlightInfo info = (HighlightInfo) obj;

    return info.getSeverity() == getSeverity()
        && info.startOffset == startOffset
        && info.endOffset == endOffset
        && Comparing.equal(info.type, type)
        && Comparing.equal(info.gutterIconRenderer, gutterIconRenderer)
        && Comparing.equal(info.forcedTextAttributes, forcedTextAttributes)
        && Comparing.equal(info.forcedTextAttributesKey, forcedTextAttributesKey)
        && Comparing.strEqual(info.getDescription(), getDescription());
  }
 private static boolean infoEquals(HighlightInfo expectedInfo, HighlightInfo info) {
   if (expectedInfo == info) return true;
   return info.getSeverity() == expectedInfo.getSeverity()
       && info.startOffset == expectedInfo.startOffset
       && info.endOffset == expectedInfo.endOffset
       && info.isAfterEndOfLine() == expectedInfo.isAfterEndOfLine()
       && (expectedInfo.type == WHATEVER || expectedInfo.type.equals(info.type))
       && (Comparing.strEqual(ANY_TEXT, expectedInfo.getDescription())
           || Comparing.strEqual(info.getDescription(), expectedInfo.getDescription()))
       && (expectedInfo.forcedTextAttributes == null
           || Comparing.equal(
               expectedInfo.getTextAttributes(null, null), info.getTextAttributes(null, null)))
       && (expectedInfo.forcedTextAttributesKey == null
           || expectedInfo.forcedTextAttributesKey.equals(info.forcedTextAttributesKey));
 }
Пример #22
0
 @Override
 public void setDisplayName(String name) {
   name = name.trim();
   final ModifiableModuleModel modifiableModuleModel = myConfigurator.getModuleModel();
   if (StringUtil.isEmpty(name)) return; // empty string comes on double click on module node
   if (Comparing.strEqual(name, myModuleName)) return; // nothing changed
   try {
     modifiableModuleModel.renameModule(myModule, name);
   } catch (ModuleWithNameAlreadyExistsException ignored) {
   }
   myConfigurator.moduleRenamed(myModule, myModuleName, name);
   myModuleName = name;
   myConfigurator.setModified(!Comparing.strEqual(myModuleName, myModule.getName()));
   myContext.getDaemonAnalyzer().queueUpdateForAllElementsWithErrors();
 }
 public LocalChangeList getListCopy(@NotNull final VirtualFile file) {
   for (LocalChangeList list : myMap.values()) {
     for (Change change : list.getChanges()) {
       if (change.getAfterRevision() != null
           && Comparing.equal(change.getAfterRevision().getFile().getVirtualFile(), file)) {
         return list.copy();
       }
       if (change.getBeforeRevision() != null
           && Comparing.equal(change.getBeforeRevision().getFile().getVirtualFile(), file)) {
         return list.copy();
       }
     }
   }
   return null;
 }
  private void recycleChangeList(
      final ShelvedChangeList listCopy, final ShelvedChangeList newList) {
    if (newList != null) {
      for (Iterator<ShelvedBinaryFile> shelvedChangeListIterator =
              listCopy.getBinaryFiles().iterator();
          shelvedChangeListIterator.hasNext(); ) {
        final ShelvedBinaryFile binaryFile = shelvedChangeListIterator.next();
        for (ShelvedBinaryFile newBinary : newList.getBinaryFiles()) {
          if (Comparing.equal(newBinary.BEFORE_PATH, binaryFile.BEFORE_PATH)
              && Comparing.equal(newBinary.AFTER_PATH, binaryFile.AFTER_PATH)) {
            shelvedChangeListIterator.remove();
          }
        }
      }
      for (Iterator<ShelvedChange> iterator = listCopy.getChanges(myProject).iterator();
          iterator.hasNext(); ) {
        final ShelvedChange change = iterator.next();
        for (ShelvedChange newChange : newList.getChanges(myProject)) {
          if (Comparing.equal(change.getBeforePath(), newChange.getBeforePath())
              && Comparing.equal(change.getAfterPath(), newChange.getAfterPath())) {
            iterator.remove();
          }
        }
      }

      // needed only if partial unshelve
      try {
        final CommitContext commitContext = new CommitContext();
        final List<FilePatch> patches = new ArrayList<FilePatch>();
        for (ShelvedChange change : listCopy.getChanges(myProject)) {
          patches.add(change.loadFilePatch(myProject, commitContext));
        }
        writePatchesToFile(myProject, listCopy.PATH, patches, commitContext);
      } catch (IOException e) {
        LOG.info(e);
        // left file as is
      } catch (PatchSyntaxException e) {
        LOG.info(e);
        // left file as is
      }
    }

    if ((!listCopy.getBinaryFiles().isEmpty()) || (!listCopy.getChanges(myProject).isEmpty())) {
      listCopy.setRecycled(true);
      myRecycledShelvedChangeLists.add(listCopy);
      notifyStateChanged();
    }
  }
  @NotNull
  @Override
  public SuggestedNameInfo suggestUniqueVariableName(
      @NotNull final SuggestedNameInfo baseNameInfo,
      PsiElement place,
      boolean ignorePlaceName,
      boolean lookForward) {
    final String[] names = baseNameInfo.names;
    final LinkedHashSet<String> uniqueNames = new LinkedHashSet<String>(names.length);
    for (String name : names) {
      if (ignorePlaceName && place instanceof PsiNamedElement) {
        final String placeName = ((PsiNamedElement) place).getName();
        if (Comparing.strEqual(placeName, name)) {
          uniqueNames.add(name);
          continue;
        }
      }
      uniqueNames.add(suggestUniqueVariableName(name, place, lookForward));
    }

    return new SuggestedNameInfo(ArrayUtil.toStringArray(uniqueNames)) {
      @Override
      public void nameChosen(String name) {
        baseNameInfo.nameChosen(name);
      }
    };
  }
  private void updateTextElement(final PsiElement elt) {
    final String newText = getNewText(elt);
    if (newText == null || Comparing.strEqual(newText, myEditor.getDocument().getText())) return;
    CommandProcessor.getInstance()
        .runUndoTransparentAction(
            new Runnable() {
              @Override
              public void run() {
                ApplicationManager.getApplication()
                    .runWriteAction(
                        new Runnable() {
                          @Override
                          public void run() {
                            Document fragmentDoc = myEditor.getDocument();
                            fragmentDoc.setReadOnly(false);

                            fragmentDoc.replaceString(0, fragmentDoc.getTextLength(), newText);
                            fragmentDoc.setReadOnly(true);
                            myEditor.getCaretModel().moveToOffset(0);
                            myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
                          }
                        });
              }
            });
  }
 @Override
 public boolean isModified() {
   VcsContentAnnotationSettings settings = VcsContentAnnotationSettings.getInstance(myProject);
   if (myHighlightRecentlyChanged.isSelected() != settings.isShow()) return true;
   if (!Comparing.equal(myHighlightInterval.getValue(), settings.getLimitDays())) return true;
   return false;
 }
Пример #28
0
  protected boolean shouldDisplay(
      EvaluationContext context, @NotNull ObjectReference objInstance, @NotNull Field field) {
    final boolean isSynthetic = DebuggerUtils.isSynthetic(field);
    if (!SHOW_SYNTHETICS && isSynthetic) {
      return false;
    }
    if (SHOW_VAL_FIELDS_AS_LOCAL_VARIABLES && isSynthetic) {
      try {
        final StackFrameProxy frameProxy = context.getFrameProxy();
        if (frameProxy != null) {
          final Location location = frameProxy.location();
          if (location != null
              && objInstance.equals(context.getThisObject())
              && Comparing.equal(objInstance.referenceType(), location.declaringType())
              && StringUtil.startsWith(
                  field.name(), FieldDescriptorImpl.OUTER_LOCAL_VAR_FIELD_PREFIX)) {
            return false;
          }
        }
      } catch (EvaluateException ignored) {
      }
    }
    if (!SHOW_STATIC && field.isStatic()) {
      return false;
    }

    if (!SHOW_STATIC_FINAL && field.isStatic() && field.isFinal()) {
      return false;
    }

    return true;
  }
  private static PsiAnnotationMemberValue[] readFromClass(
      @NonNls String attributeName, @NotNull PsiAnnotation magic, PsiType type) {
    PsiAnnotationMemberValue fromClassAttr = magic.findAttributeValue(attributeName);
    PsiType fromClassType =
        fromClassAttr instanceof PsiClassObjectAccessExpression
            ? ((PsiClassObjectAccessExpression) fromClassAttr).getOperand().getType()
            : null;
    PsiClass fromClass =
        fromClassType instanceof PsiClassType ? ((PsiClassType) fromClassType).resolve() : null;
    if (fromClass == null) return null;
    String fqn = fromClass.getQualifiedName();
    if (fqn == null) return null;
    List<PsiAnnotationMemberValue> constants = new ArrayList<PsiAnnotationMemberValue>();
    for (PsiField field : fromClass.getFields()) {
      if (!field.hasModifierProperty(PsiModifier.PUBLIC)
          || !field.hasModifierProperty(PsiModifier.STATIC)
          || !field.hasModifierProperty(PsiModifier.FINAL)) continue;
      PsiType fieldType = field.getType();
      if (!Comparing.equal(fieldType, type)) continue;
      PsiAssignmentExpression e =
          (PsiAssignmentExpression)
              JavaPsiFacade.getElementFactory(field.getProject())
                  .createExpressionFromText("x=" + fqn + "." + field.getName(), field);
      PsiReferenceExpression refToField = (PsiReferenceExpression) e.getRExpression();
      constants.add(refToField);
    }
    if (constants.isEmpty()) return null;

    return constants.toArray(new PsiAnnotationMemberValue[constants.size()]);
  }
  @Nullable
  public PsiElement[] getElements(boolean[] isCopied) {
    try {
      Transferable content = myCopyPasteManager.getContents();
      if (content == null) {
        return null;
      }

      Object transferData;
      try {
        transferData = content.getTransferData(ourDataFlavor);
      } catch (UnsupportedFlavorException e) {
        return null;
      } catch (IOException e) {
        return null;
      }

      if (!(transferData instanceof MyData)) {
        return null;
      }
      MyData dataProxy = (MyData) transferData;
      if (!Comparing.equal(dataProxy, myRecentData)) {
        return null;
      }
      if (isCopied != null) {
        isCopied[0] = myRecentData.isCopied();
      }
      return myRecentData.getElements();
    } catch (Exception e) {
      if (LOG.isDebugEnabled()) {
        LOG.debug(e);
      }
      return null;
    }
  }