Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
279,600
Point (@NotNull String key) { return getLocationFor(project, key); }
getLocation
279,601
void (@NotNull String key, Point location) { putLocationFor(project, key, location); }
putLocation
279,602
Dimension (@NotNull String key) { return getSizeFor(project, key); }
getSize
279,603
void (@NotNull String key, Dimension size) { putSizeFor(project, key, size); }
putSize
279,604
Rectangle (@NotNull String key) { return getBoundsFor(project, key); }
getBounds
279,605
void (@NotNull String key, Rectangle bounds) { putBoundsFor(project, key, bounds); }
putBounds
279,606
DimensionService () { return ApplicationManager.getApplication().getService(DimensionService.class); }
getInstance
279,607
Element () { Element element = new Element("state"); // Save locations for (Map.Entry<String, Point> entry : myKeyToLocation.entrySet()) { Point point = entry.getValue(); LOG.assertTrue(point != null); Element e = new Element(ELEMENT_LOCATION); e.setAttribute(KEY, entry.getKey()); e.setAttribute(ATTRIBUTE_X, String.valueOf(point.x)); e.setAttribute(ATTRIBUTE_Y, String.valueOf(point.y)); element.addContent(e); } // Save sizes for (Map.Entry<String, Dimension> entry : myKeToSize.entrySet()) { Dimension size = entry.getValue(); LOG.assertTrue(size != null); Element e = new Element(ELEMENT_SIZE); e.setAttribute(KEY, entry.getKey()); e.setAttribute(ATTRIBUTE_WIDTH, String.valueOf(size.width)); e.setAttribute(ATTRIBUTE_HEIGHT, String.valueOf(size.height)); element.addContent(e); } // save extended states for (ObjectIntMap.Entry<String> entry : myKeyToExtendedState.entries()) { Element e = new Element(EXTENDED_STATE); e.setAttribute(KEY, entry.getKey()); e.setAttribute(STATE, Integer.toString(entry.getValue())); element.addContent(e); } return element; }
getState
279,608
void (@NotNull Element element) { myKeyToLocation.clear(); myKeToSize.clear(); myKeyToExtendedState.clear(); for (Element e : element.getChildren()) { if (ELEMENT_LOCATION.equals(e.getName())) { try { //noinspection ConstantConditions myKeyToLocation.put(e.getAttributeValue(KEY), new Point(Integer.parseInt(e.getAttributeValue(ATTRIBUTE_X)), Integer.parseInt(e.getAttributeValue(ATTRIBUTE_Y)))); } catch (NumberFormatException ignored) { } } else if (ELEMENT_SIZE.equals(e.getName())) { try { //noinspection ConstantConditions myKeToSize.put(e.getAttributeValue(KEY), new Dimension(Integer.parseInt(e.getAttributeValue(ATTRIBUTE_WIDTH)), Integer.parseInt(e.getAttributeValue(ATTRIBUTE_HEIGHT)))); } catch (NumberFormatException ignored) { } } else if (EXTENDED_STATE.equals(e.getName())) { try { //noinspection ConstantConditions myKeyToExtendedState.put(e.getAttributeValue(KEY), Integer.parseInt(e.getAttributeValue(STATE))); } catch (NumberFormatException ignored) { } } } }
loadState
279,609
WindowStateService (@Nullable Project project) { return project == null ? WindowStateService.getInstance() : WindowStateService.getInstance(project); }
getWindowStateService
279,610
void (Object message) { if (LOG.isTraceEnabled()) { LOG.trace(myName + ": " + message); } }
trace
279,611
String () { return myName; }
toString
279,612
void () { myIsTouched = true; }
touch
279,613
int () { final Application application = ApplicationManager.getApplication(); /* TODO: uncomment assertion when problems in Perforce plugin are fixed. LOG.assertTrue(!application.isDispatchThread(), "InterruptibleActivity is supposed to be lengthy thus must not block Swing UI thread"); */ final Semaphore semaphore = new Semaphore(); semaphore.down(); application.executeOnPooledThread(() -> { try { start(); } finally { semaphore.up(); } }); final int rc = waitForSemaphore(semaphore); if (rc != 0) { application.executeOnPooledThread(() -> interrupt()); } return rc; }
execute
279,614
int (final Semaphore semaphore) { long timeoutMs = myTimeUnit.toMillis(myTimeout); long lastActiveMoment = System.currentTimeMillis(); while (true) { long current = System.currentTimeMillis(); if (myIsTouched) { myIsTouched = false; lastActiveMoment = current; } long idleTime = current - lastActiveMoment; if (idleTime > timeoutMs) { int retCode = processTimeoutInEDT(); return semaphore.waitFor(0) ? 0 : retCode; } ProgressManager.checkCanceled(); if (semaphore.waitFor(Math.min(500, timeoutMs - idleTime))) { return 0; } } }
waitForSemaphore
279,615
int () { final int[] retcode = new int[1]; try { UIUtil.invokeAndWaitIfNeeded(() -> retcode[0] = processTimeout()); } catch (Exception e) { throw new RuntimeException(e); } return retcode[0]; }
processTimeoutInEDT
279,616
void (@NotNull Process process) { try { if (process.waitFor(ourSynchronousWaitTimeout, TimeUnit.MILLISECONDS)) { closeStreams(process); return; } } catch (InterruptedException e) { closeStreams(process); throw new RuntimeException(e); } process.destroy(); AppExecutorUtil.getAppScheduledExecutorService().schedule(() -> { try { if (process.isAlive()) { process.destroyForcibly(); } } finally { closeStreams(process); } }, ourAsynchronousWaitTimeout, TimeUnit.MILLISECONDS); }
close
279,617
void (@NotNull Process process) { try { process.getOutputStream().close(); } catch (IOException e) {/**/} try { process.getInputStream().close(); } catch (IOException e) {/**/} try { process.getErrorStream().close(); } catch (IOException e) {/**/} }
closeStreams
279,618
InputStream () { return myErrorStream; }
getErrorStream
279,619
InputStream () { return myInputStream; }
getInputStream
279,620
int () { return myExitCode; }
getExitCode
279,621
void () { closeProcess(); }
interrupt
279,622
void (final Process process) { ProcessCloseUtil.close(process); }
close
279,623
void () { if (myDestroyed) return; myDestroyed = true; close(myProcess); }
closeProcess
279,624
void () { try { myExitCode = myProcess.waitFor(); } catch (InterruptedException e) { LOG.debug(e); } }
start
279,625
PluginDescriptor () { return pluginDescriptor; }
getPluginDescriptor
279,626
void (@NotNull PluginDescriptor value) { pluginDescriptor = value; }
setPluginDescriptor
279,627
ToolWindowFactory (@NotNull PluginDescriptor pluginDescriptor) { ToolWindowFactory factory = this.factory; if (factory != null) { return factory; } if (factoryClass == null) { throw new PluginException("No toolwindow factory specified for " + id, pluginDescriptor.getPluginId()); } //noinspection SynchronizeOnThis synchronized (this) { factory = this.factory; if (factory != null) { return factory; } //noinspection NonPrivateFieldAccessedInSynchronizedContext factory = ApplicationManager.getApplication().instantiateClass(factoryClass, pluginDescriptor); this.factory = factory; } return factory; }
getToolWindowFactory
279,628
String () { return getClass().getSimpleName() + ":" + id; }
toString
279,629
Color () { return TESTS_OK_COLOR; }
getOkColor
279,630
Color () { return ERROR_COLOR; }
getErrorColor
279,631
Color () { return BUILD_OK_COLOR; }
getOkColor
279,632
Color () { return ERROR_COLOR; }
getErrorColor
279,633
Color () { return INDEXING_OK_COLOR; }
getOkColor
279,634
Color () { return ERROR_COLOR; }
getErrorColor
279,635
WeakFocusStackManager () { return INSTANCE; }
getInstance
279,636
void (AWTEvent event) { // we are interested only in FOCUS_GAINED events if (event.getID() == FocusEvent.FOCUS_GAINED) { focusOwners.add((Component)event.getSource()); } }
eventDispatched
279,637
IdeGlassPane (@NotNull Component component) { if (!(component instanceof JComponent)) { throw new IllegalArgumentException("Component must be instance of JComponent"); } JRootPane root = ((JComponent)component).getRootPane(); if (root == null) { throw new IllegalArgumentException("Component must be visible in order to find glass pane for it"); } Component gp = root.getGlassPane(); if (!(gp instanceof IdeGlassPane)) { throw new IllegalArgumentException("Glass pane should be " + IdeGlassPane.class.getName()); } return (IdeGlassPane)gp; }
find
279,638
void (@NotNull JComponent target, @NotNull Painter painter, @NotNull Disposable parent) { final UiNotifyConnector connector = UiNotifyConnector.installOn(target, new Activatable() { private IdeGlassPane myPane; private Disposable myPanePainterListeners = Disposer.newDisposable(); @Override public void showNotify() { IdeGlassPane pane = find(target); if (myPane != null && myPane != pane) { Disposer.dispose(myPanePainterListeners); } myPane = pane; myPanePainterListeners = Disposer.newDisposable("PanePainterListeners"); Disposer.register(parent, myPanePainterListeners); myPane.addPainter(target, painter, myPanePainterListeners); } @Override public void hideNotify() { Disposer.dispose(myPanePainterListeners); } }); Disposer.register(parent, connector); }
installPainter
279,639
void () { IdeGlassPane pane = find(target); if (myPane != null && myPane != pane) { Disposer.dispose(myPanePainterListeners); } myPane = pane; myPanePainterListeners = Disposer.newDisposable("PanePainterListeners"); Disposer.register(parent, myPanePainterListeners); myPane.addPainter(target, painter, myPanePainterListeners); }
showNotify
279,640
void () { Disposer.dispose(myPanePainterListeners); }
hideNotify
279,641
boolean (@NotNull MouseEvent e) { Component c = UIUtil.getDeepestComponentAt(e.getComponent(), e.getX(), e.getY()); if (JBPopupFactory.getInstance().getParentBalloonFor(c) != null && e.getID() != MouseEvent.MOUSE_DRAGGED) { return false; } if (c instanceof IdeGlassPane.TopComponent) { return ((IdeGlassPane.TopComponent)c).canBePreprocessed(e); } return true; }
canBePreprocessed
279,642
LibrarySearchHelper () { if (myLibrarySearchHelper == null) { try { myLibrarySearchHelper = ApplicationManager.getApplication().instantiateClass(librarySearchClass, getPluginDescriptor()); } catch (ProcessCanceledException e) { throw e; } catch (Exception e) { Logger.getInstance(LibraryDependentToolWindow.class).error(e); return null; } } return myLibrarySearchHelper; }
getLibrarySearchHelper
279,643
FileAppearanceService () { return ApplicationManager.getApplication().getService(FileAppearanceService.class); }
getInstance
279,644
SdkAppearanceService () { return ApplicationManager.getApplication().getService(SdkAppearanceService.class); }
getInstance
279,645
void (@NotNull SimpleColoredComponent component) { synchronized (mySections) { for (TextSection section : mySections) { final TextAttributes attributes = section.getTextAttributes(); component.append(section.getText(), SimpleTextAttributes.fromTextAttributes(attributes)); } component.setIcon(myIcon); } }
customize
279,646
Icon () { synchronized (mySections) { return myIcon; } }
getIcon
279,647
void (final @Nullable Icon icon) { synchronized (mySections) { myIcon = icon; } }
setIcon
279,648
String () { synchronized (mySections) { @Nls StringBuilder buffer = new StringBuilder(); for (TextSection section : mySections) { buffer.append(section.TEXT); } return buffer.toString(); } }
getText
279,649
boolean (Object obj) { synchronized (mySections) { if (!(obj instanceof CompositeAppearance appearance)) return false; if (SwingUtilities.isEventDispatchThread()) { return appearance.mySections.equals(mySections); } else { return new ArrayList<>(appearance.mySections).equals(new ArrayList<>(mySections)); } } }
equals
279,650
int () { return getText().hashCode(); }
hashCode
279,651
void (int index, @NotNull TextSection section) { synchronized (mySections) { mySections.add(index, section); for (Iterator<TextSection> iterator = mySections.iterator(); iterator.hasNext();) { TextSection textSection = iterator.next(); if (textSection == null) { LOG.error("index: " + index + " size: " + mySections.size()); iterator.remove(); } } } }
addSectionAt
279,652
DequeEnd () { return new DequeBeginning(); }
getBeginning
279,653
DequeEnd () { return new DequeEnding(); }
getEnding
279,654
DequeEnd () { return new DequeSuffix(); }
getSuffix
279,655
CompositeAppearance (@Nls String text, @Nls String comment) { DequeEnd ending = new CompositeAppearance().getEnding(); ending.addText(text); ending.addComment(comment); return ending.getAppearance(); }
textComment
279,656
CompositeAppearance (@Nls String text, SimpleTextAttributes textAttributes) { CompositeAppearance result = new CompositeAppearance(); result.getEnding().addText(text, textAttributes); return result; }
single
279,657
CompositeAppearance (@Nls String text) { return single(text, SimpleTextAttributes.REGULAR_ATTRIBUTES); }
single
279,658
CompositeAppearance (@NlsSafe String absolutePath) { CompositeAppearance appearance = new CompositeAppearance(); appearance.setIcon(PlatformIcons.INVALID_ENTRY_ICON); appearance.getEnding().addText(absolutePath, SimpleTextAttributes.ERROR_ATTRIBUTES); return appearance; }
invalid
279,659
Iterator<TextSection> () { return mySections.iterator(); }
getSectionsIterator
279,660
TextAttributes () { return ATTRIBUTES; }
getTextAttributes
279,661
boolean (Object obj) { if (!(obj instanceof TextSection section)) return false; return section.ATTRIBUTES.equals(ATTRIBUTES) && section.TEXT.equals(TEXT); }
equals
279,662
int () { return TEXT.hashCode(); }
hashCode
279,663
void (@Nls String text, SimpleTextAttributes textAttributes) { addText(text, textAttributes.toTextAttributes()); }
addText
279,664
void (@Nls String text) { addText(text, SimpleTextAttributes.REGULAR_ATTRIBUTES); }
addText
279,665
void (@Nls String text, TextAttributes attributes) { addSection(new TextSection(text, attributes)); }
addText
279,666
void (@Nls String text, @NlsContexts.Separator String prefix, @NlsContexts.Separator String suffix, SimpleTextAttributes textAttributes) { if (text != null && !text.trim().isEmpty()) { addText(prefix + text + suffix, textAttributes); } }
addSurrounded
279,667
CompositeAppearance () { return CompositeAppearance.this; }
getAppearance
279,668
void (@Nls String comment, SimpleTextAttributes commentAttributes) { addSurrounded(comment, " (", ")", commentAttributes); }
addComment
279,669
void (@Nls String comment) { addComment(comment, SimpleTextAttributes.GRAY_ATTRIBUTES); }
addComment
279,670
void (TextSection section) { synchronized (mySections) { addSectionAt(0, section); myInsertionIndex++; } }
addSection
279,671
void (TextSection section) { synchronized (mySections) { addSectionAt(myInsertionIndex, section); myInsertionIndex++; } }
addSection
279,672
void (TextSection section) { synchronized (mySections) { addSectionAt(mySections.size(), section); } }
addSection
279,673
void (final @NotNull SimpleColoredComponent component) { component.setIcon(getIcon()); component.append(getPrimaryText(), myTextAttributes); final String secondaryText = getSecondaryText(); if (!StringUtil.isEmptyOrSpaces(secondaryText)) { component.append(" (" + secondaryText + ")", myCommentAttributes); } }
customize
279,674
String () { String secondaryText = getSecondaryText(); if (secondaryText != null && secondaryText.length() > 0) { return getPrimaryText() + " (" + secondaryText + ")"; } return getPrimaryText(); }
getText
279,675
void (SimpleTextAttributes commentAttributes) { myCommentAttributes = commentAttributes; }
setCommentAttributes
279,676
void (SimpleTextAttributes textAttributes) { myTextAttributes = textAttributes; }
setTextAttributes
279,677
SimpleTextCellAppearance (final @NotNull @NlsContexts.Label String text, final @Nullable Icon icon) { return new SimpleTextCellAppearance(text, icon, SimpleTextAttributes.REGULAR_ATTRIBUTES); }
regular
279,678
SimpleTextCellAppearance (final @NotNull @NlsContexts.Label String text, final @Nullable Icon icon) { return new SimpleTextCellAppearance(text, icon, SimpleTextAttributes.ERROR_ATTRIBUTES); }
invalid
279,679
SimpleTextCellAppearance (final @NotNull @NlsContexts.Label String text, final @Nullable Icon icon) { return new SimpleTextCellAppearance(text, icon, SimpleTextAttributes.SYNTHETIC_ATTRIBUTES); }
synthetic
279,680
void (final @NotNull SimpleColoredComponent component) { component.setIcon(myIcon); component.append(myText, myTextAttributes); }
customize
279,681
String () { return myText; }
getText
279,682
SimpleTextAttributes () { return myTextAttributes; }
getTextAttributes
279,683
void (final @Nullable Icon icon) { myIcon = icon; }
setIcon
279,684
boolean (@NotNull Presentation presentation) { return Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_KEY)); }
isSelected
279,685
void (@NotNull Presentation presentation, boolean selected) { presentation.putClientProperty(SELECTED_KEY, selected); }
setSelected
279,686
Separator () { return ourInstance; }
getInstance
279,687
Separator () { return create(null); }
create
279,688
Separator (@Nullable @NlsContexts.Separator String text) { return StringUtil.isEmptyOrSpaces(text)? ourInstance : new Separator(text); }
create
279,689
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
279,690
String () { return IdeBundle.message("action.separator", myDynamicText.get()); }
toString
279,691
AnAction () { return myDelegate; }
getDelegate
279,692
void (@NotNull AnActionEvent e) { UpdateSession session = e.getUpdateSession(); if (session == UpdateSession.EMPTY) myDelegate.update(e); else e.getPresentation().copyFrom(session.presentation(myDelegate), null, true); }
update
279,693
void (@NotNull AnActionEvent e) { myDelegate.beforeActionPerformedUpdate(e); }
beforeActionPerformedUpdate
279,694
void (@NotNull AnActionEvent e) { myDelegate.actionPerformed(e); }
actionPerformed
279,695
boolean () { return myDelegate.isDumbAware(); }
isDumbAware
279,696
ActionUpdateThread () { return myDelegate.getActionUpdateThread(); }
getActionUpdateThread
279,697
boolean () { return PerformWithDocumentsCommitted.isPerformWithDocumentsCommitted(myDelegate); }
isPerformWithDocumentsCommitted
279,698
boolean () { return myDelegate.isInInjectedContext(); }
isInInjectedContext
279,699
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread