From 8ec9cda3a342ab8dd7c26cc70744a2fea2c01a74 Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Thu, 28 Aug 2014 11:46:05 +0900 Subject: [PATCH] Refactoring: Fix null checking and branch code. Change-Id: I9e902bf9cb8ce5464d515bb328951ce6394888a1 Signed-off-by: minkee.lee --- .../manager/ui/detail/item/DetailViewItemList.java | 102 --------------------- .../item/property/ResolutionSubViewItem.java | 5 +- .../ui/detail/item/template/ComboSubViewItem.java | 10 +- .../ui/detail/item/template/ComboViewItem.java | 10 +- .../ui/detail/item/template/FileViewItem.java | 2 +- .../ui/detail/item/template/OnOffSubViewItem.java | 2 - .../ui/detail/item/template/OnOffViewItem.java | 2 - 7 files changed, 9 insertions(+), 124 deletions(-) delete mode 100644 common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemList.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 index 94f8aa3..0000000 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemList.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * JiHye Kim - * SeokYeon Hwang - * YeongKyoon Lee - * - * 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 infoList = null; - private ArrayList modifyList = null; - - public DetailViewItemList(ExtensionItem item, DetailViewPage page) { - this.item = item; - this.viewPage = page; - } - - public ArrayList 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 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; - } -} diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/ResolutionSubViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/ResolutionSubViewItem.java index 1d9fc3f..0f56a29 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/ResolutionSubViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/ResolutionSubViewItem.java @@ -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); } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java index 67ee1ed..b0e01c3 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java @@ -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. diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboViewItem.java index f82830d..c296e5f 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboViewItem.java @@ -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. diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java index 2d61499..aed5f4f 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java @@ -80,7 +80,7 @@ public class FileViewItem extends AdvancedViewItem { List