Fixed some Prevent issues 68/10568/1
authorkh5325.kim <kh5325.kim@samsung.com>
Sat, 5 Oct 2013 04:39:00 +0000 (13:39 +0900)
committerkh5325.kim <kh5325.kim@samsung.com>
Sat, 5 Oct 2013 04:39:00 +0000 (13:39 +0900)
Change-Id: I0cc9f1ccdf6b8306851c58aa12813cb2680d3f28
Signed-off-by: kh5325.kim <kh5325.kim@samsung.com>
26 files changed:
org.tizen.common.connection/src/org/tizen/common/connection/ui/SyncProgressMonitor.java
org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileImageLoader.java
org.tizen.common.gom/src/org/tizen/common/gom/smartlaunch/handler/GomSmartLaunchCycleHandler.java
org.tizen.common.gom/src/org/tizen/common/gom/smartlaunch/ui/GomDialog.java
org.tizen.common.sdblib/src/org/tizen/sdblib/receiver/DlogReceiver.java
org.tizen.common.sign/src/org/tizen/common/sign/command/SignCommand.java
org.tizen.common.sign/src/org/tizen/common/sign/preferences/SigningPreferencePage.java
org.tizen.common.ui/src/org/tizen/common/ui/commandbar/CommandGroup.java
org.tizen.common.ui/src/org/tizen/common/ui/commandbar/CommandProvider.java
org.tizen.common.ui/src/org/tizen/common/ui/commandbar/TipDialog.java
org.tizen.common.ui/src/org/tizen/common/ui/commandbar/command/ProjectCommand.java
org.tizen.common.ui/src/org/tizen/common/ui/commandbar/command/ShowStatCommand.java
org.tizen.common.ui/src/org/tizen/common/ui/commandbar/command/launcher/HyperlinkPatternMatchLinstener.java
org.tizen.common.ui/src/org/tizen/common/ui/commandbar/command/launcher/TizenHandler.java
org.tizen.common.ui/src/org/tizen/common/ui/commandbar/recommendations/SubmitReaderWriter.java
org.tizen.common.ui/src/org/tizen/common/ui/commandbar/textAssist/TextAssist.java
org.tizen.common.ui/src/org/tizen/common/ui/wizards/TizenCommonPWComposite.java
org.tizen.common.ui/src/org/tizen/common/ui/wizards/TizenCommonWizard.java
org.tizen.common.ui/src/org/tizen/common/ui/wizards/TizenCommonWizardPage.java
org.tizen.common/src/org/tizen/common/AbstractTizenProject.java
org.tizen.common/src/org/tizen/common/CommonPlugin.java
org.tizen.common/src/org/tizen/common/core/application/TizenProjectDescription.java
org.tizen.common/src/org/tizen/common/core/command/zip/ZipCommand.java
org.tizen.common/src/org/tizen/common/rds/ui/preference/RdsPreferencePage.java
org.tizen.common/src/org/tizen/common/ui/dialog/DynamicDialog.java
org.tizen.common/src/org/tizen/common/util/HostUtil.java

index c8c11aa..8faa4ef 100644 (file)
@@ -53,7 +53,7 @@ public class SyncProgressMonitor implements ISyncProgressMonitor
 
     protected long worked;
 
-    protected int estimated;
+    //protected int estimated;
 
     protected int rate;
 
@@ -82,7 +82,7 @@ public class SyncProgressMonitor implements ISyncProgressMonitor
     {
         this.totalWork = totalWork;
         this.rate = 1;
-        this.estimated = 0;
+        //this.estimated = 0;
 
         while (totalWork > Integer.MAX_VALUE)
         {
@@ -131,18 +131,25 @@ public class SyncProgressMonitor implements ISyncProgressMonitor
         final String toStr;
         final String sizeStr;
 
-        String[] subTasks = name.split("\t");
-        if (name == null || subTasks.length != 2)
+        if (name == null)
         {
-            fromStr = subTasks[0];
-            toStr = "";
-            sizeStr = "";
+            fromStr = toStr = sizeStr = "";
         }
         else
         {
-            fromStr = labelFrom + subTasks[0];
-            toStr = labelTo + subTasks[1];
-            sizeStr = labelSize + String.format("( %s / %s )", getSizeAndUnit(getWorked()), getSizeAndUnit(getTotal()));
+            String[] subTasks = name.split("\t");
+            if (subTasks.length != 2)
+            {
+                fromStr = subTasks[0];
+                toStr = "";
+                sizeStr = "";
+            }
+            else
+            {
+                fromStr = labelFrom + subTasks[0];
+                toStr = labelTo + subTasks[1];
+                sizeStr = labelSize + String.format("( %s / %s )", getSizeAndUnit(getWorked()), getSizeAndUnit(getTotal()));
+            }
         }
 
         SWTUtil.asyncExec(new Runnable()
index 20e8ed8..3263de9 100644 (file)
@@ -35,6 +35,7 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Display;
+import org.tizen.common.util.IOUtil;
 
 public class TizenRemoteFileImageLoader {
 
@@ -129,11 +130,14 @@ public class TizenRemoteFileImageLoader {
         if (img == null) {
             String tmp = PATH + filename;
             InputStream imageStream = mClass.getResourceAsStream(tmp);
-
-            if (imageStream != null) {
-                img = new Image(display, imageStream);
-                mLoadedImages.put(filename, img);
-                return img;
+            try {
+                if (imageStream != null) {
+                    img = new Image(display, imageStream);
+                    mLoadedImages.put(filename, img);
+                    return img;
+                }
+            } finally {
+                IOUtil.tryClose(imageStream);
             }
         }
         return img;
index f6e6f7d..84469e3 100644 (file)
@@ -63,8 +63,8 @@ public class GomSmartLaunchCycleHandler extends CycleBaseHandler {
             GomMessages.SMARTLAUNCH_CYCLE_COLUMNS_4};
     private String[] sampleColumns = {"Profile", "ProjectProject", "LaunchConfigurationLaunchConfiguration", "emulator-xxxxx"};
     
-    private final String TIZEN_SMART_LAUNCH_UP_ID="org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.up";
-    private final String TIZEN_SMART_LAUNCH_DOWN_ID="org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.down";
+    private final static String TIZEN_SMART_LAUNCH_UP_ID="org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.up";
+    private final static String TIZEN_SMART_LAUNCH_DOWN_ID="org.tizen.common.gom.smartlaunch.ui.tizensmartlauncher.down";
 
     @Override
     protected void addItems(Table table, WorkbenchPage page) {
index ffd1310..78bc227 100644 (file)
@@ -49,15 +49,7 @@ import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.*;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.activities.WorkbenchActivityHelper;
 import org.tizen.common.ITizenNativeProject;
@@ -70,8 +62,8 @@ import org.tizen.common.util.StringUtil;
 
 public class GomDialog extends TitleAreaDialog{
     
-    private final int WIDTH = 500;
-    private final int HEIGHT = 500;
+    private final static int WIDTH = 500;
+    private final static int HEIGHT = 500;
     
     private Label lbBuild;
     private Button[] btnMode;
@@ -315,7 +307,7 @@ public class GomDialog extends TitleAreaDialog{
         {
             String config = configList.get(i);
             comboBuildConfiguration.add(configList.get(i));
-            if(defaultConfig.equals(config))
+            if(defaultConfig != null && defaultConfig.equals(config))
             {
                 setSelectionBuildConfiguration(i);
             }
index 7d5c5ee..d734452 100644 (file)
@@ -19,9 +19,10 @@ public class DlogReceiver extends MultiLineReceiver {
     @Override
     public void processNewLines(String[] lines) {
         DlogInfo[] infos = DlogUtil.getDlogInfos(dlogFormat, lines);
-
-        for (DlogInfo info : infos) {
-            dlogUtilLogs.add(info);
+        if (infos != null) {
+            for (DlogInfo info : infos) {
+                dlogUtilLogs.add(info);
+            }
         }
     }
 
index 684d647..bd66149 100755 (executable)
@@ -68,12 +68,13 @@ public class SignCommand extends FileHandlingCommand<Object> {
         
         if ( !handler.is( this.path, Attribute.EXISTS ) ) {
             final Policy policy = context.getPolicy( Policy.NONEXIST_IN_PROJECT );
-            final MessagePolicy messagePolicy = policy.adapt( MessagePolicy.class );
-            
-            if ( messagePolicy != null ) {
-                messagePolicy.print( context.getPrompter(), "{0} doesn't exist", this.path );
+            if ( policy != null ) {
+                final MessagePolicy messagePolicy = policy.adapt( MessagePolicy.class );
+                
+                if ( messagePolicy != null ) {
+                    messagePolicy.print( context.getPrompter(), "{0} doesn't exist", this.path );
+                }
             }
-            
             return ;
         }
         
index a9cbaf8..826d52e 100755 (executable)
@@ -109,7 +109,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
     
     protected List<Button> profileDependsButtons;
     
-    
     protected SigningProfileContainer container;
     
     
@@ -136,11 +135,9 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         // load profile
         this.container = SigningProfileUtil.getProfileContainerFromFile();
         
-        // create root composite
         Composite composite = createComposite(
                 parent, SWT.NONE, createGridLayout( 1 ), new GridData( GridData.FILL_BOTH ) );
         
-        // create child composites
         createProfilesControl( composite );
         createAuthorControl( composite );
         createDistributorControl( composite );
@@ -164,13 +161,11 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
     public void createControl(Composite parent) {
         super.createControl( parent );
         
-        // don't show a default button
         Button defaultButton = getDefaultsButton();
         if (defaultButton != null) {
             defaultButton.setVisible( false );
         }
         
-        // set help
         PlatformUI.getWorkbench().getHelpSystem().setHelp(
                 parent, TizenHelpContextIds.HELP_COMMON_CERTIFICATE_GENERTOR_CONTEXT );
     }
@@ -206,7 +201,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         Composite profileListComposite = createProfileListViewerControl( group );
         Composite profileButtonComposite = createProfilesButtonControl( group );
         
-        // add control listener
         group.addControlListener( new ControlListenerImpl(
                 group, profileListComposite, profileButtonComposite ) );
     }
@@ -221,7 +215,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         final Composite profileListComposite = createComposite(
                 parent, SWT.NONE, createGridLayout( 1, 0, 3 ), new GridData( GridData.FILL_BOTH ) );
         
-        // create ListViewer
         this.listViewer = new TableViewer( profileListComposite );
         this.listViewer.getTable().setLayoutData( new GridData( GridData.FILL_BOTH ) );
         this.listViewer.setContentProvider( new ListViewerContentProvider( container ) );
@@ -286,7 +279,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         SigningProfile activeProfile = this.container.getProfileByName( activeProfileName );
         this.container.setActiveProfile( activeProfile );
         
-        // TODO: ????
         this.listViewer.setInput( "profile" );
         
         if ( activeProfile != null ) {
@@ -358,8 +350,7 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
             public void widgetSelected(SelectionEvent e) {
                 // input a profile name from the dialog
                 InputValidator validator = new InputValidator( container );
-                InputDialog dialog = new InputDialog(
-                        Display.getDefault().getActiveShell(),
+                InputDialog dialog = new InputDialog( Display.getDefault().getActiveShell(),
                         UIMessages.getString( "org.tizen.common.sign.profilename" ),
                         UIMessages.getString( "org.tizen.common.sign.entername" ),
                         EMPTY_STRING,
@@ -409,8 +400,7 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
                     
                     // input a profile name from the dialog with an old profile name
                     InputValidator validator = new InputValidator( container, profileName );
-                    InputDialog dialog = new InputDialog(
-                            Display.getDefault().getActiveShell(),
+                    InputDialog dialog = new InputDialog( Display.getDefault().getActiveShell(),
                             UIMessages.getString("org.tizen.common.sign.profilename"),
                             UIMessages.getString("org.tizen.common.sign.entername"),
                             profileName, validator );
@@ -599,6 +589,8 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
             @Override
             public void widgetSelected(SelectionEvent e) {
                 SigningProfile profile = getSelectedProfile( listViewer.getSelection() );
+                if ( profile == null )
+                    return;
                 SigningProfileItem item = profile.getAuthorProfileItem();
                 
                 ProfileItemDialog dialog = new ProfileItemDialog( Display.getDefault().getActiveShell(), item );
@@ -673,8 +665,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
             @Override
             public String getColumnText(Object element, int columnIndex) {
                 if ( columnIndex == 0 ) {
-                    // item numbering
-                    
                     int i = 0;
                     Object e;
                     while ( ( e = distributorTableViewer.getElementAt( i++ ) ) != null ) {
@@ -742,27 +732,27 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
                 Shell activeShell = Display.getDefault().getActiveShell();
                 SigningProfileItem selectedItem = getSelectedProfileItem( distributorTableViewer.getSelection() );
                 if ( selectedItem == null ) {
-                    MessageDialog.openError(
-                            activeShell,
+                    MessageDialog.openError( activeShell,
                             "Certificate editor error",
                             "Not selected a distributor item for modification" );
                     return;
                 }
                 
                 SigningProfile profile = getSelectedProfile( listViewer.getSelection() );
-                SigningProfileItem item = profile.getProfileItem( profile.getOrdinal( selectedItem ) );
-                
-                ProfileItemDialog itemDialog = new ProfileItemDialog( activeShell, item );
-                int result = itemDialog.open();
-                if ( result == ProfileItemDialog.OK ) {
-                    item.setKeyLocation( itemDialog.getKeyPath() );
-                    item.setPassword( itemDialog.getPassword() );
-                    item.setCAPath( itemDialog.getCaPath() );
-                    item.setRootCAPath( itemDialog.getRootPath() );
-                    
-                    enableTableViewer( true, profile );
-                    
-                    validatePreferencePage();
+                if ( profile != null ) {
+                    SigningProfileItem item = profile.getProfileItem( profile.getOrdinal( selectedItem ) );
+                    ProfileItemDialog itemDialog = new ProfileItemDialog( activeShell, item );
+                    int result = itemDialog.open();
+                    if ( result == ProfileItemDialog.OK ) {
+                        item.setKeyLocation( itemDialog.getKeyPath() );
+                        item.setPassword( itemDialog.getPassword() );
+                        item.setCAPath( itemDialog.getCaPath() );
+                        item.setRootCAPath( itemDialog.getRootPath() );
+                        
+                        enableTableViewer( true, profile );
+                        
+                        validatePreferencePage();
+                    }
                 }
             }
             
@@ -783,16 +773,13 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         messageLayout.marginWidth = 0;
         messageLayout.marginHeight = 0;
         messageComposite.setLayout(messageLayout);
-        messageComposite.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL));
+        messageComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
         messageComposite.setFont(font);
 
         final Label noteLabel = new Label(messageComposite, SWT.BOLD);
         noteLabel.setText(title);
-        noteLabel.setFont(JFaceResources.getFontRegistry().getBold(
-                JFaceResources.DIALOG_FONT));
-        noteLabel
-                .setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+        noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
+        noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
 
         Link messageLabel = new Link(messageComposite, SWT.WRAP);
         messageLabel.setText(message);
@@ -918,8 +905,7 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         
         IRunnableWithProgress runnable = new IRunnableWithProgress() {
             @Override
-            public void run(IProgressMonitor monitor)
-                    throws InvocationTargetException, InterruptedException {
+            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                 monitor = ObjectUtil.nvl( monitor, new NullProgressMonitor() );
                 monitor.beginTask( "generate a certificate", IProgressMonitor.UNKNOWN );
                 
@@ -948,8 +934,7 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
             PlatformUI.getWorkbench().getProgressService().busyCursorWhile( runnable );
         } catch (InvocationTargetException e) {
             logger.error( e.getMessage(), e.getCause() );
-            ErrorDialog.openError(
-                    activeShell,
+            ErrorDialog.openError( activeShell,
                     "Certificate generation error",
                     "Failed to generate a certificate.",
                     new Status( IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e.getCause() ) );
@@ -965,11 +950,12 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         
         if ( bAutoFill ) {
             SigningProfile profile = getSelectedProfile( listViewer.getSelection() );
-            SigningProfileItem item = profile.getAuthorProfileItem();
-            
-            item.setKeyLocation( absolutePath );
-            item.setPassword( dialog.getValue( CertDataKey.Password ).toCharArray() );
-            
+            if ( profile != null ) {
+                SigningProfileItem item = profile.getAuthorProfileItem();
+                
+                item.setKeyLocation( absolutePath );
+                item.setPassword( dialog.getValue( CertDataKey.Password ).toCharArray() );
+            }
             enableTableViewer( true, profile );
             
             validatePreferencePage();
@@ -992,7 +978,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         Composite composite = new Composite( parent, SWT.NONE );
         composite.setLayout( layout );
         composite.setLayoutData( layoutData );
-        
         return composite;
     }
     
@@ -1000,7 +985,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         final TableColumn column = new TableColumn( parent, style, index );
         column.setText( text );
         column.pack();
-        
         return column;
     }
     
@@ -1011,7 +995,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
                 return (SigningProfile) firstElement;
             }
         }
-        
         return null;
     }
     
@@ -1022,7 +1005,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
                 return (SigningProfileItem) firstElement;
             }
         }
-        
         return null;
     }
     
@@ -1030,7 +1012,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
      * TextCellEditor for password processing
      */
     public class PasswordTextCellEditor extends TextCellEditor {
-        
         public PasswordTextCellEditor(Composite composite) {
             super(composite);
         }
@@ -1044,7 +1025,6 @@ public class SigningPreferencePage extends PreferencePage implements IWorkbenchP
         public int getStyle() {
             return super.getStyle() | SWT.PASSWORD;
         }
-        
     }
 }
 
@@ -1146,4 +1126,3 @@ class InputValidator implements IInputValidator {
         return null;
     }
 }
-
index 1956a99..68dd3d5 100644 (file)
@@ -49,4 +49,8 @@ public class CommandGroup {
     public Collection<Command> getCommands() {\r
         return commandMap.values();\r
     }\r
+\r
+    public String getKey() {\r
+        return key;\r
+    }\r
 }\r
index 8c2486e..ff6323b 100644 (file)
@@ -36,16 +36,12 @@ import java.util.regex.Pattern;
 \r
 import org.eclipse.core.resources.IProject;\r
 import org.eclipse.core.resources.ResourcesPlugin;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
 import org.tizen.common.ui.commandbar.assistant.AssistantBubble.*;\r
 import org.tizen.common.ui.commandbar.recommendations.*;\r
 import org.tizen.common.ui.commandbar.textAssist.TextAssistContentProvider;\r
 import org.tizen.common.util.ProjectUtil;\r
 \r
 public class CommandProvider extends TextAssistContentProvider implements OrderProcessor {\r
-    protected Logger logger = LoggerFactory.getLogger(getClass());\r
-\r
     Pattern PROJECT_COMMAND_PATTERN = Pattern.compile("(@[\\w]+)(\\s.*)*");\r
     Pattern SDB_COMMAND_PATTERN = Pattern.compile("(" + Commands.SDB_COMMAND + ")(\\s.*)*");\r
 \r
@@ -106,7 +102,8 @@ public class CommandProvider extends TextAssistContentProvider implements OrderP
             @Override\r
             public void onProjectCommand(String projectName, String arg) {\r
                 boolean hasArg = arg != null;\r
-                boolean projectExists = ProjectUtil.getProject(projectName).exists();\r
+                IProject project = ProjectUtil.getProject(projectName);\r
+                boolean projectExists = (project == null) ? false : project.exists();\r
                 if (!hasArg)\r
                     returnedList.addAll(getProjectList(projectName));\r
                 for (final String[] message : Commands.getInstance().getHelp(Commands.PROJECT_COMMAND, "projectExists", projectExists)) {\r
index 6009f59..b342edf 100644 (file)
@@ -31,7 +31,6 @@ package org.tizen.common.ui.commandbar;
 import org.eclipse.jface.layout.GridLayoutFactory;\r
 import org.eclipse.jface.window.Window;\r
 import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.browser.Browser;\r
 import org.eclipse.swt.events.SelectionAdapter;\r
 import org.eclipse.swt.events.SelectionEvent;\r
 import org.eclipse.swt.graphics.Point;\r
@@ -59,11 +58,11 @@ public class TipDialog extends Window {
     }\r
 \r
     protected Layout getLayout() {\r
-        return null;\r
+        return GridLayoutFactory.fillDefaults().create();\r
     }\r
 \r
     protected void configureShell(Shell newShell) {\r
-        newShell.setLayout(GridLayoutFactory.fillDefaults().create());\r
+        super.configureShell(newShell);\r
         shell = newShell;\r
         shell.setText(text);\r
     }\r
index 6a871b1..c52496a 100644 (file)
@@ -51,8 +51,6 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
 import org.eclipse.ui.internal.dialogs.PropertyDialog;
 import org.eclipse.ui.wizards.IWizardDescriptor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.tizen.common.core.command.ExecutionContext;
 import org.tizen.common.core.command.Executor;
 import org.tizen.common.ui.commandbar.IProjectCreator;
@@ -63,12 +61,8 @@ import org.tizen.common.util.ProjectUtil;
 import org.tizen.common.util.SWTUtil;
 
 public class ProjectCommand extends ConsoleCommand {
-    protected Logger logger = LoggerFactory.getLogger(getClass());
-
     ConsoleManager consoleManager = new ConsoleManager(CONSOLE_NAME, true);
 
-    String lineSeparator = System.getProperty("line.separator");
-
     void writeln(final String s) {
         /*
         new Thread(new Runnable() {
@@ -180,7 +174,8 @@ public class ProjectCommand extends ConsoleCommand {
         pda.run();
         */
         PropertyDialog dialog = PropertyDialog.createDialogOn(SWTUtil.getShell(), initialPageId, new StructuredSelection(new Object[] { project }));
-        dialog.open();
+        if (dialog != null)
+            dialog.open();
     }
 
     private void openWizardDialog(final String name) throws Exception {
@@ -204,7 +199,8 @@ public class ProjectCommand extends ConsoleCommand {
     }
 
     private void createProject(final String name, final String[] args) throws Exception {
-        if (ProjectUtil.getProject(name).exists()) {
+        IProject project = ProjectUtil.getProject(name);
+        if (project != null && project.exists()) {
             writeln(String.format("A project '%s' already exists.", name));
             return;
         }
index e01dce0..7d43b8a 100644 (file)
@@ -66,7 +66,7 @@ import org.tizen.common.util.StringUtil;
 public class ShowStatCommand extends AbstractCommand<Object> {
     DateFormat dfw = new SimpleDateFormat("yyyy-MM-dd");
 
-    final int MAX_ENTRIES = 5;
+    private final static int MAX_ENTRIES = 5;
     Ranker ranker = new Ranker();
 
     public void run(final Executor executor, final ExecutionContext context) throws Exception {
index 2004e32..3bac874 100644 (file)
@@ -74,11 +74,13 @@ public class HyperlinkPatternMatchLinstener implements IPatternMatchListener {
                 @Override\r
                 public void linkActivated() {\r
                     IRegion region = console.getRegion(this);\r
-                    try {\r
-                        String hyperlink = console.getDocument().get(region.getOffset(), region.getLength());\r
-                        OpenBrowserUtil.open(new URL(hyperlink), SWTUtil.getDisplay());\r
-                    } catch (Exception e) {\r
-                        logger.error("Failed to open the browser", e);\r
+                    if (region != null) {\r
+                        try {\r
+                            String hyperlink = console.getDocument().get(region.getOffset(), region.getLength());\r
+                            OpenBrowserUtil.open(new URL(hyperlink), SWTUtil.getDisplay());\r
+                        } catch (Exception e) {\r
+                            logger.error("Failed to open the browser", e);\r
+                        }\r
                     }\r
                 }\r
             }, event.getOffset(), event.getLength());\r
index ae5ae25..313d7f6 100644 (file)
@@ -37,7 +37,7 @@ import org.jsoup.helper.StringUtil;
 import org.jsoup.nodes.Document;\r
 \r
 public class TizenHandler implements Handler {\r
-    private final String HOST = "https://developer.tizen.org";\r
+    private final static String HOST = "https://developer.tizen.org";\r
 \r
     public boolean isQuestion(String link) {\r
         return true;\r
@@ -72,8 +72,8 @@ public class TizenHandler implements Handler {
         if (isForum(link)) {\r
             String post = doc.select(".field-item").get(0).text();\r
             String count = doc.select(".topic-post-count").get(0).text();\r
-            answer = String.format("%s (%s)\n" + // title & replies\r
-                " >%s\n" + // link\r
+            answer = String.format("%s (%s)%n" + // title & replies\r
+                " >%s%n" + // link\r
                 " >%s...", // Post (Max: 200 chars)\r
                 title, count, link, left(post, 200));\r
         } else {\r
@@ -92,9 +92,9 @@ public class TizenHandler implements Handler {
     }\r
 \r
     public String formatOutput(List<String> answers) {\r
-        return String.format("\n" +\r
-            "Answers\n" +\r
-            "-------\n" +\r
+        return String.format("%n" +\r
+            "Answers%n" +\r
+            "-------%n" +\r
             "%s", StringUtil.join(answers, "\n"));\r
     }\r
 }\r
index 18faa58..3ecdbef 100644 (file)
@@ -34,8 +34,6 @@ import java.io.Reader;
 import java.io.Writer;\r
 import java.util.ArrayList;\r
 import java.util.Collection;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
 \r
 import javax.xml.parsers.DocumentBuilder;\r
 import javax.xml.parsers.DocumentBuilderFactory;\r
@@ -192,13 +190,6 @@ public class SubmitReaderWriter {
             throw new SAXException("illegal_boolean_attribute"); //$NON-NLS-1$\r
     }\r
 \r
-    private String getStringValue(NamedNodeMap attributes, String name) throws SAXException {\r
-        String val = getStringValue(attributes, name, null);\r
-        if (val == null)\r
-            throw new SAXException("missing_attribute"); //$NON-NLS-1$\r
-        return val;\r
-    }\r
-\r
     private String getStringValue(NamedNodeMap attributes, String name, String defaultValue) {\r
         Node node = attributes.getNamedItem(name);\r
         return node == null ? defaultValue : node.getNodeValue();\r
index 2e42291..738894d 100644 (file)
@@ -57,7 +57,7 @@ public class TextAssist extends Composite {
     private TextAssistContentProvider contentProvider;\r
     private int numberOfLines = 20;\r
 \r
-    final int TEXT_MARGIN = 3;\r
+    final static int TEXT_MARGIN = 3;\r
     private Font HELP_COMMAND_FONT;\r
     private Color HELP_COMMAND_DESC_COLOR;\r
     private Color HELP_SEPARATOR_COLOR;\r
@@ -780,6 +780,7 @@ public class TextAssist extends Composite {
      */\r
     @Override\r
     public void setFont(final Font font) {\r
+        super.setFont(font);\r
         checkWidget();\r
         this.text.setFont(font);\r
         this.table.setFont(font);\r
index 75004da..77e9158 100644 (file)
@@ -79,7 +79,7 @@ public class TizenCommonPWComposite extends PWWidget {
     private int BROWSER_WIDTH = 418;\r
     private int ICON_WIDTH = 40;\r
     private int ICON_DEFAULT_SIZE = 32;\r
-    final int TEXT_MARGIN = 30;\r
+    final static int TEXT_MARGIN = 30;\r
 \r
     protected TizenCommonPWComposite(Category root, TizenCommonWizardPage page, String label, String propertyKey, int numberOfColumns, boolean singleWidget) {\r
         super(label, propertyKey, numberOfColumns, singleWidget);\r
index 543d17e..cfc0dd0 100644 (file)
@@ -77,8 +77,10 @@ public class TizenCommonWizard extends BasicNewResourceWizard implements IExecut
         if (platformInfo == null)
             throw new IllegalArgumentException("platformInfo can not be null");
         ITizenProject tizenPrj = ProjectUtil.getTizenProject(project);
-        TizenProjectDescription desc = new TizenProjectDescription(project);
-        desc.setPlatform(platformInfo);
-        tizenPrj.setDescription(desc);
+        if (tizenPrj != null) {
+            TizenProjectDescription desc = new TizenProjectDescription(project);
+            desc.setPlatform(platformInfo);
+            tizenPrj.setDescription(desc);
+        }
     }
 }
index 013cd97..37209c3 100644 (file)
@@ -61,7 +61,7 @@ import org.tizen.common.wizards.model.Template;
 public class TizenCommonWizardPage extends WizardNewProjectCreationPage {
     protected final Logger logger = LoggerFactory.getLogger(getClass());
 
-    private final String ROOT_NAME = "TEMPLATE-ROOT"; //$NON-NLS-1$
+    private final static String ROOT_NAME = "TEMPLATE-ROOT"; //$NON-NLS-1$
 
     private static Image imgBackground;
     private static Image imgTree, imgList;
index b4ffe37..40e62d0 100644 (file)
@@ -28,6 +28,7 @@ package org.tizen.common;
 
 import org.eclipse.core.resources.IProject;
 import org.tizen.common.core.application.InstallPathConfig;
+import org.tizen.common.core.application.ProfileInfo;
 import org.tizen.common.core.application.TizenProjectDescription;
 import org.tizen.common.core.application.tproject.TprojectHandler;
 
@@ -45,7 +46,9 @@ public abstract class AbstractTizenProject implements ITizenProject {
         else {
             if ( generate ) {
                 desc = new TizenProjectDescription(getProject());
-                desc.setPlatform(InstallPathConfig.getLatestProfileInfo());
+                ProfileInfo latestProfileInfo = InstallPathConfig.getLatestProfileInfo();
+                if (latestProfileInfo != null)
+                    desc.setPlatform(latestProfileInfo);
                 if ( setDescription(desc) ) {
                     return desc;
                 }
index eba2baa..6fc96a6 100755 (executable)
@@ -25,7 +25,7 @@
 */
 package org.tizen.common;
 
-import org.apache.log4j.spi.RepositorySelector;
+//import org.apache.log4j.spi.RepositorySelector;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionRegistry;
@@ -77,7 +77,7 @@ public class CommonPlugin extends AbstractUIPlugin {
      */
     protected Executor executor = null;
     
-    protected RepositorySelector selector = null;
+    //protected RepositorySelector selector = null;
     
     protected CrashReportService crService = null;
 
index 5101d0c..a5fee19 100644 (file)
@@ -70,26 +70,26 @@ public class TizenProjectDescription {
         ProfileInfo profileInfo = InstallPathConfig.getProfileInfo(profile);
         if ( profileInfo == null ) {
             return new ProfileInfo(profile, version, null);
+        } else {
+            String path = profileInfo.getPlatformPath(version);
+            return new ProfileInfo(profile, version, path);
         }
-        String path = profileInfo.getPlatformPath(version);
-
-        return new ProfileInfo(profile, version, path);
     }
-    
+
     /**
      * Returns the profile name associated with project.
      */
     public String getProfileName() {
         return InstallPathConfig.getProfile(platform);
     }
-    
+
     /**
      * Returns the profile version associated with project.
      */
     public String getVersion() {
         return InstallPathConfig.getVersion(platform);
     }
-    
+
     public String toString() {
         return "TizenProjectDescription [project: " + project + "platform: " + platform +"]";
     }
index 58f6fbd..6a40598 100755 (executable)
@@ -280,7 +280,15 @@ extends FileHandlingCommand<Object>
 
                 final ZipEntry entry = createEntry( relative );
                 zipOut.putNextEntry( entry );
-                IOUtil.redirect( handler.read( filePath ), zipOut );
+                InputStream fileIn = handler.read( filePath );
+                try
+                {
+                    IOUtil.redirect( fileIn, zipOut );
+                }
+                finally
+                {
+                    tryClose( fileIn );
+                }
                 zipOut.closeEntry();
                 logger.debug( "Zip {}", relative );
             }
index e0f3171..7c91c3c 100644 (file)
@@ -240,7 +240,9 @@ public class RdsPreferencePage extends PropertyAndPreferencePage implements IWor
         }
         if ( OPTION_ENABLE.equals(projectSpecificOption)) {
             try {
-                rdsOption = project.getPersistentProperty(RDS_PROPERTIES_RDS_OPTION_NAME);
+                if ( project != null ) {
+                    rdsOption = project.getPersistentProperty(RDS_PROPERTIES_RDS_OPTION_NAME);
+                }
             } catch (CoreException e) {
                 logger.error("Failed to read RDS option.", e);
             }
index 87af2d0..bf692b6 100644 (file)
@@ -25,6 +25,7 @@
 
 package org.tizen.common.ui.dialog;
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
@@ -77,16 +78,13 @@ public class DynamicDialog extends Dialog {
     protected Text errorMessageText;
     protected String errorMessage; 
     
-    // inputted fields
+    // input fields
     protected Collection<UserField> fields;
     
     // ID based controls for searching
     protected Map<String, Control> controlMap = new HashMap<String, Control>();
     
     
-    /////////////////////////////////////////////////////////////////
-    // Constructor
-    
     /**
      * Default constructor for dynamic generation
      * @param parent parent shell
@@ -113,11 +111,7 @@ public class DynamicDialog extends Dialog {
     public DynamicDialog(Collection<UserField> fields) {
         this( SWTUtil.getActiveShell(), fields );
     }
-    
-    
-    /////////////////////////////////////////////////////////////////
-    // Dialog logic
-    
+
     public String getTitle() {
         return title;
     }
@@ -433,10 +427,6 @@ public class DynamicDialog extends Dialog {
         return button;
     }
     
-    
-    /////////////////////////////////////////////////////////////////
-    // control creation utility
-    
     private Composite createComposite(Composite parent, Layout layout, Object layoutData) {
         Composite composite = new Composite( parent, getCompositeStyle() ) {
             @Override
@@ -447,8 +437,7 @@ public class DynamicDialog extends Dialog {
                     if ( controlMap.containsValue( children ) ) {
                         String controlId = getKeyByValue( controlMap, children );
                         UserField userField = getModel( fields, controlId );
-                        
-                        if ( !userField.canModify() ) {
+                        if ( userField == null || !userField.canModify() ) {
                             continue;
                         }
                     }
@@ -522,7 +511,7 @@ public class DynamicDialog extends Dialog {
         if ( defaultText instanceof char[] ) {
             text.setText( new String( (char[]) defaultText ) );
         } else if ( defaultText instanceof Character[] ) {
-            text.setText( ((Character[]) defaultText).toString() );
+            text.setText( Arrays.toString((Character[]) defaultText) );
         } else {
             text.setText( StringUtil.EMPTY_STRING );
         }
index 25f0d9e..352c689 100755 (executable)
@@ -169,8 +169,6 @@ public abstract class HostUtil{
             logger.info( "Exception occurred:", e );
             return false;
         }finally{
-            logger.debug( "Output Stream :{}", gb1.getResult() );
-            logger.debug( "Error Stream :{}", gb2.getResult() );
         } 
         return true;
     }