Package org.eclipse.ui

Examples of org.eclipse.ui.IViewReference


        // Retrieve fast views
        if (fastViewManager != null) {
          ArrayList fastViews = layout.getFastViews();
          for (Iterator fvIter = fastViews.iterator(); fvIter.hasNext();) {
        IViewReference ref = (IViewReference) fvIter.next();
        fastViewManager.addViewReference(FastViewBar.FASTVIEWBAR_ID, -1, ref,
            !fvIter.hasNext());
      }
        }
View Full Code Here


            if (id.equals(IIntroConstants.INTRO_VIEW_ID)) {
        continue;
      }
           
            // Create and open the view.
            IViewReference viewRef = viewFactory.getView(id, secondaryId);
            WorkbenchPartReference ref = (WorkbenchPartReference) viewRef;

            // report error
            if (ref == null) {
                String key = ViewFactory.getKey(id, secondaryId);
View Full Code Here

        String secondaryId = ViewFactory.extractSecondaryId(viewID);
        if (secondaryId != null) {
            viewID = ViewFactory.extractPrimaryId(viewID);
        }

        IViewReference viewRef = getViewReference(viewID, secondaryId);
        if (viewRef == null) {
            String key = ViewFactory.getKey(viewID, secondaryId);
            WorkbenchPlugin
                    .log("Could not create view: '" + key + "'."); //$NON-NLS-1$ //$NON-NLS-2$
            result
View Full Code Here

        // Save the views.
        itr = viewPanes.iterator();
        int errors = 0;
        while (itr.hasNext()) {
            ViewPane pane = (ViewPane) itr.next();
            IViewReference ref = pane.getViewReference();
            IMemento viewMemento = memento
                    .createChild(IWorkbenchConstants.TAG_VIEW);
            viewMemento.putString(IWorkbenchConstants.TAG_ID, ViewFactory
                    .getKey(ref));
        }
View Full Code Here

     *
     * @return The reference to the specified view. This may be null if the
     * view fails to create (i.e. thrown a PartInitException)
     */
    public IViewReference getViewReference(String viewId, String secondaryId) {
      IViewReference ref = page.findViewReference(viewId, secondaryId);
      if (ref == null) {
            ViewFactory factory = getViewFactory();
            try {
        ref = factory.createView(viewId, secondaryId);
      } catch (PartInitException e) {
View Full Code Here

     * Shows the view with the given id and secondary id.
     */
    public IViewPart showView(String viewId, String secondaryId)
            throws PartInitException {
        ViewFactory factory = getViewFactory();
        IViewReference ref = factory.createView(viewId, secondaryId);
        IViewPart part = (IViewPart) ref.getPart(true);
        if (part == null) {
            throw new PartInitException(NLS.bind(WorkbenchMessages.ViewFactory_couldNotCreate, ref.getId()));
        }
        ViewSite site = (ViewSite) part.getSite();
        ViewPane pane = (ViewPane) site.getPane();

        IPreferenceStore store = WorkbenchPlugin.getDefault()
                .getPreferenceStore();
        int openViewMode = store.getInt(IPreferenceConstants.OPEN_VIEW_MODE);

        if (openViewMode == IPreferenceConstants.OVM_FAST &&
          fastViewManager != null) {
          fastViewManager.addViewReference(FastViewBar.FASTVIEWBAR_ID, -1, ref, true);
            setActiveFastView(ref);
        } else if (openViewMode == IPreferenceConstants.OVM_FLOAT
                && presentation.canDetach()) {
            presentation.addDetachedPart(pane);
        } else {
          if (useNewMinMax(this)) {
              // Is this view going to show in the trim?
              LayoutPart vPart = presentation.findPart(viewId, secondaryId);

              // Determine if there is a trim stack that should get the view
              String trimId = null;
             
              // If we can locate the correct trim stack then do so
              if (vPart != null) {
                String id = null;
                ILayoutContainer container = vPart.getContainer();
                if (container instanceof ContainerPlaceholder)
                  id = ((ContainerPlaceholder)container).getID();
                else if (container instanceof ViewStack)
                  id = ((ViewStack)container).getID();
               
                // Is this place-holder in the trim?
                    if (id != null && fastViewManager.getFastViews(id).size() > 0) {
                      trimId = id;
                    }
              }
             
              // No explicit trim found; If we're maximized then we either have to find an
              // arbitrary stack...
              if (trimId == null && presentation.getMaximizedStack() != null) {
                if (vPart == null) {
                  ViewStackTrimToolBar blTrimStack = fastViewManager.getBottomRightTrimStack();
                  if (blTrimStack != null) {
                    // OK, we've found a trim stack to add it to...
                    trimId = blTrimStack.getId();
                   
                    // Since there was no placeholder we have to add one
                    LayoutPart blPart = presentation.findPart(trimId, null);
                    if (blPart instanceof ContainerPlaceholder) {
                      ContainerPlaceholder cph = (ContainerPlaceholder) blPart;
                      if (cph.getRealContainer() instanceof ViewStack) {
                        ViewStack vs = (ViewStack) cph.getRealContainer();
                       
                        // Create a 'compound' id if this is a multi-instance part
                        String compoundId = ref.getId();
                        if (ref.getSecondaryId() != null)
                          compoundId = compoundId + ':' + ref.getSecondaryId();

                        // Add the new placeholder
                        vs.add(new PartPlaceholder(compoundId));
                      }
                    }
View Full Code Here

        IViewReference[] fastViews = getFastViews();

        if (fastViews.length != 0) {
            buf.append("fastviews ("); //$NON-NLS-1$
            for (int idx = 0; idx < fastViews.length; idx++) {
                IViewReference ref = fastViews[idx];

                if (idx > 0) {
                    buf.append(", "); //$NON-NLS-1$
                }

                buf.append(ref.getPartName());
            }
            buf.append("), "); //$NON-NLS-1$
        }

        getPresentation().describeLayout(buf);
View Full Code Here

                  Perspective persp = wp.getActivePerspective();

                    // If we're making a fast view then use the new mechanism directly
                    boolean useNewMinMax = Perspective.useNewMinMax(persp);
                    if (useNewMinMax) {
                      IViewReference ref = persp.getViewReference(desc.getId(), null);
                      if (ref == null)
                        return;

                      persp.getFastViewManager().addViewReference(FastViewBar.FASTVIEWBAR_ID, -1, ref, true);
                    wp.activate(ref.getPart(true));
                   
                    return;
                    }
                   
                    IViewReference ref = wp.findViewReference(desc.getId());
                   
                    if (ref == null) {
                        IViewPart part = page.showView(desc.getId(), null, IWorkbenchPage.VIEW_CREATE);
                        ref = (IViewReference)wp.getReference(part);
                    }
                   
                    if (!wp.isFastView(ref) && persp != null) {
                       persp.getFastViewManager().addViewReference(FastViewBar.FASTVIEWBAR_ID, -1, ref, true);
                    }
                    wp.activate(ref.getPart(true));
                } else {
                    page.showView(desc.getId());
                }
            } catch (PartInitException e) {
                ErrorDialog.openError(window.getShell(), WorkbenchMessages.ShowView_errorTitle,
View Full Code Here

        viewPane = newPane;
        update();
    }
   
    public void update() {
        IViewReference viewRef = getReference();
        if (viewRef == null) {
          setEnabled(false);
          return;
        }
       
View Full Code Here

              setChecked(persp.isFastView(viewRef));
        }
    }

    private IViewReference getReference() {
        IViewReference viewRef = null;
       
        if (viewPane != null) {
            IWorkbenchPartReference ref = viewPane.getPane().getPartReference();
           
            if (ref instanceof IViewReference) {
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IViewReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.