com.intellij.util.NotNullProducer Java Examples

The following examples show how to use com.intellij.util.NotNullProducer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 5 votes vote down vote up
private void configConfigFileField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(sassLintConfigFile);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            return SassLintFinder.searchForConfigFiles(getProjectPath());
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, sassLintConfigFile, "Select Sass Lint Config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #2
Source File: JBColor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static Color border() {
  return new JBColor(new NotNullProducer<Color>() {
    @Nonnull
    @Override
    public Color produce() {
      return UIUtil.getBorderColor();
    }
  });
}
 
Example #3
Source File: JBColor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static Color background() {
  return new JBColor(new NotNullProducer<Color>() {
    @Nonnull
    @Override
    public Color produce() {
      return UIUtil.getListBackground();
    }
  });
}
 
Example #4
Source File: JBColor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static Color foreground() {
  return new JBColor(new NotNullProducer<Color>() {
    @Nonnull
    @Override
    public Color produce() {
      return UIUtil.getLabelForeground();
    }
  });
}
 
Example #5
Source File: JBColor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Color darker() {
  if (func != null) {
    return new JBColor(new NotNullProducer<Color>() {
      @Nonnull
      @Override
      public Color produce() {
        return func.produce().darker();
      }
    });
  }
  return new JBColor(super.darker(), getDarkVariant().darker());
}
 
Example #6
Source File: JBColor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Color brighter() {
  if (func != null) {
    return new JBColor(new NotNullProducer<Color>() {
      @Nonnull
      @Override
      public Color produce() {
        return func.produce().brighter();
      }
    });
  }
  return new JBColor(super.brighter(), getDarkVariant().brighter());
}
 
Example #7
Source File: MorphColor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Color darker() {
  return of(new NotNullProducer<Color>() {
    @Nonnull
    @Override
    public Color produce() {
      return myColorProducer.produce().darker();
    }
  });
}
 
Example #8
Source File: MorphColor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Color brighter() {
  return of(new NotNullProducer<Color>() {
    @Nonnull
    @Override
    public Color produce() {
      return myColorProducer.produce().brighter();
    }
  });
}
 
Example #9
Source File: MorphColor.java    From consulo with Apache License 2.0 5 votes vote down vote up
private MorphColor(Color color, @Nullable UIModificationTracker modificationTracker, @Nonnull NotNullProducer<Color> function) {
  super(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
  myLastComputedColor = color;
  myModificationTracker = modificationTracker;
  myColorProducer = function;
  myLastModificationCount = modificationTracker == null ? -1 : ourTracker.getModificationCount();
}
 
Example #10
Source File: FileRefresher.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * @param recursive {@code true} if files should be considered as roots
 * @param delay     an amount of seconds before refreshing files
 * @param producer  a provider for modality state that can be invoked on background thread
 * @throws IllegalArgumentException if the specified delay is not positive
 */
public FileRefresher(boolean recursive, long delay, @Nonnull NotNullProducer<? extends ModalityState> producer) {
  if (delay <= 0) throw new IllegalArgumentException("delay");
  this.recursive = recursive;
  this.delay = delay;
  this.producer = producer;
}
 
Example #11
Source File: BuiltInServer.java    From consulo with Apache License 2.0 5 votes vote down vote up
static void configureChildHandler(@Nonnull ServerBootstrap bootstrap,
                                  @Nonnull final ChannelRegistrar channelRegistrar,
                                  @Nullable final NotNullProducer<ChannelHandler> channelHandler) {
  final PortUnificationServerHandler portUnificationServerHandler = channelHandler == null ? new PortUnificationServerHandler() : null;
  bootstrap.childHandler(new ChannelInitializer() {
    @Override
    protected void initChannel(@Nonnull Channel channel) throws Exception {
      channel.pipeline().addLast(channelRegistrar, channelHandler == null ? portUnificationServerHandler : channelHandler.produce());
    }
  });
}
 
Example #12
Source File: BuiltInServer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static BuiltInServer start(@Nonnull EventLoopGroup eventLoopGroup,
                                  boolean isEventLoopGroupOwner,
                                  int firstPort,
                                  int portsCount,
                                  boolean tryAnyPort,
                                  @Nullable NotNullProducer<ChannelHandler> handler) throws Exception {
  ChannelRegistrar channelRegistrar = new ChannelRegistrar();
  ServerBootstrap bootstrap = serverBootstrap(eventLoopGroup);
  configureChildHandler(bootstrap, channelRegistrar, handler);
  int port = bind(firstPort, portsCount, tryAnyPort, bootstrap, channelRegistrar, isEventLoopGroupOwner);
  return new BuiltInServer(eventLoopGroup, port, channelRegistrar);
}
 
Example #13
Source File: BuiltInServer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static BuiltInServer start(int workerCount,
                                  int firstPort,
                                  int portsCount,
                                  boolean tryAnyPort,
                                  @Nullable NotNullProducer<ChannelHandler> handler) throws Exception {
  return start(new NioEventLoopGroup(workerCount, new BuiltInServerThreadFactory()), true, firstPort, portsCount, tryAnyPort, handler);
}
 
Example #14
Source File: ESLintSettingsPage.java    From eslint-plugin with MIT License 5 votes vote down vote up
private void configNodeField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters();
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #15
Source File: JscsSettingsPage.java    From jscs-plugin with MIT License 5 votes vote down vote up
private void configBinField() {
    configWithDefaults(jscsBinField);
    SwingHelper.addHistoryOnExpansion(jscsBinField.getChildComponent(), new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = JscsFinder.searchForJscsBin(getProjectPath());
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, jscsBinField, "Select jscs.js cli", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #16
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 5 votes vote down vote up
private void configLintBinField() {
    configWithDefaults(sasslintBinField);
    SwingHelper.addHistoryOnExpansion(sasslintBinField.getChildComponent(), new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = SassLintFinder.searchForSassLintExe(getProjectPath());
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, sasslintBinField, "Select Sass Lint Exe", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #17
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 5 votes vote down vote up
private void configNodeField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters();
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #18
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 5 votes vote down vote up
private void configRTBinField() {
    configWithDefaults(rtBinField);
    SwingHelper.addHistoryOnExpansion(rtBinField.getChildComponent(), new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = RTFinder.searchForRTBin(getProjectPath());
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, rtBinField, "Select React-Templates Cli", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #19
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 5 votes vote down vote up
private void configNodeField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters();
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #20
Source File: VueSettingsPage.java    From vue-for-idea with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void configRTBinField() {
    configWithDefaults(rtBinField);
    SwingHelper.addHistoryOnExpansion(rtBinField.getChildComponent(), new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = VueFinder.searchForRTBin(getProjectPath());
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, rtBinField, "Select vue cli", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #21
Source File: VueSettingsPage.java    From vue-for-idea with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void configNodeField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters();
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #22
Source File: ESLintSettingsPage.java    From eslint-plugin with MIT License 5 votes vote down vote up
private void configESLintRcField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(eslintrcFile);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            return ESLintFinder.searchForESLintRCFiles(getProjectPath());
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, eslintrcFile, "Select ESLint Config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #23
Source File: JscsSettingsPage.java    From jscs-plugin with MIT License 5 votes vote down vote up
private void configJscsRcField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(jscsrcFile);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            return JscsFinder.searchForJscsRCFiles(getProjectPath());
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, jscsrcFile, "Select JSCS config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #24
Source File: JscsSettingsPage.java    From jscs-plugin with MIT License 5 votes vote down vote up
private void configNodeField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters();
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #25
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 5 votes vote down vote up
private void configRTBinField() {
    configWithDefaults(rtBinField);
    SwingHelper.addHistoryOnExpansion(rtBinField.getChildComponent(), new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = RTFinder.searchForRTBin(getProjectPath());
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, rtBinField, "Select React-Templates Cli", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #26
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 5 votes vote down vote up
private void configNodeField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters();
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #27
Source File: ESLintSettingsPage.java    From eslint-plugin with MIT License 5 votes vote down vote up
private void configESLintBinField() {
    configWithDefaults(eslintBinField2);
    SwingHelper.addHistoryOnExpansion(eslintBinField2.getChildComponent(), new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = ESLintFinder.searchForESLintBin(getProjectPath());
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, eslintBinField2, "Select ESLint.js Cli", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #28
Source File: ESLintSettingsPage.java    From eslint-plugin with MIT License 5 votes vote down vote up
private void configESLintRulesField() {
    TextFieldWithHistory textFieldWithHistory = rulesPathField.getChildComponent();
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            return ESLintFinder.tryFindRulesAsString(getProjectPath());
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, rulesPathField, "Select Built in Rules", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #29
Source File: MorphColor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static Color of(@Nonnull NotNullProducer<Color> func) {
  Color color = func.produce();
  return new MorphColor(color, ourTracker, func);
}
 
Example #30
Source File: MorphColor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static Color ofWithoutCache(@Nonnull NotNullProducer<Color> func) {
  Color color = func.produce();
  return new MorphColor(color, null, func);
}