@SuppressWarnings("OverlyBroadCatchBlock")
  private void multiCast(@NotNull Method method, Object[] args) {
    try {
      method.invoke(myBus.syncPublisher(AppTopics.FILE_DOCUMENT_SYNC), args);
    } catch (ClassCastException e) {
      LOG.error("Arguments: " + Arrays.toString(args), e);
    } catch (Exception e) {
      LOG.error(e);
    }

    // Allows pre-save document modification
    for (FileDocumentManagerListener listener : getListeners()) {
      try {
        method.invoke(listener, args);
      } catch (Exception e) {
        LOG.error(e);
      }
    }

    // stripping trailing spaces
    try {
      method.invoke(myTrailingSpacesStripper, args);
    } catch (Exception e) {
      LOG.error(e);
    }
  }
Ejemplo n.º 2
0
 public static <T> void assertOneOf(T value, T... values) {
   boolean found = false;
   for (T v : values) {
     if (value == v || value != null && value.equals(v)) {
       found = true;
     }
   }
   Assert.assertTrue(value + " should be equal to one of " + Arrays.toString(values), found);
 }
 @NotNull
 public VirtualFile[] getOpenFiles() {
   final ArrayListSet<VirtualFile> files = new ArrayListSet<VirtualFile>();
   for (final EditorWindow myWindow : myWindows) {
     final EditorWithProviderComposite[] editors = myWindow.getEditors();
     for (final EditorWithProviderComposite editor : editors) {
       final VirtualFile file = editor.getFile();
       LOG.assertTrue(file.isValid(), Arrays.toString(editor.getProviders()));
       files.add(file);
     }
   }
   return VfsUtil.toVirtualFileArray(files);
 }
Ejemplo n.º 4
0
  @Override
  public String toString() {

    String[] temp = new String[3];

    temp[0] = "Width: " + width;

    temp[1] = "Height: " + height;

    temp[2] = "File Path " + filePath;

    return Arrays.toString(temp);
  }
 public MethodCallTester<MonitoredClass> assertMethodNotCalled(
     String name, Class<?>... paramTypes) {
   assertFalse(
       "Method "
           + mockClass.getSimpleName()
           + "."
           + name
           + "("
           + Arrays.toString(paramTypes)
           + ") was called but no call was expected",
       wasMethodCalled(name, paramTypes));
   return this;
 }
 public MethodCallTester<MonitoredClass> assertMethodCalled(
     String name, Object... expectedParamValues) {
   assertTrue(
       "Method "
           + mockClass.getSimpleName()
           + "."
           + name
           + "("
           + Arrays.toString(expectedParamValues)
           + ") was not called",
       wasMethodCalled(name, expectedParamValues));
   return this;
 }
 @SuppressWarnings("unused")
 public MethodCallTester<MonitoredClass> assertMethodNotCalled(
     String name, Object... expectedParamValues) {
   assertFalse(
       "Method "
           + mockClass.getSimpleName()
           + "."
           + name
           + "("
           + Arrays.toString(expectedParamValues)
           + ") was called but no call was expected",
       wasMethodCalled(name, expectedParamValues));
   return this;
 }