Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
272,300
int (Object parent, Object child) {return intValueOf(child) - intValueOf(parent) - 1; }
getIndexOfChild
272,301
void (String[] args) { IconLoader.activate(); final JFrame frame = new JFrame(); frame.getContentPane().setLayout(new BorderLayout()); final JPanel content = new JPanel(new BorderLayout()); frame.getContentPane().add(content, BorderLayout.CENTER); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); final JTr...
main
272,302
void (final MouseEvent e) { if (balloon.get() != null && balloon.get().isVisible()) { //noinspection SSBasedInspection balloon.get().dispose(); } else { //JLabel pane1 = new JLabel("Hello, world!"); //JLabel pane2 = new JLabel("Hello, again"); //JPanel pane = new JPanel(new BorderLayout()); //pane.add(pane1, BorderLayo...
mousePressed
272,303
void (MouseEvent e) { System.out.println(e.getPoint()); }
mouseMoved
272,304
void () { final Dimension preferredDimension = new Dimension(2345,678); final Dimension explicitDimension = new Dimension(4343,5554); TextPanel tp = new TextPanel() {}; tp.setPreferredSize(preferredDimension); tp.setExplicitSize(explicitDimension); Assert.assertEquals("Explicit dimension is more preferable", explicitDi...
testSetPreferredSizeSetExplicitSizeGetExplicitSize
272,305
void () { assumeTrue("NST-unsupported OS", NST.isSupportedOS()); NSTLibrary lib = null; try { // NOTE: for supported OS-versions library must always loads (even SystemSettingsWrapper.isTouchBarServerRunning() == false) lib = NST.loadLibraryImpl(); } catch (Throwable e) { fail("Failed to load nst library for touchbar: "...
testLoadingAndBasicFunctions
272,306
void () { Assume.assumeTrue("NST-unsupported OS", NST.isSupportedOS()); final GeneralCommandLine cmdLine = new GeneralCommandLine("pgrep", "ser"); try { final ProcessOutput out = ExecUtil.execAndGetOutput(cmdLine); assertNotNull("ProcessOutput mustn't be null", out); assertNotNull("ProcessOutput.getStdout() mustn't be ...
testGetProcessOutput
272,307
void () { IoTestUtil.assumeMacOS(); final String sysVer = NSDefaults.readStringVal("loginwindow", "SystemVersionStampAsString"); assertNotNull(sysVer); assertFalse(sysVer.isEmpty()); }
testSettingsRead
272,308
void () { Assume.assumeTrue("NST-unsupported OS", NST.isSupportedOS()); assertNull(NSDefaults.testTouchBarSettingsWrite()); }
testTouchBarSettingsWrite
272,309
void (String[] args) { SwingUtilities.invokeLater(() -> _createFrame()); }
main
272,310
void () { NST.loadLibraryImpl(); final JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.setBounds(0, 0, 500, 110); f.setVisible(true); new Thread(()-> { int c = 1; while (--c >= 0) { final TBPanel testTB = _createSimpleTestTouchbar(); testTB.selectVisibleItemsToShow(); testTB.setTo(...
_createFrame
272,311
TBPanel () { final int configPopoverWidth = 143; final TBPanel testTB = new TBPanel("test_simple"); testTB.addButton().setText("butt").setAction(createPrintTextCallback("pressed button"), false); return testTB; }
_createSimpleTestTouchbar
272,312
TBPanel () { final int configPopoverWidth = 143; final TBPanel testTB = new TBPanel("test"); testTB.addButton().setText("test1").setAction(createPrintTextCallback("pressed test1 button"), false); testTB.addButton().setText("test2").setAction(createPrintTextCallback("pressed test2 button"), false); testTB.addButton().se...
_createTestButtonsTouchbar
272,313
Collection<Integer> (int maxIndex) { if (ourIndices != null) return ourIndices; final Random rnd = new Random(System.currentTimeMillis()); final int size = rnd.nextInt(maxIndex/2); ourIndices = new HashSet<>(); for (int c = 0; c < size; ++c) { final int id = rnd.nextInt(maxIndex); ourIndices.add(id); // System.out.prin...
_makeRandomCollection
272,314
TBPanel () { final TBPanel testTB = new TBPanel("test"); testTB.addSpacing(true); final TBItemScrubber scrubber = testTB.addScrubber(); final int size = 130; for (int c = 0; c < size; ++c) { String txt = String.format("%d[%1.2f]", c, Math.random()); int finalC = c; Runnable action = () -> System.out.println("performed ...
_createTestScrubberTouchbar
272,315
TBPanel () { final TBPanel testTB = new TBPanel("test"); testTB.addSpacing(true); testTB.addButton().setText("test1").setAction(createPrintTextCallback("pressed test1 button"), false); testTB.addButton().setText("test2").setAction(createPrintTextCallback("pressed test2 button"), false); testTB.addSpacing(false); testTB...
_createTestAllTouchbar
272,316
Runnable (String text) { return ()-> System.out.println(text + " [thread:" + Thread.currentThread() + "]"); }
createPrintTextCallback
272,317
void () { TestScaleHelper.assumeStandalone(); }
before
272,318
void () { TestScaleHelper.restoreProperties(); }
after
272,319
void () { JBCefBrowser browser = new JBCefBrowser("chrome:version"); JBCefJSQuery jsQuery = JBCefJSQuery.create(browser); jsQuery.addHandler(result -> { CALLBACL_COUNT.incrementAndGet(); String str = "JBCefJSQuery result: " + result; System.out.println(str); browser.loadHTML("<html><body>" + str + "</body></html>"); re...
test
272,320
void () { TestScaleHelper.assumeStandalone(); }
before
272,321
void () { TestScaleHelper.restoreSystemProperties(); }
after
272,322
void () { TestScaleHelper.restoreProperties(); // Clean up the certificate storage if needed var trustManager = CertificateManager.getInstance().getTrustManager().getCustomManager(); if (mySSLInfo != null && mySSLInfo.certificate != null) { for (X509Certificate certificate : mySSLInfo.certificate.getCertificatesChain()...
after
272,323
void () { myContinueCalled.set(true); myLatch.countDown(); }
Continue
272,324
void () { myCancelCalled.set(true); myLatch.countDown(); }
cancel
272,325
void () { await(myLatch); }
waitCall
272,326
boolean () { return myContinueCalled.get(); }
continueCalled
272,327
boolean () { return myCancelCalled.get(); }
cancelCalled
272,328
void () { CefClient client = myBrowser.getJBCefClient().getCefClient(); // Call CertificateErrorCallback with an unknown(for the custom trust manager) certificate { var callback = new CertificateErrorCallback(); boolean exit_code = client.onCertificateError(myBrowser.getCefBrowser(), CefLoadHandler.ErrorCode.ERR_CERT_A...
test
272,329
CefSSLInfo () { return new CefSSLInfo(4 /*CERT_STATUS_AUTHORITY_INVALID*/, new CefX509Certificate(new byte[][]{Base64.getDecoder().decode(CER_BASE64)})); }
makeSSLInfo
272,330
void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setRegistryProperty("ide.browser.jcef.headless.enabled", "true"); TestScaleHelper.setRegistryProperty("ide.browser.jcef.osr.enabled", "true"); }
before
272,331
void () { TestScaleHelper.restoreProperties(); }
after
272,332
void () { JBCefBrowser browser = JBCefBrowser.createBuilder() .setOffScreenRendering(true) .setOSRHandlerFactory(new JBCefOSRHandlerFactory() { final Rectangle bounds = new Rectangle(1024, 768); @Override public @NotNull Function<JComponent, Rectangle> createScreenBoundsProvider() { return component -> bounds; } }) .se...
test
272,333
void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setRegistryProperty("ide.browser.jcef.osr.enabled", "true"); }
before
272,334
void () { TestScaleHelper.restoreProperties(); }
after
272,335
void () { JBCefClient client = JBCefApp.getInstance().createClient(); client.setProperty(JBCefClient.Properties.JS_QUERY_POOL_SIZE, 1); JBCefOsrHandlerBrowser browser = JBCefOsrHandlerBrowser.create("", new MyRenderHandler(), client); JBCefJSQuery jsQuery = JBCefJSQuery.create(browser); doTest(browser, jsQuery); }
test1
272,336
void () { JBCefOsrHandlerBrowser browser = JBCefOsrHandlerBrowser.create("", new MyRenderHandler(), false); JBCefJSQuery jsQuery = JBCefJSQuery.create(browser); browser.createImmediately(); doTest(browser, jsQuery); }
test2
272,337
void () { JBCefClient client = JBCefApp.getInstance().createClient(); client.setProperty(JBCefClient.Properties.JS_QUERY_POOL_SIZE, 1); JBCefBrowser browser = JBCefBrowser.createBuilder() .setOffScreenRendering(true) .setClient(client) .setCreateImmediately(true) .build(); JBCefJSQuery jsQuery = JBCefJSQuery.create((JB...
test3
272,338
void () { JBCefBrowser browser = JBCefBrowser.createBuilder() .setOffScreenRendering(true) .build(); JBCefJSQuery jsQuery = JBCefJSQuery.create((JBCefBrowserBase)browser); browser.createImmediately(); doTest(browser, jsQuery); }
test4
272,339
void (@NotNull JBCefBrowserBase browser, @NotNull JBCefJSQuery jsQuery) { CountDownLatch latch = new CountDownLatch(1); jsQuery.addHandler(result -> { System.out.println("JBCefJSQuery result: " + result); latch.countDown(); return null; }); invokeAndWaitForLoad(browser, () -> { browser.loadURL("chrome:version"); }); in...
doTest
272,340
Rectangle (CefBrowser browser) { return new Rectangle(0, 0, 100, 100); }
getViewRect
272,341
boolean (CefBrowser browser, CefScreenInfo screenInfo) { return false; }
getScreenInfo
272,342
Point (CefBrowser browser, Point viewPoint) { return new Point(0, 0); }
getScreenPoint
272,343
double (CefBrowser browser) { return 1; }
getDeviceScaleFactor
272,344
void (CefBrowser browser, boolean show) { }
onPopupShow
272,345
void (CefBrowser browser, Rectangle size) { }
onPopupSize
272,346
void (CefBrowser browser, boolean popup, Rectangle[] dirtyRects, ByteBuffer buffer, int width, int height) { }
onPaint
272,347
boolean (CefBrowser browser, int cursorType) { return false; }
onCursorChange
272,348
boolean (CefBrowser browser, CefDragData dragData, int mask, int x, int y) { return false; }
startDragging
272,349
void (CefBrowser browser, int operation) { }
updateDragCursor
272,350
void () { TestScaleHelper.assumeStandalone(); }
before
272,351
void () { TestScaleHelper.restoreProperties(); }
after
272,352
void () { var client = JBCefApp.getInstance().createClient(); client.setProperty(JBCefClient.Properties.JS_QUERY_POOL_SIZE, 1); var browser = new JBCefBrowserBuilder().setUrl("about:blank").setClient(client).build(); showAndWaitForLoad(browser, JBCefJSQueryPoolSlotReuseTest.class.getSimpleName()); /* * Create and use a...
test
272,353
void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setSystemProperty("java.awt.headless", "false"); }
before
272,354
void () { TestScaleHelper.restoreProperties(); }
after
272,355
void () { URL url; try { url = new URL(TEST_URL); } catch (MalformedURLException e) { e.printStackTrace(); fail("Unexpected exception"); return; } String urlToQuery = url.getProtocol() + "://" + url.getHost(); JBCefCookie cookie = new JBCefCookie( "MY_COOKIE", "MY_VALUE", url.getHost(), "/", false, false); JBCefBrowser...
test
272,356
void (CefBrowser browser, CefFrame frame, CefRequest.TransitionType transitionType) { System.out.println("onLoadStart"); loadStartedLatch.countDown(); }
onLoadStart
272,357
void () { assumeStandalone(); }
before
272,358
void () { restoreProperties(); }
after
272,359
void () { setRegistryProperty("ide.browser.jcef.headless.enabled", "false"); setRegistryProperty("ide.browser.jcef.testMode.enabled", "false"); assertFalse(JBCefApp.isSupported()); try { JBCefApp.getInstance(); fail(); } catch (IllegalStateException ignore) { } setRegistryProperty("ide.browser.jcef.headless.enabled", "...
test
272,360
void (@NotNull JBCefBrowserBase browser, @NotNull String frameTitle) { invokeAndWaitForLoad(browser, () -> show(browser, frameTitle)); }
showAndWaitForLoad
272,361
void (@NotNull JBCefBrowserBase browser, @NotNull String frameTitle) { EventQueue.invokeLater(() -> show(browser, frameTitle)); }
showAsync
272,362
void (@NotNull JBCefBrowserBase browser, @NotNull String frameTitle) { JFrame frame = new JFrame(frameTitle); frame.setSize(640, 480); frame.setLocationRelativeTo(null); frame.add(browser.getComponent(), BorderLayout.CENTER); frame.setVisible(true); }
show
272,363
void (@NotNull JBCefBrowserBase browser, @NotNull Runnable runnable) { CountDownLatch latch = new CountDownLatch(1); browser.getJBCefClient().addLoadHandler(new CefLoadHandlerAdapter() { @Override public void onLoadEnd(CefBrowser cefBrowser, CefFrame frame, int httpStatusCode) { System.out.println("onLoadEnd on " + bro...
invokeAndWaitForLoad
272,364
void (CefBrowser cefBrowser, CefFrame frame, int httpStatusCode) { System.out.println("onLoadEnd on " + browser + " for " + browser.getCefBrowser().getURL()); browser.getJBCefClient().removeLoadHandler(this, cefBrowser); latch.countDown(); }
onLoadEnd
272,365
void (@NotNull Runnable runnable, @NotNull BooleanSupplier condition) { CountDownLatch latch = new CountDownLatch(1); invokeAndWaitForLatch(latch, () -> { runnable.run(); latch.countDown(); }); try { while (!condition.getAsBoolean()) { //noinspection BusyWait Thread.sleep(100); } } catch (InterruptedException e) { thro...
invokeAndWaitForCondition
272,366
void (@NotNull CountDownLatch latch, @NotNull Runnable runnable) { UIUtil.invokeLaterIfNeeded(runnable); await(latch); }
invokeAndWaitForLatch
272,367
void (@NotNull CountDownLatch latch) { try { if (!latch.await(5, TimeUnit.SECONDS)) { Assert.fail("timeout:\n" + ThreadDumper.dumpThreadsToString()); } } catch (InterruptedException e) { throw new RuntimeException(e); } }
await
272,368
void () { TestScaleHelper.setRegistryProperty("ide.browser.jcef.osr.enabled", "true"); TestScaleHelper.assumeStandalone(); }
before
272,369
void () { TestScaleHelper.restoreProperties(); }
after
272,370
void (CefBrowser browser, CefFrame frame, int httpStatusCode) { browser.setFocus(true); latch.countDown(); super.onLoadEnd(browser, frame, httpStatusCode); }
onLoadEnd
272,371
void (WindowEvent e) { browser.loadHTML(HTML_TEXT.replaceAll("###CALLBACK_PLACEHOLDER###", jsQuery.inject("event.target.value")), URL); }
windowOpened
272,372
InputMethodEvent (String text, boolean commit) { return new InputMethodEvent(browser.getCefBrowser().getUIComponent(), InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, new AttributedString(text).getIterator(), commit ? text.length() : 0, null, null); }
makeEvent
272,373
void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setSystemProperty("java.awt.headless", "false"); }
before
272,374
void () { TestScaleHelper.restoreProperties(); }
after
272,375
void () { // // Try external JBCefClient. // doTest(JBCefApp.getInstance().createClient()); // // Try default JBCefClient. // doTest(null); }
test
272,376
void (@Nullable JBCefClient client) { JBCefBrowserBase browser = null; try { browser = new JCEFHtmlPanel(client, "about:blank"); } catch (RuntimeException ex) { fail("Exception occurred: " + ex.getMessage()); ex.printStackTrace(); } if (client == null) client = browser.getJBCefClient(); assertFalse(browser.isDisposed()...
doTest
272,377
void () { TestScaleHelper.assumeStandalone(); }
before
272,378
void () { TestScaleHelper.restoreSystemProperties(); }
after
272,379
void () { _testScrollingImpl(600, 1000, 5, 20); }
testPageScrolling
272,380
void (int w, int h, int speed, int delay) { String htmlPath = PlatformTestUtil.getPlatformTestDataPath() + "ui/jcef/long_page.html"; String url = "file://" + htmlPath; _testImpl(w, h, (f)->{ try { Robot robot = new Robot(); robot.setAutoDelay(0); Rectangle r = f.getBounds(); robot.mouseMove((int)r.getCenterX(), (int)r....
_testScrollingImpl
272,381
void () { _testSvgImpl(2500, 1600); }
testAnimatedSvgLarge
272,382
void () { _testSvgImpl(1400, 800); }
testAnimatedSvg
272,383
void (int w, int h) { String svgPath = PlatformTestUtil.getPlatformTestDataPath() + "ui/jcef/animated.svg"; String url = "file://" + svgPath; _testImpl(w, h, (f)->{ try { Thread.sleep(20*1000); } catch (InterruptedException e) { throw new RuntimeException(e); } }, url, String.format("test_svg_fps_%dx%d.csv", w, h)); }
_testSvgImpl
272,384
void (int w, int h, Consumer<JFrame> testActor, String url, String outFilename) { final CountDownLatch loaded = new CountDownLatch(1); JFrame[] f = new JFrame[]{null}; invokeAndWaitForLatch(loaded, () -> { JFrame frame = f[0] = new JFrame(String.format("Test fps %dx%d (%s)", w, h, url)); frame.setSize(w, h); frame.setL...
_testImpl
272,385
void (CefBrowser cefBrowser, CefFrame frame, int httpStatusCode) { browser.getJBCefClient().removeLoadHandler(this, cefBrowser); loaded.countDown(); }
onLoadEnd
272,386
void () { TestScaleHelper.assumeStandalone(); }
before
272,387
void () { TestScaleHelper.restoreSystemProperties(); }
after
272,388
void () { CountDownLatch latch1 = new CountDownLatch(1); CountDownLatch latch2 = new CountDownLatch(1); JBCefBrowser jbCefBrowser = new JBCefBrowser("https://maps.google.com"); // we need some heavy website, taking time to load jbCefBrowser.setErrorPage(JBCefBrowserBase.ErrorPage.DEFAULT); jbCefBrowser.getJBCefClient()...
test
272,389
void (CefBrowser browser, boolean isLoading, boolean canGoBack, boolean canGoForward) { System.out.println("JBCefLoadHtmlTest.onLoadingStateChange: " + isLoading); if (!isLoading && latch1.getCount() < 1) { latch2.countDown(); } }
onLoadingStateChange
272,390
void (CefBrowser browser, CefFrame frame, CefRequest.TransitionType transitionType) { System.out.println("JBCefLoadHtmlTest.onLoadStart: " + frame.getURL()); if (frame.getURL().contains("google")) { jbCefBrowser.loadURL("https://www.jetbrains.com"); // we need some heavy website, taking time to load } }
onLoadStart
272,391
void (CefBrowser browser, CefFrame frame, int httpStatusCode) { System.out.println("JBCefLoadHtmlTest.onLoadEnd: " + frame.getURL()); if (frame.getURL().contains("jetbrains")) { latch1.countDown(); } }
onLoadEnd
272,392
void (CefBrowser browser, CefFrame frame, ErrorCode errorCode, String errorText, String failedUrl) { System.out.println("JBCefLoadHtmlTest.onLoadError: " + failedUrl); }
onLoadError
272,393
void () { TestScaleHelper.assumeStandalone(); TestScaleHelper.setRegistryProperty("ide.browser.jcef.osr.enabled", "true"); }
before
272,394
void () { TestScaleHelper.restoreProperties(); }
after
272,395
void () { show(JBCefBrowser.createBuilder().setOffScreenRendering(false).setUrl("chrome:version").build()); show(JBCefBrowser.createBuilder().setOffScreenRendering(true).setUrl("chrome:version").build()); }
test
272,396
void (@NotNull JBCefBrowser browser) { invokeAndWaitForLoad(browser, () -> { JFrame frame = new JFrame(JBCefLoadHtmlTest.class.getName()); frame.setSize(640, 480); frame.setLocationRelativeTo(null); frame.add(browser.getComponent(), BorderLayout.CENTER); frame.setVisible(true); }); }
show
272,397
void () { TestScaleHelper.assumeStandalone(); }
before
272,398
void () { test(client -> { client.setProperty(Properties.JS_QUERY_POOL_SIZE, 1); return null; }); }
test1
272,399
void () { JBCefJSQueryPoolSizePropTest.test(client -> { client.setProperty(Properties.JS_QUERY_POOL_SIZE, Integer.MAX_VALUE); // stress test return null; }); }
test2