本文整理汇总了Java中com.intellij.openapi.ui.Messages.showMessageDialog方法的典型用法代码示例。如果您正苦于以下问题:Java Messages.showMessageDialog方法的具体用法?Java Messages.showMessageDialog怎么用?Java Messages.showMessageDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.Messages
的用法示例。
在下文中一共展示了Messages.showMessageDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: 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());
}
示例3: findUsageInFile
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private boolean findUsageInFile(@NotNull FileEditor editor, @NotNull FileSearchScope direction) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (myLastSearchInFileData == null) return false;
PsiElement[] primaryElements = myLastSearchInFileData.getPrimaryElements();
PsiElement[] secondaryElements = myLastSearchInFileData.getSecondaryElements();
if (primaryElements.length == 0) {//all elements have been invalidated
Messages.showMessageDialog(myProject, FindBundle.message("find.searched.elements.have.been.changed.error"),
FindBundle.message("cannot.search.for.usages.title"), Messages.getInformationIcon());
// SCR #10022
//clearFindingNextUsageInFile();
return false;
}
//todo
TextEditor textEditor = (TextEditor)editor;
Document document = textEditor.getEditor().getDocument();
PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
if (psiFile == null) return false;
final FindUsagesHandler handler = getFindUsagesHandler(primaryElements[0], false);
if (handler == null) return false;
findUsagesInEditor(primaryElements, secondaryElements, handler, psiFile, direction, myLastSearchInFileData.myOptions, textEditor);
return true;
}
示例4: doExport
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private void doExport(){
if (TextUtils.isEmpty(textFieldInput.getText())){
textHint.setText("Input file path can not be empty!");
btnChooseInputPath.requestFocus();
return;
}else if (TextUtils.isEmpty(textFieldOutput.getText())){
textHint.setText("Output path can not be empty!");
btnChooseOutputPath.requestFocus();
return;
}
String outputFilePath = textFieldOutput.getText() + "/BT_export_string_xml_" +
System.currentTimeMillis() + ".xlsx";
boolean exportSuccess = BeTranslateUtil.generateExcel(textFieldInput.getText(), outputFilePath);
if (exportSuccess){
Messages.showMessageDialog("Export file '" + outputFilePath + "' success!", "BeTranslate",
Messages.getInformationIcon());
dispose();
}else {
Messages.showMessageDialog("Export file failed!", "BeTranslate", Messages.getWarningIcon());
}
}
示例5: actionPerformed
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
Project project = anActionEvent.getData(PlatformDataKeys.PROJECT);
// PsiFile psiFile = anActionEvent.getData(LangDataKeys.PSI_FILE);
// Editor editor = anActionEvent.getData(PlatformDataKeys.EDITOR);
// Application application = ApplicationManager.getApplication();
// MyApplicationComponent myApplicationComponent = application.getComponent(MyApplicationComponent.class);
MyDialog myDialog = new MyDialog(project);
myDialog.show();
if (myDialog.isOK()) {
Messages.showMessageDialog(project, "生成像素dimen文件成功\nGenerate pixel dimen file success",
PROJECT_NAME, Messages.getInformationIcon());
}
// String txt = Messages.showMultilineInputDialog(project,
// "请按照示例添加所需的分辨率",
// "AutoGeneratePixelDimen",
// "1920 1080\n1280 720", Messages.getQuestionIcon(), null);
}
示例6: showReadOnlyMessage
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
public static void showReadOnlyMessage(JComponent parent, final boolean sharedScheme) {
if (!sharedScheme) {
Messages.showMessageDialog(
parent,
ApplicationBundle.message("error.readonly.scheme.cannot.be.modified"),
ApplicationBundle.message("title.cannot.modify.readonly.scheme"),
Messages.getInformationIcon()
);
}
else {
Messages.showMessageDialog(
parent,
ApplicationBundle.message("error.shared.scheme.cannot.be.modified"),
ApplicationBundle.message("title.cannot.modify.readonly.scheme"),
Messages.getInformationIcon()
);
}
}
示例7: canInspect
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private boolean canInspect(ValueDescriptorImpl descriptor, DebuggerContextImpl context) {
DebuggerSession session = context.getDebuggerSession();
if (session == null || !session.isPaused()) return false;
boolean isField = descriptor instanceof FieldDescriptorImpl;
if(descriptor instanceof WatchItemDescriptor) {
Modifier modifier = ((WatchItemDescriptor)descriptor).getModifier();
if(modifier == null || !modifier.canInspect()) return false;
isField = modifier instanceof Field;
}
if (isField) { // check if possible
if (!context.getDebugProcess().canWatchFieldModification()) {
Messages.showMessageDialog(
context.getProject(),
DebuggerBundle.message("error.modification.watchpoints.not.supported"),
ActionsBundle.actionText(DebuggerActions.INSPECT),
Messages.getInformationIcon()
);
return false;
}
}
return true;
}
示例8: createNewFile
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private static void createNewFile(FileSystemTree fileSystemTree, final FileType fileType, final String initialContent) {
final VirtualFile file = fileSystemTree.getNewFileParent();
if (file == null || !file.isDirectory()) return;
String newFileName;
while (true) {
newFileName = Messages.showInputDialog(UIBundle.message("create.new.file.enter.new.file.name.prompt.text"),
UIBundle.message("new.file.dialog.title"), Messages.getQuestionIcon());
if (newFileName == null) {
return;
}
if ("".equals(newFileName.trim())) {
Messages.showMessageDialog(UIBundle.message("create.new.file.file.name.cannot.be.empty.error.message"),
UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
continue;
}
Exception failReason = ((FileSystemTreeImpl)fileSystemTree).createNewFile(file, newFileName, fileType, initialContent);
if (failReason != null) {
Messages.showMessageDialog(UIBundle.message("create.new.file.could.not.create.file.error.message", newFileName),
UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
continue;
}
return;
}
}
示例9: doDrop
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private void doDrop(TreeNode targetNode, PsiElement[] sourceElements, final boolean externalDrop) {
final PsiElement targetElement = getPsiElement(targetNode);
if (targetElement == null) return;
if (DumbService.isDumb(myProject)) {
Messages.showMessageDialog(myProject, "Move refactoring is not available while indexing is in progress", "Indexing", null);
return;
}
final Module module = getModule(targetNode);
final DataContext dataContext = DataManager.getInstance().getDataContext(myTree);
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
if (!targetElement.isValid()) return;
for (PsiElement sourceElement : sourceElements) {
if (!sourceElement.isValid()) return;
}
getActionHandler().invoke(myProject, sourceElements, new DataContext() {
@Override
@Nullable
public Object getData(@NonNls String dataId) {
if (LangDataKeys.TARGET_MODULE.is(dataId)) {
if (module != null) return module;
}
if (LangDataKeys.TARGET_PSI_ELEMENT.is(dataId)) {
return targetElement;
}
else {
return externalDrop ? null : dataContext.getData(dataId);
}
}
});
}
示例10: getTranslation
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private void getTranslation(String selectedText) throws JSONException {
Messages.showMessageDialog(
new ToTranslate(NetApi.getJson(selectedText)).toString(),
"翻译结果",
Messages.getInformationIcon()
);
}
示例11: actionPerformed
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public void actionPerformed(final ActionEvent event) {
try{
myConfigurable.apply();
}
catch(ConfigurationException e){
Messages.showMessageDialog(myProject, e.getMessage(), ExecutionBundle.message("invalid.data.dialog.title"), Messages.getErrorIcon());
}
}
示例12: showErrorDialog
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private void showErrorDialog(String message) {
String title = CommonBundle.getErrorTitle();
Icon icon = Messages.getErrorIcon();
if (myDialogParent != null) {
Messages.showMessageDialog(myDialogParent, message, title, icon);
}
else {
Messages.showMessageDialog(myProject, message, title, icon);
}
}
示例13: doOKAction
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
protected void doOKAction() {
final String packageName = getPackageName();
final Ref<String> errorStringRef = new Ref<String>();
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
@Override
public void run() {
try {
final PsiDirectory baseDir = myModule == null ? null : PackageUtil.findPossiblePackageDirectoryInModule(myModule, packageName);
myTargetDirectory = myModule == null ? null
: PackageUtil.findOrCreateDirectoryForPackage(myModule, packageName, baseDir, true);
if (myTargetDirectory == null) {
errorStringRef.set("");
return;
}
errorStringRef.set(RefactoringMessageUtil.checkCanCreateClass(myTargetDirectory, getClassName()));
}
catch (IncorrectOperationException e) {
errorStringRef.set(e.getMessage());
}
}
}, GroovyInspectionBundle.message("create.directory.command"), null);
if (errorStringRef.get() != null) {
if (!errorStringRef.get().isEmpty()) {
Messages.showMessageDialog(myProject, errorStringRef.get(), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
}
return;
}
super.doOKAction();
}
示例14: doOKAction
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
protected void doOKAction(){
final String packageName = myTfPackage.getText();
final String className = getClassName();
final String[] errorString = new String[1];
final PsiManager manager = PsiManager.getInstance(myProject);
final PsiNameHelper nameHelper = PsiNameHelper.getInstance(manager.getProject());
if (packageName.length() > 0 && !nameHelper.isQualifiedName(packageName)) {
errorString[0] = RefactoringBundle.message("invalid.target.package.name.specified");
} else if (className != null && className.isEmpty()) {
errorString[0] = RefactoringBundle.message("no.class.name.specified");
} else {
if (!nameHelper.isIdentifier(className)) {
errorString[0] = RefactoringMessageUtil.getIncorrectIdentifierMessage(className);
}
else if (!myDoClone) {
try {
final PackageWrapper targetPackage = new PackageWrapper(manager, packageName);
myDestination = myDestinationCB.selectDirectory(targetPackage, false);
if (myDestination == null) return;
}
catch (IncorrectOperationException e) {
errorString[0] = e.getMessage();
}
}
RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, packageName);
}
if (errorString[0] != null) {
if (errorString[0].length() > 0) {
Messages.showMessageDialog(myProject, errorString[0], RefactoringBundle.message("error.title"), Messages.getErrorIcon());
}
myNameField.requestFocusInWindow();
return;
}
CopyFilesOrDirectoriesDialog.saveOpenInEditorState(myOpenInEditorCb.isSelected());
super.doOKAction();
}
示例15: showCyclicModulesHaveDifferentLanguageLevel
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private void showCyclicModulesHaveDifferentLanguageLevel(Set<Module> modulesInChunk) {
Module firstModule = ContainerUtil.getFirstItem(modulesInChunk);
LOG.assertTrue(firstModule != null);
String moduleNameToSelect = firstModule.getName();
final String moduleNames = getModulesString(modulesInChunk);
Messages.showMessageDialog(myProject, CompilerBundle.message("error.chunk.modules.must.have.same.language.level", moduleNames),
CommonBundle.getErrorTitle(), Messages.getErrorIcon());
showConfigurationDialog(moduleNameToSelect, null);
}