@Override public boolean isSearchInModuleContent(@NotNull Module aModule) { return GoSdkService.getInstance(ObjectUtils.assertNotNull(getProject())).isGoModule(aModule); }
@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(); }
Project project = ObjectUtils.assertNotNull(getProject()); PsiManager psiManager = PsiManager.getInstance(project); PsiFile referencePsiFile = psiManager.findFile(referenceFile);
@NotNull protected PsiElement findElementAtCaretOrInSelection() { SelectionModel selectionModel = myFixture.getEditor().getSelectionModel(); if (selectionModel.hasSelection()) { PsiElement left = myFixture.getFile().findElementAt(selectionModel.getSelectionStart()); PsiElement right = myFixture.getFile().findElementAt(selectionModel.getSelectionEnd() - 1); assertNotNull(left); assertNotNull(right); return ObjectUtils.assertNotNull(PsiTreeUtil.findCommonParent(left, right)); } else { return ObjectUtils.assertNotNull(myFixture.getFile().findElementAt(myFixture.getEditor().getCaretModel().getOffset())); } }
@NotNull public static String getName(PsiNameIdentifierOwner o) { return ObjectUtils.assertNotNull(o.getNameIdentifier()).getText(); }
@NotNull private String getAccessorType(@NotNull BnfRule rule) { if (Rule.isExternal(rule)) { Pair<String, String> first = ContainerUtil.getFirstItem(getAttribute(rule, KnownAttribute.IMPLEMENTS)); return ObjectUtils.assertNotNull(first).second; } else { return ruleInfo(rule).intfClass; } }
protected LivePreviewLanguage(@NotNull BnfFile grammarFile) { super(BASE_INSTANCE, ObjectUtils.assertNotNull(grammarFile.getVirtualFile()).getPath()); VirtualFile virtualFile = ObjectUtils.assertNotNull(grammarFile.getVirtualFile()); Application app = ApplicationManager.getApplication(); if (app.isUnitTestMode()) { myBnfFile = new SoftReference<>(grammarFile); myFilePointer = null; } else { myFilePointer = VirtualFilePointerManager.getInstance().create(virtualFile, app, null); myBnfFile = null; } }
@NotNull public static PsiNameIdentifierOwner setName(PsiNameIdentifierOwner o, String newName) { ObjectUtils.assertNotNull(o.getNameIdentifier()).replace(JFlexPsiElementFactory.createIdFromText(o.getProject(), newName)); return o; }
protected <T extends PsiElement> T getElementAtCaretWithoutInjection(@NotNull Class<T> clazz) { return ObjectUtils.assertNotNull(PsiTreeUtil.getParentOfType(getElementAtCaretWithoutInjection(), clazz, false)); }
@Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { BnfListEntry element = getElement(); PsiElement id = ObjectUtils.assertNotNull(element.getId()); id.replace(BnfElementFactory.createLeafFromText(element.getProject(), newElementName)); return element; } }
@Override public void actionPerformed(AnActionEvent e) { Editor editor = getPreviewEditor(e); if (editor == null) return; Boolean value = GrammarAtCaretPassFactory.GRAMMAR_AT_CARET_KEY.get(editor); GrammarAtCaretPassFactory.GRAMMAR_AT_CARET_KEY.set(editor, value == null ? Boolean.TRUE : null); Project project = ObjectUtils.assertNotNull(e.getProject()); DaemonCodeAnalyzer.getInstance(project).restart(); } }
@Nullable @Override public Result calculateResult(ExpressionContext context) { TemplateState state = TemplateManagerImpl.getTemplateState(context.getEditor()); assert state != null; TextResult text = ObjectUtils.assertNotNull(state.getVariableValue("TokenText")); String curText = GrammarUtil.unquote(text.getText()); if (ParserGeneratorUtil.isRegexpToken(curText)) { return state.getVariableValue("TokenName"); } else { return new TextResult("'" + curText + "'"); } }
@NotNull protected <T extends PsiElement> T getElementAtCaret(@NotNull Class<T> clazz) { int offset = myFixture.getEditor().getCaretModel().getOffset(); PsiElement focused = myFixture.getFile().findElementAt(offset); return ObjectUtils.assertNotNull(PsiTreeUtil.getParentOfType(focused, clazz, false)); }
final List<PsiElement> result = ContainerUtil.newArrayList(); BnfAttr thisAttr = ObjectUtils.assertNotNull(PsiTreeUtil.getParentOfType(getElement(), BnfAttr.class)); BnfAttrs thisAttrs = ObjectUtils.assertNotNull(PsiTreeUtil.getParentOfType(thisAttr, BnfAttrs.class)); BnfRule thisRule = PsiTreeUtil.getParentOfType(thisAttrs, BnfRule.class);
BnfRule rule = ObjectUtils.assertNotNull(myFile.getRule(ruleName)); if (Rule.isExternal(rule) || Rule.isFake(rule)) continue; if (myExpressionHelper.getExpressionInfo(rule) != null) continue;
boolean first = true; for (String ruleName : ownRuleNames) { BnfRule rule = ObjectUtils.assertNotNull(myFile.getRule(ruleName)); if (getAttribute(rule, KnownAttribute.ELEMENT_TYPE) != null) continue; if (!RuleGraphHelper.hasElementType(rule)) continue;
final String attrName = ObjectUtils.assertNotNull(PsiTreeUtil.getParentOfType(o, BnfAttr.class)).getName(); KnownAttribute attribute = KnownAttribute.getCompatibleAttribute(attrName); String value = StringUtil.unquoteString(o.getText());
PsiElement tokenId = ObjectUtils.assertNotNull(entry.getId()); PsiElement tokenValue = ObjectUtils.assertNotNull(entry.getLiteralExpression()); if (tokenName == null) { builder.replaceElement(tokenId, "TokenName", new TextExpression(tokenId.getText()), true);
@Override protected void setUp() throws Exception { super.setUp(); enableDebugLogging(); try { myProjectFixture = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getTestName(true)).getFixture(); myProjectFixture.setUp(); myCodeInsightFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(myProjectFixture); // Use the context info loaded earlier to setup the environment for TF work initializeTfEnvironment(); myProject = myProjectFixture.getProject(); myProjectRoot = myProject.getBaseDir(); myProjectPath = myProjectRoot.getPath(); myGitSettings = GitVcsSettings.getInstance(myProject); myGitRepositoryManager = GitUtil.getRepositoryManager(myProject); myPlatformFacade = ServiceManager.getService(myProject, GitPlatformFacade.class); myGit = ServiceManager.getService(myProject, Git.class); myVcs = ObjectUtils.assertNotNull(GitVcs.getInstance(myProject)); myVcs.doActivate(); addSilently(); removeSilently(); EULADialog.acceptEula(); } catch (Exception e) { tearDown(); throw e; } }