diff options
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java | 82 |
1 files changed, 37 insertions, 45 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java index de908a669..24fc22883 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 2012 IBM Corporation and others. * 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 @@ -19,22 +19,27 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; - +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchDelegate; +import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; +import org.eclipse.debug.internal.core.LaunchDelegate; +import org.eclipse.debug.internal.core.LaunchManager; +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.IDebugHelpContextIds; +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; +import org.eclipse.debug.internal.ui.SWTFactory; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchCategoryFilter; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPresentationManager; +import org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.MessageDialogWithToggle; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.preference.RadioGroupFieldEditor; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; @@ -42,7 +47,16 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; - +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; import org.eclipse.ui.IPerspectiveDescriptor; import org.eclipse.ui.IPerspectiveRegistry; import org.eclipse.ui.IWorkbench; @@ -53,23 +67,6 @@ import org.eclipse.ui.activities.IActivityManagerListener; import org.eclipse.ui.activities.WorkbenchActivityHelper; import org.eclipse.ui.model.WorkbenchViewerComparator; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchDelegate; -import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.core.LaunchDelegate; -import org.eclipse.debug.internal.core.LaunchManager; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchCategoryFilter; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPresentationManager; -import org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager; - -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; - /** * The preference page for selecting and changing launch perspectives * @@ -171,15 +168,8 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I } fgCurrentWorkingContext.clear(); if(!selection.isEmpty()) { - Point pt = getShell().getSize(); createCombos(fMainComposite, selection.toArray()); fMainComposite.layout(); - if(!fInitializing) { - Point pt2 = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - if(pt2.x > pt.x) { - getShell().setSize(pt2); - } - } } else { SWTFactory.createWrapLabel(fMainComposite, DebugPreferencesMessages.LaunchPerspectivePreferencePage_0, 2, 275); @@ -206,11 +196,6 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I private static HashSet fgCurrentWorkingContext = null; /** - * fields - */ - private boolean fInitializing = false; - - /** * A default selection listener to be reused by all combo boxes presenting perspective data */ private SelectionListener fSelectionListener = new SelectionListener() { @@ -336,6 +321,15 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I fPerspectivesPanel.refreshPanel((IStructuredSelection) event.getSelection()); } }); + fTreeViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + IStructuredSelection ss = (IStructuredSelection) event.getSelection(); + if(!ss.isEmpty()) { + Object obj = ss.getFirstElement(); + fTreeViewer.setExpandedState(obj, !fTreeViewer.getExpandedState(obj)); + } + } + }); fTreeViewer.setLabelProvider(DebugUITools.newDebugModelPresentation()); fTreeViewer.setComparator(new WorkbenchViewerComparator()); fTreeViewer.setContentProvider(new PerspectiveContentProvider()); @@ -527,7 +521,6 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I * a selection changed event from the tree viewer */ protected void initializeControls() { - fInitializing = true; if(fTree.getItemCount() > 0) { TreeItem item = fTree.getItem(0); fTreeViewer.setSelection(new StructuredSelection(item.getData())); @@ -536,7 +529,6 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I //load the group selections fSwitchLaunch.load(); fSwitchSuspend.load(); - fInitializing = false; } /** |