*/
public void setText(String newTitle) {
attr.setText(newTitle);
+ this.redraw();
}
/**
+ File.separator + AnalyzerConstants.TEMP_FOLDER_NAME;
public static final String CONFIG_FOLDER_PATH = PathManager
.getConfigFolderPath();
- public static final String WORKBENCH_FOLDER_PATH = PathManager.getWorkbenchPath();
+ public static final String WORKBENCH_FOLDER_PATH = PathManager
+ .getWorkbenchPath();
public static final String ABOUT_FILE_PATH = PathManager.getAboutPath();
public static final String SDB_PATH = PathManager.getSdbPath();
public static final String READELF_PATH = DYNAMIC_ANALYZER_INSTALL_PATH
+ AnalyzerConstants.TOOLS_FOLDER_NAME + File.separator
+ "smart-build-interface" + File.separator + "bin" + File.separator
+ "sbi";
-
+
public static final String SDK_INFO_RELATIVE_PATH = "../../sdk.info"; //$NON-NLS-1$
+ public static final String BINARY_AUTO_SAVE_PATH = PathManager
+ .getSavePath() + File.separator + "BinarySettings.save";
}
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PerspectiveAdapter;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
public class AnalyzerPerspectiveListener extends PerspectiveAdapter {
DACommunicator.addDeviceListener();
DACommunicator.loadDevices();
DACommunicator.updateToolbarDevice();
+ BinarySettingManager.getInstance().initBinarySettings();
init = true;
}
}
setDebugSourcePath(splitContent[1]);
setDebugRpmPath(splitContent[2]);
setDebugFilePath(splitContent[3]);
- setUserSourcePath(splitContent[4]);
+ if (splitContent.length >= 5) {
+ setUserSourcePath(splitContent[4]);
+ }
}
public boolean isEqual(String binPath) {
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.PathManager;
import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
+import org.tizen.dynamicanalyzer.swap.platform.ui.BinarySettingProcessor;
+import org.tizen.dynamicanalyzer.swap.platform.ui.BinarySettingProgressManager;
import org.tizen.dynamicanalyzer.swap.platform.ui.InputRow;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
private List<BinarySettingData> realBinarySettings = new ArrayList<BinarySettingData>();
private String debugRoot = PathManager.getRootStrapsPath();
-
+
public static synchronized BinarySettingManager getInstance() {
if (null == instance) {
instance = new BinarySettingManager();
public void setDebugRoot(String debugRoot) {
this.debugRoot = debugRoot;
}
+
+ public void initBinarySettings() {
+ File saveFile = new File(AnalyzerPaths.BINARY_AUTO_SAVE_PATH);
+ BufferedReader br = null;
+ String content = null;
+ try {
+ List<BinarySettingData> binarySettings = new ArrayList<BinarySettingData>();
+ br = new BufferedReader(new FileReader(saveFile));
+ while (null != (content = br.readLine())) {
+ BinarySettingData binaryData = new BinarySettingData();
+ binaryData.loadSaveData(content);
+ binarySettings.add(binaryData);
+ }
+
+ BinarySettingManager.getInstance().putRealBinarySettingData(
+ binarySettings);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ AnalyzerUtil.tryClose(br);
+ }
+ }
}
FileExplorerDialog dialog = new FileExplorerDialog(getShell());
dialog.setFilter("debug");
dialog.getExplorer().setRoot(
- BinarySettingManager.getInstance().getDebugRoot());
+// BinarySettingManager.getInstance().getDebugRoot());
+ "/home/");
Object result = dialog.open();
List<BinarySettingData> bins = new ArrayList<BinarySettingData>();
if (result != null) {
package org.tizen.dynamicanalyzer.ui.toolbar.configuration;
import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
+import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerDialog;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
+import org.tizen.dynamicanalyzer.ui.widgets.WarningDialog;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
@Override
public void handleClickEvent(DACustomButton button) {
+ if (null != button) {
+ WarningDialog dialog = new WarningDialog(getShell(), SWT.NONE);
+ dialog.setMessage("Clear binary settings?\nIf you click 'Ok', All settings will be deleted");
+ boolean result = dialog.open();
+ if (!result) {
+ return;
+ }
+ }
List<BinarySettingData> binaries = BinarySettingManager
.getInstance().getRealBinarySettings();
if (!binaries.isEmpty()) {
System.out.println("update complete!");
}
+ public void doClose() {
+ String targetPath = AnalyzerPaths.BINARY_AUTO_SAVE_PATH;
+
+ File saveFile = new File(targetPath);
+ FileWriter fileWriter = null;
+ BufferedWriter bufWriter = null;
+
+ List<BinarySettingData> saveData = BinarySettingManager.getInstance()
+ .getRealBinarySettings();
+
+ boolean success = false;
+ try {
+ fileWriter = new FileWriter(saveFile);
+ bufWriter = new BufferedWriter(fileWriter);
+ for (int i = 0; i < saveData.size(); i++) {
+ bufWriter.write(saveData.get(i).getSaveData());
+ bufWriter.newLine();
+ }
+ success = true;
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ AnalyzerUtil.tryClose(bufWriter, fileWriter);
+ }
+
+ if (success) {
+ // add snapshot model update
+ System.out.println("binary settings auto save success!!"); //$NON-NLS-1$
+
+ } else {
+ System.out.println("binary settings auto save fail..."); //$NON-NLS-1$
+ }
+ }
+
public void initInputRows() {
List<BinarySettingData> binData = null;
binData = BinarySettingManager.getInstance().getRealBinarySettings();
for (int i = 0; i < binData.size(); i++) {
InputRow inputRow = new InputRow(inputComposite);
inputRow.setBinaryText(binData.get(i).getBinaryPath());
-// String debug = binData.get(i).getDebugFilePath();
+ // String debug = binData.get(i).getDebugFilePath();
String debug = binData.get(i).getDebugRpmPath();
if (null != debug && !debug.isEmpty()) {
inputRow.setDebugText(debug);
if (null != source && !source.isEmpty()) {
inputRow.setSourceText(source);
} else {
- inputRow.setSourceText(CommonConstants.EMPTY);
+ source = binData.get(i).getDebugSourcePath();
+ if (null != source && !source.isEmpty()) {
+ inputRow.setSourceText(source);
+ } else {
+ inputRow.setSourceText(CommonConstants.EMPTY);
+ }
}
inputRowHash.put(binData.get(i).getBinaryPath(), inputRow);
inputRowList.add(inputRow);
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.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
private DACustomButton applyButton = null;
private DACustomButton okButton = null;
private DACustomButton cancelButton = null;
- DATabComposite tabView = null;
+ private DATabComposite tabView = null;
+ private Composite buttonContentsComp = null;
private DATableComposite featuresTable;
public ConfigurationDialog(Shell parent) {
}
private void doBack() {
- ConfigurationDialogDataManager.getInstance()
- .setSettingValueFromConfigureManager();
+ Composite selectedComposite = tabView.getTopComposite();
+ if (!(selectedComposite instanceof BinarySettingsPage)) {
+ ConfigurationDialogDataManager.getInstance()
+ .setSettingValueFromConfigureManager();
+ } else {
+ BinarySettingsPage page = (BinarySettingsPage) selectedComposite;
+ page.doClose();
+ }
+
+
}
public void enableButteon() {
tabView.getContentComposite(), SWT.NONE);
tabView.addView(binarySettings, false);
// button
- Composite buttonContentsComp = new Composite(shell, SWT.NONE);
+ buttonContentsComp = new Composite(shell, SWT.NONE);
buttonContentsComp.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
e.gc.drawLine(0, 0, rect.x + rect.width, 0);
}
});
+
+ binarySettings.addListener(SWT.Show, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ System.out.println("binary settings show");
+ cancelButton.setText(AnalyzerLabels.CLOSE);
+ FormData data = (FormData) okButton.getLayoutData();
+ data.width = 0;
+
+ data = (FormData) applyButton.getLayoutData();
+ data.width = 0;
+
+ buttonContentsComp.layout();
+ }
+ });
+
+ binarySettings.addListener(SWT.Hide, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ System.out.println("binary settings hide");
+ cancelButton.setText(AnalyzerLabels.CANCEL);
+ FormData data = (FormData) okButton.getLayoutData();
+ data.width = 100;
+
+ data = (FormData) applyButton.getLayoutData();
+ data.width = 100;
+
+ buttonContentsComp.layout();
+ }
+ });
+
compLayout = new FormLayout();
buttonContentsComp.setLayout(compLayout);
buttonContentsComp
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Image;
+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.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.DesignConstants;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+
+public class WarningDialog {
+
+ private Shell parent = null;
+ private Shell shell = null;
+ private DACustomButton okButton = null;
+ private DACustomButton cancelButton = null;
+ private String message = CommonConstants.EMPTY;
+ private boolean returnType = false;
+ private String titleText = AnalyzerLabels.DA_WARNING;
+
+ private Image iconImage = ImageResources.DIALOG_WARNING_ICON;
+
+ private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ returnType = true;
+ shell.dispose();
+ }
+ };
+
+ private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ returnType = false;
+ shell.dispose();
+ }
+ };
+
+ public WarningDialog(Shell parent, int style) {
+ this.parent = parent;
+ }
+
+ public WarningDialog(Shell parent, int style, int width, int height) {
+ this(parent, style);
+ }
+
+ public boolean open() {
+ shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
+ shell.setSize(446, 153);
+ shell.setLayout(new FormLayout());
+ shell.setText(titleText);
+
+ Composite base = new Composite(shell, SWT.NONE);
+ base.setLayout(new FormLayout());
+ FormData baseData = new FormData();
+ baseData.top = new FormAttachment(0, 0);
+ baseData.left = new FormAttachment(0, 0);
+ baseData.right = new FormAttachment(100, 0);
+ baseData.height = 76;
+ base.setLayoutData(baseData);
+ base.setVisible(true);
+ base.setBackground(ColorResources.DIALOG_BG_UPPER);
+
+ // Icon
+ Label icon = new Label(base, SWT.TRANSPARENT);
+ icon.setBackground(ColorResources.DIALOG_BG_UPPER);
+ icon.setImage(iconImage);
+
+ // Contents
+ Label strMessage = new Label(base, SWT.TRANSPARENT);
+ strMessage.setText(message);
+ strMessage.setBackground(ColorResources.DIALOG_BG_UPPER);
+ strMessage.setAlignment(SWT.LEFT);
+ strMessage.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+ strMessage.setFont(FontResources.ABOUT_TEXT);
+
+ FormData labelData = new FormData();
+ labelData.left = new FormAttachment(0, 15);
+ labelData.top = new FormAttachment(0, 6);
+ labelData.height = 64;
+ labelData.width = 64;
+ icon.setLayoutData(labelData);
+
+ labelData = new FormData();
+ labelData.left = new FormAttachment(0, 95);
+ labelData.right = new FormAttachment(100, 0);
+ labelData.top = new FormAttachment(0, 15);
+ labelData.height = 40;
+ strMessage.setLayoutData(labelData);
+
+ Composite buttonComp = new Composite(shell, SWT.NONE);
+ FormLayout compLayout = new FormLayout();
+ buttonComp.setLayout(compLayout);
+ buttonComp.setBackground(ColorResources.DIALOG_BG_LOWER);
+
+ buttonComp.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Composite comp = (Composite) e.widget;
+ Rectangle rect = comp.getClientArea();
+ e.gc.setForeground(ColorResources.DIALOG_SUNKEN_1);
+ e.gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y);
+ e.gc.setForeground(ColorResources.DIALOG_SUNKEN_2);
+ e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width,
+ rect.y + 1);
+ }
+ });
+
+ FormData compData = new FormData();
+ compData.top = new FormAttachment(base, 0);
+ compData.left = new FormAttachment(0, 0);
+ compData.right = new FormAttachment(100, 0);
+ compData.bottom = new FormAttachment(100, 0);
+ buttonComp.setLayoutData(compData);
+
+ cancelButton = new DAButton(buttonComp, SWT.NONE);
+ cancelButton.addClickListener(cancelButtonListener);
+ cancelButton.setText(AnalyzerLabels.CANCEL);
+ cancelButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 12);
+ data.right = new FormAttachment(100, -9);
+ data.width = DesignConstants.DA_BUTTON_WIDTH;
+ data.height = DesignConstants.DA_BUTTON_HEIGHT;
+ cancelButton.setLayoutData(data);
+
+ okButton = new DAButton(buttonComp, SWT.NONE);
+ okButton.addClickListener(okButtonListener);
+ okButton.setText(AnalyzerLabels.OK);
+ okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+
+ FormData okData = new FormData();
+ okData.top = new FormAttachment(0, 12);
+ okData.right = new FormAttachment(cancelButton, -5);
+ okData.width = DesignConstants.DA_BUTTON_WIDTH;
+ okData.height = DesignConstants.DA_BUTTON_HEIGHT;
+ okButton.setLayoutData(okData);
+
+ shell.open();
+
+ Display display = Display.getCurrent();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+
+ shell.dispose();
+ return returnType;
+ }
+
+ public void setMessage(String msg) {
+ message = msg;
+ }
+
+ public void setIcon(Image img) {
+ iconImage = img;
+ }
+
+ public void setTitleText(String title) {
+ titleText = title;
+ }
+}