org.eclipse.ui.forms;bundle-version="3.3.103"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.tizen.injector.Injector
-Export-Package: org.tizen.injector.protocol,
+Export-Package: org.tizen.injector.control,
+ org.tizen.injector.model,
+ org.tizen.injector.protocol,
org.tizen.injector.protocol.sensor,
org.tizen.injector.provider,
org.tizen.injector.receiver,
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.control;\r
+import org.eclipse.jface.viewers.CellEditor;\r
+import org.eclipse.jface.viewers.ComboBoxCellEditor;\r
+import org.eclipse.jface.viewers.ICellModifier;\r
+import org.eclipse.jface.viewers.TableViewer;\r
+import org.eclipse.jface.viewers.TextCellEditor;\r
+import org.eclipse.swt.widgets.TableColumn;\r
+import org.eclipse.swt.widgets.TableItem;\r
+import org.tizen.injector.model.ITableVO;\r
+\r
+\r
+/**\r
+ * This class implements an ICellModifier\r
+ * An ICellModifier is called when the user modifes a cell in the \r
+ * tableViewer\r
+ */\r
+\r
+public class TableViewCellModifier implements ICellModifier {\r
+ private TableViewer viewer;\r
+ private String[] columnNames;\r
+ CellEditor[] cellEditors;\r
+ /**\r
+ * Constructor \r
+ * @param TableViewerExample an instance of a TableViewerExample \r
+ */\r
+ public TableViewCellModifier(TableViewer viewer) {\r
+ super();\r
+ this.viewer = viewer;\r
+ this.columnNames = getColumnNames();\r
+ this.viewer.setColumnProperties(columnNames);\r
+ }\r
+\r
+ private String[] getColumnNames() {\r
+ TableColumn[] columns = viewer.getTable().getColumns();\r
+ String[] columnNames = new String[columns.length];\r
+ for(int i=0;i<columnNames.length;i++){\r
+ columnNames[i] = columns[i].getText();\r
+ }\r
+ \r
+ return columnNames;\r
+ }\r
+\r
+ /**\r
+ * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)\r
+ */\r
+ public boolean canModify(Object element, String property) {\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)\r
+ */\r
+ public Object getValue(Object element, String property) {\r
+ \r
+ Object result = null;\r
+ int idx = getColumnIndex(property);\r
+ ITableVO vo = (ITableVO)element;\r
+ \r
+ CellEditor ce = getCellEditor(idx);\r
+ \r
+ if(ce instanceof ComboBoxCellEditor){\r
+ result = vo.getColumnValue(idx);\r
+ }else if(ce instanceof TextCellEditor){\r
+ result = vo.getColumnValue(idx);\r
+ }else{\r
+ result = ""; //$NON-NLS-1$\r
+ }\r
+ return result; \r
+ }\r
+\r
+ private CellEditor getCellEditor(int idx) {\r
+ if(this.cellEditors==null)\r
+ this.cellEditors = viewer.getCellEditors();\r
+ return this.cellEditors[idx];\r
+ }\r
+\r
+ private int getColumnIndex(String property) {\r
+ for(int i=0;i<columnNames.length;i++){\r
+ if(columnNames[i].equals(property))\r
+ return i;\r
+ }\r
+ return 0;\r
+ }\r
+ // not used\r
+ /*\r
+ private int getComboIndex(String[] items, Object str) {\r
+ for(int i=0;i<items.length;i++){\r
+ if(items[i].equals(str))\r
+ return i;\r
+ }\r
+ return 0;\r
+ }\r
+ */\r
+\r
+ /**\r
+ * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)\r
+ */\r
+ public void modify(Object element, String property, Object value) { \r
+ int idx = getColumnIndex(property);\r
+ ITableVO vo = (ITableVO)((TableItem) element).getData();\r
+ \r
+ if(cellEditors[idx] instanceof ComboBoxCellEditor){\r
+ if((Integer)value < 0)\r
+ return;\r
+ else\r
+ vo.setColumnValue(idx, value);\r
+ }else if(cellEditors[idx] instanceof TextCellEditor){\r
+ vo.setColumnValue(idx, value);\r
+ }\r
+ \r
+ viewer.update(vo, null);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.control;\r
+\r
+import java.util.Comparator;\r
+\r
+import org.eclipse.jface.viewers.TableViewer;\r
+import org.eclipse.jface.viewers.Viewer;\r
+import org.eclipse.jface.viewers.ViewerSorter;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.SelectionAdapter;\r
+import org.eclipse.swt.events.SelectionEvent;\r
+import org.eclipse.swt.graphics.Cursor;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.Table;\r
+import org.eclipse.swt.widgets.TableColumn;\r
+import org.tizen.injector.model.ITableVO;\r
+\r
+\r
+/**\r
+ * A viewer sorter is used by a structured viewer to reorder the elements\r
+ * provided by its content provider. In addition, the TableViewColumnSorter\r
+ * listens for mouse clicks in the column headers and resorts the table content\r
+ * based on the column that was selected. Clicking on a column a second time\r
+ * toggles the sort order.\r
+ */\r
+public class TableViewColumnSorter extends ViewerSorter {\r
+ private static final String COLUMN_INDEX_KEY = "COLUMN_INDEX"; //$NON-NLS-1$\r
+ private static final String HEADER_TEXT_KEY = "HEADER_TEXT"; //$NON-NLS-1$\r
+ private static final String TAG_DESCENDING = "\u25b2"; // up-pointing triangle\r
+ private static final String TAG_ASCENDING = "\u25bc"; // down-pointing triangle\r
+ \r
+ private TableViewer viewer;\r
+ private Table table;\r
+ private TableColumn[] columns;\r
+ Cursor waitCursor;\r
+ \r
+ private Comparator<String> stringComparator = new Comparator<String>(){\r
+ @Override\r
+ public int compare(String str1, String str2) {\r
+ str1=str1==null?"":str1; //$NON-NLS-1$\r
+ str2=str2==null?"":str2; //$NON-NLS-1$\r
+ return str1.compareTo(str2);\r
+ }\r
+ };\r
+ \r
+ private Comparator<Integer> numberComparator = new Comparator<Integer>(){\r
+ @Override\r
+ public int compare(Integer num1, Integer num2) {\r
+ return num1>num2?1:(num1==num2?0:-1);\r
+ }\r
+ };\r
+\r
+ public TableViewColumnSorter(TableViewer viewer) {\r
+ this.viewer = viewer;\r
+ this.table = viewer.getTable();\r
+ this.columns = viewer.getTable().getColumns();\r
+ \r
+ createCursor();\r
+ createSelectionListener(columns);\r
+ }\r
+\r
+ private void createCursor(){\r
+ waitCursor = Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT);\r
+ }\r
+ \r
+ public int compare(Viewer viewer, Object object1, Object object2) {\r
+ TableColumn column = table.getSortColumn();\r
+ \r
+ int index = -1;\r
+ if(column==null){\r
+ return 0;\r
+ }else{\r
+ index = (Integer)column.getData(COLUMN_INDEX_KEY);\r
+ }\r
+ \r
+ Object target1 = ((ITableVO)object1).getColumnValue(index);\r
+ Object target2 = ((ITableVO)object2).getColumnValue(index);\r
+ \r
+ int result = compare(target1, target2);\r
+ \r
+ if(table.getSortDirection()==SWT.UP)\r
+ return result;\r
+ else\r
+ return -result;\r
+ }\r
+ \r
+ public int compare(Object object1, Object object2){\r
+ if(object1 instanceof Integer){\r
+ return numberComparator.compare((Integer)object1, (Integer)object2);\r
+ }else{\r
+ return stringComparator.compare(object1.toString(), object2.toString());\r
+ }\r
+ }\r
+\r
+ private void createSelectionListener(TableColumn[] columns) {\r
+ for (int i = 0; i < columns.length; i++) {\r
+ columns[i].setData(COLUMN_INDEX_KEY,i);\r
+ columns[i].setData(HEADER_TEXT_KEY,columns[i].getText());\r
+ columns[i].addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ TableColumn column = (TableColumn)e.getSource();\r
+ clearColumnHeader(column);\r
+ renderColumnHeader(column);\r
+ \r
+ table.setCursor(waitCursor);\r
+ viewer.refresh();\r
+ table.setCursor(null);\r
+ }\r
+ });\r
+ }\r
+ }\r
+ \r
+ private void renderColumnHeader(TableColumn column){\r
+ int direction = table.getSortDirection()==SWT.UP?SWT.DOWN:SWT.UP;\r
+ table.setSortDirection(direction);\r
+ table.setSortColumn(column);\r
+ \r
+ String title = (String)column.getData(HEADER_TEXT_KEY);\r
+ String directionShape = direction==SWT.UP?TAG_DESCENDING:TAG_ASCENDING;\r
+ column.setText(title+" "+directionShape); //$NON-NLS-1$\r
+ }\r
+ \r
+ private void clearColumnHeader(TableColumn column){\r
+ TableColumn prevColumn = table.getSortColumn();\r
+ \r
+ if(prevColumn==null){\r
+ return;\r
+ }else{\r
+ prevColumn.setText((String)prevColumn.getData(HEADER_TEXT_KEY));\r
+ }\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.control;\r
+\r
+import org.eclipse.jface.viewers.IStructuredContentProvider;\r
+import org.eclipse.jface.viewers.Viewer;\r
+import org.tizen.injector.model.ITableModel;\r
+\r
+\r
+public class TableViewContentProvider implements IStructuredContentProvider {\r
+\r
+ public TableViewContentProvider() {\r
+ }\r
+\r
+ public Object[] getElements(Object model) {\r
+ return ((ITableModel)model).getDatas();\r
+ }\r
+\r
+ public void dispose() {\r
+ \r
+ }\r
+\r
+ public void inputChanged(Viewer viewer, Object obj, Object obj1) {\r
+ \r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.control;\r
+\r
+import java.lang.reflect.Field;\r
+import java.lang.reflect.Method;\r
+\r
+import org.eclipse.jface.viewers.CellEditor;\r
+import org.eclipse.jface.viewers.ColumnLabelProvider;\r
+import org.eclipse.jface.viewers.ComboBoxCellEditor;\r
+import org.eclipse.jface.viewers.ITableLabelProvider;\r
+import org.eclipse.jface.viewers.TableViewer;\r
+import org.eclipse.swt.graphics.Image;\r
+import org.tizen.injector.model.ITableVO;\r
+\r
+\r
+public class TableViewLabelProvider extends ColumnLabelProvider implements ITableLabelProvider {\r
+\r
+ public TableViewLabelProvider() {\r
+ }\r
+ \r
+ private TableViewer viewer;\r
+ CellEditor[] cellEditors;\r
+ \r
+ public TableViewLabelProvider(TableViewer viewer) {\r
+ this.setViewer(viewer);\r
+ this.cellEditors = viewer.getCellEditors();\r
+ }\r
+ \r
+ private Field[] fields;\r
+ \r
+ private int getColumnIndex(int columnIndex){\r
+ return fields.length>columnIndex?columnIndex:fields.length;\r
+ }\r
+\r
+ public Image getColumnImage(Object element, int columnIndex) {\r
+ return null;\r
+ }\r
+ \r
+// private void hasCellEditor(){\r
+// if(this.cellEditors==null)\r
+// this.cellEditors = viewer.getCellEditors();\r
+// }\r
+ \r
+ private CellEditor getCellEditor(int idx) {\r
+ if(this.cellEditors==null)\r
+ return null;\r
+ else\r
+ return this.cellEditors[idx];\r
+ }\r
+\r
+ public String getColumnText(Object element, int columnIndex) {\r
+ Object obj = null;\r
+ \r
+ if(element instanceof ITableVO){\r
+ ITableVO data = (ITableVO)element;\r
+ if(this.cellEditors != null){\r
+ CellEditor ce = getCellEditor(columnIndex);\r
+ if(ce instanceof ComboBoxCellEditor){\r
+ ComboBoxCellEditor editor = (ComboBoxCellEditor)ce;\r
+ String items[] = editor.getItems();\r
+ int idx = (Integer) data.getColumnValue(columnIndex);\r
+ if(idx<0)\r
+ obj = null;\r
+ else if(idx>items.length)\r
+ obj = items[0];\r
+ else\r
+ obj = items[idx];\r
+ }else{\r
+ obj = data.getColumnValue(columnIndex);\r
+ }\r
+ }else{\r
+ obj = data.getColumnValue(columnIndex);\r
+ }\r
+ }else{\r
+ if(fields==null)\r
+ fields = element.getClass().getDeclaredFields();\r
+ \r
+ int idx = getColumnIndex(columnIndex);\r
+ String fieldName = fields[idx].getName().substring(0, 1).toUpperCase() \r
+ + fields[idx].getName().substring(1,fields[idx].getName().length());\r
+ \r
+ try{\r
+ Method method = element.getClass().getMethod("get" + fieldName, new Class[] {}); //$NON-NLS-1$\r
+ obj = method.invoke(element, new Object[] {});\r
+ }catch(Exception e){\r
+ return ""; //$NON-NLS-1$\r
+ }\r
+ } \r
+ \r
+ return obj==null?"":String.valueOf(obj); //$NON-NLS-1$\r
+ }\r
+\r
+ public TableViewer getViewer() {\r
+ return viewer;\r
+ }\r
+\r
+ public void setViewer(TableViewer viewer) {\r
+ this.viewer = viewer;\r
+ }\r
+\r
+\r
+}\r
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.model;\r
+\r
+import java.io.File;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileReader;\r
+import java.io.FileWriter;\r
+import java.io.IOException;\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.Iterator;\r
+\r
+import org.eclipse.ui.IMemento;\r
+import org.eclipse.ui.XMLMemento;\r
+\r
+public abstract class AbstractTableModel implements ITableModel {\r
+ private static final String TAG_ROOT = "root"; //$NON-NLS-1$\r
+\r
+ private Collection<AbstractTableVO> inventory = new ArrayList<AbstractTableVO>();\r
+ protected AbstractTableVO source;\r
+ private boolean isDirty = false;\r
+\r
+ public AbstractTableModel(AbstractTableVO source) {\r
+ this.source = source;\r
+ \r
+ }\r
+ \r
+ \r
+\r
+ public ITableVO[] getDatas() {\r
+ if (inventory == null)\r
+ return null;\r
+\r
+ return inventory.toArray(new AbstractTableVO[inventory.size()]);\r
+ }\r
+\r
+ public void add(Collection<AbstractTableVO> datas) {\r
+ if (datas == null)\r
+ return;\r
+\r
+ inventory.addAll(datas);\r
+ }\r
+ \r
+ public int size(){\r
+ return inventory.size();\r
+ }\r
+\r
+ public void add(AbstractTableVO data) {\r
+ inventory.add(data);\r
+ }\r
+\r
+ public void remove(Collection<AbstractTableVO> datas) {\r
+ if (datas == null)\r
+ return;\r
+\r
+ inventory.removeAll(datas);\r
+ }\r
+\r
+ public void remove(AbstractTableVO data) {\r
+ inventory.remove(data);\r
+ }\r
+ \r
+ public void clear() {\r
+ inventory.clear();\r
+ }\r
+\r
+ public void load(String fileName) {\r
+ if (inventory==null||source==null)\r
+ return;\r
+ \r
+ FileReader reader = null;\r
+ try {\r
+ reader = new FileReader(new File(fileName));\r
+ load(XMLMemento.createReadRoot(reader));\r
+ } catch (FileNotFoundException e) {\r
+ e.printStackTrace();\r
+ } catch (Exception e) {\r
+ e.printStackTrace();\r
+ } finally {\r
+ try {\r
+ if (reader != null)\r
+ reader.close();\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+ }\r
+\r
+ private void load(XMLMemento memento) {\r
+ IMemento[] children = memento.getChildren(getSourceName());\r
+ AbstractTableVO data = null;\r
+ String[] fields = source.getColumnNames();\r
+ for (int i = 0; i < children.length; i++) {\r
+ data = source.clone();\r
+ for (int j = 0; j < fields.length; j++) {\r
+ data.setColumnValue(j, children[i].getString(fields[j]));\r
+ }\r
+ add(data);\r
+ }\r
+ }\r
+\r
+ public void save(String fileName) {\r
+ if (inventory == null || source == null)\r
+ return;\r
+\r
+ XMLMemento memento = XMLMemento.createWriteRoot(TAG_ROOT);\r
+ save(memento);\r
+ FileWriter writer = null;\r
+ try {\r
+ writer = new FileWriter(fileName);\r
+ memento.save(writer);\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ } finally {\r
+ try {\r
+ if (writer != null)\r
+ writer.close();\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+ }\r
+\r
+ private void save(XMLMemento memento) {\r
+ Iterator<AbstractTableVO> iter = inventory.iterator();\r
+ AbstractTableVO data = null;\r
+ String[] fields = null;\r
+\r
+ while (iter.hasNext()) {\r
+ data = iter.next();\r
+ fields = data.getColumnNames();\r
+ IMemento child = memento.createChild(getSourceName());\r
+ for (int j = 0; j < fields.length; j++) {\r
+ child.putString(\r
+ fields[j], \r
+ String.valueOf(data.getColumnValue(j)));\r
+ }\r
+ }\r
+\r
+ }\r
+\r
+ public String getSourceName() {\r
+ return this.source.getClass().getSimpleName();\r
+ }\r
+ \r
+ public boolean isDirty(){\r
+ return this.isDirty;\r
+ }\r
+ \r
+ public synchronized void setDirty(boolean isDirty){\r
+ this.isDirty = isDirty;\r
+ }\r
+\r
+}\r
+\r
+\r
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.model;\r
+\r
+public abstract class AbstractTableVO implements ITableVO{\r
+ public abstract String[] getColumnNames();\r
+ public abstract Object getColumnValue(int index);\r
+ public abstract void setColumnValue(int index, Object value);\r
+ \r
+ public AbstractTableVO clone(){\r
+ Object obj = null;\r
+ try{\r
+ obj = super.clone();\r
+ }catch(CloneNotSupportedException e){\r
+ \r
+ }\r
+ return (AbstractTableVO)obj;\r
+ }\r
+ \r
+ public Object getColumnValue(String columnName){\r
+ return getColumnValue(getColumnIndex(columnName));\r
+ }\r
+ \r
+ public String getColumnName(int index){\r
+ String[] columnNames = getColumnNames();\r
+ if(index<0||index>columnNames.length)\r
+ return null;\r
+ else\r
+ return columnNames[index];\r
+ }\r
+ \r
+ public int getColumnIndex(String columnName){\r
+ String[] columnNames = getColumnNames();\r
+ int index =-1;\r
+ for(int i=0;i<columnNames.length;i++){\r
+ if(columnName.equals(columnNames[i])){\r
+ index = i;\r
+ break;\r
+ }\r
+ }\r
+ return index;\r
+ }\r
+ \r
+ @Override\r
+ public String toString() {\r
+ StringBuffer buf = new StringBuffer();\r
+ String[] fields = getColumnNames();\r
+ for (int j = 0; j < fields.length; j++) {\r
+ Object obj = getColumnValue(j);\r
+ buf.append(obj==null?"":String.valueOf(obj)); //$NON-NLS-1$\r
+ if(j<fields.length-1)\r
+ buf.append(","); //$NON-NLS-1$\r
+ }\r
+ return buf.toString();\r
+ }\r
+ \r
+}\r
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.model;\r
+\r
+\r
+public class DefaultTableModel extends AbstractTableModel {\r
+\r
+ public DefaultTableModel(AbstractTableVO source) {\r
+ super(source);\r
+ }\r
+\r
+ public String getSourceName() {\r
+ String str = this.source.getClass().getSimpleName();\r
+ if(str.endsWith("VO")) //$NON-NLS-1$\r
+ str = str.substring(0,str.length()-2);\r
+ return str;\r
+ }\r
+}\r
+\r
+\r
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.model;\r
+\r
+import java.util.Collection;\r
+\r
+\r
+public interface ITableModel\r
+{\r
+ public void add(AbstractTableVO datas);\r
+ public void add(Collection<AbstractTableVO> datas);\r
+ public void remove(AbstractTableVO datas);\r
+ public void remove(Collection<AbstractTableVO> datas);\r
+ public ITableVO[] getDatas();\r
+ public void load(String fileName);\r
+ public void save(String fileName);\r
+ public void clear();\r
+ public int size();\r
+ public String getSourceName();\r
+ public boolean isDirty();\r
+ public void setDirty(boolean isDirty);\r
+}\r
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.model;\r
+\r
+public interface ITableVO extends IVO{\r
+ public String[] getColumnNames();\r
+ public Object getColumnValue(int index);\r
+ public Object getColumnValue(String columnName);\r
+ public int getColumnIndex(String columnName);\r
+ public String getColumnName(int index);\r
+ public void setColumnValue(int index, Object value);\r
+}\r
--- /dev/null
+/*\r
+ * org.tizen.injector\r
+ * \r
+ * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * Jihye Kim <jihye1128.kim@dsamsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+package org.tizen.injector.model;\r
+\r
+public interface IVO extends Cloneable{\r
+}\r
package org.tizen.injector.util;
-import java.awt.TextArea;
-
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.connection.ConnectionPlugin.ISelectionListener;
-import org.tizen.common.model.ITableVO;
+import org.tizen.injector.model.ITableVO;
import org.tizen.sdblib.FileListingService.FileEntry;
-import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.SyncService;
import org.tizen.sdblib.SyncService.SyncResult;
//import org.tizen.location.core.injector.DebugLog;
package org.tizen.location.core.model;
-import org.tizen.common.model.AbstractTableVO;
+import org.tizen.injector.model.AbstractTableVO;
import org.tizen.location.core.protocol.GeoLocation;
public class GeoLocationVO extends AbstractTableVO {
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.Section;
-import org.tizen.common.model.DefaultTableModel;
+import org.tizen.injector.model.DefaultTableModel;
import org.tizen.injector.provider.AbstractInjectorItem;
//import org.tizen.location.core.injector.DebugLog;
import org.tizen.location.core.model.GeoLocationVO;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
-import org.tizen.common.control.TableViewContentProvider;
-import org.tizen.common.control.TableViewLabelProvider;
-import org.tizen.common.model.DefaultTableModel;
-import org.tizen.common.model.ITableVO;
+import org.tizen.injector.control.TableViewContentProvider;
+import org.tizen.injector.control.TableViewLabelProvider;
+import org.tizen.injector.model.DefaultTableModel;
+import org.tizen.injector.model.ITableVO;
import org.tizen.injector.provider.AbstractInjectorItem;
import org.tizen.injector.provider.AbstractInjectorPage;
//import org.tizen.location.core.injector.AbstractLocationInjector;