@NotNull EditorWindow[] getOrderedWindows() { final List<EditorWindow> res = new ArrayList<EditorWindow>(); // Collector for windows in tree ordering: class Inner { private void collect(final JPanel panel) { final Component comp = panel.getComponent(0); if (comp instanceof Splitter) { final Splitter splitter = (Splitter) comp; collect((JPanel) splitter.getFirstComponent()); collect((JPanel) splitter.getSecondComponent()); } else if (comp instanceof JPanel || comp instanceof JBTabs) { final EditorWindow window = findWindowWith(comp); if (window != null) { res.add(window); } } } } // get root component and traverse splitters tree: if (getComponentCount() != 0) { final Component comp = getComponent(0); LOG.assertTrue(comp instanceof JPanel); final JPanel panel = (JPanel) comp; if (panel.getComponentCount() != 0) { new Inner().collect(panel); } } LOG.assertTrue(res.size() == myWindows.size()); return res.toArray(new EditorWindow[res.size()]); }
/** * @return default LookAndFeelInfo for the running OS. For Win32 and Linux the method returns * Alloy LAF or IDEA LAF if first not found, for Mac OS X it returns Aqua RubyMine uses Native * L&F for linux as well */ private UIManager.LookAndFeelInfo getDefaultLaf() { final String systemLafClassName = UIManager.getSystemLookAndFeelClassName(); if (SystemInfo.isMac) { UIManager.LookAndFeelInfo laf = findLaf(systemLafClassName); LOG.assertTrue(laf != null); return laf; } if (PlatformUtils.isRubyMine() || PlatformUtils.isPyCharm()) { final String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop")); if ("gnome".equals(desktop)) { UIManager.LookAndFeelInfo laf = findLaf(systemLafClassName); if (laf != null) { return laf; } LOG.info("Could not find system look and feel: " + laf); } } // Default final String defaultLafName = StartupUtil.getDefaultLAF(); if (defaultLafName != null) { UIManager.LookAndFeelInfo defaultLaf = findLaf(defaultLafName); if (defaultLaf != null) { return defaultLaf; } } UIManager.LookAndFeelInfo ideaLaf = findLaf( isIntelliJLafEnabled() ? IntelliJLaf.class.getName() : IdeaLookAndFeelInfo.CLASS_NAME); if (ideaLaf != null) { return ideaLaf; } throw new IllegalStateException("No default look&feel found"); }
public static Set<String> getPackageNames(final String url) throws IOException { final TreeSet<String> names = new TreeSet<String>(); final HTMLEditorKit.ParserCallback callback = new HTMLEditorKit.ParserCallback() { HTML.Tag myTag; @Override public void handleStartTag(HTML.Tag tag, MutableAttributeSet set, int i) { myTag = tag; } public void handleText(char[] data, int pos) { if (myTag != null && "a".equals(myTag.toString())) { names.add(String.valueOf(data)); } } }; try { final URL repositoryUrl = new URL(url); final InputStream is = repositoryUrl.openStream(); final Reader reader = new InputStreamReader(is); try { new ParserDelegator().parse(reader, callback, true); } catch (IOException e) { LOG.warn(e); } finally { reader.close(); } } catch (MalformedURLException e) { LOG.warn(e); } return names; }
@Nullable private XmlFile createAnnotationsXml( @NotNull VirtualFile root, @NonNls @NotNull String packageName) { final String[] dirs = packageName.split("[\\.]"); for (String dir : dirs) { if (dir.isEmpty()) break; VirtualFile subdir = root.findChild(dir); if (subdir == null) { try { subdir = root.createChildDirectory(null, dir); } catch (IOException e) { LOG.error(e); } } root = subdir; } final PsiDirectory directory = myPsiManager.findDirectory(root); if (directory == null) return null; final PsiFile psiFile = directory.findFile(ANNOTATIONS_XML); if (psiFile instanceof XmlFile) { return (XmlFile) psiFile; } try { final PsiFileFactory factory = PsiFileFactory.getInstance(myPsiManager.getProject()); return (XmlFile) directory.add( factory.createFileFromText(ANNOTATIONS_XML, XmlFileType.INSTANCE, "<root></root>")); } catch (IncorrectOperationException e) { LOG.error(e); } return null; }
public Process createProcess() throws ExecutionException { if (LOG.isDebugEnabled()) { LOG.debug("Executing [" + getCommandLineString() + "]"); } List<String> commands; try { checkWorkingDirectory(); if (StringUtil.isEmptyOrSpaces(myExePath)) { throw new ExecutionException( IdeBundle.message("run.configuration.error.executable.not.specified")); } commands = CommandLineUtil.toCommandLine(myExePath, myProgramParams.getList()); } catch (ExecutionException e) { LOG.warn(e); throw e; } try { ProcessBuilder builder = new ProcessBuilder(commands); setupEnvironment(builder.environment()); builder.directory(myWorkDirectory); builder.redirectErrorStream(myRedirectErrorStream); return builder.start(); } catch (IOException e) { LOG.warn(e); throw new ProcessNotCreatedException(e.getMessage(), e, this); } }
@Override public void contentsChanged(VirtualFileEvent event) { if (event.isFromSave()) return; final VirtualFile file = event.getFile(); final Document document = getCachedDocument(file); if (document == null) { myMultiCaster.fileWithNoDocumentChanged(file); return; } if (isBinaryWithDecompiler(file)) { myMultiCaster.fileWithNoDocumentChanged( file); // This will generate PSI event at FileManagerImpl } long documentStamp = document.getModificationStamp(); long oldFileStamp = event.getOldModificationStamp(); if (documentStamp != oldFileStamp) { LOG.info("reload from disk?"); LOG.info(" documentStamp:" + documentStamp); LOG.info(" oldFileStamp:" + oldFileStamp); if (file.isValid() && askReloadFromDisk(file, document)) { reloadFromDisk(document); } } else { reloadFromDisk(document); } }
private static void retainOnlyJarsAndDirectories(List<VirtualFile> woSdk) { for (Iterator<VirtualFile> iterator = woSdk.iterator(); iterator.hasNext(); ) { VirtualFile file = iterator.next(); final VirtualFile local = ArchiveVfsUtil.getVirtualFileForJar(file); final boolean dir = file.isDirectory(); final String name = file.getName(); if (LOG.isDebugEnabled()) { LOG.debug( "Considering: " + file.getPath() + "; local=" + local + "; dir=" + dir + "; name=" + name); } if (dir || local != null) { continue; } if (name.endsWith(".jar")) { continue; } LOG.debug("Removing"); iterator.remove(); } }
private static LineRange expandLineRangeToCoverPsiElements( final LineRange range, Editor editor, final PsiFile file) { Pair<PsiElement, PsiElement> psiRange = getElementRange(editor, file, range); if (psiRange == null) return null; final PsiElement parent = PsiTreeUtil.findCommonParent(psiRange.getFirst(), psiRange.getSecond()); Pair<PsiElement, PsiElement> elementRange = getElementRange(parent, psiRange.getFirst(), psiRange.getSecond()); if (elementRange == null) return null; int endOffset = elementRange.getSecond().getTextRange().getEndOffset(); Document document = editor.getDocument(); if (endOffset > document.getTextLength()) { LOG.assertTrue(!PsiDocumentManager.getInstance(file.getProject()).isUncommited(document)); LOG.assertTrue(PsiDocumentManagerImpl.checkConsistency(file, document)); } int endLine; if (endOffset == document.getTextLength()) { endLine = document.getLineCount(); } else { endLine = editor.offsetToLogicalPosition(endOffset).line + 1; endLine = Math.min(endLine, document.getLineCount()); } int startLine = Math.min( range.startLine, editor.offsetToLogicalPosition(elementRange.getFirst().getTextOffset()).line); endLine = Math.max(endLine, range.endLine); return new LineRange(startLine, endLine); }
private void performShutdown() { if (myShutDown.compareAndSet(false, true)) { LOG.info("VFS dispose started"); FSRecords.dispose(); LOG.info("VFS dispose completed"); } }
public static boolean isJsonSchema( @NotNull JsonSchemaExportedDefinitions definitions, @NotNull VirtualFile key, @NotNull final String string, Consumer<String> errorConsumer) throws IOException { final JsonSchemaReader reader = new JsonSchemaReader(key); java.io.StringReader stringReader = new java.io.StringReader(string); try { reader.read(stringReader, null); } catch (Exception e) { LOG.info(e); errorConsumer.consume(e.getMessage()); return false; } // have two stages so that just syntax errors do not clear cache stringReader = new java.io.StringReader(string); try { reader.read(stringReader, definitions); } catch (Exception e) { LOG.info(e); errorConsumer.consume(e.getMessage()); throw e; } return true; }
public static GrStatement replaceStatement( GrStatementOwner declarationOwner, ExtractInfoHelper helper) { GrStatement realStatement; if (declarationOwner != null && !isSingleExpression(helper.getStatements())) { // Replace set of statements final GrStatement[] newStatement = createResultStatement(helper); // add call statement final GrStatement[] statements = helper.getStatements(); LOG.assertTrue(statements.length > 0); realStatement = null; for (GrStatement statement : newStatement) { realStatement = declarationOwner.addStatementBefore(statement, statements[0]); GrReferenceAdjuster.shortenReferences(realStatement); } LOG.assertTrue(realStatement != null); // remove old statements removeOldStatements(declarationOwner, helper); PsiImplUtil.removeNewLineAfter(realStatement); } else { // Expression call replace GrExpression methodCall = createMethodCall(helper); GrExpression oldExpr = (GrExpression) helper.getStatements()[0]; realStatement = oldExpr.replaceWithExpression(methodCall, true); GrReferenceAdjuster.shortenReferences(realStatement); } return realStatement; }
@Override protected boolean isComponentSuitable(@Nullable Map<String, String> options) { if (!super.isComponentSuitable(options)) { return false; } if (options == null || options.isEmpty()) { return true; } for (String optionName : options.keySet()) { if ("workspace".equals(optionName)) { continue; } // we cannot filter using module options because at this moment module file data could be not // loaded String message = "Don't specify " + optionName + " in the component registration, transform component to service and implement your logic in your getInstance() method"; if (ApplicationManager.getApplication().isUnitTestMode()) { LOG.error(message); } else { LOG.warn(message); } } return true; }
/** * Check if rebase is in progress, propose to resolve conflicts. * * @return true if rebase is in progress, which means that update can't continue. */ private boolean checkRebaseInProgress() { LOG.info("checkRebaseInProgress: checking if there is an unfinished rebase process..."); final GitRebaser rebaser = new GitRebaser(myProject, myGit, myProgressIndicator); final Collection<VirtualFile> rebasingRoots = rebaser.getRebasingRoots(); if (rebasingRoots.isEmpty()) { return false; } LOG.info("checkRebaseInProgress: roots with unfinished rebase: " + rebasingRoots); GitConflictResolver.Params params = new GitConflictResolver.Params(); params.setErrorNotificationTitle("Can't update"); params.setMergeDescription( "You have unfinished rebase process. These conflicts must be resolved before update."); params.setErrorNotificationAdditionalDescription( "Then you may <b>continue rebase</b>. <br/> You also may <b>abort rebase</b> to restore the original branch and stop rebasing."); params.setReverse(true); return !new GitConflictResolver(myProject, myGit, rebasingRoots, params) { @Override protected boolean proceedIfNothingToMerge() { return rebaser.continueRebase(rebasingRoots); } @Override protected boolean proceedAfterAllMerged() { return rebaser.continueRebase(rebasingRoots); } }.merge(); }
TextEditorComponent( @NotNull final Project project, @NotNull final VirtualFile file, @NotNull final TextEditorImpl textEditor) { super(new BorderLayout(), textEditor); myProject = project; myFile = file; myTextEditor = textEditor; myDocument = FileDocumentManager.getInstance().getDocument(myFile); LOG.assertTrue(myDocument != null); myDocumentListener = new MyDocumentListener(); myDocument.addDocumentListener(myDocumentListener); myEditorMouseListener = new MyEditorMouseListener(); myEditorPropertyChangeListener = new MyEditorPropertyChangeListener(); myConnection = project.getMessageBus().connect(); myConnection.subscribe(FileTypeManager.TOPIC, new MyFileTypeListener()); myVirtualFileListener = new MyVirtualFileListener(); myFile.getFileSystem().addVirtualFileListener(myVirtualFileListener); myEditor = createEditor(); add(myEditor.getComponent(), BorderLayout.CENTER); myModified = isModifiedImpl(); myValid = isEditorValidImpl(); LOG.assertTrue(myValid); }
@Nullable public static String getReferencePrefix(@NotNull PsiElement insertedElement, int offsetInFile) { final PsiReference ref = insertedElement.getContainingFile().findReferenceAt(offsetInFile); if (ref != null) { final PsiElement element = ref.getElement(); final int endIndex = offsetInFile - element.getTextRange().getStartOffset(); final int beginIndex = ref.getRangeInElement().getStartOffset(); if (beginIndex > endIndex) { LOG.error( "Inconsistent reference (found at offset not included in its range): ref=" + ref + " element=" + element + " text=" + element.getText()); } if (beginIndex < 0) { LOG.error( "Inconsistent reference (begin < 0): ref=" + ref + " element=" + element + "; begin=" + beginIndex + " text=" + element.getText()); } LOG.assertTrue(endIndex >= 0); return element.getText().substring(beginIndex, endIndex); } return null; }
private boolean merge(boolean mergeDialogInvokedFromNotification) { try { final Collection<VirtualFile> initiallyUnmergedFiles = getUnmergedFiles(myRoots); if (initiallyUnmergedFiles.isEmpty()) { LOG.info("merge: no unmerged files"); return mergeDialogInvokedFromNotification ? true : proceedIfNothingToMerge(); } else { showMergeDialog(initiallyUnmergedFiles); final Collection<VirtualFile> unmergedFilesAfterResolve = getUnmergedFiles(myRoots); if (unmergedFilesAfterResolve.isEmpty()) { LOG.info("merge no more unmerged files"); return mergeDialogInvokedFromNotification ? true : proceedAfterAllMerged(); } else { LOG.info("mergeFiles unmerged files remain: " + unmergedFilesAfterResolve); if (mergeDialogInvokedFromNotification) { notifyUnresolvedRemainAfterNotification(); } else { notifyUnresolvedRemain(); } } } } catch (VcsException e) { if (myVcs.getExecutableValidator().checkExecutableAndNotifyIfNeeded()) { notifyException(e); } } return false; }
@Nullable public PsiElement[] getElements(boolean[] isCopied) { try { Transferable content = myCopyPasteManager.getContents(); if (content == null) { return null; } Object transferData; try { transferData = content.getTransferData(ourDataFlavor); } catch (UnsupportedFlavorException e) { return null; } catch (IOException e) { return null; } if (!(transferData instanceof MyData)) { return null; } MyData dataProxy = (MyData) transferData; if (!Comparing.equal(dataProxy, myRecentData)) { return null; } if (isCopied != null) { isCopied[0] = myRecentData.isCopied(); } return myRecentData.getElements(); } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug(e); } return null; } }
public void scan() { List<VirtualFile> workQueue = myWorkQueue; myWorkQueue = new ArrayList<VirtualFile>(); boolean hasEventsToFire = myFinishRunnable != null || !myEvents.isEmpty(); if (!workQueue.isEmpty()) { LocalFileSystemImpl fs = (LocalFileSystemImpl) LocalFileSystem.getInstance(); fs.markSuspiciousFilesDirty(workQueue); FileWatcher watcher = fs.getFileWatcher(); for (VirtualFile file : workQueue) { NewVirtualFile nvf = (NewVirtualFile) file; if (!myIsRecursive && (!myIsAsync || !watcher.isWatched( nvf))) { // We're unable to definitely refresh synchronously by means of file // watcher. nvf.markDirty(); } RefreshWorker worker = new RefreshWorker(file, myIsRecursive); long t = LOG.isDebugEnabled() ? System.currentTimeMillis() : 0; worker.scan(); List<VFileEvent> events = worker.getEvents(); if (t != 0) { t = System.currentTimeMillis() - t; LOG.debug(file + " scanned in " + t + " ms, events: " + events); } myEvents.addAll(events); if (!events.isEmpty()) hasEventsToFire = true; } } iHaveEventsToFire = hasEventsToFire; }
@Override public void run(@NotNull ProgressIndicator indicator) { try { mySocket = myServerSocket.accept(); final ExecutionException[] ex = new ExecutionException[1]; DumbService.getInstance(getProject()) .repeatUntilPassesInSmartMode( new Runnable() { @Override public void run() { try { search(); } catch (ExecutionException e) { ex[0] = e; } } }); if (ex[0] != null) { logCantRunException(ex[0]); } } catch (ProcessCanceledException e) { throw e; } catch (IOException e) { LOG.info(e); } catch (Throwable e) { LOG.error(e); } }
public static void checkSanity() { long t = System.currentTimeMillis(); try { r.lock(); final int fileLength = (int) getRecords().length(); assert fileLength % RECORD_SIZE == 0; int recordCount = fileLength / RECORD_SIZE; IntArrayList usedAttributeRecordIds = new IntArrayList(); IntArrayList validAttributeIds = new IntArrayList(); for (int id = 2; id < recordCount; id++) { int flags = getFlags(id); LOG.assertTrue( (flags & ~ALL_VALID_FLAGS) == 0, "Invalid flags: 0x" + Integer.toHexString(flags) + ", id: " + id); if ((flags & FREE_RECORD_FLAG) != 0) { LOG.assertTrue( DbConnection.myFreeRecords.contains(id), "Record, marked free, not in free list: " + id); } else { LOG.assertTrue( !DbConnection.myFreeRecords.contains(id), "Record, not marked free, in free list: " + id); checkRecordSanity(id, recordCount, usedAttributeRecordIds, validAttributeIds); } } } finally { r.unlock(); } t = System.currentTimeMillis() - t; LOG.info("Sanity check took " + t + " ms"); }
@SuppressWarnings("OverlyBroadCatchBlock") private void multiCast(@NotNull Method method, Object[] args) { try { method.invoke(myBus.syncPublisher(AppTopics.FILE_DOCUMENT_SYNC), args); } catch (ClassCastException e) { LOG.error("Arguments: " + Arrays.toString(args), e); } catch (Exception e) { LOG.error(e); } // Allows pre-save document modification for (FileDocumentManagerListener listener : getListeners()) { try { method.invoke(listener, args); } catch (Exception e) { LOG.error(e); } } // stripping trailing spaces try { method.invoke(myTrailingSpacesStripper, args); } catch (Exception e) { LOG.error(e); } }
public final void showError(@NotNull String message, @NotNull Throwable e) { if (getProject().isDisposed()) { return; } while (e instanceof InvocationTargetException) { if (e.getCause() == null) { break; } e = e.getCause(); } ErrorInfo info = new ErrorInfo(); info.myMessage = info.myDisplayMessage = message; info.myThrowable = e; configureError(info); if (info.myShowMessage) { showErrorPage(info); } if (info.myShowLog) { LOG.error( LogMessageEx.createEvent( info.myDisplayMessage, info.myMessage + "\n" + ExceptionUtil.getThrowableText(info.myThrowable), new Attachment(myFile))); } else { LOG.info(info.myDisplayMessage + "\n" + info.myMessage, info.myThrowable); } }
public synchronized void addItem(final CompletionResult item) { if (!isRunning()) return; ProgressManager.checkCanceled(); final boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode(); if (!unitTestMode) { LOG.assertTrue(!ApplicationManager.getApplication().isDispatchThread()); } LOG.assertTrue(myParameters.getPosition().isValid()); myItemSorters.put(item.getLookupElement(), (CompletionSorterImpl) item.getSorter()); myLookup.addItem(item.getLookupElement(), item.getPrefixMatcher()); myCount++; if (myCount == 1) { ApplicationManager.getApplication() .executeOnPooledThread( new Runnable() { public void run() { try { Thread.sleep(300); } catch (InterruptedException ignore) { } finally { myFreezeSemaphore.up(); } } }); } myQueue.queue(myUpdate); }
private void finishCompletionProcess(boolean disposeOffsetMap) { cancel(); ApplicationManager.getApplication().assertIsDispatchThread(); Disposer.dispose(myQueue); LookupManager.getInstance(getProject()).removePropertyChangeListener(myLookupManagerListener); CompletionProgressIndicator currentCompletion = CompletionServiceImpl.getCompletionService().getCurrentCompletion(); LOG.assertTrue(currentCompletion == this, currentCompletion + "!=" + this); CompletionServiceImpl.assertPhase( CompletionPhase.BgCalculation.class, CompletionPhase.ItemsCalculated.class, CompletionPhase.Synchronous.class, CompletionPhase.CommittingDocuments.class); if (CompletionServiceImpl.getCompletionPhase() instanceof CompletionPhase.CommittingDocuments) { LOG.assertTrue( CompletionServiceImpl.getCompletionPhase().indicator != null, CompletionServiceImpl.getCompletionPhase()); ((CompletionPhase.CommittingDocuments) CompletionServiceImpl.getCompletionPhase()).replaced = true; } CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion); if (disposeOffsetMap) { disposeOffsetMaps(); } }
static void log( ProgressIndicator progressIndicator, TextEditorHighlightingPass pass, @NonNls @NotNull Object... info) { if (LOG.isDebugEnabled()) { CharSequence docText = pass == null || pass.getDocument() == null ? "" : ": '" + StringUtil.first(pass.getDocument().getCharsSequence(), 10, true) + "'"; synchronized (PassExecutorService.class) { String infos = StringUtil.join(info, Functions.TO_STRING(), " "); String message = StringUtil.repeatSymbol(' ', getThreadNum() * 4) + " " + pass + " " + infos + "; progress=" + (progressIndicator == null ? null : progressIndicator.hashCode()) + " " + (progressIndicator == null ? "?" : progressIndicator.isCanceled() ? "X" : "V") + docText; LOG.debug(message); // System.out.println(message); } } }
private static PsiExpression getArg(PsiElement element) { final PsiExpressionList argumentList = ((PsiCall) element.getParent()).getArgumentList(); LOG.assertTrue(argumentList != null); final PsiExpression[] args = argumentList.getExpressions(); LOG.assertTrue(args.length == 1); return args[0]; }
@Override public InputStream sendXmlRpc(byte[] request) throws IOException { // Create a trust manager that does not validate certificate for this connection TrustManager[] trustAllCerts = new TrustManager[] {new PyPITrustManager()}; try { SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustAllCerts, new SecureRandom()); final HttpConfigurable settings = HttpConfigurable.getInstance(); con = settings.openConnection(PYPI_LIST_URL); if (con instanceof HttpsURLConnection) { ((HttpsURLConnection) con).setSSLSocketFactory(sslContext.getSocketFactory()); } con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setAllowUserInteraction(false); con.setRequestProperty("Content-Length", Integer.toString(request.length)); con.setRequestProperty("Content-Type", "text/xml"); if (auth != null) { con.setRequestProperty("Authorization", "Basic " + auth); } OutputStream out = con.getOutputStream(); out.write(request); out.flush(); out.close(); return con.getInputStream(); } catch (NoSuchAlgorithmException e) { LOG.warn(e.getMessage()); } catch (KeyManagementException e) { LOG.warn(e.getMessage()); } return super.sendXmlRpc(request); }
private void updateFinished() { myDumb = false; if (myProject.isDisposed()) return; if (ApplicationManager.getApplication().isInternal()) LOG.info("updateFinished"); try { myPublisher.exitDumbMode(); FileEditorManagerEx.getInstanceEx(myProject).refreshIcons(); } finally { // It may happen that one of the pending runWhenSmart actions triggers new dumb mode; // in this case we should quit processing pending actions and postpone them until the newly // started dumb mode finishes. while (!myDumb) { final Runnable runnable; synchronized (myRunWhenSmartQueue) { if (myRunWhenSmartQueue.isEmpty()) { break; } runnable = myRunWhenSmartQueue.pullFirst(); } try { runnable.run(); } catch (Throwable e) { LOG.error(e); } } } }
private static void removeParametersFromCall( GrMethodCallExpression methodCall, GrIntroduceParameterSettings settings) { final GroovyResolveResult resolveResult = methodCall.advancedResolve(); final PsiElement resolved = resolveResult.getElement(); LOG.assertTrue(resolved instanceof PsiMethod); final GrClosureSignature signature = GrClosureSignatureUtil.createSignature( (PsiMethod) resolved, resolveResult.getSubstitutor()); final GrClosureSignatureUtil.ArgInfo<PsiElement>[] argInfos = GrClosureSignatureUtil.mapParametersToArguments(signature, methodCall); LOG.assertTrue(argInfos != null); settings .parametersToRemove() .forEach( new TIntProcedure() { @Override public boolean execute(int value) { final List<PsiElement> args = argInfos[value].args; for (PsiElement arg : args) { arg.delete(); } return true; } }); }
public synchronized void addItem(final CompletionResult item) { if (!isRunning()) return; ProgressManager.checkCanceled(); final boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode(); if (!unitTestMode) { LOG.assertTrue(!ApplicationManager.getApplication().isDispatchThread()); } LOG.assertTrue(myParameters.getPosition().isValid()); myItemSorters.put(item.getLookupElement(), (CompletionSorterImpl) item.getSorter()); myLookup.addItem(item.getLookupElement(), item.getPrefixMatcher()); myCount++; if (myCount == 1) { new Alarm(Alarm.ThreadToUse.SHARED_THREAD, this) .addRequest( new Runnable() { @Override public void run() { myFreezeSemaphore.up(); } }, 300); } myQueue.queue(myUpdate); }