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 56431 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/FolderLayout.java (-6 / +9 lines)
Lines 53-64 Link Here
53
			return;
53
			return;
54
54
55
		// Get the view's label.
55
		// Get the view's label.
56
		IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
56
		// @issue: why do we need to ask the registry for the view??
57
		IViewDescriptor desc = reg.find(viewId);
57
		if (viewId.indexOf("*") == -1) { //$NON-NLS-1$
58
		if (desc == null) {
58
			IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
59
			// cannot safely open the dialog so log the problem
59
			IViewDescriptor desc = reg.find(viewId);
60
			WorkbenchPlugin.log("Unable to find view label: " + viewId); //$NON-NLS-1$
60
			if (desc == null) {
61
			return;
61
				// cannot safely open the dialog so log the problem
62
				WorkbenchPlugin.log("Unable to find view label: " + viewId); //$NON-NLS-1$
63
				return;
64
			}
62
		}
65
		}
63
66
64
		// Create the placeholder.
67
		// Create the placeholder.
(-)Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java (-4 / +23 lines)
Lines 226-236 Link Here
226
 * Adds the child using ratio and position attributes
226
 * Adds the child using ratio and position attributes
227
 * from the specified placeholder without replacing
227
 * from the specified placeholder without replacing
228
 * the placeholder
228
 * the placeholder
229
 * 
230
 * FIXME: I believe there is a bug in computeRelation()
231
 * when a part is positioned relative to the editorarea.
232
 * We end up with a null relative and 0.0 for a ratio.
229
 */
233
 */
230
void addChildForPlaceholder(LayoutPart part, LayoutPart placeholder) {
234
void addChildForPlaceholder(LayoutPart child, LayoutPart placeholder) {
231
	//FIXME we need to get the relation and ratio 
235
	RelationshipInfo newRelationshipInfo = new RelationshipInfo();
232
	// from the placholder
236
	newRelationshipInfo.part = child;
233
	add(part, SWT.RIGHT, 0.5f, placeholder);
237
	if(root != null) {
238
		findPosition(newRelationshipInfo);
239
	}
240
	
241
	// find the relationship info for the placeholder
242
	RelationshipInfo[] relationships = computeRelation();
243
	for (int i = 0; i < relationships.length; i ++) {
244
		RelationshipInfo info = relationships[i];
245
		if (info.part == placeholder) {
246
			newRelationshipInfo.ratio = info.ratio;
247
			newRelationshipInfo.relationship = info.relationship;
248
			newRelationshipInfo.relative = info.relative;
249
		}
250
	}
251
	
252
	addChild(newRelationshipInfo);	
234
	root.updateSashes(parent);
253
	root.updateSashes(parent);
235
	resizeSashes(parent.getClientArea());
254
	resizeSashes(parent.getClientArea());
236
}
255
}
(-)Eclipse UI/org/eclipse/ui/internal/Perspective.java (-26 / +18 lines)
Lines 484-490 Link Here
484
 * @since 3.0
484
 * @since 3.0
485
 */
485
 */
486
public boolean isFixedView(IViewReference ref) {
486
public boolean isFixedView(IViewReference ref) {
487
	return fixedViews.contains(ref.getId());
487
	// check for secondaryId
488
	String id = ref.getId();
489
	if (ref.getSecondaryId() != null)
490
		id += ":"+ref.getSecondaryId(); //$NON-NLS-1$
491
	return fixedViews.contains(id);
488
}
492
}
489
/**
493
/**
490
 * Returns true if a layout or perspective is fixed.
494
 * Returns true if a layout or perspective is fixed.
Lines 814-820 Link Here
814
			ref.setPane(vp);
818
			ref.setPane(vp);
815
		}
819
		}
816
		page.addPart(ref);
820
		page.addPart(ref);
817
		if(pres.willPartBeVisible(ref.getId())) {
821
		boolean willPartBeVisible = (secondaryId != null) ? 
822
				pres.willPartBeVisible(ref.getId(), secondaryId) : 
823
				pres.willPartBeVisible(ref.getId());
824
		if(willPartBeVisible) {
818
			IStatus restoreStatus = viewFactory.restoreView((IViewReference)ref);
825
			IStatus restoreStatus = viewFactory.restoreView((IViewReference)ref);
819
			result.add(restoreStatus);
826
			result.add(restoreStatus);
820
			if(restoreStatus.getSeverity() == IStatus.OK) {
827
			if(restoreStatus.getSeverity() == IStatus.OK) {
Lines 840-845 Link Here
840
			// Get the view details.
847
			// Get the view details.
841
			IMemento childMem = views[x];
848
			IMemento childMem = views[x];
842
			String viewID = childMem.getString(IWorkbenchConstants.TAG_ID);
849
			String viewID = childMem.getString(IWorkbenchConstants.TAG_ID);
850
			String secondaryId = childMem.getString(IWorkbenchConstants.TAG_SECONDARY_ID);
843
			Float ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO);
851
			Float ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO);
844
			if (ratio == null) {
852
			if (ratio == null) {
845
				Integer viewWidth = childMem.getInteger(IWorkbenchConstants.TAG_WIDTH);
853
				Integer viewWidth = childMem.getInteger(IWorkbenchConstants.TAG_WIDTH);
Lines 848-861 Link Here
848
				else
856
				else
849
					ratio = new Float((float)viewWidth.intValue() / (float)getClientComposite().getSize().x);
857
					ratio = new Float((float)viewWidth.intValue() / (float)getClientComposite().getSize().x);
850
			}
858
			}
859
			// FIXME: this needs to work with mutliple view instances
851
			mapFastViewToWidthRatio.put(viewID, ratio);
860
			mapFastViewToWidthRatio.put(viewID, ratio);
852
				
861
				
853
			WorkbenchPartReference ref = (WorkbenchPartReference) viewFactory.getView(viewID);
862
			WorkbenchPartReference ref = (WorkbenchPartReference) viewFactory.getView(viewID, secondaryId);
854
			if(ref == null) {
863
			if(ref == null) {
855
				WorkbenchPlugin.log("Could not create view: '" + viewID + "'."); //$NON-NLS-1$ //$NON-NLS-2$
864
				String logId = (secondaryId!=null) ? viewID +":"+secondaryId : viewID;
865
				WorkbenchPlugin.log("Could not create view: '" + logId + "'."); //$NON-NLS-1$ //$NON-NLS-2$
856
				result.add(new Status(
866
				result.add(new Status(
857
					Status.ERROR,PlatformUI.PLUGIN_ID,0,
867
					Status.ERROR,PlatformUI.PLUGIN_ID,0,
858
					WorkbenchMessages.format("Perspective.couldNotFind", new String[]{viewID}), //$NON-NLS-1$
868
					WorkbenchMessages.format("Perspective.couldNotFind", new String[]{logId}), //$NON-NLS-1$
859
					null));
869
					null));
860
				continue;
870
				continue;
861
			}
871
			}
Lines 879-905 Link Here
879
			IMemento childMem = views[x];
889
			IMemento childMem = views[x];
880
			String viewID = childMem.getString(IWorkbenchConstants.TAG_ID);
890
			String viewID = childMem.getString(IWorkbenchConstants.TAG_ID);
881
			
891
			
882
			WorkbenchPartReference ref = (WorkbenchPartReference) viewFactory.getView(viewID);
892
			// we don't really need to create a view here
883
			if(ref == null) {
893
			// we are just adding it to a list
884
				WorkbenchPlugin.log("Could not create view: '" + viewID + "'."); //$NON-NLS-1$ //$NON-NLS-2$
894
			fixedViews.add(viewID);
885
				result.add(new Status(
886
						Status.ERROR,PlatformUI.PLUGIN_ID,0,
887
						WorkbenchMessages.format("Perspective.couldNotFind", new String[]{viewID}), //$NON-NLS-1$
888
						null));
889
				continue;
890
			}
891
			// Add to fixed view list because creating a view pane
892
			// will come back to check if its a fast view. We really
893
			// need to clean up this code.
894
			
895
			//@issue see directly above, also I don't think we need
896
			// to actually restore the view bleow, probably shouldn't
897
			// throw the error above either
898
			fixedViews.add(ref.getId());
899
//			if(ref.getPane() == null) {
900
//				ref.setPane(new ViewPane((IViewReference)ref,page));
901
//			}
902
//			page.addPart(ref);
903
		}
895
		}
904
	}
896
	}
905
		
897
		
(-)Eclipse UI/org/eclipse/ui/internal/PerspectivePresentation.java (-33 / +22 lines)
Lines 330-336 Link Here
330
	 * folder.
330
	 * folder.
331
	 */
331
	 */
332
	public boolean willPartBeVisible(String partId) {
332
	public boolean willPartBeVisible(String partId) {
333
		LayoutPart part = findPart(partId);
333
		return willPartBeVisible(partId, null);
334
	}
335
	public boolean willPartBeVisible(String partId, String secondaryId) {
336
		LayoutPart part = findPart(partId, secondaryId);
334
		if (part == null)
337
		if (part == null)
335
			return false;
338
			return false;
336
		ILayoutContainer container = part.getContainer();
339
		ILayoutContainer container = part.getContainer();
Lines 742-769 Link Here
742
	 * Wild cards now supported.
745
	 * Wild cards now supported.
743
	 */
746
	 */
744
	private LayoutPart findPart(String id) {
747
	private LayoutPart findPart(String id) {
745
		// Check main window.
748
		String myNull = null;
746
		LayoutPart part = findPart(id, mainLayout.getChildren());
749
		return findPart(id, myNull);
747
		if (part != null)
748
			return part;
749
750
		// Check each detached windows
751
		for (int i = 0, length = detachedWindowList.size(); i < length; i++) {
752
			DetachedWindow window = (DetachedWindow) detachedWindowList.get(i);
753
			part = findPart(id, window.getChildren());
754
			if (part != null)
755
				return part;
756
		}
757
		for (int i = 0; i < detachedPlaceHolderList.size(); i++) {
758
			DetachedPlaceHolder holder =
759
				(DetachedPlaceHolder) detachedPlaceHolderList.get(i);
760
			part = findPart(id, holder.getChildren());
761
			if (part != null)
762
				return part;
763
		}
764
765
		// Not found.
766
		return null;
767
	}
750
	}
768
	/**
751
	/**
769
	 * Find the first part that matches the specified 
752
	 * Find the first part that matches the specified 
Lines 772-792 Link Here
772
	 */
755
	 */
773
	private LayoutPart findPart(String primaryId, String secondaryId) {
756
	private LayoutPart findPart(String primaryId, String secondaryId) {
774
		// check main window.
757
		// check main window.
775
		LayoutPart part = findPart(primaryId, secondaryId, mainLayout.getChildren());
758
		LayoutPart part = (secondaryId != null) ? 
759
				findPart(primaryId, secondaryId, mainLayout.getChildren()) : 
760
				findPart(primaryId, mainLayout.getChildren());
776
		if (part != null)
761
		if (part != null)
777
			return part;
762
			return part;
778
763
779
		// check each detached windows.
764
		// check each detached windows.
780
		for (int i = 0, length = detachedWindowList.size(); i < length; i++) {
765
		for (int i = 0, length = detachedWindowList.size(); i < length; i++) {
781
			DetachedWindow window = (DetachedWindow) detachedWindowList.get(i);
766
			DetachedWindow window = (DetachedWindow) detachedWindowList.get(i);
782
			part = findPart(primaryId, secondaryId, window.getChildren());
767
			part = (secondaryId != null) ? 
768
					findPart(primaryId, secondaryId, window.getChildren()) :
769
					findPart(primaryId, window.getChildren());
783
			if (part != null)
770
			if (part != null)
784
				return part;
771
				return part;
785
		}
772
		}
786
		for (int i = 0; i < detachedPlaceHolderList.size(); i++) {
773
		for (int i = 0; i < detachedPlaceHolderList.size(); i++) {
787
			DetachedPlaceHolder holder =
774
			DetachedPlaceHolder holder =
788
				(DetachedPlaceHolder) detachedPlaceHolderList.get(i);
775
				(DetachedPlaceHolder) detachedPlaceHolderList.get(i);
789
			part = findPart(primaryId, secondaryId, holder.getChildren());
776
			part = (secondaryId != null) ? 
777
					findPart(primaryId, secondaryId, holder.getChildren()) :
778
					findPart(primaryId, holder.getChildren()) ;
790
			if (part != null)
779
			if (part != null)
791
				return part;
780
				return part;
792
		}
781
		}
Lines 809-816 Link Here
809
		MatchingPart currentMatchingPart = null;
798
		MatchingPart currentMatchingPart = null;
810
		for (int i = 0, length = parts.length; i < length; i++) {
799
		for (int i = 0, length = parts.length; i < length; i++) {
811
			LayoutPart part = parts[i];
800
			LayoutPart part = parts[i];
801
			// check for part equality, parts with secondary ids fail
812
			if (part.getID().equals(id)) {
802
			if (part.getID().equals(id)) {
813
				// parts with a secondary id do not match in this case
814
				if (part instanceof ViewPane) {
803
				if (part instanceof ViewPane) {
815
					ViewPane pane = (ViewPane) part;
804
					ViewPane pane = (ViewPane) part;
816
					IViewReference ref = (IViewReference)pane.getPartReference();
805
					IViewReference ref = (IViewReference)pane.getPartReference();
Lines 818-834 Link Here
818
						continue;
807
						continue;
819
				}
808
				}
820
				return part;
809
				return part;
821
			} 
810
			}
822
			else if (part.getID().indexOf(WILD_CARD) != -1) {
811
			// check pattern matching placeholders
812
			else if (part instanceof PartPlaceholder && part.getID().indexOf(WILD_CARD) != -1) {
823
				StringMatcher sm = new StringMatcher(part.getID(), true, false);
813
				StringMatcher sm = new StringMatcher(part.getID(), true, false);
824
				MatchingPart matchingPart;
814
				MatchingPart matchingPart;
825
				if (sm.match(id)) {
815
				if (sm.match(id)) {
826
					matchingPart = new MatchingPart(part.getID(), null, part);
816
					matchingPart = new MatchingPart(part.getID(), null, part);
827
					if (currentMatchingPart != null && 
817
					if (currentMatchingPart == null)
828
							matchingPart.pid.length() > currentMatchingPart.pid.length())
829
						currentMatchingPart = matchingPart;	
830
					else
831
						currentMatchingPart = matchingPart;
818
						currentMatchingPart = matchingPart;
819
					else if (matchingPart.pid.length() > currentMatchingPart.pid.length())
820
						currentMatchingPart = matchingPart;							
832
				}
821
				}
833
			}
822
			}
834
			else if (part instanceof EditorArea) {
823
			else if (part instanceof EditorArea) {

Return to bug 56431