From ff4d0b8dbb2db192ffd3a5febb8c06cdd86d1d7c Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 20 Mar 2013 21:42:37 +0100 Subject: [PATCH] IDEA-99207 (try to show GUI error notifications if started not from console) --- bin/scripts/unix/idea.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/bin/scripts/unix/idea.sh b/bin/scripts/unix/idea.sh index 25606d590da7..1de77a1cd97b 100755 --- a/bin/scripts/unix/idea.sh +++ b/bin/scripts/unix/idea.sh @@ -5,6 +5,24 @@ # --------------------------------------------------------------------- # +message() +{ + TITLE="Cannot start @@product_full@@" + if [ -t 1 ]; then + echo "ERROR: $TITLE\n$1" + elif [ -n `which zenity` ]; then + zenity --error --title="$TITLE" --text="$1" + elif [ -n `which kdialog` ]; then + kdialog --error --title "$TITLE" "$1" + elif [ -n `which xmessage` ]; then + xmessage -center "ERROR: $TITLE: $1" + elif [ -n `which notify-send` ]; then + notify-send "ERROR: $TITLE: $1" + else + echo "ERROR: $TITLE\n$1" + fi +} + UNAME=`which uname` GREP=`which egrep` GREP_OPTIONS="" @@ -16,7 +34,7 @@ CAT=`which cat` TR=`which tr` if [ -z "$UNAME" -o -z "$GREP" -o -z "$CUT" -o -z "$MKTEMP" -o -z "$RM" -o -z "$CAT" -o -z "$TR" ]; then - echo "ERROR: required tools are missing - check beginning of \"$0\" file for details." + message "Required tools are missing - check beginning of \"$0\" file for details." exit 1 fi @@ -68,11 +86,7 @@ else fi if [ -z "$JDK" ]; then - echo "ERROR: cannot start @@product_full@@." - echo "No JDK found. Please validate either @@product_uc@@_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation." - echo - echo "Press Enter to continue." - read IGNORE + message "No JDK found. Please validate either @@product_uc@@_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation." exit 1 fi