• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DataConstants类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.actionSystem.DataConstants的典型用法代码示例。如果您正苦于以下问题:Java DataConstants类的具体用法?Java DataConstants怎么用?Java DataConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataConstants类属于com.intellij.openapi.actionSystem包,在下文中一共展示了DataConstants类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public void actionPerformed( AnActionEvent e ) {
    Editor editor = ( Editor ) e.getDataContext().getData( "editor" );
    SelectionModel selectionModel = editor.getSelectionModel();
    if ( selectionModel != null ) {
        String selectedText = selectionModel.getSelectedText();
        if ( selectedText != null && selectedText.trim().length() > 0 ) {
            Project project = ( Project ) e.getDataContext().getData( DataConstants.PROJECT );
            String panelid = ( String ) project.getUserData( QuickNotes.KEY_PANELID );
            QuickNotesPanel quickNotesPanel = QuickNotesManager.getInstance().getQuickNotesPanel( panelid );
            if ( quickNotesPanel != null ) {
                FileDocumentManager manager = FileDocumentManager.getInstance();
                VirtualFile virtualFile = manager.getFile( editor.getDocument() );
                quickNotesPanel.addNewNote( "[File: " + virtualFile.getPath() + "]\n" + selectedText );
            }
        }
    }
}
 
开发者ID:jrana,项目名称:quicknotes,代码行数:18,代码来源:AddToQuickNotes.java


示例2: runEnable

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
@Override
protected boolean runEnable(AnActionEvent anActionEvent) {
    Object o = anActionEvent.getDataContext().getData(DataConstants.PSI_FILE);
    if (o instanceof XmlFileImpl) {
        parentFileName = ((XmlFileImpl) o).getVirtualFile().getParent().getName();
        if (isPreference(parentFileName)) {
            return true;
        }

    } else if (o instanceof PsiFile) {
        parentFileName = ((PsiFile) o).getVirtualFile().getParent().getName();
        if (isDataBase(parentFileName)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:zzz40500,项目名称:ADB-Duang,代码行数:18,代码来源:PushAction.java


示例3: actionPerformed

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null) return;
    final VirtualFile file = (VirtualFile) e.getDataContext().getData(DataConstants.VIRTUAL_FILE);

    if (file == null) {
        RTFile[] rtFiles = RTFile.DATA_KEY.getData(e.getDataContext());
        if (rtFiles == null || rtFiles.length == 0) {
            System.out.println("No file for rt compile");
            return;
        }
        // handle all files
        for (RTFile rtFile : rtFiles) {
            FileEditorManager.getInstance(project).openFile(rtFile.getController().getVirtualFile(), true, true);
        }
    } else {
        VirtualFile vfs = file.getParent().findChild(RTMergerTreeStructureProvider.getJSControllerName(file));
        if (vfs != null) {
            FileEditorManager.getInstance(project).openFile(vfs, true, true);
        }
    }
}
 
开发者ID:idok,项目名称:react-templates-plugin,代码行数:24,代码来源:SwitchViewAction.java


示例4: actionPerformed

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
        final Project project = e.getProject();
        if (project == null) return;
        final VirtualFile file = (VirtualFile) e.getDataContext().getData(DataConstants.VIRTUAL_FILE);

        JscsProjectComponent component = project.getComponent(JscsProjectComponent.class);
//        JscsConfigFileListener.start(collectedInfo.project);
//        actualFile = ActualFile2.getOrCreateActualFile(JSCS_TEMP_FILE_KEY, file, collectedInfo.fileContent);
//        if (actualFile == null || actualFile.getActualFile() == null) {
//            return null;
//        }
//            File cwd = new File(project.getBasePath());
//            if (actualFile instanceof ActualFile2.TempActualFile) {
//                cwd = ((ActualFile2.TempActualFile) actualFile).getTempFile().file.getParentFile();
//            }
//        String relativeFile = actualFile.getActualFile().getName();
//        File cwd = actualFile.getActualFile().getParentFile();
//            String relativeFile = FileUtils.makeRelative(cwd, actualFile.getActualFile());

        String rc = JscsExternalAnnotator.getRC(project, component.jscsRcFile);
        LintResult result = JscsRunner.fix(project.getBasePath(), file.getPath(), component.nodeInterpreter, component.jscsExecutable, rc, component.preset, component.settings.esnext, component.settings.esprima);
        file.refresh(true, false);
    }
 
开发者ID:idok,项目名称:jscs-plugin,代码行数:24,代码来源:JscsFixAction.java


示例5: getAndroidFacetName

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
@Override
protected String getAndroidFacetName(AnActionEvent anActionEvent) {
    Object o = anActionEvent.getDataContext().getData(DataConstants.PSI_FILE);
    if (o instanceof XmlFileImpl) {

        return ((XmlFileImpl) o).getVirtualFile().getParent().getParent().getName();

    } else if (o instanceof PsiFile) {
        return parentFileName = ((PsiFile) o).getVirtualFile().getParent().getParent().getName();
    }
    return super.getAndroidFacetName(anActionEvent);
}
 
开发者ID:zzz40500,项目名称:ADB-Duang,代码行数:13,代码来源:PushAction.java


示例6: runEnable

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
protected boolean runEnable(AnActionEvent anActionEvent) {
    Object o = anActionEvent.getDataContext().getData(DataConstants.PSI_FILE);
    if (o instanceof PsiFile) {

        targetFilePath = ((PsiFile) o).getVirtualFile().getPath();
        if (isDataBase(((PsiFile) o).getVirtualFile().getParent().getName())) {
            if (isMacOs())
                return true;
        }
    }
    return false;
}
 
开发者ID:zzz40500,项目名称:ADB-Duang,代码行数:13,代码来源:EditDbAction.java


示例7: getFile

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
private static PsiFile getFile(final Editor      editor ,
                               final DataContext context )
{
    final Project             project             = (Project) context.getData(DataConstants.PROJECT);
    final Document            document            = editor.getDocument();
    final FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
    final VirtualFile         virtualFile         = fileDocumentManager.getFile(document);
    final PsiManager          psiManager          = PsiManager.getInstance(project);
    return psiManager.findFile(virtualFile);
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:11,代码来源:RearrangerActionHandler.java


示例8: RearrangeIt

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public RearrangeIt(final DataContext dc)
{
    this.dc = dc;
    if (dc != null) {
        this.project = (Project) dc.getData(DataConstants.PROJECT);
    }
    else this.project = null;
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:9,代码来源:ProjectTreeActionHandler.java


示例9: execute

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public final void execute(final Editor editor, final DataContext context)
{
    if (editor == null)
    {
        return;
    }
    final Project project = (Project) context.getData(DataConstants.PROJECT);
    logger.debug("project=" + project);
    logger.debug("editor=" + editor);
    final Document document = editor.getDocument();
    final CaretModel caret = editor.getCaretModel();
    int cursorOffset = caret.getOffset();
    final PsiFile psiFile = getFile(editor, context);
    if (!psiFile.getName().endsWith(".java"))
    {
        logger.debug("not a .java file -- skipping " + psiFile.getName());
        return;
    }
    if (!RearrangerActionHandler.isFileWritable(psiFile))
    {
        logger.debug("not a writable .java file -- skipping " + psiFile.getName());
        return;
    }
    logger.debug("inProgress=" + inProgress);
    if (!useDialog)
    {
        if (inProgress)
        {
            return;
        }
        setInProgress(true);
    }
    buildLiveRearrangerData(project, document, psiFile, cursorOffset);
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:35,代码来源:LiveRearrangerActionHandler.java


示例10: getFile

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
private static PsiFile getFile(final Editor editor,
                               final DataContext context)
{
    final Project project = (Project) context.getData(DataConstants.PROJECT);
    final Document document = editor.getDocument();
    final FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
    final VirtualFile virtualFile = fileDocumentManager.getFile(document);
    final PsiManager psiManager = PsiManager.getInstance(project);
    return psiManager.findFile(virtualFile);
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:11,代码来源:LiveRearrangerActionHandler.java


示例11: execute

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public final void execute(final Editor editor, final DataContext context)
{
    if (editor == null) {
        return;
    }
    final Project     project     = (Project) context.getData(DataConstants.PROJECT);
    logger.debug("project=" + project);
    logger.debug("editor=" + editor);
    final Document    document    = editor.getDocument();
    final CaretModel  caret = editor.getCaretModel();
    int cursorOffset = caret.getOffset();
    final PsiFile     psiFile     = getFile(editor, context);
    if (!psiFile.getName().endsWith(".java")) {
        logger.debug("not a .java file -- skipping " + psiFile.getName());
        return;
    }
    if (!psiFile.isWritable()) {
        logger.debug("not a writable .java file -- skipping " + psiFile.getName());
        return;
    }
    logger.debug("inProgress=" + inProgress);
    if (inProgress) {
        return;
    }

    setInProgress(true);
    buildLiveRearrangerData(project, document, psiFile, cursorOffset);
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:29,代码来源:RearrangementResult31.java


示例12: testJUnitPackage

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public void testJUnitPackage() {
  PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
  PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass);
  final MapDataContext dataContext = new MapDataContext();
  final Module module = ModuleUtil.findModuleForPsiElement(psiClass);
  dataContext.put(DataConstants.MODULE, module);
  JUnitConfiguration configuration = createJUnitConfiguration(psiPackage, AllInPackageConfigurationProducer.class, dataContext);
  checkTestObject(JUnitConfiguration.TEST_PACKAGE, configuration);
  checkPackage(PACKAGE_NAME, configuration);
  checkGeneretedName(configuration, PACKAGE_NAME + " in " + module.getName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ContextConfigurationTest.java


示例13: testJUnitDefaultPackage

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public void testJUnitDefaultPackage() {
  PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
  PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass);
  PsiPackage defaultPackage = psiPackage.getParentPackage();
  final Module module = ModuleUtil.findModuleForPsiElement(psiClass);
  final MapDataContext dataContext = new MapDataContext();
  dataContext.put(DataConstants.MODULE, module);
  JUnitConfiguration configuration = createJUnitConfiguration(defaultPackage, AllInPackageConfigurationProducer.class, dataContext);
  checkTestObject(JUnitConfiguration.TEST_PACKAGE, configuration);
  checkPackage("", configuration);
  checkGeneretedName(configuration, "All in " + module.getName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ContextConfigurationTest.java


示例14: createDataContextFor

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
private DataContext createDataContextFor(final Editor editor) {
  return new DataContext() {
    @Override
    public Object getData(String dataId) {
      if (dataId.equals(DataConstants.EDITOR)) return editor;
      if (dataId.equals(DataConstants.PROJECT)) return getProject();
      return null;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:NonProjectFileAccessTest.java


示例15: update

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
@Override
    public void update(@NotNull AnActionEvent e) {
        boolean enabled = false;
        Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
        boolean rtEnabled = RTActionUtil.isRTEnabled(project);
        if (project != null) {
            final VirtualFile file = (VirtualFile) e.getDataContext().getData(DataConstants.VIRTUAL_FILE);
            enabled = rtEnabled && (RTFileUtil.isRTFile(file) || BuildTemplateAction.isRtFileContext(e.getDataContext()));
//            if (file != null) {
//                e.getPresentation().setText("Switch to Code Behind file '" + file.getName() + '\'');
//            }
        }
        e.getPresentation().setVisible(enabled);
    }
 
开发者ID:idok,项目名称:react-templates-plugin,代码行数:15,代码来源:SwitchViewAction.java


示例16: actionPerformed

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
    if (Utils.debug) {
        Utils.print("running perl script action from context...");
    }
    VirtualFile[] files = (VirtualFile[]) e.getDataContext().getData(DataConstants.VIRTUAL_FILE_ARRAY);
    if (isInvalid(e.getProject(), files)) return;
    for (int i = 0; i < files.length; i++) {
        if (files[i].getExtension().equals("pl")) {
            PerlCli.runFile(e.getProject(), files[i].getPath());
        }
    }
}
 
开发者ID:eli1982,项目名称:intellij-perl-plugin,代码行数:13,代码来源:RunPerlAction.java


示例17: update

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
    try {
        super.update(e);
        VirtualFile[] files = (VirtualFile[]) e.getDataContext().getData(DataConstants.VIRTUAL_FILE_ARRAY);
        if (isInvalid(e.getProject(), files)) return;

        //check pl file in order to update display
        boolean visible = false;
        String perlScriptName = "";
        for (int i = 0; i < files.length; i++) {
            VirtualFile file = files[i];
            if (file != null && file.getExtension().equals("pl")) {
                visible = true;
                if (perlScriptName.isEmpty()) {
                    perlScriptName = file.getName();
                } else {
                    perlScriptName += ", " + file.getName();
                }
            }
        }

        e.getPresentation().setVisible(true);// Visibility
        e.getPresentation().setEnabled(visible);// Enable or disable
        e.getPresentation().setText("Run '" + ((perlScriptName.isEmpty()) ? "..." : perlScriptName) + "'");// Update text
    }finally {
    }
}
 
开发者ID:eli1982,项目名称:intellij-perl-plugin,代码行数:29,代码来源:RunPerlAction.java


示例18: update

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
    boolean enabled = false;
    Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
    boolean pluginEnabled = isJscsEnabled(project);
    if (project != null) {
        final VirtualFile file = (VirtualFile) e.getDataContext().getData(DataConstants.VIRTUAL_FILE);
        enabled = pluginEnabled && isJSFile(file); // || isRtFileContext(e.getDataContext()));
        if (file != null) {
            e.getPresentation().setText("JSCS Fix '" + file.getName() + '\'');
        }
    }
    e.getPresentation().setVisible(enabled);
}
 
开发者ID:idok,项目名称:jscs-plugin,代码行数:15,代码来源:JscsFixAction.java


示例19: actionPerformed

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
        final Project project = e.getProject();
        if (project == null) return;
        final VirtualFile file = (VirtualFile) e.getDataContext().getData(DataConstants.VIRTUAL_FILE);

        // TODO handle multiple selection
        if (file == null) {
//            File[] rtFiles = RTFile.DATA_KEY.getData(e.getDataContext());
//            if (rtFiles == null || rtFiles.length == 0) {
//                System.out.println("No file for rt compile");
//                return;
//            }
//            // handle all files
//            for (RTFile rtFile : rtFiles) {
//                RTFileListener.compile(rtFile.getRtFile().getVirtualFile(), project);
//            }
        } else {
            ESLintProjectComponent component = project.getComponent(ESLintProjectComponent.class);
            if (!component.isSettingsValid() || !component.isEnabled()) {
                return;
            }
//            Result result = ESLintRunner.lint(project.getBasePath(), relativeFile, component.nodeInterpreter, component.eslintExecutable, component.eslintRcFile, component.customRulesPath);

            if (project.getBasePath() != null) {
                ESLintRunner.ESLintSettings settings = ESLintRunner.buildSettings(project.getBasePath(), file.getPath(), component);
                try {
                    ESLintRunner.fix(settings);
                    file.refresh(false, false);
                } catch (ExecutionException e1) {
                    e1.printStackTrace();
                }
            }
        }
    }
 
开发者ID:idok,项目名称:eslint-plugin,代码行数:35,代码来源:ESLintFixAction.java


示例20: actionPerformed

import com.intellij.openapi.actionSystem.DataConstants; //导入依赖的package包/类
public void actionPerformed(AnActionEvent anActionEvent) {
    Application application =
            ApplicationManager.getApplication();
    Project project = (Project) anActionEvent.getDataContext().getData(DataConstants.PROJECT);

    Axis2IdeaPlugin axis2component =
            (Axis2IdeaPlugin) application.getComponent(Axis2IdeaPlugin.class);
    axis2component.showTool(project);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:10,代码来源:Axis2PluginAction.java



注:本文中的com.intellij.openapi.actionSystem.DataConstants类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CommandExecutor类代码示例发布时间:2022-05-22
下一篇:
Java CorbaClientDelegateImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap