[Title]1.add prefrences page to set timeout value while
authorhyunsik.noh <hyunsik.noh@samsung.com>
Tue, 11 Sep 2012 06:48:14 +0000 (15:48 +0900)
committerhyunsik.noh <hyunsik.noh@samsung.com>
Tue, 11 Sep 2012 06:48:14 +0000 (15:48 +0900)
pushing/pulling files via Connection Explorer
2. sdblib.jar update
3. fix to show dialog when failed to push/pull files
[Type]enhancement
[Module]common
[Redmine#]

Change-Id: I3629916b5675f2f763d0f1ea808727f84183c44d

org.tizen.common.connection/OSGI-INF/l10n/bundle.properties
org.tizen.common.connection/plugin.xml
org.tizen.common.connection/src/org/tizen/common/connection/ConnectionPlugin.java
org.tizen.common.connection/src/org/tizen/common/connection/preference/PreferenceMessages.java [new file with mode: 0644]
org.tizen.common.connection/src/org/tizen/common/connection/preference/PreferenceMessages.properties [new file with mode: 0644]
org.tizen.common.connection/src/org/tizen/common/connection/preference/TizenConnectionExplorerPreferencePage.java [new file with mode: 0644]
org.tizen.common/lib/sdblib.jar

index 30d3796..af68969 100644 (file)
@@ -8,6 +8,8 @@ view.log = Log
 properties.page.info = Info
 properties.page.permission = Permission
 
+connectionexplorer.name = Connection Explorer
+
 command.category = Connection Explorer
 command.delete.name = Delete
 command.delete.description = Delete a file or folder on the connected target
index 4a0b771..f6b3038 100644 (file)
             restorable="true">
       </view>
    </extension>
+   
+   <extension
+        point="org.eclipse.ui.preferencePages">
+        <page
+            class="org.tizen.common.connection.preference.TizenConnectionExplorerPreferencePage"
+            id="org.tizen.common.connection.preferences.tizencommon"
+            name="%connectionexplorer.name"
+            category="org.tizen.common.preferences.tizencommon">
+        </page>
+    </extension>
 
    <extension
          point="org.eclipse.ui.views">
index c12e65b..f2b232e 100755 (executable)
@@ -35,10 +35,12 @@ import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionRegistry;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.RegistryFactory;
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 import org.tizen.common.connection.debugtools.DebugTool;
+import org.tizen.common.connection.preference.TizenConnectionExplorerPreferencePage;
 import org.tizen.common.core.application.InstallPathConfig;
 import org.tizen.common.util.FileUtil;
 import org.tizen.common.util.OSChecker;
@@ -105,6 +107,14 @@ public class ConnectionPlugin extends AbstractUIPlugin {
         }
 
     }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeDefaultPreferences(org.eclipse.jface.preference.IPreferenceStore)
+     */
+    @Override
+    protected void initializeDefaultPreferences( final IPreferenceStore store ) {
+        store.setDefault(TizenConnectionExplorerPreferencePage.KEY_PUSHPULL_TIMEOUT, TizenConnectionExplorerPreferencePage.VALUE_PUSHPULL_TIMEOUT_DEFAULT);
+    }
 
     public static synchronized  List<DebugTool> getDebugTools(IDevice device) {
         List<DebugTool> toolLists = new ArrayList<DebugTool>();
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/preference/PreferenceMessages.java b/org.tizen.common.connection/src/org/tizen/common/connection/preference/PreferenceMessages.java
new file mode 100644 (file)
index 0000000..920f077
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+*  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.connection.preference;
+
+import org.eclipse.osgi.util.NLS;
+
+public class PreferenceMessages {
+
+    private static final String BUNDLE_NAME = PreferenceMessages.class.getName();//$NON-NLS-1$
+
+    public static String CONNECTION_EXPLORER_DESCRIPTION;
+    public static String CONNECTION_EXPLORER_GROUP_TIMEOUT;
+    public static String CONNECTION_EXPLORER_TIMEOUT_DESCRIPTION;
+    public static String CONNECTION_EXPLORER_LABEL_TIMEOUT;
+    
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages( BUNDLE_NAME, PreferenceMessages.class );
+    }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/preference/PreferenceMessages.properties b/org.tizen.common.connection/src/org/tizen/common/connection/preference/PreferenceMessages.properties
new file mode 100644 (file)
index 0000000..8cd429a
--- /dev/null
@@ -0,0 +1,4 @@
+CONNECTION_EXPLORER_DESCRIPTION=Settings for Connection Explorer
+CONNECTION_EXPLORER_GROUP_TIMEOUT=Setting Timeout
+CONNECTION_EXPLORER_TIMEOUT_DESCRIPTION=Set timeout to push/pull files through the Connection Explorer
+CONNECTION_EXPLORER_LABEL_TIMEOUT=Timeout (milliseconds) :
\ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/preference/TizenConnectionExplorerPreferencePage.java b/org.tizen.common.connection/src/org/tizen/common/connection/preference/TizenConnectionExplorerPreferencePage.java
new file mode 100644 (file)
index 0000000..b26d43b
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+*  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.connection.preference;
+
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.tizen.common.connection.ConnectionPlugin;
+
+
+public class
+TizenConnectionExplorerPreferencePage
+extends FieldEditorPreferencePage 
+implements IWorkbenchPreferencePage
+{
+       public static final String KEY_PUSHPULL_TIMEOUT = "pushpull_timeout"; //$NON-NLS-1$
+       public static final int VALUE_PUSHPULL_TIMEOUT_DEFAULT = 5000;
+       
+    public TizenConnectionExplorerPreferencePage() {
+               setPreferenceStore( ConnectionPlugin.getDefault().getPreferenceStore() );
+               setDescription( PreferenceMessages.CONNECTION_EXPLORER_DESCRIPTION ); 
+    }
+
+    
+       @Override
+       public void init(IWorkbench workbench) {
+               // TODO Auto-generated method stub
+       }
+       
+       @Override
+       protected void createFieldEditors() {
+               Composite composite = getFieldEditorParent();
+               
+               GridLayout layout = new GridLayout();
+               layout.numColumns = 1;
+               layout.marginHeight = 0;
+               layout.marginWidth = 0;
+               composite.setLayout( layout );
+               GridData data = new GridData(GridData.FILL_BOTH);
+               data.verticalAlignment = GridData.FILL;
+               data.horizontalAlignment = GridData.FILL;
+               composite.setLayoutData( data );
+               createSpacer( composite, 1 );
+               createPushPullTimeoutPreferences( composite );
+       }
+       
+       protected void createSpacer( Composite composite, int columnSpan ) {
+               Label label = new Label( composite, SWT.NONE );
+               GridData gd = new GridData();
+               gd.horizontalSpan = columnSpan;
+               label.setLayoutData( gd );
+       }
+       
+       private void createPushPullTimeoutPreferences( Composite parent ) {
+        Composite comp = createGroup( parent, PreferenceMessages.CONNECTION_EXPLORER_GROUP_TIMEOUT, 1 );
+        Label desc = new Label(comp, SWT.NONE);
+        desc.setText(PreferenceMessages.CONNECTION_EXPLORER_TIMEOUT_DESCRIPTION);
+        Composite formatComposite = createCompositeEx( comp, 1, GridData.FILL_HORIZONTAL);
+        IntegerFieldEditor intField = new IntegerFieldEditor(KEY_PUSHPULL_TIMEOUT, PreferenceMessages.CONNECTION_EXPLORER_LABEL_TIMEOUT, formatComposite);
+        addField(intField);
+    }
+    
+    private Composite createCompositeEx(Composite parent, int numColumns, int layoutMode) {
+        Composite composite = new Composite(parent, SWT.NULL);
+        composite.setFont(parent.getFont());
+    
+        composite.setLayout(new GridLayout(numColumns, true));
+        composite.setLayoutData(new GridData(layoutMode));
+        return composite;
+    }
+    private Group createGroup(Composite parent, String label, int nColumns) {
+        Group group = new Group(parent, SWT.NONE);
+        group.setFont(parent.getFont());
+        group.setText(label);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = nColumns;
+        group.setLayout(layout);
+        group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        
+        return group;
+    }
+}
index dac88c1..c17cdc8 100644 (file)
Binary files a/org.tizen.common/lib/sdblib.jar and b/org.tizen.common/lib/sdblib.jar differ