com.intellij.util.ObjectUtils Java Examples
The following examples show how to use
com.intellij.util.ObjectUtils.
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: AbstractCommonCheckinAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(@Nonnull VcsContext context) { LOG.debug("actionPerformed. "); Project project = ObjectUtils.notNull(context.getProject()); if (ChangeListManager.getInstance(project).isFreezedWithNotification("Can not " + getMnemonicsFreeActionName(context) + " now")) { LOG.debug("ChangeListManager is freezed. returning."); } else if (ProjectLevelVcsManager.getInstance(project).isBackgroundVcsOperationRunning()) { LOG.debug("Background operation is running. returning."); } else { FilePath[] roots = prepareRootsForCommit(getRoots(context), project); ChangeListManager.getInstance(project) .invokeAfterUpdate(() -> performCheckIn(context, project, roots), InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, VcsBundle.message("waiting.changelists.update.for.show.commit.dialog.message"), ModalityState.current()); } }
Example #2
Source File: PopupFactoryImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void handleSelect(boolean handleFinalChoices, InputEvent e) { final Object selectedValue = getList().getSelectedValue(); final ActionPopupStep actionPopupStep = ObjectUtils.tryCast(getListStep(), ActionPopupStep.class); if (actionPopupStep != null) { KeepingPopupOpenAction dontClosePopupAction = getActionByClass(selectedValue, actionPopupStep, KeepingPopupOpenAction.class); if (dontClosePopupAction != null) { actionPopupStep.performAction((AnAction)dontClosePopupAction, e != null ? e.getModifiers() : 0, e); for (ActionItem item : actionPopupStep.getValues()) { updateActionItem(item); } getList().repaint(); return; } } super.handleSelect(handleFinalChoices, e); }
Example #3
Source File: EditorTextFieldCellRenderer.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private static Pair<EditorTextField, EditorEx> createEditor(Project project, @Nullable FileType fileType, boolean inheritFontFromLaF) { EditorTextField field = new EditorTextField(new EditorTextFieldRendererDocument(), project, fileType, false, false); field.setSupplementary(true); field.setFontInheritedFromLAF(inheritFontFromLaF); field.addNotify(); // creates editor EditorEx editor = (EditorEx)ObjectUtils.assertNotNull(field.getEditor()); editor.setRendererMode(true); editor.setColorsScheme(editor.createBoundColorSchemeDelegate(null)); editor.getSettings().setCaretRowShown(false); editor.getScrollPane().setBorder(null); return Pair.create(field, editor); }
Example #4
Source File: ChangesTreeList.java From consulo with Apache License 2.0 | 6 votes |
@Override public Color getFileColorFor(Object object) { VirtualFile file; if (object instanceof FilePath) { file = ((FilePath)object).getVirtualFile(); } else if (object instanceof Change) { file = ((Change)object).getVirtualFile(); } else { file = ObjectUtils.tryCast(object, VirtualFile.class); } if (file != null) { return FileColorManager.getInstance(myProject).getFileColor(file); } return super.getFileColorFor(object); }
Example #5
Source File: EditorUtil.java From consulo with Apache License 2.0 | 6 votes |
public static void runBatchFoldingOperationOutsideOfBulkUpdate(@Nonnull Editor editor, @Nonnull Runnable operation) { DocumentEx document = ObjectUtils.tryCast(editor.getDocument(), DocumentEx.class); if (document != null && document.isInBulkUpdate()) { MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(); disposeWithEditor(editor, connection::disconnect); connection.subscribe(DocumentBulkUpdateListener.TOPIC, new DocumentBulkUpdateListener.Adapter() { @Override public void updateFinished(@Nonnull Document doc) { if (doc == editor.getDocument()) { editor.getFoldingModel().runBatchFoldingOperation(operation); connection.disconnect(); } } }); } else { editor.getFoldingModel().runBatchFoldingOperation(operation); } }
Example #6
Source File: MultipleChangeListBrowser.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void setInitialSelection(@Nonnull List<? extends ChangeList> changeLists, @Nonnull List<Object> changes, @javax.annotation.Nullable ChangeList initialListSelection) { myAllChanges = ContainerUtil.newArrayList(); mySelectedChangeList = initialListSelection; for (ChangeList list : changeLists) { if (list instanceof LocalChangeList) { myAllChanges.addAll(list.getChanges()); if (initialListSelection == null && ContainerUtil.intersects(list.getChanges(), changes)) { mySelectedChangeList = list; } } } if (mySelectedChangeList == null) { mySelectedChangeList = ObjectUtils.chooseNotNull(findDefaultList(changeLists), ContainerUtil.getFirstItem(changeLists)); } }
Example #7
Source File: FreeRunConfiguration.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 6 votes |
protected GeneralCommandLine createDefaultCommandLine() { // here just run one command: python freeline.py PtyCommandLine commandLine = new PtyCommandLine(); if (!SystemInfo.isWindows) { commandLine.getEnvironment().put("TERM", "xterm-256color"); } // commandLine.withConsoleMode(false); // commandLine.withInitialColumns(120); ExecutionEnvironment environment = getEnvironment(); commandLine.setWorkDirectory(environment.getProject().getBasePath()); String defaultShell = ObjectUtils.notNull(EnvironmentUtil.getValue("SHELL"), "/bin/sh"); commandLine.setExePath(defaultShell); // commandLine.setExePath("npm"); // commandLine.addParameters("run-script"); // commandLine.addParameters("start"); return commandLine; }
Example #8
Source File: SubscriberIndexUtil.java From idea-php-shopware-plugin with MIT License | 6 votes |
/** * foo => 'goo' * foo => ['goo', ... ] */ @Nullable public static String getMethodNameForEventValue(@NotNull PhpPsiElement value) { if(value instanceof StringLiteralExpression) { return ((StringLiteralExpression) value).getContents(); } if(value instanceof ArrayCreationExpression) { PhpPsiElement firstPsiChild = value.getFirstPsiChild(); if(firstPsiChild != null && firstPsiChild.getNode().getElementType() == PhpElementTypes.ARRAY_VALUE) { StringLiteralExpression stringLiteral = ObjectUtils.tryCast(firstPsiChild.getFirstPsiChild(), StringLiteralExpression.class); if(stringLiteral != null) { return stringLiteral.getContents(); } } return null; } return null; }
Example #9
Source File: ChangesBrowserBase.java From consulo with Apache License 2.0 | 5 votes |
public void setSelected(AnActionEvent e, boolean state) { T change = ObjectUtils.tryCast(e.getData(VcsDataKeys.CURRENT_CHANGE), myClass); if (change == null) return; if (state) { myViewer.includeChange(change); } else { myViewer.excludeChange(change); } }
Example #10
Source File: VcsLogClassicFilterUi.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override protected VcsLogTextFilter createFilter(@Nonnull List<String> values) { return new VcsLogTextFilterImpl(ObjectUtils.assertNotNull(ContainerUtil.getFirstItem(values)), myUiProperties.get(MainVcsLogUiProperties.TEXT_FILTER_REGEX), myUiProperties.get(MainVcsLogUiProperties.TEXT_FILTER_MATCH_CASE)); }
Example #11
Source File: IdeConsoleRootType.java From consulo with Apache License 2.0 | 5 votes |
@Nullable @Override public Image substituteIcon(@Nonnull Project project, @Nonnull VirtualFile file) { if (file.isDirectory()) return null; FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(file.getNameSequence()); Image icon = fileType == UnknownFileType.INSTANCE || fileType == PlainTextFileType.INSTANCE ? AllIcons.Debugger.Console : ObjectUtils.notNull(fileType.getIcon(), AllIcons.Debugger.Console); return ImageEffects.layered(icon, AllIcons.Nodes.RunnableMark); }
Example #12
Source File: ActionManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
private void unregisterAction(@Nonnull String actionId, boolean removeFromGroups) { synchronized (myLock) { if (!myId2Action.containsKey(actionId)) { if (LOG.isDebugEnabled()) { LOG.debug("action with ID " + actionId + " wasn't registered"); } return; } AnAction oldValue = myId2Action.remove(actionId); myAction2Id.remove(oldValue); myId2Index.remove(actionId); for (final Map.Entry<PluginId, Collection<String>> entry : myPlugin2Id.entrySet()) { Collection<String> pluginActions = entry.getValue(); pluginActions.remove(actionId); } if (removeFromGroups) { //CustomActionsSchema customActionSchema = ApplicationManager.getApplication().getServiceIfCreated(CustomActionsSchema.class); for (String groupId : myId2GroupId.get(actionId)) { //if (customActionSchema != null) { // customActionSchema.invalidateCustomizedActionGroup(groupId); //} DefaultActionGroup group = ObjectUtils.assertNotNull((DefaultActionGroup)getActionOrStub(groupId)); group.remove(oldValue, actionId); } } if (oldValue instanceof ActionGroup) { myId2GroupId.values().remove(actionId); } } }
Example #13
Source File: VirtualFilePointerManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private synchronized VirtualFilePointerImpl getOrCreate(VirtualFile file, String path, String url, boolean recursive, @Nonnull Disposable parentDisposable, @Nullable VirtualFilePointerListener listener, @Nonnull NewVirtualFileSystem fs) { VirtualFilePointerListener nl = ObjectUtils.notNull(listener, NULL_LISTENER); Map<VirtualFilePointerListener, FilePointerPartNode> myPointers = myRoots.computeIfAbsent(fs, __ -> new THashMap<>()); FilePointerPartNode root = myPointers.computeIfAbsent(nl, __ -> FilePointerPartNode.createFakeRoot()); FilePointerPartNode node = file == null ? FilePointerPartNode.findOrCreateNodeByPath(root, path, fs) : root.findOrCreateNodeByFile(file, fs); VirtualFilePointerImpl pointer = node.getAnyPointer(); if (pointer == null) { pointer = new VirtualFilePointerImpl(); Pair<VirtualFile, String> fileAndUrl = Pair.create(file, file == null ? url : file.getUrl()); node.associate(pointer, fileAndUrl); for (FilePointerPartNode n = node; n != null; n = n.parent) { n.pointersUnder++; } } pointer.incrementUsageCount(1); pointer.recursive = recursive; root.checkConsistency(); DelegatingDisposable.registerDisposable(parentDisposable, pointer); myPointerSetModCount++; return pointer; }
Example #14
Source File: Jsr223IdeScriptEngineManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nullable @Override public IdeScriptEngine getEngineForFileExtension(@Nonnull final String extension, @Nullable ClassLoader loader) { ClassLoader l = ObjectUtils.notNull(loader, AllPluginsLoader.INSTANCE); return ClassLoaderUtil.runWithClassLoader(l, new Computable<IdeScriptEngine>() { @Override public IdeScriptEngine compute() { return createIdeScriptEngine(getScriptEngineManager().getEngineByExtension(extension)); } }); }
Example #15
Source File: GraphCommitCellRenderer.java From consulo with Apache License 2.0 | 5 votes |
public void customize(@Nonnull GraphCommitCell cell, boolean isSelected, boolean hasFocus, int row, int column) { clear(); setPaintFocusBorder(false); acquireState(myGraphTable, isSelected, hasFocus, row, column); getCellState().updateRenderer(this); setBorder(null); myGraphImage = getGraphImage(cell.getPrintElements()); SimpleTextAttributes style = myGraphTable.applyHighlighters(this, row, column, hasFocus, isSelected); Collection<VcsRef> refs = cell.getRefsToThisCommit(); Color baseForeground = ObjectUtils.assertNotNull(myGraphTable.getBaseStyle(row, column, hasFocus, isSelected).getForeground()); append(""); // appendTextPadding wont work without this if (myReferencePainter.isLeftAligned()) { myReferencePainter.customizePainter(this, refs, getBackground(), baseForeground, isSelected, getAvailableWidth(column)); appendTextPadding(myGraphImage.getWidth() + myReferencePainter.getSize().width + LabelPainter.RIGHT_PADDING); appendText(cell, style, isSelected); } else { appendTextPadding(myGraphImage.getWidth()); appendText(cell, style, isSelected); myReferencePainter.customizePainter(this, refs, getBackground(), baseForeground, isSelected, getAvailableWidth(column)); } }
Example #16
Source File: NavBarPanel.java From consulo with Apache License 2.0 | 5 votes |
static Object expandDirsWithJustOneSubdir(Object target) { if (target instanceof PsiElement && !((PsiElement)target).isValid()) return target; if (target instanceof PsiDirectory) { PsiDirectory directory = (PsiDirectory)target; for (VirtualFile file = directory.getVirtualFile(), next; ; file = next) { VirtualFile[] children = file.getChildren(); VirtualFile child = children.length == 1 ? children[0] : null; //noinspection AssignmentToForLoopParameter next = child != null && child.isDirectory() && !child.is(VFileProperty.SYMLINK) ? child : null; if (next == null) return ObjectUtils.notNull(directory.getManager().findDirectory(file), directory); } } return target; }
Example #17
Source File: LabelPainter.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public static VcsLogRefManager getRefManager(@Nonnull VcsLogData logData, @Nonnull Collection<VcsRef> references) { if (!references.isEmpty()) { VirtualFile root = ObjectUtils.assertNotNull(ContainerUtil.getFirstItem(references)).getRoot(); return logData.getLogProvider(root).getReferenceManager(); } else { return null; } }
Example #18
Source File: AnnotateDiffViewerAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void showAnnotation(@Nonnull UnifiedDiffViewer viewer, @Nonnull Side side, @Nonnull AnnotationData data) { if (side != viewer.getMasterSide()) return; Project project = ObjectUtils.assertNotNull(viewer.getProject()); UnifiedUpToDateLineNumberProvider lineNumberProvider = new UnifiedUpToDateLineNumberProvider(viewer, side); AnnotateToggleAction.doAnnotate(viewer.getEditor(), project, null, data.annotation, data.vcs, lineNumberProvider); }
Example #19
Source File: PhpAutoPopupTypedHandler.java From idea-php-advanced-autocomplete with MIT License | 5 votes |
@NotNull @Override public Result checkAutoPopup(char charTyped, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { if (!(file instanceof PhpFile)) { return Result.CONTINUE; } if (charTyped != '%') { return Result.CONTINUE; } int offset = editor.getCaretModel().getOffset(); PsiElement psiElement = file.findElementAt(offset); ParameterList parameterList = PhpPsiUtil.getParentByCondition(psiElement, true, ParameterList.INSTANCEOF, Statement.INSTANCEOF); if (parameterList != null) { FunctionReference functionCall = ObjectUtils.tryCast(parameterList.getParent(), FunctionReference.class); String fqn = PhpElementsUtil.resolveFqn(functionCall); if (/*charTyped == '%' &&*/ PhpElementsUtil.isFormatFunction(fqn)) { if (StringUtil.getPrecedingCharNum(editor.getDocument().getCharsSequence(), offset, '%') % 2 == 0) { PhpCompletionUtil.showCompletion(editor); } } } return Result.CONTINUE; }
Example #20
Source File: LightFilePointer.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static String toPresentableUrl(@Nonnull String url) { String path = VirtualFileManager.extractPath(url); String protocol = VirtualFileManager.extractProtocol(url); VirtualFileSystem fileSystem = VirtualFileManager.getInstance().getFileSystem(protocol); return ObjectUtils.notNull(fileSystem, StandardFileSystems.local()).extractPresentableUrl(path); }
Example #21
Source File: RunIdeConsoleAction.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static RunContentDescriptor getConsoleView(@Nonnull Project project, @Nonnull VirtualFile file) { PsiFile psiFile = ObjectUtils.assertNotNull(PsiManager.getInstance(project).findFile(file)); WeakReference<RunContentDescriptor> ref = psiFile.getCopyableUserData(DESCRIPTOR_KEY); RunContentDescriptor descriptor = ref == null ? null : ref.get(); if (descriptor == null || descriptor.getExecutionConsole() == null) { descriptor = createConsoleView(project, psiFile); psiFile.putCopyableUserData(DESCRIPTOR_KEY, new WeakReference<>(descriptor)); } return descriptor; }
Example #22
Source File: AnnotateDiffViewerAction.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable private static DiffViewerBase getViewer(AnActionEvent e) { DiffViewerBase diffViewer = ObjectUtils.tryCast(e.getData(DiffDataKeys.DIFF_VIEWER), DiffViewerBase.class); if (diffViewer != null) return diffViewer; TextMergeViewer mergeViewer = ObjectUtils.tryCast(e.getData(DiffDataKeys.MERGE_VIEWER), TextMergeViewer.class); if (mergeViewer != null) return mergeViewer.getViewer(); return null; }
Example #23
Source File: JBTextArea.java From consulo with Apache License 2.0 | 5 votes |
public JBTextArea(Document doc, String text, int rows, int columns) { super(doc, text, rows, columns); myEmptyText = new TextComponentEmptyText(this) { @Override protected boolean isStatusVisible() { Object function = getClientProperty("StatusVisibleFunction"); if (function instanceof BooleanFunction) { //noinspection unchecked return ((BooleanFunction<JTextComponent>)function).fun(JBTextArea.this); } return super.isStatusVisible(); } @Override protected Rectangle getTextComponentBound() { Insets insets = ObjectUtils.notNull(getInsets(), JBUI.emptyInsets()); Insets margin = ObjectUtils.notNull(getMargin(), JBUI.emptyInsets()); Insets ipad = getComponent().getIpad(); Dimension size = getSize(); int left = insets.left + margin.left - ipad.left; int top = insets.top + margin.top - ipad.top; int right = size.width - (insets.right + margin.right - ipad.right); return new Rectangle(left, top, right - left, getRowHeight()); } }; getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@Nonnull DocumentEvent e) { invalidate(); revalidate(); repaint(); } }); }
Example #24
Source File: LoadTextUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static Pair.NonNull<Charset, byte[]> getOverriddenCharsetByBOM(@Nonnull byte[] content, @Nonnull Charset charset) { if (charset.name().contains(CharsetToolkit.UTF8) && CharsetToolkit.hasUTF8Bom(content)) { return Pair.createNonNull(charset, CharsetToolkit.UTF8_BOM); } Charset charsetFromBOM = CharsetToolkit.guessFromBOM(content); if (charsetFromBOM != null) { byte[] bom = ObjectUtils.notNull(CharsetToolkit.getMandatoryBom(charsetFromBOM), ArrayUtilRt.EMPTY_BYTE_ARRAY); return Pair.createNonNull(charsetFromBOM, bom); } return Pair.createNonNull(charset, ArrayUtilRt.EMPTY_BYTE_ARRAY); }
Example #25
Source File: CheckBoxList.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static Dimension getCheckBoxDimension(@Nonnull JCheckBox checkBox) { Icon icon = null; BasicRadioButtonUI ui = ObjectUtils.tryCast(checkBox.getUI(), BasicRadioButtonUI.class); if (ui != null) { icon = ui.getDefaultIcon(); } if (icon == null) { // com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxUI.getDefaultIcon() icon = JBUI.scale(EmptyIcon.create(20)); } Insets margin = checkBox.getMargin(); return new Dimension(margin.left + icon.getIconWidth(), margin.top + icon.getIconHeight()); }
Example #26
Source File: CreatePatchConfigurationPanel.java From consulo with Apache License 2.0 | 5 votes |
public CreatePatchConfigurationPanel(@Nonnull final Project project) { myProject = project; initMainPanel(); myFileNameField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog( new FileSaverDescriptor("Save Patch to", ""), myMainPanel); final String path = FileUtil.toSystemIndependentName(getFileName()); final int idx = path.lastIndexOf("/"); VirtualFile baseDir = idx == -1 ? project.getBaseDir() : (LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path.substring(0, idx)))); baseDir = baseDir == null ? project.getBaseDir() : baseDir; final String name = idx == -1 ? path : path.substring(idx + 1); final VirtualFileWrapper fileWrapper = dialog.save(baseDir, name); if (fileWrapper != null) { myFileNameField.setText(fileWrapper.getFile().getPath()); } } }); myFileNameField.setTextFieldPreferredWidth(TEXT_FIELD_WIDTH); myBasePathField.setTextFieldPreferredWidth(TEXT_FIELD_WIDTH); myBasePathField.addBrowseFolderListener(new TextBrowseFolderListener(FileChooserDescriptorFactory.createSingleFolderDescriptor())); myWarningLabel.setForeground(JBColor.RED); selectBasePath(ObjectUtils.assertNotNull(myProject.getBaseDir())); initEncodingCombo(); }
Example #27
Source File: QuickEditAction.java From consulo with Apache License 2.0 | 5 votes |
public QuickEditHandler invokeImpl(@Nonnull final Project project, final Editor editor, PsiFile file) throws IncorrectOperationException { int offset = editor.getCaretModel().getOffset(); Pair<PsiElement, TextRange> pair = ObjectUtils.assertNotNull(getRangePair(file, editor)); PsiFile injectedFile = (PsiFile)pair.first; QuickEditHandler handler = getHandler(project, injectedFile, editor, file); if (!ApplicationManager.getApplication().isUnitTestMode()) { DocumentWindow documentWindow = InjectedLanguageUtil.getDocumentWindow(injectedFile); if (documentWindow != null) { handler.navigate(InjectedLanguageUtil.hostToInjectedUnescaped(documentWindow, offset)); } } return handler; }
Example #28
Source File: AbstractAutoTestManager.java From consulo with Apache License 2.0 | 5 votes |
public static void saveConfigurationState(State state, RunProfile profile) { RunConfiguration runConfiguration = ObjectUtils.tryCast(profile, RunConfiguration.class); if (runConfiguration != null) { RunConfigurationDescriptor descriptor = new RunConfigurationDescriptor(); descriptor.myType = runConfiguration.getType().getId(); descriptor.myName = runConfiguration.getName(); state.myEnabledRunConfigurations.add(descriptor); } }
Example #29
Source File: ApplyPatchAction.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static ApplyFilePatch.Result tryApplyPatch(@javax.annotation.Nullable final Project project, @Nonnull final ApplyFilePatchBase patch, @javax.annotation.Nullable final ApplyPatchContext context, @Nonnull final VirtualFile file, @javax.annotation.Nullable final CommitContext commitContext) { final FilePatch patchBase = patch.getPatch(); return ApplicationManager.getApplication().runWriteAction( new Computable<ApplyFilePatch.Result>() { @Override public ApplyFilePatch.Result compute() { try { return patch.apply(file, context, project, VcsUtil.getFilePath(file), new Getter<CharSequence>() { @Override public CharSequence get() { final BaseRevisionTextPatchEP baseRevisionTextPatchEP = Extensions.findExtension(PatchEP.EP_NAME, project, BaseRevisionTextPatchEP.class); final String path = ObjectUtils.chooseNotNull(patchBase.getBeforeName(), patchBase.getAfterName()); return baseRevisionTextPatchEP.provideContent(path, commitContext); } }, commitContext); } catch (IOException e) { LOG.error(e); return ApplyFilePatch.Result.createThrow(e); } } }); }
Example #30
Source File: GroupNode.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @SuppressWarnings("unchecked") List<Node> getSwingChildren() { // on java 9 - children is Vector<TreeNode> List children = this.children; return ObjectUtils.notNull(children, Collections.<Node>emptyList()); }