com.intellij.openapi.actionSystem.CommonDataKeys Java Examples

The following examples show how to use com.intellij.openapi.actionSystem.CommonDataKeys. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileTextRule.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public String getData(@Nonnull DataProvider dataProvider) {
  final VirtualFile virtualFile = dataProvider.getDataUnchecked(PlatformDataKeys.VIRTUAL_FILE);
  if (virtualFile == null) {
    return null;
  }

  final FileType fileType = virtualFile.getFileType();
  if (fileType.isBinary() || fileType.isReadOnly()) {
    return null;
  }

  final Project project = dataProvider.getDataUnchecked(CommonDataKeys.PROJECT);
  if (project == null) {
    return null;
  }

  final Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
  if (document == null) {
    return null;
  }

  return document.getText();
}
 
Example #2
Source File: ToggleDockModeAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void setSelected(AnActionEvent event, boolean flag) {
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return;
  }
  ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  String id = windowManager.getActiveToolWindowId();
  if (id == null) {
    return;
  }
  ToolWindow toolWindow = windowManager.getToolWindow(id);
  ToolWindowType type = toolWindow.getType();
  if (ToolWindowType.DOCKED == type) {
    toolWindow.setType(ToolWindowType.SLIDING, null);
  }
  else if (ToolWindowType.SLIDING == type) {
    toolWindow.setType(ToolWindowType.DOCKED, null);
  }
}
 
Example #3
Source File: OpenCommitInBrowserAction.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
@Override
public void actionPerformed(@NotNull final AnActionEvent anActionEvent) {
    final Project project = anActionEvent.getRequiredData(CommonDataKeys.PROJECT);
    final VcsFullCommitDetails commit = anActionEvent.getRequiredData(VcsLogDataKeys.VCS_LOG).getSelectedDetails().get(0);

    final GitRepository gitRepository = GitUtil.getRepositoryManager(project).getRepositoryForRootQuick(commit.getRoot());
    if (gitRepository == null)
        return;

    final GitRemote remote = TfGitHelper.getTfGitRemote(gitRepository);

    // guard for null so findbugs doesn't complain
    if (remote == null) {
        return;
    }

    final String remoteUrl = remote.getFirstUrl();
    if (remoteUrl == null) {
        return;
    }

    final URI urlToBrowseTo = UrlHelper.getCommitURI(remoteUrl, commit.getId().toString());
    logger.info("Browsing to url " + urlToBrowseTo.getPath());
    BrowserUtil.browse(urlToBrowseTo);
}
 
Example #4
Source File: ChooseRunConfigurationPopup.java    From consulo with Apache License 2.0 6 votes vote down vote up
static void execute(final ItemWrapper itemWrapper, final Executor executor) {
  if (executor == null) {
    return;
  }

  final DataContext dataContext = DataManager.getInstance().getDataContext();
  final Project project = dataContext.getData(CommonDataKeys.PROJECT);
  if (project != null) {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        itemWrapper.perform(project, executor, dataContext);
      }
    });
  }
}
 
Example #5
Source File: CustomRenameHandler.java    From Intellij-Plugin with Apache License 2.0 6 votes vote down vote up
public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
    PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
    if (element == null) element = psiElement;
    psiElement = element;
    String text = element.toString();

    //Finding text from annotation
    if (isMethod(element)) {
        List<String> values = StepUtil.getGaugeStepAnnotationValues((PsiMethod) element);
        if (values.size() == 0) {
            return;
        } else if (values.size() == 1)
            text = values.get(0);
        else if (values.size() > 1) {
            Messages.showWarningDialog("Refactoring for steps having aliases are not supported", "Warning");
            return;
        }
    } else if (isStep(element)) {
        text = ((SpecStepImpl) element).getStepValue().getStepAnnotationText();
    } else if (isConcept(element)) {
        text = removeIdentifiers(((ConceptStepImpl) element).getStepValue().getStepAnnotationText());
    }
    final RefactoringDialog form = new RefactoringDialog(this.editor.getProject(), file, this.editor, text);
    form.show();
}
 
Example #6
Source File: TextEditorComponent.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public Object getData(@Nonnull final Key<?> dataId) {
  final Editor e = validateCurrentEditor();
  if (e == null || e.isDisposed()) return null;

  // There's no FileEditorManager for default project (which is used in diff command-line application)
  if (!myProject.isDisposed() && !myProject.isDefault()) {
    final Object o = FileEditorManager.getInstance(myProject).getData(dataId, e, e.getCaretModel().getCurrentCaret());
    if (o != null) return o;
  }

  if (CommonDataKeys.EDITOR == dataId) {
    return e;
  }
  if (CommonDataKeys.VIRTUAL_FILE == dataId) {
    return myFile.isValid() ? myFile : null;  // fix for SCR 40329
  }
  return null;
}
 
Example #7
Source File: TextEndAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(Editor editor, DataContext dataContext) {
  editor.getCaretModel().removeSecondaryCarets();
  int offset = editor.getDocument().getTextLength();
  if (editor instanceof DesktopEditorImpl) {
    editor.getCaretModel().moveToLogicalPosition(editor.offsetToLogicalPosition(offset).leanForward(true));
  }
  else {
    editor.getCaretModel().moveToOffset(offset);
  }
  editor.getSelectionModel().removeSelection();

  ScrollingModel scrollingModel = editor.getScrollingModel();
  scrollingModel.disableAnimation();
  scrollingModel.scrollToCaret(ScrollType.CENTER);
  scrollingModel.enableAnimation();

  Project project = dataContext.getData(CommonDataKeys.PROJECT);
  if (project != null) {
    IdeDocumentHistory instance = IdeDocumentHistory.getInstance(project);
    if (instance != null) {
      instance.includeCurrentCommandAsNavigation();
    }
  }
}
 
Example #8
Source File: ResolveRedSymbolsAction.java    From litho with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  // Verified nonNull in #update
  final Project project = e.getProject();
  final VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
  final PsiJavaFile psiFile = (PsiJavaFile) e.getData(CommonDataKeys.PSI_FILE);
  final Editor editor = e.getData(CommonDataKeys.EDITOR);

  Map<String, String> eventMetadata = new HashMap<>();
  resolveRedSymbols(
      psiFile,
      virtualFile,
      editor,
      project,
      eventMetadata,
      finished -> {
        eventMetadata.put(EventLogger.KEY_TYPE, "action");
        eventMetadata.put(EventLogger.KEY_RESULT, finished ? "success" : "fail");
        LithoLoggerProvider.getEventLogger().log(EventLogger.EVENT_RED_SYMBOLS, eventMetadata);
      });
}
 
Example #9
Source File: SlackSettings.java    From SlackStorm with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getData(CommonDataKeys.PROJECT);

    List<String> channelsId = SlackStorage.getInstance().getChannelsId();

    if (channelsId.size() > 0) {
        String channelToRemove = Messages.showEditableChooseDialog(
            "Select the channel to remove",
            SlackChannel.getSettingsDescription(),
            SlackStorage.getSlackIcon(),
            channelsId.toArray(new String[channelsId.size()]),
            channelsId.get(0),
            null
        );

        if (channelsId.contains(channelToRemove)) {
            SlackStorage.getInstance().removeChannelByDescription(channelToRemove);
            Messages.showMessageDialog(project, "Channel \"" + channelToRemove + "\" removed.", "Information", Messages.getInformationIcon());
        }
    }
}
 
Example #10
Source File: MacroManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static DataContext getCorrectContext(DataContext dataContext) {
  if (dataContext.getData(PlatformDataKeys.FILE_EDITOR) != null) {
    return dataContext;
  }
  Project project = dataContext.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return dataContext;
  }
  FileEditorManager editorManager = FileEditorManager.getInstance(project);
  VirtualFile[] files = editorManager.getSelectedFiles();
  if (files.length == 0) {
    return dataContext;
  }
  FileEditor fileEditor = editorManager.getSelectedEditor(files[0]);
  return fileEditor == null ? dataContext : DataManager.getInstance().getDataContext(fileEditor.getComponent());
}
 
Example #11
Source File: UnshelveWithDialogAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  final ShelvedChangeList[] changeLists = e.getData(ShelvedChangesViewManager.SHELVED_CHANGELIST_KEY);
  if (project == null || changeLists == null || changeLists.length != 1) return;

  FileDocumentManager.getInstance().saveAllDocuments();

  final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(changeLists[0].PATH));
  if (virtualFile == null) {
    VcsBalloonProblemNotifier.showOverChangesView(project, "Can not find path file", MessageType.ERROR);
    return;
  }
  if (! changeLists[0].getBinaryFiles().isEmpty()) {
    VcsBalloonProblemNotifier.showOverChangesView(project, "Binary file(s) would be skipped.", MessageType.WARNING);
  }
  final ApplyPatchDifferentiatedDialog dialog =
    new ApplyPatchDifferentiatedDialog(project, new ApplyPatchDefaultExecutor(project), Collections.<ApplyPatchExecutor>emptyList(),
                                       ApplyPatchMode.UNSHELVE, virtualFile);
  dialog.setHelpId("reference.dialogs.vcs.unshelve");
  dialog.show();
}
 
Example #12
Source File: NavBarUpdateQueue.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void requestModelUpdateFromContextOrObject(DataContext dataContext, Object object) {
  try {
    final NavBarModel model = myPanel.getModel();
    if (dataContext != null) {
      if (dataContext.getData(CommonDataKeys.PROJECT) != myPanel.getProject() || myPanel.isNodePopupActive()) {
        requestModelUpdate(null, myPanel.getContextObject(), true);
        return;
      }
      final Window window = SwingUtilities.getWindowAncestor(myPanel);
      if (window != null && !window.isFocused()) {
        model.updateModel(DataManager.getInstance().getDataContext(myPanel));
      }
      else {
        model.updateModel(dataContext);
      }
    }
    else {
      model.updateModel(object);
    }

    queueRebuildUi();
  }
  finally {
    myModelUpdating.set(false);
  }
}
 
Example #13
Source File: OpenAndroidModule.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  final VirtualFile projectFile = findProjectFile(e);
  if (projectFile == null) {
    FlutterMessages.showError("Error Opening Android Studio", "Project not found.");
    return;
  }
  final int modifiers = e.getModifiers();
  // From ReopenProjectAction.
  final boolean forceOpenInNewFrame = BitUtil.isSet(modifiers, InputEvent.CTRL_MASK)
                                      || BitUtil.isSet(modifiers, InputEvent.SHIFT_MASK)
                                      || e.getPlace() == ActionPlaces.WELCOME_SCREEN;

  VirtualFile sourceFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
  // Using:
  //ProjectUtil.openOrImport(projectFile.getPath(), e.getProject(), forceOpenInNewFrame);
  // presents the user with a really imposing Gradle project import dialog.
  openOrImportProject(projectFile, e.getProject(), sourceFile, forceOpenInNewFrame);
}
 
Example #14
Source File: BaseToolWindowToggleAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public final void setSelected(AnActionEvent e, boolean state) {
  Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return;
  }
  String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
  if (id == null) {
    return;
  }

  ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
  ToolWindowEx toolWindow = (ToolWindowEx)mgr.getToolWindow(id);

  setSelected(toolWindow, state);
}
 
Example #15
Source File: CloseAllEditorsAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void update(AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  final EditorWindow editorWindow = event.getData(EditorWindow.DATA_KEY);
  if (editorWindow != null && editorWindow.inSplitter()) {
    presentation.setText(IdeBundle.message("action.close.all.editors.in.tab.group"));
  }
  else {
    presentation.setText(IdeBundle.message("action.close.all.editors"));
  }
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  presentation.setEnabled(FileEditorManager.getInstance(project).getSelectedFiles().length > 0);
}
 
Example #16
Source File: ColorAndFontOptions.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static boolean edit(DataContext context, String search, Function<ColorAndFontOptions, SearchableConfigurable> function) {
  ColorAndFontOptions options = new ColorAndFontOptions();
  SearchableConfigurable page = function.apply(options);

  Configurable[] configurables = options.getConfigurables();
  try {
    if (page != null) {
      Runnable runnable = search == null ? null : page.enableSearch(search);
      Window window = UIUtil.getWindow(context.getData(PlatformDataKeys.CONTEXT_COMPONENT));
      if (window != null) {
        ShowSettingsUtil.getInstance().editConfigurable(window, page, runnable);
      }
      else {
        ShowSettingsUtil.getInstance().editConfigurable(context.getData(CommonDataKeys.PROJECT), page, runnable);
      }
    }
  }
  finally {
    for (Configurable configurable : configurables) configurable.disposeUIResources();
    options.disposeUIResources();
  }
  return page != null;
}
 
Example #17
Source File: QuickEvaluateAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isEnabled(@Nonnull final Project project, final AnActionEvent event) {
  if (!myHandler.isEnabled(project)) {
    return false;
  }

  Editor editor = event.getData(CommonDataKeys.EDITOR);
  if (editor == null) {
    return false;
  }

  if (event.getData(EditorGutter.KEY) != null) {
    return false;
  }

  return true;
}
 
Example #18
Source File: GenerateAction.java    From RIBs with Apache License 2.0 6 votes vote down vote up
/**
 * Checked whether or not this action can be enabled.
 * <p>
 * <p>Requirements to be enabled: * User must be in a Java source folder.
 *
 * @param dataContext to figure out where the user is.
 * @return {@code true} when the action is available, {@code false} when the action is not
 * available.
 */
private boolean isAvailable(DataContext dataContext) {
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    return false;
  }

  final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
  if (view == null || view.getDirectories().length == 0) {
    return false;
  }

  ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  for (PsiDirectory dir : view.getDirectories()) {
    if (projectFileIndex.isUnderSourceRootOfType(
        dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES)
        && checkPackageExists(dir)) {
      return true;
    }
  }

  return false;
}
 
Example #19
Source File: CsvChangeEscapeCharacterAction.java    From intellij-csv-validator with Apache License 2.0 5 votes vote down vote up
@Override
public void setSelected(@NotNull AnActionEvent anActionEvent, boolean selected) {
    PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);
    if (psiFile == null) {
        return;
    }
    CsvFileAttributes.getInstance(psiFile.getProject()).setEscapeCharacter(psiFile, this.myEscapeCharacter);
    FileContentUtilCore.reparseFiles(psiFile.getVirtualFile());

    FileEditor fileEditor = anActionEvent.getData(PlatformDataKeys.FILE_EDITOR);
    if (fileEditor != null) {
        fileEditor.selectNotify();
    }
}
 
Example #20
Source File: ShowDiffWithLocalAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  Project project = e.getRequiredData(CommonDataKeys.PROJECT);
  if (ChangeListManager.getInstance(project).isFreezedWithNotification(null)) return;

  VcsRevisionNumber currentRevisionNumber = e.getRequiredData(VcsDataKeys.HISTORY_SESSION).getCurrentRevisionNumber();
  VcsFileRevision selectedRevision = e.getRequiredData(VcsDataKeys.VCS_FILE_REVISIONS)[0];
  FilePath filePath = e.getRequiredData(VcsDataKeys.FILE_PATH);

  if (currentRevisionNumber != null && selectedRevision != null) {
    DiffFromHistoryHandler diffHandler =
            ObjectUtil.notNull(e.getRequiredData(VcsDataKeys.HISTORY_PROVIDER).getHistoryDiffHandler(), new StandardDiffFromHistoryHandler());
    diffHandler.showDiffForTwo(project, filePath, selectedRevision, new CurrentRevision(filePath.getVirtualFile(), currentRevisionNumber));
  }
}
 
Example #21
Source File: CsvDefaultSeparatorAction.java    From intellij-csv-validator with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isSelected(@NotNull AnActionEvent anActionEvent) {
    PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);
    if (psiFile == null) {
        return false;
    }
    return !CsvHelper.hasValueSeparatorAttribute(psiFile);
}
 
Example #22
Source File: FileRelativePathMacro.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public String expand(DataContext dataContext) {
  Project project = dataContext.getData(CommonDataKeys.PROJECT);
  final VirtualFile baseDir = project == null ? null : project.getBaseDir();
  if (baseDir == null) {
    return null;
  }

  VirtualFile file = dataContext.getData(PlatformDataKeys.VIRTUAL_FILE);
  if (file == null) return null;
  return FileUtil.getRelativePath(VfsUtil.virtualToIoFile(baseDir), VfsUtil.virtualToIoFile(file));
}
 
Example #23
Source File: VcsPushAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  Project project = e.getRequiredData(CommonDataKeys.PROJECT);
  VcsRepositoryManager manager = ServiceManager.getService(project, VcsRepositoryManager.class);
  Collection<Repository> repositories = e.getData(CommonDataKeys.EDITOR) != null
                                        ? ContainerUtil.<Repository>emptyList()
                                        : collectRepositories(manager, e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY));
  VirtualFile selectedFile = DvcsUtil.getSelectedFile(project);
  new VcsPushDialog(project, DvcsUtil.sortRepositories(repositories), selectedFile != null ? manager.getRepositoryForFile(selectedFile) : null).show();
}
 
Example #24
Source File: CompareFilesAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void update(@Nonnull AnActionEvent e) {
  super.update(e);

  VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);

  String text = "Compare Files";
  if (files != null && files.length == 1) {
    text = "Compare With...";
  }
  else if (files != null && files.length == 2) {
    Type type1 = getType(files[0]);
    Type type2 = getType(files[1]);

    if (type1 != type2) {
      text = "Compare";
    }
    else {
      switch (type1) {
        case FILE:
          text = "Compare Files";
          break;
        case DIRECTORY:
          text = "Compare Directories";
          break;
        case ARCHIVE:
          text = "Compare Archives";
          break;
      }
    }
  }
  e.getPresentation().setText(text);
}
 
Example #25
Source File: SOAPKitScaffoldingAction.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void update(AnActionEvent anActionEvent)
{
    final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(anActionEvent.getDataContext());
    final boolean isWSDL;
    if (file != null)
    {
        isWSDL = "wsdl".equalsIgnoreCase(file.getExtension());
        anActionEvent.getPresentation().setEnabled(isWSDL);
        anActionEvent.getPresentation().setVisible(isWSDL);
    }

}
 
Example #26
Source File: EditorTextField.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Object getData(@Nonnull Key<?> dataId) {
  if (myEditor != null && myEditor.isRendererMode()) {
    if (PlatformDataKeys.COPY_PROVIDER == dataId) {
      return myEditor.getCopyProvider();
    }
    return null;
  }

  if (CommonDataKeys.EDITOR == dataId) {
    return myEditor;
  }

  return null;
}
 
Example #27
Source File: BackAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void update(@Nonnull AnActionEvent event){
  Presentation presentation = event.getPresentation();
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null || project.isDisposed()) {
    presentation.setEnabled(false);
    return;
  }
  presentation.setEnabled(IdeDocumentHistory.getInstance(project).isBackAvailable());
}
 
Example #28
Source File: ToggleBookmarkAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void update(AnActionEvent event) {
  DataContext dataContext = event.getDataContext();
  final Project project = dataContext.getData(CommonDataKeys.PROJECT);
  event.getPresentation().setEnabled(project != null &&
                                     (ToolWindowManager.getInstance(project).isEditorComponentActive() &&
                                      dataContext.getData(PlatformDataKeys.EDITOR) != null ||
                                      dataContext.getData(PlatformDataKeys.VIRTUAL_FILE) != null));

  event.getPresentation().setText(IdeBundle.message("action.bookmark.toggle"));
}
 
Example #29
Source File: APIKitScaffoldingAction.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void update(AnActionEvent anActionEvent)
{
    final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(anActionEvent.getDataContext());
    final boolean isRAML;
    if (file != null)
    {
        isRAML = RamlFileType.getInstance().getDefaultExtension().equalsIgnoreCase(file.getExtension());
        anActionEvent.getPresentation().setEnabled(isRAML);
        anActionEvent.getPresentation().setVisible(isRAML);
    }

}
 
Example #30
Source File: GaugeExecutionProducer.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isConfigurationFromContext(RunConfiguration configuration, ConfigurationContext context) {
    if (!(configuration.getType() instanceof GaugeRunTaskConfigurationType)) return false;
    Location location = context.getLocation();
    PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(context.getDataContext());
    if (location == null || location.getVirtualFile() == null || element == null) return false;
    if (!isInSpecScope(context.getPsiLocation())) return false;
    String specsToExecute = ((GaugeRunConfiguration) configuration).getSpecsToExecute();
    return specsToExecute != null && (specsToExecute.equals(location.getVirtualFile().getPath()));
}