當前位置: 首頁>>代碼示例>>Java>>正文


Java AnActionEvent.getProject方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:kaygisiz,項目名稱:Dependency-Injection-Graph,代碼行數:19,代碼來源:SetPackageFilter.java

示例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);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:25,代碼來源:StudyRefreshAnswerPlaceholder.java

示例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);
}
 
開發者ID:y1xian,項目名稱:KotlinMvp,代碼行數:17,代碼來源:AndroidMvpAction.java

示例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;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:19,代碼來源:CCSwitchSubtask.java

示例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);
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:26,代碼來源:StudyFillPlaceholdersAction.java

示例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);
}
 
開發者ID:FWDekker,項目名稱:intellij-randomness,代碼行數:18,代碼來源:PopupAction.java

示例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()));
    }

}
 
開發者ID:JanGatting,項目名稱:GitCommitMessage,代碼行數:15,代碼來源:OpenPanelAction.java

示例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);
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:12,代碼來源:StudyUtils.java

示例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);
		});
	}
}
 
開發者ID:xylo,項目名稱:intellij-postfix-templates,代碼行數:9,代碼來源:OpenKotlinTemplatesAction.java

示例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);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:32,代碼來源:CCEditTaskTextAction.java

示例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);
    }
}
 
開發者ID:crowdin,項目名稱:android-studio-plugin,代碼行數:14,代碼來源:UploadAction.java

示例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);
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:14,代碼來源:CCTaskFileActionBase.java

示例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);
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:12,代碼來源:CCSwitchSubtask.java

示例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();
        }
    }
}
 
開發者ID:kaygisiz,項目名稱:Dependency-Injection-Graph,代碼行數:31,代碼來源:GenerateDependencyInjectionGraph.java

示例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));
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:7,代碼來源:CCCreateCourseArchive.java


注:本文中的com.intellij.openapi.actionSystem.AnActionEvent.getProject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。