<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="lib" path="lib/jna-platform-4.1.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
CheckEmulatorDir.CheckSwapDir();
PlatformList.makePlatformList();
- EMPluginLoader.completeLoadPlugin();
+// EMPluginLoader.completeLoadPlugin();
if (isConsoleMode) {
EmulatorManager.startConsoleProcessor();
for (Platform platform : PlatformList.getPlatformList()) {
if (platform.getName().equals(c.getCurrentValue())) {
for (CustomPlatform cp : PlatformList.getCustomPlatform()) {
- if (platform.getProfile().equals(platform.getProfile())) {
+ if (platform.getProfile().equals(cp.getProfile())) {
image = cp.getImageList().get(0);
check = true;
break;
if (prop.get("[Meta]") != null) {
loadOldProperty(prop);
} else {
- imageName = prop.getProperty(StringResources.IMAGE_NAME).toLowerCase();
+ imageName = prop.getProperty(StringResources.IMAGE_NAME);
+// imageName = prop.getProperty(StringResources.IMAGE_NAME).toLowerCase();
if (imageName == null) {
throw new IOException("Image name is null. This image can not add.");
}
}
private void loadOldProperty(Properties prop) throws IOException {
- imageName = prop.getProperty(StringResources.IMAGE_NAME).toLowerCase();
+// imageName = prop.getProperty(StringResources.IMAGE_NAME).toLowerCase();
+ imageName = prop.getProperty(StringResources.IMAGE_NAME);
if (imageName == null) {
throw new IOException("Image name is null. This image can not add.");
}
}
}
if (this.resolution == null) {
- throw new IOException("This resolution is not supported ( + " +
- re + ")");
+ try {
+ this.resolution = new RESOLUTION(Integer.valueOf(width),
+ Integer.valueOf(height), "", 0);
+ } catch (NumberFormatException e) {
+ throw new IOException("This resolution is not supported ( + " +
+ re + ")");
+ }
}
}
/*
if (jarFile != null) {
Attributes attr = null;
try {
- attr = jarFile.getManifest().getMainAttributes();
+ if (jarFile.getManifest() != null) {
+ attr = jarFile.getManifest().getMainAttributes();
+ }
} catch (IOException e) {
EMLogger.addStaticLog("Faile to load Manifest file: " + e.getMessage());
}
CHECKBOX_OFF("checkbox_off", ImageType.PNG),
CHECKBOX_ON_DIS("checkbox_on_dis", ImageType.PNG),
- CHECKBOX_OFF_DIS("checkbox_off_dis", ImageType.PNG)
+ CHECKBOX_OFF_DIS("checkbox_off_dis", ImageType.PNG),
+
+ SPINNER_UP("spinner_up"),
+ SPINNER_DOWN("spinner_down")
;
String name;
left.getImageData().width, 0,
width - left.getImageData().width + right.getImageData().width, height);
gc.drawImage(right, width - right.getImageData().width, 0);
+ gc.dispose();
return image;
}
left.getImageData().width, 0,
width - left.getImageData().width + right.getImageData().width, height);
gc.drawImage(right, width - right.getImageData().width, 0);
+ gc.dispose();
return image;
}
left.getImageData().width, 0,
width - left.getImageData().width + right.getImageData().width, height);
gc.drawImage(right, width - right.getImageData().width, 0);
+ gc.dispose();
return image;
}
gc.setInterpolation(SWT.NONE);
gc.fillRectangle(0, 0, width, height);
- // left
+ // left
gc.drawImage(left, 0, 0);
- // middle
+ // middle
gc.drawImage(middle, 0, 0,
middle.getImageData().width, middle.getImageData().height,
left.getImageData().width, 0,
// right
gc.drawImage(ImageResources.INPUTBOX_ON_RIGHT.getImage(),
width - left.getImageData().width, 0);
-
+
gc.dispose();
return image;
}
middle.getImageData().width, middle.getImageData().height,
left.getImageData().width, 0,
width - left.getImageData().width * 2, height);
-
+
// right
gc.drawImage(ImageResources.INPUTBOX_OFF_RIGHT.getImage(),
width - left.getImageData().width, 0);
-
+
gc.dispose();
return image;
}
public static Image getSelectTabFolder(int width, int height) {
Image image = new Image(Display.getCurrent(), width, height);
-
+
GC gc = new GC(image);
gc.setInterpolation(SWT.NONE);
gc.fillRectangle(0, 0, width, height);
middle.getImageData().width, middle.getImageData().height,
left.getImageData().width, 0,
width - left.getImageData().width * 2, height);
-
+
// right
gc.drawImage(ImageResources.TAB_SELECTED_RIGHT.getImage(),
width - left.getImageData().width , 0);
-
- gc.dispose();
+ gc.dispose();
return image;
}
public static Image getUnselectedTabFolder(int width, int height) {
-
+
Image left = ImageResources.TAB_UNSELECTED_LEFT.getImage();
Image middle = ImageResources.TAB_UNSELECTED_MIDDLE.getImage();
Image right = ImageResources.TAB_UNSELECTED_RIGHT.getImage();
// right
gc.drawImage(right, width - leftWidth , 0);
-
gc.dispose();
-
return image;
}
middle.getImageData().width, middle.getImageData().height,
leftWidth, 0,
width - (leftWidth + rightWidth), height);
-
+
// right
gc.drawImage(right, width - leftWidth , 0);
-
gc.dispose();
-
return image;
}
Image temp = ImageResources.SCROLLBAR_BACK.getImage();
gc.drawImage(temp, 0, 0, temp.getImageData().width, temp.getImageData().height,
0, 0, width, height);
+ gc.dispose();
return image;
}
}
File emulator_vms = new File(FilePathResources.getOldTizenSdkDataEmulatorPath());
if (emulator_vms == null || !emulator_vms.exists()) {
return false;
+
+ } else if (emulator_vms.list() == null) {
+ return false;
+
} else if (emulator_vms.list().length == 0) { // empty dir
emulator_vms.delete();
return false;
}
}
+ public void setEnabled(boolean enabled) {}
+
}
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.tizen.emulator.manager.resources.ColorResources;
protected Composite comp = null;
protected DetailViewItem upperItem = null;
protected DetailViewItem downItem = null;
- protected Label titleLabel;
+ protected Canvas titleLabel;
protected String title;
private boolean isCreateMode;
protected boolean isMinMode = false;
});
}
- titleLabel = new Label(compList.get(0), SWT.NONE);
+ titleLabel = new Canvas(compList.get(0), SWT.NONE);
titleLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont());
titleLabel.setForeground(ColorResources.DETAIL_TITILE_FONT_COLOR.getColor());
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Canvas;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.ui.detail.item.AdvancedViewItem;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
import org.tizen.emulator.manager.ui.widgets.ImageButton;
import org.tizen.emulator.manager.vms.VMPropertyValue;
import org.tizen.emulator.manager.vms.xml.template.Item;
});
}
- titleLabel = new Label(compList.get(0), SWT.NONE);
+ titleLabel = new Canvas(compList.get(0), SWT.NONE);
titleLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont());
titleLabel.setForeground(ColorResources.DETAIL_TITILE_FONT_COLOR.getColor());
HIDE_LABEL("hideLabel"),
DEFAULT_IF_EMPTY("defaultIfEmpty"),
SPREAD_ON_START("spreadOnStart"),
- PROFILE("profile")
+ PROFILE("profile"),
+ MODIFY_ENABLE("modifyEnable")
;
+ public static final String VALUE_TRUE = "true";
+ public static final String VALUE_FALSE = "false";
+ public static final String VALUE_ON = "on";
+ public static final String VALUE_OFF = "off";
+
+
private String name;
private OptionType(String name) {
public void setDialogEnable(boolean enable) {
if (dialogItem != null) {
- dialogItem.setEnable(enable);
+ dialogItem.setEnabled(enable);
}
}
import org.tizen.emulator.manager.ui.detail.item.template.TextViewItem;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.helper.HelperClass;
import org.tizen.emulator.manager.vms.xml.template.Item;
public class MaxTouchViewItem extends TextViewItem {
}
@Override
- public void drawModify() {
- valueLabel = new ImageLabel(compList.get(0), SWT.NONE);
- valueLabel.setDisableImage(PatchImageResources.getInputBoxON(INPUTBOX_WIDTH));
+ public boolean settingModifyItem(VMPropertyValue value) {
+ if (isCreateMode() && useDefaultOnCreate) {
+ newValue = defaultOnCreate;
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = valueLabel.getSize().x;
- data.height = valueLabel.getSize().y;
- valueLabel.setLayoutData(data);
- valueLabel.setEnabled(false);
- }
+ } else {
+ newValue = String.valueOf(value.maxTouchCount);
+ }
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- newValue = String.valueOf(value.maxTouchCount);
- valueLabel.setText(newValue);
+ if (modifyEnable) {
+ text.setText(newValue);
+
+ } else {
+ valueLabel.setText(newValue);
+ }
return false;
}
valueLabel.setText(newValue);
return false;
}
+
+ @Override
+ public boolean checkValue() {
+ if (!modifyEnable) {
+ return true;
+ }
+
+ boolean result = true;
+ String errMsg = null;
+ try {
+ int val = Integer.parseInt(newValue);
+ if (val <= 0) {
+ errMsg = "Max touch value should be positive integer.";
+ result = false;
+ }
+
+ } catch(NumberFormatException e) {
+ result = false;
+ errMsg = "Max touch value should be integer number.";
+ }
+
+ HelperClass.setStatusBar(errMsg);
+ return result;
+ }
}
@Override
protected void parseOption(List<Option> optionList) {
+ super.parseOption(optionList);
resList = new ArrayList<RESOLUTION>();
for (Option option : optionList) {
String[] split = option.getValue().split(",");
public class CheckLabelViewItem extends LabelViewItem {
private ImageButton checkBox;
- private boolean hideLabel = false;
+ protected boolean hideLabel = false;
public CheckLabelViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
super(template, lineLabelViewItem);
TITLE_WIDTH = 60; // override
parseOption(template.getOption());
+ lineLabelViewItem.addItem(name, this);
}
protected void parseOption(List<Option> optionList) {
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.ui.detail.item.OptionType;
-import org.tizen.emulator.manager.ui.widgets.ImageButton;
+import org.tizen.emulator.manager.ui.widgets.CheckBoxButton;
import org.tizen.emulator.manager.vms.VMPropertyValue;
import org.tizen.emulator.manager.vms.xml.template.Item;
import org.tizen.emulator.manager.vms.xml.template.Option;
-public class CheckSubViewItem implements ISubViewItem {
+public class CheckSubViewItem extends SubViewItem {
- protected String name;
- protected String title;
- protected LabelViewItem parentItem;
- protected Composite comp; // parent
+// protected String name;
+// protected String title;
+// protected LabelViewItem parentItem;
+// protected Composite comp; // parent
- boolean oldValue;
- boolean newValue;
+ protected boolean oldValue;
+ protected boolean newValue;
protected Label titleLabel;
- protected ImageButton detailCheckBox; // modify
- protected ImageButton modifyCheckBox; // modify
+ protected CheckBoxButton detailCheckBox; // modify
+ protected CheckBoxButton modifyCheckBox; // modify
private Label clickedLabel;
private Rectangle labelRect = new Rectangle(0,0,100,20);
public static String VALUE_ON = "on";
public static String VALUE_OFF = "off";
- private boolean useDefaultOnCreate = false;
- private boolean defaultOnCreate = false;
- private boolean disableOnCreate = false;
- private boolean titleLabelMouseEnable = true;
+ protected boolean disableOnCreate = false;
+ protected boolean titleLabelMouseEnable = true;
- private boolean defaultIfEmpty = true;
+ protected boolean defaultIfEmpty = true;
public CheckSubViewItem(LabelViewItem parentItem, Composite comp, Item template, boolean isOdd) {
- this.parentItem = parentItem;
- this.comp = comp;
- this.name = template.getName();
- this.title = template.getTitle();
- if (!isOdd) {
- CHECKBOX_LEFT_GAP += ODD_GAP;
+ super(parentItem, comp, template);
+ if (parentItem instanceof CheckLabelViewItem) {
+ if (!isOdd) {
+ CHECKBOX_LEFT_GAP += ODD_GAP;
+ }
+
+ } else { // LableViewItem's subitem
+ CHECKBOX_LEFT_GAP = CATEGORY_OFFSET;
}
+
parseOption(template.getOption());
}
protected void parseOption(List<Option> optionList) {
+ super.parseOption(optionList);
for (Option option : optionList) {
- if (option.getName().equals(OptionType.DEFAULT_ON_CREATE.getName())) {
- useDefaultOnCreate = true;
- if(option.getValue().equals(VALUE_ON)) {
- defaultOnCreate = true;
- }
- }
if (option.getName().equals(OptionType.DEFAULT_IF_EMPTY.getName())) {
if(option.getValue().equals(VALUE_OFF)) {
defaultIfEmpty = false;
}
}
+ public void setTitleLabelEnabled(boolean enabled) {
+ titleLabel.setEnabled(enabled);
+ if (enabled) {
+ titleLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
+ } else {
+ titleLabel.setForeground(ColorResources.DETAIL_DISABLE_FONT_COLOR.getColor());
+ }
+ }
+
+ public void setTitleToolTipText(String text) {
+ titleLabel.setToolTipText(text);
+ }
+
+ public boolean getValue() {
+ return newValue;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
@Override
public void drawDetail() {
// checkbox image
- detailCheckBox = new ImageButton(comp, SWT.NONE);
+ detailCheckBox = new CheckBoxButton(comp, SWT.NONE);
detailCheckBox.setImages(ImageResources.CHECKBOX_ON_DIS.getImage(), // on normal
ImageResources.CHECKBOX_ON_DIS.getImage(),
ImageResources.CHECKBOX_ON_DIS.getImage(),
ImageResources.CHECKBOX_OFF_DIS.getImage(), // off normal
ImageResources.CHECKBOX_OFF_DIS.getImage(),
ImageResources.CHECKBOX_OFF_DIS.getImage(),
+ ImageResources.CHECKBOX_ON_DIS.getImage(), // disable
ImageResources.CHECKBOX_OFF_DIS.getImage()); // disable
FormData data = new FormData();
// text label
titleLabel = new Label(comp, SWT.NONE);
titleLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- titleLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
titleLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
// titleLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont());
data.width = TITLE_WIDTH;
titleLabel.setLayoutData(data);
titleLabel.setText(title);
-
+ setTitleLabelEnabled(false);
}
@Override
public void drawModify() {
// checkbox
- modifyCheckBox = new ImageButton(comp, SWT.TOGGLE);
- modifyCheckBox.setImages(ImageResources.CHECKBOX_ON.getImage(), // on normal
- ImageResources.CHECKBOX_ON.getImage(),
- ImageResources.CHECKBOX_ON.getImage(),
- ImageResources.CHECKBOX_OFF.getImage(), // off normal
- ImageResources.CHECKBOX_OFF.getImage(),
- ImageResources.CHECKBOX_OFF.getImage(),
-// ImageResources.CHECKBOX_OFF_DIS.getImage(), // disable
- ImageResources.CHECKBOX_ON_DIS.getImage()); // disable
-
- modifyCheckBox.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (modifyCheckBox.isSelection()) { // NOT SUPPORT
- newValue = false;
-
- } else { // SUPPORT
- newValue = true;
-
- }
- if (!parentItem.isCreateMode()) {
- parentItem.getListener().ChangeValue(parentItem.getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
+ modifyCheckBox = new CheckBoxButton(comp, SWT.TOGGLE);
+ modifyCheckBox.setImages(ImageResources.CHECKBOX_OFF.getImage(), // on normal
+ ImageResources.CHECKBOX_OFF.getImage(), // hover
+ ImageResources.CHECKBOX_OFF.getImage(), // pushed
+ ImageResources.CHECKBOX_ON.getImage(), // select
+ ImageResources.CHECKBOX_ON.getImage(), // select_hover
+ ImageResources.CHECKBOX_ON.getImage(), // select_pushed
+ ImageResources.CHECKBOX_ON_DIS.getImage(), // disable_normal
+ ImageResources.CHECKBOX_OFF_DIS.getImage()); // disable_select
FormData data = new FormData();
data = new FormData();
// text label
titleLabel = new Label(comp, SWT.NONE);
titleLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- titleLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
titleLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
// titleLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont());
data.width = TITLE_WIDTH;
titleLabel.setLayoutData(data);
titleLabel.setText(title);
+ setTitleLabelEnabled(true);
- addListener();
+ addTitleLabelListener();
+ addCheckboxListener();
+ }
+
+ protected void addCheckboxListener() {
+ modifyCheckBox.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (modifyCheckBox.isSelection()) {
+ oldValue = newValue = true;
+
+ } else {
+ oldValue = newValue = false;
+ }
+
+ if (parentItem.isCreateMode()) {
+ parentItem.getListener().changeConfirmButton();
+ } else {
+ parentItem.getListener().changeConfirmButton(
+ parentItem.getThis());
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+ }
+ });
}
@Override
public boolean settingModifyItem(VMPropertyValue value) {
// Set value.
- if (parentItem.isCreateMode() && useDefaultOnCreate) {
- newValue = oldValue = defaultOnCreate;
- } else {
- String onOffVal = value.getAdvancedOptionSubValue(parentItem.getName(), name).toLowerCase();
- newValue = oldValue = checkOnOff(onOffVal);
- }
+ String val = getModifyValue(value);
+ newValue = oldValue = checkOnOff(val);
// Set enable/disable
if (parentItem.isCreateMode() && disableOnCreate) {
- modifyCheckBox.setEnabled(false);
- titleLabelMouseEnable = false;
+ setEnabled(false);
} else {
- modifyCheckBox.setEnabled(true);
- titleLabelMouseEnable = true;
+ setEnabled(true);
}
// Set checkbox state.
- modifyCheckBox.setSelection( newValue ? false : true); // false is checked.
-
+ modifyCheckBox.setChecked(newValue);
+ modifyCheckBox.notifyListeners(SWT.Selection, new Event());
+ setItemState();
return false;
}
}
public void setCheckBox(boolean checked) {
- if (checked) {
- newValue = true;
- modifyCheckBox.setSelection(false);
- } else {
- newValue = false;
- modifyCheckBox.setSelection(true);
- }
- if (!parentItem.isCreateMode()) {
- parentItem.getListener().ChangeValue(parentItem.getThis());
+ if (modifyCheckBox != null) {
+ oldValue = newValue = checked;
+ modifyCheckBox.setSelection(checked);
+
+ if (parentItem.isCreateMode()) {
+ parentItem.getListener().changeConfirmButton();
+ } else {
+ parentItem.getListener().changeConfirmButton(
+ parentItem.getThis());
+ }
}
}
- private boolean checkOnOff(String onOffVal) {
+ protected boolean checkOnOff(String onOffVal) {
if (onOffVal.equals(VALUE_ON)) {
return true;
} else if (onOffVal.equals(VALUE_OFF)) {
if (labelRect.contains(event.x, event.y)) {
if (clickedLabel == label) {
label.redraw();
+ modifyCheckBox.setChecked(!modifyCheckBox.isSelection());
label.notifyListeners(SWT.Selection, new Event());
//notifyListeners(SWT.DefaultSelection, new Event());
}
@Override
public void widgetSelected(SelectionEvent e) {
- if (modifyCheckBox.isSelection()) { // NOT SUPPORT
- setCheckBox(true); // change check-box
+ if (modifyCheckBox.isSelection()) {
+ setCheckBox(true);
- } else { // SUPPORT
+ } else {
setCheckBox(false);
}
+
+ modifyCheckBox.notifyListeners(SWT.Selection, new Event());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
};
- private void addListener() {
-
+ protected void addTitleLabelListener() {
titleLabel.addListener(SWT.MouseDown, mouseListener);
titleLabel.addListener(SWT.MouseUp, mouseListener);
titleLabel.addListener(SWT.MouseEnter, mouseListener);
titleLabel.addListener(SWT.MouseExit, mouseListener);
titleLabel.addListener(SWT.Selection, new TypedListener(selectionListener));
-
modifyCheckBox.addListener(SWT.MouseEnter, mouseListener);
+ }
+ public String getItemValue(VMPropertyValue value) {
+ return value.getAdvancedOptionSubValue(parentItem.getName(), name).toLowerCase();
}
+ public void setEnabled(boolean enabled) {
+ modifyCheckBox.setEnabled(enabled);
+ titleLabelMouseEnable = enabled;
+ setTitleLabelEnabled(enabled);
+ }
+ public void setChecked(boolean checked) {
+ oldValue = newValue = checked;
+ modifyCheckBox.setChecked(checked);
+ }
}
protected Image INPUTBOX_ON_IMAGE = null;
protected static int COMBO_WIDTH = 105;
- protected boolean useDefaultOnCreate = false;
- protected String defaultOnCreate = null;
-
public ComboSubViewItem(LabelViewItem parentItem, Composite comp, Item template) {
super(parentItem, comp, template);
parseOption(template.getOption());
}
+ @Override
protected void parseOption(List<Option> optionList) {
+ super.parseOption(optionList);
for (Option option : optionList) {
if (option.getName().equals(OptionType.COMBO_LIST.getName())) {
String[] split = option.getValue().split(",");
comboOptions.add(s.trim());
}
}
-
- if (option.getName().equals(OptionType.DEFAULT_ON_CREATE.getName())) {
- useDefaultOnCreate = true;
- defaultOnCreate = option.getValue();
- }
}
}
combo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
combo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
combo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
+ combo.setImage(WSTATE.DISABLE_ON, INPUTBOX_ON_IMAGE);
combo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
combo.setEnabled(true);
@Override
public boolean settingModifyItem(VMPropertyValue value) {
- if (parentItem.isCreateMode() && useDefaultOnCreate) {
- newValue = defaultOnCreate;
- } else {
- newValue = value.getAdvancedOptionSubValue(parentItem.getName(), name);
- }
+ newValue = getModifyValue(value);
// make combo box list
combo.removeAll();
combo.select(index);
}
}
+
+ setItemState();
return true;
}
}
}
+ @Override
+ public void setEnabled(boolean enabled) {
+ combo.setEnabled(enabled);
+ }
}
protected Image INPUTBOX_OFF_IMAGE = null;
protected int COMBOBOX_WIDTH = 175;
- private boolean useDefaultOnCreate = false;
- private String defaultOnCreate = null;
+ protected boolean useDefaultOnCreate = false;
+ protected String defaultOnCreate = null;
+
+ public String getValue()
+ {
+ return newValue;
+ }
public ComboViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
super(lineLabelViewItem);
if (INPUTBOX_ON_IMAGE != null) {
INPUTBOX_ON_IMAGE.dispose();
}
+ if (INPUTBOX_OFF_IMAGE != null) {
+ INPUTBOX_OFF_IMAGE.dispose();
+ }
}
@Override
INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(COMBOBOX_WIDTH);
}
+ if (INPUTBOX_OFF_IMAGE == null) {
+ INPUTBOX_OFF_IMAGE = PatchImageResources.getInputBoxOff(COMBOBOX_WIDTH);
+ }
+
combo = new ImageCombo(compList.get(0), SWT.NONE);
combo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
combo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
combo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
+ combo.setImage(WSTATE.DISABLE_ON, INPUTBOX_ON_IMAGE);
combo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
combo.setEnabled(true);
return true;
}
+ public void resetCombo() {
+
+ }
+
}
public FileSubViewItem(LabelViewItem parentItem, Composite comp, Item template) {
super(parentItem, comp, template);
+ super.parseOption(template.getOption());
List<Option> optionList = template.getOption();
for (Option option : optionList) {
if (option.getName().equals(OptionType.FILE_FILTER.getName())) {
@Override
public boolean settingModifyItem(VMPropertyValue value) {
- newValue = value.getAdvancedOptionSubValue(parentItem.getName(), name);
+ newValue = getModifyValue(value);
String fileName = newValue.substring(newValue
.lastIndexOf(File.separator) + 1, newValue.length());
filePathLabel.setText(fileName);
filePathLabel.setToolTipText(newValue);
+ setItemState();
return true;
}
- public void setEnable(boolean enable) {
- selectFileButton.setEnabled(enable);
+ @Override
+ public void setEnabled(boolean enabled) {
+ selectFileButton.setEnabled(enabled);
}
@Override
}
}
+
}
public void setValue(VMPropertyValue value);
public boolean settingModifyItem(VMPropertyValue value);
public void closeItem();
+ public String getName();
+ public void setEnabled(boolean enabled);
+ public Boolean getModifyEnable();
+ public void setModifyEnable(boolean enable);
+ public String getItemValue(VMPropertyValue value);
+ public String getModifyValue(VMPropertyValue value);
}
protected Item template;
boolean isDeviceItem;
boolean spreadOnStart = true;
+ protected boolean modifyEnable = true;
public LabelViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
super(lineLabelViewItem);
private void parseOption(List<Option> optionList) {
for (Option option : optionList) {
if (option.getName().equals(OptionType.SPREAD_ON_START.getName())) {
- if(option.getValue().equals("false")) {
+ if(option.getValue().equals(OptionType.VALUE_FALSE)){
this.spreadOnStart = false;
}
+
+ } else if (option.getName().equals(OptionType.MODIFY_ENABLE.getName())) {
+ if (option.getValue().equals(OptionType.VALUE_FALSE)) {
+ modifyEnable = false;
+ }
}
}
}
public void drawModify() {
for (ISubViewItem subItem : getSubItemList()) {
subItem.drawModify();
+ if (subItem.getModifyEnable() == null) {
+ subItem.setModifyEnable(modifyEnable);
+ }
}
}
@Override
public boolean settingModifyItem(VMPropertyValue value) {
- onOffButton.setEnabled(true);
- boolean onOff = value.getAdvancedOptionSubValue(parentItem.getName(), name)
- .toLowerCase().equals(VALUE_ON) ? true : false;
- newValue = oldValue = onOff;
+ String val = getModifyValue(value);
+ newValue = oldValue = val.equals(VALUE_ON) ? true : false;
if (oldValue) {
onOffButton.setSelection(false);
onOffButton.setSelection(true);
buttonLabel.setText(StringResources.NOT_SUPPORTED);
}
+ setItemState();
return true;
}
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.PatchImageResources;
import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
+import org.tizen.emulator.manager.ui.widgets.CustomSpinner;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
import org.tizen.emulator.manager.vms.VMPropertyValue;
import org.tizen.emulator.manager.vms.xml.template.Item;
protected int newValue;
// for modify view
- protected Spinner spinner;
+// protected Spinner spinner;
+ protected CustomSpinner spinner;
protected int SPINNER_WIDTH = 105;
private Image INPUTBOX_ON_IMAGE = null;
valueLabel.setLayout(new FormLayout());
- spinner = new Spinner(valueLabel, SWT.NONE);
- spinner.setValues(0, 0, 999, 0, 1, 1);
+// spinner = new Spinner(valueLabel, SWT.NONE);
+ spinner = new CustomSpinner(valueLabel, SWT.NONE);
+ spinner.setValues(0, 0, 999, 0, 1, 10);
spinner.setTextLimit(3);
-
+//
spinner.setBackground(ColorResources.DETAIL_INPUT_BOX_COLOR.getColor());
spinner.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
spinner.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
data = new FormData();
data.left = new FormAttachment(0, 5);
- data.top = new FormAttachment(0, 1);
- data.right = new FormAttachment(100, -2);
+ data.top = new FormAttachment(0, 2);
+ data.right = new FormAttachment(100, -5);
data.bottom = new FormAttachment(100, -2);
spinner.setLayoutData(data);
package org.tizen.emulator.manager.ui.detail.item.template;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.widgets.Composite;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.PatchImageResources;
+import org.tizen.emulator.manager.ui.detail.item.OptionType;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
import org.tizen.emulator.manager.vms.xml.template.Item;
+import org.tizen.emulator.manager.vms.xml.template.Option;
public abstract class SubViewItem implements ISubViewItem {
// for category
protected static int LABEL_WIDTH = 105;
protected static int TOP_GAP = 3;
+ protected boolean useDefaultOnCreate = false;
+ protected String defaultOnCreate = null;
+ protected Boolean modifyEnable = null;
+
+
public SubViewItem(LabelViewItem parentItem, Composite comp, Item template) {
this.parentItem = parentItem;
this.comp = comp;
this.title = template.getTitle();
}
+ protected void parseOption(List<Option> optionList) {
+ for (Option option : optionList) {
+ if (option.getName().equals(OptionType.DEFAULT_ON_CREATE.getName())) {
+ useDefaultOnCreate = true;
+ defaultOnCreate = option.getValue();
+
+ } else if (option.getName().equals(OptionType.MODIFY_ENABLE.getName())) {
+ if (option.getValue().equals(OptionType.VALUE_FALSE)) {
+ modifyEnable = false;
+
+ } else if (option.getValue().equals(OptionType.VALUE_TRUE)) {
+ modifyEnable = true;
+ }
+ }
+ }
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
@Override
public void drawDetail() {
// draw category
}
}
+ @Override
+ public void setEnabled(boolean enabled) {}
+
+ @Override
+ public Boolean getModifyEnable() {
+ return modifyEnable;
+ }
+
+ @Override
+ public void setModifyEnable(boolean enable){
+ modifyEnable = enable;
+ }
+
+ public void setItemState() {
+ if (modifyEnable != null) {
+ setEnabled(modifyEnable);
+ }
+ }
+
+ @Override
+ public String getItemValue(VMPropertyValue value) {
+ return value.getAdvancedOptionSubValue(parentItem.getName(), name);
+ }
+
+ @Override
+ public String getModifyValue(VMPropertyValue value) {
+ if (parentItem.isCreateMode() && useDefaultOnCreate) {
+ return defaultOnCreate;
+
+ } else {
+ return getItemValue(value);
+ }
+ }
}
valueLabel = new ImageLabel(comp, SWT.NONE);
valueLabel.setEnableImage(INPUTBOX_ON_IMAGE);
- valueLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
+// valueLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
valueLabel.setLayout(new FormLayout());
FormData data = new FormData();
@Override
public boolean settingModifyItem(VMPropertyValue value) {
- newValue = value.getAdvancedOptionSubValue(parentItem.getName(), name);
+ newValue = getModifyValue(value);
text.setText(newValue);
+ setItemState();
return false;
}
- @Override
- public void closeItem() {
- super.closeItem();
+ public void setEnabled(boolean enabled) {
+ valueLabel.setEnabled(enabled);
+ text.setEnabled(enabled);
+ }
+
+ public void resetText(boolean enabled) {
+
+ if (enabled) {
+ // enable text input
+ setEnabled(true);
+ newValue = oldValue; // restore
+
+ } else {
+ // disable text input
+ setEnabled(false);
+ oldValue = newValue; // save
+ newValue = "";
+ }
- if (INPUTBOX_ON_IMAGE != null) {
- INPUTBOX_ON_IMAGE.dispose();
+ if (newValue != null) {
+ text.setText(newValue);
}
}
package org.tizen.emulator.manager.ui.detail.item.template;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.tizen.emulator.manager.ui.detail.item.AdvancedViewItem;
import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
+import org.tizen.emulator.manager.ui.detail.item.OptionType;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
import org.tizen.emulator.manager.vms.VMProperty;
import org.tizen.emulator.manager.vms.VMPropertyValue;
import org.tizen.emulator.manager.vms.xml.template.Item;
+import org.tizen.emulator.manager.vms.xml.template.Option;
public class TextViewItem extends AdvancedViewItem{
protected Image INPUTBOX_ON_IMAGE = null;
protected Image INPUTBOX_OFF_IMAGE = null;
+ protected boolean modifyEnable = true;
+ protected boolean useDefaultOnCreate = false;
+ protected String defaultOnCreate = null;
+
+ protected String VALUE_FALSE = "false";
+
public TextViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
super(lineLabelViewItem);
if (lineLabelViewItem == null) {
name = template.getName();
title = template.getTitle();
count = 1;
+ parseOption(template.getOption());
+ }
+
+ protected void parseOption(List<Option> optionList) {
+ for (Option option : optionList) {
+ if (option.getName().equals(OptionType.DEFAULT_ON_CREATE.getName())) {
+ useDefaultOnCreate = true;
+ defaultOnCreate = option.getValue();
+
+ } else if (option.getName().equals(OptionType.MODIFY_ENABLE.getName())) {
+ if (option.getValue().equals(VALUE_FALSE)) {
+ modifyEnable = false;
+ }
+ }
+ }
}
@Override
@Override
public void drawModify() {
+ if (modifyEnable) {
+ if (INPUTBOX_ON_IMAGE == null) {
+ INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH);
+ }
- if (INPUTBOX_ON_IMAGE == null) {
- INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH);
- }
+ if (INPUTBOX_OFF_IMAGE == null) {
+ INPUTBOX_OFF_IMAGE = PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH);
+ }
- if (INPUTBOX_OFF_IMAGE == null) {
- INPUTBOX_OFF_IMAGE = PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH);
- }
+ valueLabel = new ImageLabel(compList.get(0), SWT.NONE);
+ valueLabel.setEnableImage(INPUTBOX_ON_IMAGE);
+ // valueLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
+ valueLabel.setLayout(new FormLayout());
- valueLabel = new ImageLabel(compList.get(0), SWT.NONE);
- valueLabel.setEnableImage(INPUTBOX_ON_IMAGE);
-// valueLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
- valueLabel.setLayout(new FormLayout());
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, INPUTBOX_OFFSET);
+ data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
+ data.width = valueLabel.getSize().x;
+ data.height = valueLabel.getSize().y;
+ valueLabel.setLayoutData(data);
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = valueLabel.getSize().x;
- data.height = valueLabel.getSize().y;
- valueLabel.setLayoutData(data);
+ text = new Text(valueLabel, SWT.NONE);
+ text.setBackground(ColorResources.DETAIL_INPUT_BOX_COLOR.getColor());
+ text.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
+ text.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
+ text.setTextLimit(VMProperty.MAX_NAME_LEN);
- text = new Text(valueLabel, SWT.NONE);
- text.setBackground(ColorResources.DETAIL_INPUT_BOX_COLOR.getColor());
- text.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- text.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- text.setTextLimit(VMProperty.MAX_NAME_LEN);
+ data = new FormData();
+ data.left = new FormAttachment(0, 5);
+ data.top = new FormAttachment(0, 2);
+ data.right = new FormAttachment(100, -5);
+ data.bottom = new FormAttachment(100, -2);
+ text.setLayoutData(data);
+ addListener();
- data = new FormData();
- data.left = new FormAttachment(0, 5);
- data.top = new FormAttachment(0, 2);
- data.right = new FormAttachment(100, -5);
- data.bottom = new FormAttachment(100, -2);
- text.setLayoutData(data);
+ } else {
+ valueLabel = new ImageLabel(compList.get(0), SWT.NONE);
+ valueLabel.setDisableImage(PatchImageResources.getInputBoxON(INPUTBOX_WIDTH));
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, INPUTBOX_OFFSET);
+ data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
+ data.width = valueLabel.getSize().x;
+ data.height = valueLabel.getSize().y;
+ valueLabel.setLayoutData(data);
+ valueLabel.setEnabled(false);
+ }
- addListener();
}
@Override
public void modifyText(ModifyEvent e) {
newValue = text.getText();
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
+ if (isCreateMode()) {
+ getListener().changeConfirmButton();
+
+ } else {
+ getListener().changeConfirmButton(getThis());
}
}
});
@Override
public boolean settingModifyItem(VMPropertyValue value) {
- newValue = value.getAdvancedOptionValue(name);
- text.setText(newValue);
+ if (isCreateMode() && useDefaultOnCreate) {
+ newValue = defaultOnCreate;
+
+ } else {
+ newValue = value.getAdvancedOptionValue(name);
+ }
+
+ if (modifyEnable) {
+ text.setText(newValue);
+
+ } else {
+ valueLabel.setText(newValue);
+ }
return false;
}
return true;
}
+ @Override
+ public void setEnabled(boolean enabled) {
+ valueLabel.setEnabled(enabled);
+ text.setEnabled(enabled);
+ }
+
+ public void resetText(boolean enabled) {
+
+ if (enabled) {
+ // enable text input
+ setEnabled(true);
+ newValue = oldValue; // restore
+
+ } else {
+ // disable text input
+ setEnabled(false);
+ oldValue = newValue; // save
+ newValue = "";
+ }
+
+ if (newValue != null) {
+ text.setText(newValue);
+ }
+ }
+
}
package org.tizen.emulator.manager.ui.dialog;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.MainDialog;
}
}
+ public void close() {
+ if (dialog != null && !dialog.isDisposed()) {
+ dialog.close();
+ }
+ }
+
+ public void openNoButtonInfoDialog(final String message) {
+ String title = "Emulator Manager";
+ int icon_style = SWT.ICON_INFORMATION;
+ dialog = new Shell(shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+ dialog.setText(title);
+ dialog.setLayout(new GridLayout(2, false));
+ dialog.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+
+ Label icon = new Label(dialog, SWT.NONE);
+ icon.setImage(Display.getCurrent().getSystemImage(icon_style));
+ icon.pack();
+
+ Label text = new Label(dialog, SWT.NONE);
+ text.setText(message);
+ text.pack();
+
+ int x = icon.getSize().x + text.getSize().x;
+ int y = 0;
+ if (icon.getSize().y > text.getSize().y ) {
+ y = icon.getSize().y;
+ } else {
+ y = text.getSize().y;
+ }
+
+ dialog.setSize(x + 50, y + 60);
+
+ if (MainDialog.getShell() != null) {
+ Point p = MainDialog.getShell().getLocation();
+ Point s = MainDialog.getShell().getSize();
+ dialog.setLocation(p.x + (s.x>>2), p.y + (s.y>>2));
+ }
+
+ dialog.open();
+
+ }
+
public int openInfoDialog(final String message) {
return openInfoDialog("Emulator Manager", message);
}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * sangho Park <sangho1206.park@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.manager.ui.widgets;
+
+import org.eclipse.swt.widgets.Composite;
+
+public class CheckBoxButton extends ImageButton {
+
+ public CheckBoxButton(Composite parent, int style) {
+ super(parent, style);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ @Override
+ public boolean isSelection() {
+ if (state == WSTATE.SELECTED ||
+ state == WSTATE.SELECTED_HOVER || state == WSTATE.SELECTED_PUSH ||
+ state == WSTATE.DISABLE_ON) {
+ return true;
+
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean enable) {
+ int tmpStateId = state.getId();
+ super.setEnabled(enable);
+ state = WSTATE.getState(tmpStateId);
+
+ if (state == WSTATE.SELECTED || state == WSTATE.SELECTED_HOVER ||
+ state == WSTATE.SELECTED_PUSH || state == WSTATE.DISABLE_ON) {
+ state = enable ? WSTATE.SELECTED : WSTATE.DISABLE_ON;
+
+ } else {
+ state = enable ? WSTATE.NORMAL : WSTATE.DISABLE_OFF;
+ }
+ redraw();
+ }
+
+
+ public void setChecked(boolean checked) {
+ selected = checked;
+ if (state == WSTATE.DISABLE_ON || state == WSTATE.DISABLE_OFF) {
+ state = checked ? WSTATE.DISABLE_ON : WSTATE.DISABLE_OFF;
+
+ } else {
+ state = checked ? WSTATE.SELECTED : WSTATE.NORMAL;
+ }
+ redraw();
+ }
+
+ @Override
+ public void setSelection(boolean selected) {
+ setChecked(selected);
+ redraw();
+ }
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * MunKyu Im <munkyu.im@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * Minkee Lee <minkee.lee@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.manager.ui.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.TypedListener;
+import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.resources.ImageResources;
+import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.ui.VMsMainView;
+import org.tizen.emulator.manager.ui.dialog.MessageDialog;
+
+public class CustomSpinner extends Composite {
+
+ private Text text;
+ private Canvas arrowUp;
+ private Canvas arrowDown;
+
+ private int selection;
+ private int min;
+ private int max;
+ private int digits;
+ private int increment;
+ private int pageIncrement;
+
+ private boolean isArrowPressed = false;
+
+ private LongPressWorker longPressWorker;
+
+ public boolean isArrowPressed() {
+ return isArrowPressed;
+ }
+
+ public int getIncrement() {
+ return increment;
+ }
+
+ public Text getText() {
+ return text;
+ }
+
+ private Image arrowUpImage = ImageResources.SPINNER_UP.getImage();
+ private Image arrowDownImage = ImageResources.SPINNER_DOWN.getImage();
+
+ public CustomSpinner(Composite parent, int style) {
+ super(parent, style);
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginBottom = 0;
+ gridLayout.marginTop = 0;
+ gridLayout.marginLeft = 0;
+ gridLayout.marginRight = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.verticalSpacing = 1;
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.numColumns = 2;
+ this.setLayout(gridLayout);
+
+ text = new Text(this, SWT.NONE);
+ GridData textData = new GridData();
+ textData.verticalSpan = 2;
+ textData.verticalAlignment = GridData.FILL;
+ textData.horizontalAlignment = GridData.FILL;
+ textData.grabExcessHorizontalSpace = true;
+ textData.grabExcessVerticalSpace = true;
+ text.setLayoutData(textData);
+
+ arrowUp = new Canvas(this, SWT.NONE);
+ GridData arrowUpData = new GridData();
+ arrowUpData.verticalAlignment = GridData.FILL;
+ arrowUpData.widthHint = 8;
+ arrowUpData.grabExcessVerticalSpace = true;
+ arrowUp.setLayoutData(arrowUpData);
+
+ arrowDown = new Canvas(this, SWT.NONE);
+ GridData arrowDownData = new GridData();
+ arrowDownData.verticalAlignment = GridData.FILL;
+ arrowDownData.grabExcessVerticalSpace = true;
+ arrowDownData.widthHint = 8;
+ arrowDown.setLayoutData(arrowDownData);
+
+ addTextListener();
+ addArrowPaintListener();
+ addArrowButtonListener();
+ if (EmulatorManager.isLinux()) { // TODO solve windows problem. & check
+ // Mac
+ addMouseWheelListener();
+ }
+ addDisposeListener();
+ }
+
+ public void setValues(int selection, int min, int max, int digits,
+ int increment, int pageIncrement) {
+ this.selection = selection;
+ this.min = min;
+ this.max = max;
+ this.digits = digits;
+ this.increment = increment;
+ this.pageIncrement = pageIncrement;
+ }
+
+ public void setTextLimit(int textLimit) {
+ text.setTextLimit(textLimit);
+ }
+
+ public void setBackground(Color color) {
+ text.setBackground(color);
+ arrowUp.setBackground(color);
+ arrowDown.setBackground(color);
+ }
+
+ public void setForeground(Color color) {
+ text.setForeground(color);
+ arrowUp.setForeground(color);
+ arrowDown.setForeground(color);
+ }
+
+ public void setFont(Font font) {
+ text.setFont(font);
+ }
+
+ public void setSelection(int value) {
+ selection = value;
+ if (selection > max) {
+ selection = max;
+ }
+ if (selection < min) {
+ selection = min;
+ }
+ text.setText(String.valueOf(selection));
+ text.selectAll();
+ }
+
+ public int getSelection() {
+ return selection;
+ }
+
+ public void addModifyListener(ModifyListener listener) {
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Modify, typedListener);
+ }
+
+ public void addKeyListener(KeyAdapter listener) {
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.KeyDown, typedListener);
+ }
+
+ private void addTextListener() {
+
+ // Text input
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent event) {
+
+ // If modify event is from setText() call, return.
+ if (String.valueOf(selection).equals(text.getText())) {
+ text.getParent().notifyListeners(SWT.Modify, new Event());
+ return;
+ }
+
+ // Check if text is integer.
+ Text widget = (Text) event.widget;
+ String textValue = widget.getText();
+ if (!textValue.isEmpty()) {
+ try {
+ selection = Integer.parseInt(widget.getText());
+
+ } catch (NumberFormatException e) {
+ int pos = text.getCaretPosition();
+ text.setText(String.valueOf(selection));
+ text.setSelection(pos - 1);
+ EMLogger.getLogger().info(
+ " textModify : " + e.getMessage());
+ }
+
+ } else {
+ selection = 0;
+ text.setText("0");
+ }
+
+ if (selection == 0) {
+ text.selectAll();
+ }
+
+ text.getParent().notifyListeners(SWT.Modify, new Event());
+ }
+ });
+
+ // cursor, page up/down
+ text.addListener(SWT.KeyDown, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ if (event.type == SWT.KeyDown) {
+
+ switch (event.keyCode) {
+ case SWT.ARROW_UP:
+ setSelection(selection + increment);
+ // In windows, arrow up event makes cursor move to
+ // right.
+ // "doit = false" prevent this.
+ event.doit = false;
+ break;
+
+ case SWT.ARROW_DOWN:
+ setSelection(selection - increment);
+ // In windows, arrow down event makes cursor move to
+ // right.
+ // "doit = false" prevent this.
+ event.doit = false;
+ break;
+
+ case SWT.PAGE_UP:
+ setSelection(selection + pageIncrement);
+ break;
+
+ case SWT.PAGE_DOWN:
+ setSelection(selection - pageIncrement);
+ break;
+
+ default:
+ text.getParent().notifyListeners(SWT.KeyDown, event);
+ return;
+ }
+ text.selectAll();
+
+ }
+ }
+ });
+
+ }
+
+ private void addMouseWheelListener() {
+ addListener(SWT.MouseVerticalWheel, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ // TODO Auto-generated method stub
+
+ switch (event.type) {
+ case SWT.MouseVerticalWheel:
+ ((Composite) event.widget).setFocus(); // bring focus.
+
+ if (event.count > 0) { // scroll up
+ setSelection(selection + increment);
+
+ } else {
+ setSelection(selection - increment);
+ }
+
+ text.selectAll();
+ event.doit = false; // stop scroll event propagation.
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ });
+ }
+
+ private void addArrowButtonListener() {
+
+ // ArrowUp button listener
+ Listener arrowUpMouseListener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ // TODO Auto-generated method stub
+
+ switch (event.type) {
+ case SWT.MouseDown:
+ // Increase spinner value.
+ Canvas widget = (Canvas) event.widget;
+ int arrowIncrement = (widget == arrowUp) ? increment
+ : increment * -1;
+ setSelection(selection + arrowIncrement);
+ setFocus();
+ isArrowPressed = true;
+
+ // Start long-press worker.
+ longPressWorker = new LongPressWorker(arrowIncrement,
+ (CustomSpinner) ((Composite) event.widget)
+ .getParent());
+ longPressWorker.start();
+ break;
+
+ case SWT.MouseUp:
+ // Stop long press worker
+ isArrowPressed = false;
+ if (longPressWorker.isAlive()) {
+ longPressWorker.interrupt();
+ }
+ break;
+
+ case SWT.MouseMove:
+ if (isArrowPressed) {
+ Rectangle rect = ((Canvas) event.widget)
+ .getClientArea();
+ if (!rect.contains(event.x, event.y)) {
+ // Stop long press worker
+ isArrowPressed = false;
+ if (longPressWorker.isAlive()) {
+ longPressWorker.interrupt();
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ };
+ arrowUp.addListener(SWT.MouseDown, arrowUpMouseListener);
+ arrowUp.addListener(SWT.MouseUp, arrowUpMouseListener);
+ arrowUp.addListener(SWT.MouseMove, arrowUpMouseListener);
+
+ arrowDown.addListener(SWT.MouseDown, arrowUpMouseListener);
+ arrowDown.addListener(SWT.MouseUp, arrowUpMouseListener);
+ arrowDown.addListener(SWT.MouseMove, arrowUpMouseListener);
+ }
+
+ private void addDisposeListener() {
+ addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent event) {
+ CustomSpinner spinner = (CustomSpinner) event.widget;
+ spinner.dispose();
+ }
+
+ });
+ }
+
+ private void addArrowPaintListener() {
+ arrowUp.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ // TODO Auto-generated method stub
+ Canvas canvas = (Canvas) e.widget;
+ int w = canvas.getBounds().width;
+ int h = canvas.getBounds().height;
+
+ e.gc.drawImage(arrowUpImage, 0, h
+ - arrowUpImage.getImageData().height);
+ }
+ });
+
+ arrowDown.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ Canvas canvas = (Canvas) e.widget;
+ int w = canvas.getBounds().width;
+ int h = canvas.getBounds().height;
+
+ e.gc.drawImage(arrowDownImage, 0, 0);
+
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ if (text != null) {
+ text.dispose();
+ }
+ if (arrowUpImage != null) {
+ arrowUpImage.dispose();
+ }
+ if (arrowDownImage != null) {
+ arrowDownImage.dispose();
+ }
+ if (arrowUp != null) {
+ arrowUp.dispose();
+ }
+ if (arrowDown != null) {
+ arrowDown.dispose();
+ }
+ }
+
+ @Override
+ public boolean setFocus() {
+ boolean res = text.setFocus();
+ text.selectAll();
+ return res;
+ }
+}
+
+class LongPressWorker extends Thread {
+ CustomSpinner spinner;
+ int increment;
+
+ public LongPressWorker(int increment, CustomSpinner spinner) {
+ this.increment = increment;
+ this.spinner = spinner;
+ }
+
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(500); // Increase start delay.
+ } catch (InterruptedException e) {
+ return;
+ }
+
+ while (true) {
+ if (!spinner.isArrowPressed()) {
+ break;
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ spinner.setSelection(spinner.getSelection() + increment);
+ spinner.setFocus();
+ }
+ });
+
+ try {
+ Thread.sleep(50); // count up delay while long pressed.
+ } catch (InterruptedException e) {
+ return;
+ }
+ }
+ }
+}
images.add(s.getId(), null);
}
- fontColors.set(WSTATE.DISABLE.getId(),
+ fontColors.set(WSTATE.DISABLE_ON.getId(),
ColorResources.BUTTON_DISABLE_FONT_COLOR.getColor());
if (checkStyle(style, SWT.RADIO)) {
images.set(WSTATE.NORMAL.getId(), normal);
images.set(WSTATE.HOVER.getId(), hover);
images.set(WSTATE.PUSH.getId(), pushed);
- images.set(WSTATE.DISABLE.getId(), disable);
+ images.set(WSTATE.DISABLE_ON.getId(), disable);
if (checkStyle(style, SWT.PUSH)) {
defaultPush = false;
images.set(WSTATE.SELECTED.getId(), selected);
images.set(WSTATE.SELECTED_HOVER.getId(), selected_hover);
images.set(WSTATE.SELECTED_PUSH.getId(), selected_push);
- images.set(WSTATE.DISABLE.getId(), disable);
+ images.set(WSTATE.DISABLE_ON.getId(), disable);
+
+ if (checkStyle(style, SWT.PUSH)) {
+ defaultPush = false;
+ }
+ redraw();
+ }
+
+ public void setImages(Image normal, Image hover, Image pushed,
+ Image selected, Image selected_hover, Image selected_push, Image disable_on, Image disable_off) {
+ images.set(WSTATE.NORMAL.getId(), normal);
+ images.set(WSTATE.HOVER.getId(), hover);
+ images.set(WSTATE.PUSH.getId(), pushed);
+ images.set(WSTATE.SELECTED.getId(), selected);
+ images.set(WSTATE.SELECTED_HOVER.getId(), selected_hover);
+ images.set(WSTATE.SELECTED_PUSH.getId(), selected_push);
+ images.set(WSTATE.DISABLE_ON.getId(), disable_on);
+ images.set(WSTATE.DISABLE_OFF.getId(), disable_off);
if (checkStyle(style, SWT.PUSH)) {
defaultPush = false;
fontColors.set(WSTATE.NORMAL.getId(), normal);
fontColors.set(WSTATE.HOVER.getId(), hover);
fontColors.set(WSTATE.PUSH.getId(), pushed);
- fontColors.set(WSTATE.DISABLE.getId(), disable);
+ fontColors.set(WSTATE.DISABLE_ON.getId(), disable);
redraw();
}
fontColors.set(WSTATE.SELECTED.getId(), selected);
fontColors.set(WSTATE.SELECTED_HOVER.getId(), selected_hover);
fontColors.set(WSTATE.SELECTED_PUSH.getId(), selected_push);
- fontColors.set(WSTATE.DISABLE.getId(), disable);
+ fontColors.set(WSTATE.DISABLE_ON.getId(), disable);
redraw();
}
@Override
public void handleEvent(Event event) {
- if (state == WSTATE.DISABLE) {
+ if (state == WSTATE.DISABLE_ON) {
return;
}
public void setSelection(boolean selected) {
if (selected) {
- state = WSTATE.SELECTED;
+ state = (state == WSTATE.DISABLE_OFF) ? state : WSTATE.SELECTED;
this.selected = true;
} else {
- state = state != WSTATE.DISABLE ? WSTATE.NORMAL : WSTATE.DISABLE;
+ state = state != WSTATE.DISABLE_ON ? WSTATE.NORMAL : WSTATE.DISABLE_ON;
this.selected = false;
}
redraw();
@Override
public void setEnabled(boolean enable) {
super.setEnabled(enable);
- state = (enable ? WSTATE.NORMAL : WSTATE.DISABLE);
+ state = (enable ? WSTATE.NORMAL : WSTATE.DISABLE_ON);
+ redraw();
+ }
+
+ public void setEnabled(boolean enable, boolean isOn) {
+ super.setEnabled(enable);
+ if (enable) {
+ state = isOn ? WSTATE.NORMAL : WSTATE.SELECTED;
+
+ } else {
+ state = isOn ? WSTATE.DISABLE_ON : WSTATE.DISABLE_OFF;
+ }
redraw();
}
}
fonts.add(s.getId(), FontResources.COMBO_BUTTON_FONT.getFont());
}
- images.set(WSTATE.DISABLE.getId(),
+ images.set(WSTATE.DISABLE_ON.getId(),
ImageResources.COMBO_DISABLE.getImage());
images.set(WSTATE.HOVER.getId(),
ImageResources.COMBO_HOVER.getImage());
images.set(WSTATE.PUSH.getId(),
ImageResources.COMBO_PUSH.getImage());
- fontColors.add(WSTATE.DISABLE.getId(),
+ fontColors.add(WSTATE.DISABLE_ON.getId(),
ColorResources.COMBO_DISABLE_FONT_COLOR.getColor());
}
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (!enabled) {
- state = WSTATE.DISABLE;
+ state = WSTATE.DISABLE_ON;
} else {
state = WSTATE.NORMAL;
}
e.gc.drawImage(img, x, y);
}
- if (arrowButtonImage != null) {
+ if (arrowButtonImage != null && state != WSTATE.DISABLE_ON) {
int w = arrowButtonImage.getImageData().width;
int h = arrowButtonImage.getImageData().height;
x += rect.width - w - ARROW_OFFSET;
if (selectedText != null) {
e.gc.drawText(selectedText, x, y, true);
}
+
+ if (state == WSTATE.DISABLE_ON) {
+ // draw transparent layer
+ e.gc.setAlpha(150);
+ e.gc.fillRectangle(rect.x + 5, rect.y + 2, rect.width - 10, rect.height - 4);
+ }
}
};
if (enabled) {
state = WSTATE.NORMAL;
} else {
- state = WSTATE.DISABLE;
+ state = WSTATE.DISABLE_ON;
}
this.redraw();
}
@Override
public void handleEvent(Event event) {
- if (state == WSTATE.DISABLE) {
+ if (state == WSTATE.DISABLE_ON) {
return;
}
SELECTED(3),
SELECTED_HOVER(4),
SELECTED_PUSH(5),
- DISABLE(6);
+ DISABLE_ON(6),
+ DISABLE_OFF(7);
private int id;
WSTATE(int id) {
return id;
}
+ public static WSTATE getState(int id) {
+ for (WSTATE state : WSTATE.values()) {
+ if (state.id == id) {
+ return state;
+ }
+ }
+ return WSTATE.NORMAL;
+ }
+
}
private WorkerThread worker = null;
private String baseImagePath = null;
private String baseImagePartPath = null;
+ private Object lock = new Object();
public void initLauncher() {
dialog.Open(destFile, maxSize);
*/
- worker = new WorkerThread(proc);
+ worker = new WorkerThread(proc, lock);
worker.setDaemon(false);
worker.start();
- synchronized(worker) {
+ synchronized(lock) {
try {
- worker.wait(2000);
+ lock.wait(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (EmulatorManager.isConsoleMode()) {
System.out.println("Wait....while creating base image." + StringResources.NEW_LINE
+ "This task can take about 30 ~ 60 seconds");
- synchronized(worker) {
+ synchronized(lock) {
while(worker.isAlive()) {
try {
- worker.wait();
+ lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
class WorkerThread extends Thread {
QemuImgProc proc;
boolean isError;
- public WorkerThread(QemuImgProc proc) {
+ Object lock;
+ public WorkerThread(QemuImgProc proc, Object lock) {
this.proc = proc;
+ this.lock = lock;
isError = false;
}
if (! proc.Running()) {
isError = true;
}
- synchronized(this) {
+ synchronized(lock) {
if (file != null) {
file.delete();
}
File baseFile = new File(baseImagePath);
File partFile = new File(baseImagePartPath);
partFile.renameTo(baseFile);
- notifyAll();
+ lock.notifyAll();
}
}
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.ConnectException;
+import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
+import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.net.ServerSocket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.channels.SocketChannel;
import java.nio.channels.UnresolvedAddressException;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Enumeration;
+import java.util.List;
+import java.util.regex.Pattern;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.logging.EMLogger;
}
+
+
+ public static void setStatusBar(String errMsg) {
+ if (errMsg == null || errMsg.trim().isEmpty()) {
+ MainDialog.getStatusBar().reset();
+
+ } else {
+ MainDialog.getStatusBar().error(errMsg);
+ }
+ }
+
+
+ public static ProcessResult runProcess(List<String> cmd) {
+ ProcessResult result = new ProcessResult();
+ ProcessBuilder pb = new ProcessBuilder(cmd);
+ int exitValue = 0;
+ Process process;
+ try {
+ process = pb.start();
+ List<String> stdOut = ProcessOutputReader.readStdOut(process, cmd.toString());
+ List<String> stdErr = ProcessOutputReader.readStdErr(process, cmd.toString());
+ exitValue = process.waitFor();
+
+ if (exitValue != 0) {
+ EMLogger.getLogger().warning("Command returns fail:" +
+ "cmd : " + cmd.toString() + ", return : " + exitValue);
+ result.setResult(false);
+
+ } else {
+ result.setResult(true);
+ }
+ result.setExitValue(exitValue);
+ result.setStdOutMsg(stdOut);
+ result.setStdErrMsg(stdErr);
+
+ } catch (IOException e) {
+ EMLogger.getLogger().warning("Run process fail. " + e.getMessage());
+ result.setResult(false);
+ result.setStdErrMsg(Arrays.asList(e.getMessage()));
+
+ } catch (InterruptedException e) {
+ result.setResult(false);
+ EMLogger.getLogger().info("Process end with interrupt. " + e.getMessage());
+ result.setStdErrMsg(Arrays.asList(e.getMessage()));
+ }
+
+ return result;
+ }
+
}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@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.manager.vms.helper;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.emulator.manager.logging.EMLogger;
+
+public class ProcessOutputReader extends Thread {
+
+ private BufferedReader reader;
+ private String processName;
+ private List<String> msgList = new ArrayList<String>();
+ private boolean readFinished;
+
+ public List<String> getMsg() {
+ return msgList;
+ }
+
+ public ProcessOutputReader(BufferedReader reader, String processName) {
+ this.reader = reader;
+ this.processName = processName;
+ this.setDaemon(true);
+ }
+
+ // Read output/error stream of process to prevent blocking due to full of
+ // buffer.
+ public static void startFlush(Process process, String processName) {
+ BufferedReader out = new BufferedReader(new InputStreamReader(
+ process.getInputStream()));
+ new ProcessOutputReader(out, processName).start();
+
+ BufferedReader err = new BufferedReader(new InputStreamReader(
+ process.getErrorStream()));
+ new ProcessOutputReader(err, processName).start();
+ }
+
+ // Read process's stdout.
+ public static List<String> readStdOut(Process process, String processName) {
+ BufferedReader out = new BufferedReader(new InputStreamReader(
+ process.getInputStream()));
+ ProcessOutputReader reader = new ProcessOutputReader(out, processName);
+ reader.start();
+ while (!reader.readFinished) {
+ try {
+ Thread.sleep(20);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ return reader.getMsg();
+
+ }
+
+ // Read process's stderr.
+ public static List<String> readStdErr(Process process, String processName) {
+ BufferedReader err = new BufferedReader(new InputStreamReader(
+ process.getErrorStream()));
+ ProcessOutputReader reader = new ProcessOutputReader(err, processName);
+ reader.start();
+ while (!reader.readFinished) {
+ try {
+ Thread.sleep(20);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ return reader.getMsg();
+
+ }
+
+ @Override
+ public void run() {
+ String msg;
+ try {
+ while ((msg = reader.readLine()) != null) {
+ msgList.add(msg);
+ }
+ } catch (IOException e) {
+ EMLogger.getLogger().warning(e.getMessage());
+ } finally {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ EMLogger.getLogger().warning(e.getMessage());
+ }
+ }
+
+ readFinished = true;
+ }
+}
--- /dev/null
+/* Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@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.manager.vms.helper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProcessResult {
+ boolean result;
+ int exitValue;
+ List<String> stdOutMsg = new ArrayList<String>();
+ List<String> stdErrMsg = new ArrayList<String>();
+
+ public void setExitValue(int exitValue) {
+ this.exitValue = exitValue;
+ }
+
+ public int getExitValue() {
+ return exitValue;
+ }
+
+ public boolean isSuccess() {
+ return result;
+ }
+
+ public void setResult(boolean result) {
+ this.result = result;
+ }
+
+ public List<String> getStdOutMsg() {
+ return stdOutMsg;
+ }
+
+ public void setStdOutMsg(List<String> stdOutMsg) {
+ this.stdOutMsg = stdOutMsg;
+ }
+
+ public List<String> getStdErrMsg() {
+ return stdErrMsg;
+ }
+
+ public void setStdErrMsg(List<String> stdErrMsg) {
+ this.stdErrMsg = stdErrMsg;
+ }
+
+ public String getResultMessage() {
+ StringBuilder sb = new StringBuilder();
+ for (String str : stdOutMsg) {
+ sb.append(str).append("\n");
+ }
+ for (String str : stdErrMsg) {
+ sb.append(str).append("\n");
+ }
+ return sb.toString();
+ }
+}
\ No newline at end of file
+* 2.4.93
+- Revert "Launcher: Added rotary argument. (wearable)"
+- Revert "Resolution: Added 360x360 resolution for wearable."
+== minkee Lee<minkee.lee@samsung.com> 2015-01-05
+
+* 2.4.92
+- CLI: Fixed error - creating custom VM.
+== minkee Lee<minkee.lee@samsung.com> 2015-01-05
+
+* 2.4.91
+- Launcher: Added rotary argument. (wearable)
+== minkee Lee<minkee.lee@samsung.com> 2014-12-30
+
+* 2.4.90
+- Skin: Modified skin-loading logic.
+== minkee Lee<minkee.lee@samsung.com> 2014-12-29
+
* 2.4.89
+- Resolution: Added 360x360 resolution for wearable.
- Launcher: Added profile argument.
- Refresh: Fixed bug that emulator-manager go to hanging state when refresh.
== minkee Lee<minkee.lee@samsung.com> 2014-12-24
Source: emulator-manager
-Version: 2.4.89
+Version: 2.4.93
Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
Package: emulator-manager