From 05dd5ce963c009959ec7be3905321757e3a96b5e Mon Sep 17 00:00:00 2001 From: Sarika Sinha Date: Tue, 29 Aug 2017 11:17:16 +0530 Subject: Bug 518866 - [9] User should have the ability to define module path and classpath while launching Change-Id: I55dbc85b53d87d5936f9335023ad4385314a53d9 --- .../ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/ui') 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..fb2ccc2c5 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,15 @@ public interface ILaunchConfigurationTab { * @since 3.0 */ public void deactivated(ILaunchConfigurationWorkingCopy workingCopy); + + /** + * Checks if it is OK to leave the Tab. + * + * @return true if OK to leave the tab or false + * @since 3.12 + */ + public default boolean OkToLeaveTab() { + return true; + } } -- cgit v1.2.3 From 54ffa511aed2d6633ff077dd48c8865690e9cc66 Mon Sep 17 00:00:00 2001 From: Sarika Sinha Date: Fri, 1 Sep 2017 15:24:07 +0530 Subject: Bug 518866 - [9] User should have the ability to define module path and classpath while launching Change-Id: I5192082c2076f5a39dbb82e29dec3e747d237aa7 --- org.eclipse.debug.ui/.settings/.api_filters | 6 ++ .../LaunchConfigurationTabGroupViewer.java | 77 ++++++++++++++-------- .../eclipse/debug/ui/ILaunchConfigurationTab.java | 8 +++ 3 files changed, 63 insertions(+), 28 deletions(-) (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/ui') diff --git a/org.eclipse.debug.ui/.settings/.api_filters b/org.eclipse.debug.ui/.settings/.api_filters index e7430a98a..b6cbd924f 100644 --- a/org.eclipse.debug.ui/.settings/.api_filters +++ b/org.eclipse.debug.ui/.settings/.api_filters @@ -55,6 +55,12 @@ + + + + + + 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 d287fec6b..2bb34429e 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 @@ -105,7 +105,7 @@ public class LaunchConfigurationTabGroupViewer { /** * The old configuration */ - private boolean sameInput = false; + private boolean fRefreshTabs = false; /** * This view's control, which contains a composite area of controls @@ -324,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); @@ -392,16 +396,11 @@ public class LaunchConfigurationTabGroupViewer { public void handleEvent(Event newEvent) { if (newEvent.detail == SWT.Selection) { // display.removeListener(SWT.PostEvent, this); - if (sameInput) { - displayInstanceTabs(true); + if (fRefreshTabs) { + refreshTabs(true); fTabFolder.setSelection(selectedIndex); refreshStatus(); } - if (canChangeTab) { - handleTabSelected(); - refresh(); - } - } } }); @@ -411,8 +410,6 @@ public class LaunchConfigurationTabGroupViewer { } } - private boolean canChangeTab = true; - private void handleTabChange(int newPageIndex) { if (fCurrentTabIndex == newPageIndex) { return; @@ -422,13 +419,10 @@ public class LaunchConfigurationTabGroupViewer { if (fCurrentTabIndex != -1) { ILaunchConfigurationTab tab = tabs[fCurrentTabIndex]; fTabFolder.setSelection(fCurrentTabIndex); - if (!tab.OkToLeaveTab()) { - canChangeTab = false; - - } - else { - canChangeTab = true; + if (tab.OkToLeaveTab()) { fTabFolder.setSelection(newPageIndex); + handleTabSelected(); + refresh(); } } } else { @@ -667,11 +661,48 @@ public class LaunchConfigurationTabGroupViewer { } inputChanged(input); } else { - // Input needs to be changed even if same for Tab initializations - inputChanged(input); + if (!input.equals(getConfiguration())) { + inputChanged(input); + } + } + } + /* + * 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 null. + * + * @param input the new input, possibly null + */ + 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 null. * @@ -688,10 +719,7 @@ public class LaunchConfigurationTabGroupViewer { ILaunchConfiguration configuration = (ILaunchConfiguration)finput; boolean refreshTabs = true; if (fWorkingCopy != null && fWorkingCopy.getOriginal().equals(configuration.getWorkingCopy().getOriginal())) { - sameInput = true; refreshTabs = false; - } else { - sameInput = false; } fOriginal = configuration; fWorkingCopy = configuration.getWorkingCopy(); @@ -1452,13 +1480,6 @@ public class LaunchConfigurationTabGroupViewer { return null; } } - ILaunchConfigurationTab[] tabs = getTabs(); - if (fCurrentTabIndex != -1) { - ILaunchConfigurationTab tab = tabs[fCurrentTabIndex]; - if (!tab.OkToLeaveTab()) { - return null; - } - } Exception exception = null; final ILaunchConfiguration[] saved = new ILaunchConfiguration[1]; try { 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 fb2ccc2c5..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 @@ -245,5 +245,13 @@ public interface ILaunchConfigurationTab { public default boolean OkToLeaveTab() { return true; } + + /** + * Perform the changes after apply. + * + * @since 3.12 + */ + public default void postApply() { + } } -- cgit v1.2.3