Java Code Examples for com.intellij.util.NotNullProducer

The following examples show how to use com.intellij.util.NotNullProducer. These examples are extracted from open source projects. 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 Project: sass-lint-plugin   Source File: SassLintSettingsPage.java    License: 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 2
Source Project: sass-lint-plugin   Source File: SassLintSettingsPage.java    License: 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 3
Source Project: sass-lint-plugin   Source File: SassLintSettingsPage.java    License: 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 4
Source Project: react-templates-plugin   Source File: RTSettingsPage.java    License: 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 5
Source Project: react-templates-plugin   Source File: RTSettingsPage.java    License: 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 6
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 7
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 8
Source Project: jscs-plugin   Source File: JscsSettingsPage.java    License: 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 9
Source Project: jscs-plugin   Source File: JscsSettingsPage.java    License: 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 10
Source Project: jscs-plugin   Source File: JscsSettingsPage.java    License: 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 11
Source Project: react-templates-plugin   Source File: RTSettingsPage.java    License: 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 12
Source Project: react-templates-plugin   Source File: RTSettingsPage.java    License: 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 13
Source Project: eslint-plugin   Source File: ESLintSettingsPage.java    License: 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 14
Source Project: eslint-plugin   Source File: ESLintSettingsPage.java    License: 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 15
Source Project: eslint-plugin   Source File: ESLintSettingsPage.java    License: 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 16
Source Project: eslint-plugin   Source File: ESLintSettingsPage.java    License: 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 17
Source Project: consulo   Source File: BuiltInServer.java    License: 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 18
Source Project: consulo   Source File: BuiltInServer.java    License: 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 19
Source Project: consulo   Source File: BuiltInServer.java    License: 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 20
Source Project: consulo   Source File: FileRefresher.java    License: 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 21
Source Project: consulo   Source File: MorphColor.java    License: 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 22
Source Project: consulo   Source File: MorphColor.java    License: 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 23
Source Project: consulo   Source File: MorphColor.java    License: 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 24
Source Project: consulo   Source File: JBColor.java    License: 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 25
Source Project: consulo   Source File: JBColor.java    License: 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 26
Source Project: consulo   Source File: JBColor.java    License: 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 27
Source Project: consulo   Source File: JBColor.java    License: 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 28
Source Project: consulo   Source File: JBColor.java    License: 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 29
Source Project: consulo   Source File: GeneralHighlightingPass.java    License: Apache License 2.0 4 votes vote down vote up
void setHighlightVisitorProducer(@Nonnull NotNullProducer<HighlightVisitor[]> highlightVisitorProducer) {
  myHighlightVisitorProducer = highlightVisitorProducer;
}
 
Example 30
Source Project: consulo   Source File: DesktopToolWindowHeader.java    License: Apache License 2.0 4 votes vote down vote up
public GearAction(NotNullProducer<ActionGroup> gearProducer) {
  super("Show options", null, AllIcons.General.GearPlain);
  myGearProducer = gearProducer;
}