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 213645
Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/FastViewManager.java (-7 / +67 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Carlos Devoto carlos.devoto@compuware.com Bug 213645
10
 *     Markus Alexander Kuppe, Versant Corporation - bug #215797
11
 *     Markus Alexander Kuppe, Versant Corporation - bug #215797
11
 *******************************************************************************/
12
 *******************************************************************************/
12
13
Lines 543-553 Link Here
543
		//long startTick = System.currentTimeMillis();
544
		//long startTick = System.currentTimeMillis();
544
		// Update the model first
545
		// Update the model first
545
		List toMove = getTrueViewOrder(vs);
546
		List toMove = getTrueViewOrder(vs);
546
		for (Iterator viewIter = toMove.iterator(); viewIter.hasNext();) {
547
		if (toMove.isEmpty()) {
547
			IViewReference ref = (IViewReference) viewIter.next();
548
			// We are dealing with an empty durable ViewStack; hide it!
548
			addViewReference(vs.getID(), -1, ref, false);
549
			vs.dispose();
550
			ILayoutContainer parentContainer = vs.getContainer();
551
			ContainerPlaceholder placeholder = new ContainerPlaceholder(vs
552
					.getID());
553
            placeholder.setRealContainer(vs);
554
			parentContainer.replace(vs, placeholder);
555
			
556
		} else {
557
			for (Iterator viewIter = toMove.iterator(); viewIter.hasNext();) {
558
				IViewReference ref = (IViewReference) viewIter.next();
559
				addViewReference(vs.getID(), -1, ref, false);
560
			}
549
		}
561
		}
550
551
		vs.deferUpdates(false);
562
		vs.deferUpdates(false);
552
		
563
		
553
		// Find (or create) the trim stack to move to
564
		// Find (or create) the trim stack to move to
Lines 555-563 Link Here
555
				.calcStackSide(stackBounds), paneOrientation);
566
				.calcStackSide(stackBounds), paneOrientation);
556
		vstb.setRestoreOnUnzoom(restoreOnUnzoom);
567
		vstb.setRestoreOnUnzoom(restoreOnUnzoom);
557
		vstb.setSelectedTabId(selId);
568
		vstb.setSelectedTabId(selId);
558
		updateTrim(vstb.getId());
569
		if (toMove.isEmpty()) {
559
		
570
			// We are dealing with an empty durable ViewStack; show the trim!
560
		//System.out.println("minimize time: " + (System.currentTimeMillis()-startTick)); //$NON-NLS-1$
571
			IWindowTrim trim = vstb;
572
573
			// Ensure that the trim is displayed
574
			if (!trim.getControl().getVisible()) {
575
				tbm.setTrimVisible(trim, true);
576
			}
577
578
			if (trim instanceof FastViewBar) {
579
				FastViewBar fvb = (FastViewBar) trim;
580
				fvb.update(true);
581
			} else if (trim instanceof ViewStackTrimToolBar) {
582
				vstb.update(true);
583
				vstb.getControl().pack();
584
				LayoutUtil.resize(trim.getControl());
585
			}
586
			tbm.forceLayout();
587
		} else {
588
	        updateTrim(vstb.getId());
589
		}
590
591
	    //System.out.println("minimize time: " + (System.currentTimeMillis()-startTick)); //$NON-NLS-1$
561
		if (vstb != null) {
592
		if (vstb != null) {
562
			animation.addEndRect(vstb.getControl());
593
			animation.addEndRect(vstb.getControl());
563
			scheduleDeferrableAnimation();
594
			scheduleDeferrableAnimation();
Lines 591-596 Link Here
591
			secondaryId = idParts[1];
622
			secondaryId = idParts[1];
592
		
623
		
593
		List fvs = getFastViews(id);
624
		List fvs = getFastViews(id);
625
		if (fvs.isEmpty()) {
626
			// We are dealing with a durable view stack that is currently empty, so execute special logic to restore it from the minimized state
627
            LayoutPart part = perspective.getPresentation().findPart(id, null);	
628
            if (part instanceof ContainerPlaceholder) {
629
                ContainerPlaceholder containerPlaceholder = (ContainerPlaceholder) part;                        
630
                ILayoutContainer parentContainer = containerPlaceholder
631
                        .getContainer();
632
                ILayoutContainer container = (ILayoutContainer) containerPlaceholder
633
                        .getRealContainer();
634
                if (container instanceof LayoutPart) {
635
                    parentContainer.replace(containerPlaceholder,
636
                            (LayoutPart) container);
637
                }
638
                containerPlaceholder.setRealContainer(null);
639
                IWindowTrim trim = tbm.getTrim(id);
640
641
        		// If it's not there there's not much we can do
642
        		if (trim == null)
643
        			return;
644
645
        		// Hide the trim
646
				if (trim.getControl().getVisible()) {
647
					tbm.setTrimVisible(trim, false);
648
					tbm.forceLayout();
649
				}
650
            }
651
            return;
652
		} 
653
		
594
		for (Iterator fvIter = fvs.iterator(); fvIter.hasNext();) {
654
		for (Iterator fvIter = fvs.iterator(); fvIter.hasNext();) {
595
			IViewReference ref = (IViewReference) fvIter.next();
655
			IViewReference ref = (IViewReference) fvIter.next();
596
			removeViewReference(ref, true, !fvIter.hasNext());
656
			removeViewReference(ref, true, !fvIter.hasNext());
(-)Eclipse UI/org/eclipse/ui/internal/ViewStack.java (+28 lines)
Lines 9-14 Link Here
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Cagatay Kavukcuoglu <cagatayk@acm.org>
10
 *     Cagatay Kavukcuoglu <cagatayk@acm.org>
11
 *     - Fix for bug 10025 - Resizing views should not use height ratios
11
 *     - Fix for bug 10025 - Resizing views should not use height ratios
12
 *     Carlos Devoto carlos.devoto@compuware.com Bug 213645
12
 *******************************************************************************/
13
 *******************************************************************************/
13
package org.eclipse.ui.internal;
14
package org.eclipse.ui.internal;
14
15
Lines 49-54 Link Here
49
50
50
    private SystemMenuDetach detachViewAction;
51
    private SystemMenuDetach detachViewAction;
51
52
53
	private boolean durable = false;
54
52
    public void addSystemActions(IMenuManager menuManager) {
55
    public void addSystemActions(IMenuManager menuManager) {
53
        appendToGroupIfPossible(menuManager,
56
        appendToGroupIfPossible(menuManager,
54
                "misc", new UpdatingActionContributionItem(fastViewAction)); //$NON-NLS-1$
57
                "misc", new UpdatingActionContributionItem(fastViewAction)); //$NON-NLS-1$
Lines 134-140 Link Here
134
		if (Perspective.useNewMinMax(persp)) {
137
		if (Perspective.useNewMinMax(persp)) {
135
			FastViewManager fvm = persp.getFastViewManager();
138
			FastViewManager fvm = persp.getFastViewManager();
136
			if (minimized) {
139
			if (minimized) {
140
				// Need to temporarily set the durability attribute to false or we won't be able to minimized the folder
141
				boolean tempDurable = durable;
142
				durable = false; 
137
				fvm.moveToTrim(this, false);
143
				fvm.moveToTrim(this, false);
144
				// Restore the durability attribute to its previous value
145
				durable = tempDurable;
138
			} else {
146
			} else {
139
				// First, if we're maximized then revert
147
				// First, if we're maximized then revert
140
				if (persp.getPresentation().getMaximizedStack() != null) {
148
				if (persp.getPresentation().getMaximizedStack() != null) {
Lines 199-202 Link Here
199
    public StackPresentation getTestPresentation() {
207
    public StackPresentation getTestPresentation() {
200
    	return getPresentation();
208
    	return getPresentation();
201
    }
209
    }
210
211
	/**
212
	 * Set the durability attribute for this stack. The stack's durability determines
213
	 * whether or not the stack remains visible after its last child is closed.
214
	 * 
215
	 * @param durable If true, the stack remains visible after its last child is closed
216
	 */
217
	public void setDurable(boolean durable) {
218
        this.durable  = durable;		
219
	}
220
	
221
	/**
222
	 * Get the durability attribute for this stack. The stack's durability determines
223
	 * whether or not the stack remains visible after its last child is closed.
224
	 * 
225
	 * @return true, if the stack remains visible when its last child is closed; false otherwise
226
	 */
227
	public boolean getDurable () {
228
		return this.durable;
229
	}
202
}
230
}
(-)Eclipse UI/org/eclipse/ui/internal/PerspectiveHelper.java (-8 / +13 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Carlos Devoto carlos.devoto@compuware.com Bug 213645
10
 *     Marco Maccaferri, maccasoft.com - patch for defect 222750
11
 *     Marco Maccaferri, maccasoft.com - patch for defect 222750
11
 *******************************************************************************/
12
 *******************************************************************************/
12
13
Lines 767-775 Link Here
767
                }
768
                }
768
            }
769
            }
769
770
770
            if (!hasChildren) {
771
            if (!hasChildren && !(oldContainer instanceof ViewStack && ((ViewStack)oldContainer).getDurable())) {
771
                // There are no more children in this container, so get rid of
772
                // There are no more children in this container, so get rid of
772
                // it
773
                // it (but only if the container is not a durable ViewStack)
773
                if (oldContainer instanceof LayoutPart) {
774
                if (oldContainer instanceof LayoutPart) {
774
                    LayoutPart parent = (LayoutPart) oldContainer;
775
                    LayoutPart parent = (LayoutPart) oldContainer;
775
                    ILayoutContainer parentContainer = parent.getContainer();
776
                    ILayoutContainer parentContainer = parent.getContainer();
Lines 1233-1244 Link Here
1233
            LayoutPart[] children = container.getChildren();
1234
            LayoutPart[] children = container.getChildren();
1234
            if (children != null) {
1235
            if (children != null) {
1235
                boolean allInvisible = true;
1236
                boolean allInvisible = true;
1236
                for (int i = 0, length = children.length; i < length; i++) {
1237
                if (container instanceof ViewStack && !((ViewStack) container).isMinimized && ((ViewStack) container).getDurable()) {
1237
                    if (!(children[i] instanceof PartPlaceholder)) {
1238
                	allInvisible = false;
1238
                        allInvisible = false;
1239
                } else {
1239
                        break;
1240
					for (int i = 0, length = children.length; i < length; i++) {
1240
                    }
1241
						if (!(children[i] instanceof PartPlaceholder)) {
1241
                }
1242
							allInvisible = false;
1243
							break;
1244
						}
1245
					}
1246
				}
1242
                if (allInvisible && (container instanceof LayoutPart)) {
1247
                if (allInvisible && (container instanceof LayoutPart)) {
1243
                    // what type of window are we in?
1248
                    // what type of window are we in?
1244
                    LayoutPart cPart = (LayoutPart) container;
1249
                    LayoutPart cPart = (LayoutPart) container;
(-)Eclipse UI/org/eclipse/ui/internal/PageLayout.java (+7 lines)
Lines 480-485 Link Here
480
        // Create the folder.
480
        // Create the folder.
481
        ViewStack folder = new ViewStack(rootLayoutContainer.page);
481
        ViewStack folder = new ViewStack(rootLayoutContainer.page);
482
        folder.setID(folderId);
482
        folder.setID(folderId);
483
484
		if (getDescriptor() != null
485
				&& viewFactory.getWorkbenchPage().window.getWindowAdvisor()
486
						.isDurableFolder(getDescriptor().getId(), folderId)) {
487
			folder.setDurable(true);
488
		}
489
        
483
        addPart(folder, folderId, relationship, ratio, refId);
490
        addPart(folder, folderId, relationship, ratio, refId);
484
491
485
        // Create a wrapper.
492
        // Create a wrapper.
(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java (-2 / +2 lines)
Lines 3424-3436 Link Here
3424
	/**
3424
	/**
3425
	 * Returns the window advisor, creating a new one for this window if needed.
3425
	 * Returns the window advisor, creating a new one for this window if needed.
3426
	 * <p>
3426
	 * <p>
3427
	 * IMPORTANT This method is declared private to prevent regular plug-ins
3427
	 * IMPORTANT This method is declared package private to prevent regular plug-ins
3428
	 * from downcasting IWorkbenchWindow to WorkbenchWindow and getting hold of
3428
	 * from downcasting IWorkbenchWindow to WorkbenchWindow and getting hold of
3429
	 * the window advisor that would allow them to tamper with the window. The
3429
	 * the window advisor that would allow them to tamper with the window. The
3430
	 * window advisor is internal to the application.
3430
	 * window advisor is internal to the application.
3431
	 * </p>
3431
	 * </p>
3432
	 */
3432
	 */
3433
	private/* private - DO NOT CHANGE */
3433
	/* package private - DO NOT CHANGE */
3434
	WorkbenchWindowAdvisor getWindowAdvisor() {
3434
	WorkbenchWindowAdvisor getWindowAdvisor() {
3435
		if (windowAdvisor == null) {
3435
		if (windowAdvisor == null) {
3436
			windowAdvisor = getAdvisor().createWorkbenchWindowAdvisor(
3436
			windowAdvisor = getAdvisor().createWorkbenchWindowAdvisor(
(-)Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java (+15 lines)
Lines 282-287 Link Here
282
    public Control createEmptyWindowContents(Composite parent) {
282
    public Control createEmptyWindowContents(Composite parent) {
283
        return null;
283
        return null;
284
    }
284
    }
285
    
286
    /**
287
     * Returns <code>true</code> if the given folder in the given perspective should remain visible even after all
288
     * parts in it have been closed by the user. The default is <code>false</code>. The return value for a certain
289
     * combination of perspective id and folder id must not change over time.
290
     * 
291
     * @param perspectiveId the perspective id
292
     * @param folderId the folder id
293
     * @return <code>true</code> if the given folder should be durable
294
     * 
295
     * @since 3.5 
296
     */
297
    public boolean isDurableFolder(String perspectiveId, String folderId) {
298
    	return false;
299
    }
285
300
286
    /**
301
    /**
287
     * Disposes any resources allocated by this window advisor.
302
     * Disposes any resources allocated by this window advisor.

Return to bug 213645