本文整理汇总了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();
}
示例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);
}
示例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);
}
}
}
});
}
};
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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());
}
}
示例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();
}
示例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();
}
示例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");
}
}