本文整理汇总了Java中com.intellij.openapi.ui.MessageType类的典型用法代码示例。如果您正苦于以下问题:Java MessageType类的具体用法?Java MessageType怎么用?Java MessageType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageType类属于com.intellij.openapi.ui包,在下文中一共展示了MessageType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOK
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
private void onOK() {
this.setAlwaysOnTop(false);
String jsonSTR = editTP.getText().trim();
if (TextUtils.isEmpty(jsonSTR)) {
return;
}
String generateClassName = generateClassTF.getText().replaceAll(" ", "").replaceAll(".java$", "");
if (TextUtils.isEmpty(generateClassName) || generateClassName.endsWith(".")) {
Toast.make(project, generateClassP, MessageType.ERROR, "the path is not allowed");
return;
}
PsiClass generateClass = null;
if (!currentClass.equals(generateClassName)) {
generateClass = PsiClassUtil.exist(file, generateClassTF.getText());
} else {
generateClass = cls;
}
new ConvertBridge(this, jsonSTR, file, project, generateClass,
cls, generateClassName).run();
}
示例2: showError
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
@Override
public void showError(ConvertBridge.Error err) {
switch (err) {
case DATA_ERROR:
errorLB.setText("data err !!");
if (Config.getInstant().isToastError()) {
Toast.make(project, errorLB, MessageType.ERROR, "click to see details");
}
break;
case PARSE_ERROR:
errorLB.setText("parse err !!");
if (Config.getInstant().isToastError()) {
Toast.make(project, errorLB, MessageType.ERROR, "click to see details");
}
break;
case PATH_ERROR:
Toast.make(project, generateClassP, MessageType.ERROR, "the path is not allowed");
break;
}
}
示例3: execute
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
public void execute(ClassEntity targetClass) {
this.targetClass = targetClass;
ProgressManager.getInstance().run(new Task.Backgroundable(project, "GsonFormat") {
@Override
public void run(@NotNull ProgressIndicator progressIndicator) {
progressIndicator.setIndeterminate(true);
long currentTimeMillis = System.currentTimeMillis();
execute();
progressIndicator.setIndeterminate(false);
progressIndicator.setFraction(1.0);
StringBuffer sb = new StringBuffer();
sb.append("GsonFormat [" + (System.currentTimeMillis() - currentTimeMillis) + " ms]\n");
// sb.append("generate class : ( "+generateClassList.size()+" )\n");
// for (String item: generateClassList) {
// sb.append(" at "+item+"\n");
// }
// sb.append(" \n");
// NotificationCenter.info(sb.toString());
Toast.make(project, MessageType.INFO, sb.toString());
}
});
}
示例4: actionPerformed
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent event) {
// TODO: insert action logic here
Project project = event.getData(PlatformDataKeys.PROJECT);
Object nav = event.getData(CommonDataKeys.NAVIGATABLE);
String path;
try {
if (nav instanceof PsiDirectory) {
PsiDirectory directory = (PsiDirectory) nav;
path = directory.getVirtualFile().getPath();
} else {
PsiFile file = (PsiFile) nav;
path = file.getVirtualFile().getPath();
}
Toast.make(project, MessageType.INFO, "Open: " + path);
Runtime.getRuntime().exec("cmd /c start " + path);
} catch (Exception e) {
e.printStackTrace();
if (nav instanceof PsiClass) {
Toast.make(project, MessageType.ERROR, "Could not open the java file, double-click to open.");
return;
}
Toast.make(project, MessageType.ERROR, e.getMessage());
}
}
示例5: notifyByBallon
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
@Override
public void notifyByBallon(String message, MessageType type)
{
ToolWindowManager toolWindowMgr = ToolWindowManager.getInstance(project);
toolWindowMgr.notifyByBalloon(TOOL_WINDOW_ID, type, message);
if (MessageType.ERROR.equals(type))
{
LOG.error(message);
}
else if (MessageType.WARNING.equals(type))
{
LOG.warn(message);
}
else if (MessageType.INFO.equals(type))
{
LOG.info(message);
}
}
示例6: handleBadRequest
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
private void handleBadRequest(final HybrisHttpResult httpResult, final Project project) {
if (httpResult.getStatusCode() != SC_OK) {
final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
if (httpResult.getStatusCode() == SC_NOT_FOUND || httpResult.getStatusCode() == SC_MOVED_TEMPORARILY) {
JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(
"Hybris Host URL '" + httpResult.getErrorMessage() + "' was incorrect. Please, check your settings.",
MessageType.ERROR,
null
).setFadeoutTime(FADEOUT_TIME)
.createBalloon().show(
RelativePoint.getCenterOf(statusBar.getComponent()),
Balloon.Position.atRight
);
}
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:18,代码来源:ExecuteHybrisConsole.java
示例7: onSuccess
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
@Override
public void onSuccess() {
String message = myResult.getMessage();
StudyStatus status = myResult.getStatus();
myTask.setStatus(status);
switch (status) {
case Failed:
myChecker.onTaskFailed(message);
break;
case Solved:
myChecker.onTaskSolved(message);
break;
default:
StudyCheckUtils.showTestResultPopUp(message, MessageType.WARNING.getPopupBackground(), myProject);
}
ApplicationManager.getApplication().invokeLater(() -> {
StudyUtils.updateToolWindows(myProject);
ProjectView.getInstance(myProject).refresh();
for (StudyCheckListener listener : StudyCheckListener.EP_NAME.getExtensions()) {
listener.afterCheck(myProject, myTask);
}
});
myChecker.clearState();
myCheckInProgress.set(false);
}
示例8: onTaskSolved
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
@Override
public void onTaskSolved(@NotNull String message) {
boolean hasMoreSubtasks = myTask.activeSubtaskNotLast();
final int activeSubtaskIndex = myTask.getActiveSubtaskIndex();
int visibleSubtaskIndex = activeSubtaskIndex + 1;
ApplicationManager.getApplication().invokeLater(() -> {
int subtaskSize = myTask.getLastSubtaskIndex() + 1;
String resultMessage = !hasMoreSubtasks ? message : "Subtask " + visibleSubtaskIndex + "/" + subtaskSize + " solved";
StudyCheckUtils.showTestResultPopUp(resultMessage, MessageType.INFO.getPopupBackground(), myProject);
if (hasMoreSubtasks) {
int nextSubtaskIndex = activeSubtaskIndex + 1;
StudySubtaskUtils.switchStep(myProject, myTask, nextSubtaskIndex);
rememberAnswers(nextSubtaskIndex, myTask);
}
});
}
示例9: generateProject
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
@Override
public void generateProject(@NotNull Project project, @NotNull VirtualFile baseDir, @NotNull GravProjectSettings settings, @NotNull Module module) {
StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(new File(settings.gravInstallationPath));
if (vf == null || !GravSdkType.isValidGravSDK(vf)) {
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder("Project couldn't be created because Grav Installation isn't valid", MessageType.ERROR, null)
.setFadeoutTime(3500)
.createBalloon()
.show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above);
} else {
storage.setDefaultGravDownloadPath(settings.gravInstallationPath);
PropertiesComponent.getInstance().setValue(LAST_USED_GRAV_HOME, new File(settings.gravInstallationPath).getAbsolutePath());
GravProjectGeneratorUtil projectGenerator = new GravProjectGeneratorUtil();
projectGenerator.generateProject(project, baseDir, settings, module);
try {
List<String> includePath = new ArrayList<>();
includePath.add(baseDir.getPath());
PhpIncludePathManager.getInstance(project).setIncludePath(includePath);
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例10: moduleCreated
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
@Override
public void moduleCreated(@NotNull Module module) {
StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
String msg = String.format("Please wait while module for project %s is created", project.getName());
settings = GravProjectSettings.getInstance(project);
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder(msg, MessageType.WARNING, null)
.setFadeoutTime(4000)
.createBalloon()
.show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above);
VirtualFile[] roots1 = ModuleRootManager.getInstance(module).getContentRoots();
if (roots1.length != 0) {
final VirtualFile src = roots1[0];
settings.withSrcDirectory = withSrcDirectory;
settings.gravInstallationPath = getGravInstallPath().getPath();
// settings.withSrcDirectory =
GravProjectGeneratorUtil generatorUtil = new GravProjectGeneratorUtil();
generatorUtil.generateProject(project, src, settings, module);
}
}
示例11: fileCreated
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
@Override
public void fileCreated(@NotNull VirtualFileEvent event) {
//process only for files inside the language directory
if (event.getFile().getParent().isDirectory() && event.getFile().getParent().getNameWithoutExtension().compareTo("languages") == 0) {
if (GravYamlFiles.getLanguageFileType(event.getFile()) == GravYamlFiles.LangFileEditorType.LANGUAGE_FOLDER) {
boolean present = false;
for (VirtualFile each : getFileMap().values()) {
if (each.getName().compareTo(event.getFile().getName()) == 0) {
present = true;
break;
}
}
if (!present) {
getFileMap().put(event.getFile().getNameWithoutExtension(), event.getFile());
model.addLanguage(event.getFile().getNameWithoutExtension());
editor.initTabs();
}
} else {
NotificationHelper.showBaloon("Not a valid language resource name", MessageType.WARNING, project);
}
}
}
示例12: actionPerformed
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
dialog.show();
int exitCode = dialog.getExitCode();
if (exitCode != CANCEL_EXIT_CODE) {
String key = dialog.getKeyText();
String value = dialog.getValueText();
currentLang = dialog.getSelectedLangauge();
if (currentLang != null && !currentLang.isEmpty()) {
Editor ieditor = editorMap.get(currentLang);
Document document = ieditor.getDocument();
WriteCommandAction.runWriteCommandAction(fileEditor.getProject(), () -> updateDocumentHook(document, ieditor.getProject(), currentLang, key, value, model));
} else {
NotificationHelper.showBaloon("No language file available", MessageType.WARNING, fileEditor.getProject());
}
}
}
示例13: showMessage
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
private static void showMessage(final Project project, final MessageType messageType, final String format, final Object[] args) {
StatusBar statusBar = windowManager.getStatusBar(project);
if(statusBar == null || statusBar.getComponent() == null){
return;
}
String message = String.format(format, args);
jbPopupFactory.createHtmlTextBalloonBuilder(message, messageType, null)
.setFadeoutTime(7500)
.createBalloon()
.show(RelativePoint.getNorthEastOf(statusBar.getComponent()), Balloon.Position.atRight);
if(messageType == MessageType.INFO){
log.info(message);
}
else if(messageType == MessageType.WARNING) {
log.warn(message);
}
else{
log.debug(message);
}
}
示例14: displayUploadResultBalloonMessage
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
private void displayUploadResultBalloonMessage(String fileName, Boolean isSuccess) {
String message = fileName + " Uploaded Successfully";
MessageType messageType = MessageType.INFO;
if (!isSuccess) {
message = fileName + " Failed to Upload";
messageType = MessageType.ERROR;
}
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder("<h3>" + message + "</h3>", messageType, null)
.setFadeoutTime(3000)
.createBalloon()
.show(RelativePoint.getNorthEastOf(WindowManager.getInstance().getIdeFrame(project).getComponent()),
Balloon.Position.above);
}
示例15: updateStep
import com.intellij.openapi.ui.MessageType; //导入依赖的package包/类
private void updateStep(@NotNull ValidationStatus result) {
myResult = result;
String message = "";
Icon icon = null;
if (!myIsFirstUIUpdate && (result.getMessageType() != MessageType.INFO)) {
message = getValidationMessage(result);
icon = result.getMessageType().getDefaultIcon();
}
myIsFirstUIUpdate = false;
myValidationStatus.setText(message);
myValidationStatus.setIcon(icon);
myRemoveOriginalFileCheckBox.setVisible(result == ValidationStatus.IN_MODULE);
myReplaceFileDependencyWithCheckBox.setVisible(result == ValidationStatus.IN_MODULE);
fireStateChanged();
}