Utility: Emulator-manager icon group in windows taskbar.
authorminkee.lee <minkee.lee@samsung.com>
Tue, 23 Sep 2014 10:27:51 +0000 (19:27 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Thu, 16 Oct 2014 12:21:19 +0000 (21:21 +0900)
- In Windows OS, assign taskbar group ID to emulator-manager.
  Group ID allows an application to group its associated processes and
  windows under a single taskbar button.

Change-Id: Ic3da7a6195ebcbf322fa424ecc015a0572d1765f
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
build.xml
common-project/.classpath
common-project/src/org/tizen/emulator/manager/EmulatorManager.java

index 7d05481..f3782d0 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -7,6 +7,7 @@
        <property name="proto.file" value="protobuf.jar" />
        <property name="swt.file" value="swt.jar" />
        <property name="jsch.file" value="jsch-0.1.50.jar" />
+       <property name="jna.file" value="jna-4.1.0.jar" />
 
        <property name="common.dir" value="common-project" />
        <property name="plugin.dir" value="plugin-project" />
@@ -33,6 +34,7 @@
                <fileset dir="${common.dir}/lib" includes="${swt.file}" />
                <fileset dir="${common.dir}/lib" includes="${jsch.file}" />
                <fileset dir="${common.dir}/lib" includes="${proto.file}" />
+               <fileset dir="${common.dir}/lib" includes="${jna.file}" />
        </path>
 
        <path id="plugin-classpath">
@@ -74,7 +76,7 @@
                        <fileset file="about.properties" />
                        <manifest>
                                <attribute name="Main-Class" value="${mainclass}" />
-                               <attribute name="Class-path" value="${swt.file} ${jsch.file} ${proto.file}" />
+                               <attribute name="Class-path" value="${swt.file} ${jsch.file} ${proto.file} ${jna.file}" />
                        </manifest>
                </jar>
        </target>
                <fileset dir="${classpath.dibs}" includes="${swt.file}" />
                <fileset dir="${classpath.dibs}" includes="${jsch.file}" />
                <fileset dir="${classpath.dibs}" includes="${proto.file}" />
+               <fileset dir="${classpath.dibs}" includes="${jna.file}" />
        </path>
 
        <path id="plugin-classpath-dibs">
index 1233968..dae27ea 100644 (file)
@@ -7,5 +7,6 @@
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_51"/>
        <classpathentry exported="true" kind="lib" path="lib/jsch-0.1.50.jar"/>
        <classpathentry kind="lib" path="lib/protobuf.jar"/>
+       <classpathentry kind="lib" path="lib/jna-4.1.0.jar"/>
        <classpathentry kind="output" path="bin"/>
 </classpath>
index d55240b..3eaa41f 100755 (executable)
@@ -57,6 +57,10 @@ import org.tizen.emulator.manager.ui.VMsMainView;
 import org.tizen.emulator.manager.ui.dialog.MessageDialog;
 import org.tizen.emulator.manager.vms.helper.WorkerLock;
 
+import com.sun.jna.Native;
+import com.sun.jna.NativeLong;
+import com.sun.jna.WString;
+
 public class EmulatorManager {
        //private static EmulatorManager instance = null;
        private static int current_tab_index;
@@ -84,8 +88,26 @@ public class EmulatorManager {
                } else if (System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) {
                         isMac = true;
                }
+               if (isWin) {
+                       Native.register("shell32");
+               }
+       }
+
+       public static void setProcessAppUserModelID(final String appID) {
+               long S_OK = 0;
+               NativeLong result = SetCurrentProcessExplicitAppUserModelID(new WString(appID));
+               if (result.longValue() == S_OK) {
+                       EMLogger.getLogger().log(Level.INFO, "Set process AppUserModelID to " + appID);
+               } else {
+                       EMLogger.getLogger().log(Level.WARNING, "Failed to set process AppUserModelID to " + appID);
+               }
        }
 
+       // Specifies a unique application-defined Application User Model ID (AppUserModelID)
+       // that identifies the current process to the taskbar.
+       // (http://msdn.microsoft.com/en-us/library/windows/desktop/dd378422%28v=vs.85%29.aspx)
+       private static native NativeLong SetCurrentProcessExplicitAppUserModelID(WString appID);
+
        public static void setCurrentTabIndex(int index){
                current_tab_index = index;
        }
@@ -190,6 +212,10 @@ public class EmulatorManager {
        }
 
        public static void main(String[] args) {
+               if (isWin) {
+                       // Running icon grouping ID on taskbar.
+                       setProcessAppUserModelID(EmulatorManager.class.getName());
+               }
                //
                Runtime.getRuntime().addShutdownHook(new Thread(new EMShutdownHook()));
                //