[Desc.] moved class and message files to related package. updated message class. changed connection explorer id. remove unused source
[Issue]
Change-Id: Ic02a5db6828017b92bb5a12c09d35708324322f8
point="org.eclipse.ui.views">
<view
category="org.tizen.nativeapp.viewCategory"
- class="org.tizen.common.connection.ui.ConnectionExplorer"
+ class="org.tizen.common.connection.explorer.ConnectionExplorer"
icon="icons/connection_explorer.gif"
- id="org.tizen.common.connection.ui.ConnectionExplorer"
+ id="org.tizen.common.connection.explorer.ConnectionExplorer"
name="%view.connectionExplorer"
restorable="true">
</view>
ratio="1"
relationship="bottom"
relative="org.eclipse.ui.navigator.ProjectExplorer"
- id="org.tizen.common.connection.ui.ConnectionExplorer">
+ id="org.tizen.common.connection.explorer.ConnectionExplorer">
</view>
<viewShortcut
- id="org.tizen.common.connection.ui.ConnectionExplorer">
+ id="org.tizen.common.connection.explorer.ConnectionExplorer">
</viewShortcut>
</perspectiveExtension>
</extension>
// 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;
--- /dev/null
+/*\r
+ * Common\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hoon Kang <h245.kang@samsung.com>\r
+ * YoonKi Park <yoonki.park@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.connection.ddmuilib;\r
+\r
+import org.eclipse.osgi.util.NLS;\r
+\r
+public class FileDialogMessages extends NLS\r
+{\r
+ private static final String BUNDLE_NAME = FileDialogMessages.class.getPackage().getName() + ".FileDialogMessages";\r
+\r
+ public static String FileDialog_Message_Title;\r
+ public static String FileDialog_Overwrite_Message;\r
+ public static String FileDialog_Duplicate_Message;\r
+ public static String FileDialog_Delete_Message;\r
+ public static String FileDialog_TabName_Message;\r
+ public static String FileDialog_Update_Title;\r
+ public static String FileDialog_Update_Message;\r
+\r
+ static\r
+ {\r
+ // initialize resource bundle\r
+ NLS.initializeMessages(BUNDLE_NAME, FileDialogMessages.class);\r
+ }\r
+\r
+ private FileDialogMessages()\r
+ {\r
+ }\r
+}\r
--- /dev/null
+FileDialog_Message_Title=Message\r
+FileDialog_Overwrite_Message=The {0} file already exists. Do you want to overwrite it?\r
+FileDialog_Duplicate_Message=Existing file\r
+FileDialog_Delete_Message=Are you sure you want to delete the ''{0}'' file?\r
+FileDialog_TabName_Message=The tab name already exists. Enter a different name.\r
+FileDialog_Update_Title=Tizen SDK\r
+FileDialog_Update_Message= Tizen SDK updates are available. Do you want to install them now?
\ No newline at end of file
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
{
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;
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);
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);
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);
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);
@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();
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.connection.ui;
+package org.tizen.common.connection.explorer;
import java.io.File;
import java.io.IOException;
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;
private ToolItem pullToolItem;
private ToolItem emulManagerToolItem;
+ private MenuManager menuMgr;
private MenuManager subNewMenu;
private MenuManager subLogMenu;
+
private Action actionAddFolder;
private Action actionAddFile;
private Action actionPush;
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);
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();
}
};
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());
}
};
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);
}
});
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;
}
});
}
- 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");
}
- private void fillContextMenu(IMenuManager manager) {
+ private void fillContextMenu(IMenuManager manager)
+ {
subNewMenu.add(actionAddFile);
subNewMenu.add(actionAddFolder);
manager.add(subNewMenu);
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());
}
}
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);
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());
}
}
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();
}
});
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();
}
});
}
@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);
}
});
}
@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
if (arg0 instanceof FileEntry)
{
FileEntry entry = (FileEntry) arg0;
- return PARENT_TYPES.contains( entry.getType() );
+ return PARENT_TYPES.contains(entry.getType());
}
return false;
}
{
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
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;
}
}
}
{
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();
@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
@Override
public void removeListener(ILabelProviderListener listener)
- {}
+ {
+ }
public static String getDeviceSerialWithName(IDevice device)
{
{
return combineSerialWithName(entry.getFileListingService().getDevice().getSerialNumber(), entry.getName());
}
-
+
private static String combineSerialWithName(String serial, String name)
{
return String.format("%s (%s)", serial, name);
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;
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;
private ToolItem pushToolItem;
private ToolItem pullToolItem;
-// private ToolItem emulStartToolItem;
+ // private ToolItem emulStartToolItem;
private MenuManager subNewMenu;
private Action actionPush;
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();
@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)
{
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;
FileEntry entry = getSingleFileEntry();
FileDialog dlg = new FileDialog(parent.getShell(), SWT.OPEN);
-
+
setDialog(dlg, "Push the Files");
String[] fileName = new String[1];
if (entry.isDirectory() || entry.isRoot())
{
refreshFileEntry = entry;
- } else
+ }
+ else
{
refreshFileEntry = entry.getParent();
}
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);
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()));
}
throw new RuntimeException(e);
}
- refresh(entry.getParent());
- setActionEnabled();
+ refresh(entry.getParent());
+ setActionEnabled();
}
}
}
}
});
}
-
+
public void showPropertySelection(final IWorkbenchPartSite site)
{
doActionForEntry(new IActionForEntry()
}
});
}
-
+
public void setPlatformLogOnOff(boolean On)
{
String command = String.format("dlogctrl set platformlog %s; echo $?", On ? "1" : "0");
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);
}
}
{
// set up the data source.
treeViewer.setInput(bridge);
- } else
+ }
+ else
{
// tree is disposed, we need to do something.
// lets remove ourselves from the listener.
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);
// get a progress dialog
final TransferProgressMonitorDialog tmd = new TransferProgressMonitorDialog(parent.getShell());
-
+
tmd.run(true, true, new IRunnableWithProgress()
{
@Override
{
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)
{
DialogUtil.openErrorDialog(message);
}
}
-
+
private void openFailDialog(final String message)
{
Display display = parent.getDisplay();
private void pushFiles(final String[] localFiles, final FileEntry remoteDirectory)
{
final String[] files = getFilesToOverwrite(localFiles, remoteDirectory);
- if ( isEmpty( files ) )
+ if (isEmpty(files))
{
return;
}
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());
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:
@Override
public void onConnected(IDevice device)
{
- if ( !device.isOnline() )
+ if (!device.isOnline())
{
return;
}
// 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.
if (entry != null)
{
currentDevice = entry.getFileListingService().getDevice();
- } else
+ }
+ else
{
IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices();
if (devices.length != 0)
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;
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;
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;
}
{
TreeItem[] items = tree.getSelection();
return (FileEntry) items[0].getData();
- } else
+ }
+ else
{
return null;
}
tree.setSelection(item);
}
}
- } else
+ }
+ else
{
// tree is disposed, we need to do something.
// lets remove ourselves from the listener.
}
});
}
-
+
private boolean isSingleEntry()
{
Tree tree = treeViewer.getTree();
if (tree.getSelectionCount() == 1)
{
return true;
- } else
+ }
+ else
{
return false;
}
private interface IActionForEntry
{
- boolean doCheckEnable();
+ boolean doCheckEnable();
void doAction();
}
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.connection.ui;
+package org.tizen.common.connection.explorer;
import org.eclipse.osgi.util.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;
public static String Explorer_Message_EmulatorError;
public static String Explorer_Message_PlatformLogError;
+ public static String Explorer_Tree_Header;
+
static
{
// initialize resource bundle
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
+++ /dev/null
-/*\r
-* Common\r
-*\r
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
-*\r
-* Contact: \r
-* Hoon Kang <h245.kang@samsung.com>\r
-* YoonKi Park <yoonki.park@samsung.com>\r
-* \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*\r
-* Contributors:\r
-* - S-Core Co., Ltd\r
-*\r
-*/\r
-package org.tizen.common.connection.explorer;\r
-\r
-import java.util.MissingResourceException;\r
-import java.util.ResourceBundle;\r
-\r
-public class Messages {\r
- private static final String BUNDLE_NAME = "org.tizen.common.connection.explorer.messages"; //$NON-NLS-1$\r
-\r
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle\r
- .getBundle(BUNDLE_NAME);\r
-\r
- private Messages() {\r
- }\r
- \r
- public static String getString(String key) {\r
- try {\r
- return RESOURCE_BUNDLE.getString(key);\r
- } catch (MissingResourceException e) {\r
- return '!' + key + '!';\r
- }\r
- }\r
- \r
- public static String getString(String key, Object binding) {\r
- try {\r
- return RESOURCE_BUNDLE.getString(key);\r
- } catch (MissingResourceException e) {\r
- return '!' + key + '!';\r
- }\r
- }\r
-}\r
+++ /dev/null
-FileDialogUtils.message.title=Message\r
-FileDialogUtils.overwrite.message=The {0} file already exists. Do you want to overwrite it?\r
-FileDialogUtils.duplicate.message=Existing file\r
-FileDialogUtils.delete.message=Are you sure you want to delete the ''{0}'' file?\r
-FileDialogUtils.tabName.message= The tab name already exists. Enter a different name.\r
-FileDialogUtils.update.title=Tizen SDK\r
-FileDialogUtils.update.message= Tizen SDK updates are available. Do you want to install them now?\r
-ConnectionExplorer.tree.header=Files
\ No newline at end of file