From b0b7fda001ac55f351558fb25239641eb172d0c1 Mon Sep 17 00:00:00 2001 From: "shingil.kang" Date: Fri, 24 May 2013 04:10:22 +0900 Subject: [PATCH] [Title] connection explorer refactoring #1 [Desc.] moved class and message files to related package. updated message class. changed connection explorer id. remove unused source [Issue] Change-Id: Ic02a5db6828017b92bb5a12c09d35708324322f8 --- org.tizen.common.connection/plugin.xml | 8 +- .../tizen/common/connection/ConnectionPlugin.java | 4 +- .../connection/ddmuilib/FileDialogMessages.java | 51 ++++ .../ddmuilib/FileDialogMessages.properties | 7 + .../connection/ddmuilib/FileDialogUtils.java | 14 +- .../{ui => explorer}/ConnectionExplorer.java | 308 +++++++++++++-------- .../ConnectionExplorerContentProvider.java | 2 +- .../explorer/ConnectionExplorerLabelProvider.java | 84 +++--- .../explorer/ConnectionExplorerPanel.java | 209 +++++++------- .../{ui => explorer}/ConnectionUIMessages.java | 6 +- .../ConnectionUIMessages.properties | 2 + .../tizen/common/connection/explorer/Messages.java | 55 ---- .../common/connection/explorer/messages.properties | 8 - 13 files changed, 422 insertions(+), 336 deletions(-) create mode 100755 org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogMessages.java create mode 100644 org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogMessages.properties rename org.tizen.common.connection/src/org/tizen/common/connection/{ui => explorer}/ConnectionExplorer.java (76%) rename org.tizen.common.connection/src/org/tizen/common/connection/{ui => explorer}/ConnectionUIMessages.java (96%) rename org.tizen.common.connection/src/org/tizen/common/connection/{ui => explorer}/ConnectionUIMessages.properties (97%) delete mode 100755 org.tizen.common.connection/src/org/tizen/common/connection/explorer/Messages.java delete mode 100644 org.tizen.common.connection/src/org/tizen/common/connection/explorer/messages.properties diff --git a/org.tizen.common.connection/plugin.xml b/org.tizen.common.connection/plugin.xml index a99d817..6810fbd 100644 --- a/org.tizen.common.connection/plugin.xml +++ b/org.tizen.common.connection/plugin.xml @@ -12,9 +12,9 @@ point="org.eclipse.ui.views"> @@ -70,10 +70,10 @@ ratio="1" relationship="bottom" relative="org.eclipse.ui.navigator.ProjectExplorer" - id="org.tizen.common.connection.ui.ConnectionExplorer"> + id="org.tizen.common.connection.explorer.ConnectionExplorer"> + id="org.tizen.common.connection.explorer.ConnectionExplorer"> diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ConnectionPlugin.java b/org.tizen.common.connection/src/org/tizen/common/connection/ConnectionPlugin.java index d73a8fe..e071c48 100755 --- a/org.tizen.common.connection/src/org/tizen/common/connection/ConnectionPlugin.java +++ b/org.tizen.common.connection/src/org/tizen/common/connection/ConnectionPlugin.java @@ -50,8 +50,8 @@ public class ConnectionPlugin extends AbstractUIPlugin { // The plug-in ID public static final String PLUGIN_ID = "org.tizen.common.connection"; //$NON-NLS-1$ - public static final String ID_LOGS_VIEW = "org.tizen.common.connection.ui.LogView"; //$NON-NLS-1$ - public static final String ID_CONNECTION_VIEW = "org.tizen.common.connection.ui.ConnectionExplorer"; + public static final String ID_LOGS_VIEW = "org.tizen.common.connection.log.LogView"; //$NON-NLS-1$ + public static final String ID_CONNECTION_VIEW = "org.tizen.common.connection.explorer.ConnectionExplorer"; // The shared instance private static ConnectionPlugin plugin; diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogMessages.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogMessages.java new file mode 100755 index 0000000..89d0e90 --- /dev/null +++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogMessages.java @@ -0,0 +1,51 @@ +/* + * Common + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Hoon Kang + * YoonKi Park + * + * 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.ddmuilib; + +import org.eclipse.osgi.util.NLS; + +public class FileDialogMessages extends NLS +{ + private static final String BUNDLE_NAME = FileDialogMessages.class.getPackage().getName() + ".FileDialogMessages"; + + public static String FileDialog_Message_Title; + public static String FileDialog_Overwrite_Message; + public static String FileDialog_Duplicate_Message; + public static String FileDialog_Delete_Message; + public static String FileDialog_TabName_Message; + public static String FileDialog_Update_Title; + public static String FileDialog_Update_Message; + + static + { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, FileDialogMessages.class); + } + + private FileDialogMessages() + { + } +} diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogMessages.properties b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogMessages.properties new file mode 100644 index 0000000..4fb7a63 --- /dev/null +++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogMessages.properties @@ -0,0 +1,7 @@ +FileDialog_Message_Title=Message +FileDialog_Overwrite_Message=The {0} file already exists. Do you want to overwrite it? +FileDialog_Duplicate_Message=Existing file +FileDialog_Delete_Message=Are you sure you want to delete the ''{0}'' file? +FileDialog_TabName_Message=The tab name already exists. Enter a different name. +FileDialog_Update_Title=Tizen SDK +FileDialog_Update_Message= Tizen SDK updates are available. Do you want to install them now? \ No newline at end of file diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogUtils.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogUtils.java index 1c2c41b..f64ed12 100644 --- a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogUtils.java +++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogUtils.java @@ -32,7 +32,7 @@ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.ui.PlatformUI; -import org.tizen.common.connection.explorer.Messages; +import org.tizen.common.connection.ddmuilib.FileDialogMessages; public class FileDialogUtils { @@ -43,7 +43,7 @@ public class FileDialogUtils public static int checkOverwrite(final String filename) { - String message = NLS.bind(Messages.getString("FileDialogUtils.overwrite.message"), filename); + String message = NLS.bind(FileDialogMessages.FileDialog_Overwrite_Message, filename); String[] labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}; int type = MessageDialog.QUESTION; @@ -52,7 +52,7 @@ public class FileDialogUtils public static int confirmDelete(final String filename) { - String message = NLS.bind(Messages.getString("FileDialogUtils.delete.message"), filename); + String message = NLS.bind(FileDialogMessages.FileDialog_Delete_Message, filename); String[] labels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; int type = MessageDialog.QUESTION; return openFileDialog(labels, message, type); @@ -60,7 +60,7 @@ public class FileDialogUtils public static int allowFileOverwrite(final String filename) { - String message = NLS.bind(Messages.getString("FileDialogUtils.overwrite.message"), filename); + String message = NLS.bind(FileDialogMessages.FileDialog_Overwrite_Message, filename); String[] labels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; int type = MessageDialog.QUESTION; return openFileDialog(labels, message, type); @@ -68,7 +68,7 @@ public class FileDialogUtils public static int checkTabName(final String filename) { - String message = NLS.bind(Messages.getString("FileDialogUtils.tabName.message"), filename); + String message = NLS.bind(FileDialogMessages.FileDialog_TabName_Message, filename); String[] labels = new String[] { IDialogConstants.OK_LABEL }; int type = MessageDialog.ERROR; return openFileDialog(labels, message, type); @@ -76,7 +76,7 @@ public class FileDialogUtils public static void notifyDuplication(final String filename) { - String message = NLS.bind(Messages.getString("FileDialogUtils.duplicate.message"), filename); + String message = NLS.bind(FileDialogMessages.FileDialog_Duplicate_Message, filename); String[] labels = new String[] { IDialogConstants.OK_LABEL }; int type = MessageDialog.ERROR; openFileDialog(labels, message, type); @@ -90,7 +90,7 @@ public class FileDialogUtils @Override public void run() { - String title = Messages.getString("FileDialogUtils.message.title"); + String title = FileDialogMessages.FileDialog_Message_Title; MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), title, null, message, type, labels, 0); dialog.open(); diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorer.java similarity index 76% rename from org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java rename to org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorer.java index 8fa6227..3cbde1a 100755 --- a/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java +++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorer.java @@ -23,7 +23,7 @@ * - S-Core Co., Ltd * */ -package org.tizen.common.connection.ui; +package org.tizen.common.connection.explorer; import java.io.File; import java.io.IOException; @@ -70,7 +70,8 @@ import org.tizen.sdblib.SmartDevelopmentBridge; import org.tizen.sdblib.receiver.MultiLineReceiver; import org.tizen.sdblib.service.FileEntry; -public class ConnectionExplorer extends ViewPart implements IPartListener2 { +public class ConnectionExplorer extends ViewPart implements IPartListener2 +{ private ConnectionExplorerPanel panel; private Composite parent; @@ -80,8 +81,10 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { private ToolItem pullToolItem; private ToolItem emulManagerToolItem; + private MenuManager menuMgr; private MenuManager subNewMenu; private MenuManager subLogMenu; + private Action actionAddFolder; private Action actionAddFile; private Action actionPush; @@ -92,33 +95,21 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { private Action actionDelete; private Action actionPlatformLogOn; private Action actionPlatformLogOff; - - private MenuManager menuMgr; - private static ConnectionExplorer explorer; public static String PLATFORMLOG_OFF = "0"; public static String PLATFORMLOG_ON = "1"; public static int PLATFORMLOG_UNABLE = 2; - - synchronized public static ConnectionExplorer gerDefault() { - if (explorer == null) { - explorer = new ConnectionExplorer(); - } - return explorer; - } - - synchronized public static void release() { - explorer = null; - } - + @Override - public void dispose() { + public void dispose() + { IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow(); workbenchWindow.getPartService().removePartListener(this); } @Override - public void createPartControl(Composite p) { + public void createPartControl(Composite p) + { IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow(); workbenchWindow.getPartService().addPartListener(this); @@ -153,135 +144,169 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { panel.setToolItems(pushToolItem, pullToolItem, emulManagerToolItem); - panel.setActions(subNewMenu, actionPush, actionPull, actionRefresh, actionRename, actionProperty, actionDelete, - subLogMenu); + panel.setActions(subNewMenu, actionPush, actionPull, actionRefresh, actionRename, actionProperty, actionDelete, subLogMenu); } - private void createFileExplorerView(Composite parent) { + private void createFileExplorerView(Composite parent) + { // device explorer panel = new ConnectionExplorerPanel(); panel.createPanel(parent); - panel.getTreeViewer().getTree().addKeyListener(new KeyAdapter() { + panel.getTreeViewer().getTree().addKeyListener(new KeyAdapter() + { @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(KeyEvent e) + { handleKeyPressed(e); } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(KeyEvent e) + { } }); } - private void handleKeyPressed(KeyEvent event) { + private void handleKeyPressed(KeyEvent event) + { Tree tree = (Tree) event.widget; int length = tree.getSelectionCount(); - if (event.keyCode == SWT.F5) { - if (length == 1) { + if (event.keyCode == SWT.F5) + { + if (length == 1) + { actionRefresh(); } - } else if (event.keyCode == SWT.F2) { - if (length == 1) { + } + else if (event.keyCode == SWT.F2) + { + if (length == 1) + { actionRename(); } - } else if (event.keyCode == SWT.DEL) { + } + else if (event.keyCode == SWT.DEL) + { actionDelete(); } - if ((event.stateMask == SWT.ALT) && (event.keyCode == SWT.CR)) { + if ((event.stateMask == SWT.ALT) && (event.keyCode == SWT.CR)) + { actionShowProperty(); } } - private void actionAddFile() { + private void actionAddFile() + { panel.addNewFileSelection(); } - private void actionAddFolder() { + private void actionAddFolder() + { panel.addNewFolderSelection(); } - private void actionPush() { + private void actionPush() + { panel.pushIntoSelection(); } - private void actionPull() { + private void actionPull() + { panel.pullSelection(); } - private void actionRefresh() { + private void actionRefresh() + { panel.refreshSelection(); } - private void actionDelete() { + private void actionDelete() + { panel.deleteSelection(); } - private void actionRename() { + private void actionRename() + { panel.renameSelection(); } - private void actionShowProperty() { + private void actionShowProperty() + { panel.showPropertySelection(getSite()); } - private void actionSetPlatformLog(boolean setON) { + private void actionSetPlatformLog(boolean setON) + { panel.setPlatformLogOnOff(setON); } /* * make actions */ - private void makeActions() { + private void makeActions() + { subNewMenu = new MenuManager(ConnectionUIMessages.Explorer_ConetextMenu_New, null); - actionAddFile = new Action() { + actionAddFile = new Action() + { @Override - public void run() { + public void run() + { actionAddFile(); } }; actionAddFile.setText(ConnectionUIMessages.Explorer_ConetextMenu_File); - actionAddFolder = new Action() { + actionAddFolder = new Action() + { @Override - public void run() { + public void run() + { actionAddFolder(); } }; actionAddFolder.setText(ConnectionUIMessages.Explorer_ConetextMenu_Folder); - actionPush = new Action() { + actionPush = new Action() + { @Override - public void run() { + public void run() + { actionPush(); } }; actionPush.setText(ConnectionUIMessages.Explorer_ConetextMenu_Push); - actionPull = new Action() { + actionPull = new Action() + { @Override - public void run() { + public void run() + { actionPull(); } }; actionPull.setText(ConnectionUIMessages.Explorer_ConetextMenu_Pull); // Add refresh action - actionRefresh = new Action() { + actionRefresh = new Action() + { @Override - public void run() { + public void run() + { actionRefresh(); } }; actionRefresh.setText(ConnectionUIMessages.Explorer_ConetextMenu_Refresh); actionRefresh.setActionDefinitionId("org.tizen.common.connection.refresh"); - actionRename = new Action() { + actionRename = new Action() + { @Override - public void run() { + public void run() + { actionRename(); } }; @@ -289,18 +314,22 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { actionRename.setText(ConnectionUIMessages.Explorer_ConetextMenu_Rename); actionRename.setActionDefinitionId("org.tizen.common.connection.rename"); - actionDelete = new Action() { + actionDelete = new Action() + { @Override - public void run() { + public void run() + { actionDelete(); } }; actionDelete.setText(ConnectionUIMessages.Explorer_ConetextMenu_Delete); actionDelete.setActionDefinitionId("org.tizen.common.connection.delete"); - actionProperty = new Action() { + actionProperty = new Action() + { @Override - public void run() { + public void run() + { panel.showPropertySelection(getSite()); } }; @@ -309,30 +338,37 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { subLogMenu = new MenuManager(ConnectionUIMessages.Explorer_ConetextMenu_Log, null); - actionPlatformLogOn = new Action() { + actionPlatformLogOn = new Action() + { @Override - public void run() { + public void run() + { actionSetPlatformLog(true); } }; actionPlatformLogOn.setText(ConnectionUIMessages.Explorer_ConetextMenu_Log_On); - actionPlatformLogOff = new Action() { + actionPlatformLogOff = new Action() + { @Override - public void run() { + public void run() + { actionSetPlatformLog(false); } }; actionPlatformLogOff.setText(ConnectionUIMessages.Explorer_ConetextMenu_Log_Off); } - private void initContextMenu() { + private void initContextMenu() + { // initialize the context menu menuMgr = new MenuManager("Connection Explorer MenuMgr"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); - menuMgr.addMenuListener(new IMenuListener() { + menuMgr.addMenuListener(new IMenuListener() + { @Override - public void menuAboutToShow(IMenuManager manager) { + public void menuAboutToShow(IMenuManager manager) + { fillContextMenu(manager); } }); @@ -341,14 +377,19 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { panel.getTreeViewer().getTree().setMenu(menu); getSite().registerContextMenu(menuMgr, panel.getTreeViewer()); - menuMgr.addMenuListener(new IMenuListener() { + menuMgr.addMenuListener(new IMenuListener() + { @Override - public void menuAboutToShow(IMenuManager manager) { + public void menuAboutToShow(IMenuManager manager) + { // Remove team menu from our menu IContributionItem[] items = manager.getItems(); - if (items != null) { - for (IContributionItem item : items) { - if (("team.main").equals(item.getId())) { + if (items != null) + { + for (IContributionItem item : items) + { + if (("team.main").equals(item.getId())) + { manager.remove(item); break; } @@ -358,7 +399,8 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { }); } - private void activateContext() { + private void activateContext() + { IContextService contextService = (IContextService) getSite().getService(IContextService.class); contextService.activateContext("org.tizen.common.connection.delete.context"); contextService.activateContext("org.tizen.common.connection.rename.context"); @@ -367,7 +409,8 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { } - private void fillContextMenu(IMenuManager manager) { + private void fillContextMenu(IMenuManager manager) + { subNewMenu.add(actionAddFile); subNewMenu.add(actionAddFolder); manager.add(subNewMenu); @@ -388,49 +431,63 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { int resPlatform = isPlatformLogOn(); - if(resPlatform == Integer.parseInt(PLATFORMLOG_ON)) { + if (resPlatform == Integer.parseInt(PLATFORMLOG_ON)) + { actionPlatformLogOn.setChecked(true); actionPlatformLogOff.setChecked(false); - } else if(resPlatform == Integer.parseInt(PLATFORMLOG_OFF)) { + } + else if (resPlatform == Integer.parseInt(PLATFORMLOG_OFF)) + { actionPlatformLogOn.setChecked(false); actionPlatformLogOff.setChecked(true); - } else { + } + else + { actionPlatformLogOn.setChecked(false); actionPlatformLogOff.setChecked(false); } } - private int isPlatformLogOn() { + private int isPlatformLogOn() + { TreeItem[] items = panel.getTreeViewer().getTree().getSelection(); FileEntry file = (FileEntry) items[0].getData(); IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices(); final AtomicInteger result = new AtomicInteger(PLATFORMLOG_UNABLE); - for (IDevice device : devices) { - if (file.getName().equals(device.getDeviceName())) { + for (IDevice device : devices) + { + if (file.getName().equals(device.getDeviceName())) + { String command = "dlogctrl get platformlog"; - try { - device.executeShellCommand(command, new MultiLineReceiver() { + try + { + device.executeShellCommand(command, new MultiLineReceiver() + { @Override - public void processNewLines(String[] lines) { - for(String line: lines) + public void processNewLines(String[] lines) + { + for (String line : lines) { - if (PLATFORMLOG_ON.equals(line) || PLATFORMLOG_OFF.equals(line)) { + if (PLATFORMLOG_ON.equals(line) || PLATFORMLOG_OFF.equals(line)) + { result.set(Integer.parseInt(line)); - if (!subLogMenu.isVisible()) { + if (!subLogMenu.isVisible()) + { subLogMenu.setVisible(true); } break; } } - if(result.get() == PLATFORMLOG_UNABLE) + if (result.get() == PLATFORMLOG_UNABLE) { Logger.error("Fail to get platform log: " + lines[0]); } } }); - } catch (IOException e) { + } catch (IOException e) + { Logger.error("Fail to get platform log", e.getMessage()); } } @@ -438,7 +495,8 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { return result.get(); } - private void createToolBar(Composite shell, Object layoutData) { + private void createToolBar(Composite shell, Object layoutData) + { toolBar = new ToolBar(shell, SWT.NULL); toolBar.setLayoutData(layoutData); @@ -447,12 +505,16 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { emulManagerToolItem = new ToolItem(toolBar, SWT.PUSH); emulManagerToolItem.setImage(ConnectionPlugin.getImageDescriptorFromPlugin("icons/emulator_manager.gif").createImage()); emulManagerToolItem.setToolTipText(ConnectionUIMessages.Explorer_Tooltip_EmulatorManager); - emulManagerToolItem.addSelectionListener(new SelectionAdapter() { + emulManagerToolItem.addSelectionListener(new SelectionAdapter() + { @Override - public void widgetSelected(SelectionEvent e) { - try { + public void widgetSelected(SelectionEvent e) + { + try + { startEmulatorManager(); - } catch (Exception e1) { + } catch (Exception e1) + { Logger.error("Fail to start Emulator Manager", e1.getMessage()); } } @@ -464,9 +526,11 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { pushToolItem = new ToolItem(toolBar, SWT.PUSH); pushToolItem.setImage(ConnectionPlugin.getImageDescriptorFromPlugin("icons/push.gif").createImage()); pushToolItem.setToolTipText(ConnectionUIMessages.Explorer_Tooltip_Push); - pushToolItem.addSelectionListener(new SelectionAdapter() { + pushToolItem.addSelectionListener(new SelectionAdapter() + { @Override - public void widgetSelected(SelectionEvent e) { + public void widgetSelected(SelectionEvent e) + { panel.pushIntoSelection(); } }); @@ -477,9 +541,11 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { pullToolItem = new ToolItem(toolBar, SWT.PUSH); pullToolItem.setImage(ConnectionPlugin.getImageDescriptorFromPlugin("icons/pull.gif").createImage()); pullToolItem.setToolTipText(ConnectionUIMessages.Explorer_Tooltip_Pull); - pullToolItem.addSelectionListener(new SelectionAdapter() { + pullToolItem.addSelectionListener(new SelectionAdapter() + { @Override - public void widgetSelected(SelectionEvent e) { + public void widgetSelected(SelectionEvent e) + { panel.pullSelection(); } }); @@ -488,49 +554,60 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { } @Override - public void setFocus() { - if (parent != null) { + public void setFocus() + { + if (parent != null) + { parent.setFocus(); } } - public static void startEmulatorManager() throws Exception { + public static void startEmulatorManager() throws Exception + { int osType = ConnectionPlugin.getDefault().os; int linuxType = ConnectionPlugin.LINUX; - String exePath = ConnectionPlugin.getDefault().getPreferenceStore() - .getString(TizenConnectionExplorerPreferencePage.KEY_EMULATOR_MANAGER_PATH); - if (exePath.equals("") || (!exePath.equals("") && !HostUtil.exists(exePath))) { + String exePath = ConnectionPlugin.getDefault().getPreferenceStore().getString(TizenConnectionExplorerPreferencePage.KEY_EMULATOR_MANAGER_PATH); + if (exePath.equals("") || (!exePath.equals("") && !HostUtil.exists(exePath))) + { throw new Exception(ConnectionUIMessages.Explorer_Message_EmulatorError); } // FIXME : should implement the lines below based on windows system. String command = exePath; - if (osType == linuxType) { + if (osType == linuxType) + { command = command + " 1>/dev/null 2>/dev/null &"; HostUtil.execute(command); - } else { + } + else + { HostUtil.batchExecute(command, null, new File(InstallPathConfig.getEmulatorPath())); } } @Override - public void partActivated(IWorkbenchPartReference partRef) { + public void partActivated(IWorkbenchPartReference partRef) + { } @Override - public void partBroughtToTop(IWorkbenchPartReference partRef) { + public void partBroughtToTop(IWorkbenchPartReference partRef) + { } @Override - public void partClosed(IWorkbenchPartReference partRef) { - if (ConnectionPlugin.ID_CONNECTION_VIEW.equals(partRef.getId())) { + public void partClosed(IWorkbenchPartReference partRef) + { + if (ConnectionPlugin.ID_CONNECTION_VIEW.equals(partRef.getId())) + { ConnectionPlugin.getDefault().setCurrentDevice(null); SWTUtil.syncExec(new Runnable() { @Override - public void run() { + public void run() + { NotifierDialog.notify(ConnectionUIMessages.Explorer_Closed_Title, ConnectionUIMessages.Explorer_Closed_Message, NotificationType.WARN); } }); @@ -538,22 +615,27 @@ public class ConnectionExplorer extends ViewPart implements IPartListener2 { } @Override - public void partDeactivated(IWorkbenchPartReference partRef) { + public void partDeactivated(IWorkbenchPartReference partRef) + { } @Override - public void partOpened(IWorkbenchPartReference partRef) { + public void partOpened(IWorkbenchPartReference partRef) + { } @Override - public void partHidden(IWorkbenchPartReference partRef) { + public void partHidden(IWorkbenchPartReference partRef) + { } @Override - public void partVisible(IWorkbenchPartReference partRef) { + public void partVisible(IWorkbenchPartReference partRef) + { } @Override - public void partInputChanged(IWorkbenchPartReference partRef) { + public void partInputChanged(IWorkbenchPartReference partRef) + { } } \ No newline at end of file diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerContentProvider.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerContentProvider.java index c16e971..bda4fbc 100755 --- a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerContentProvider.java +++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerContentProvider.java @@ -109,7 +109,7 @@ public class ConnectionExplorerContentProvider implements ITreeContentProvider if (arg0 instanceof FileEntry) { FileEntry entry = (FileEntry) arg0; - return PARENT_TYPES.contains( entry.getType() ); + return PARENT_TYPES.contains(entry.getType()); } return false; } diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerLabelProvider.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerLabelProvider.java index fc1c8d6..3ec350e 100755 --- a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerLabelProvider.java +++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerLabelProvider.java @@ -58,17 +58,12 @@ public class ConnectionExplorerLabelProvider implements ITableLabelProvider { fileImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/file.gif").createImage(); - folderImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/directory.gif") - .createImage(); - fileLinkImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/file_link.gif") - .createImage(); - folderLinkImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/directory_link.gif") - .createImage(); + folderImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/directory.gif").createImage(); + fileLinkImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/file_link.gif").createImage(); + folderLinkImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/directory_link.gif").createImage(); otherImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/file.gif").createImage(); - emulatorImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/emulator.gif") - .createImage(); - deviceImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/device.gif") - .createImage(); + emulatorImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/emulator.gif").createImage(); + deviceImage = ConnectionPlugin.getImageDescriptorFromPlugin("icons/device.gif").createImage(); } @Override @@ -79,22 +74,21 @@ public class ConnectionExplorerLabelProvider implements ITableLabelProvider if (element instanceof FileEntry) { FileEntry entry = (FileEntry) element; - switch (entry.getType()) - { - case TYPE_FILE: - return fileImage; - case TYPE_LINK: - return fileLinkImage; - case TYPE_DIRECTORY: - return folderImage; - case TYPE_DIRECTORY_LINK: - return folderLinkImage; - case TYPE_ROOT_EMULATOR: - return emulatorImage; - case TYPE_ROOT_DEVICE: - return deviceImage; - default: - return otherImage; + switch (entry.getType()) { + case TYPE_FILE: + return fileImage; + case TYPE_LINK: + return fileLinkImage; + case TYPE_DIRECTORY: + return folderImage; + case TYPE_DIRECTORY_LINK: + return folderLinkImage; + case TYPE_ROOT_EMULATOR: + return emulatorImage; + case TYPE_ROOT_DEVICE: + return deviceImage; + default: + return otherImage; } } } @@ -108,20 +102,21 @@ public class ConnectionExplorerLabelProvider implements ITableLabelProvider { FileEntry entry = (FileEntry) element; - switch (columnIndex) - { - case 0: - if (entry.isRoot()) - { - return getDeviceSerialWithName(entry); - } else - { - return entry.getName(); - } - default: - return null; + switch (columnIndex) { + case 0: + if (entry.isRoot()) + { + return getDeviceSerialWithName(entry); + } + else + { + return entry.getName(); + } + default: + return null; } - } else if (element instanceof IDevice) + } + else if (element instanceof IDevice) { IDevice device = (IDevice) element; return device.getDeviceName(); @@ -131,13 +126,13 @@ public class ConnectionExplorerLabelProvider implements ITableLabelProvider @Override public void addListener(ILabelProviderListener listener) - {} + { + } @Override public void dispose() { - SWTUtil.tryDispose(fileImage, folderImage, fileLinkImage, folderLinkImage, otherImage, - emulatorImage, deviceImage); + SWTUtil.tryDispose(fileImage, folderImage, fileLinkImage, folderLinkImage, otherImage, emulatorImage, deviceImage); } @Override @@ -148,7 +143,8 @@ public class ConnectionExplorerLabelProvider implements ITableLabelProvider @Override public void removeListener(ILabelProviderListener listener) - {} + { + } public static String getDeviceSerialWithName(IDevice device) { @@ -159,7 +155,7 @@ public class ConnectionExplorerLabelProvider implements ITableLabelProvider { return combineSerialWithName(entry.getFileListingService().getDevice().getSerialNumber(), entry.getName()); } - + private static String combineSerialWithName(String serial, String name) { return String.format("%s (%s)", serial, name); diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerPanel.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerPanel.java index f48cc3e..e8a4455 100755 --- a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerPanel.java +++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerPanel.java @@ -80,10 +80,11 @@ import org.tizen.common.connection.ddmuilib.FileDialogUtils; import org.tizen.common.connection.ddmuilib.Panel; import org.tizen.common.connection.ddmuilib.SyncProgressMonitor; import org.tizen.common.connection.ddmuilib.TableHelper; +import org.tizen.common.connection.ddmuilib.FileDialogMessages; import org.tizen.common.connection.debugtools.OnDemandInstall; import org.tizen.common.connection.preference.TizenConnectionExplorerPreferencePage; import org.tizen.common.connection.sdblib.dnd.FileEntryTransfer; -import org.tizen.common.connection.ui.ConnectionUIMessages; +import org.tizen.common.connection.explorer.ConnectionUIMessages; import org.tizen.common.ui.dialog.TransferProgressMonitorDialog; import org.tizen.common.ui.view.console.AnsicodeAdapter; import org.tizen.common.ui.view.console.ConsoleManager; @@ -110,11 +111,11 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe private Composite parent; private TreeViewer treeViewer; private ConnectionExplorerContentProvider contentProvider; - + private boolean bSubLog = false; private final int STATE_PROPERTY = 0x0000001; private final int STATE_DELETE = 0x0000010; - private final int STATE_RENAME = 0x0000100; + private final int STATE_RENAME = 0x0000100; private final int STATE_REFRESH = 0x0001000; private final int STATE_PULL = 0x0010000; private final int STATE_PUSH = 0x0100000; @@ -122,7 +123,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe private ToolItem pushToolItem; private ToolItem pullToolItem; -// private ToolItem emulStartToolItem; + // private ToolItem emulStartToolItem; private MenuManager subNewMenu; private Action actionPush; @@ -160,7 +161,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe Tree tree = treeViewer.getTree(); IPreferenceStore store = DdmUiPreferences.getStore(); - TableHelper.createTreeColumn(tree, Messages.getString("ConnectionExplorer.tree.header"), SWT.LEFT, "abcdefghijklmnopqrstuvwzabcdefghijk", COLUMN_NAME, store); //$NON-NLS-1$ + TableHelper.createTreeColumn(tree, ConnectionUIMessages.Explorer_Tree_Header, SWT.LEFT, "abcdefghijklmnopqrstuvwzabcdefghijk", COLUMN_NAME, store); //$NON-NLS-1$ tree.setHeaderVisible(true); contentProvider = new ConnectionExplorerContentProvider(); @@ -172,69 +173,70 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe @Override public void widgetSelected(SelectionEvent e) { - // set device for selected FileEntry when select FileEntry on tree + // set device for selected FileEntry when select FileEntry on + // tree notifyListeners(); } }); // setup drag listener - treeViewer.addDragSupport(DND.DROP_MOVE | DND.DROP_COPY, new Transfer[] { PluginTransfer.getInstance(), FileEntryTransfer.getInstance() }, - new DragSourceListener() - { + treeViewer.addDragSupport(DND.DROP_MOVE | DND.DROP_COPY, new Transfer[] { PluginTransfer.getInstance(), FileEntryTransfer.getInstance() }, new DragSourceListener() + { - @Override - public void dragStart(DragSourceEvent e) - { + @Override + public void dragStart(DragSourceEvent e) + { - TreeItem[] items = treeViewer.getTree().getSelection(); + TreeItem[] items = treeViewer.getTree().getSelection(); - for (int i = 0; i < items.length; i++) + for (int i = 0; i < items.length; i++) + { + Object data = items[i].getData(); + if (data instanceof FileEntry) + { + if (((FileEntry) data).isDirectory() == true || ((FileEntry) data).isRoot() == true) { - Object data = items[i].getData(); - if (data instanceof FileEntry) - { - if (((FileEntry) data).isDirectory() == true || ((FileEntry) data).isRoot() == true) - { - e.doit = false; - return; - } - } + e.doit = false; + return; } - e.doit = true; } + } + e.doit = true; + } - @Override - public void dragFinished(DragSourceEvent arg0) - { - - } + @Override + public void dragFinished(DragSourceEvent arg0) + { - @Override - public void dragSetData(DragSourceEvent e) - { - // get the selection - TreeItem[] items = treeViewer.getTree().getSelection(); - FileEntry[] entries = new FileEntry[items.length]; + } - for (int i = 0; i < items.length; i++) - { - Object data = items[i].getData(); - if (data instanceof FileEntry) - { - entries[i] = ((FileEntry) data); - } - } + @Override + public void dragSetData(DragSourceEvent e) + { + // get the selection + TreeItem[] items = treeViewer.getTree().getSelection(); + FileEntry[] entries = new FileEntry[items.length]; - if (FileEntryTransfer.getInstance().isSupportedType(e.dataType)) - { - e.data = entries; - } else if (PluginTransfer.getInstance().isSupportedType(e.dataType)) - { - byte[] data = FileEntryTransfer.getInstance().toByteArray(entries); - e.data = new PluginTransferData(DRAGACTIONID, data); - } + for (int i = 0; i < items.length; i++) + { + Object data = items[i].getData(); + if (data instanceof FileEntry) + { + entries[i] = ((FileEntry) data); } - }); + } + + if (FileEntryTransfer.getInstance().isSupportedType(e.dataType)) + { + e.data = entries; + } + else if (PluginTransfer.getInstance().isSupportedType(e.dataType)) + { + byte[] data = FileEntryTransfer.getInstance().toByteArray(entries); + e.data = new PluginTransferData(DRAGACTIONID, data); + } + } + }); // setup drop listener treeViewer.addDropSupport(DND.DROP_COPY | DND.DROP_MOVE, new Transfer[] { FileTransfer.getInstance() }, new ViewerDropAdapter(treeViewer) @@ -307,11 +309,10 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe { pushToolItem = push; pullToolItem = pull; -// emulStartToolItem = start; + // emulStartToolItem = start; } - public void setActions(MenuManager pSubMenu, Action pActionPush, Action pActionPull, Action pActionRefresh, Action pActionRename, Action pActionProperty, - Action pActionDelete, MenuManager pSubLogMenu) + public void setActions(MenuManager pSubMenu, Action pActionPush, Action pActionPull, Action pActionRefresh, Action pActionRename, Action pActionProperty, Action pActionDelete, MenuManager pSubLogMenu) { subNewMenu = pSubMenu; actionPush = pActionPush; @@ -376,7 +377,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe FileEntry entry = getSingleFileEntry(); FileDialog dlg = new FileDialog(parent.getShell(), SWT.OPEN); - + setDialog(dlg, "Push the Files"); String[] fileName = new String[1]; @@ -391,7 +392,8 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe if (entry.isDirectory() || entry.isRoot()) { refreshFileEntry = entry; - } else + } + else { refreshFileEntry = entry.getParent(); } @@ -425,7 +427,8 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe FileDialog dlg = (FileDialog) dialog; dlg.setFilterPath(defaultPath); defaultSave = dlg.getFilterPath(); - } else if (dialog instanceof DirectoryDialog) + } + else if (dialog instanceof DirectoryDialog) { DirectoryDialog dlg = (DirectoryDialog) dialog; dlg.setFilterPath(defaultPath); @@ -628,7 +631,8 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe if (entry.isDirectory()) { command = String.format("rm -rf %s; echo $?", FilenameUtil.addDoubleQuote(entry.getFullEscapedPath())); - } else + } + else { command = String.format("rm -f %s; echo $?", FilenameUtil.addDoubleQuote(entry.getFullEscapedPath())); } @@ -651,8 +655,8 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe throw new RuntimeException(e); } - refresh(entry.getParent()); - setActionEnabled(); + refresh(entry.getParent()); + setActionEnabled(); } } } @@ -664,7 +668,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe } }); } - + public void showPropertySelection(final IWorkbenchPartSite site) { doActionForEntry(new IActionForEntry() @@ -683,7 +687,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe } }); } - + public void setPlatformLogOnOff(boolean On) { String command = String.format("dlogctrl set platformlog %s; echo $?", On ? "1" : "0"); @@ -708,7 +712,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe sb.append(line); } Status status = new Status(IStatus.ERROR, id, 0, sb.toString(), null); - ErrorDialog.openError(Display.getCurrent().getActiveShell(), Messages.getString("FileDialogUtils.message.title"), message, status); + ErrorDialog.openError(Display.getCurrent().getActiveShell(), FileDialogMessages.FileDialog_Message_Title, message, status); } } @@ -737,7 +741,8 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe { // set up the data source. treeViewer.setInput(bridge); - } else + } + else { // tree is disposed, we need to do something. // lets remove ourselves from the listener. @@ -799,12 +804,10 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe Object data = item.getData(); if (data instanceof FileEntry) { - FileEntry entry = (FileEntry)data; + FileEntry entry = (FileEntry) data; if (!FilenameUtil.isVaildName(entry.getName())) { - DialogUtil.openErrorDialog(entry.getName() + "\n" + - ConnectionUIMessages.Explorer_Message_Invalid_Character - + FilenameUtil.getInvalidCharacters()); + DialogUtil.openErrorDialog(entry.getName() + "\n" + ConnectionUIMessages.Explorer_Message_Invalid_Character + FilenameUtil.getInvalidCharacters()); continue; } entries.add((FileEntry) data); @@ -814,7 +817,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe // get a progress dialog final TransferProgressMonitorDialog tmd = new TransferProgressMonitorDialog(parent.getShell()); - + tmd.run(true, true, new IRunnableWithProgress() { @Override @@ -822,7 +825,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe { int timeOut = ConnectionPlugin.getDefault().getPreferenceStore().getInt(TizenConnectionExplorerPreferencePage.KEY_PUSHPULL_TIMEOUT); // create a monitor wrapper around the jface monitor - SyncResult result = sync.pull(entryArray, localDirectory, new SyncProgressMonitor(tmd,monitor, "Pulling file(s) from the device"), timeOut ); + SyncResult result = sync.pull(entryArray, localDirectory, new SyncProgressMonitor(tmd, monitor, "Pulling file(s) from the device"), timeOut); if (result.getCode() != SyncService.RESULT_OK) { @@ -841,7 +844,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe DialogUtil.openErrorDialog(message); } } - + private void openFailDialog(final String message) { Display display = parent.getDisplay(); @@ -864,7 +867,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe private void pushFiles(final String[] localFiles, final FileEntry remoteDirectory) { final String[] files = getFilesToOverwrite(localFiles, remoteDirectory); - if ( isEmpty( files ) ) + if (isEmpty(files)) { return; } @@ -881,8 +884,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { int timeOut = ConnectionPlugin.getDefault().getPreferenceStore().getInt(TizenConnectionExplorerPreferencePage.KEY_PUSHPULL_TIMEOUT); - SyncResult result = sync.push(files, remoteDirectory, (ISyncProgressMonitor) new SyncProgressMonitor(tmd, monitor, - "Pushing file(s) to the device"), timeOut); + SyncResult result = sync.push(files, remoteDirectory, (ISyncProgressMonitor) new SyncProgressMonitor(tmd, monitor, "Pushing file(s) to the device"), timeOut); if (result.getCode() != SyncService.RESULT_OK) { String message = String.format("Failed to push the items: \n%1$s", result.getMessage()); @@ -929,15 +931,15 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe if (src.length == 1) { ret = FileDialogUtils.allowFileOverwrite(f.getName()); - if( ret == IDialogConstants.CANCEL_ID) + if (ret == IDialogConstants.CANCEL_ID) { break; } - } else + } + else { ret = FileDialogUtils.checkOverwrite(f.getName()); - switch (ret ) - { + switch (ret) { case FileDialogUtils.CANCEL_ID: return null; case FileDialogUtils.NO_ID: @@ -989,7 +991,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe @Override public void onConnected(IDevice device) { - if ( !device.isOnline() ) + if (!device.isOnline()) { return; } @@ -1033,7 +1035,8 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe // notify the listener of a possible selection change. notifyListeners(); - } else + } + else { // tree is disposed, we need to do something. // lets remove ourselves from the listener. @@ -1081,7 +1084,8 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe if (entry != null) { currentDevice = entry.getFileListingService().getDevice(); - } else + } + else { IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices(); if (devices.length != 0) @@ -1121,14 +1125,13 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe int validCheck = FilenameUtil.isVaildName(fileName, os); if (validCheck != FilenameUtil.IS_VALID_NAME) { - switch(validCheck) - { - case FilenameUtil.HAS_INVALID_CHARACTER: - return ConnectionUIMessages.Explorer_Message_Invalid_Character + FilenameUtil.getInvalidCharacters(os); - case FilenameUtil.HAS_NO_NAME: - return ""; - default: - break; + switch (validCheck) { + case FilenameUtil.HAS_INVALID_CHARACTER: + return ConnectionUIMessages.Explorer_Message_Invalid_Character + FilenameUtil.getInvalidCharacters(os); + case FilenameUtil.HAS_NO_NAME: + return ""; + default: + break; } } return null; @@ -1137,7 +1140,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe public int getActionState() { - //sub, push, pull, refresh, rename, delete, property + // sub, push, pull, refresh, rename, delete, property int length = treeViewer.getTree().getSelectionCount(); int state = 0x0000000; @@ -1148,16 +1151,19 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe FileEntry entry = getSingleFileEntry(); if (entry.isRoot()) { - state = STATE_SUB | STATE_PUSH| STATE_PULL | STATE_REFRESH | STATE_PROPERTY; + state = STATE_SUB | STATE_PUSH | STATE_PULL | STATE_REFRESH | STATE_PROPERTY; bSubLog = true; - } else if (!entry.isDirectory()) + } + else if (!entry.isDirectory()) { state = STATE_PULL | STATE_REFRESH | STATE_RENAME | STATE_DELETE | STATE_PROPERTY; - } else + } + else { state = STATE_SUB | STATE_PUSH | STATE_PULL | STATE_REFRESH | STATE_RENAME | STATE_DELETE | STATE_PROPERTY; } - } else if (length > 1) + } + else if (length > 1) { state = STATE_PULL | STATE_DELETE; } @@ -1198,7 +1204,8 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe { TreeItem[] items = tree.getSelection(); return (FileEntry) items[0].getData(); - } else + } + else { return null; } @@ -1232,7 +1239,8 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe tree.setSelection(item); } } - } else + } + else { // tree is disposed, we need to do something. // lets remove ourselves from the listener. @@ -1241,14 +1249,15 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe } }); } - + private boolean isSingleEntry() { Tree tree = treeViewer.getTree(); if (tree.getSelectionCount() == 1) { return true; - } else + } + else { return false; } @@ -1264,7 +1273,7 @@ public class ConnectionExplorerPanel extends Panel implements IDeviceChangeListe private interface IActionForEntry { - boolean doCheckEnable(); + boolean doCheckEnable(); void doAction(); } diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionUIMessages.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionUIMessages.java similarity index 96% rename from org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionUIMessages.java rename to org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionUIMessages.java index 248b559..ad7caf0 100644 --- a/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionUIMessages.java +++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionUIMessages.java @@ -23,7 +23,7 @@ * - S-Core Co., Ltd * */ -package org.tizen.common.connection.ui; +package org.tizen.common.connection.explorer; import org.eclipse.osgi.util.NLS; @@ -46,7 +46,7 @@ public class ConnectionUIMessages extends NLS public static String Explorer_ConetextMenu_Log; public static String Explorer_ConetextMenu_Log_On; public static String Explorer_ConetextMenu_Log_Off; - + public static String Explorer_Message_Invalid_Character; public static String Explorer_Tooltip_EmulatorManager; @@ -56,6 +56,8 @@ public class ConnectionUIMessages extends NLS public static String Explorer_Message_EmulatorError; public static String Explorer_Message_PlatformLogError; + public static String Explorer_Tree_Header; + static { // initialize resource bundle diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionUIMessages.properties b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionUIMessages.properties similarity index 97% rename from org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionUIMessages.properties rename to org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionUIMessages.properties index 3db284b..4f2897f 100644 --- a/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionUIMessages.properties +++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionUIMessages.properties @@ -22,3 +22,5 @@ Explorer_Message_Invalid_Character = File contains invalid characters like Explorer_Message_EmulatorError = Emulator is not installed or the install path is invalid. Explorer_Message_PlatformLogError = Failed to get platform log + +Explorer_Tree_Header=Files \ No newline at end of file diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/Messages.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/Messages.java deleted file mode 100755 index f603e24..0000000 --- a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/Messages.java +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Common -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: -* Hoon Kang -* YoonKi Park -* - * 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.explorer; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.tizen.common.connection.explorer.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } - - public static String getString(String key, Object binding) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/messages.properties b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/messages.properties deleted file mode 100644 index e0981e3..0000000 --- a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/messages.properties +++ /dev/null @@ -1,8 +0,0 @@ -FileDialogUtils.message.title=Message -FileDialogUtils.overwrite.message=The {0} file already exists. Do you want to overwrite it? -FileDialogUtils.duplicate.message=Existing file -FileDialogUtils.delete.message=Are you sure you want to delete the ''{0}'' file? -FileDialogUtils.tabName.message= The tab name already exists. Enter a different name. -FileDialogUtils.update.title=Tizen SDK -FileDialogUtils.update.message= Tizen SDK updates are available. Do you want to install them now? -ConnectionExplorer.tree.header=Files \ No newline at end of file -- 2.7.4