import org.tizen.emulator.skin.util.SkinRegion;
import org.tizen.emulator.skin.util.SkinRotation;
import org.tizen.emulator.skin.util.SkinUtil;
+import org.tizen.emulator.skin.util.SwtUtil;
/**
*
String emulatorName = SkinUtil.makeEmulatorName( config );
shell.setText( emulatorName );
- if ( SkinUtil.isWindowsPlatform() ) {
+ if ( SwtUtil.isWindowsPlatform() ) {
shell.setImage( imageRegistry.getIcon( IconName.EMULATOR_TITLE_ICO ) );
} else {
shell.setImage( imageRegistry.getIcon( IconName.EMULATOR_TITLE ) );
long windowHandleId = 0;
- if ( SkinUtil.isLinuxPlatform() ) {
+ if ( SwtUtil.isLinuxPlatform() ) {
try {
Field field = lcdCanvas.getClass().getField( "embeddedHandle" );
shutdown();
}
- } else if ( SkinUtil.isWindowsPlatform() ) {
+ } else if ( SwtUtil.isWindowsPlatform() ) {
logger.info( "lcdCanvas.handle:" + lcdCanvas.handle );
windowHandleId = lcdCanvas.handle;
- } else if ( SkinUtil.isMacPlatform() ) {
+ } else if ( SwtUtil.isMacPlatform() ) {
// TODO
previous = null;
- if( SkinUtil.isWindowsPlatform() && disappearEvent) {
+ if( SwtUtil.isWindowsPlatform() && disappearEvent) {
disappearEvent = false;
if (isMetaKey(e) && e.character != '\0') {
logger.info( "send previous release : keycode=" + disappearKeycode +
public void keyPressed( KeyEvent e ) {
int keyCode = e.keyCode | e.stateMask;
- if( SkinUtil.isWindowsPlatform() ) {
+ if( SwtUtil.isWindowsPlatform() ) {
if ( null != previous ) {
if ( previous.keyCode != e.keyCode ) {
private Field getOSField( String field ) {
String className = "";
- if ( SkinUtil.isLinuxPlatform() ) {
+ if ( SwtUtil.isLinuxPlatform() ) {
className = GTK_OS_CLASS;
- } else if ( SkinUtil.isWindowsPlatform() ) {
+ } else if ( SwtUtil.isWindowsPlatform() ) {
className = WIN32_OS_CLASS;
}
private Method getOSMethod( String method, Class<?>... parameterTypes ) {
String className = "";
- if ( SkinUtil.isLinuxPlatform() ) {
+ if ( SwtUtil.isLinuxPlatform() ) {
className = GTK_OS_CLASS;
- } else if ( SkinUtil.isWindowsPlatform() ) {
+ } else if ( SwtUtil.isWindowsPlatform() ) {
className = WIN32_OS_CLASS;
}
}
private boolean setTopMost32(boolean isOnTop) {
- if ( SkinUtil.isLinuxPlatform() ) {
+ if ( SwtUtil.isLinuxPlatform() ) {
// reference : http://wmctrl.sourcearchive.com/documentation/1.07/main_8c-source.html
/* if ( !OS.GDK_WINDOWING_X11() ) {
invokeOSMethod( xSendEvent, xDisplay, rootWin, false, (int) ( 1L << 20 | 1L << 19 ), malloc );
invokeOSMethod( getOSMethod( "g_free", int.class ), malloc ) ;
- } else if( SkinUtil.isWindowsPlatform() ) {
+ } else if( SwtUtil.isWindowsPlatform() ) {
Point location = shell.getLocation();
/* int hWndInsertAfter = 0;
int.class, int.class );
invokeOSMethod( m, shell.handle, hWndInsertAfter, location.x, location.y, 0, 0, noSize );
- } else if( SkinUtil.isMacPlatform() ) {
+ } else if( SwtUtil.isMacPlatform() ) {
//TODO:
}
private boolean setTopMost64(boolean isOnTop)
{
- if ( SkinUtil.isLinuxPlatform() ) {
+ if ( SwtUtil.isLinuxPlatform() ) {
Boolean gdkWindowingX11 = (Boolean) invokeOSMethod( getOSMethod( "GDK_WINDOWING_X11" ) );
if (null == gdkWindowingX11) {
return false;
// SubstructureRedirectMask:1L<<20 | SubstructureNotifyMask:1L<<19
invokeOSMethod( xSendEvent, xDisplay, rootWin, false, (long) ( 1L << 20 | 1L << 19 ), malloc );
invokeOSMethod( getOSMethod( "g_free", long.class ), malloc );
- } else if (SkinUtil.isWindowsPlatform()) {
+ } else if (SwtUtil.isWindowsPlatform()) {
//TODO:
- } else if( SkinUtil.isMacPlatform() ) {
+ } else if( SwtUtil.isMacPlatform() ) {
//TODO:
}
ProcessBuilder procSdb = new ProcessBuilder();
- if ( SkinUtil.isLinuxPlatform() ) {
+ if ( SwtUtil.isLinuxPlatform() ) {
procSdb.command( "/usr/bin/gnome-terminal", "--disable-factory",
"--title=" + SkinUtil.makeEmulatorName( config ), "-x", sdbPath, "-s", "emulator-"
+ portSdb, "shell" );
- } else if ( SkinUtil.isWindowsPlatform() ) {
+ } else if ( SwtUtil.isWindowsPlatform() ) {
procSdb.command( "cmd.exe", "/c", "start", sdbPath, "-s", "emulator-" + portSdb, "shell" );
}
logger.log( Level.INFO, procSdb.command().toString() );
import org.eclipse.swt.widgets.Text;
import org.tizen.emulator.skin.log.SkinLogger;
import org.tizen.emulator.skin.util.IOUtil;
-import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.StringUtil;
+import org.tizen.emulator.skin.util.SwtUtil;
public class AboutDialog extends SkinDialog {
Text versionText = new Text( composite, SWT.NONE );
String version = getValue( properties, PROP_KEY_VERSION );
- if (SkinUtil.isWindowsPlatform()) {
+ if (SwtUtil.isWindowsPlatform()) {
versionText.setText("Version" + " : " + version);
} else {
versionText.setText("Version" + " : " + version);
import org.tizen.emulator.skin.log.SkinLogger;
import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.StringUtil;
+import org.tizen.emulator.skin.util.SwtUtil;
/**
*
String logPath = refinedData.get(logKey);
ProcessBuilder procBrowser = new ProcessBuilder();
- if (SkinUtil.isLinuxPlatform()) {
+ if (SwtUtil.isLinuxPlatform()) {
procBrowser.command("nautilus", "--browser", logPath);
- } else if (SkinUtil.isWindowsPlatform()) {
+ } else if (SwtUtil.isWindowsPlatform()) {
procBrowser.command("explorer", "\"" + logPath + "\"");
- } else if (SkinUtil.isMacPlatform()) {
+ } else if (SwtUtil.isMacPlatform()) {
//TODO:
}
@Override
protected void setShellSize() {
- if( SkinUtil.isLinuxPlatform() ) {
+ if( SwtUtil.isLinuxPlatform() ) {
shell.setSize( (int) ( 402 * 1.618 ), 402 );
} else {
shell.setSize( (int) ( 372 * 1.618 ), 372 );
String logPath = "";
boolean isHaxError = false;
- if ( SkinUtil.isLinuxPlatform() ) {
+ if ( SwtUtil.isLinuxPlatform() ) {
hwVirtualCompare = "-enable-kvm";
- } else if ( SkinUtil.isWindowsPlatform() ) {
+ } else if ( SwtUtil.isWindowsPlatform() ) {
hwVirtualCompare = "-enable-hax";
}
if ( 0 == i ) {
String exec = split[i].trim().toLowerCase();
- if( SkinUtil.isWindowsPlatform() ) {
+ if( SwtUtil.isWindowsPlatform() ) {
if( 4 <= exec.length() ) {
// remove '.exe' in Windows
exec = exec.substring( 0, exec.length() - 4 );
result.put( "RAM Size", ram );
- if ( SkinUtil.isLinuxPlatform() ) {
+ if ( SwtUtil.isLinuxPlatform() ) {
if ( StringUtil.isEmpty( sharedPath ) ) {
result.put( "File Sharing", "Not Supported" );
result.put( "File Shared Path", "None" );
import org.tizen.emulator.skin.util.IOUtil;
import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.StringUtil;
+import org.tizen.emulator.skin.util.SwtUtil;
public class ScreenShotDialog {
ImageData data = null;
- if ( SkinUtil.isWindowsPlatform() ) {
+ if ( SwtUtil.isWindowsPlatform() ) {
// change RGB mask
ImageData imageData = image.getImageData();
PaletteData paletteData = new PaletteData( BLUE_MASK, GREEN_MASK, RED_MASK );
private SkinUtil() {
}
- public static boolean isLinuxPlatform() {
- return "gtk".equalsIgnoreCase( SWT.getPlatform() );
- }
-
- public static boolean isWindowsPlatform() {
- return "win32".equalsIgnoreCase( SWT.getPlatform() );
- }
-
- public static boolean isMacPlatform() {
- return "cocoa".equalsIgnoreCase( SWT.getPlatform() );
- }
-
public static String getVmName( EmulatorConfig config ) {
String vmPath = config.getArg( ArgsConstants.VM_PATH );
String regex = "";
- if ( isWindowsPlatform() ) {
+ if ( SwtUtil.isWindowsPlatform() ) {
regex = "\\" + File.separator;
} else {
regex = File.separator;
public static String getSdbPath() {
String sdbPath = null;
- if (SkinUtil.isWindowsPlatform()) {
+ if (SwtUtil.isWindowsPlatform()) {
sdbPath = ".\\..\\..\\sdb.exe";
} else {
sdbPath = "./../../sdb";
--- /dev/null
+/**
+ *
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.skin.util;
+
+import org.eclipse.swt.SWT;
+
+
+/**
+ *
+ *
+ */
+public class SwtUtil {
+ private SwtUtil() {
+ }
+
+ public static boolean isLinuxPlatform() {
+ return "gtk".equalsIgnoreCase( SWT.getPlatform() );
+ }
+
+ public static boolean isWindowsPlatform() {
+ return "win32".equalsIgnoreCase( SWT.getPlatform() ); //win32-win32-x86_64
+ }
+
+ public static boolean isMacPlatform() {
+ return "cocoa".equalsIgnoreCase( SWT.getPlatform() );
+ }
+}