当前位置: 首页>>代码示例>>Java>>正文


Java DataKeys类代码示例

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


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

示例1: actionPerformed

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
@Override
public void actionPerformed(@Nonnull AnActionEvent event) {
    if (!isAvailable(event)) {
        return;
    }

    project = event.getProject();
    ideView = event.getData(DataKeys.IDE_VIEW);

    final Injector injector = GuiceManager.getInstance(project).getInjector();
    injector.injectMembers(this);

    // 'selected' is null when directory selection is canceled although multiple directories are chosen.
    final PsiDirectory selected = ideView.getOrChooseDirectory();
    if (selected == null) {
        return;
    }

    final NewClassDialog dialog = NewClassDialog.builder(project, bundle)
            .nameValidator(nameValidatorProvider.get())
            .jsonValidator(jsonValidatorProvider.get())
            .actionListener(this)
            .build();
    dialog.show();
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:26,代码来源:NewClassAction.java

示例2: actionPerformed

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    project = e.getProject();
    selectGroup = DataKeys.VIRTUAL_FILE.getData(e.getDataContext());
    String className = Messages.showInputDialog(project, "请输入类名称", "NewMvpGroup", Messages.getQuestionIcon());
    if (className == null || className.equals("")) {
        System.out.print("没有输入类名");
        return;
    }
    if (className.equals("base") || className.equals("BASE") || className.equals("Base")) {
        createMvpBase();
    } else {
        createClassMvp(className);
    }
    project.getBaseDir().refresh(false, true);
}
 
开发者ID:y1xian,项目名称:KotlinMvp,代码行数:17,代码来源:AndroidMvpAction.java

示例3: createEditBtnListener

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
private ActionListener createEditBtnListener() {
    return new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            final File file = new File(AzurePlugin.prefFilePath);
            ApplicationManager.getApplication().runWriteAction(new Runnable() {
                @Override
                public void run() {
                    final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
                    if (vf != null) {
                        try {
                            vf.setWritable(true);
                            DataContext dataContext = DataManager.getInstance().getDataContext();
                            Project project = DataKeys.PROJECT.getData(dataContext);
                            FileEditorManager.getInstance(project).openFile(vf, true);
                        } catch (IOException ex) {
                            AzurePlugin.log(message("error"), ex);
                        }
                    }
                }
            });
        }
    };
}
 
开发者ID:Microsoft,项目名称:Azure-Toolkit-for-IntelliJ,代码行数:25,代码来源:ServiceEndpointsPanel.java

示例4: actionPerformed

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    Project project = getEventProject(event);
    VirtualFile assetRoot = SettingsHelper.getAssetPath(IconPack.ANDROID_ICONS);
    if (assetRoot == null) {
        Messages.showMessageDialog(
            project,
            "You have to select the Android Icons asset folder in the settings!",
            "Error",
            Messages.getErrorIcon());
        if (project == null) {
            project = ProjectManager.getInstance().getDefaultProject();
        }
        ShowSettingsUtil.getInstance().showSettingsDialog(project, "Android Drawable Importer");
    } else {
        Module module = event.getData(DataKeys.MODULE);
        AndroidIconsImporter dialog = new AndroidIconsImporter(project, module);
        dialog.show();
    }
}
 
开发者ID:sayedyousef,项目名称:plgin,代码行数:21,代码来源:AndroidIconsAction.java

示例5: actionPerformed

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    Project project = getEventProject(event);
    VirtualFile assetRoot = SettingsHelper.getAssetPath(IconPack.MATERIAL_ICONS);
    if (assetRoot == null) {
        Messages.showMessageDialog(
            project,
            "You have to select the Material Icons root folder in the settings!",
            "Error",
            Messages.getErrorIcon());
        if (project == null) {
            project = ProjectManager.getInstance().getDefaultProject();
        }
        ShowSettingsUtil.getInstance().showSettingsDialog(project, "Android Drawable Importer");
    } else {
        Module module = event.getData(DataKeys.MODULE);
        MaterialIconsImporter dialog = new MaterialIconsImporter(project, module);
        dialog.show();
    }
}
 
开发者ID:sayedyousef,项目名称:plgin,代码行数:21,代码来源:MaterialIconsAction.java

示例6: actionPerformed

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
/**
 * Invoked when the user clicks on a popup menu item.
 *
 * @param event Popup menu click event
 */
public void actionPerformed(ActionEvent event)
{
    IdeaPlugin plugin = IdeaPlugin.getInstance(ideaEvent.getData(DataKeys.PROJECT));

    if (event.getActionCommand().equals(IdeaPlugin.ACTION_CLEAR_RESPONSE))
    {
        plugin.clearResponse();
    }
    else if (event.getActionCommand().equals(IdeaPlugin.ACTION_RESET_ALL))
    {
        plugin.resetAll();
    }
    else if (event.getActionCommand().equals(IdeaPlugin.ACTION_RESET_TO_LAST))
    {
        plugin.resetToLast();
    }
}
 
开发者ID:drcallaway,项目名称:restclient-idea-plugin,代码行数:23,代码来源:EditMenuAction.java

示例7: actionPerformed

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
/**
 * Invoked when the user clicks on a popup menu item.
 *
 * @param event Popup menu click event
 */
public void actionPerformed(ActionEvent event)
{
    IdeaPlugin plugin = IdeaPlugin.getInstance(ideaEvent.getData(DataKeys.PROJECT));

    if (event.getActionCommand().equals(IdeaPlugin.ACTION_PASSWORD_ENCODER_DECODER))
    {
        plugin.passwordEncodeDecode();
    }
    else if (event.getActionCommand().equals(IdeaPlugin.ACTION_START_TRACE_SERVER))
    {
        plugin.startTraceServer();
    }
    else if (event.getActionCommand().equals(IdeaPlugin.ACTION_STOP_TRACE_SERVER))
    {
        plugin.stopTraceServer();
    }
    else if (event.getActionCommand().equals(IdeaPlugin.ACTION_INSERT_TRACE_URL))
    {
        plugin.insertTraceServerUrl();
    }
    else if (event.getActionCommand().equals(IdeaPlugin.METHOD_OPTIONS))
    {
        plugin.options(event);
    }
}
 
开发者ID:drcallaway,项目名称:restclient-idea-plugin,代码行数:31,代码来源:ToolsMenuAction.java

示例8: actionPerformed

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getProject();
    Module module = e.getData(DataKeys.MODULE);

    final PsiJavaFile psiFile = (PsiJavaFile) getPsiFile(e);
    final VirtualFile sourceRoot =
            ProjectFileIndex.SERVICE.getInstance(module.getProject()).getSourceRootForFile(psiFile.getVirtualFile());

    PackageChooserPopup packageChooserPopup = new PackageChooserPopup(project, sourceRoot);
    JBPopup popup = packageChooserPopup.createPopup(new PackageChooserPopup.OnPackageSelectedListener() {
        @Override
        public void onPackageSelected(String qualifiedPackageName) {
            Scheme scheme = SchemeManager.getScheme(psiFile, qualifiedPackageName);
            VirtualFile generatedFile = SchemeFileGenerator.generate(scheme, sourceRoot);
            if(generatedFile!=null) {
                generatedFile.refresh(false, false);
            }
            FileEditorManager.getInstance(project).openFile(generatedFile, true);
        }
    });
    popup.showCenteredInCurrentWindow(project);
}
 
开发者ID:nrudenko,项目名称:OrmGeneratorPlugin,代码行数:23,代码来源:GenerateSchemeAction.java

示例9: update

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
/**
 * validate operation available
 *
 * @param e action event
 */
@Override
public void update(AnActionEvent e) {
    super.update(e);
    PsiFile psiFile = e.getData(DataKeys.PSI_FILE);
    Editor editor = e.getData(DataKeys.EDITOR);
    if ((psiFile != null && psiFile instanceof XmlFile) && editor != null) {
        PsiElement psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset());
        if (psiElement != null) {
            XmlTag tag = getResultMapTag(psiElement);
            if (tag != null) {
                e.getPresentation().setEnabled(true);
                e.getPresentation().setVisible(true);
                return;
            }
        }
    }
    e.getPresentation().setEnabled(false);
    e.getPresentation().setVisible(false);
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:25,代码来源:GenerateSQLForResultMapAction.java

示例10: update

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
/**
 * validate action is available
 *
 * @param event action event
 */
public void update(AnActionEvent event) {
	Presentation presentation = event.getPresentation();
	Module module = event.getData(DataKeys.MODULE);
	PsiElement psiElement = event.getData(DataKeys.PSI_ELEMENT);
	if (psiElement instanceof PsiDirectory) {
		PsiDirectory psiDirectory = (PsiDirectory) psiElement;
		if (JavaDirectoryService.getInstance().getPackage(psiDirectory) != null) {
			DataSource dataSource = JavadocTableNameReferenceProvider.getDataSourceForIbatis(module);
			if (dataSource != null) {
				presentation.setEnabled(true);
				presentation.setVisible(true);
				return;
			}
		}
	}
	presentation.setEnabled(false);
	presentation.setVisible(false);
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:24,代码来源:ModelClassGeneratorAction.java

示例11: handleClickOnError

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
private void handleClickOnError(BuckTreeNodeDetailError node) {
  TreeNode parentNode = node.getParent();
  if (parentNode instanceof BuckTreeNodeFileError) {
    BuckTreeNodeFileError buckParentNode = (BuckTreeNodeFileError) parentNode;

    DataContext dataContext = DataManager.getInstance().getDataContext();
    Project project = DataKeys.PROJECT.getData(dataContext);

    String relativePath = buckParentNode.getFilePath().replace(project.getBasePath(), "");

    VirtualFile virtualFile = project.getBaseDir().findFileByRelativePath(relativePath);
    OpenFileDescriptor openFileDescriptor =
        new OpenFileDescriptor(project, virtualFile, node.getLine() - 1, node.getColumn() - 1);
    openFileDescriptor.navigate(true);
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:17,代码来源:BuckToolWindowFactory.java

示例12: triggerConfigChange

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
private void triggerConfigChange() {
    DataContext dataContext = DataManager.getInstance().getDataContextFromFocus().getResult();
    Project project = DataKeys.PROJECT.getData(dataContext);
    if (project != null) {
        MessageBus messageBus = project.getMessageBus();
        messageBus.connect();
        ConfigChangeNotifier configChangeNotifier = messageBus.syncPublisher(ConfigChangeNotifier.CONFIG_TOPIC);
        configChangeNotifier.configChanged(activeCheckBox.isSelected());
    }
}
 
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:11,代码来源:IdeaCurrencyConfigUI.java

示例13: actionPerformed

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    VirtualFile[] data = e.getData(DataKeys.VIRTUAL_FILE_ARRAY);
    // TODO: insert action logic here
    PatcherDialog dialog = new PatcherDialog(e);
    dialog.setSize(600, 400);
    dialog.setLocationRelativeTo(null);
    dialog.setVisible(true);
    dialog.requestFocus();
}
 
开发者ID:serical,项目名称:patcher,代码行数:11,代码来源:CreatePatcherAction.java

示例14: createUIComponents

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
private void createUIComponents() {
    VirtualFile[] data = event.getData(DataKeys.VIRTUAL_FILE_ARRAY);
    fieldList = new JBList(data);
    fieldList.setEmptyText("No File Selected!");
    ToolbarDecorator decorator = ToolbarDecorator.createDecorator(fieldList);
    filePanel = decorator.createPanel();
}
 
开发者ID:serical,项目名称:patcher,代码行数:8,代码来源:PatcherDialog.java

示例15: actionPerformed

import com.intellij.openapi.actionSystem.DataKeys; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    try {
        com.intellij.openapi.actionSystem.DataContext dataContext = e.getDataContext();
        PsiJavaFile javaFile = (PsiJavaFile) ((PsiFile) DataKeys.PSI_FILE.getData(dataContext)).getContainingFile();
        String sourceName = javaFile.getName();
        Module module = (Module) DataKeys.MODULE.getData(dataContext);
        String compileRoot = CompilerModuleExtension.getInstance(module).getCompilerOutputPath().getPath();
        getVirtualFile(sourceName, CompilerModuleExtension.getInstance(module).getCompilerOutputPath().getChildren(), compileRoot);
        VirtualFileManager.getInstance().syncRefresh();
    } catch (Exception ex) {
        ex.printStackTrace();
        Messages.showErrorDialog("Please build your module or project!!!", "error");
    }
}
 
开发者ID:serical,项目名称:patcher,代码行数:16,代码来源:ClassesExportAction.java


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