本文整理匯總了Java中com.intellij.openapi.actionSystem.AnActionEvent.getProject方法的典型用法代碼示例。如果您正苦於以下問題:Java AnActionEvent.getProject方法的具體用法?Java AnActionEvent.getProject怎麽用?Java AnActionEvent.getProject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.actionSystem.AnActionEvent
的用法示例。
在下文中一共展示了AnActionEvent.getProject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
Project project = anActionEvent.getProject();
if (project != null) {
String packageName = Messages.showInputDialog(
Strings.MESSAGE_ASK_PACKAGE_NAME_TO_FILTER,
Strings.TITLE_ASK_PACKAGE_NAME_TO_FILTER,
Messages.getQuestionIcon(),
PropertiesManager.getData(project, PropertyKeys.PACKAGE_NAME),
new NonEmptyInputValidator());
if (!TextUtils.isEmpty(packageName)) {
PropertiesManager.putData(project, PropertyKeys.PACKAGE_NAME, packageName);
}
}
}
示例2: update
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
presentation.setEnabledAndVisible(false);
Project project = e.getProject();
if (project == null) {
return;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
if (!EduNames.STUDY.equals(course.getCourseMode())) {
presentation.setVisible(true);
return;
}
if (getAnswerPlaceholder(e) == null) {
presentation.setEnabledAndVisible(false);
return;
}
presentation.setEnabledAndVisible(true);
}
示例3: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的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);
}
示例4: getTask
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
private static TaskWithSubtasks getTask(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null || !CCUtils.isCourseCreator(project)) {
return null;
}
VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
if (virtualFile == null) {
return null;
}
while (virtualFile.getName().equals(EduNames.SRC) || !virtualFile.isDirectory()) {
VirtualFile parent = virtualFile.getParent();
if (parent != null) {
virtualFile = parent;
}
}
final Task task = StudyUtils.getTask(project, virtualFile);
return task instanceof TaskWithSubtasks ? (TaskWithSubtasks)task : null;
}
示例5: update
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
StudyUtils.updateAction(e);
final Project project = e.getProject();
if (project != null) {
Course course = StudyTaskManager.getInstance(project).getCourse();
Presentation presentation = e.getPresentation();
if (course != null && !EduNames.STUDY.equals(course.getCourseMode())) {
presentation.setEnabled(false);
presentation.setVisible(true);
return;
}
StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
StudyState studyState = new StudyState(studyEditor);
if (!studyState.isValid()) {
presentation.setEnabledAndVisible(false);
return;
}
TaskFile taskFile = studyState.getTaskFile();
if (taskFile.getActivePlaceholders().isEmpty()) {
presentation.setEnabledAndVisible(false);
}
}
}
示例6: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void actionPerformed(final AnActionEvent event) {
final Project project = event.getProject();
if (project == null) {
return;
}
final ListPopupImpl popup = (ListPopupImpl) JBPopupFactory.getInstance()
.createActionGroupPopup(TITLE, new PopupGroup(), event.getDataContext(),
JBPopupFactory.ActionSelectionAid.NUMBERING, true, event.getPlace());
JBPopupHelper.disableSpeedSearch(popup);
JBPopupHelper.registerShiftActions(popup, TITLE, SHIFT_TITLE);
JBPopupHelper.registerCtrlActions(popup, TITLE, CTRL_TITLE);
popup.setAdText(AD_TEXT);
popup.showCenteredInCurrentWindow(project);
}
示例7: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent actionEvent) {
final CommitMessageI commitPanel = getCommitPanel(actionEvent);
if (commitPanel == null)
return;
PanelDialog dialog = new PanelDialog(actionEvent.getProject());
dialog.show();
if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
commitPanel.setCommitMessage(dialog.getCommitMessage(actionEvent.getProject()));
}
}
示例8: updateAction
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
public static void updateAction(@NotNull final AnActionEvent e) {
final Presentation presentation = e.getPresentation();
presentation.setEnabled(false);
final Project project = e.getProject();
if (project != null) {
final StudyEditor studyEditor = getSelectedStudyEditor(project);
if (studyEditor != null) {
presentation.setEnabledAndVisible(true);
}
}
}
示例9: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
if (anActionEvent.getProject() != null) {
CptUtil.getTemplateFile("kotlin").ifPresent(file -> {
CptUtil.openFileInEditor(anActionEvent.getProject(), file);
});
}
}
示例10: setSelected
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void setSelected(AnActionEvent e, boolean state) {
Project project = e.getProject();
if (project == null) {
return;
}
StudyToolWindow window = StudyUtils.getStudyToolWindow(project);
if (window == null) {
return;
}
Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
if (editor == null) {
return;
}
VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(editor.getDocument());
if (virtualFile == null) {
StudyTaskManager.getInstance(project).setTurnEditingMode(true);
return;
}
Task task = StudyUtils.getTaskForFile(project, virtualFile);
if (task == null) {
StudyTaskManager.getInstance(project).setTurnEditingMode(true);
return;
}
if (!state) {
window.leaveEditingMode(project);
return;
}
window.enterEditingMode(project);
}
示例11: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void actionPerformed(@NotNull final AnActionEvent anActionEvent) {
Project project = anActionEvent.getProject();
VirtualFile virtualFile = project.getBaseDir();
String sourcesProp = Utils.getPropertyValue(PROPERTY_SOURCES, true);
List<String> sourcesList = Utils.getSourcesList(sourcesProp);
Crowdin crowdin = new Crowdin();
for (String src : sourcesList) {
VirtualFile source = Utils.getSourceFile(virtualFile, src);
String branch = Utils.getCurrentBranch(project);
crowdin.uploadFile(source, branch);
}
}
示例12: update
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
Project project = e.getProject();
Presentation presentation = e.getPresentation();
if (project == null || !CCUtils.isCourseCreator(project)) {
presentation.setEnabledAndVisible(false);
return;
}
final VirtualFile[] virtualFiles = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(e.getDataContext());
if (virtualFiles == null || virtualFiles.length == 0) {
presentation.setEnabledAndVisible(false);
}
}
示例13: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return;
}
TaskWithSubtasks task = getTask(e);
if (task != null) {
CCSubtaskEditorNotificationProvider.createPopup(task, project).showCenteredInCurrentWindow(project);
}
}
示例14: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
Project project = anActionEvent.getProject();
if (project != null) {
try {
initFiles(project);
} catch (IOException e) {
e.printStackTrace();
}
if (TextUtils.isEmpty(apkPath)) {
chooseAndSaveApkFile(project);
}
packageName = PropertiesManager.getData(project, PropertyKeys.PACKAGE_NAME);
if (TextUtils.isEmpty(packageName)) {
setPackageName(project);
}
isInnerClassEnabled = PropertiesManager.getData(project, PropertyKeys.IS_INNER_CLASS_ENABLE, Strings.TRUE);
if (!TextUtils.isEmpty(apkPath) && !TextUtils.isEmpty(packageName)) {
Task task = generateDependencyInjectionGraph(project);
task.queue();
}
}
}
示例15: update
import com.intellij.openapi.actionSystem.AnActionEvent; //導入方法依賴的package包/類
@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
Project project = e.getProject();
presentation.setEnabledAndVisible(project != null && CCUtils.isCourseCreator(project));
}