本文整理匯總了Java中com.intellij.openapi.actionSystem.AnActionEvent類的典型用法代碼示例。如果您正苦於以下問題:Java AnActionEvent類的具體用法?Java AnActionEvent怎麽用?Java AnActionEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AnActionEvent類屬於com.intellij.openapi.actionSystem包,在下文中一共展示了AnActionEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
Project project = anActionEvent.getProject();
VirtualFile virtualFile = project.getBaseDir();
VirtualFile source = Utils.getSourceFile(virtualFile, null);
Crowdin crowdin = new Crowdin();
String branch = Utils.getCurrentBranch(project);
crowdin.exportTranslations(branch);
File downloadTranslations = crowdin.downloadTranslations(source, branch);
Utils.extractTranslations(downloadTranslations);
if (downloadTranslations.delete()) {
System.out.println("all.zip was deleted");
} else {
System.out.println("all.zip wasn't deleted");
}
}
示例2: 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);
}
示例3: getTranslation
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
private void getTranslation(AnActionEvent event) {
Editor mEditor = event.getData(PlatformDataKeys.EDITOR);
Project project = event.getData(PlatformDataKeys.PROJECT);
String basePath = project.getBasePath();
if (null == mEditor) {
return;
}
SelectionModel model = mEditor.getSelectionModel();
String selectedText = model.getSelectedText();
if (TextUtils.isEmpty(selectedText)) {
selectedText = getCurrentWords(mEditor);
if (TextUtils.isEmpty(selectedText)) {
return;
}
}
String queryText = strip(addBlanks(selectedText));
new Thread(new RequestRunnable(mEditor, queryText,basePath)).start();
}
示例4: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return;
}
final AnswerPlaceholder answerPlaceholder = getAnswerPlaceholder(e);
if (answerPlaceholder == null) {
return;
}
StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
if (studyEditor != null) {
StudySubtaskUtils.refreshPlaceholder(studyEditor.getEditor(), answerPlaceholder);
final StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
answerPlaceholder.reset();
taskManager.setStatus(answerPlaceholder, StudyStatus.Unchecked);
}
}
示例5: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
EduCoursesPanel panel = new EduCoursesPanel();
DialogBuilder dialogBuilder = new DialogBuilder().title("Select Course").centerPanel(panel);
dialogBuilder.addOkAction().setText("Join");
panel.addCourseValidationListener(new EduCoursesPanel.CourseValidationListener() {
@Override
public void validationStatusChanged(boolean canStartCourse) {
dialogBuilder.setOkActionEnabled(canStartCourse);
}
});
dialogBuilder.setOkOperation(() -> {
dialogBuilder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE);
Course course = panel.getSelectedCourse();
String location = panel.getLocationString();
EduCreateNewProjectDialog.createProject(EduPluginConfigurator.INSTANCE.forLanguage(course.getLanguageById()).getEduCourseProjectGenerator(), course, location);
});
dialogBuilder.show();
}
示例6: setSelected
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void setSelected(AnActionEvent e, boolean state) {
JGivenSettings.getInstance().setJGivenFilteringEnabled(state);
if (e.getProject() == null) {
return;
}
Set<Usage> scenarioStateUsages = usageView.getUsages().stream()
.filter(u -> u instanceof ReadWriteAccessUsageInfo2UsageAdapter &&
scenarioStateAnnotationProvider.isJGivenScenarioState(((ReadWriteAccessUsageInfo2UsageAdapter) u).getElement()))
.collect(Collectors.toSet());
if (state) {
excludedUsages.stream()
.filter(u -> !scenarioStateUsages.contains(u))
.forEach(usageView::appendUsage);
} else {
excludedUsages = usageView.getUsages().stream()
.filter(scenarioStateUsages::contains)
.collect(Collectors.toSet());
excludedUsages.forEach(usageView::removeUsage);
}
e.getProject().getMessageBus().syncPublisher(UsageFilteringRuleProvider.RULES_CHANGED).run();
}
示例7: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的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 );
}
}
}
}
示例8: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
RefmtManager refmt = RefmtManager.getInstance();
if (refmt != null) {
PsiFile file = e.getData(PSI_FILE);
Project project = e.getProject();
if (project != null && file != null && (file instanceof OclFile || file instanceof RmlFile)) {
String format = file instanceof OclFile ? "ml" : "re";
Document document = PsiDocumentManager.getInstance(project).getDocument(file);
if (document != null) {
//WriteCommandAction.writeCommandAction(project).run(() -> refmt.refmt(project, format, document));
WriteCommandAction.runWriteCommandAction(project, () -> refmt.refmt(project, format, document)); // idea#143
}
}
}
}
示例9: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
final Project project = getEventProject(anActionEvent);
if (project == null) {
return;
}
removeOldProjectData(project);
try {
collectStatistics();
final AddModuleWizard wizard = getWizard(project);
final ProjectBuilder projectBuilder = wizard.getProjectBuilder();
if (projectBuilder instanceof AbstractHybrisProjectImportBuilder) {
((AbstractHybrisProjectImportBuilder) projectBuilder).setRefresh(true);
}
projectBuilder.commit(project, null, ModulesProvider.EMPTY_MODULES_PROVIDER);
} catch (ConfigurationException e) {
Messages.showErrorDialog(
anActionEvent.getProject(),
e.getMessage(),
HybrisI18NBundleUtils.message("hybris.project.import.error.unable.to.proceed")
);
}
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:27,代碼來源:ProjectRefreshAction.java
示例10: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void actionPerformed(@NotNull AnActionEvent event) {
final Project project = getEventProject(event);
if (project == null) {
this.setStatus(event, false);
return;
}
PsiDirectory bundleDirContext = ExtensionUtility.getExtensionDirectory(event);
if (bundleDirContext == null) {
return;
}
String className = Messages.showInputDialog(project, "New class name:", "New File", TYPO3CMSIcons.TYPO3_ICON);
if (StringUtils.isBlank(className)) {
return;
}
if (!PhpNameUtil.isValidClassName(className)) {
JOptionPane.showMessageDialog(null, "Invalid class name");
return;
}
write(project, bundleDirContext, className);
}
示例11: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
public void actionPerformed(AnActionEvent e) {
this.project = e.getData(CommonDataKeys.PROJECT);
String description = this.showInputDialog(SlackChannel.getIdDescription(), null);
if (!isValidField(description)) {
errorMessage();
return;
}
String token = this.showInputDialog(SlackChannel.getTokenDescription(), null);
if (!isValidField(token)) {
errorMessage();
return;
}
String channel = this.showInputDialog(SlackChannel.getChanneNameDescription(), "");
SlackStorage.getInstance().registerChannel(new SlackChannel(token, description, channel));
Messages.showMessageDialog(this.project, "Settings Saved.", "Information", Messages.getInformationIcon());
}
示例12: update
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
Project project = e.getProject();
if (project == null) {
presentation.setEnabledAndVisible(false);
return;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null || !course.isAdaptive()) {
presentation.setEnabledAndVisible(false);
return;
}
presentation.setEnabledAndVisible(true);
}
示例13: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void actionPerformed(final AnActionEvent e) {
final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
if (editor != null) {
final SelectionModel selectionModel = editor.getSelectionModel();
final ImportImpexHttpClient client = new ImportImpexHttpClient();
final String selectedText = selectionModel.getSelectedText();
if (StringUtils.isNotEmpty(selectedText)) {
final HybrisHttpResult hybrisHttpResult = client.importImpex(selectedText);
ExecuteHybrisConsole.getInstance().show(hybrisHttpResult, e.getProject());
}
}
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:15,代碼來源:ImportImpexAction.java
示例14: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
cacheFile = new File(Constant.CACHE_PATH);
if (!cacheFile.exists()) {
cacheFile.mkdirs();
}
long size = FileUtils.sizeOfDirectory(cacheFile);
DialogBuilder builder = new DialogBuilder();
builder.setTitle(Constant.TITLE);
builder.resizable(false);
builder.setCenterPanel(new JLabel(String.format("Currently occupy storage %.2fM, "
+ "Clean Cache immediately?", size/1024.0/1024.0),
Messages.getInformationIcon(), SwingConstants.CENTER));
builder.addOkAction().setText("Clean Now");
builder.addCancelAction().setText("Cancel");
builder.setButtonsAlignment(SwingConstants.RIGHT);
if (builder.show() == 0) {
clean();
}
}
示例15: actionPerformed
import com.intellij.openapi.actionSystem.AnActionEvent; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
AbstractNewProjectDialog dialog = new AbstractNewProjectDialog() {
@Override
protected DefaultActionGroup createRootStep() {
return new PyCCCreateCourseProjectStep();
}
};
dialog.show();
}