summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSungho Park <chywoo.park@samsung.com>2012-04-30 18:00:41 +0900
committerSungho Park <chywoo.park@samsung.com>2012-04-30 18:00:41 +0900
commit497d5ab077dbf5ca4146e516535da17e3f7314db (patch)
treea46adc901a9e63486c59d8075870ca4c2a784178
parentcfbb72d16bcace565c28948592ef0017c825bafc (diff)
downloadcommon-eplugin-1.0_post.tar.gz
common-eplugin-1.0_post.tar.bz2
common-eplugin-1.0_post.zip
upload tizen1.0 source1.0_post
Change-Id: I8896457eb56e065f7a57ec9932a3b8a69d497c45
-rw-r--r--README10
-rw-r--r--org.tizen.common.connection/META-INF/MANIFEST.MF2
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java13
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java46
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java281
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java218
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/log/LogUIMessages.java53
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/log/LogUIMessages.properties17
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java17
-rw-r--r--org.tizen.common.feature/feature.xml2
-rw-r--r--org.tizen.common/META-INF/MANIFEST.MF2
-rw-r--r--org.tizen.common/icons/msg_close_hover.pngbin0 -> 3270 bytes
-rw-r--r--org.tizen.common/icons/msg_close_normal.pngbin0 -> 3192 bytes
-rw-r--r--org.tizen.common/icons/msg_close_push.pngbin0 -> 3312 bytes
-rw-r--r--org.tizen.common/plugin.xml22
-rw-r--r--org.tizen.common/src/org/tizen/common/console/ConsoleManager.java6
-rw-r--r--org.tizen.common/src/org/tizen/common/control/TableViewColumnSorter.java4
-rw-r--r--org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.properties2
-rw-r--r--org.tizen.common/src/org/tizen/common/properties/InstallPathConfig.java4
-rw-r--r--org.tizen.common/src/org/tizen/common/swt/CommonColor.java43
-rw-r--r--org.tizen.common/src/org/tizen/common/update/UpdateManager.java (renamed from org.tizen.common/src/org/tizen/common/util/UpdateManager.java)69
-rw-r--r--org.tizen.common/src/org/tizen/common/update/UpdateMessages.properties3
-rw-r--r--org.tizen.common/src/org/tizen/common/util/FileUtil.java55
-rw-r--r--org.tizen.common/src/org/tizen/common/util/HostUtil.java55
-rw-r--r--org.tizen.common/src/org/tizen/common/util/NotificationType.java115
-rw-r--r--org.tizen.common/src/org/tizen/common/util/NotifierDialog.java697
-rw-r--r--org.tizen.common/src/org/tizen/common/util/SWTUtil.java39
-rw-r--r--org.tizen.common/src/org/tizen/common/util/ShellParser.java80
-rw-r--r--package/pkginfo.manifest8
29 files changed, 1112 insertions, 751 deletions
diff --git a/README b/README
new file mode 100644
index 000000000..a1d85699d
--- /dev/null
+++ b/README
@@ -0,0 +1,10 @@
+BUILD OVERVIEW
+==============
+Currently you can build some components of SDK and apply to installed SDK
+directory(a.k.a tizen-sdk).
+
+The procedure is as follows:
+
+1. Git clone "sdk-build.git".
+2. Open "sdk-build/tizen-ide" folder.
+3. You can find "README" file in "sdk-build/tizen-ide" folder. Just follow guideline in "README" file.
diff --git a/org.tizen.common.connection/META-INF/MANIFEST.MF b/org.tizen.common.connection/META-INF/MANIFEST.MF
index c4e0d3928..3aa5a4cd4 100644
--- a/org.tizen.common.connection/META-INF/MANIFEST.MF
+++ b/org.tizen.common.connection/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tizen Common Connection
Bundle-SymbolicName: org.tizen.common.connection;singleton:=true
-Bundle-Version: 1.17.0.qualifier
+Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.tizen.common.connection.ConnectionPlugin
Bundle-Vendor: Samsung
Require-Bundle: org.eclipse.ui,
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java
index 144e688f8..c62827865 100644
--- a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java
@@ -204,10 +204,13 @@ class InstallProgress implements IRunnableWithProgress {
monitor.worked(5);
if (isCopied) {
try {
- device.executeShellCommand("rm -rf " + DebugTool.TOOLS_TARGET_PATH + "/" + tool.getPackagename() + ";"
- + "cd " + DebugTool.TOOLS_TARGET_PATH + " && tar -xzf " + tool.getBinaryname() + ";"
- + "echo 'version:" + tool.getVersion() + "' >" + DebugTool.TOOLS_TARGET_PATH + "/" + tool.getControlFile() + ";"
- + "cd " + DebugTool.TOOLS_TARGET_PATH + " && rm " + tool.getBinaryname());
+ //make one string command for sequential executing
+ device.executeShellCommand(
+ "rm -rf " + DebugTool.TOOLS_TARGET_PATH + "/" + tool.getPackagename() + ";"
+ + "cd " + DebugTool.TOOLS_TARGET_PATH + " && tar -xzf " + tool.getBinaryname() + ";"
+ + "echo 'version:" + tool.getVersion() + "' >" + DebugTool.TOOLS_TARGET_PATH + "/" + tool.getControlFile() + ";"
+ + "cd " + DebugTool.TOOLS_TARGET_PATH + " && rm " + tool.getBinaryname());
+
} catch (IOException e) {
Logger.error("Error after copied " + tool.getPackagename() , e);
}
@@ -318,4 +321,4 @@ public class ToolsInstall {
});
}
-} \ No newline at end of file
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java
index be746c826..2d6ccd340 100644
--- a/org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java
@@ -3,10 +3,10 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
-* Contact:
+* Contact:
* Hoon Kang <h245.kang@samsung.com>
* Hyunsik Noh <hyunsik.noh@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
@@ -44,7 +44,6 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.tizen.common.connection.ddmuilib.FileDialogUtils;
-
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.SmartDevelopmentBridge;
@@ -59,13 +58,13 @@ public class AddViewDialog extends Dialog {
private Shell parent;
private Shell shell;
-
+
private String dialogName = null;
private boolean bOk = false;
private LogTab oldTab = null;
-
+
private static final String TEMPNAME = "LogTab-#";
private static int cnt = 0;
@@ -99,11 +98,11 @@ public class AddViewDialog extends Dialog {
if (tab.getFilterDeviceName() == null)
return;
device = tab.getFilterDeviceName();
-
+
pidKeyword = tab.getPidFilter();
tagKeyword = tab.getTagFilter();
msgKeyword = tab.getMsgFilter();
-
+
oldTab = tab;
}
}
@@ -111,7 +110,7 @@ public class AddViewDialog extends Dialog {
/**
* Opens the dialog. The method will return when the user closes the dialog
* somehow.
- *
+ *
* @return true if ok was pressed, false if cancelled.
*/
public boolean open() {
@@ -149,6 +148,7 @@ public class AddViewDialog extends Dialog {
shell.setLayout(new GridLayout(1, false));
shell.addListener(SWT.Close, new Listener() {
+ @Override
public void handleEvent(Event event) {
}
});
@@ -198,7 +198,7 @@ public class AddViewDialog extends Dialog {
mid.setText("Search Keywords");
mid.setLayoutData(new GridData(GridData.FILL_BOTH));
mid.setLayout(new GridLayout(2, false));
-
+
l = new Label(mid, SWT.NONE);
l.setText("Tag : ");
@@ -208,7 +208,7 @@ public class AddViewDialog extends Dialog {
tagText.setMessage("Separated by a space/comma");
tagText.setToolTipText("Search Tag Keywords are separated by a space as well as a comma");
tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
l = new Label(mid, SWT.NONE);
l.setText("Pid : ");
@@ -218,7 +218,7 @@ public class AddViewDialog extends Dialog {
pidText.setMessage("Separated by a space/comma");
pidText.setToolTipText("Search Pid Keywords are separated by a space as well as a comma");
pidText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
l = new Label(mid, SWT.NONE);
l.setText("Message : ");
@@ -242,39 +242,39 @@ public class AddViewDialog extends Dialog {
public void widgetSelected(SelectionEvent e) {
String newName = tabNameText.getText();
for (LogTab tab : LogPanel.tabs) {
- if (tab.getFilterName().equals(newName)) {
+ if (tab.getFilterName().equals(newName)) {
if (oldTab != null && oldTab == tab)
- continue;
+ continue;
int ret = FileDialogUtils.getInstance().checkTabName(newName);
if (ret == IDialogConstants.OK_ID)
return;
}
}
-
+
bOk = true;
-
+
if (tabNameText.getText().length() != 0)
tabName = tabNameText.getText();
else
tabName = TEMPNAME + cnt++;
-
+
if (tagText.getText().length() != 0)
tagKeyword = tagText.getText();
else
tagKeyword = null;
-
+
if (pidText.getText().length() != 0)
pidKeyword = pidText.getText();
else
pidKeyword = null;
-
+
if (msgText.getText().length() != 0)
msgKeyword = msgText.getText();
else
msgKeyword = null;
-
+
device = dCombo.getItem(dCombo.getSelectionIndex());
-
+
shell.close();
}
});
@@ -298,15 +298,15 @@ public class AddViewDialog extends Dialog {
public String getDevice() {
return device;
}
-
+
public String getPidKeyword() {
return pidKeyword;
}
-
+
public String getTagKeyword() {
return tagKeyword;
}
-
+
public String getMsgKeyword() {
return msgKeyword;
}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java
index b0b10e9b9..12b45b632 100644
--- a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java
@@ -3,10 +3,10 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
-* Contact:
+* Contact:
* Hoon Kang <h245.kang@samsung.com>
* Hyunsik Noh <hyunsik.noh@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
@@ -63,9 +63,11 @@ import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.tizen.common.connection.ddmuilib.FileDialogUtils;
import org.tizen.common.connection.ddmuilib.ITableFocusListener;
-import org.tizen.common.connection.ddmuilib.Panel;
import org.tizen.common.connection.ddmuilib.ITableFocusListener.IFocusedTableActivator;
-
+import org.tizen.common.connection.ddmuilib.Panel;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.NotificationType;
+import org.tizen.common.util.NotifierDialog;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.Log.LogLevel;
import org.tizen.sdblib.SmartDevelopmentBridge;
@@ -73,22 +75,27 @@ import org.tizen.sdblib.SmartDevelopmentBridge.IDeviceChangeListener;
public class LogPanel extends Panel implements IDeviceChangeListener {
- public static final int ENABLE_NOTHING = 0;
- public static final int ENABLE_DEFAULT = 1;
- public static final int ENABLE_ALL = 2;
+ public static final int ACTION_NOTHING = 0;
+ public static final int ACTION_DEVICE_TAB = 1;
+ public static final int ACTION_ADDITIONAL_TAB = 2;
public static ArrayList<LogTab> tabs = new ArrayList<LogTab>();
-
+
private String defaultLogSave;
private static int tabCnt = 0;
+
private Composite parent;
private TabFolder folders;
- private Text filterText;
+ private Table table;
+
+ private Combo panelFilterIndex;
+ private Text panelFilterKeyword;
+
+ private final LogColors colors;
- private LogColors colors;
-
private LogTab currentTab;
+
private Action[] levelActions;
private Action addAction;
private Action removeAction;
@@ -96,6 +103,8 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
private Action exportAction;
private Action clearAction;
+ private Control control;
+
/** message data, separated from content for multi line messages */
protected static class LogMessageInfo {
public LogLevel logLevel;
@@ -119,7 +128,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
/**
* Create the log panel with some default parameters
- *
+ *
* @param colors
* The display color object
*/
@@ -152,31 +161,43 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
folders.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
-
- currentTab = getCurrentLogTab();
- if (currentTab == null)
- return;
- currentTab.initTab();
- currentTab.setLevelIcon(levelActions);
-
- if (currentTab.isDefault()) {
- setActionEnabled(LogPanel.ENABLE_DEFAULT);
- } else {
- setActionEnabled(LogPanel.ENABLE_ALL);
- }
+ selectLogTab();
}
});
+ control = getTabControl(folders);
SmartDevelopmentBridge.addDeviceChangeListener(this);
+ //Create default device tab if device(s) is connectied
createDefaultTabs();
-
+ selectLogTab();
return null;
}
+ private void selectLogTab()
+ {
+ //1.get selected tabitem's logtab
+ //2.set previous logtab view filter and get selected logtab view filter
+ initViewFilter(getCurrentLogTab());
+ if (currentTab == null)
+ return;
+ //remove all message and re-fill message into table from selected logtab msg buffer
+ currentTab.initTab();
+
+ //set icon selection from selected logtab object
+ currentTab.setLevelIcon(levelActions);
+
+ //Set action enabled state from selected tab(LotTab object)
+ if (currentTab.isDefault()) {
+ setActionEnabled(LogPanel.ACTION_DEVICE_TAB);
+ } else {
+ setActionEnabled(LogPanel.ACTION_ADDITIONAL_TAB);
+ }
+ }
+
/**
- *
+ *
* Create the LogFilters with default devicesd
- *
+ *
*/
private void createDefaultTabs() {
SmartDevelopmentBridge sdbBridge = SmartDevelopmentBridge.getBridge();
@@ -198,7 +219,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
private LogTab createDefaultTab(IDevice device, String tabName) {
LogTab tab = createTab(device, null);
tab.setDefault();
- setActionEnabled(LogPanel.ENABLE_DEFAULT);
+ setActionEnabled(LogPanel.ACTION_DEVICE_TAB);
return tab;
}
@@ -226,23 +247,40 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
TabItem item = new TabItem(folders, SWT.NONE, tabCnt++);
item.setText(tab.getFilterName());
-
- item.setControl(getTabControl(folders, tab));
+ tab.setTable(table);
+ item.setControl(control);
tab.setTab(item);
folders.setSelection(item);
tabs.add(tab);
if (tab.isDefault()) {
- setActionEnabled(LogPanel.ENABLE_DEFAULT);
+ setActionEnabled(LogPanel.ACTION_DEVICE_TAB);
} else {
- setActionEnabled(LogPanel.ENABLE_ALL);
+ setActionEnabled(LogPanel.ACTION_ADDITIONAL_TAB);
}
tab.setLevelIcon(levelActions);
return tab;
}
- private Control getTabControl(TabFolder tabFolder, final LogTab tab) {
+ private void initViewFilter(LogTab tab)
+ {
+ if(currentTab != null)
+ {
+ currentTab.setFilterIndexFromPanel(panelFilterIndex.getSelectionIndex());
+ currentTab.setFilterKeywordFromPanel(panelFilterKeyword.getText());
+ }
+
+ currentTab = tab;
+
+ if(tab != null)
+ {
+ panelFilterIndex.select(tab.getFilterIndexFromPanel());
+ panelFilterKeyword.setText(tab.getFilterKeywordFromPanel());
+ }
+ }
+
+ private Control getTabControl(TabFolder tabFolder) {
// Create a composite and add four buttons to it
Composite composite = new Composite(tabFolder, SWT.NONE);
@@ -253,7 +291,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
mid.setLayoutData(new GridData(GridData.FILL_BOTH));
mid.setLayout(new FillLayout());
- final Table table = new Table(mid, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.BORDER_SOLID);
+ table = new Table(mid, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL);
table.setHeaderVisible(true);
table.setLinesVisible(true);
@@ -264,10 +302,12 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
ControlListener listener = null;
listener = new ControlListener() {
+ @Override
public void controlMoved(ControlEvent e) {
}
+ @Override
public void controlResized(ControlEvent e) {
Rectangle r = table.getClientArea();
@@ -276,7 +316,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
total += table.getColumn(1).getWidth();
total += table.getColumn(2).getWidth();
total += table.getColumn(3).getWidth();
-
+//
if (r.width > total) {
table.getColumn(4).setWidth(r.width - total);
}
@@ -301,47 +341,55 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
col = createTableColumn(table, "Message", SWT.LEFT,
"abcdefghijklmnopqrstuvwxyz0123456789");
- col.setResizable(false);
+// col.setResizable(false);
Composite bottom = new Composite(composite, SWT.NONE);
bottom.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
bottom.setLayout(new GridLayout(3, false));
- final Combo combo = new Combo(bottom, SWT.READ_ONLY);
+ panelFilterIndex = new Combo(bottom, SWT.READ_ONLY);
String[] comboItems = {"Pid", "Tag", "Message"};
- combo.setItems(comboItems);
- combo.select(2);
- combo.setToolTipText("Keyword Search: Pid or Tag, Message");
- combo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- if (filterText.getText() != null) {
- int index = combo.getSelectionIndex();
- if (index != -1)
- tab.tableRefill(index, filterText.getText());
- }
+ panelFilterIndex.setItems(comboItems);
+ panelFilterIndex.select(2);
+ panelFilterIndex.setToolTipText(LogUIMessages.Log_Tooltip_View_Filter_Combo);
+ panelFilterIndex.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if(currentTab != null)
+ {
+ int index = panelFilterIndex.getSelectionIndex();
+ if (panelFilterKeyword.getText() != null) {
+ currentTab.tableRefill(index, panelFilterKeyword.getText());
+ }
+ }
}
- public void widgetDefaultSelected(SelectionEvent e) {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
}
});
- filterText = new Text(bottom, SWT.SINGLE | SWT.BORDER);
- filterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- filterText.setMessage("Search Keywords from this table are separated by a space as well as a comma");
- filterText.addModifyListener(new ModifyListener() {
+ panelFilterKeyword = new Text(bottom, SWT.SINGLE | SWT.BORDER);
+ panelFilterKeyword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ panelFilterKeyword.setMessage(LogUIMessages.Log_Message_View_Filter_Text);
+ panelFilterKeyword.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
- if (filterText.getText() != null) {
- int index = combo.getSelectionIndex();
- if (index != -1) {
- tab.tableRefill(index, filterText.getText());
- }
- }
+ if(currentTab != null)
+ {
+ String keyword = panelFilterKeyword.getText();
+ int index = currentTab.getFilterIndexFromPanel();
+ panelFilterIndex.select(index);
+ if (keyword != null) {
+ if (index != -1) {
+ currentTab.tableRefill(index, keyword);
+ }
+ }
+ }
}
});
- tab.setTable(table);
return composite;
}
@@ -359,7 +407,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
/**
* Copies the current selection of the current filter as multiline text.
- *
+ *
* @param clipboard
* The clipboard to place the copied content.
*/
@@ -378,7 +426,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
/**
* Sets a TableFocusListener which will be notified when one of the tables
* gets or loses focus.
- *
+ *
* @param listener
*/
public void setTableFocusListener(ITableFocusListener listener) {
@@ -394,17 +442,19 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
/**
* Sets up a Table object to notify the global Table Focus listener when it
* gets or loses the focus.
- *
+ *
* @param table
* the Table object.
*/
private void addTableToFocusListener(final Table table) {
// create the activator for this table
final IFocusedTableActivator activator = new IFocusedTableActivator() {
+ @Override
public void copy(Clipboard clipboard) {
copyTable(clipboard, table);
}
+ @Override
public void selectAll() {
table.selectAll();
}
@@ -413,10 +463,12 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
// add the focus listener on the table to notify the global
// listener
table.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent e) {
globalListener.focusGained(activator);
}
+ @Override
public void focusLost(FocusEvent e) {
globalListener.focusLost(activator);
}
@@ -426,7 +478,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
/**
* Copies the current selection of a Table into the provided Clipboard, as
* multi-line text.
- *
+ *
* @param clipboard
* The clipboard to place the copied content.
* @param table
@@ -458,24 +510,24 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
/**
* saves the current selection in a text file.
- *
+ *
* @return false if the saving failed.
*/
public boolean save() {
if (getCurrentLogTab() == null)
return false;
FileDialog dlg = new FileDialog(parent.getShell(), SWT.SAVE);
- String fileName;
- dlg.setText("Export Log");
- dlg.setFileName(getCurrentLogTab().getFilterName() + "-log.txt");
+ dlg.setText(LogUIMessages.Log_Title_Tab_Export);
+ String fileName = String.format(LogUIMessages.Log_File_Tab_Export_Postfix, getCurrentLogTab().getFilterName());
+ dlg.setFileName(fileName);
String defaultPath = defaultLogSave;
if (defaultPath == null) {
defaultPath = System.getProperty("user.home"); //$NON-NLS-1$
}
dlg.setFilterPath(defaultPath);
- dlg.setFilterNames(new String[] { "Text Files (*.txt)" });
- dlg.setFilterExtensions(new String[] { "*.txt" });
+ dlg.setFilterNames(new String[] { LogUIMessages.Log_File_Tab_Export_Filter });
+ dlg.setFilterExtensions(new String[] { LogUIMessages.Log_File_Tab_Export_Filter_Extensions });
File check;
boolean again;
do {
@@ -519,19 +571,41 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
this.getCurrentLogTab().clear();
}
+ private boolean checkTabConnection(LogTab tab, String title)
+ {
+ String deviceName = tab.getFilterDeviceName();
+ if(deviceName == null)
+ {
+ String tabName = tab.getFilterName();
+ String message = String.format(LogUIMessages.Log_Message_Tab_Device_Disconnected, tabName);
+ DialogUtil.openErrorDialog(parent.getShell(), title, message);
+ return false;
+ }
+ return true;
+ }
+
public void addTab() {
- if (getCurrentLogTab() == null)
+ LogTab tab = getCurrentLogTab();
+ if (tab == null)
return;
- AddViewDialog dlg = new AddViewDialog(parent.getShell(),
- getCurrentLogTab().getFilterDeviceName());
-
+ if(!checkTabConnection(tab, LogUIMessages.Log_Title_Tab_AddTab_Error))
+ {
+ return ;
+ }
+
+ AddViewDialog dlg = new AddViewDialog(parent.getShell(), tab.getFilterDeviceName());
+ //if base device is already disconnected,
+ if(dlg.getDevice() == null)
+ return ;
+
if (dlg.open()) {
for (IDevice device : SmartDevelopmentBridge.getBridge()
.getDevices()) {
if (device.getSerialNumber().equals(dlg.getDevice())) {
LogTab newTab = createTab(device, dlg.getName());
-
+ setTabRefresh(newTab);
+ initViewFilter(newTab);
newTab.setPidFilter(dlg.getPidKeyword());
newTab.setTagFilter(dlg.getTagKeyword());
newTab.setMsgFilter(dlg.getMsgKeyword());
@@ -555,11 +629,13 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
return;
}
tab.stopLogTab(true);
+// tab.dispose();
+ folders.getItem(index).dispose();
tabs.remove(index);
tabCnt--;
- tab.dispose();
if (!tabs.isEmpty())
- folders.setSelection(0);
+ folders.setSelection(folders.getItemCount());
+ selectLogTab();
}
@@ -571,7 +647,12 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
if (oldTab.isDefault()) {
return;
}
-
+
+ if(!checkTabConnection(oldTab, LogUIMessages.Log_Title_Tab_EditTab_Error))
+ {
+ return ;
+ }
+
AddViewDialog dlg = new AddViewDialog(parent.getShell(), oldTab);
if (dlg.open()) {
for (IDevice device : SmartDevelopmentBridge.getBridge()
@@ -595,11 +676,17 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
oldTab.setPidFilter(dlg.getPidKeyword());
oldTab.setTagFilter(dlg.getTagKeyword());
oldTab.setMsgFilter(dlg.getMsgKeyword());
-
+
if (bRestart)
+ {
oldTab.startLogTab();
+ setTabRefresh(oldTab);
+ initViewFilter(oldTab);
+ }
else
+ {
oldTab.refill();
+ }
break;
}
}
@@ -625,11 +712,22 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
public LogTab getCurrentLogTab() {
if (tabs.size() != 0) {
int index = folders.getSelectionIndex();
- return tabs.get(index);
+ LogTab tab = tabs.get(index);
+ setTabRefresh(tab);
+ return tab;
} else
return null;
}
+ private void setTabRefresh(LogTab tab)
+ {
+ for(LogTab anytab : tabs)
+ {
+ anytab.setPendingAsyncRefresh(false);
+ }
+ tab.setPendingAsyncRefresh(true);
+ }
+
public void stopAll() {
for (LogTab tab : tabs) {
tab.stopLogTab(true);
@@ -647,7 +745,22 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
}
@Override
- public void deviceDisconnected(IDevice device) {
+ public void deviceDisconnected(final IDevice device) {
+ if (parent.isDisposed() == false) {
+ Display display = parent.getDisplay();
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (parent.isDisposed() == false) {
+ String deviceSN = device.getSerialNumber();
+ String title = LogUIMessages.Log_Title_View_Device_Disconnected;
+ String message = String.format(LogUIMessages.Log_Message_View_Device_Disconnected, deviceSN, deviceSN);
+ NotifierDialog.notify(title, message, NotificationType.DISCONNECTED);
+ }
+ }
+ });
+ }
+
}
@Override
@@ -656,9 +769,11 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
if (parent.isDisposed() == false) {
Display display = parent.getDisplay();
display.asyncExec(new Runnable() {
+ @Override
public void run() {
if (folders.isDisposed() == false) {
LogTab tab = createDefaultTab(device, null);
+ selectLogTab();
tab.startLogTab();
} else {
SmartDevelopmentBridge
@@ -672,7 +787,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
public void setActionEnabled(int enable) {
- if (enable == ENABLE_NOTHING) {
+ if (enable == ACTION_NOTHING) {
addAction.setEnabled(false);
removeAction.setEnabled(false);
@@ -682,7 +797,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
for (Action a : levelActions) {
a.setEnabled(false);
}
- } else if (enable == ENABLE_DEFAULT) {
+ } else if (enable == ACTION_DEVICE_TAB) {
addAction.setEnabled(true);
removeAction.setEnabled(false);
editAction.setEnabled(false);
@@ -691,7 +806,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener {
for (Action a : levelActions) {
a.setEnabled(true);
}
- } else if (enable == ENABLE_ALL) {
+ } else if (enable == ACTION_ADDITIONAL_TAB) {
addAction.setEnabled(true);
removeAction.setEnabled(true);
editAction.setEnabled(true);
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java
index 5e49a7cfc..9c6f57432 100644
--- a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java
@@ -3,10 +3,10 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
-* Contact:
+* Contact:
* Hoon Kang <h245.kang@samsung.com>
* Hyunsik Noh <hyunsik.noh@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
@@ -40,7 +40,6 @@ import org.eclipse.swt.widgets.TableItem;
import org.tizen.common.connection.log.LogPanel.LogMessage;
import org.tizen.common.connection.log.LogPanel.LogMessageInfo;
import org.tizen.common.console.AnsicodeAdapter;
-
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.Log;
import org.tizen.sdblib.Log.LogLevel;
@@ -54,7 +53,6 @@ public class LogTab {
public static final int FILTER_PID = 0x0;
public static final int FILTER_TAG = 0x1;
public static final int FILTER_MSG = 0x2;
- private int filterMode = FILTER_NONE;
public static final int LEVEL_ALL = 0x1F;
public static final int LEVEL_VERBOSE = 0x1;
@@ -72,11 +70,14 @@ public class LogTab {
private String[] pidFilter = null;
private String[] tagFilter = null;
private String[] msgFilter = null;
-
+
private String pidFilterString = null;
private String tagFilterString = null;
private String msgFilterString = null;
- private String tableFilter = null;
+
+ private int filterIndexFromPanel = FILTER_MSG;
+ private String filterKeywordFromPanel = "";
+
private String filterName = null;
private IDevice filterDevice = null;
private LogTabOuputReceiver logger = null;
@@ -87,11 +88,11 @@ public class LogTab {
private static Pattern logPattern = Pattern
.compile("^\\[\\s(\\d\\d-\\d\\d\\s\\d\\d:\\d\\d:\\d\\d\\.\\d+)" + //$NON-NLS-1$
- "\\s+(\\d*):\\s*(\\d+)\\s([VDIWE])/(.+)\\s+\\]$");
+ "\\s+(\\d*):\\s*(\\d+)\\s([VDIWE])/(.+)\\s+\\]$");
- private ArrayList<LogMessage> tableMessages = new ArrayList<LogMessage>();
- private ArrayList<LogMessage> newMessages = new ArrayList<LogMessage>();
- private LogMessage[] buffer = new LogMessage[STRING_BUFFER_LENGTH];
+ private final ArrayList<LogMessage> tableMessages = new ArrayList<LogMessage>();
+ private final ArrayList<LogMessage> newMessages = new ArrayList<LogMessage>();
+ private final LogMessage[] buffer = new LogMessage[STRING_BUFFER_LENGTH];
private LogMessageInfo lastMessageInfo = null;
private boolean pendingAsyncRefresh = false;
@@ -137,9 +138,9 @@ public class LogTab {
if (msg != null)
msgFilter = setFilter(msg.split("[\\s\t,]"));
else
- msgFilter = null;
+ msgFilter = null;
}
-
+
private String[] setFilter(String[] array) {
ArrayList<String> result = new ArrayList<String>();
for (String s : array) {
@@ -149,7 +150,7 @@ public class LogTab {
}
return result.toArray(new String[(result.size())]);
}
-
+
public String getFilterName() {
return filterName;
}
@@ -171,7 +172,10 @@ public class LogTab {
}
public String getFilterDeviceName() {
- return filterDevice.getSerialNumber();
+ if(filterDevice != null)
+ return filterDevice.getSerialNumber();
+ else
+ return null;
}
public void setTab(TabItem pTabItem) {
@@ -188,7 +192,7 @@ public class LogTab {
/**
* Returns the UI table object.
- *
+ *
* @return
*/
public Table getTable() {
@@ -196,8 +200,16 @@ public class LogTab {
}
public void dispose() {
- table.dispose();
- tabItem.dispose();
+ Display d = tabItem.getDisplay();
+
+ d.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (tabItem.isDisposed() == false) {
+ tabItem.dispose();
+ }
+ }
+ });
table = null;
tabItem = null;
}
@@ -239,6 +251,7 @@ public class LogTab {
} finally {
logger = null;
filterDevice = null;
+ stopLogTab(false);
}
}
} .start();
@@ -258,6 +271,7 @@ public class LogTab {
}
}
+ //add message to tableMessages(filtered message) and replace old message to new message
public boolean addMessage(LogMessage newMessage, LogMessage oldMessage) {
synchronized (tableMessages) {
if (oldMessage != null) {
@@ -396,7 +410,7 @@ public class LogTab {
/**
* Add a TableItem for the index-th item of the buffer
- *
+ *
* @param filter
* The index of the table in which to insert the item.
*/
@@ -451,6 +465,7 @@ public class LogTab {
}
}
+ @Override
public boolean isCancelled() {
return isCancelled;
}
@@ -458,9 +473,8 @@ public class LogTab {
/**
* Process new Log lines coming from {@link LogCatOuputReceiver}.
- *
- * @param lines
- * the new lines
+ *
+ * @param lines the new lines
*/
protected void processLogLines(String[] lines) {
// WARNING: this will not work if the string contains more line
@@ -483,8 +497,7 @@ public class LogTab {
// check for header lines.
Matcher matcher = logPattern.matcher(line);
if (matcher.matches()) {
- // this is a header line, parse the
- // header and keep it around.
+ // this is a header line, parse the header and keep it around.
lastMessageInfo = new LogMessageInfo();
lastMessageInfo.time = matcher.group(1);
@@ -493,27 +506,21 @@ public class LogTab {
.getByLetterString(matcher.group(4));
lastMessageInfo.tag = matcher.group(5).trim();
} else {
- // This is not a header line.
- // Create a new LogMessage and process
- // it.
- LogMessage mc = new LogMessage();
if (lastMessageInfo == null) {
return;
}
- // If someone printed a log message
- // with
- // embedded '\n' characters, there
- // will
- // one header line followed by
- // multiple text lines.
+ // This is not a header line.
+ // Create a new LogMessage and process it.
+ LogMessage mc = new LogMessage();
+
+ // If someone printed a log message with embedded '\n' characters,
+ //there will one header line followed by multiple text lines.
// Use the last header that we saw.
mc.data = lastMessageInfo;
- // tabs seem to display as only 1 tab
- // so we replace the leading tabs
- // by 4 spaces.
+ // tabs seem to display as only 1 tab so we replace the leading tabs by 4 spaces.
mc.msg = line.replaceAll("\t", " "); //$NON-NLS-1$ //$NON-NLS-2$
// process the new LogMessage.
@@ -525,12 +532,8 @@ public class LogTab {
}
}
- // if we don't have a pending Runnable that will do the
- // refresh, we
- // ask the Display
- // to run one in the UI thread.
- if (pendingAsyncRefresh == false) {
- pendingAsyncRefresh = true;
+ if (pendingAsyncRefresh) {
+// pendingAsyncRefresh = true;
try {
Display display = table.getDisplay();
@@ -538,13 +541,12 @@ public class LogTab {
// run in sync because this will update the
// buffer start/end indices
display.asyncExec(new Runnable() {
+ @Override
public void run() {
asyncRefresh();
}
});
} catch (SWTException e) {
- // display is disposed, we're probably
- // quitting. Let's stop.
stopLogTab(false);
}
}
@@ -556,12 +558,10 @@ public class LogTab {
* <p/>
* This adds the new message to the buffer, and gives it to the existing
* filters.
- *
+ *
* @param newMessage
*/
private void processNewMessage(LogMessage newMessage) {
- // // if we are in auto filtering mode, make sure we have
- // // a filter for this
// compute the index where the message goes.
// was the buffer empty?
@@ -592,29 +592,7 @@ public class LogTab {
// then add the new one
buffer[messageIndex] = newMessage;
- synchronized (tableMessages) {
- if (oldMessage != null) {
- if (tableMessages.size() > STRING_BUFFER_LENGTH) {
- int index = tableMessages.indexOf(oldMessage);
- if (index != -1) {
- // TODO check that index will always
- // be -1 or 0, as only the oldest
- // message is ever removed.
- tableMessages.remove(index);
- removedMessageCount++;
- }
- }
- }
- }
-
- boolean filter = accept(newMessage);
- if (filter) {
- // at this point the message is accepted, we add it to the
- // list
- tableMessages.add(newMessage);
- newMessages.add(newMessage);
- }
-
+ addMessage(newMessage, oldMessage);
}
/**
@@ -623,16 +601,17 @@ public class LogTab {
private void asyncRefresh() {
if (table.isDisposed() == false) {
synchronized (buffer) {
- try {
- // the circular buffer has been updated, let
- // have the filter flush
- // their display with the new messages.
- flush();
-
- } finally {
- // the pending refresh is done.
- pendingAsyncRefresh = false;
- }
+ flush();
+// try {
+// // the circular buffer has been updated, let
+// // have the filter flush
+// // their display with the new messages.
+// flush();
+//
+// } finally {
+// // the pending refresh is done.
+// pendingAsyncRefresh = false;
+// }
}
} else {
stopLogTab(true);
@@ -650,6 +629,7 @@ public class LogTab {
// run sync as we need to update right now.
d.syncExec(new Runnable() {
+ @Override
public void run() {
if (table.isDisposed() == false) {
table.removeAll();
@@ -685,9 +665,7 @@ public class LogTab {
for (int i = indexStart; i < max; i++) {
int realItemIndex = i % STRING_BUFFER_LENGTH;
- addMessage(buffer[realItemIndex], null /*
- * old message
- */);
+ addMessage(buffer[realItemIndex], null /** old message*/);
}
}
@@ -700,46 +678,61 @@ public class LogTab {
synchronized (buffer) {
for (LogMessage logMsg : buffer) {
if (accept(logMsg)) {
- tableMessages.add(logMsg);
- newMessages.add(logMsg);
+ addMessage(logMsg, null);
}
}
}
flush();
}
-
+
public void tableRefill(int index, String filter) {
-
- tableFilter = filter;
- filterMode = index;
-
- newMessages.clear();
- lastMessageInfo = null;
- if (table.isDisposed() == false)
- table.removeAll();
+ filterKeywordFromPanel = filter;
+ filterIndexFromPanel = index;
- synchronized (tableMessages) {
- for (LogMessage logMsg : tableMessages) {
- if (tableAccept(logMsg)) {
- newMessages.add(logMsg);
+ msgClear();
+
+ synchronized (buffer) {
+ for (LogMessage logMsg : buffer) {
+ if (accept(logMsg) && tableAccept(logMsg)) {
+ addMessage(logMsg, null);
}
}
}
flush();
}
-
+
+ public int getFilterIndexFromPanel()
+ {
+ return filterIndexFromPanel;
+ }
+
+ public void setFilterIndexFromPanel(int index)
+ {
+ filterIndexFromPanel = index;
+ }
+
+ public String getFilterKeywordFromPanel()
+ {
+ return filterKeywordFromPanel;
+ }
+
+ public void setFilterKeywordFromPanel(String keyword)
+ {
+ filterKeywordFromPanel = keyword;
+ }
+
boolean tableAccept(LogMessage logMessage) {
if (logMessage == null)
return false;
-
- if (tableFilter == null || tableFilter.length() == 0)
+
+ if (filterKeywordFromPanel == null || filterKeywordFromPanel.length() == 0)
return true;
-
- switch(filterMode) {
+
+ switch(filterIndexFromPanel) {
case 0:
{
- String[] filter = tableFilter.split("[\\s\t,]");
+ String[] filter = filterKeywordFromPanel.split("[\\s\t,]");
for (int i = 0; i < filter.length; i++) {
if (logMessage.data.pidString.contains(
filter[i]))
@@ -747,10 +740,10 @@ public class LogTab {
}
}
break;
-
+
case 1:
{
- String[] filter = tableFilter.split("[\\s\t,]");
+ String[] filter = filterKeywordFromPanel.split("[\\s\t,]");
for (int i = 0; i < filter.length; i++) {
if (logMessage.data.tag.toLowerCase().contains(
filter[i].toLowerCase()))
@@ -758,10 +751,10 @@ public class LogTab {
}
}
break;
-
+
case 2:
{
- String[] filter = tableFilter.split("[\\s\t,]");
+ String[] filter = filterKeywordFromPanel.split("[\\s\t,]");
for (int i = 0; i < filter.length; i++) {
if (logMessage.msg.toLowerCase().contains(
filter[i].toLowerCase()))
@@ -769,7 +762,7 @@ public class LogTab {
}
}
break;
-
+
default:
return false;
@@ -785,6 +778,7 @@ public class LogTab {
levelMode &= (~level);
}
+ //remove all filtered messages and tableMessages for refill or init tab
public void msgClear() {
removedMessageCount = 0;
newMessages.clear();
@@ -794,6 +788,7 @@ public class LogTab {
table.removeAll();
}
+ //buffer clear
public void clear() {
for (int i = 0; i < STRING_BUFFER_LENGTH; i++) {
buffer[i] = null;
@@ -817,4 +812,9 @@ public class LogTab {
return isDefault;
}
+ public void setPendingAsyncRefresh(boolean b)
+ {
+ pendingAsyncRefresh = b;
+ }
+
} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogUIMessages.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogUIMessages.java
new file mode 100644
index 000000000..656ee5f80
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogUIMessages.java
@@ -0,0 +1,53 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5225.kim@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.log;
+
+import org.eclipse.osgi.util.NLS;
+
+public class LogUIMessages extends NLS {
+ private static final String BUNDLE_NAME = LogUIMessages.class.getPackage().getName() + ".LogUIMessages"; //$NON-NLS-1$
+
+ public static String Log;
+ public static String Log_Title_Tab_AddTab_Error;
+ public static String Log_Title_Tab_EditTab_Error;
+ public static String Log_Title_View_Device_Disconnected;
+ public static String Log_Message_Tab_Device_Disconnected;
+ public static String Log_Message_View_Device_Disconnected;
+ public static String Log_Message_View_Filter_Text;
+ public static String Log_Tooltip_View_Filter_Combo;
+ public static String Log_Title_Tab_Export;
+ public static String Log_File_Tab_Export_Postfix;
+ public static String Log_File_Tab_Export_Filter;
+ public static String Log_File_Tab_Export_Filter_Extensions;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, LogUIMessages.class);
+ }
+
+ private LogUIMessages() {
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogUIMessages.properties b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogUIMessages.properties
new file mode 100644
index 000000000..6f0ab47fa
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogUIMessages.properties
@@ -0,0 +1,17 @@
+Log = Log
+
+Log_Title_Tab_AddTab_Error = Add tab error
+Log_Title_Tab_EditTab_Error = Edit tab error
+Log_Title_View_Device_Disconnected = Device is disconnected
+
+Log_Message_Tab_Device_Disconnected = %s tab's device is already disconnected.
+Log_Message_View_Device_Disconnected = %s is disconnected.\nThe tabs for %s do not work.
+Log_Message_View_Filter_Text = Search Keywords from this table are separated by a space as well as a comma
+
+Log_Tooltip_View_Filter_Combo = Keyword Search: Pid or Tag, Message
+
+Log_Title_Tab_Export = Export Log
+
+Log_File_Tab_Export_Postfix = %s-log.txt
+Log_File_Tab_Export_Filter = Text Files (*.txt)
+Log_File_Tab_Export_Filter_Extensions = *.txt \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java b/org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java
index 6c73dad2f..a48f3923c 100644
--- a/org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java
@@ -3,10 +3,10 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
-* Contact:
+* Contact:
* Hoon Kang <h245.kang@samsung.com>
* Hyunsik Noh <hyunsik.noh@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
@@ -40,12 +40,11 @@ import org.eclipse.ui.part.ViewPart;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.connection.log.LogColors;
import org.tizen.common.connection.log.LogPanel;
-
import org.tizen.sdblib.Log.LogLevel;
/**
* The log cat view displays log output from the current device selection.
- *
+ *
*/
public final class LogView extends ViewPart {
@@ -60,7 +59,7 @@ public final class LogView extends ViewPart {
private Action clearAction;
private Action[] logLevelActions;
- private String[] logLevelIcons = { "icons/log/v.png", //$NON-NLS-1S
+ private final String[] logLevelIcons = { "icons/log/v.png", //$NON-NLS-1S
"icons/log/d.png", //$NON-NLS-1S
"icons/log/i.png", //$NON-NLS-1S
"icons/log/w.png", //$NON-NLS-1S
@@ -88,7 +87,7 @@ public final class LogView extends ViewPart {
};
addAction.setToolTipText("Add LogTab");
addAction.setImageDescriptor(ConnectionPlugin.getImageDescriptorFromPlugin("icons/log/Add tab.png"));
-
+
removeAction = new Action("Remove Tab") {
@Override
public void run() {
@@ -97,7 +96,7 @@ public final class LogView extends ViewPart {
};
removeAction.setToolTipText("Remove LogTab");
removeAction.setImageDescriptor(ConnectionPlugin.getImageDescriptorFromPlugin("icons/log/Remove tab.png"));
-
+
editAction = new Action("Edit Tab") {
@Override
public void run() {
@@ -156,10 +155,10 @@ public final class LogView extends ViewPart {
// now create the log view
logPanel = new LogPanel(colors);
-
+
logPanel.setActions(logLevelActions, addAction, removeAction, editAction, exportAction, clearAction);
placeActions();
- logPanel.setActionEnabled(LogPanel.ENABLE_NOTHING);
+ logPanel.setActionEnabled(LogPanel.ACTION_NOTHING);
logPanel.createPanel(parent);
// setup the copy action
diff --git a/org.tizen.common.feature/feature.xml b/org.tizen.common.feature/feature.xml
index 7ea234da9..30796d6a0 100644
--- a/org.tizen.common.feature/feature.xml
+++ b/org.tizen.common.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.tizen.common.feature"
label="Tizen Common Tools"
- version="0.20.0.qualifier"
+ version="1.0.0.qualifier"
provider-name="Samsung"
plugin="org.tizen.base.platform"
license-feature="org.tizen.base.feature">
diff --git a/org.tizen.common/META-INF/MANIFEST.MF b/org.tizen.common/META-INF/MANIFEST.MF
index 10823da4d..70adb4a31 100644
--- a/org.tizen.common/META-INF/MANIFEST.MF
+++ b/org.tizen.common/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tizen Common
Bundle-SymbolicName: org.tizen.common;singleton:=true
-Bundle-Version: 1.17.0.qualifier
+Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Samsung
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
diff --git a/org.tizen.common/icons/msg_close_hover.png b/org.tizen.common/icons/msg_close_hover.png
new file mode 100644
index 000000000..9ccad0572
--- /dev/null
+++ b/org.tizen.common/icons/msg_close_hover.png
Binary files differ
diff --git a/org.tizen.common/icons/msg_close_normal.png b/org.tizen.common/icons/msg_close_normal.png
new file mode 100644
index 000000000..392bf6ba7
--- /dev/null
+++ b/org.tizen.common/icons/msg_close_normal.png
Binary files differ
diff --git a/org.tizen.common/icons/msg_close_push.png b/org.tizen.common/icons/msg_close_push.png
new file mode 100644
index 000000000..804eac708
--- /dev/null
+++ b/org.tizen.common/icons/msg_close_push.png
Binary files differ
diff --git a/org.tizen.common/plugin.xml b/org.tizen.common/plugin.xml
index bbe192e0d..8deffd8f4 100644
--- a/org.tizen.common/plugin.xml
+++ b/org.tizen.common/plugin.xml
@@ -19,7 +19,7 @@
<extension
point="org.eclipse.ui.startup">
<startup
- class="org.tizen.common.util.UpdateManager">
+ class="org.tizen.common.update.UpdateManager">
</startup>
</extension>
<!-- activities start -->
@@ -210,10 +210,6 @@
activityId="org.tizen.web.DisableWizardsActivity"
pattern="org\.eclipse\.wst\.xml\.ui/org\.eclipse\.wst\.xml\.ui\.XMLExampleProjectCreationWizard">
</activityPatternBinding>
- <activityPatternBinding
- activityId="org.tizen.web.DisableWizardsActivity"
- pattern="org\.eclipse\.wst\.web\.ui/org\.eclipse\.wst\.web\.ui\.internal\.wizards\.SimpleWebProjectWizard">
- </activityPatternBinding>
<activityPatternBinding
@@ -256,26 +252,10 @@
</activityPatternBinding>
<activityPatternBinding
activityId="org.tizen.web.DisableWizardsActivity"
- pattern="org\.eclipse\.wst\.jsdt\.ui/org\.eclipse\.wst\.jsdt\.ui\.wizards\.JavaProjectWizard">
- </activityPatternBinding>
- <activityPatternBinding
- activityId="org.tizen.web.DisableWizardsActivity"
- pattern="org\.eclipse\.wst\.jsdt\.ui/org\.eclipse\.wst\.jsdt\.ui\.NewJSWizard">
- </activityPatternBinding>
- <activityPatternBinding
- activityId="org.tizen.web.DisableWizardsActivity"
pattern="org\.eclipse\.jst\.jsp\.ui/org\.eclipse\.jst\.jsp\.ui\.internal\.wizard.*">
</activityPatternBinding>
<activityPatternBinding
activityId="org.tizen.web.DisableWizardsActivity"
- pattern="org\.eclipse\.wst\.html\.ui/org\.eclipse\.wst\.html\.ui\.internal\.wizard\.NewHTMLWizard">
- </activityPatternBinding>
- <activityPatternBinding
- activityId="org.tizen.web.DisableWizardsActivity"
- pattern="org\.eclipse\.wst\.css\.ui/org\.eclipse\.wst\.css\.ui\.internal\.wizard\.NewCSSWizard">
- </activityPatternBinding>
- <activityPatternBinding
- activityId="org.tizen.web.DisableWizardsActivity"
pattern="org\.eclipse\.emf\.codegen\.ui/org\.eclipse\.emf\.codegen\.ui\.ConvertToJETProjectWizard">
</activityPatternBinding>
<activityPatternBinding
diff --git a/org.tizen.common/src/org/tizen/common/console/ConsoleManager.java b/org.tizen.common/src/org/tizen/common/console/ConsoleManager.java
index ec4871d3b..455d7dd7f 100644
--- a/org.tizen.common/src/org/tizen/common/console/ConsoleManager.java
+++ b/org.tizen.common/src/org/tizen/common/console/ConsoleManager.java
@@ -113,13 +113,17 @@ public class ConsoleManager
}
if(this.consoleFocus)
- consoleManager.showConsoleView(console);
+ showConsoleView();
return console;
}
public IConsole getConsole() {
return console;
}
+
+ public void showConsoleView() {
+ consoleManager.showConsoleView(console);
+ }
/**
* Remove a MessageConsole instance specified key title from list, if it is present
*
diff --git a/org.tizen.common/src/org/tizen/common/control/TableViewColumnSorter.java b/org.tizen.common/src/org/tizen/common/control/TableViewColumnSorter.java
index b08a9bc46..1456f8928 100644
--- a/org.tizen.common/src/org/tizen/common/control/TableViewColumnSorter.java
+++ b/org.tizen.common/src/org/tizen/common/control/TableViewColumnSorter.java
@@ -52,8 +52,8 @@ import org.tizen.common.model.ITableVO;
public class TableViewColumnSorter extends ViewerSorter {
private static final String COLUMN_INDEX_KEY = "COLUMN_INDEX"; //$NON-NLS-1$
private static final String HEADER_TEXT_KEY = "HEADER_TEXT"; //$NON-NLS-1$
- private static final String TAG_DESCENDING = "â–²"; //$NON-NLS-1$
- private static final String TAG_ASCENDING = "â–¼"; //$NON-NLS-1$
+ private static final String TAG_DESCENDING = "\u25b2"; // up-pointing triangle
+ private static final String TAG_ASCENDING = "\u25bc"; // down-pointing triangle
private TableViewer viewer;
private Table table;
diff --git a/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.properties b/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.properties
index 3609acb77..c4856e3d8 100644
--- a/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.properties
+++ b/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.properties
@@ -1,6 +1,6 @@
TizenPreferencePage.0=General settings for Tizen developement:
TizenPreferencePage.1=SDK Path settings
-TizenPreferencePage.2=Location :
+TizenPreferencePage.2=Location:
TizenPreferencePage.3=SDK Update
TizenPreferencePage.4=Automatically find new updates and notify me
diff --git a/org.tizen.common/src/org/tizen/common/properties/InstallPathConfig.java b/org.tizen.common/src/org/tizen/common/properties/InstallPathConfig.java
index 63f9d44c9..d49b70804 100644
--- a/org.tizen.common/src/org/tizen/common/properties/InstallPathConfig.java
+++ b/org.tizen.common/src/org/tizen/common/properties/InstallPathConfig.java
@@ -71,6 +71,10 @@ final public class InstallPathConfig {
return sdkInstallPath + File.separatorChar + EMULATOR_PATH;
}
+ /**
+ * @deprecated Use {@link #getSDKPath()} instead.
+ */
+ @Deprecated
public static String getIDEPath() {
// FIXME : can't help but putting the code due to the Web IDE path , It has to be removed soon.
return System.getProperty("user.dir");
diff --git a/org.tizen.common/src/org/tizen/common/swt/CommonColor.java b/org.tizen.common/src/org/tizen/common/swt/CommonColor.java
new file mode 100644
index 000000000..e9e9466ce
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/swt/CommonColor.java
@@ -0,0 +1,43 @@
+/*
+ * Web IDE - launch
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Gyeongseok Seo <gyeongseok.seo@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * Kangho Kim <kh5325.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.common.swt;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Common SWT Color
+ * @author Gyeongseok Seo <gyeongseok.seo@samsung.com>
+ *
+ */
+public class CommonColor {
+ public static final Color BLACK = new Color(PlatformUI.getWorkbench().getDisplay(), 0, 0, 0);
+ public static final Color RED = new Color(PlatformUI.getWorkbench().getDisplay(), 255, 0, 0);
+ public static final Color ORANGE_RED = new Color(PlatformUI.getWorkbench().getDisplay(), 255, 69, 0);
+ public static final Color ROYAL_BLUE = new Color(PlatformUI.getWorkbench().getDisplay(), 65, 105, 225);
+ public static final Color YELLOW_GREEN = new Color(PlatformUI.getWorkbench().getDisplay(), 153, 204, 50);
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/UpdateManager.java b/org.tizen.common/src/org/tizen/common/update/UpdateManager.java
index 7edaf7445..1a171792a 100644
--- a/org.tizen.common/src/org/tizen/common/util/UpdateManager.java
+++ b/org.tizen.common/src/org/tizen/common/update/UpdateManager.java
@@ -1,10 +1,11 @@
-/*
-* Common
+/**
+* UpdateManager
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
* Kangho Kim <kh5325.kim@samsung.com>
+* Taeyoung Son <taeyoung2.son@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,9 +23,10 @@
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.util;
+package org.tizen.common.update;
import java.io.File;
+import java.util.ResourceBundle;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -37,10 +39,19 @@ import org.eclipse.ui.PlatformUI;
import org.tizen.common.CommonPlugin;
import org.tizen.common.preferences.TizenBasePreferencePage;
import org.tizen.common.properties.InstallPathConfig;
+import org.tizen.common.util.HostUtil;
+import org.tizen.common.util.OSChecker;
public class UpdateManager implements IStartup {
private static final String EXECUTE_INSTALLER_COMMAND = "java -jar InstallManager.jar";
+ private static final String EXECUTE_INSTALLER_COMMAND_FOR_WINDOWS = "InstManager.exe";
+ private static final String UPDATE_LIST_CHECK_COMMAND = "%s -checkPackageUpdate";
+ private static final String RESULT_VALUE_OF_UPDATABLE = "updatable";
+ private static final String BUNDLE_NAME = UpdateManager.class.getPackage().getName() + ".UpdateMessages";//$NON-NLS-1$
+
+ public static ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
final IWorkbench workbench = PlatformUI.getWorkbench();
@Override
@@ -69,8 +80,8 @@ public class UpdateManager implements IStartup {
}
private boolean isExistUpdatablePackage() {
- String result = HostUtil.returnExecute(EXECUTE_INSTALLER_COMMAND + " -checkPackageUpdate", InstallPathConfig.getInstallManagerPath());
- if(result.equals("updatable"))
+ String result = HostUtil.returnExecute(getUpdateCheckCmd(), InstallPathConfig.getInstallManagerPath());
+ if(RESULT_VALUE_OF_UPDATABLE.equals(result))
return true;
return false;
}
@@ -83,36 +94,9 @@ public class UpdateManager implements IStartup {
}
private void executeInstallManger() {
- returnExecute(EXECUTE_INSTALLER_COMMAND, InstallPathConfig.getInstallManagerPath());
+ HostUtil.batchExecute(getInstallerExeCmd(), null, new File(InstallPathConfig.getInstallManagerPath()));
}
- public static String returnExecute(String command, String workingDir) {
- final StringBuilder contents = new StringBuilder();
-
- Process proc = null;
-
- String[] fullCommand = HostUtil.getCommand(command);
-
- try {
- ProcessBuilder pb = new ProcessBuilder();
- pb.command(fullCommand);
- if(workingDir != null) {
- pb.directory(new File(workingDir));
- }
- proc = pb.start();
-
- ShellParser parser = new ShellParser(proc);
- parser.parsing();
-
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- } finally{
- }
-
- return contents.toString().trim();
-
- }
public int checkUpdate() {
final int[] result = new int[1]; // using array since you can't change a final int
@@ -128,8 +112,8 @@ public class UpdateManager implements IStartup {
MessageDialog dialog = new MessageDialog(
PlatformUI.getWorkbench().getDisplay().getActiveShell(),
- "Tizen SDK",
- null,"Updates are available for Tizen SDK. Do you want to install them?" , MessageDialog.QUESTION, labels, 0);
+ resources.getString("message.dialogTitle"),
+ null, resources.getString("message.askForUpdate"), MessageDialog.QUESTION, labels, 0);
dialog.open();
if (dialog.getReturnCode() == SWT.DEFAULT) {
// A window close returns SWT.DEFAULT - mapped to a cancel
@@ -143,4 +127,19 @@ public class UpdateManager implements IStartup {
PlatformUI.getWorkbench().getDisplay().syncExec(query);
return result[0];
}
+
+ private String getInstallerExeCmd() {
+ String exeInstaller = null;
+
+ if(OSChecker.isWindows())
+ exeInstaller = EXECUTE_INSTALLER_COMMAND_FOR_WINDOWS;
+ else
+ exeInstaller = EXECUTE_INSTALLER_COMMAND;
+
+ return exeInstaller;
+ }
+
+ private String getUpdateCheckCmd() {
+ return String.format(UPDATE_LIST_CHECK_COMMAND, EXECUTE_INSTALLER_COMMAND);
+ }
}
diff --git a/org.tizen.common/src/org/tizen/common/update/UpdateMessages.properties b/org.tizen.common/src/org/tizen/common/update/UpdateMessages.properties
new file mode 100644
index 000000000..06a30a973
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/update/UpdateMessages.properties
@@ -0,0 +1,3 @@
+##
+message.dialogTitle = Tizen SDK
+message.askForUpdate = Updates are available for Tizen SDK. Do you want to install them? \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/util/FileUtil.java b/org.tizen.common/src/org/tizen/common/util/FileUtil.java
index d778247af..eca82e5b4 100644
--- a/org.tizen.common/src/org/tizen/common/util/FileUtil.java
+++ b/org.tizen.common/src/org/tizen/common/util/FileUtil.java
@@ -184,4 +184,59 @@ public class FileUtil {
}
bout.flush();
}
+
+ /**
+ * Copy source file to destination file.
+ * If intermediate directories of destination file don't exists, it creates them.
+ * If destination file already exists, it tries to overwrite it.
+ *
+ * @param from source file path
+ * @param to destination file path
+ */
+ public static void copyTo(String from, String to) throws IOException {
+ copyTo(from, to, false);
+ }
+
+ /**
+ * Copy source file to destination file.
+ * If intermediate directories of destination file don't exists, it creates them.
+ * If destination file already exists, it tries to overwrite it.
+ *
+ * @param from source file path
+ * @param to destination file path
+ * @param append to destination file flag
+ */
+ public static void copyTo(String from, String to, boolean append) throws IOException {
+ File fromFile = new File(from);
+ File toFile = new File(to);
+
+ File parent = toFile.getParentFile();
+ if (!parent.exists()) {
+ if (!parent.mkdirs()) {
+ throw new IOException("File copy error. Cannot create directory - " + parent.getAbsolutePath());
+ }
+ }
+
+ // makes sure it is not the same file
+ if (fromFile.getCanonicalPath().equals(toFile.getCanonicalPath())) {
+ throw new IOException("Unable to write file " + fromFile + " on itself.");
+ }
+
+ BufferedInputStream in = null;
+ BufferedOutputStream out = null;
+
+ try {
+ in = new BufferedInputStream(new FileInputStream(fromFile), BUFFER_SIZE);
+ out = new BufferedOutputStream(new FileOutputStream(to, append), BUFFER_SIZE);
+
+ byte[] bytes = new byte[BUFFER_SIZE];
+ int nRead = 0;
+ while ((nRead = in.read(bytes, 0, bytes.length)) > 0) {
+ out.write(bytes, 0, nRead);
+ }
+ } finally {
+ if (in != null) in.close();
+ if (out != null) out.close();
+ }
+ }
}
diff --git a/org.tizen.common/src/org/tizen/common/util/HostUtil.java b/org.tizen.common/src/org/tizen/common/util/HostUtil.java
index 4e2330fc6..a2e1b6871 100644
--- a/org.tizen.common/src/org/tizen/common/util/HostUtil.java
+++ b/org.tizen.common/src/org/tizen/common/util/HostUtil.java
@@ -40,6 +40,7 @@ import java.nio.channels.FileChannel;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.tizen.common.console.ConsoleManager;
public abstract class HostUtil{
@@ -228,16 +229,60 @@ public abstract class HostUtil{
return contents.toString().trim();
}
+
+ /**
+ * Show output messages while executes the command on console view
+ * @param command - Command to execute.
+ * @param viewName - View name showing messages while executes the command.
+ */
+ public static void executeWithConsole(String command, String viewName) throws Exception {
+ BufferedReader input = null;
+
+ String line = null;
+
+ Process proc = null;
+
+ String[] fullCommand = getCommand(command);
+
+ ConsoleManager cm = new ConsoleManager( viewName, true );
+ cm.clear();
+
+ try {
+ ProcessBuilder pb = new ProcessBuilder();
+ pb.redirectErrorStream(true);
+ pb.command(fullCommand);
+ proc = pb.start();
+ input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ while((line=input.readLine())!=null){
+ cm.println(line);
+ }
+ proc.waitFor();
+ // abnormal termination
+ if (proc.exitValue() != 0)
+ throw new Exception("Failed to execute command: " + command);
+ } finally {
+ if(proc!=null)
+ proc.destroy();
+ if(input!=null)
+ try {
+ input.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
public static String returnExecute(String command){
return returnExecute(command, null);
}
public static String[] getCommand(String command){
- if(isLinux()){
- return new String[]{SHELL_COMMAND_LINUX,"-c",command}; //$NON-NLS-1$
- }else{
+
+ if(OSChecker.isWindows()){
return new String[]{SHELL_COMMAND_WINDOW,"/c",command}; //$NON-NLS-1$
+ }else
+ {
+ return new String[]{SHELL_COMMAND_LINUX,"-c",command}; //$NON-NLS-1$
}
}
@@ -275,6 +320,10 @@ public abstract class HostUtil{
return file.delete();
}
+ /**
+ * @deprecated Use {@link FileUtil#copyTo(String, String)} instead.
+ */
+ @Deprecated
public static boolean copyFile(String src, String des) throws Exception {
boolean canExecute = false;
File srcFile=new File(src);
diff --git a/org.tizen.common/src/org/tizen/common/util/NotificationType.java b/org.tizen.common/src/org/tizen/common/util/NotificationType.java
index 37a6a9009..3e8d5a8a7 100644
--- a/org.tizen.common/src/org/tizen/common/util/NotificationType.java
+++ b/org.tizen.common/src/org/tizen/common/util/NotificationType.java
@@ -1,56 +1,59 @@
-/*
-* Common
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Kangho Kim <kh5325.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.common.util;
-
-import org.eclipse.swt.graphics.Image;
-import org.tizen.common.cache.ImageCache;
-
-
-public enum NotificationType {
- ERROR(ImageCache.getImage("error.png")),
- DELETE(ImageCache.getImage("delete.png")),
- WARN(ImageCache.getImage("warn.png")),
- SUCCESS(ImageCache.getImage("ok.png")),
- INFO(ImageCache.getImage("info.png")),
- LIBRARY(ImageCache.getImage("library.png")),
- HINT(ImageCache.getImage("hint.png")),
- PRINTED(ImageCache.getImage("printer.png")),
- CONNECTION_TERMINATED(ImageCache.getImage("terminated.png")),
- CONNECTION_FAILED(ImageCache.getImage("connecting.png")),
- CONNECTED(ImageCache.getImage("connected.png")),
- DISCONNECTED(ImageCache.getImage("disconnected.png")),
- TRANSACTION_OK(ImageCache.getImage("ok.png")),
- TRANSACTION_FAIL(ImageCache.getImage("error.png"));
-
- private Image _image;
-
- private NotificationType(Image img) {
- _image = img;
- }
-
- public Image getImage() {
- return _image;
- }
-}
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.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.common.util;
+
+import org.eclipse.swt.graphics.Image;
+import org.tizen.common.cache.ImageCache;
+
+
+public enum NotificationType {
+ ERROR(ImageCache.getImage("error.png")),
+ DELETE(ImageCache.getImage("delete.png")),
+ WARN(ImageCache.getImage("warn.png")),
+ SUCCESS(ImageCache.getImage("ok.png")),
+ INFO(ImageCache.getImage("info.png")),
+ LIBRARY(ImageCache.getImage("library.png")),
+ HINT(ImageCache.getImage("hint.png")),
+ PRINTED(ImageCache.getImage("printer.png")),
+ CONNECTION_TERMINATED(ImageCache.getImage("terminated.png")),
+ CONNECTION_FAILED(ImageCache.getImage("connecting.png")),
+ CONNECTED(ImageCache.getImage("connected.png")),
+ DISCONNECTED(ImageCache.getImage("disconnected.png")),
+ TRANSACTION_OK(ImageCache.getImage("ok.png")),
+ TRANSACTION_FAIL(ImageCache.getImage("error.png")),
+ XBUTTON_NORMAL(ImageCache.getImage("msg_close_normal.png")),
+ XBUTTON_HOVER(ImageCache.getImage("msg_close_hover.png")),
+ XBUTTON_PUSH(ImageCache.getImage("msg_close_push.png"));
+
+ private Image _image;
+
+ private NotificationType(Image img) {
+ _image = img;
+ }
+
+ public Image getImage() {
+ return _image;
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/NotifierDialog.java b/org.tizen.common/src/org/tizen/common/util/NotifierDialog.java
index f76858cf7..047425327 100644
--- a/org.tizen.common/src/org/tizen/common/util/NotifierDialog.java
+++ b/org.tizen.common/src/org/tizen/common/util/NotifierDialog.java
@@ -1,316 +1,381 @@
-/*
-* Common
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Kangho Kim <kh5325.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.common.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-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.common.cache.ColorCache;
-import org.tizen.common.cache.FontCache;
-
-
-public class NotifierDialog {
-
- // how long the the tray popup is displayed after fading in (in milliseconds)
- private static final int DISPLAY_TIME = 4500;
- // how long each tick is when fading in (in ms)
- private static final int FADE_TIMER = 50;
- // how long each tick is when fading out (in ms)
- private static final int FADE_IN_STEP = 30;
- // how many tick steps we use when fading out
- private static final int FADE_OUT_STEP = 8;
-
- // how high the alpha value is when we have finished fading in
- private static final int FINAL_ALPHA = 225;
-
- // title foreground color
- private static Color _titleFgColor = ColorCache.getColor(40, 73, 97);
- // text foreground color
- private static Color _fgColor = _titleFgColor;
-
- // shell gradient background color - top
- private static Color _bgFgGradient = ColorCache.getColor(226, 239, 249);
- // shell gradient background color - bottom
- private static Color _bgBgGradient = ColorCache.getColor(177, 211, 243);
- // shell border color
- private static Color _borderColor = ColorCache.getColor(40, 73, 97);
-
- // contains list of all active popup shells
- private static List<Shell> _activeShells = new ArrayList<Shell>();
-
- // image used when drawing
- private static Image _oldImage;
-
- private static Shell _shell;
-
- /**
- * Creates and shows a notification dialog with a specific title, message and a
- *
- * @param title
- * @param message
- * @param type
- */
- public static void notify(String title, String message, NotificationType type) {
- _shell = new Shell(Display.getDefault().getActiveShell(), SWT.NO_FOCUS | SWT.NO_TRIM);
- _shell.setLayout(new FillLayout());
- _shell.setForeground(_fgColor);
- _shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
- _shell.addListener(SWT.Dispose, new Listener() {
- @Override
- public void handleEvent(Event event) {
- _activeShells.remove(_shell);
- }
- });
-
- final Composite inner = new Composite(_shell, SWT.NONE);
-
- GridLayout gl = new GridLayout(2, false);
- gl.marginLeft = 5;
- gl.marginTop = 0;
- gl.marginRight = 5;
- gl.marginBottom = 5;
-
- inner.setLayout(gl);
- _shell.addListener(SWT.Resize, new Listener() {
-
- @Override
- public void handleEvent(Event e) {
- try {
- // get the size of the drawing area
- Rectangle rect = _shell.getClientArea();
- // create a new image with that size
- Image newImage = new Image(Display.getDefault(), Math.max(1, rect.width), rect.height);
- // create a GC object we can use to draw with
- GC gc = new GC(newImage);
-
- // fill background
- gc.setForeground(_bgFgGradient);
- gc.setBackground(_bgBgGradient);
- gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, true);
-
- // draw shell edge
- gc.setLineWidth(2);
- gc.setForeground(_borderColor);
- gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2);
- // remember to dipose the GC object!
- gc.dispose();
-
- // now set the background image on the shell
- _shell.setBackgroundImage(newImage);
-
- // remember/dispose old used iamge
- if (_oldImage != null) {
- _oldImage.dispose();
- }
- _oldImage = newImage;
- } catch (Exception err) {
- err.printStackTrace();
- }
- }
- });
-
- GC gc = new GC(_shell);
-
- String lines[] = message.split("\n");
- Point longest = null;
- int typicalHeight = gc.stringExtent("X").y;
-
- for (String line : lines) {
- Point extent = gc.stringExtent(line);
- if (longest == null) {
- longest = extent;
- continue;
- }
-
- if (extent.x > longest.x) {
- longest = extent;
- }
- }
- gc.dispose();
-
- int minHeight = typicalHeight * lines.length;
-
- CLabel imgLabel = new CLabel(inner, SWT.NONE);
- imgLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
- imgLabel.setImage(type.getImage());
-
- CLabel titleLabel = new CLabel(inner, SWT.NONE);
- titleLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
- titleLabel.setText(title);
- titleLabel.setForeground(_titleFgColor);
- Font f = titleLabel.getFont();
- FontData fd = f.getFontData()[0];
- fd.setStyle(SWT.BOLD);
- fd.height = 11;
- titleLabel.setFont(FontCache.getFont(fd));
-
- Label text = new Label(inner, SWT.WRAP);
- Font tf = text.getFont();
- FontData tfd = tf.getFontData()[0];
- tfd.setStyle(SWT.BOLD);
- tfd.height = 8;
- text.setFont(FontCache.getFont(tfd));
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = 2;
- text.setLayoutData(gd);
- text.setForeground(_fgColor);
- text.setText(message);
-
- minHeight = 100;
-
- _shell.setSize(350, minHeight);
-
- if (Display.getDefault().getActiveShell() == null || Display.getDefault().getActiveShell().getMonitor() == null) { return; }
-
- Rectangle clientArea = Display.getDefault().getActiveShell().getMonitor().getClientArea();
-
- int startX = clientArea.x + clientArea.width - 352;
- int startY = clientArea.y + clientArea.height - 102;
-
- // move other shells up
- if (!_activeShells.isEmpty()) {
- List<Shell> modifiable = new ArrayList<Shell>(_activeShells);
- Collections.reverse(modifiable);
- for (Shell shell : modifiable) {
- Point curLoc = shell.getLocation();
- shell.setLocation(curLoc.x, curLoc.y - 100);
- if (curLoc.y - 100 < 0) {
- _activeShells.remove(shell);
- shell.dispose();
- }
- }
- }
-
- _shell.setLocation(startX, startY);
- _shell.setAlpha(0);
- _shell.setVisible(true);
-
- _activeShells.add(_shell);
-
- fadeIn(_shell);
- }
-
- private static void fadeIn(final Shell _shell) {
- Runnable run = new Runnable() {
-
- @Override
- public void run() {
- try {
- if (_shell == null || _shell.isDisposed()) { return; }
-
- int cur = _shell.getAlpha();
- cur += FADE_IN_STEP;
-
- if (cur > FINAL_ALPHA) {
- _shell.setAlpha(FINAL_ALPHA);
- startTimer(_shell);
- return;
- }
-
- _shell.setAlpha(cur);
- Display.getDefault().timerExec(FADE_TIMER, this);
- } catch (Exception err) {
- err.printStackTrace();
- }
- }
-
- };
- Display.getDefault().timerExec(FADE_TIMER, run);
- }
-
- private static void startTimer(final Shell _shell) {
- Runnable run = new Runnable() {
-
- @Override
- public void run() {
- try {
- if (_shell == null || _shell.isDisposed()) { return; }
-
- fadeOut(_shell);
- } catch (Exception err) {
- err.printStackTrace();
- }
- }
-
- };
- Display.getDefault().timerExec(DISPLAY_TIME, run);
-
- }
-
- private static void fadeOut(final Shell _shell) {
- final Runnable run = new Runnable() {
-
- @Override
- public void run() {
- try {
- if (_shell == null || _shell.isDisposed()) { return; }
-
- int cur = _shell.getAlpha();
- cur -= FADE_OUT_STEP;
-
- if (cur <= 0) {
- _shell.setAlpha(0);
- if (_oldImage != null) {
- _oldImage.dispose();
- }
- _shell.dispose();
- _activeShells.remove(_shell);
- return;
- }
-
- _shell.setAlpha(cur);
-
- Display.getDefault().timerExec(FADE_TIMER, this);
-
- } catch (Exception err) {
- err.printStackTrace();
- }
- }
-
- };
- Display.getDefault().timerExec(FADE_TIMER, run);
-
- }
-
-}
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.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.common.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+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.eclipse.ui.PlatformUI;
+import org.tizen.common.cache.ColorCache;
+import org.tizen.common.cache.FontCache;
+
+
+public class NotifierDialog {
+
+ // how long the the tray popup is displayed after fading in (in milliseconds)
+ private static final int DISPLAY_TIME = 4500;
+ // how long each tick is when fading in (in ms)
+ private static final int FADE_TIMER = 50;
+ // how long each tick is when fading out (in ms)
+ private static final int FADE_IN_STEP = 30;
+ // how many tick steps we use when fading out
+ private static final int FADE_OUT_STEP = 8;
+
+ // how high the alpha value is when we have finished fading in
+ private static final int FINAL_ALPHA = 225;
+
+ // title foreground color
+ private static Color _titleFgColor = ColorCache.getColor(40, 73, 97);
+ // text foreground color
+ private static Color _fgColor = _titleFgColor;
+
+ // shell gradient background color - top
+ private static Color _bgFgGradient = ColorCache.getColor(226, 239, 249);
+ // shell gradient background color - bottom
+ private static Color _bgBgGradient = ColorCache.getColor(177, 211, 243);
+ // shell border color
+ private static Color _borderColor = ColorCache.getColor(40, 73, 97);
+
+ // contains list of all active popup shells
+ private static List<Shell> _activeShells = new ArrayList<Shell>();
+
+ // image used when drawing
+ private static Image _oldImage;
+
+ private static Shell _shell;
+
+ // label button listener
+ private static LabelButtonListener _listner = new LabelButtonListener();
+
+ // dialog start position
+ private static int startX = 0;
+ private static int startY = 0;
+
+ /**
+ * Creates and shows a notification dialog with a specific title, message and icon
+ *
+ * @param title
+ * @param message
+ * @param type
+ */
+ public static void notify(String title, String message, NotificationType type) {
+ Shell eclipseShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ _shell = new Shell(eclipseShell, SWT.NO_FOCUS | SWT.NO_TRIM);
+ //_shell = new Shell(Display.getDefault().getActiveShell(), SWT.NO_FOCUS | SWT.NO_TRIM);
+ _shell.setLayout(new FillLayout());
+ _shell.setForeground(_fgColor);
+ _shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
+ _shell.addListener(SWT.Dispose, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ if( event.widget instanceof Shell ) {
+ Shell shell = (Shell)event.widget;
+ _activeShells.remove(shell);
+ }
+ }
+ });
+
+ final Composite inner = new Composite(_shell, SWT.NONE);
+
+ GridLayout gl = new GridLayout(3, false);
+ gl.marginLeft = 5;
+ gl.marginTop = 0;
+ gl.marginRight = 5;
+ gl.marginBottom = 5;
+
+ inner.setLayout(gl);
+ _shell.addListener(SWT.Resize, new Listener() {
+
+ @Override
+ public void handleEvent(Event e) {
+ try {
+ // get the size of the drawing area
+ Rectangle rect = _shell.getClientArea();
+ // create a new image with that size
+ Image newImage = new Image(Display.getDefault(), Math.max(1, rect.width), rect.height);
+ // create a GC object we can use to draw with
+ GC gc = new GC(newImage);
+
+ // fill background
+ gc.setForeground(_bgFgGradient);
+ gc.setBackground(_bgBgGradient);
+ gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, true);
+
+ // draw shell edge
+ gc.setLineWidth(2);
+ gc.setForeground(_borderColor);
+ gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2);
+ // remember to dipose the GC object!
+ gc.dispose();
+
+ // now set the background image on the shell
+ _shell.setBackgroundImage(newImage);
+
+ // remember/dispose old used iamge
+ if (_oldImage != null) {
+ _oldImage.dispose();
+ }
+ _oldImage = newImage;
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+ });
+
+ GC gc = new GC(_shell);
+
+ String lines[] = message.split("\n");
+ Point longest = null;
+ int typicalHeight = gc.stringExtent("X").y;
+
+ for (String line : lines) {
+ Point extent = gc.stringExtent(line);
+ if (longest == null) {
+ longest = extent;
+ continue;
+ }
+
+ if (extent.x > longest.x) {
+ longest = extent;
+ }
+ }
+ gc.dispose();
+
+ int minHeight = typicalHeight * lines.length;
+
+ CLabel imgLabel = new CLabel(inner, SWT.NONE);
+ imgLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
+ imgLabel.setImage(type.getImage());
+
+ CLabel titleLabel = new CLabel(inner, SWT.NONE);
+ titleLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER)); //GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
+ titleLabel.setText(title);
+ titleLabel.setForeground(_titleFgColor);
+ Font f = titleLabel.getFont();
+ FontData fd = f.getFontData()[0];
+ fd.setStyle(SWT.BOLD);
+ fd.height = 11;
+ titleLabel.setFont(FontCache.getFont(fd));
+
+ // added close button
+ Label button = new Label(inner, SWT.NONE);
+ button.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_END));
+ button.setImage(NotificationType.XBUTTON_NORMAL.getImage());
+ addLabelButtonListner(button);
+
+ Label text = new Label(inner, SWT.WRAP);
+ Font tf = text.getFont();
+ FontData tfd = tf.getFontData()[0];
+ tfd.setStyle(SWT.BOLD);
+ tfd.height = 8;
+ text.setFont(FontCache.getFont(tfd));
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 2;
+ text.setLayoutData(gd);
+ text.setForeground(_fgColor);
+ text.setText(message);
+
+ minHeight = 100;
+
+ _shell.setSize(350, minHeight);
+
+ //if (Display.getDefault().getActiveShell() == null || Display.getDefault().getActiveShell().getMonitor() == null) { return; }
+ if (eclipseShell == null || eclipseShell.getBounds() == null) { return; }
+
+ //Rectangle clientArea = Display.getDefault().getActiveShell().getMonitor().getClientArea();
+ Rectangle clientArea = eclipseShell.getBounds();
+
+ startX = clientArea.x + clientArea.width - 352;
+ startY = clientArea.y + clientArea.height - 102;
+
+ // move other shells up
+ if (!_activeShells.isEmpty()) {
+ List<Shell> modifiable = new ArrayList<Shell>(_activeShells);
+ Collections.reverse(modifiable);
+ for (Shell shell : modifiable) {
+ Point curLoc = shell.getLocation();
+ if (curLoc.y - 100 < 0 || curLoc.x != startX) {
+ _activeShells.remove(shell);
+ shell.dispose();
+ } else {
+ shell.setLocation(curLoc.x, curLoc.y - 100);
+ }
+ }
+ }
+
+ // set notifierDialog position
+ _shell.setLocation(startX, startY);
+ _shell.setAlpha(0);
+ _shell.setVisible(true);
+
+ _activeShells.add(_shell);
+
+ fadeIn(_shell);
+ }
+
+ private static void addLabelButtonListner (Label button) {
+ button.addListener(SWT.MouseDown, _listner);
+ button.addListener(SWT.MouseUp, _listner);
+ button.addListener(SWT.MouseEnter, _listner);
+ button.addListener(SWT.MouseExit, _listner);
+ button.addListener(SWT.MouseHover, _listner);
+ }
+
+ private static class LabelButtonListener implements Listener {
+ @Override
+ public void handleEvent(Event event) {
+ if ( event.widget instanceof Label ) {
+ Label bt = (Label)event.widget;
+ Shell shell = bt.getParent().getShell();
+ if ( SWT.MouseDown == event.type ) {
+ bt.setImage(NotificationType.XBUTTON_PUSH.getImage());
+ } else if (SWT.MouseUp == event.type ) {
+ bt.setImage(NotificationType.XBUTTON_NORMAL.getImage());
+ if ( shell != null ) {
+ _activeShells.remove(shell);
+ shell.dispose();
+
+ if ( _activeShells.size() > 0 ) {
+ List<Shell> modifiable = new ArrayList<Shell>(_activeShells);
+ Collections.reverse(modifiable);
+ int y = 0;
+ for (Shell tempshell : modifiable) {
+ tempshell.setLocation(tempshell.getLocation().x, startY-y);
+ y+=100;
+ }
+ }
+ }
+ } else if ( SWT.MouseHover == event.type ) {
+ bt.setImage(NotificationType.XBUTTON_HOVER.getImage());
+ } else if ( SWT.MouseEnter == event.type ) {
+ bt.setImage(NotificationType.XBUTTON_HOVER.getImage());
+ } else if ( SWT.MouseExit == event.type ) {
+ bt.setImage(NotificationType.XBUTTON_NORMAL.getImage());
+ }
+ }
+ }
+ }
+
+ private static void fadeIn(final Shell _shell) {
+ Runnable run = new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ if (_shell == null || _shell.isDisposed()) { return; }
+
+ int cur = _shell.getAlpha();
+ cur += FADE_IN_STEP;
+
+ if (cur > FINAL_ALPHA) {
+ _shell.setAlpha(FINAL_ALPHA);
+ startTimer(_shell);
+ return;
+ }
+
+ _shell.setAlpha(cur);
+ Display.getDefault().timerExec(FADE_TIMER, this);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ };
+ Display.getDefault().timerExec(FADE_TIMER, run);
+ }
+
+ private static void startTimer(final Shell _shell) {
+ Runnable run = new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ if (_shell == null || _shell.isDisposed()) { return; }
+
+ fadeOut(_shell);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ };
+ Display.getDefault().timerExec(DISPLAY_TIME, run);
+
+ }
+
+ private static void fadeOut(final Shell _shell) {
+ final Runnable run = new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ if (_shell == null || _shell.isDisposed()) { return; }
+
+ int cur = _shell.getAlpha();
+ cur -= FADE_OUT_STEP;
+
+ if (cur <= 0) {
+ _shell.setAlpha(0);
+ if (_oldImage != null) {
+ _oldImage.dispose();
+ }
+ _shell.dispose();
+ _activeShells.remove(_shell);
+ return;
+ }
+
+ _shell.setAlpha(cur);
+
+ Display.getDefault().timerExec(FADE_TIMER, this);
+
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ };
+ Display.getDefault().timerExec(FADE_TIMER, run);
+
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/SWTUtil.java b/org.tizen.common/src/org/tizen/common/util/SWTUtil.java
index 21c7dc9c7..e9c6f1981 100644
--- a/org.tizen.common/src/org/tizen/common/util/SWTUtil.java
+++ b/org.tizen.common/src/org/tizen/common/util/SWTUtil.java
@@ -29,6 +29,9 @@ import java.awt.Toolkit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.VerifyEvent;
@@ -37,8 +40,10 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
public class SWTUtil {
@@ -200,4 +205,38 @@ public class SWTUtil {
return page.getEditorReferences();
}
+ public static void refreshLocal() throws CoreException {
+ IEditorPart editor = SWTUtil.getActiveEditor();
+ if (editor != null && editor.getEditorInput() != null){
+ IFileEditorInput input = (IFileEditorInput) editor.getEditorInput().getAdapter(IFileEditorInput.class);
+ if (input == null) {
+ return;
+ }
+ input.getFile().getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+ }
+
+ public static String getProjectPath() {
+ IEditorPart editor = SWTUtil.getActiveEditor();
+ if (editor == null || editor.getEditorInput() == null){
+ return null;
+ }
+
+ IFileEditorInput input = (IFileEditorInput) editor.getEditorInput().getAdapter(IFileEditorInput.class);
+ if (input == null) {
+ return null;
+ }
+
+ String projectName = input.getFile().getProject().getName();
+
+ IWorkspaceRoot workspaceRoot = IDEWorkbenchPlugin.getPluginWorkspace().getRoot();
+ String projectPath = "";
+ try {
+ projectPath = workspaceRoot.getProject(projectName).getLocation().toOSString();
+ } catch (Exception e) {
+ projectPath = workspaceRoot.getLocation().toOSString();
+ }
+
+ return projectPath;
+ }
} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/util/ShellParser.java b/org.tizen.common/src/org/tizen/common/util/ShellParser.java
deleted file mode 100644
index 5f868f59d..000000000
--- a/org.tizen.common/src/org/tizen/common/util/ShellParser.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-* Common
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Kangho Kim <kh5325.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.common.util;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-public class ShellParser{
- Process proc = null;
-
- public ShellParser(Process process) {
- proc = process;
- }
-
- public void setProcess(Process proc) {
- this.proc = proc;
- }
-
- public void parsing() {
- final StringBuilder contents = new StringBuilder();
-
- Thread inputThread = new Thread(){
- public void run() {
- String line = null;
- BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- try {
- while((line=input.readLine())!=null){
- contents.append(line);
- contents.append(HostUtil.LINE_SEPARATOR);
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- };
-
- Thread errorThread = new Thread(){
- public void run() {
- String line = null;
- BufferedReader input = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
- try {
- while((line=input.readLine())!=null){
- contents.append(line);
- contents.append(HostUtil.LINE_SEPARATOR);
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- };
-
- inputThread.start();
- errorThread.start();
- }
-}
diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest
index 2bae7c8c2..7f09c0fb0 100644
--- a/package/pkginfo.manifest
+++ b/package/pkginfo.manifest
@@ -1,19 +1,19 @@
Package:common-eplugin
-Version:0.20.12
+Version:1.0.14
OS:linux
Build-host-os:linux
Build-dependency:indigo-pde [linux], base-ide-product [linux]
Install-dependency:base-ide-product [linux]
Source:common-eplugin
-Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Jihoon Song, Ho Namkoong, Taeyoung Son
+Maintainer:kangho kim <kh5325.kim@samsung.com>, yoonki park <yoonki.park@samsung.com>, hyunsik non <hyunsik.noh@samsung.com>, taeyoung son <taeyoung2.son@samsung.com>, gune Kim <gune.kim@samsung.com>, ho namkoong <ho.namkoong@samsung.com>, hyeongseok heo <hyeong-seok.heo@samsung.com>, gyeongseok seo <gyeongseok.seo@samsung.com>, jihoon song<jihoon80.song@samsung.com>, changhyun lee <changhyun1.lee@samsung.com>, bonyong lee <bonyong.lee@samsung.com>
Description:Common plugin
Package:common-eplugin
-Version:0.20.12
+Version:1.0.14
OS:windows
Build-host-os:linux
Build-dependency:indigo-winpde [windows], base-ide-product [windows]
Install-dependency:base-ide-product [windows]
Source:common-eplugin
-Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Jihoon Song, Ho Namkoong, Taeyoung Son
+Maintainer:kangho kim <kh5325.kim@samsung.com>, yoonki park <yoonki.park@samsung.com>, hyunsik non <hyunsik.noh@samsung.com>, taeyoung son <taeyoung2.son@samsung.com>, gune Kim <gune.kim@samsung.com>, ho namkoong <ho.namkoong@samsung.com>, hyeongseok heo <hyeong-seok.heo@samsung.com>, gyeongseok seo <gyeongseok.seo@samsung.com>, jihoon song<jihoon80.song@samsung.com>, changhyun lee <changhyun1.lee@samsung.com>, bonyong lee <bonyong.lee@samsung.com>
Description:Common plugin