本文整理匯總了Java中com.intellij.openapi.ui.Messages類的典型用法代碼示例。如果您正苦於以下問題:Java Messages類的具體用法?Java Messages怎麽用?Java Messages使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Messages類屬於com.intellij.openapi.ui包,在下文中一共展示了Messages類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
import com.intellij.openapi.ui.Messages; //導入依賴的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: unpackCourseArchive
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
private static void unpackCourseArchive(final Project project) {
FileChooserDescriptor descriptor =
new FileChooserDescriptor(true, true, true, true, true, false);
final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, null);
if (virtualFile == null) {
return;
}
final String basePath = project.getBasePath();
if (basePath == null) return;
Course course = StudyProjectGenerator.getCourse(virtualFile.getPath());
if (course == null) {
Messages.showErrorDialog("This course is incompatible with current version", "Failed to Unpack Course");
return;
}
generateFromStudentCourse(project, course);
}
示例3: TemplateEditPane
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
public TemplateEditPane(CodeMakerSettings settings, String template,
CodeMakerConfiguration parentPane) {
CodeTemplate codeTemplate = settings.getCodeTemplate(template);
if (codeTemplate == null) {
codeTemplate = CodeTemplate.EMPTY_TEMPLATE;
}
templateNameText.setText(codeTemplate.getName());
classNumberText.setText(String.valueOf(codeTemplate.getClassNumber()));
classNameText.setText(codeTemplate.getClassNameVm());
addVmEditor(codeTemplate.getCodeTemplate());
deleteTemplateButton.addActionListener(e -> {
int result = Messages.showYesNoDialog("刪除模板?", "刪除", null);
if (result == Messages.OK) {
settings.removeCodeTemplate(template);
parentPane.refresh(settings);
}
});
}
示例4: send
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
public static void send()
{
SourcetrailOptions options = SourcetrailOptions.getInstance();
try
{
String text = "ping>>" + ApplicationNamesInfo.getInstance().getFullProductName() + "<EOM>";
Socket socket = new Socket(options.getIp(), options.getSourcetrailPort());
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
writer.write(text);
writer.flush();
socket.close();
}
catch(Exception e)
{
String errorMsg =
"No connection to a Sourcetrail instance\n\n Make sure Sourcetrail is running and the right address is used("
+ options.getIp() + ":" + options.getSourcetrailPort() + ")";
Messages.showMessageDialog(errorMsg, "SourcetrailPluginError", Messages.getErrorIcon());
e.printStackTrace();
}
}
示例5: actionPerformed
import com.intellij.openapi.ui.Messages; //導入依賴的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);
}
示例6: actionPerformed
import com.intellij.openapi.ui.Messages; //導入依賴的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());
}
示例7: actionPerformed
import com.intellij.openapi.ui.Messages; //導入依賴的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();
}
}
示例8: shouldContinue
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
@Override
public boolean shouldContinue(final List<File> t) {
if (!t.isEmpty()) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
Messages.showErrorDialog(
HybrisI18NBundleUtils.message("hybris.project.import.scan.failed", t),
HybrisI18NBundleUtils.message("hybris.project.error")
);
}
});
}
return false;
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:18,代碼來源:DirectoriesScannerErrorsProcessor.java
示例9: actionPerformed
import com.intellij.openapi.ui.Messages; //導入依賴的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: generateProject
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir) {
final Course course = getCourse(project);
if (course == null) {
LOG.warn("Course is null");
Messages.showWarningDialog("Some problems occurred while creating the course", "Error in Course Creation");
return;
}
else if (course.isAdaptive() && !StudyUtils.isCourseValid(course)) {
Messages.showWarningDialog("There is no recommended tasks for this adaptive course", "Error in Course Creation");
return;
}
StudyTaskManager.getInstance(project).setCourse(course);
ApplicationManager.getApplication().runWriteAction(() -> {
StudyGenerator.createCourse(course, baseDir);
StudyUtils.registerStudyToolWindow(course, project);
StudyUtils.openFirstTask(course, project);
EduUsagesCollector.projectTypeCreated(course.isAdaptive() ? EduNames.ADAPTIVE : EduNames.STUDY);
});
}
示例11: actionPerformed
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
final Project project = e.getData(CommonDataKeys.PROJECT);
if (view == null || project == null) {
return;
}
final String courseId = Messages.showInputDialog("Please, enter course id", "Get Course From Stepik", null);
if (StringUtil.isNotEmpty(courseId)) {
ProgressManager.getInstance().run(new Task.Modal(project, "Creating Course", true) {
@Override
public void run(@NotNull final ProgressIndicator indicator) {
createCourse(project, courseId);
}
});
}
}
示例12: packCourse
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
private static void packCourse(@NotNull final VirtualFile baseDir, String locationDir, String zipName, boolean showMessage) {
try {
final File zipFile = new File(locationDir, zipName + ".zip");
ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile)));
VirtualFile[] courseFiles = baseDir.getChildren();
for (VirtualFile file : courseFiles) {
ZipUtil.addFileOrDirRecursively(zos, null, new File(file.getPath()), file.getName(), null, null);
}
zos.close();
if (showMessage) {
ApplicationManager.getApplication().invokeLater(
() -> Messages.showInfoMessage("Course archive was saved to " + zipFile.getPath(),
"Course Archive Was Created Successfully"));
}
}
catch (IOException e1) {
LOG.error(e1);
}
}
示例13: generateJson
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
private static void generateJson(VirtualFile parentDir, Course course) {
final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().
registerTypeAdapter(Task.class, new StudySerializationUtils.Json.TaskAdapter()).create();
final String json = gson.toJson(course);
final File courseJson = new File(parentDir.getPath(), EduNames.COURSE_META_FILE);
OutputStreamWriter outputStreamWriter = null;
try {
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(courseJson), "UTF-8");
outputStreamWriter.write(json);
}
catch (Exception e) {
Messages.showErrorDialog(e.getMessage(), "Failed to Generate Json");
LOG.info(e);
}
finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
}
catch (IOException e1) {
//close silently
}
}
}
示例14: doSearch
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
private void doSearch(String keyword, AnActionEvent actionEvent) {
getRepositories(keyword)
.thenAcceptAsync(mavenSearchResponse -> {
SwingUtilities.invokeLater(() -> {
if (!mavenSearchResponse.getBody().getNumFound().equals("0")) {
SelectFromListDialog dialog = initSelectFromListDialog(actionEvent.getProject(), Strings.TITLE_SELECT_REPOSITORY, ArrayHelper.docListToStringArray(mavenSearchResponse.getBody().getDocList()), toStringAspect);
boolean isOk = dialog.showAndGet();
if (isOk) {
gradleManager.addDependency(String.valueOf(dialog.getSelection()[0]), actionEvent);
}
} else if (mavenSearchResponse.getSpellcheck().getSuggestion().size() > 0) {
Messages.showInfoMessage(Strings.MESSAGE_SUGGESTIONS + String.join(",", ArrayHelper.objectListToStringArray(mavenSearchResponse.getSpellcheck().getSuggestion())), Strings.TITLE_NOT_FOUND);
} else {
Messages.showInfoMessage("", Strings.TITLE_NOT_FOUND);
}
});
}
).exceptionally(throwable -> {
SwingUtilities.invokeLater(() -> {
Messages.showInfoMessage(throwable.getMessage(), Strings.ERROR_TITLE_MAVEN_SEARCH);
});
return null;
});
}
示例15: createDirectory
import com.intellij.openapi.ui.Messages; //導入依賴的package包/類
public static PsiDirectory createDirectory(Project project, String title, String description) {
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.setTitle(title);
descriptor.setShowFileSystemRoots(false);
descriptor.setDescription(description);
descriptor.setHideIgnored(true);
descriptor.setRoots(project.getBaseDir());
descriptor.setForcedToUseIdeaFileChooser(true);
VirtualFile file = FileChooser.chooseFile(descriptor, project, project.getBaseDir());
if(Objects.isNull(file)){
Messages.showInfoMessage("Cancel " + title, "Error");
return null;
}
PsiDirectory psiDirectory = PsiDirectoryFactory.getInstance(project).createDirectory(file);
if(PsiDirectoryFactory.getInstance(project).isPackage(psiDirectory)){
return psiDirectory;
}else {
Messages.showInfoMessage("請選擇正確的 package 路徑。", "Error");
return createDirectory(project, title, description);
}
}