Esempio n. 1
0
  @NotNull
  private InlineProgressIndicator createInlineDelegate(
      @NotNull TaskInfo info, @NotNull ProgressIndicatorEx original, final boolean compact) {
    final Collection<InlineProgressIndicator> inlines = myOriginal2Inlines.get(original);
    if (inlines != null) {
      for (InlineProgressIndicator eachInline : inlines) {
        if (eachInline.isCompact() == compact) return eachInline;
      }
    }

    final InlineProgressIndicator inline = new MyInlineProgressIndicator(compact, info, original);

    myInline2Original.put(inline, original);
    myOriginal2Inlines.put(original, inline);

    if (compact) {
      inline
          .getComponent()
          .addMouseListener(
              new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                  handle(e);
                }

                @Override
                public void mouseReleased(MouseEvent e) {
                  handle(e);
                }
              });
    }

    return inline;
  }
Esempio n. 2
0
 @Override
 public DfaInstructionState[] visitPush(
     PushInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
   if (myContext == instruction.getPlace()) {
     final Map<DfaVariableValue, DfaVariableState> map =
         ((ValuableDataFlowRunner.MyDfaMemoryState) memState).getVariableStates();
     for (Map.Entry<DfaVariableValue, DfaVariableState> entry : map.entrySet()) {
       ValuableDataFlowRunner.ValuableDfaVariableState state =
           (ValuableDataFlowRunner.ValuableDfaVariableState) entry.getValue();
       DfaVariableValue variableValue = entry.getKey();
       final PsiExpression psiExpression = state.myExpression;
       if (psiExpression != null && variableValue.getQualifier() == null) {
         myValues.put(variableValue.getPsiVariable(), psiExpression);
       }
     }
     DfaValue value = instruction.getValue();
     if (value instanceof DfaVariableValue
         && ((DfaVariableValue) value).getQualifier() == null) {
       if (memState.isNotNull((DfaVariableValue) value)) {
         myNotNulls.add(((DfaVariableValue) value).getPsiVariable());
       }
       if (memState.isNull(value)) {
         myNulls.add(((DfaVariableValue) value).getPsiVariable());
       }
     }
   }
   return super.visitPush(instruction, runner, memState);
 }
Esempio n. 3
0
 private static MultiValuesMap<String, BaseInjection> createInjectionMap(
     final Collection<BaseInjection> injections) {
   final MultiValuesMap<String, BaseInjection> existingMap =
       new MultiValuesMap<String, BaseInjection>();
   for (BaseInjection injection : injections) {
     for (InjectionPlace place : injection.getInjectionPlaces()) {
       existingMap.put(place.getText(), injection);
     }
   }
   return existingMap;
 }
 static void importInjections(
     final Collection<BaseInjection> existingInjections,
     final Collection<BaseInjection> importingInjections,
     final Collection<BaseInjection> originalInjections,
     final Collection<BaseInjection> newInjections) {
   final MultiValuesMap<InjectionPlace, BaseInjection> placeMap =
       new MultiValuesMap<InjectionPlace, BaseInjection>();
   for (BaseInjection exising : existingInjections) {
     for (InjectionPlace place : exising.getInjectionPlaces()) {
       placeMap.put(place, exising);
     }
   }
   main:
   for (BaseInjection other : importingInjections) {
     final List<BaseInjection> matchingInjections =
         ContainerUtil.concat(
             other.getInjectionPlaces(),
             new Function<InjectionPlace, Collection<? extends BaseInjection>>() {
               public Collection<? extends BaseInjection> fun(final InjectionPlace o) {
                 final Collection<BaseInjection> collection = placeMap.get(o);
                 return collection == null ? Collections.<BaseInjection>emptyList() : collection;
               }
             });
     if (matchingInjections.isEmpty()) {
       newInjections.add(other);
     } else {
       BaseInjection existing = null;
       for (BaseInjection injection : matchingInjections) {
         if (injection.equals(other)) continue main;
         if (existing == null && injection.sameLanguageParameters(other)) {
           existing = injection;
         }
       }
       if (existing == null) continue main; // skip!! language changed
       final BaseInjection newInjection = existing.copy();
       newInjection.mergeOriginalPlacesFrom(other, true);
       if (!newInjection.equals(existing)) {
         originalInjections.add(existing);
         newInjections.add(newInjection);
       }
     }
   }
 }
  public static void processFiles(final List<FileInfo> fileInfos, @Nullable String changelist) {
    FileInfo[] copy = fileInfos.toArray(new FileInfo[fileInfos.size()]);
    MultiValuesMap<HandleType, VirtualFile> handleTypeToFile =
        new MultiValuesMap<HandleType, VirtualFile>();
    for (FileInfo fileInfo : copy) {
      handleTypeToFile.put(fileInfo.getSelectedHandleType(), fileInfo.getFile());
    }

    for (HandleType handleType : handleTypeToFile.keySet()) {
      handleType.processFiles(
          handleTypeToFile.get(handleType),
          changelist == null ? handleType.getDefaultChangelist() : changelist);
    }

    for (FileInfo fileInfo : copy) {
      if (!fileInfo.getFile().exists() || fileInfo.getFile().isWritable()) {
        fileInfos.remove(fileInfo);
      }
    }
  }