@NotNull private String getPresentableName() { return ObjectUtils.notNull(myPresentableName, "go"); } }
@Nullable private static GoReferenceExpression unwrapParensAndCast(@Nullable PsiElement e) { while (e instanceof GoParenthesesExpr) { e = ((GoParenthesesExpr)e).getExpression(); } return ObjectUtils.tryCast(e, GoReferenceExpression.class); }
@Override public boolean isSearchInModuleContent(@NotNull Module aModule) { return GoSdkService.getInstance(ObjectUtils.assertNotNull(getProject())).isGoModule(aModule); }
@NotNull private DlvCommandProcessor getProcessor() { return assertNotNull(tryCast(getVm(), DlvVm.class)).getCommandProcessor(); }
public GoConsoleFilter(@NotNull Project project, @Nullable Module module, @Nullable String workingDirectoryUrl) { myProject = project; myModule = module; myWorkingDirectoryUrl = ObjectUtils.chooseNotNull(workingDirectoryUrl, VfsUtilCore.pathToUrl(System.getProperty("user.dir"))); }
elementCreateCall = myShortener.fun(StringUtil.getPackageName(info.second)) + "." + StringUtil.getShortName(info.second); String fieldType = ObjectUtils.notNull(useExactElements ? exactType : "IElementType"); String callFix = elementCreateCall.equals("new IElementType") ? ", null" : ""; out(fieldType + " " + elementType + " = " + elementCreateCall + "(\"" + elementType + "\"" + callFix + ");"); tokenCreateCall = myShortener.fun(StringUtil.getPackageName(tokenTypeFactory)) + "." + StringUtil.getShortName(tokenTypeFactory); String fieldType = ObjectUtils.notNull(useExactTokens ? exactType : null, "IElementType"); for (String tokenText : mySimpleTokens.keySet()) { String tokenName = ObjectUtils.chooseNotNull(mySimpleTokens.get(tokenText), tokenText); if (isIgnoredWhitespaceToken(tokenName, tokenText)) continue; sortedTokens.put(getElementType(tokenName), isRegexpToken(tokenText) ? tokenName : tokenText);
@Nullable public Project getEffectiveProject() { return myProject != null ? myProject : ObjectUtils.doIfNotNull(getModule(), Module::getProject); }
public BallerinaConsoleFilter(@NotNull Project project, @Nullable Module module, @Nullable String workingDirectoryUrl) { myProject = project; myModule = module; myWorkingDirectoryUrl = ObjectUtils.chooseNotNull(workingDirectoryUrl, VfsUtilCore.pathToUrl(System.getProperty("user.dir"))); }
@Nullable public static PerlCommandLine getPerlCommandLine(@NotNull Project project, @Nullable Sdk perlSdk, @Nullable VirtualFile scriptFile, @NotNull List<String> perlParameters, @NotNull List<String> scriptParameters) { if (perlSdk == null) { perlSdk = PerlProjectManager.getSdk(project, scriptFile); } return getPerlCommandLine(project, perlSdk, ObjectUtils.doIfNotNull(scriptFile, VirtualFile::getPath), perlParameters, scriptParameters); }
@NotNull private String getPresentableName() { return ObjectUtils.notNull(myPresentableName, "Ballerina Executor"); } }
@Nullable protected GoExpression getExpression(@NotNull PsiElement[] elements) { return ObjectUtils.tryCast(ArrayUtil.getFirstElement(elements), GoExpression.class); } }
@Override public boolean isSearchInModuleContent(@NotNull Module aModule) { return GoSdkService.getInstance(ObjectUtils.assertNotNull(getProject())).isGoModule(aModule); }
@Nullable @Override protected VirtualFile getInitialFile() { return ObjectUtils.chooseNotNull(super.getInitialFile(), GoSdkUtil.suggestSdkDirectory()); } }
@Contract("null->null") @Nullable public static PerlOsHandler from(@Nullable Sdk sdk) { return ObjectUtils.doIfNotNull(PerlHostData.from(sdk), PerlHostData::getOsHandler); } }
@NotNull private static GoExpression getTopmostExpression(@NotNull GoExpression expression) { return ObjectUtils.notNull(PsiTreeUtil.getTopmostParentOfType(expression, GoExpression.class), expression); }
/** * Sets the insert/replace state of the editor. */ private void setInsertEditorState(@NotNull Editor editor, boolean value) { final EditorEx editorEx = ObjectUtils.tryCast(editor, EditorEx.class); if (editorEx == null) return; editorEx.setInsertMode(value); }
Project project = ObjectUtils.assertNotNull(getProject()); PsiManager psiManager = PsiManager.getInstance(project); PsiFile referencePsiFile = psiManager.findFile(referenceFile);
@Nullable @Contract("null, _ -> null") public static <T extends PsiElement> T getNonStrictTopmostParentOfType(@Nullable PsiElement element, @NotNull Class<T> aClass) { T first = PsiTreeUtil.getNonStrictParentOfType(element, aClass); T topMost = PsiTreeUtil.getTopmostParentOfType(first, aClass); return ObjectUtils.chooseNotNull(topMost, first); }
@Contract("null->null") @Nullable static PerlImplementationData from(@Nullable Sdk sdk) { return ObjectUtils.doIfNotNull(PerlSdkAdditionalData.from(sdk), PerlSdkAdditionalData::getImplementationData); } }
@NotNull private static TextRange getTextRange(@NotNull PsiElement o) { return ObjectUtils.notNull(PsiTreeUtil.getParentOfType(o, GoTopLevelDeclaration.class), o).getTextRange(); } }