From 0dcea4aeddace9f479e1d1773e62210635b2c016 Mon Sep 17 00:00:00 2001 From: jooyoul_lee Date: Thu, 7 Nov 2013 21:48:07 +0900 Subject: [PATCH] [Title] Binary setting into configuration dialog [Desc.] [Issue] --- .../swap/communicator/Communicator30.java | 3 +- .../swap/platform/ui/BinaryAddDialog.java | 33 +- .../platform/ui/BinaryAnalyzingConfigDialog.java | 6 +- .../dynamicanalyzer/swap/platform/ui/InputRow.java | 24 +- .../swap/platform/ui/LoadSettingDialog.java | 8 +- .../dynamicanalyzer/ui/toolbar/ToolbarArea.java | 56 ++-- .../toolbar/configuration/BinarySettingsPage.java | 366 +++++++++++++++++++++ .../toolbar/configuration/ConfigurationDialog.java | 53 +-- 8 files changed, 472 insertions(+), 77 deletions(-) create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java index 57fe9f9..7c5b5f2 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java @@ -934,7 +934,8 @@ public class Communicator30 extends BaseCommunicator { binInfo.setSourceBinaryPath(localBinaryPath); String[] splitLocalBinaryPath = localBinaryPath .split(CommonConstants.SLASH); - if (null == splitLocalBinaryPath[0] + if (splitLocalBinaryPath.length <= 0 + || null == splitLocalBinaryPath[0] || splitLocalBinaryPath[0].isEmpty()) { localBinaryPath = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator + getFileName(binPaths.get(i)); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAddDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAddDialog.java index e2cc709..b200a58 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAddDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAddDialog.java @@ -6,6 +6,8 @@ import java.util.List; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Rectangle; @@ -121,16 +123,27 @@ public class BinaryAddDialog extends DAMessageBox { data = new FormData(); data.top = new FormAttachment(label, 10); data.left = new FormAttachment(0, 12); - data.height = 26; + data.height = 24; data.width = 350; binary.setLayoutData(data); - binary.setBackground(ColorResources.VIEW_BG_COLOR); + binary.setBackground(ColorResources.WHITE); binary.addKeyListener(binaryKeyListener); binary.setText(binaryStr); + binary.addPaintListener(new PaintListener() { + @Override + public void paintControl(PaintEvent e) { + e.gc.setForeground(ColorResources.BLUE); + Text text = (Text) e.widget; + Rectangle rect = text.getClientArea(); + e.gc.drawRectangle(rect.x, rect.y, rect.width -1, rect.height - 1); + e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3, rect.height - 3); + } + }); + findButton = new DAButton(shell, SWT.NONE); data = new FormData(); - data.top = new FormAttachment(label, 10); + data.top = new FormAttachment(label, 9); data.left = new FormAttachment(binary, 5); data.height = 30; data.width = 50; @@ -176,9 +189,21 @@ public class BinaryAddDialog extends DAMessageBox { data.height = 26; data.width = 350; debugPackage.setLayoutData(data); - debugPackage.setBackground(ColorResources.VIEW_BG_COLOR); + debugPackage.setBackground(ColorResources.WHITE); debugPackage.setText(debutStr); + debugPackage.addPaintListener(new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + e.gc.setForeground(ColorResources.BLUE); + Text text = (Text) e.widget; + Rectangle rect = text.getClientArea(); + e.gc.drawRectangle(rect.x, rect.y, rect.width -1, rect.height - 1); + e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3, rect.height - 3); + } + }); + Composite buttonComp = new Composite(shell, SWT.NONE); buttonComp.setLayout(new FormLayout()); buttonComp.setBackground(ColorResources.DIALOG_BG_LOWER); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAnalyzingConfigDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAnalyzingConfigDialog.java index 9159126..adb3c47 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAnalyzingConfigDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAnalyzingConfigDialog.java @@ -78,11 +78,11 @@ public class BinaryAnalyzingConfigDialog extends DAMessageBox { private DAButton okButton = null; private DAButton cancelButton = null; - private BinaryAnalyzingConfigDialog me = null; +// private BinaryAnalyzingConfigDialog me = null; public BinaryAnalyzingConfigDialog(Shell parentShell) { super(parentShell); - me = this; +// me = this; inputRowHash = BinarySettingManager.getInstance().getInputRowHash(); inputRowList = BinarySettingManager.getInstance().getInputRowList(); @@ -118,7 +118,7 @@ public class BinaryAnalyzingConfigDialog extends DAMessageBox { @Override public void handleClickEvent(DACustomButton button) { LoadSettingDialog dialog = new LoadSettingDialog(shell); - dialog.setParentDialog(me); +// dialog.setParentDialog(me); Object result = dialog.open(); if (result == null) { return; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/InputRow.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/InputRow.java index 6e33602..9dd8571 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/InputRow.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/InputRow.java @@ -154,23 +154,23 @@ public class InputRow extends Composite { data = new FormData(); data.top = new FormAttachment(0, 0); - // data.left = new FormAttachment(85, 3); - data.right = new FormAttachment(100, -25); - data.width = 80; - data.height = ROW_HEIGHT; - minusButton.setLayoutData(data); - minusButton.setText("remove"); - minusButton.addClickListener(minusButtonListener); - - data = new FormData(); - data.top = new FormAttachment(0, 0); // data.left = new FormAttachment(60, 5); - data.right = new FormAttachment(minusButton, -3); - data.width = 80; + data.left = new FormAttachment(sourcePathText, 3); + data.width = 65; data.height = ROW_HEIGHT; editButton.setLayoutData(data); editButton.setText("Edit"); editButton.addClickListener(editButtonListener); + + data = new FormData(); + data.top = new FormAttachment(0, 0); + // data.left = new FormAttachment(85, 3); + data.left = new FormAttachment(editButton, 3); + data.width = 65; + data.height = ROW_HEIGHT; + minusButton.setLayoutData(data); + minusButton.setText("remove"); + minusButton.addClickListener(minusButtonListener); // sourceCombo.setComboButtonGradation( // ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_START, diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/LoadSettingDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/LoadSettingDialog.java index a4bd611..c0d7ed8 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/LoadSettingDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/LoadSettingDialog.java @@ -80,7 +80,7 @@ public class LoadSettingDialog extends DAMessageBox { private DATableComposite saveTable = null; private DACustomButton okButton = null; private DACustomButton cancelButton = null; - BinaryAnalyzingConfigDialog parentDialog = null; +// BinaryAnalyzingConfigDialog parentDialog = null; private String[] columnNames = { "File name" }; private int[] columnSizes = { 390 }; @@ -325,7 +325,7 @@ public class LoadSettingDialog extends DAMessageBox { // } } - public void setParentDialog(BinaryAnalyzingConfigDialog pDlg) { - parentDialog = pDlg; - } +// public void setParentDialog(BinaryAnalyzingConfigDialog pDlg) { +// parentDialog = pDlg; +// } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java index 337db58..6730031 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java @@ -110,7 +110,7 @@ public class ToolbarArea { private DACustomButton openTraceButton; private DACustomButton replayButton; private DACustomButton configButton; - private DACustomButton binarySettingsButton; +// private DACustomButton binarySettingsButton; private DACustomButton aboutButton; @@ -416,16 +416,16 @@ public class ToolbarArea { } }); - binarySettingsButton - .addClickListener(new DACustomButtonClickEventListener() { - - @Override - public void handleClickEvent(DACustomButton button) { - BinaryAnalyzingConfigDialog dialog = new BinaryAnalyzingConfigDialog( - shell); - dialog.open(); - } - }); +// binarySettingsButton +// .addClickListener(new DACustomButtonClickEventListener() { +// +// @Override +// public void handleClickEvent(DACustomButton button) { +// BinaryAnalyzingConfigDialog dialog = new BinaryAnalyzingConfigDialog( +// shell); +// dialog.open(); +// } +// }); aboutButton.addClickListener(new DACustomButtonClickEventListener() { @@ -602,13 +602,13 @@ public class ToolbarArea { buttons.put(REPLAY_BUTTON, replayButton); // create binarySettingButton - binarySettingsButton = new DACustomButton(parent, - ImageResources.SCREEN_SHOT_TOGGLE, - ImageResources.SCREEN_SHOT_TOGGLE_PUSH, - ImageResources.SCREEN_SHOT_TOGGLE_HOVER, - ImageResources.SCREEN_SHOT_DISABLE); - binarySettingsButton.setToolTipText("Binary Settings"); - buttons.put(SETTING_BUTTON, binarySettingsButton); +// binarySettingsButton = new DACustomButton(parent, +// ImageResources.SCREEN_SHOT_TOGGLE, +// ImageResources.SCREEN_SHOT_TOGGLE_PUSH, +// ImageResources.SCREEN_SHOT_TOGGLE_HOVER, +// ImageResources.SCREEN_SHOT_DISABLE); +// binarySettingsButton.setToolTipText("Binary Settings"); +// buttons.put(SETTING_BUTTON, binarySettingsButton); // Creates config button configButton = new DACustomButton(parent, @@ -698,16 +698,16 @@ public class ToolbarArea { data.height = 30; configButton.setLayoutData(data); - data = new FormData(); - data.top = new FormAttachment(0, 4); - data.right = new FormAttachment(configButton, 0); - data.width = 34; // 31 - data.height = 30; - binarySettingsButton.setLayoutData(data); +// data = new FormData(); +// data.top = new FormAttachment(0, 4); +// data.right = new FormAttachment(configButton, 0); +// data.width = 34; // 31 +// data.height = 30; +// binarySettingsButton.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(0, 4); - data.right = new FormAttachment(binarySettingsButton, -5); + data.right = new FormAttachment(configButton, -5); data.width = 32; data.height = 30; viewSourceButton.setLayoutData(data); @@ -1042,9 +1042,9 @@ public class ToolbarArea { setRepalyButtonEnable(enabled); } - public void setBinarySettingsButtonEnablement(boolean enabled) { - binarySettingsButton.setButtonEnabled(enabled); - } +// public void setBinarySettingsButtonEnablement(boolean enabled) { +// binarySettingsButton.setButtonEnabled(enabled); +// } public void startTimer() { timerClock.start(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java new file mode 100644 index 0000000..d44fd2d --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java @@ -0,0 +1,366 @@ +package org.tizen.dynamicanalyzer.ui.toolbar.configuration; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.tizen.dynamicanalyzer.common.AnalyzerConstants; +import org.tizen.dynamicanalyzer.common.AnalyzerPaths; +import org.tizen.dynamicanalyzer.common.CommonConstants; +import org.tizen.dynamicanalyzer.communicator.DACommunicator; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.resources.FontResources; +import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData; +import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager; +import org.tizen.dynamicanalyzer.swap.platform.ui.BinaryAddDialog; +import org.tizen.dynamicanalyzer.swap.platform.ui.InputRow; +import org.tizen.dynamicanalyzer.swap.platform.ui.LoadSettingDialog; +import org.tizen.dynamicanalyzer.swap.platform.ui.SaveSettingDialog; +import org.tizen.dynamicanalyzer.ui.page.DAPageComposite; +import org.tizen.dynamicanalyzer.ui.widgets.DAButton; +import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; +import org.tizen.dynamicanalyzer.widgets.button.DACustomButton; +import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener; +import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioButton; +import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioGroup; +import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioSelectionListener; + +public class BinarySettingsPage extends DAPageComposite { + public static final String ID = BinarySettingsPage.class.getName(); + + private HashMap inputRowHash = null; + private List inputRowList = null; + + private ScrolledComposite scrolledComposite = null; + private Composite inputComposite = null; + // private DACustomToggleButton enableButton = null; + private DARadioButton addLibButton = null; + private DARadioButton removeLibButton = null; + + private DAButton cleanButton = null; + private DAButton addButton = null; + private DAButton saveButton = null; + private DAButton loadButton = null; + + private boolean isLoaded = false; + private boolean addLib = true; + + private DARadioSelectionListener addLibButtonListener = new DARadioSelectionListener() { + + @Override + public void handleSelectionEvent(DARadioButton radio) { + addLib = true; + } + }; + + private DARadioSelectionListener removeLibButtonListener = new DARadioSelectionListener() { + + @Override + public void handleSelectionEvent(DARadioButton radio) { + addLib = false; + } + }; + private DACustomButtonClickEventListener addButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + BinaryAddDialog dialog = new BinaryAddDialog(button.getParent() + .getShell()); + Object result = dialog.open(); + + if (result != null) { + @SuppressWarnings("unchecked") + List paths = (List) result; + InputRow inputRow = new InputRow(inputComposite); + inputRow.setBinaryText(paths.get(0)); + inputRow.setSourceText(paths.get(1)); + inputRowHash.put(paths.get(0), inputRow); + inputRowList.add(inputRow); + inputComposite.layout(); + } + } + }; + + private DACustomButtonClickEventListener loadButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + LoadSettingDialog dialog = new LoadSettingDialog(button.getParent() + .getShell()); + Object result = dialog.open(); + if (result == null) { + return; + } + + cleanButtonListener.handleClickEvent(null); + + String path = (String) result; + File saveFile = new File(path); + BufferedReader br = null; + String content = null; + try { + br = new BufferedReader(new FileReader(saveFile)); + while (null != (content = br.readLine())) { + InputRow inputRow = new InputRow(inputComposite); + String[] splitContent = content + .split(CommonConstants.COMMA); + inputRow.setBinaryText(new String(splitContent[0])); + inputRow.setSourceText(new String(splitContent[1])); + inputRowList.add(inputRow); + inputRowHash.put(inputRow.getBinaryText(), inputRow); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + AnalyzerUtil.tryClose(br); + } + inputComposite.layout(); + } + }; + + private DACustomButtonClickEventListener saveButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + SaveSettingDialog dialog = new SaveSettingDialog(button.getParent() + .getShell(), inputRowList); + dialog.open(); + // save dialog + // filename.setting + } + }; + + private DACustomButtonClickEventListener cleanButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + for (int i = 0; i < inputRowList.size(); i++) { + inputRowList.get(i).dispose(); + } + inputRowList.clear(); + inputRowHash.clear(); + } + }; + + public BinarySettingsPage(Composite parent, int style) { + super(parent, style); + + name = "Binary Settings"; + inputRowHash = BinarySettingManager.getInstance().getInputRowHash(); + inputRowList = BinarySettingManager.getInstance().getInputRowList(); + + String settingPath = AnalyzerPaths.DYNAMIC_ANALYZER_SETTING_PATH; + File settingFolder = new File(settingPath); + if (!settingFolder.exists() || !settingFolder.isDirectory()) { + settingFolder.mkdirs(); + } + + this.setLayout(new FormLayout()); + this.setBackground(ColorResources.DIALOG_BG_UPPER); + + Label msgTypeLabel = new Label(this, SWT.TRANSPARENT); + FormData data = new FormData(); + data.top = new FormAttachment(0, 6); + data.left = new FormAttachment(0, 8); + data.height = 16; + data.width = 60; + msgTypeLabel.setLayoutData(data); + msgTypeLabel.setText("Msessage :"); + msgTypeLabel.setBackground(ColorResources.DIALOG_BG_UPPER); + + DARadioGroup radioGroup = new DARadioGroup(); + addLibButton = new DARadioButton(this, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(0, 6); + data.left = new FormAttachment(msgTypeLabel, 22); + data.height = 16; + data.width = 100; + addLibButton.setLayoutData(data); + addLibButton.setForeground(ColorResources.BLACK); + addLibButton.setBackground(ColorResources.DIALOG_BG_UPPER); + addLibButton.setText("Add Libarry"); + addLibButton.addSelectionListener(addLibButtonListener); + radioGroup.addChild(addLibButton); + + removeLibButton = new DARadioButton(this, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(0, 6); + data.left = new FormAttachment(addLibButton, 22); + data.height = 16; + data.width = 120; + removeLibButton.setLayoutData(data); + removeLibButton.setForeground(ColorResources.BLACK); + removeLibButton.setBackground(ColorResources.DIALOG_BG_UPPER); + removeLibButton.setText("Remove Library"); + removeLibButton.addSelectionListener(removeLibButtonListener); + radioGroup.addChild(removeLibButton); + + Label binaryLabel = new Label(this, SWT.TRANSPARENT); + data = new FormData(); + data.top = new FormAttachment(msgTypeLabel, 12); + data.left = new FormAttachment(0, 20); + data.height = 10; + data.width = 148 + 80; + binaryLabel.setLayoutData(data); + binaryLabel.setForeground(ColorResources.BLACK); + binaryLabel.setText("Binary Name"); + binaryLabel.setBackground(ColorResources.DIALOG_BG_UPPER); + binaryLabel.setForeground(ColorResources.BLUE); + binaryLabel.setFont(FontResources.ADDITEM_BUTTON_FONT); + + Label sourceLabel = new Label(this, SWT.TRANSPARENT); + data = new FormData(); + data.top = new FormAttachment(msgTypeLabel, 12); + data.left = new FormAttachment(binaryLabel, 3); + data.height = 10; + data.width = 207 + 60; + sourceLabel.setLayoutData(data); + sourceLabel.setForeground(ColorResources.BLACK); + sourceLabel.setText("Source Path"); + sourceLabel.setBackground(ColorResources.DIALOG_BG_UPPER); + sourceLabel.setForeground(ColorResources.BLUE); + sourceLabel.setFont(FontResources.ADDITEM_BUTTON_FONT); + + scrolledComposite = new ScrolledComposite(this, SWT.BORDER + | SWT.V_SCROLL | SWT.H_SCROLL); + data = new FormData(); + data.top = new FormAttachment(binaryLabel, 6); + data.left = new FormAttachment(0, 6); + data.height = 210; + data.width = 590; + scrolledComposite.setLayoutData(data); + scrolledComposite.setLayout(new FormLayout()); + scrolledComposite.setBackground(ColorResources.BLUE); + scrolledComposite.setExpandHorizontal(true); + scrolledComposite.setExpandVertical(true); + + // scrolledComposite.setMinSize(WIDTH - 30, 200); + + inputComposite = new Composite(scrolledComposite, SWT.NONE); + scrolledComposite.setContent(inputComposite); + scrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT, + SWT.DEFAULT)); + scrolledComposite.setShowFocusedControl(true); + data = new FormData(); + data.top = new FormAttachment(binaryLabel, 5); + data.left = new FormAttachment(0, 15); + data.height = 210; + data.width = 590; + inputComposite.setLayoutData(data); + inputComposite.setLayout(new FormLayout()); + inputComposite.setBackground(ColorResources.DIALOG_BG_UPPER); + + saveButton = new DAButton(this, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(scrolledComposite, 5); + data.left = new FormAttachment(0, 6); + data.height = 22; + data.width = 100; + saveButton.setLayoutData(data); + saveButton.setText("Save Settings"); + saveButton.addClickListener(saveButtonListener); + + loadButton = new DAButton(this, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(scrolledComposite, 5); + data.left = new FormAttachment(saveButton, 8); + data.height = 22; + data.width = 100; + loadButton.setLayoutData(data); + loadButton.setText("Load Settings"); + loadButton.addClickListener(loadButtonListener); + + addButton = new DAButton(this, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(scrolledComposite, 5); + data.right = new FormAttachment(100, -8); + data.height = 22; + data.width = 100; + addButton.setLayoutData(data); + addButton.setText("Add"); + addButton.addClickListener(addButtonListener); + + cleanButton = new DAButton(this, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(scrolledComposite, 5); + data.right = new FormAttachment(addButton, -8); + data.height = 22; + data.width = 100; + cleanButton.setLayoutData(data); + cleanButton.setText("Clear All"); + cleanButton.addClickListener(cleanButtonListener); + + inputRowList.clear(); + inputRowHash.clear(); + + this.addListener(SWT.Show, new Listener() { + + @Override + public void handleEvent(Event event) { + System.out.println("show listener"); + initInputRows(); + } + }); + + } + + public void deApply() { + List tempBinarySettings = new ArrayList(); + for (InputRow input : inputRowList) { + BinarySettingData binaryData = new BinarySettingData(); + binaryData.setBinaryPath(input.getBinaryText()); + binaryData.setDebugPath(input.getSourceText()); + tempBinarySettings.add(binaryData); + } + BinarySettingManager.getInstance().putBinarySettingData( + tempBinarySettings); + BinarySettingManager.getInstance().checkSourcePath(); + + DACommunicator.sendBinaryInfoMessageForLib(); + int swapMsg = AnalyzerConstants.MSG_SWAP_INST_ADD; + if (!addLib) { + swapMsg = AnalyzerConstants.MSG_SWAP_INST_REMOVE; + } + DACommunicator.sendSWAPMessage(swapMsg); + } + + public void initInputRows() { + if (!isLoaded) { + List binData = BinarySettingManager + .getInstance().getBinarySettings(); + for (int i = 0; i < binData.size(); i++) { + InputRow inputRow = new InputRow(inputComposite); + inputRow.setBinaryText(binData.get(i).getBinaryPath()); + String source = binData.get(i).getSourcePath(); + if (null != source && !source.isEmpty()) { + inputRow.setSourceText(source); + // String[] splitSource = + // source.split(CommonConstants.SLASH); + // String comboSel = new String( + // splitSource[splitSource.length - 1]); + // inputRow.setSourceComboText(comboSel); + } + inputRowHash.put(binData.get(i).getBinaryPath(), inputRow); + inputRowList.add(inputRow); + } + inputComposite.layout(); + isLoaded = true; + } + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialog.java index 10a4769..e2a3ebd 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialog.java @@ -52,7 +52,7 @@ import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener public class ConfigurationDialog extends DAMessageBox { private static boolean opened = false; private DACustomButton applyButton = null; - private DACustomButton okButton = null; + // private DACustomButton okButton = null; private DACustomButton cancelButton = null; DATabComposite tabView = null; @@ -69,14 +69,6 @@ public class ConfigurationDialog extends DAMessageBox { } }; - private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() { - - @Override - public void handleClickEvent(DACustomButton button) { - doApply(); - shell.dispose(); - } - }; private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() { @Override @@ -87,9 +79,17 @@ public class ConfigurationDialog extends DAMessageBox { }; private void doApply() { - ConfigurationDialogValues.getInstance().applySettingValueToConfigFile(); - - DACommunicator.sendRuntimeMessage(DACommunicator.MSG_TYPE_CONFIG, null); + Composite selectedComposite = tabView.getTopComposite(); + if (!(selectedComposite instanceof BinarySettingsPage)) { + ConfigurationDialogValues.getInstance() + .applySettingValueToConfigFile(); + + DACommunicator.sendRuntimeMessage(DACommunicator.MSG_TYPE_CONFIG, + null); + } else { + BinarySettingsPage page = (BinarySettingsPage) selectedComposite; + page.deApply(); + } } private void doBack() { @@ -160,6 +160,9 @@ public class ConfigurationDialog extends DAMessageBox { tabView.getContentComposite(), SWT.NONE); tabView.addView(settingPage, false); + Composite binarySettings = new BinarySettingsPage( + tabView.getContentComposite(), SWT.NONE); + tabView.addView(binarySettings, false); // button Composite buttonContentsComp = new Composite(shell, SWT.NONE); buttonContentsComp.addPaintListener(new PaintListener() { @@ -185,32 +188,32 @@ public class ConfigurationDialog extends DAMessageBox { cancelButton = new DAButton(buttonContentsComp, SWT.NONE); cancelButton.addClickListener(cancelButtonListener); - cancelButton.setText(AnalyzerLabels.CANCEL); + cancelButton.setText(AnalyzerLabels.CLOSE); cancelButton.setFont(FontResources.DIALOG_BUTTON_FONT); FormData buttonData = new FormData(); - buttonData.right = new FormAttachment(100, -9); + buttonData.left = new FormAttachment(50, 4); buttonData.top = new FormAttachment(0, 11); buttonData.width = 100; buttonData.height = 28; cancelButton.setLayoutData(buttonData); - okButton = new DAButton(buttonContentsComp, SWT.NONE); - okButton.addClickListener(okButtonListener); - okButton.setText(AnalyzerLabels.OK); - okButton.setFont(FontResources.DIALOG_BUTTON_FONT); - buttonData = new FormData(); - buttonData.right = new FormAttachment(cancelButton, -8); - buttonData.top = new FormAttachment(0, 11); - buttonData.width = 100; - buttonData.height = 28; - okButton.setLayoutData(buttonData); + // okButton = new DAButton(buttonContentsComp, SWT.NONE); + // okButton.addClickListener(okButtonListener); + // okButton.setText(AnalyzerLabels.OK); + // okButton.setFont(FontResources.DIALOG_BUTTON_FONT); + // buttonData = new FormData(); + // buttonData.right = new FormAttachment(50, -4); + // buttonData.top = new FormAttachment(0, 11); + // buttonData.width = 100; + // buttonData.height = 28; + // okButton.setLayoutData(buttonData); applyButton = new DAButton(buttonContentsComp, SWT.NONE); applyButton.addClickListener(applyButtonListener); applyButton.setText(AnalyzerLabels.APPLY); applyButton.setFont(FontResources.DIALOG_BUTTON_FONT); buttonData = new FormData(); - buttonData.right = new FormAttachment(okButton, -8); + buttonData.right = new FormAttachment(50, -4); buttonData.top = new FormAttachment(0, 11); buttonData.width = 100; buttonData.height = 28; -- 2.7.4