From 70f06667d8a0d73920fcc38ca722c2591607e5e4 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Tue, 7 Sep 2010 16:19:56 -0700 Subject: Open the debug perspective when showing hprof files. This prevents the creation of an editor area in the ddms perspective (the only way to get rid of it later seems to be to reset the perspective). Change-Id: I1eb4a3f6a77f27cc462b18b9db43d27cfef09337 --- .../src/com/android/ide/eclipse/adt/AdtPlugin.java | 2 -- .../android/ide/eclipse/ddms/views/DeviceView.java | 24 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'eclipse/plugins') diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java index c2088df..afe04ae 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java @@ -16,8 +16,6 @@ package com.android.ide.eclipse.adt; -import com.android.ddmuilib.StackTracePanel; -import com.android.ddmuilib.StackTracePanel.ISourceRevealer; import com.android.ddmuilib.console.DdmConsole; import com.android.ddmuilib.console.IDdmConsole; import com.android.ide.eclipse.adt.internal.VersionCheck; diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java index f2033de..bbaded7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java +++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java @@ -42,6 +42,8 @@ import com.android.ide.eclipse.ddms.preferences.PreferenceInitializer; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Path; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; @@ -56,8 +58,12 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IActionBars; import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.part.ViewPart; @@ -228,6 +234,24 @@ public class DeviceView extends ViewPart implements IUiSelectionListener, IClien IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(tempPath)); if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) { + // before we open the file in an editor window, we make sure the current + // workbench page has an editor area (typically the ddms perspective doesn't). + IWorkbench workbench = PlatformUI.getWorkbench(); + IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); + IWorkbenchPage page = window.getActivePage(); + if (page.isEditorAreaVisible() == false) { + IAdaptable input; + if (page != null) + input= page.getInput(); + else + input= ResourcesPlugin.getWorkspace().getRoot(); + try { + workbench.showPerspective("org.eclipse.debug.ui.DebugPerspective", + window, input); + } catch (WorkbenchException e) { + } + } + IDE.openEditorOnFileStore( getSite().getWorkbenchWindow().getActivePage(), fileStore); -- cgit v1.1