Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2011-11-09 18:13:17 +0000
committerEugene Tarassov2011-11-09 18:13:17 +0000
commit3ca2c7df4e670e8ffa23dd865c8d1dc2935afeda (patch)
treeaac9e87edfa3f60e31ac006f192611bd5bada623
parent955ce49554a4f84a458a6754d1ba0c0862e43331 (diff)
parent7c07cd8f9ae8bf7ff6b5a5601667f8c5eb41bbea (diff)
downloadorg.eclipse.tcf-3ca2c7df4e670e8ffa23dd865c8d1dc2935afeda.tar.gz
org.eclipse.tcf-3ca2c7df4e670e8ffa23dd865c8d1dc2935afeda.tar.xz
org.eclipse.tcf-3ca2c7df4e670e8ffa23dd865c8d1dc2935afeda.zip
Merge branch 'master' of ssh://git.eclipse.org/gitroot/tcf/org.eclipse.tcf
-rw-r--r--python/src/tcf/services/linenumbers.py10
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/ViewsUtil.java46
2 files changed, 51 insertions, 5 deletions
diff --git a/python/src/tcf/services/linenumbers.py b/python/src/tcf/services/linenumbers.py
index 410e8d2b4..d026ecd12 100644
--- a/python/src/tcf/services/linenumbers.py
+++ b/python/src/tcf/services/linenumbers.py
@@ -46,7 +46,7 @@ class CodeArea(object):
self.epilogue_begin = epilogue_begin
def __eq__(self, o):
- if self == o: return True
+ if self is o: return True
if not isinstance(o, CodeArea): return False
if self.start_line != o.start_line: return False
if self.start_column != o.start_column: return False
@@ -81,12 +81,12 @@ class CodeArea(object):
bf.write(str(self.start_line))
if self.start_column:
bf.write('.')
- bf.write(self.start_column)
+ bf.write(str(self.start_column))
bf.write("..")
- bf.write(self.end_line)
+ bf.write(str(self.end_line))
if self.end_column:
bf.write('.')
- bf.write(self.end_column)
+ bf.write(str(self.end_column))
bf.write(" -> ")
if self.start_address:
bf.write("0x")
@@ -101,7 +101,7 @@ class CodeArea(object):
bf.write('0')
if self.isa:
bf.write(",isa ")
- bf.write(self.isa)
+ bf.write(str(self.isa))
if self.is_statement:
bf.write(",statement")
if self.basic_block:
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/ViewsUtil.java b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/ViewsUtil.java
index 5e4f93fca..4da52265b 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/ViewsUtil.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/ViewsUtil.java
@@ -9,13 +9,20 @@
*******************************************************************************/
package org.eclipse.tm.te.ui.views;
+import java.util.Collections;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.ISources;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.navigator.CommonNavigator;
/**
@@ -106,4 +113,43 @@ public class ViewsUtil {
PlatformUI.getWorkbench().getDisplay().asyncExec(runnable);
}
}
+
+ /**
+ * Opens the properties editor or dialog on the given selection.
+ *
+ * @param selection The selection. Must be not <code>null</code>.
+ */
+ public static void openProperties(final ISelection selection) {
+ Assert.isNotNull(selection);
+
+ // Create the runnable
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ ICommandService service = (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class);
+ if (service != null) {
+ final Command command = service.getCommand("org.eclipse.ui.file.properties"); //$NON-NLS-1$
+ if (command != null && command.isDefined()) {
+ // Construct the application context
+ EvaluationContext context = new EvaluationContext(null, selection);
+ // Apply the selection to the "activeMenuSelection" and "selection" variable too
+ context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
+ context.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection);
+ context.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ // Construct the execution event
+ ExecutionEvent execEvent = new ExecutionEvent(command, Collections.EMPTY_MAP, this, context);
+ // And execute the event
+ try {
+ command.executeWithChecks(execEvent);
+ } catch (Exception e) { /* ignored on purpose */ }
+ }
+ }
+ }
+ };
+
+ // Execute asynchronously
+ if (PlatformUI.isWorkbenchRunning()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(runnable);
+ }
+ }
}

Back to the top