diff options
author | Sarika Sinha | 2017-09-26 11:01:54 +0000 |
---|---|---|
committer | Sarika Sinha | 2017-09-26 11:01:54 +0000 |
commit | 72bc4e8d7adb9ca98e2b9f2b5af464f6c6ef3911 (patch) | |
tree | c107655ed93469a8d302548c770e983d12050fc7 | |
parent | c2a10306c92c88d6bc460956e8bab8f5c0e0c473 (diff) | |
parent | 1b93440740ddcadb63df6c30e152e52810e5b932 (diff) | |
download | eclipse.platform.debug-72bc4e8d7adb9ca98e2b9f2b5af464f6c6ef3911.tar.gz eclipse.platform.debug-72bc4e8d7adb9ca98e2b9f2b5af464f6c6ef3911.tar.xz eclipse.platform.debug-72bc4e8d7adb9ca98e2b9f2b5af464f6c6ef3911.zip |
Merge R4_7_Maintenance for Java9I20171002-2000I20171001-2000I20170930-1500I20170929-2000I20170928-2000I20170927-2000I20170927-0420I20170926-2000
Change-Id: I93feda21eb29db31eee086d317c17706aca3fdd0
4 files changed, 203 insertions, 79 deletions
diff --git a/org.eclipse.debug.ui/.settings/.api_filters b/org.eclipse.debug.ui/.settings/.api_filters index ff2070863..b6cbd924f 100644 --- a/org.eclipse.debug.ui/.settings/.api_filters +++ b/org.eclipse.debug.ui/.settings/.api_filters @@ -1,66 +1,80 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.debug.ui" version="2">
- <resource path="ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java" type="org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationViewer">
- <filter comment="Known illegal extension" id="571473929">
- <message_arguments>
- <message_argument value="TreeViewer"/>
- <message_argument value="LaunchConfigurationViewer"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java" type="org.eclipse.debug.internal.ui.preferences.LaunchPerspectivePreferencePage$PerspectivesTreeViewer">
- <filter comment="Known illegal extension" id="571473929">
- <message_arguments>
- <message_argument value="TreeViewer"/>
- <message_argument value="PerspectivesTreeViewer"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java" type="org.eclipse.debug.internal.ui.sourcelookup.SourceContainerViewer">
- <filter comment="Known illegal extension" id="571473929">
- <message_arguments>
- <message_argument value="TreeViewer"/>
- <message_argument value="SourceContainerViewer"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ProjectSourceContainerDialog.java" type="org.eclipse.debug.internal.ui.sourcelookup.browsers.ProjectSourceContainerDialog">
- <filter comment="Known illegal extension" id="571473929">
- <message_arguments>
- <message_argument value="ListSelectionDialog"/>
- <message_argument value="ProjectSourceContainerDialog"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java" type="org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer">
- <filter comment="Known illegal extension for the async viewer support" id="571473929">
- <message_arguments>
- <message_argument value="TreeViewer"/>
- <message_argument value="InternalTreeModelViewer"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java" type="org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer">
- <filter comment="Known illegal extension" id="571473929">
- <message_arguments>
- <message_argument value="CheckboxTreeViewer"/>
- <message_argument value="BreakpointsViewer"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java" type="org.eclipse.debug.ui.actions.AbstractLaunchHistoryAction">
- <filter comment="Known leaked internal types" id="576725006">
- <message_arguments>
- <message_argument value="ILaunchHistoryChangedListener"/>
- <message_argument value="AbstractLaunchHistoryAction"/>
- </message_arguments>
- </filter>
- <filter comment="Known leaked internal types" id="643842064">
- <message_arguments>
- <message_argument value="LaunchHistory"/>
- <message_argument value="AbstractLaunchHistoryAction"/>
- <message_argument value="getLaunchHistory()"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<component id="org.eclipse.debug.ui" version="2"> + <resource path="ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java" type="org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationViewer"> + <filter comment="Known illegal extension" id="571473929"> + <message_arguments> + <message_argument value="TreeViewer"/> + <message_argument value="LaunchConfigurationViewer"/> + </message_arguments> + </filter> + </resource> + <resource path="ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java" type="org.eclipse.debug.internal.ui.preferences.LaunchPerspectivePreferencePage$PerspectivesTreeViewer"> + <filter comment="Known illegal extension" id="571473929"> + <message_arguments> + <message_argument value="TreeViewer"/> + <message_argument value="PerspectivesTreeViewer"/> + </message_arguments> + </filter> + </resource> + <resource path="ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java" type="org.eclipse.debug.internal.ui.sourcelookup.SourceContainerViewer"> + <filter comment="Known illegal extension" id="571473929"> + <message_arguments> + <message_argument value="TreeViewer"/> + <message_argument value="SourceContainerViewer"/> + </message_arguments> + </filter> + </resource> + <resource path="ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ProjectSourceContainerDialog.java" type="org.eclipse.debug.internal.ui.sourcelookup.browsers.ProjectSourceContainerDialog"> + <filter comment="Known illegal extension" id="571473929"> + <message_arguments> + <message_argument value="ListSelectionDialog"/> + <message_argument value="ProjectSourceContainerDialog"/> + </message_arguments> + </filter> + </resource> + <resource path="ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java" type="org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer"> + <filter comment="Known illegal extension for the async viewer support" id="571473929"> + <message_arguments> + <message_argument value="TreeViewer"/> + <message_argument value="InternalTreeModelViewer"/> + </message_arguments> + </filter> + </resource> + <resource path="ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java" type="org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer"> + <filter comment="Known illegal extension" id="571473929"> + <message_arguments> + <message_argument value="CheckboxTreeViewer"/> + <message_argument value="BreakpointsViewer"/> + </message_arguments> + </filter> + </resource> + <resource path="ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java" type="org.eclipse.debug.ui.ILaunchConfigurationTab"> + <filter id="404000815"> + <message_arguments> + <message_argument value="org.eclipse.debug.ui.ILaunchConfigurationTab"/> + <message_argument value="OkToLeaveTab()"/> + </message_arguments> + </filter> + <filter id="404000815"> + <message_arguments> + <message_argument value="org.eclipse.debug.ui.ILaunchConfigurationTab"/> + <message_argument value="postApply()"/> + </message_arguments> + </filter> + </resource> + <resource path="ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java" type="org.eclipse.debug.ui.actions.AbstractLaunchHistoryAction"> + <filter comment="Known leaked internal types" id="576725006"> + <message_arguments> + <message_argument value="ILaunchHistoryChangedListener"/> + <message_argument value="AbstractLaunchHistoryAction"/> + </message_arguments> + </filter> + <filter comment="Known leaked internal types" id="643842064"> + <message_arguments> + <message_argument value="LaunchHistory"/> + <message_argument value="AbstractLaunchHistoryAction"/> + <message_argument value="getLaunchHistory()"/> + </message_arguments> + </filter> + </resource> +</component> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java index f6d809897..04a53eb57 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2017 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 @@ -68,8 +68,11 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Link; +import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IWorkbenchPreferenceConstants; @@ -100,6 +103,11 @@ public class LaunchConfigurationTabGroupViewer { private ILaunchConfigurationWorkingCopy fWorkingCopy; /** + * The old configuration + */ + private boolean fRefreshTabs = false; + + /** * This view's control, which contains a composite area of controls */ private Composite fViewerControl; @@ -316,6 +324,10 @@ public class LaunchConfigurationTabGroupViewer { @Override public void widgetSelected(SelectionEvent evt) { handleApplyPressed(); + ILaunchConfigurationTab[] tabs = getTabs(); + for (ILaunchConfigurationTab tab : tabs) { + tab.postApply(); + } } }); Dialog.applyDialogFont(parent); @@ -373,15 +385,53 @@ public class LaunchConfigurationTabGroupViewer { fTabFolder.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { + int selectedIndex = fTabFolder.indexOf((CTabItem) event.item); if (!fInitializingTabs) { - handleTabSelected(); - refresh(); + handleTabChange(selectedIndex); } + + Display display = fTabFolder.getDisplay(); + display.addListener(SWT.PostEvent, new Listener() { + @Override + public void handleEvent(Event newEvent) { + if (newEvent.detail == SWT.Selection) { // + display.removeListener(SWT.PostEvent, this); + if (fRefreshTabs) { + refreshTabs(true); + fTabFolder.setSelection(selectedIndex); + refreshStatus(); + } + } + } + }); + } }); } } + private void handleTabChange(int newPageIndex) { + if (fCurrentTabIndex == newPageIndex) { + return; + } + if (isDirty() && !fInitializingTabs) { + ILaunchConfigurationTab[] tabs = getTabs(); + if (fCurrentTabIndex != -1) { + ILaunchConfigurationTab tab = tabs[fCurrentTabIndex]; + fTabFolder.setSelection(fCurrentTabIndex); + if (tab.OkToLeaveTab()) { + fTabFolder.setSelection(newPageIndex); + handleTabSelected(); + refresh(); + } + } + } else { + handleTabSelected(); + refresh(); + } + + } + /** * Returns the apply button * @return the 'Apply' button @@ -616,6 +666,42 @@ public class LaunchConfigurationTabGroupViewer { } } } + /* + * Refresh tabs for same input + */ + + public void refreshTabs(boolean refresh) { + if (DebugUIPlugin.getStandardDisplay().getThread().equals(Thread.currentThread())) { + refreshTabs0(refresh); + } else { + DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() { + @Override + public void run() { + refreshTabs0(refresh); + } + }); + } + } + + /** + * The input has changed to the given object, possibly <code>null</code>. + * + * @param input the new input, possibly <code>null</code> + */ + protected void refreshTabs0(boolean refreshTabs) { + final boolean refresh = refreshTabs; + Runnable r = new Runnable() { + @Override + public void run() { + fViewform.setRedraw(false); + fRefreshTabs = !refresh; + displayInstanceTabs(refresh); + refreshStatus(); + fViewform.setRedraw(true); + } + }; + BusyIndicator.showWhile(getShell().getDisplay(), r); + } /** * The input has changed to the given object, possibly <code>null</code>. @@ -631,10 +717,14 @@ public class LaunchConfigurationTabGroupViewer { fViewform.setRedraw(false); if (finput instanceof ILaunchConfiguration) { ILaunchConfiguration configuration = (ILaunchConfiguration)finput; - boolean refreshtabs = !delegatesEqual(fWorkingCopy, configuration); + boolean refreshTabs = true; + if (fWorkingCopy != null && fWorkingCopy.getOriginal().equals(configuration.getWorkingCopy().getOriginal())) { + refreshTabs = false; + } fOriginal = configuration; fWorkingCopy = configuration.getWorkingCopy(); - displayInstanceTabs(refreshtabs); + // Need to refresh all the time as tabs might have changed + displayInstanceTabs(refreshTabs); } else if (finput instanceof ILaunchConfigurationType) { fDescription = getDescription((ILaunchConfigurationType)finput); setNoInput(); @@ -1383,7 +1473,7 @@ public class LaunchConfigurationTabGroupViewer { * * @return the saved launch configuration or <code>null</code> if not saved */ - protected ILaunchConfiguration handleApplyPressed() { + public ILaunchConfiguration handleApplyPressed() { if(fOriginal != null && fOriginal.isReadOnly()) { IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] {fOriginal.getFile()}, fViewerControl.getShell()); if(!status.isOK()) { @@ -1484,10 +1574,12 @@ public class LaunchConfigurationTabGroupViewer { * @param index the index of the tab to display */ public void setActiveTab(int index) { - ILaunchConfigurationTab[] tabs = getTabs(); - if (index >= 0 && index < tabs.length) { - fTabFolder.setSelection(index); - handleTabSelected(); + if (!fTabFolder.isDisposed()) { + ILaunchConfigurationTab[] tabs = getTabs(); + if (index >= 0 && index < tabs.length) { + fTabFolder.setSelection(index); + handleTabSelected(); + } } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java index 4ab262b86..22d5bef2d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2017 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 @@ -931,7 +931,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun * * @return LaunchConfigurationTabGroupViewer */ - protected LaunchConfigurationTabGroupViewer getTabViewer() { + public LaunchConfigurationTabGroupViewer getTabViewer() { return fTabViewer; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java index 3a8551d88..158530f36 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2017 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 @@ -235,5 +235,23 @@ public interface ILaunchConfigurationTab { * @since 3.0 */ public void deactivated(ILaunchConfigurationWorkingCopy workingCopy); + + /** + * Checks if it is OK to leave the Tab. + * + * @return <code>true</code> if OK to leave the tab or <code>false</code> + * @since 3.12 + */ + public default boolean OkToLeaveTab() { + return true; + } + + /** + * Perform the changes after apply. + * + * @since 3.12 + */ + public default void postApply() { + } } |