Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
289,600
int () { return tokenStart; }
getOffset
289,601
int () { return lastState; }
getState
289,602
void (@NotNull Lexer lexer) { advanceAs(lexer, lexer.getTokenType()); }
advanceLexer
289,603
void (@NotNull Lexer lexer, IElementType type) { addToken(type); lexer.advance(); }
advanceAs
289,604
Lexer () { return myDelegate; }
getDelegate
289,605
void (@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) { myDelegate.start(buffer, startOffset, endOffset, initialState); }
start
289,606
int () { return myDelegate.getState(); }
getState
289,607
int () { return myDelegate.getTokenStart(); }
getTokenStart
289,608
int () { return myDelegate.getTokenEnd(); }
getTokenEnd
289,609
void () { myDelegate.advance(); }
advance
289,610
CharSequence () { return myDelegate.getBufferSequence(); }
getBufferSequence
289,611
int () { return myDelegate.getBufferEnd(); }
getBufferEnd
289,612
void (final @NotNull CharSequence buffer, final int startOffset, final int endOffset, final int initialState) { super.start(buffer, startOffset, endOffset, initialState); myTokenType = null; myState = 0; myTokenStart = 0; }
start
289,613
int () { if (myTokenType == null) locateToken(); return myState; }
getState
289,614
IElementType () { if (myTokenType == null) locateToken(); return myTokenType; }
getTokenType
289,615
int () { if (myTokenType == null) locateToken(); return myTokenStart; }
getTokenStart
289,616
int () { if (myTokenType == null) locateToken(); return super.getTokenStart(); }
getTokenEnd
289,617
void () { myTokenType = null; myState = 0; myTokenStart = 0; }
advance
289,618
void () { if (myTokenType == null){ Lexer orig = getDelegate(); myTokenType = orig.getTokenType(); myTokenStart = orig.getTokenStart(); myState = orig.getState(); if (myTokenType == null) return; orig.advance(); myTokenType = getMergeFunction().merge(myTokenType, orig); } }
locateToken
289,619
Lexer () { return getDelegate(); }
getOriginal
289,620
void (@NotNull LexerPosition position) { MyLexerPosition pos = (MyLexerPosition)position; getDelegate().restore(pos.getOriginalPosition()); myTokenType = pos.getType(); myTokenStart = pos.getOffset(); myState = pos.getOldState(); }
restore
289,621
String () { return getClass().getName() + "[" + getDelegate() + "]"; }
toString
289,622
LexerPosition () { return new MyLexerPosition(myTokenStart, myTokenType, getDelegate().getCurrentPosition(), myState); }
getCurrentPosition
289,623
int () { return myOffset; }
getOffset
289,624
int () { return myOriginalPosition.getState(); }
getState
289,625
IElementType () { return myTokenType; }
getType
289,626
LexerPosition () { return myOriginalPosition; }
getOriginalPosition
289,627
int () { return myOldState; }
getOldState
289,628
void (final @NotNull CharSequence buffer, final int startOffset, final int endOffset, final int initialState) { myBuffer = buffer; myStartOffset = startOffset; myEndOffset = endOffset; }
start
289,629
CharSequence () { return myBuffer; }
getBufferSequence
289,630
int () { return 0; }
getState
289,631
IElementType () { return myStartOffset < myEndOffset ? myTokenType : null; }
getTokenType
289,632
int () { return myStartOffset; }
getTokenStart
289,633
int () { return myEndOffset; }
getTokenEnd
289,634
void () { myStartOffset = myEndOffset; }
advance
289,635
LexerPosition () { return new LexerPositionImpl(0, getState()); }
getCurrentPosition
289,636
void (@NotNull LexerPosition position) { }
restore
289,637
int () { return myEndOffset; }
getBufferEnd
289,638
int () { return myOffset; }
getOffset
289,639
int () { return myState; }
getState
289,640
void (Lexer lexer, IElementType[] startTokens, IElementType[] stopTokens) { if (Boolean.TRUE.equals(ourDisableLayersFlag.get())) return; registerLayer(lexer, startTokens); mySelfStoppingLexers.add(lexer); myStopTokens.put(lexer, stopTokens); }
registerSelfStoppingLayer
289,641
void (Lexer lexer, IElementType... startTokens) { if (Boolean.TRUE.equals(ourDisableLayersFlag.get())) return; for (IElementType startToken : startTokens) { LOG.assertTrue(!myStartTokenToLayerLexer.containsKey(startToken)); myStartTokenToLayerLexer.put(startToken, lexer); } }
registerLayer
289,642
void () { final IElementType baseTokenType = super.getTokenType(); myCurrentLayerLexer = findLayerLexer(baseTokenType); if (myCurrentLayerLexer != null) { myCurrentBaseTokenType = baseTokenType; myBaseTokenEnd = super.getTokenEnd(); myCurrentLayerLexer.start(super.getBufferSequence(), super.getTokenStart(), super.getTokenEnd()); if (mySelfStoppingLexers.contains(myCurrentLayerLexer)) { super.advance(); } } }
activateLayerIfNecessary
289,643
void (@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) { LOG.assertTrue(initialState != IN_LAYER_STATE, "Restoring to layer is not supported."); myState = initialState; myCurrentLayerLexer = null; super.start(buffer, startOffset, endOffset, initialState); activateLayerIfNecessary(); }
start
289,644
int () { return myState; }
getState
289,645
IElementType () { if (isInLayerEndGap()) { return myCurrentBaseTokenType; } return isLayerActive() ? myCurrentLayerLexer.getTokenType() : super.getTokenType(); }
getTokenType
289,646
int () { if (isInLayerEndGap()) { return myLayerLeftPart; } return isLayerActive() ? myCurrentLayerLexer.getTokenStart() : super.getTokenStart(); }
getTokenStart
289,647
int () { if (isInLayerEndGap()) { return myBaseTokenEnd; } return isLayerActive() ? myCurrentLayerLexer.getTokenEnd() : super.getTokenEnd(); }
getTokenEnd
289,648
void () { if (isInLayerEndGap()){ myLayerLeftPart = -1; myState = super.getState(); return; } if (isLayerActive()) { final Lexer activeLayerLexer = myCurrentLayerLexer; IElementType layerTokenType = activeLayerLexer.getTokenType(); if (!isStopToken(myCurrentLayerLexer, layerTokenType)) { myCurrentLayerLexer.advance(); layerTokenType = myCurrentLayerLexer.getTokenType(); } else { layerTokenType = null; } if (layerTokenType == null) { int tokenEnd = myCurrentLayerLexer.getTokenEnd(); boolean selfStopping = mySelfStoppingLexers.contains(myCurrentLayerLexer); myCurrentLayerLexer = null; if (!selfStopping) { super.advance(); // In case when we have non-covered gap we should return left part as next token } else if (tokenEnd != myBaseTokenEnd) { myState = IN_LAYER_LEXER_FINISHED_STATE; myLayerLeftPart = tokenEnd; if (LOG.isDebugEnabled()) { LOG.debug("We've got not covered gap from layered lexer: " + activeLayerLexer + "\n on token: " + getBufferSequence().subSequence(myLayerLeftPart, myBaseTokenEnd)); } return; } activateLayerIfNecessary(); } } else { super.advance(); activateLayerIfNecessary(); } myState = isLayerActive() ? IN_LAYER_STATE : super.getState(); }
advance
289,649
LexerPosition () { return new LexerPositionImpl(getTokenStart(), getState()); }
getCurrentPosition
289,650
void (@NotNull LexerPosition position) { start(getBufferSequence(), position.getOffset(), getBufferEnd(), position.getState()); }
restore
289,651
boolean (Lexer lexer, IElementType tokenType) { final IElementType[] stopTokens = myStopTokens.get(lexer); if (stopTokens == null) return false; return ArrayUtil.indexOfIdentity(stopTokens, tokenType) != -1; }
isStopToken
289,652
boolean () { return myCurrentLayerLexer != null; }
isLayerActive
289,653
boolean () { return myLayerLeftPart != -1; }
isInLayerEndGap
289,654
void () { Assert.assertNotEquals( "ExecutionBundle.properties was broken", "!message.error.happened.0!", ExecutionBundle.message("message.error.happened.0", "value") ); }
messageBundleTest
289,655
String () { return "multiple_targets"; }
getId
289,656
String () { return ExecutionBundle.message("multiple.specified"); }
getDisplayName
289,657
Icon () { return null; }
getIcon
289,658
boolean (@NotNull RunConfiguration configuration) { return true; }
canRun
289,659
void (@NotNull RunnerAndConfigurationSettings settings) { if (settings == getRunManager().getSelectedConfiguration()) { updateActiveTarget(settings); } }
runConfigurationChanged
289,660
void (@Nullable RunnerAndConfigurationSettings settings) { updateActiveTarget(settings); }
runConfigurationSelected
289,661
RunManagerImpl () { RunManagerImpl runManager = myRunManager; if (runManager == null) { runManager = RunManagerImpl.getInstanceImpl(myProject); myRunManager = runManager; } return runManager; }
getRunManager
289,662
void (@NotNull RunManagerImpl runManager) { myRunManager = runManager; }
setRunManager
289,663
Element () { Element state = new Element("state"); synchronized (myActiveTargetLock) { if (mySavedActiveTargetId != null && !mySavedActiveTargetId.equals(DefaultExecutionTarget.INSTANCE.getId())) { state.setAttribute("SELECTED_TARGET", mySavedActiveTargetId); } } return state; }
getState
289,664
void (@NotNull Element state) { synchronized (myActiveTargetLock) { if (myActiveTarget == null && mySavedActiveTargetId == null) { mySavedActiveTargetId = state.getAttributeValue("SELECTED_TARGET"); } } }
loadState
289,665
ExecutionTarget () { synchronized (myActiveTargetLock) { if (myActiveTarget == null) { updateActiveTarget(); } return myActiveTarget; } }
getActiveTarget
289,666
void (@NotNull ExecutionTarget target) { ThreadingAssertions.assertEventDispatchThread(); synchronized (myActiveTargetLock) { updateActiveTarget(getRunManager().getSelectedConfiguration(), target); } }
setActiveTarget
289,667
void () { updateActiveTarget(getRunManager().getSelectedConfiguration()); }
updateActiveTarget
289,668
void (@Nullable RunnerAndConfigurationSettings settings) { updateActiveTarget(settings, null); }
updateActiveTarget
289,669
void (@Nullable RunnerAndConfigurationSettings settings, @Nullable ExecutionTarget toSelect) { List<ExecutionTarget> suitable = settings == null ? Collections.singletonList(DefaultExecutionTarget.INSTANCE) : getTargetsFor(settings.getConfiguration()); ExecutionTarget toNotify; synchronized (myActiveTargetLock) { if (toSelect == null && !DefaultExecutionTarget.INSTANCE.equals(myActiveTarget)) { toSelect = myActiveTarget; } int index = -1; if (toSelect != null) { index = suitable.indexOf(toSelect); } else if (mySavedActiveTargetId != null) { for (int i = 0, size = suitable.size(); i < size; i++) { if (suitable.get(i).getId().equals(mySavedActiveTargetId)) { index = i; break; } } } toNotify = doSetActiveTarget(index >= 0 ? suitable.get(index) : getDefaultTarget(suitable)); } if (toNotify != null) { myProject.getMessageBus().syncPublisher(TOPIC).activeTargetChanged(toNotify); } }
updateActiveTarget
289,670
ExecutionTarget (List<? extends ExecutionTarget> suitable) { // The following cases are possible when we enter this method: // a) mySavedActiveTargetId == null. It means that we open / import project for the first time and there is no target selected // In this case we are trying to find the first ExecutionTarget that is ready, because we do not have any other conditions. // b) mySavedActiveTargetId != null. It means that some target was saved, but we weren't able to find it. Right now it can happen // when and only when there was a device connected, it was saved as a target, next the device was disconnected and other device was // connected / no devices left connected. In this case we should not select the target that is ready, cause most probably user still // needs some device to be selected (or at least the device placeholder). As all the devices and device placeholders are always shown // at the beginning of the list, selecting the first item works in this case. ExecutionTarget result = mySavedActiveTargetId == null ? ContainerUtil.find(suitable, ExecutionTarget::isReady) : ContainerUtil.getFirstItem(suitable); return result != null ? result : DefaultExecutionTarget.INSTANCE; }
getDefaultTarget
289,671
boolean (@Nullable RunConfiguration configuration, @NotNull ExecutionTarget target) { if (configuration == null) { return false; } boolean isCompound = configuration instanceof CompoundRunConfiguration; if (isCompound && target == MULTIPLE_TARGETS) { return true; } ExecutionTarget defaultTarget = DefaultExecutionTarget.INSTANCE; boolean checkFallbackToDefault = isCompound && !target.equals(defaultTarget); return doWithEachNonCompoundWithSpecifiedTarget(configuration, (subConfiguration, executionTarget) -> { if (!(subConfiguration instanceof TargetAwareRunProfile targetAwareProfile)) { return true; } if ((Registry.is("update.run.configuration.actions.from.cache", false)) && getRunManager().isInvalidInCache(subConfiguration)) { return false; } return target.canRun(subConfiguration) && targetAwareProfile.canRunOn(target) || (checkFallbackToDefault && defaultTarget.canRun(subConfiguration) && targetAwareProfile.canRunOn(defaultTarget)); }); }
doCanRun
289,672
List<ExecutionTarget> (@Nullable RunConfiguration configuration) { if (configuration == null) { return Collections.emptyList(); } List<ExecutionTargetProvider> providers = ExecutionTargetProvider.EXTENSION_NAME.getExtensionList(); LinkedHashSet<ExecutionTarget> result = new LinkedHashSet<>(); Set<ExecutionTarget> specifiedTargets = new HashSet<>(); doWithEachNonCompoundWithSpecifiedTarget(configuration, (subConfiguration, executionTarget) -> { for (ExecutionTargetProvider eachTargetProvider : providers) { List<ExecutionTarget> supportedTargets = eachTargetProvider.getTargets(myProject, subConfiguration); if (executionTarget == null) { result.addAll(supportedTargets); } else if (supportedTargets.contains(executionTarget)) { result.add(executionTarget); specifiedTargets.add(executionTarget); break; } } return true; }); if (!result.isEmpty()) { specifiedTargets.forEach(it -> result.retainAll(Collections.singleton(it))); if (result.isEmpty()) { result.add(MULTIPLE_TARGETS); } } return ContainerUtil.filter(result, it -> doCanRun(configuration, it)); }
getTargetsFor
289,673
boolean (@NotNull RunConfiguration configuration, @NotNull BiPredicate<? super RunConfiguration, ? super ExecutionTarget> action) { Set<RunConfiguration> recursionGuard = new HashSet<>(); LinkedList<Pair<RunConfiguration, ExecutionTarget>> toProcess = new LinkedList<>(); toProcess.add(Pair.create(configuration, null)); while (!toProcess.isEmpty()) { Pair<RunConfiguration, ExecutionTarget> eachWithTarget = toProcess.pollFirst(); assert eachWithTarget != null; if (!recursionGuard.add(eachWithTarget.first)) { continue; } RunConfiguration eachConfiguration = eachWithTarget.first; if (eachConfiguration instanceof CompoundRunConfiguration) { for (Map.Entry<RunConfiguration, ExecutionTarget> subConfigWithTarget : ((CompoundRunConfiguration)eachConfiguration).getConfigurationsWithTargets(getRunManager()).entrySet()) { toProcess.add(Pair.create(subConfigWithTarget.getKey(), subConfigWithTarget.getValue())); } } else if (!action.test(eachWithTarget.first, eachWithTarget.second)) { return false; } } return true; }
doWithEachNonCompoundWithSpecifiedTarget
289,674
void () { ThreadingAssertions.assertEventDispatchThread(); updateActiveTarget(); }
update
289,675
void (@Nullable RunManagerImpl runManager) { mySavedActiveTargetId = null; myActiveTarget = null; myRunManager = runManager; }
reset
289,676
int () { return myTimeout; }
getTimeout
289,677
void (@NotNull ProcessHandler processHandler, @NotNull String commandLineString, @NotNull ProcessOutput outputCollected, @Nullable Throwable invocatorStack) { super.onTimeout(processHandler, commandLineString, outputCollected, invocatorStack); String output = "\n stdout: " + outputCollected.getStdout() + ";\n stderr: " + outputCollected.getStderr(); LOG.error(new Throwable("Timeout (" + getTimeout() + " sec) on executing: " + commandLineString + "; output collected: " + output, invocatorStack)); }
onTimeout
289,678
RunContentExecutor (Filter filter) { myFilterList.add(filter); return this; }
withFilter
289,679
RunContentExecutor (@NlsContexts.TabTitle String title) { myTitle = title; return this; }
withTitle
289,680
RunContentExecutor (Runnable rerun) { myRerunAction = rerun; return this; }
withRerun
289,681
RunContentExecutor (@NotNull Runnable stop, @NotNull Computable<Boolean> stopEnabled) { myStopAction = stop; myStopEnabled = stopEnabled; return this; }
withStop
289,682
RunContentExecutor (Runnable afterCompletion) { myAfterCompletion = afterCompletion; return this; }
withAfterCompletion
289,683
RunContentExecutor (String helpId) { myHelpId = helpId; return this; }
withHelpId
289,684
RunContentExecutor (boolean activateToolWindow) { myActivateToolWindow = activateToolWindow; return this; }
withActivateToolWindow
289,685
RunContentExecutor (boolean focusToolWindow) { myFocusToolWindow = focusToolWindow; return this; }
withFocusToolWindow
289,686
ConsoleView () { TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(myProject); consoleBuilder.filters(myFilterList); final ConsoleView console = consoleBuilder.getConsole(); if (myHelpId != null) { console.setHelpId(myHelpId); } Executor executor = DefaultRunExecutor.getRunExecutorInstance(); DefaultActionGroup actions = new DefaultActionGroup(); final JComponent consolePanel = createConsolePanel(console, actions); RunContentDescriptor descriptor = new RunContentDescriptor(console, myProcess, consolePanel, myTitle); descriptor.setActivateToolWindowWhenAdded(myActivateToolWindow); descriptor.setAutoFocusContent(myFocusToolWindow); Disposer.register(descriptor, this); Disposer.register(descriptor, console); actions.add(new RerunAction(consolePanel)); actions.add(new StopAction()); actions.add(new CloseAction(executor, descriptor, myProject)); RunContentManager.getInstance(myProject).showRunContent(executor, descriptor); return console; }
createConsole
289,687
void () { FileDocumentManager.getInstance().saveAllDocuments(); // Use user-provided console if exist. Create new otherwise ConsoleView view = (myUserProvidedConsole != null ? myUserProvidedConsole : createConsole()); view.attachToProcess(myProcess); if (myAfterCompletion != null) { myProcess.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull ProcessEvent event) { ApplicationManager.getApplication().invokeLater(myAfterCompletion); } }); } myProcess.startNotify(); }
run
289,688
void (@NotNull ProcessEvent event) { ApplicationManager.getApplication().invokeLater(myAfterCompletion); }
processTerminated
289,689
JComponent (ConsoleView view, ActionGroup actions) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(view.getComponent(), BorderLayout.CENTER); ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("RunContentExecutor", actions, false); actionToolbar.setTargetComponent(panel); panel.add(actionToolbar.getComponent(), BorderLayout.WEST); return panel; }
createConsolePanel
289,690
void () { }
dispose
289,691
RunContentExecutor (@Nullable ConsoleView console) { myUserProvidedConsole = console; return this; }
withConsole
289,692
void (@NotNull AnActionEvent e) { myRerunAction.run(); }
actionPerformed
289,693
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabledAndVisible(myRerunAction != null); }
update
289,694
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
289,695
boolean () { return true; }
isDumbAware
289,696
void (@NotNull AnActionEvent e) { myStopAction.run(); }
actionPerformed
289,697
void (@NotNull AnActionEvent e) { e.getPresentation().setVisible(myStopAction != null); e.getPresentation().setEnabled(myStopEnabled != null && myStopEnabled.compute()); }
update
289,698
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
289,699
List<ExecutionTarget> (@NotNull Project project, @NotNull RunConfiguration configuration) { return Collections.singletonList(DefaultExecutionTarget.INSTANCE); }
getTargets