Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 110684
Collapse All | Expand All

(-)src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java (-1 / +2 lines)
Lines 259-265 Link Here
259
259
260
		hookTitleUpdateListeners(configurer);
260
		hookTitleUpdateListeners(configurer);
261
	}
261
	}
262
262
	
263
	/**
263
	/**
264
	 * Hooks the listeners needed on the window
264
	 * Hooks the listeners needed on the window
265
	 * 
265
	 * 
Lines 543-548 Link Here
543
			page.openEditor(new WelcomeEditorInput(
543
			page.openEditor(new WelcomeEditorInput(
544
					welcomePerspectiveInfos[index]), WELCOME_EDITOR_ID, true);
544
					welcomePerspectiveInfos[index]), WELCOME_EDITOR_ID, true);
545
		}
545
		}
546
		cleanUpEditorArea();
546
	}
547
	}
547
548
548
	/**
549
	/**
(-)Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java (+32 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ui.application;
11
package org.eclipse.ui.application;
12
12
13
import java.util.ArrayList;
13
import org.eclipse.core.runtime.Assert;
14
import org.eclipse.core.runtime.Assert;
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.Status;
16
import org.eclipse.core.runtime.Status;
Lines 21-26 Link Here
21
import org.eclipse.ui.PlatformUI;
22
import org.eclipse.ui.PlatformUI;
22
import org.eclipse.ui.WorkbenchException;
23
import org.eclipse.ui.WorkbenchException;
23
import org.eclipse.ui.actions.ActionFactory;
24
import org.eclipse.ui.actions.ActionFactory;
25
import org.eclipse.ui.internal.EditorAreaHelper;
26
import org.eclipse.ui.internal.PartStack;
27
import org.eclipse.ui.internal.WorkbenchPage;
24
import org.eclipse.ui.internal.WorkbenchWindowConfigurer;
28
import org.eclipse.ui.internal.WorkbenchWindowConfigurer;
25
import org.eclipse.ui.internal.util.PrefUtil;
29
import org.eclipse.ui.internal.util.PrefUtil;
26
import org.eclipse.ui.intro.IIntroManager;
30
import org.eclipse.ui.intro.IIntroManager;
Lines 134-139 Link Here
134
        // do nothing
138
        // do nothing
135
    }
139
    }
136
140
141
	/**
142
	 * Close any empty editor stacks that may have been left open when the
143
	 * Workbench Window shut down. May be called from
144
	 * {@link #postWindowRestore()} in the subclass but is not called by
145
	 * default.
146
	 * 
147
	 * @since 3.7
148
	 */
149
	protected void cleanUpEditorArea() {
150
		// close any empty Editor stacks that may have been left open
151
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=110684
152
		if (getWindowConfigurer() != null && getWindowConfigurer().getWindow() != null
153
				&& getWindowConfigurer().getWindow().getActivePage() != null) {
154
			WorkbenchPage activePage = (WorkbenchPage) getWindowConfigurer().getWindow()
155
					.getActivePage();
156
			EditorAreaHelper editorAreaHelper = activePage.getEditorPresentation();
157
			if (editorAreaHelper != null) {
158
				ArrayList workbooks = editorAreaHelper.getWorkbooks();
159
				for (int i = 0; i < workbooks.size(); i++) {
160
					PartStack editorStack = (PartStack) workbooks.get(i);
161
					if (editorStack.getChildren().length == 0) {
162
						editorStack.getContainer().remove(editorStack);
163
					}
164
				}
165
			}
166
		}
167
	}
168
137
    /**
169
    /**
138
     * Opens the introduction componenet.  
170
     * Opens the introduction componenet.  
139
     * <p>
171
     * <p>

Return to bug 110684