RCP 视图最大化

findLeftViewStack(CurrentDealView.ID).setMinimized(true);
public static ViewStack findLeftViewStack(String id) {
		LayoutPart relativepart = ((WorkbenchPage) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage())
				.getPerspectivePresentation().findPart(id, null);
		return findViewStack(relativepart);
	}

	private static ViewStack findViewStack(LayoutPart relativepart) {
		if (relativepart instanceof ContainerPlaceholder) {
			ViewStack stack = (ViewStack) ((ContainerPlaceholder) relativepart).getRealContainer();
			return stack;
		} else if (relativepart instanceof PartPlaceholder) {
			ILayoutContainer content = relativepart.getContainer();
			return findViewStack(content);
		} else if (relativepart != null && relativepart.getContainer() instanceof ViewStack)
			return (ViewStack) relativepart.getContainer();
		return null;
	}

	private static ViewStack findViewStack(ILayoutContainer content) {
		if (content instanceof ContainerPlaceholder) {
			ViewStack stack = (ViewStack) ((ContainerPlaceholder) content).getRealContainer();
			return stack;
		} else if (content instanceof PartPlaceholder) {
			return findViewStack(((PartPlaceholder) content).getContainer());
		} else if (content instanceof ViewStack) {
			return (ViewStack) content;
		}
		return null;
	}


if (part != null) {
			iworkbenchpage.activate(part);
			iworkbenchpage.bringToTop(part);

			WorkbenchPage realPage = (WorkbenchPage) iworkbenchpage;

			IWorkbenchPartReference partRef = iworkbenchpage
					.getActivePartReference();
			
			
			
			
			if (partRef != null) {
				realPage.toggleZoom(partRef);
			} else {
				System.out.println("partRef is null!");
			}
		}

你可能感兴趣的:(java)