while (!shell.isDisposed())
{
if (!display.readAndDispatch())
+ {
display.sleep();
+ }
}
return bOk;
tabNameText = new Text(top, SWT.SINGLE | SWT.BORDER);
if (tabName != null)
+ {
tabNameText.setText(tabName);
+ }
tabNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
l = new Label(top, SWT.NONE);
for (IDevice d : devices)
{
if (d.isOnline())
+ {
dCombo.add(d.getSerialNumber());
+ }
}
if (device != null)
tagText = new Text(mid, SWT.SINGLE | SWT.BORDER);
if (tagKeyword != null)
+ {
tagText.setText(tagKeyword);
+ }
tagText.setMessage("Separated by a space and comma");
tagText.setToolTipText("Search Tag Keywords are separated by a space as well as a comma");
tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
pidText = new Text(mid, SWT.SINGLE | SWT.BORDER);
if (pidKeyword != null)
+ {
pidText.setText(pidKeyword);
+ }
pidText.setMessage("Separated by a space and comma");
pidText.setToolTipText("Search Pid Keywords are separated by a space as well as a comma");
pidText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
msgText = new Text(mid, SWT.SINGLE | SWT.BORDER);
if (msgKeyword != null)
+ {
msgText.setText(msgKeyword);
+ }
msgText.setMessage("Separated by a space and comma");
msgText.setToolTipText("Search Message Keywords are separated by a space as well as a comma");
msgText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (tab.getLogTabName().equals(newName))
{
if (oldTab != null && oldTab == tab)
+ {
continue;
+ }
int ret = FileDialogUtils.checkTabName(newName);
if (ret == IDialogConstants.OK_ID)
+ {
return;
+ }
}
}
for (IDevice device : getDevices())
{
if (device.isOffline())
+ {
continue;
+ }
LogTab dTab = createLogTab(ConnectionExplorerLabelProvider.getDeviceSerialWithName(device), device, true);
dTab.start();
}
public boolean save()
{
if (getSelectionLogTab() == null)
+ {
return false;
+ }
FileDialog dlg = new FileDialog(parent.getShell(), SWT.SAVE);
dlg.setText(LogUIMessages.Log_Title_Tab_Export);
again = false;
fileName = dlg.open();
if (fileName == null)
+ {
return false;
+ }
checkFile = new File(fileName);
if (checkFile.exists())
{
{
LogTab tab = getSelectionLogTab();
if ( tab != null)
+ {
tab.clear();
+ }
}
/**
LogTab tab = getSelectionLogTab();
if (tab == null)
+ {
return;
+ }
if (!checkTabConnection(tab, LogUIMessages.Log_Title_Tab_AddTab_Error))
{
AddViewDialog dlg = new AddViewDialog(parent.getShell(), tab.getDeviceSerialNumber());
if (dlg.getDevice() == null)
+ {
return;
+ }
if (dlg.open())
{
}
}
} else
+ {
return;
+ }
}
public void removeTab(LogTab tab)
{
int index = tabFolder.getSelectionIndex();
if (index < 0)
+ {
return;
+ }
LogTab tab = logTabList.get(index);
removeTab(tab);
logTabList.remove(tab);
LogTab oldTab = getSelectionLogTab();
if (oldTab == null)
+ {
return;
+ }
if (oldTab.isDefault())
{
for(LogTab logTab : logTabList)
{
if(logTab.getTabItem() == item)
+ {
return logTab;
+ }
}
}
return null;
IDevice[] devices;
SmartDevelopmentBridge sdbBridge = SmartDevelopmentBridge.getBridge();
if(sdbBridge != null)
+ {
devices = sdbBridge.getDevices();
+ }
else
+ {
devices = new IDevice[0];
+ }
return devices;
}
*/
package org.tizen.common.connection.log;
+import static org.tizen.common.util.SWTUtil.syncExec;
+
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
{
pidInput = pid;
if (pid != null)
+ {
pidFilters = setFilter(pid.split("[\\s\t,]"));
+ }
else
+ {
pidFilters = null;
+ }
}
public void setTagFilter(String tag)
{
tagInput = tag;
if (tag != null)
+ {
tagFilters = setFilter(tag.split("[\\s\t,]"));
+ }
else
+ {
tagFilters = null;
+ }
}
public void setMsgFilter(String msg)
{
msgInput = msg;
if (msg != null)
+ {
msgFilters = setFilter(msg.split("[\\s\t,]"));
+ }
else
+ {
msgFilters = null;
+ }
}
private String[] setFilter(String[] array)
public String getDeviceSerialNumber()
{
if (device != null)
+ {
return device.getSerialNumber();
+ }
else
+ {
return null;
+ }
}
public void setTabItem(TabItem tabItem)
{
filteredMessages.add(newMessage);
if(filteredByIconAndText(newMessage))
+ {
newMessages.add(newMessage);
+ }
}
}
}
for (String filter : pidFilters)
{
if (logMessage.data.pidString.contains(filter))
+ {
return true;
+ }
}
}
for (String filter : tagFilters)
{
if (logMessage.data.tag.toLowerCase().contains(filter.toLowerCase()))
+ {
return true;
+ }
}
}
for (String filter : msgFilters)
{
if (logMessage.msg.toLowerCase().contains(filter.toLowerCase()))
+ {
return true;
+ }
}
}
return false;
boolean filteredByIconAndText(LogMessage logMessage)
{
if (logMessage == null)
+ {
return false;
+ }
if (levelMode != LEVEL_ALL)
{
a = (levelMode & (0x1 << (logMessage.data.logLevel.getPriority() - 2)));
if (a == 0)
+ {
return false;
+ }
}
if (filteredByText(logMessage))
table.removeAll();
} else
{
- Display d = table.getDisplay();
-
// run sync as we need to update right now.
- d.syncExec(new Runnable()
+ syncExec(new Runnable()
{
@Override
public void run()
FileEntry[] children = null;
if (isInitialized == false)
+ {
children = parent.getCachedChildren();
+ }
else
+ {
children = parent.getFileListingService().getChildren(parent, false, null);
+ }
List<FileEntry> entries = new ArrayList<FileEntry>();
for (FileEntry child : children) {
}
return entries.toArray();
} else
+ {
return new Object[0];
+ }
}
@Override
if (arg0 instanceof FileEntry) {
FileEntry entry = (FileEntry) arg0;
if (entry.getType() == FileListingService.TYPE_DIRECTORY_LINK)
+ {
return true;
+ }
else if (entry.getType() == FileListingService.TYPE_LINK)
+ {
return true;
+ }
else if (entry.getType() == FileListingService.TYPE_DIRECTORY)
+ {
return true;
+ }
else if (entry.getType() == FileListingService.TYPE_ROOT_EMULATOR)
+ {
return true;
+ }
else if (entry.getType() == FileListingService.TYPE_ROOT_DEVICE)
+ {
return true;
+ }
else
+ {
return false;
+ }
}
return false;
}
package org.tizen.common.core.application;
+import static org.tizen.common.util.IOUtil.tryClose;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
public static String getSDBPath() {
String toolsPath = getToolsPath();
if (OSChecker.isWindows())
+ {
return toolsPath + File.separator + "sdb.exe";
+ }
else
+ {
return toolsPath + File.separator + "sdb";
+ }
}
public static String getSdbWinUsbApiPath() {
if (HostUtil.exists(sdkPath)) {
String[] fileContent = HostUtil.getContents(sdkPath).split("=");
if (HostUtil.exists(fileContent[1]))
+ {
sdkInstallPath = fileContent[1];
+ }
else {
status = false;
}
} catch (IOException e) {
e.printStackTrace();
} finally {
- if (br != null) {
- try {
- br.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ tryClose( br );
}
return value;
if (codes[j].length() > 0 && codes[j].matches("[\\d]*")) {
int code = Integer.parseInt(codes[j]);
if (code == 0)
+ {
brighter = false;
+ }
else if (code == 1)
+ {
brighter = true;
+ }
else if (code >= 30 && code <= 39) {
if (code == 39)
+ {
color[0] = BLACK; //default foreground color
+ }
else if (code >= 30 && code <= 37) {
color[0] = getColorFromANSICode(code, brighter);
brighter = false;
}
} else if (code >= 40 && code <= 49) {
if (code == 49)
+ {
color[1] = WHITE; //default background color
+ }
else if (code >= 40 && code <= 47)
+ {
color[1] = getColorFromANSICode(code, brighter);
+ }
}
}
}
}
public static List<TextStyle> getStringStyles(String newLineStr) {
List<TextStyle> styles = parseAnsiString(newLineStr);
- if (styles != null) {
- return styles;
- }else {
- return null;
- }
+ return styles;
}
}
\r
package org.tizen.common.ui.widget;\r
\r
-import java.util.List;\r
import java.util.ArrayList;\r
+import java.util.List;\r
\r
-import org.eclipse.swt.*;\r
-import org.eclipse.swt.graphics.*;\r
-import org.eclipse.swt.widgets.*;\r
-import org.eclipse.swt.events.*;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.DisposeEvent;\r
+import org.eclipse.swt.events.DisposeListener;\r
+import org.eclipse.swt.events.MouseAdapter;\r
+import org.eclipse.swt.events.MouseEvent;\r
+import org.eclipse.swt.events.MouseTrackAdapter;\r
+import org.eclipse.swt.events.PaintEvent;\r
+import org.eclipse.swt.events.PaintListener;\r
+import org.eclipse.swt.graphics.GC;\r
+import org.eclipse.swt.graphics.Image;\r
+import org.eclipse.swt.graphics.Point;\r
+import org.eclipse.swt.graphics.Rectangle;\r
+import org.eclipse.swt.widgets.Canvas;\r
+import org.eclipse.swt.widgets.Composite;\r
\r
/**\r
* Reference to http://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm\r
int imageHeight = image.getBounds().height;\r
gc.dispose();\r
if (imageWidth >= textWidth)\r
+ {\r
width = imageWidth + 2;\r
+ }\r
else\r
width = textWidth + 2;\r
height = textHeight + imageHeight + 7;\r
height = extent.y + 2;\r
}\r
if (wHint != -1)\r
+ {\r
width = wHint;\r
+ }\r
if (hHint != -1)\r
+ {\r
height = hHint;\r
+ }\r
\r
return new Point(width + 2, height + 2);\r
}\r
import static org.tizen.common.util.StringUtil.EMPTY_STRING;
import static org.tizen.common.util.StringUtil.NULL_STRING;
+import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
else if ( obj instanceof Object[] )
{
return toString( ( Object[] ) obj );
- }
- else if ( obj instanceof boolean[] )
- {
- return toString( ( boolean[] ) obj );
- }
- else if ( obj instanceof byte[] )
- {
- return toString( ( byte[] )obj );
- }
- else if ( obj instanceof char[] )
- {
- return toString( ( char[] ) obj );
- }
- else if ( obj instanceof double[] )
- {
- return toString( ( double[] ) obj );
- }
- else if ( obj instanceof float[] )
- {
- return toString( (float[] ) obj );
- }
- else if ( obj instanceof int[] )
- {
- return toString( (int[] ) obj );
- }
- else if ( obj instanceof long[] )
- {
- return toString( ( long[] ) obj );
- }
- else if ( obj instanceof short[] )
- {
- return toString( ( short[] )obj );
+ } else if ( obj.getClass().isArray() )
+ {
+ int length = Array.getLength( obj );
+
+ if ( 0 == length )
+ {
+ return EMPTY_ARRAY;
+ }
+
+ final StringBuilder buffer= new StringBuilder();
+
+ buffer.append( ARRAY_START);
+ for ( int i=0 ; i<length ; ++i )
+ {
+ if ( 0 != i ) {
+ buffer.append( ARRAY_ELEMENT_SEPARATOR );
+ }
+
+ buffer.append( toString( Array.get( obj, i ) ) );
+ }
+ buffer.append( ARRAY_END );
+ return buffer.toString();
}
return ObjectUtil.nvl( obj.toString(), EMPTY_STRING );
}
-
- /**
- * Converts <code>array</code> boolean[] to String.
- *
- * @param array boolean[] to convert
- *
- * @return converted String
- */
- public static
- String
- toString(
- final boolean[] array
- )
- {
- if ( null == array )
- {
- return NULL_STRING;
- }
-
- final int length = array.length;
-
- if ( 0 == length )
- {
- return EMPTY_ARRAY;
- }
-
- final StringBuilder buffer= new StringBuilder();
-
- buffer.append( ARRAY_START);
- for ( int i=0 ; i<length ; ++i )
- {
- if ( 0 != i ) {
- buffer.append( ARRAY_ELEMENT_SEPARATOR );
- }
-
- buffer.append( toString( array[i] ) );
- }
- buffer.append( ARRAY_END );
- return buffer.toString();
- }
-
- /**
- * Converts <code>array</code> byte[] to String.
- *
- * @param array byte[] to convert
- *
- * @return converted String
- */
- public static
- String
- toString(
- final byte[] array
- )
- {
- if ( null == array )
- {
- return NULL_STRING;
- }
-
- final int length = array.length;
-
- if ( 0 == length )
- {
- return EMPTY_ARRAY;
- }
-
- final StringBuilder buffer= new StringBuilder();
-
- buffer.append( ARRAY_START);
- for ( int i=0 ; i<length ; ++i )
- {
- if ( 0 != i ) {
- buffer.append( ARRAY_ELEMENT_SEPARATOR );
- }
-
- buffer.append( toString( array[i] ) );
- }
- buffer.append( ARRAY_END );
- return buffer.toString();
- }
-
- /**
- * Converts <code>array</code> char[] to String.
- *
- * @param array char[] to convert
- *
- * @return converted String
- */
- public static
- String
- toString(
- final char[] array
- )
- {
- if ( null == array )
- {
- return NULL_STRING;
- }
-
- final int length = array.length;
-
- if ( 0 == length )
- {
- return EMPTY_ARRAY;
- }
-
- final StringBuilder buffer= new StringBuilder();
-
- buffer.append( ARRAY_START);
- for ( int i=0 ; i<length ; ++i )
- {
- if ( 0 != i )
- {
- buffer.append( ARRAY_ELEMENT_SEPARATOR );
- }
-
- buffer.append( toString( array[i] ) );
- }
- buffer.append( ARRAY_END );
- return buffer.toString();
- }
-
-
- /**
- * Converts <code>array</code> short[] to String.
- *
- * @param array short[] to convert
- *
- * @return converted String
- */
- public static
- String
- toString(
- final short[] array
- )
- {
- if ( null == array )
- {
- return NULL_STRING;
- }
-
- final int length = array.length;
-
- if ( 0 == length )
- {
- return EMPTY_ARRAY;
- }
-
- final StringBuilder buffer = new StringBuilder();
- for( int i=0 ; i<length ; ++i )
- {
- if ( 0 == i )
- {
- buffer.append( ARRAY_START );
- }
- else
- {
- buffer.append( ARRAY_ELEMENT_SEPARATOR );
- }
-
- buffer.append( array[i] );
- }
- buffer.append( ARRAY_END );
- return buffer.toString();
- }
-
- /**
- * Converts <code>array</code> int[] to String.
- *
- * @param array int[] to String
- *
- * @return converted String
- */
- public static
- String
- toString(
- final int[] array
- )
- {
- if ( null == array )
- {
- return NULL_STRING;
- }
-
- final int length = array.length;
-
- if ( 0 == length )
- {
- return EMPTY_ARRAY;
- }
-
- final StringBuilder buffer = new StringBuilder();
- for( int i=0 ; i<length ; ++i )
- {
- if ( 0 == i )
- {
- buffer.append( ARRAY_START );
- }
- else
- {
- buffer.append( ARRAY_ELEMENT_SEPARATOR );
- }
-
- buffer.append( array[i] );
- }
- buffer.append( ARRAY_END );
- return buffer.toString();
- }
-
- /**
- * Converts <code>array</code> long[] to String.
- *
- * @param array long[] to convert
- *
- * @return converted String
- */
- public static
- String
- toString(
- final long[] array
- )
- {
- if ( null == array )
- {
- return NULL_STRING;
- }
-
- int length = array.length;
-
- if ( 0 == length )
- {
- return EMPTY_ARRAY;
- }
-
- final StringBuilder buffer = new StringBuilder();
- for( int i=0 ; i<length ; ++i)
- {
- if ( 0 == i )
- {
- buffer.append( ARRAY_START );
- }
- else
- {
- buffer.append( ARRAY_ELEMENT_SEPARATOR );
- }
-
- buffer.append( array[i] );
- }
- buffer.append( ARRAY_END );
- return buffer.toString();
- }
-
- /**
- * Converts <code>array</code> double[] to String.
- *
- * @param array double[] to convert
- *
- * @return converted String
- */
- public static
- String
- toString(
- final double[] array
- )
- {
- if ( null == array )
- {
- return NULL_STRING;
- }
-
- int length= array.length;
-
- if ( 0 == length )
- {
- return EMPTY_ARRAY;
- }
-
- StringBuilder buffer = new StringBuilder();
- for( int i=0 ; i<length ; ++i )
- {
- if ( 0 == i )
- {
- buffer.append( ARRAY_START);
- }
- else
- {
- buffer.append( ARRAY_ELEMENT_SEPARATOR);
- }
-
- buffer.append( array[i] );
- }
- buffer.append( ARRAY_END );
- return buffer.toString();
- }
-
- /**
- * Converts <code>array</code> float[] to String.
- *
- * @param array float[] to convert
- *
- * @return converted String
- */
- public static
- String
- toString(
- final float[] array
- )
- {
- if ( null == array )
- {
- return NULL_STRING;
- }
-
- int length = array.length;
-
- if ( 0 == length )
- {
- return EMPTY_ARRAY;
- }
-
- final StringBuilder buffer = new StringBuilder();
- for( int i=0 ; i < length ; ++i )
- {
- if ( 0 == i )
- {
- buffer.append( ARRAY_START );
- }
- else
- {
- buffer.append( ARRAY_ELEMENT_SEPARATOR );
- }
-
- buffer.append( array[i] );
- }
- buffer.append( ARRAY_END );
- return buffer.toString();
- }
-
- /**
- * Converts <code>array</code> Object[] to String.
- *
- * @param array Object[] to convert
- *
- * @return converted String
- */
- public static <T>
- String
- toString(
- final T[] array
- )
- {
- if ( null == array )
- {
- return NULL_STRING;
- }
-
- final int length = array.length;
-
- if ( 0 == length )
- {
- return EMPTY_ARRAY;
- }
-
- final StringBuilder buffer= new StringBuilder();
-
- buffer.append( ARRAY_START);
- buffer.append( concatenate( array, ARRAY_ELEMENT_SEPARATOR ) );
- buffer.append( ARRAY_END );
- return buffer.toString();
- }
/**
* Returns a String from <code>array</code> Object[] with String separator.
byte[] b = new byte[4096];
for (int n; (n = is.read(b)) != -1;)
+ {
out.append(new String(b,0,n));
+ }
return out.toString();
}
assertEquals( "{T, i, Z, e, N}", result );
result = CollectionUtil.toString( charArray2 );
assertEquals( "{}", result );
+
+ assertEquals( "{true, false}", CollectionUtil.toString( new boolean[] { true, false } ) );
}
/**