Revision WindowActivator - Add OS dependency 70/35170/1
authorjungwook.ryu <jungwook.ryu@samsung.com>
Tue, 10 Feb 2015 07:15:48 +0000 (16:15 +0900)
committerjungwook.ryu <jungwook.ryu@samsung.com>
Tue, 10 Feb 2015 07:15:48 +0000 (16:15 +0900)
Change-Id: I7b6fba8b1a7d402e231f7ccafcf10d6fa5512708
Signed-off-by: jungwook.ryu <jungwook.ryu@samsung.com>
org.tizen.dynamicanalysis.ide.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/OpenEditManager.java_Linux
org.tizen.dynamicanalysis.ide.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/OpenEditManager.java_Window
org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/OpenEditManager.java_Linux
org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/OpenEditManager.java_Window

index 8980609..e8e9e5b 100644 (file)
@@ -22,8 +22,7 @@
  * Contributors:
  * - S-Core Co., Ltd
  *
- */ 
-
+ */
 
 package org.tizen.dynamicanalysis.ide.eplugin.communication;
 
@@ -46,70 +45,59 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.texteditor.ITextEditor;
+import org.tizen.common.util.OSChecker;
 import org.tizen.dynamicanalysis.ide.eplugin.DALog;
 
-public class OpenEditManager implements Runnable
-{
+public class OpenEditManager implements Runnable {
        private ITextEditor _editor;
        private IDocument _document;
        private String filepath;
        private int fileline;
-       
-       public  OpenEditManager(String path, int line)
-       {
+
+       public OpenEditManager(String path, int line) {
                this.filepath = path;
                this.fileline = line;
        }
 
-       private void initEditor( final String path ) throws IOException
-       {
+       private void initEditor(final String path) throws IOException {
                IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
                IFile ifile = root.getFile(new Path(path));
                IEditorPart part = null;
-                               
-               if (!ifile.exists())
-               {
+
+               if (!ifile.exists()) {
                        File targetfile = new File(path);
-                       if(targetfile.exists() && targetfile.isFile())
-                       {
+                       if (targetfile.exists() && targetfile.isFile()) {
                                IFileStore filestore = EFS.getLocalFileSystem().getStore(targetfile.toURI());
                                part = openEditor(filestore);
-                       }
-                       else
-                       {
+                       } else {
                                throw new IOException("Source file (" + path + ") is not found.");//$NON-NLS-1$ //$NON-NLS-2$
                        }
-               }
-               else
-               {
+               } else {
                        part = openEditor(ifile);
                }
 
-               if(part != null && (part instanceof ITextEditor))
-           {
-               _editor = (ITextEditor)part;
-               IDocumentProvider provider = _editor.getDocumentProvider();
-               _document = provider.getDocument(_editor.getEditorInput());
+               if (part != null && (part instanceof ITextEditor)) {
+                       _editor = (ITextEditor) part;
+                       IDocumentProvider provider = _editor.getDocumentProvider();
+                       _document = provider.getDocument(_editor.getEditorInput());
 
-           }
+               }
        }
 
        private IEditorPart openEditor(final IFile ifile) {
                // editor open
-               IWorkbenchPage page = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getActivePage();
+               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {
                        IDE.openEditor(page, ifile);
                } catch (PartInitException e) {
                        DALog.printLog("OpenEditManager - openEditor - PartInitException");
                }
-               
+
                return page.getActiveEditor();
        }
-       
+
        private IEditorPart openEditor(final IFileStore ifilestr) {
-               IWorkbenchPage page = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getActivePage();
+               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {
                        IDE.openEditorOnFileStore(page, ifilestr);
                } catch (PartInitException e) {
@@ -118,68 +106,41 @@ public class OpenEditManager implements Runnable
 
                return page.getActiveEditor();
        }
-       
-       private ITextEditor getEditor()
-       {
+
+       private ITextEditor getEditor() {
                return _editor;
        }
 
-       public void run(){
-               try
-               {
+       public void run() {
+               try {
                        int offset;
-                       
+
                        initEditor(this.filepath);
-                       
-                       if(this.fileline > 0)
-                       {
+
+                       if (this.fileline > 0) {
                                offset = _document.getLineOffset(this.fileline - 1);
-                       }
-                       else
-                       {
+                       } else {
                                offset = 0;
                        }
-                       getEditor().setHighlightRange(offset, 0, true); //move cursor
-       
-                       String os = System.getProperty("os.name").toLowerCase();
-                       if(os.indexOf("mac") >= 0){
+                       getEditor().setHighlightRange(offset, 0, true); // move cursor
+
+                       if (OSChecker.isMAC()) {
                                forceActiveOnMac();
-                       }else if(os.indexOf("linux") >= 0){
-                               //forActiveOnLinux();
+                       } else if (OSChecker.isLinux()) {
                                FocusManager fm = new FocusManager();
                                fm.start();
+                       } else {
+                               DALog.printLog("OS should be Linux/Mac. It's Error case. IDE is not focus on.");
                        }
-               }
-               catch (IOException e)
-               {       
+               } catch (IOException e) {
                        DALog.printLog("OpenEditManager - run - IOException");
-               }
-               catch (BadLocationException e)
-               {
+               } catch (BadLocationException e) {
                        DALog.printLog("OpenEditManager - run - BadLocationException");
                }
        }
-       
-       public void forActiveOnLinux() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
-               PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               shell.moveAbove(null);
-                               shell.setVisible(true);
-                               shell.setFullScreen(true);
-                               shell.setFullScreen(false);
-                               shell.open();
-                               shell.forceFocus();
-                               shell.forceActive();
-                       }
-               });
-       }
-       
+
        public void forceActiveOnMac() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
+               final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
                PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
                        @Override
                        public void run() {
index 97743a3..c953050 100644 (file)
@@ -22,8 +22,7 @@
  * Contributors:
  * - S-Core Co., Ltd
  *
- */ 
-
+ */
 
 package org.tizen.dynamicanalysis.ide.eplugin.communication;
 
@@ -46,71 +45,60 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.texteditor.ITextEditor;
+import org.tizen.common.util.OSChecker;
 import org.tizen.dynamicanalysis.ide.eplugin.DALog;
 import org.eclipse.swt.internal.win32.*;
 
-public class OpenEditManager implements Runnable
-{
+public class OpenEditManager implements Runnable {
        private ITextEditor _editor;
        private IDocument _document;
        private String filepath;
        private int fileline;
-       
-       public  OpenEditManager(String path, int line)
-       {
+
+       public OpenEditManager(String path, int line) {
                this.filepath = path;
                this.fileline = line;
        }
 
-       private void initEditor( final String path ) throws IOException
-       {
+       private void initEditor(final String path) throws IOException {
                IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
                IFile ifile = root.getFile(new Path(path));
                IEditorPart part = null;
-                               
-               if (!ifile.exists())
-               {
+
+               if (!ifile.exists()) {
                        File targetfile = new File(path);
-                       if(targetfile.exists() && targetfile.isFile())
-                       {
+                       if (targetfile.exists() && targetfile.isFile()) {
                                IFileStore filestore = EFS.getLocalFileSystem().getStore(targetfile.toURI());
                                part = openEditor(filestore);
-                       }
-                       else
-                       {
+                       } else {
                                throw new IOException("Source file (" + path + ") is not found.");//$NON-NLS-1$ //$NON-NLS-2$
                        }
-               }
-               else
-               {
+               } else {
                        part = openEditor(ifile);
                }
 
-               if(part != null && (part instanceof ITextEditor))
-           {
-               _editor = (ITextEditor)part;
-               IDocumentProvider provider = _editor.getDocumentProvider();
-               _document = provider.getDocument(_editor.getEditorInput());
+               if (part != null && (part instanceof ITextEditor)) {
+                       _editor = (ITextEditor) part;
+                       IDocumentProvider provider = _editor.getDocumentProvider();
+                       _document = provider.getDocument(_editor.getEditorInput());
 
-           }
+               }
        }
 
        private IEditorPart openEditor(final IFile ifile) {
                // editor open
-               IWorkbenchPage page = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getActivePage();
+               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {
                        IDE.openEditor(page, ifile);
                } catch (PartInitException e) {
                        DALog.printLog("OpenEditManager - openEditor - PartInitException");
                }
-               
+
                return page.getActiveEditor();
        }
-       
+
        private IEditorPart openEditor(final IFileStore ifilestr) {
-               IWorkbenchPage page = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getActivePage();
+               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {
                        IDE.openEditorOnFileStore(page, ifilestr);
                } catch (PartInitException e) {
@@ -119,105 +107,55 @@ public class OpenEditManager implements Runnable
 
                return page.getActiveEditor();
        }
-       
-       private ITextEditor getEditor()
-       {
+
+       private ITextEditor getEditor() {
                return _editor;
        }
 
-       public void run(){
-               try
-               {
+       public void run() {
+               try {
                        int offset;
-                       
+
                        initEditor(this.filepath);
-                       
-                       if(this.fileline > 0)
-                       {
+
+                       if (this.fileline > 0) {
                                offset = _document.getLineOffset(this.fileline - 1);
-                       }
-                       else
-                       {
+                       } else {
                                offset = 0;
                        }
-                       getEditor().setHighlightRange(offset, 0, true); //move cursor
-       
-                       String os = System.getProperty("os.name").toLowerCase();
-                       if(os.indexOf("win") >= 0) {
+                       getEditor().setHighlightRange(offset, 0, true); // move cursor
+                       if (OSChecker.isWindows()) {
                                forceActiveOnWindows();
-                       }else if(os.indexOf("mac") >= 0){
-                               forceActiveOnMac();
-                       }else if(os.indexOf("linux") >= 0){
-                               //forActiveOnLinux();
-                               FocusManager fm = new FocusManager();
-                               fm.start();
+                       } else {
+                               DALog.printLog("OS should be Windows. It's Error case. IDE is not focus on.");
                        }
-               }
-               catch (IOException e)
-               {       
+               } catch (IOException e) {
                        DALog.printLog("OpenEditManager - run - IOException");
-               }
-               catch (BadLocationException e)
-               {
+               } catch (BadLocationException e) {
                        DALog.printLog("OpenEditManager - run - BadLocationException");
                }
        }
-       
-       public void forActiveOnLinux() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
-               PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               shell.moveAbove(null);
-                               shell.setVisible(true);
-                               shell.setFullScreen(true);
-                               shell.setFullScreen(false);
-                               shell.open();
-                               shell.forceFocus();
-                               shell.forceActive();
-                       }
-               });
-       }
-       
-       public void forceActiveOnMac() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
-               PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               shell.moveAbove(null);
-                               shell.setVisible(true);
-                               shell.setFocus();
-                               shell.setActive();
-                               shell.open();
-                               shell.forceFocus();
-                               shell.forceActive();
-                       }
-               });
-       }
 
        public void forceActiveOnWindows() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
-               
-           int hFrom = OS.GetForegroundWindow();
-
-           if (hFrom <= 0) {
-             OS.SetForegroundWindow(shell.handle);
-             return;
-           }
-
-           int pid = OS.GetWindowThreadProcessId(hFrom, null);
-           int threadid = OS.GetWindowThreadProcessId(shell.handle, null);
-
-           if (threadid == pid) {
-             OS.SetForegroundWindow(shell.handle);
-             return;
-           } 
-           
+               final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+               if (OS.GetForegroundWindow() <= 0) {
+                       DALog.printLog("Failed Active on IDE.");
+                       return;
+               }
+
+               int pid = OS.GetWindowThreadProcessId(OS.GetForegroundWindow(), null);
+               int threadid = OS.GetWindowThreadProcessId(shell.handle, null);
+
+               if (threadid == pid) {
+                       OS.SetForegroundWindow(shell.handle);
+                       DALog.printLog("Success Active on IDE.");
+                       return;
+               }
+
                if (pid > 0) {
                        if (!OS.AttachThreadInput(threadid, pid, true)) {
+                               DALog.printLog("Failed Active on IDE.");
                                return;
                        }
                        OS.SetForegroundWindow(shell.handle);
@@ -227,12 +165,12 @@ public class OpenEditManager implements Runnable
                OS.BringWindowToTop(shell.handle);
                OS.UpdateWindow(shell.handle);
                OS.SetActiveWindow(shell.handle);
-             
-           if(OS.IsIconic(shell.handle)) {
-               // OS.SW_RESTORE : If the window is minimized or maximized, the system  
-               // restores it to its original size and position.
-               OS.ShowWindow(shell.handle, OS.SW_RESTORE);
-           }
-           
-         }
+
+               if (OS.IsIconic(shell.handle)) {
+                       // OS.SW_RESTORE : If the window is minimized or maximized, the
+                       // system restores it to its original size and position.
+                       OS.ShowWindow(shell.handle, OS.SW_RESTORE);
+               }
+               DALog.printLog("Success Active on IDE.");
+       }
 }
index 8980609..e8e9e5b 100644 (file)
@@ -22,8 +22,7 @@
  * Contributors:
  * - S-Core Co., Ltd
  *
- */ 
-
+ */
 
 package org.tizen.dynamicanalysis.ide.eplugin.communication;
 
@@ -46,70 +45,59 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.texteditor.ITextEditor;
+import org.tizen.common.util.OSChecker;
 import org.tizen.dynamicanalysis.ide.eplugin.DALog;
 
-public class OpenEditManager implements Runnable
-{
+public class OpenEditManager implements Runnable {
        private ITextEditor _editor;
        private IDocument _document;
        private String filepath;
        private int fileline;
-       
-       public  OpenEditManager(String path, int line)
-       {
+
+       public OpenEditManager(String path, int line) {
                this.filepath = path;
                this.fileline = line;
        }
 
-       private void initEditor( final String path ) throws IOException
-       {
+       private void initEditor(final String path) throws IOException {
                IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
                IFile ifile = root.getFile(new Path(path));
                IEditorPart part = null;
-                               
-               if (!ifile.exists())
-               {
+
+               if (!ifile.exists()) {
                        File targetfile = new File(path);
-                       if(targetfile.exists() && targetfile.isFile())
-                       {
+                       if (targetfile.exists() && targetfile.isFile()) {
                                IFileStore filestore = EFS.getLocalFileSystem().getStore(targetfile.toURI());
                                part = openEditor(filestore);
-                       }
-                       else
-                       {
+                       } else {
                                throw new IOException("Source file (" + path + ") is not found.");//$NON-NLS-1$ //$NON-NLS-2$
                        }
-               }
-               else
-               {
+               } else {
                        part = openEditor(ifile);
                }
 
-               if(part != null && (part instanceof ITextEditor))
-           {
-               _editor = (ITextEditor)part;
-               IDocumentProvider provider = _editor.getDocumentProvider();
-               _document = provider.getDocument(_editor.getEditorInput());
+               if (part != null && (part instanceof ITextEditor)) {
+                       _editor = (ITextEditor) part;
+                       IDocumentProvider provider = _editor.getDocumentProvider();
+                       _document = provider.getDocument(_editor.getEditorInput());
 
-           }
+               }
        }
 
        private IEditorPart openEditor(final IFile ifile) {
                // editor open
-               IWorkbenchPage page = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getActivePage();
+               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {
                        IDE.openEditor(page, ifile);
                } catch (PartInitException e) {
                        DALog.printLog("OpenEditManager - openEditor - PartInitException");
                }
-               
+
                return page.getActiveEditor();
        }
-       
+
        private IEditorPart openEditor(final IFileStore ifilestr) {
-               IWorkbenchPage page = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getActivePage();
+               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {
                        IDE.openEditorOnFileStore(page, ifilestr);
                } catch (PartInitException e) {
@@ -118,68 +106,41 @@ public class OpenEditManager implements Runnable
 
                return page.getActiveEditor();
        }
-       
-       private ITextEditor getEditor()
-       {
+
+       private ITextEditor getEditor() {
                return _editor;
        }
 
-       public void run(){
-               try
-               {
+       public void run() {
+               try {
                        int offset;
-                       
+
                        initEditor(this.filepath);
-                       
-                       if(this.fileline > 0)
-                       {
+
+                       if (this.fileline > 0) {
                                offset = _document.getLineOffset(this.fileline - 1);
-                       }
-                       else
-                       {
+                       } else {
                                offset = 0;
                        }
-                       getEditor().setHighlightRange(offset, 0, true); //move cursor
-       
-                       String os = System.getProperty("os.name").toLowerCase();
-                       if(os.indexOf("mac") >= 0){
+                       getEditor().setHighlightRange(offset, 0, true); // move cursor
+
+                       if (OSChecker.isMAC()) {
                                forceActiveOnMac();
-                       }else if(os.indexOf("linux") >= 0){
-                               //forActiveOnLinux();
+                       } else if (OSChecker.isLinux()) {
                                FocusManager fm = new FocusManager();
                                fm.start();
+                       } else {
+                               DALog.printLog("OS should be Linux/Mac. It's Error case. IDE is not focus on.");
                        }
-               }
-               catch (IOException e)
-               {       
+               } catch (IOException e) {
                        DALog.printLog("OpenEditManager - run - IOException");
-               }
-               catch (BadLocationException e)
-               {
+               } catch (BadLocationException e) {
                        DALog.printLog("OpenEditManager - run - BadLocationException");
                }
        }
-       
-       public void forActiveOnLinux() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
-               PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               shell.moveAbove(null);
-                               shell.setVisible(true);
-                               shell.setFullScreen(true);
-                               shell.setFullScreen(false);
-                               shell.open();
-                               shell.forceFocus();
-                               shell.forceActive();
-                       }
-               });
-       }
-       
+
        public void forceActiveOnMac() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
+               final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
                PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
                        @Override
                        public void run() {
index 97743a3..c953050 100644 (file)
@@ -22,8 +22,7 @@
  * Contributors:
  * - S-Core Co., Ltd
  *
- */ 
-
+ */
 
 package org.tizen.dynamicanalysis.ide.eplugin.communication;
 
@@ -46,71 +45,60 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.texteditor.ITextEditor;
+import org.tizen.common.util.OSChecker;
 import org.tizen.dynamicanalysis.ide.eplugin.DALog;
 import org.eclipse.swt.internal.win32.*;
 
-public class OpenEditManager implements Runnable
-{
+public class OpenEditManager implements Runnable {
        private ITextEditor _editor;
        private IDocument _document;
        private String filepath;
        private int fileline;
-       
-       public  OpenEditManager(String path, int line)
-       {
+
+       public OpenEditManager(String path, int line) {
                this.filepath = path;
                this.fileline = line;
        }
 
-       private void initEditor( final String path ) throws IOException
-       {
+       private void initEditor(final String path) throws IOException {
                IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
                IFile ifile = root.getFile(new Path(path));
                IEditorPart part = null;
-                               
-               if (!ifile.exists())
-               {
+
+               if (!ifile.exists()) {
                        File targetfile = new File(path);
-                       if(targetfile.exists() && targetfile.isFile())
-                       {
+                       if (targetfile.exists() && targetfile.isFile()) {
                                IFileStore filestore = EFS.getLocalFileSystem().getStore(targetfile.toURI());
                                part = openEditor(filestore);
-                       }
-                       else
-                       {
+                       } else {
                                throw new IOException("Source file (" + path + ") is not found.");//$NON-NLS-1$ //$NON-NLS-2$
                        }
-               }
-               else
-               {
+               } else {
                        part = openEditor(ifile);
                }
 
-               if(part != null && (part instanceof ITextEditor))
-           {
-               _editor = (ITextEditor)part;
-               IDocumentProvider provider = _editor.getDocumentProvider();
-               _document = provider.getDocument(_editor.getEditorInput());
+               if (part != null && (part instanceof ITextEditor)) {
+                       _editor = (ITextEditor) part;
+                       IDocumentProvider provider = _editor.getDocumentProvider();
+                       _document = provider.getDocument(_editor.getEditorInput());
 
-           }
+               }
        }
 
        private IEditorPart openEditor(final IFile ifile) {
                // editor open
-               IWorkbenchPage page = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getActivePage();
+               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {
                        IDE.openEditor(page, ifile);
                } catch (PartInitException e) {
                        DALog.printLog("OpenEditManager - openEditor - PartInitException");
                }
-               
+
                return page.getActiveEditor();
        }
-       
+
        private IEditorPart openEditor(final IFileStore ifilestr) {
-               IWorkbenchPage page = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getActivePage();
+               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {
                        IDE.openEditorOnFileStore(page, ifilestr);
                } catch (PartInitException e) {
@@ -119,105 +107,55 @@ public class OpenEditManager implements Runnable
 
                return page.getActiveEditor();
        }
-       
-       private ITextEditor getEditor()
-       {
+
+       private ITextEditor getEditor() {
                return _editor;
        }
 
-       public void run(){
-               try
-               {
+       public void run() {
+               try {
                        int offset;
-                       
+
                        initEditor(this.filepath);
-                       
-                       if(this.fileline > 0)
-                       {
+
+                       if (this.fileline > 0) {
                                offset = _document.getLineOffset(this.fileline - 1);
-                       }
-                       else
-                       {
+                       } else {
                                offset = 0;
                        }
-                       getEditor().setHighlightRange(offset, 0, true); //move cursor
-       
-                       String os = System.getProperty("os.name").toLowerCase();
-                       if(os.indexOf("win") >= 0) {
+                       getEditor().setHighlightRange(offset, 0, true); // move cursor
+                       if (OSChecker.isWindows()) {
                                forceActiveOnWindows();
-                       }else if(os.indexOf("mac") >= 0){
-                               forceActiveOnMac();
-                       }else if(os.indexOf("linux") >= 0){
-                               //forActiveOnLinux();
-                               FocusManager fm = new FocusManager();
-                               fm.start();
+                       } else {
+                               DALog.printLog("OS should be Windows. It's Error case. IDE is not focus on.");
                        }
-               }
-               catch (IOException e)
-               {       
+               } catch (IOException e) {
                        DALog.printLog("OpenEditManager - run - IOException");
-               }
-               catch (BadLocationException e)
-               {
+               } catch (BadLocationException e) {
                        DALog.printLog("OpenEditManager - run - BadLocationException");
                }
        }
-       
-       public void forActiveOnLinux() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
-               PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               shell.moveAbove(null);
-                               shell.setVisible(true);
-                               shell.setFullScreen(true);
-                               shell.setFullScreen(false);
-                               shell.open();
-                               shell.forceFocus();
-                               shell.forceActive();
-                       }
-               });
-       }
-       
-       public void forceActiveOnMac() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
-               PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               shell.moveAbove(null);
-                               shell.setVisible(true);
-                               shell.setFocus();
-                               shell.setActive();
-                               shell.open();
-                               shell.forceFocus();
-                               shell.forceActive();
-                       }
-               });
-       }
 
        public void forceActiveOnWindows() {
-               final Shell shell = PlatformUI.getWorkbench()
-                               .getActiveWorkbenchWindow().getShell();
-               
-           int hFrom = OS.GetForegroundWindow();
-
-           if (hFrom <= 0) {
-             OS.SetForegroundWindow(shell.handle);
-             return;
-           }
-
-           int pid = OS.GetWindowThreadProcessId(hFrom, null);
-           int threadid = OS.GetWindowThreadProcessId(shell.handle, null);
-
-           if (threadid == pid) {
-             OS.SetForegroundWindow(shell.handle);
-             return;
-           } 
-           
+               final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+               if (OS.GetForegroundWindow() <= 0) {
+                       DALog.printLog("Failed Active on IDE.");
+                       return;
+               }
+
+               int pid = OS.GetWindowThreadProcessId(OS.GetForegroundWindow(), null);
+               int threadid = OS.GetWindowThreadProcessId(shell.handle, null);
+
+               if (threadid == pid) {
+                       OS.SetForegroundWindow(shell.handle);
+                       DALog.printLog("Success Active on IDE.");
+                       return;
+               }
+
                if (pid > 0) {
                        if (!OS.AttachThreadInput(threadid, pid, true)) {
+                               DALog.printLog("Failed Active on IDE.");
                                return;
                        }
                        OS.SetForegroundWindow(shell.handle);
@@ -227,12 +165,12 @@ public class OpenEditManager implements Runnable
                OS.BringWindowToTop(shell.handle);
                OS.UpdateWindow(shell.handle);
                OS.SetActiveWindow(shell.handle);
-             
-           if(OS.IsIconic(shell.handle)) {
-               // OS.SW_RESTORE : If the window is minimized or maximized, the system  
-               // restores it to its original size and position.
-               OS.ShowWindow(shell.handle, OS.SW_RESTORE);
-           }
-           
-         }
+
+               if (OS.IsIconic(shell.handle)) {
+                       // OS.SW_RESTORE : If the window is minimized or maximized, the
+                       // system restores it to its original size and position.
+                       OS.ShowWindow(shell.handle, OS.SW_RESTORE);
+               }
+               DALog.printLog("Success Active on IDE.");
+       }
 }