Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap')
-rw-r--r--proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapProcessor.java139
-rw-r--r--proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapTool.java184
-rw-r--r--proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapVViewLabelProvider.java59
-rw-r--r--proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapView.java290
-rw-r--r--proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapViewContentProvider.java60
-rw-r--r--proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages.java40
-rw-r--r--proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages.properties27
-rw-r--r--proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages_pt.properties27
8 files changed, 826 insertions, 0 deletions
diff --git a/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapProcessor.java b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapProcessor.java
new file mode 100644
index 0000000000..adacf507b8
--- /dev/null
+++ b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapProcessor.java
@@ -0,0 +1,139 @@
+/********************************************************************************
+ * Copyright (c) 2008 Motorola Inc. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributor:
+ * Otávio Ferranti (Motorola)
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.tml.linuxtools.tools.memorymap;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Scanner;
+import java.util.regex.MatchResult;
+
+import org.eclipse.tml.common.utilities.logger.ILogger;
+
+import org.eclipse.tml.linuxtools.LinuxToolsPlugin;
+import org.eclipse.tml.linuxtools.network.IConstants.CommandCode;
+import org.eclipse.tml.linuxtools.network.IConstants.EventCode;
+import org.eclipse.tml.linuxtools.network.IConnectionProvider;
+import org.eclipse.tml.linuxtools.tools.AbstractNotifier;
+import org.eclipse.tml.linuxtools.tools.IListener;
+import org.eclipse.tml.linuxtools.tools.INotifier;
+
+/**
+ * @author Otávio Ferranti
+ */
+public class MemoryMapProcessor extends AbstractNotifier implements IListener {
+
+ final private String CMD_FETCH_IOMEM = "/proc/iomem"; //$NON-NLS-1$
+ final private String PARSE_PATTERN = "\\s*(\\w{8})-(\\w{8})\\s*:\\s*(.*)"; //$NON-NLS-1$
+
+ final private String MSG_EXECUTING_COMMAND =
+ Messages.MemoryMapProcessor_Msg_Executing_The_Command;
+
+ final private String MSG_GOT_RESULT =
+ Messages.MemoryMapProcessor_Msg_Got_The_Result;
+
+ final private int MAX_COLUMNS = 4;
+ private IConnectionProvider connectionProvider = null;
+
+ private ILogger logger = null;
+
+ /**
+ * The constructor;
+ * @param connectionProvider
+ */
+ public MemoryMapProcessor(IConnectionProvider connectionProvider) {
+ setConnectionProvider(connectionProvider);
+ logger = LinuxToolsPlugin.getLogger();
+ }
+
+ /**
+ * @throws IOException
+ */
+ public void gatherData() throws IOException {
+ connectionProvider.setResponseLength(8192);
+ connectionProvider.sendCommand(CommandCode.FETCH_FILE, this.CMD_FETCH_IOMEM);
+ logger.debug(MSG_EXECUTING_COMMAND + "\n" + this.CMD_FETCH_IOMEM); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tml.linuxtools.network.IListener#notify(org.eclipse.tml.linuxtools.network.INotifier, org.eclipse.tml.linuxtools.network.IConstants.EventCode, java.lang.Object)
+ */
+ public void notify(INotifier notifier,
+ EventCode event,
+ Object result) {
+ if (notifier == this.connectionProvider &&
+ event == EventCode.EVT_PROVIDER_SENDCOMMAND_FINISHED) {
+ this.connectionProvider.setResponseLength(1024);
+ Object[][] parsedResult = parseIomem((StringBuffer) result);
+ this.notifyListeners(EventCode.EVT_PROCESSOR_GATHERDATA_FINISHED,
+ parsedResult);
+ }
+ }
+
+ /**
+ * @param connectionProvider
+ */
+ public void setConnectionProvider (IConnectionProvider connectionProvider) {
+ if (null != this.connectionProvider) {
+ this.connectionProvider.removeListener(this);
+ }
+ this.connectionProvider = connectionProvider;
+ if (null != this.connectionProvider) {
+ this.connectionProvider.addListener(this);
+ }
+ }
+
+ /**
+ * @param data
+ * @return
+ */
+ private Object[][] parseIomem(StringBuffer data) {
+ logger.debug(MSG_GOT_RESULT + "\n" + data.toString());
+
+ Scanner s1 = new Scanner(data.toString());
+
+ ArrayList<String[]> list = new ArrayList<String[]>();
+
+ int j = 0;
+
+ while (s1.hasNextLine()) {
+ Scanner s2 = new Scanner(s1.nextLine());
+ s2.findInLine(PARSE_PATTERN);
+
+ String[] entry = null;
+ try {
+ MatchResult result = s2.match();
+ entry = new String[MAX_COLUMNS];
+ for (int i = 1; i <= result.groupCount() && i <= MAX_COLUMNS - 1; i++) {
+ entry[i-1] = result.group(i);
+ }
+ entry[MAX_COLUMNS - 1] = new Integer(j).toString();
+ j++;
+ } catch (IllegalStateException ise) {
+ //TODO: Nothing ?
+ }
+
+ s2.close();
+ if (null != entry) {
+ list.add(entry);
+ }
+ }
+ s1.close();
+
+ String[][] retVal = new String[list.size()][MAX_COLUMNS];
+ for (int i = 0; i < retVal.length; i++) {
+ retVal[i] = list.get(i);
+ }
+ return retVal;
+ }
+}
diff --git a/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapTool.java b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapTool.java
new file mode 100644
index 0000000000..048fe4568f
--- /dev/null
+++ b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapTool.java
@@ -0,0 +1,184 @@
+/********************************************************************************
+ * Copyright (c) 2008 Motorola Inc. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributor:
+ * Otávio Ferranti (Motorola)
+ *
+ * Contributors:
+ * Otávio Ferranti - Eldorado Research Institute - Bug 255255 [tml][proctools] Add extension points
+ ********************************************************************************/
+
+package org.eclipse.tml.linuxtools.tools.memorymap;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.tml.linuxtools.network.IConnectionProvider;
+import org.eclipse.tml.linuxtools.network.IConstants.EventCode;
+import org.eclipse.tml.linuxtools.network.IConstants.OperationCode;
+import org.eclipse.tml.linuxtools.tools.AbstractNotifier;
+import org.eclipse.tml.linuxtools.tools.IListener;
+import org.eclipse.tml.linuxtools.tools.INotifier;
+import org.eclipse.tml.linuxtools.tools.ITool;
+import org.eclipse.tml.linuxtools.utilities.Extensions;
+import org.eclipse.tml.linuxtools.utilities.ProtocolDescriptor;
+
+/**
+ * @author Otávio Ferranti
+ */
+public class MemoryMapTool extends AbstractNotifier implements IListener, ITool {
+
+ private IConnectionProvider connectionProvider = null;
+ private MemoryMapProcessor processor = null;
+
+ private String[] requiredCapabilities = {"GET_FILE"}; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tml.linuxtools.tools.memorymap.iTool#createInstance(java.lang.String, int, java.lang.String)
+ */
+ public void connect (String host,
+ int port,
+ ProtocolDescriptor protocol) {
+
+ Class<IConnectionProvider> connectionProviderClass =
+ protocol.getConnectionProviderClass();
+
+ try {
+ Object aux = connectionProviderClass.newInstance();
+ connectionProvider = (IConnectionProvider) aux;
+ } catch (InstantiationException ie) {
+ } catch (IllegalAccessException iae) {
+ } catch (ClassCastException cce) {
+ }
+
+ connectionProvider.addListener(this);
+ try {
+ connectionProvider.connect(host, port);
+ } catch (IOException ie) { }
+ processor = new MemoryMapProcessor(connectionProvider);
+
+ processor.addListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tml.linuxtools.tools.ITool#closeConnection()
+ */
+ public void disconnect() {
+ if (null != connectionProvider) {
+ try {
+ connectionProvider.disconnect();
+ } catch (IOException ie) {
+ }
+ connectionProvider = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tml.linuxtools.tools.memorymap.iTool#login(java.lang.String, java.lang.String)
+ */
+ public void login (String user, String password) {
+ try {
+ connectionProvider.login(user, password);
+ } catch (IOException ie) {
+ //TODO: Nothing ?
+ }
+ }
+
+ public List<ProtocolDescriptor> getProtocolsDescriptors() {
+ List <ProtocolDescriptor> pdList = Extensions.findProcotols(requiredCapabilities);
+ return pdList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tml.linuxtools.tools.IListener#notify(org.eclipse.tml.linuxtools.tools.INotifier, org.eclipse.tml.linuxtools.network.IConstants.EventCode, java.lang.Object)
+ */
+ public void notify(INotifier notifier, EventCode event, Object result) {
+ try {
+ if (notifier == connectionProvider) {
+ switch (event) {
+ case EVT_PROVIDER_CONNECT_FINISHED:
+ if (OperationCode.SUCCESS == result) {
+ processor.gatherData();
+ }
+ this.notifyListeners(
+ EventCode.EVT_TOOL_CONNECT_FINISHED,
+ result);
+ break;
+ case EVT_PROVIDER_CONNECT_ERROR:
+ break;
+ case EVT_PROVIDER_LOGIN_FINISHED:
+ if (OperationCode.SUCCESS == result) {
+ processor.gatherData();
+ }
+ this.notifyListeners(
+ EventCode.EVT_TOOL_LOGIN_FINISHED,
+ result);
+ break;
+ case EVT_PROVIDER_SENDCOMMAND_FINISHED:
+ break;
+ case EVT_PROVIDER_SENDCOMMAND_ERROR:
+ break;
+ case EVT_PROVIDER_SENDDATA_FINISHED:
+ break;
+ case EVT_PROVIDER_SENDDATA_ERROR:
+ break;
+ case EVT_PROVIDER_DISCONNECT_FINISHED:
+ this.notifyListeners(
+ EventCode.EVT_TOOL_DISCONNECT_FINISHED,
+ result);
+ break;
+ }
+ }
+ if (notifier == processor) {
+ switch (event) {
+ case EVT_PROCESSOR_GATHERDATA_FINISHED:
+ notifyListeners(EventCode.EVT_TOOL_REFRESH_VIEW,
+ result);
+ break;
+ case EVT_PROCESSOR_GATHERDATA_ERROR:
+ break;
+ }
+ }
+ } catch (IOException ie) {
+ }
+ }
+
+ /**
+ *
+ */
+ public void refresh() {
+ try {
+ if (null != processor) {
+ processor.gatherData();
+ }
+ } catch (IOException ie) {
+ //TODO: Nothing ?
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tml.linuxtools.tools.ITool#getRefreshDelay()
+ */
+ public int getRefreshDelay() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tml.linuxtools.tools.ITool#setRefreshDelay(int)
+ */
+ public void setRefreshDelay(int delay) {
+ // TODO Auto-generated method stub
+ }
+
+ public void start() {
+ // TODO Auto-generated method stub
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+ }
+}
diff --git a/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapVViewLabelProvider.java b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapVViewLabelProvider.java
new file mode 100644
index 0000000000..0a6f34bcde
--- /dev/null
+++ b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapVViewLabelProvider.java
@@ -0,0 +1,59 @@
+/********************************************************************************
+ * Copyright (c) 2008 Motorola Inc. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributor:
+ * Otávio Ferranti (Motorola)
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.tml.linuxtools.tools.memorymap;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Otávio Ferranti
+ */
+public class MemoryMapVViewLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object obj, int index) {
+ //TODO: Enhance this.
+ if (index == 2) {
+ return getImage(((Object[]) obj)[index]);
+ } else {
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object obj, int index) {
+ if (obj instanceof String[]) {
+ return getText(((Object[]) obj)[index]);
+ } else {
+ return new String(""); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object obj) {
+ return PlatformUI.getWorkbench().
+ getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
+ }
+}
+
diff --git a/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapView.java b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapView.java
new file mode 100644
index 0000000000..9a095f7d1c
--- /dev/null
+++ b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapView.java
@@ -0,0 +1,290 @@
+/********************************************************************************
+ * Copyright (c) 2008 Motorola Inc. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributor:
+ * Otávio Ferranti (Motorola)
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.tml.linuxtools.tools.memorymap;
+
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.action.*;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.SWT;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.ViewPart;
+
+import org.eclipse.tml.linuxtools.LinuxToolsPlugin;
+import org.eclipse.tml.linuxtools.tools.IListener;
+import org.eclipse.tml.linuxtools.tools.INotifier;
+import org.eclipse.tml.linuxtools.tools.ITool;
+import org.eclipse.tml.linuxtools.ui.IToolViewPart;
+import org.eclipse.tml.linuxtools.ui.DialogLogin;
+import org.eclipse.tml.linuxtools.ui.ViewActionDisconnect;
+import org.eclipse.tml.linuxtools.ui.ViewActionConnect;
+import org.eclipse.tml.linuxtools.ui.ViewActionRefresh;
+import org.eclipse.tml.linuxtools.network.IConstants.EventCode;
+import org.eclipse.tml.linuxtools.network.IConstants.OperationCode;
+
+/**
+ * @author Otávio Ferranti
+ */
+public class MemoryMapView extends ViewPart implements IToolViewPart, IListener {
+
+ private class AddressSorter extends ViewerSorter {
+
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ int result = 0;
+ try {
+ int a = new Integer(((String[]) e1)[MAX_COLUMNS - 1]).intValue();
+ int b = new Integer(((String[]) e2)[MAX_COLUMNS - 1]).intValue();
+ if (a > b) {
+ result = 1;
+ } else if (a < b) {
+ result = -1;
+ };
+ }
+ catch (NumberFormatException nfe) {
+ //TODO: Nothing ?
+ }
+ return result;
+ }
+ }
+ final private String COL_LABEL_ADDRESS_START = Messages.MemoryMapView_Col_Label_Address_Start;
+ final private String COL_LABEL_ADDRESS_END = Messages.MemoryMapView_Col_Label_Address_End;
+ final private String COL_LABEL_REGION = Messages.MemoryMapView_Col_label_Region;
+
+ final private int MAX_COLUMNS = 4;
+
+ private ITool tool = null;
+ private TableViewer viewer;
+
+ private Action refreshAction;
+ private Action disconnectAction;
+ private Action connectAction;
+
+ private IPartListener partActivationListener = new IPartListener() {
+ public void partActivated(IWorkbenchPart part) {
+ }
+
+ public void partBroughtToTop(IWorkbenchPart part) {
+ }
+
+ public void partClosed(IWorkbenchPart part) {
+ if (MemoryMapView.this.getSite().getPart() == part) {
+ ITool tool = MemoryMapView.this.getTool();
+ if (null != tool) {
+ tool.disconnect();
+ }
+ }
+ }
+
+ public void partDeactivated(IWorkbenchPart part) {
+ }
+
+ public void partOpened(IWorkbenchPart part) {
+ }
+ };
+
+ /**
+ * The constructor.
+ */
+ public MemoryMapView() {
+ }
+
+ /**
+ * This is a callback that will allow us
+ * to create the viewer and initialize it.
+ */
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPartControl(Composite parent) {
+
+ viewer = new TableViewer(parent, SWT.FULL_SELECTION |
+ SWT.H_SCROLL | SWT.V_SCROLL);
+ viewer.setContentProvider(new MemoryMapViewContentProvider());
+ viewer.setLabelProvider(new MemoryMapVViewLabelProvider());
+ viewer.setSorter(new AddressSorter());
+
+ Table table = viewer.getTable();
+ table.setHeaderVisible(true);
+
+ new TableColumn(table, SWT.LEFT).setText(COL_LABEL_ADDRESS_START);
+ new TableColumn(table, SWT.LEFT).setText(COL_LABEL_ADDRESS_END);
+ new TableColumn(table, SWT.LEFT).setText(COL_LABEL_REGION);
+
+ refresh();
+ resize();
+
+ makeActions();
+ // hookDoubleClickAction();
+ addToToolBar();
+
+ getViewSite()
+ .getWorkbenchWindow()
+ .getPartService()
+ .addPartListener(partActivationListener);
+
+ setConnectEnabled(true);
+ refreshAction.setEnabled(false);
+ }
+
+ private void addToToolBar() {
+ IActionBars actionBars = getViewSite().getActionBars();
+ IToolBarManager toolBarMmanager = actionBars.getToolBarManager();
+ toolBarMmanager.add(refreshAction);
+ toolBarMmanager.add(disconnectAction);
+ toolBarMmanager.add(connectAction);
+ }
+
+ private void makeActions() {
+
+ refreshAction = new Action() {
+ public void run() {
+ IViewActionDelegate delegate = new ViewActionRefresh();
+ delegate.init(MemoryMapView.this);
+ delegate.run(this);
+ this.setEnabled(false);
+ }
+ };
+ refreshAction.setToolTipText(Messages.MemoryMapView_Action_Refresh);
+ refreshAction.setImageDescriptor(
+ LinuxToolsPlugin.getDefault().getImageDescriptor(LinuxToolsPlugin.ICON_REFRESH));
+
+ disconnectAction = new Action() {
+ public void run() {
+ IViewActionDelegate delegate = new ViewActionDisconnect();
+ delegate.init(MemoryMapView.this);
+ delegate.run(this);
+ }
+ };
+ disconnectAction.setToolTipText(Messages.MemoryMapView_Action_Disconnect);
+ disconnectAction.setImageDescriptor(
+ LinuxToolsPlugin.getDefault().getImageDescriptor(LinuxToolsPlugin.ICON_DISCONNECT));
+
+ connectAction = new Action() {
+ public void run() {
+ IViewActionDelegate delegate = new ViewActionConnect();
+ delegate.init(MemoryMapView.this);
+ delegate.run(this);
+ }
+ };
+ connectAction.setToolTipText(Messages.MemoryMapView_Action_Connect);
+ connectAction.setImageDescriptor(
+ LinuxToolsPlugin.getDefault().getImageDescriptor(LinuxToolsPlugin.ICON_CONNECT));
+
+ }
+
+ private void setConnectEnabled(boolean bool) {
+ connectAction.setEnabled(bool);
+ disconnectAction.setEnabled(!bool);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tml.linuxtools.ui.IToolView#getTool()
+ */
+ public ITool getTool() {
+ if(null == tool) {
+ tool = new MemoryMapTool();
+ tool.addListener(this);
+ }
+ return tool;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tml.linuxtools.network.IListener#notify(org.eclipse.tml.linuxtools.network.INotifier, org.eclipse.tml.linuxtools.network.IConstants.EventCode, java.lang.Object)
+ */
+ public void notify(INotifier notifier, EventCode event, Object result) {
+ if (notifier == tool) {
+ final Object finalResult = result;
+ final EventCode finalEvent = event;
+ final ViewPart finalView = this;
+ final ITool finalTool = this.tool;
+
+ this.getViewSite().getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ switch(finalEvent) {
+ case EVT_TOOL_REFRESH_VIEW:
+ viewer.setInput(finalResult);
+ refreshAction.setEnabled(true);
+ refresh();
+ resize();
+ break;
+ case EVT_TOOL_CONNECT_FINISHED:
+ case EVT_TOOL_LOGIN_FINISHED:
+ switch ((OperationCode)finalResult) {
+ case SUCCESS:
+ setConnectEnabled(false);
+ refreshAction.setEnabled(true);
+ break;
+ case LOGIN_REQUIRED: {
+ final DialogLogin dialog = new DialogLogin(
+ finalView.getViewSite().getShell(),
+ finalTool, false);
+ dialog.open();
+ }
+ break;
+ case LOGIN_FAILED: {
+ final DialogLogin dialog = new DialogLogin(
+ finalView.getViewSite().getShell(),
+ finalTool, true);
+ dialog.open();
+ }
+ break;
+ }
+ break;
+ case EVT_TOOL_DISCONNECT_FINISHED:
+ setConnectEnabled(true);
+ refreshAction.setEnabled(false);
+ break;
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ *
+ */
+ public void refresh() {
+ viewer.refresh();
+ }
+
+ /**
+ *
+ */
+ public void resize() {
+ Table table = viewer.getTable();
+ for (int i = 0, n = table.getColumnCount(); i < n; i++) {
+ table.getColumn(i).pack();
+ }
+ }
+
+ /**
+ * @param data
+ */
+ public void setData (Object data) {
+ viewer.setInput(data);
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+} \ No newline at end of file
diff --git a/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapViewContentProvider.java b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapViewContentProvider.java
new file mode 100644
index 0000000000..e24f886359
--- /dev/null
+++ b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/MemoryMapViewContentProvider.java
@@ -0,0 +1,60 @@
+/********************************************************************************
+ * Copyright (c) 2008 Motorola Inc. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributor:
+ * Otávio Ferranti (Motorola)
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.tml.linuxtools.tools.memorymap;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/*
+ * The content provider class is responsible for
+ * providing objects to the view. It can wrap
+ * existing objects in adapters or simply return
+ * objects as-is. These objects may be sensitive
+ * to the current input of the view, or ignore
+ * it and always show the same content
+ * (like Task List, for example).
+ */
+
+/**
+ * @author Otávio Ferranti
+ */
+public class MemoryMapViewContentProvider implements IStructuredContentProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object parent) {
+ if (parent instanceof String[][]) {
+ return (String[][]) parent;
+ } else {
+ String[][] aux = new String[1][];
+ aux[0] = new String[] {"", //$NON-NLS-1$
+ "", //$NON-NLS-1$
+ ""}; //$NON-NLS-1$
+ return aux;
+ }
+ }
+}
diff --git a/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages.java b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages.java
new file mode 100644
index 0000000000..41ee2b3956
--- /dev/null
+++ b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages.java
@@ -0,0 +1,40 @@
+/********************************************************************************
+ * Copyright (c) 2008 Motorola Inc. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributor:
+ * Otávio Ferranti (Motorola)
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.tml.linuxtools.tools.memorymap;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Otávio Ferranti
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME =
+ "org.eclipse.tml.linuxtools.tools.memorymap.messages"; //$NON-NLS-1$
+
+ public static String MemoryMapProcessor_Msg_Executing_The_Command;
+ public static String MemoryMapProcessor_Msg_Got_The_Result;
+ public static String MemoryMapView_Action_Refresh;
+ public static String MemoryMapView_Action_Disconnect;
+ public static String MemoryMapView_Action_Connect;
+ public static String MemoryMapView_Col_Label_Address_End;
+ public static String MemoryMapView_Col_Label_Address_Start;
+ public static String MemoryMapView_Col_label_Region;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages.properties b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages.properties
new file mode 100644
index 0000000000..26498c4b9b
--- /dev/null
+++ b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages.properties
@@ -0,0 +1,27 @@
+################################################################################
+# Copyright (c) 2008 Motorola Inc.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Initial Contributors:
+# Otávio Ferranti (Motorola)
+#
+# Contributors:
+# {Name} (company) - description of contribution.
+################################################################################
+
+# NLS_MESSAGEFORMAT_VAR
+# NLS_ENCODING=UTF-8
+
+MemoryMapView_Col_Label_Address_Start=Start
+MemoryMapView_Col_Label_Address_End=End
+MemoryMapView_Col_label_Region=Region name
+
+MemoryMapView_Action_Refresh=Refresh
+MemoryMapView_Action_Disconnect=Disconnect
+MemoryMapView_Action_Connect=Connect
+
+MemoryMapProcessor_Msg_Executing_The_Command=Executing the command:
+MemoryMapProcessor_Msg_Got_The_Result=Got the result:
diff --git a/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages_pt.properties b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages_pt.properties
new file mode 100644
index 0000000000..5e5213a877
--- /dev/null
+++ b/proctools/plugins/org.eclipse.sequoyah.device.linuxtools/src/org/eclipse/sequoyah/linuxtools/tools/memorymap/Messages_pt.properties
@@ -0,0 +1,27 @@
+################################################################################
+# Copyright (c) 2008 Motorola Inc.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Initial Contributors:
+# Otávio Ferranti (Motorola)
+#
+# Contributors:
+# {Name} (company) - description of contribution.
+################################################################################
+
+# NLS_MESSAGEFORMAT_VAR
+# NLS_ENCODING=UTF-8
+
+MemoryMapView_Col_Label_Address_Start=Início
+MemoryMapView_Col_Label_Address_End=Fim
+MemoryMapView_Col_label_Region=Nome do intervalo
+
+MemoryMapView_Action_Refresh=Atualizar
+MemoryMapView_Action_Disconnect=Desconectar
+MemoryMapView_Action_Connect=Conectar
+
+MemoryMapProcessor_Msg_Executing_The_Command=Executando o comando:
+MemoryMapProcessor_Msg_Got_The_Result=Resultado obtido:

Back to the top