Refactoring: Fix null checking and branch code.
authorminkee.lee <minkee.lee@samsung.com>
Thu, 28 Aug 2014 02:46:05 +0000 (11:46 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Thu, 28 Aug 2014 02:46:05 +0000 (11:46 +0900)
Change-Id: I9e902bf9cb8ce5464d515bb328951ce6394888a1
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemList.java [deleted file]
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/ResolutionSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java

diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemList.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemList.java
deleted file mode 100644 (file)
index 94f8aa3..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Emulator Manager
- *
- * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * 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.ui.detail.item;
-
-import java.util.ArrayList;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.tizen.emulator.manager.plugin.ExtensionItem;
-import org.tizen.emulator.manager.ui.detail.DetailViewPage;
-import org.tizen.emulator.manager.ui.detail.PModifyViewPage;
-
-public class DetailViewItemList {
-       private ExtensionItem item = null;
-       private DetailViewPage viewPage = null;
-       private Composite infoComp = null;
-       private Composite modifyComp = null;
-       private ArrayList<IInfoViewItem> infoList = null;
-       private ArrayList<IModifyViewItem> modifyList = null;
-
-       public DetailViewItemList(ExtensionItem item, DetailViewPage page) {
-               this.item = item;
-               this.viewPage = page;
-       }
-
-       public ArrayList<IInfoViewItem> getInfoItemList() {
-               if (infoList == null) {
-                       infoComp = new Composite(viewPage.getItemListComposite(), SWT.NONE);
-                       infoComp.setLayout(new FormLayout());
-                       IItemListFactory f = (IItemListFactory)(item.createClass());
-//                     infoList = f.getInfoItemList();
-                       IInfoViewItem item = null;
-                       DetailViewItem up       = null;
-                       for (int i = 0; i < infoList.size(); i++) {
-                               item = infoList.get(i);
-                               item.initItem(infoComp, up);
-                               item.drawDetail();
-                               up = (DetailViewItem) item;
-                       }
-                       infoComp.layout(true, true);
-               }
-               return infoList;
-       }
-
-       public ArrayList<IModifyViewItem> getModifyItemList() {
-               if (modifyList == null) {
-                       modifyComp = new Composite(viewPage.getItemListComposite(), SWT.NONE);
-                       modifyComp.setLayout(new FormLayout());
-                       IItemListFactory f = (IItemListFactory)(item.createClass());
-//                     modifyList = f.getModifyItemList();
-
-                       IModifyViewItem item = null;
-                       DetailViewItem up       = null;
-                       for (int i = 0; i < modifyList.size(); i++) {
-                               item = modifyList.get(i);
-                               item.initItem(modifyComp, up);
-                               item.drawModify();
-                               item.setListener((PModifyViewPage)viewPage);
-                               up = (DetailViewItem) item;
-                       }
-
-                       modifyComp.layout(true, true);
-               }
-               return modifyList;
-       }
-
-       public Composite getInfoComposite() {
-               return infoComp;
-       }
-
-       public Composite getModifyComposite() {
-               return modifyComp;
-       }
-}
index 1d9fc3f..0f56a29 100644 (file)
@@ -139,9 +139,8 @@ public class ResolutionSubViewItem extends ComboSubViewItem {
        public boolean settingModifyItem(VMPropertyValue value) {
                oldResolution = newResolution = value.resolution;
                // make ComboBox list
-               if (combo != null) {
-                       combo.removeAll();
-               }
+               combo.removeAll();
+
                for (String s : comboOptions) {
                        combo.add(s);
                }
index 67ee1ed..b0e01c3 100644 (file)
@@ -143,13 +143,9 @@ public class ComboSubViewItem extends SubViewItem {
                newValue = value.getAdvancedOptionSubValue(parentItem.getName(), name);
 
                // make combo box list
-               if (comboOptions != null) {
-                       if (combo != null) {
-                               combo.removeAll();
-                       }
-                       for(String option : comboOptions) {
-                               combo.add(option);
-                       }
+               combo.removeAll();
+               for(String option : comboOptions) {
+                       combo.add(option);
                }
 
                // Select combo-box item.
index f82830d..c296e5f 100644 (file)
@@ -183,13 +183,9 @@ public class ComboViewItem extends AdvancedViewItem{
                newValue = getItemValue(value);
 
                // makeComboBox
-               if (comboOptions != null) {
-                       if (combo != null) {
-                               combo.removeAll();
-                       }
-                       for(String option : comboOptions) {
-                               combo.add(option);
-                       }
+               combo.removeAll();
+               for(String option : comboOptions) {
+                       combo.add(option);
                }
 
                // Select combo-box item.
index 2d61499..aed5f4f 100644 (file)
@@ -80,7 +80,7 @@ public class FileViewItem extends AdvancedViewItem {
 
                List<Option> optionList = template.getOption();
                for (Option option : optionList) {
-                       if (option.getName().equals(OptionType.FILE_FILTER)) {
+                       if (option.getName().equals(OptionType.FILE_FILTER.getName())) {
                                String[] split = option.getValue().split(",");
                                for(String s : split) {
                                        filters.add(s.trim());
index 2f7e5aa..c92730a 100644 (file)
@@ -108,8 +108,6 @@ public class OnOffSubViewItem extends SubViewItem{
                String onOffVal = value.getAdvancedOptionSubValue(parentItem.getName(), name);
                if (onOffVal.equals(VALUE_ON)) {
                        valueLabel.setText(StringResources.SUPPORTED);
-               } else if (onOffVal.equals(VALUE_OFF)) {
-                       valueLabel.setText(StringResources.NOT_SUPPORTED);
                } else {
                        valueLabel.setText(StringResources.NOT_SUPPORTED);
                }
index a3ac360..dacda4c 100644 (file)
@@ -96,8 +96,6 @@ public class OnOffViewItem extends AdvancedViewItem{
                String onOffVal = value.getAdvancedOptionValue(name).toLowerCase();
                if (onOffVal.equals(VALUE_ON)) {
                        valueLabel.setText(StringResources.SUPPORTED);
-               } else if (onOffVal.equals(VALUE_OFF)) {
-                       valueLabel.setText(StringResources.NOT_SUPPORTED);
                } else {
                        valueLabel.setText(StringResources.NOT_SUPPORTED);
                }