Examples of IViewReference


Examples of org.eclipse.ui.IViewReference

     * This factory does reference counting.  For more info see
     * getView.
     */
    public void releaseView(IViewReference viewRef) {
        String key = getKey(viewRef);
        IViewReference ref = (IViewReference) counter.get(key);
        if (ref == null) {
      return;
    }
        int count = counter.removeRef(key);
        if (count <= 0) {
View Full Code Here

Examples of org.eclipse.ui.IViewReference

     */
    public IStatus saveState(IMemento memento) {
        final MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID,
                IStatus.OK, WorkbenchMessages.ViewFactory_problemsSavingViews, null);

        final IViewReference refs[] = getViews();
        for (int i = 0; i < refs.length; i++) {
            //for dynamic UI - add the following line to replace subsequent code which is commented out
            saveViewState(memento, refs[i], result);
        }
        return result;
View Full Code Here

Examples of org.eclipse.ui.IViewReference

                .getKey(ref));
        if (ref instanceof ViewReference) {
            viewMemento.putString(IWorkbenchConstants.TAG_PART_NAME,
                    ((ViewReference) ref).getPartName());
        }
        final IViewReference viewRef = ref;
        final IViewPart view = (IViewPart) ref.getPart(false);
        if (view != null) {
            SafeRunner.run(new SafeRunnable() {
                public void run() {
                  if (view instanceof IWorkbenchPart3) {
            Map properties = ((IWorkbenchPart3) view)
                .getPartProperties();
            if (!properties.isEmpty()) {
              IMemento propBag = viewMemento
                  .createChild(IWorkbenchConstants.TAG_PROPERTIES);
              Iterator i = properties.entrySet().iterator();
              while (i.hasNext()) {
                Map.Entry entry = (Map.Entry) i.next();
                IMemento p = propBag.createChild(
                    IWorkbenchConstants.TAG_PROPERTY,
                    (String) entry.getKey());
                p.putTextData((String) entry.getValue());
              }
            }
          }
                    view.saveState(viewMemento
                            .createChild(IWorkbenchConstants.TAG_VIEW_STATE));
                }

                public void handleException(Throwable e) {
                    result
                            .add(new Status(
                                    IStatus.ERROR,
                                    PlatformUI.PLUGIN_ID,
                                    0,
                                    NLS.bind(WorkbenchMessages.ViewFactory_couldNotSave, viewRef.getTitle() ),
                                    e));
                }
            });
        } else {
          IMemento mem = null;
View Full Code Here

Examples of org.eclipse.ui.IViewReference

        if (persp == null) {
      return null;
    }

        // If this view is already visible just return.
        IViewReference ref = persp.findView(viewID, secondaryID);
        IViewPart view = null;
        if (ref != null) {
      view = ref.getView(true);
    }
        if (view != null) {
            busyShowView(view, mode);
            return view;
        }
View Full Code Here

Examples of org.eclipse.ui.IViewReference

            // if there is no active part or it's not a view, bring to top
            if (ref == null || !(ref instanceof IViewReference)) {
        bringToTop(part);
      } else {
                // otherwise check to see if the we're in the same stack as the active view
                IViewReference activeView = (IViewReference) ref;
                IViewReference[] viewStack = getViewReferenceStack(part);
                for (int i = 0; i < viewStack.length; i++) {
                    if (viewStack[i].equals(activeView)) {
            return;
          }
View Full Code Here

Examples of org.eclipse.ui.IViewReference

        List partsToSave = new ArrayList();
        List viewsToClose = new ArrayList();
        // collect views that will go away and views that are dirty
        IViewReference[] viewReferences = persp.getViewReferences();
        for (int i = 0; i < viewReferences.length; i++) {
      IViewReference reference = viewReferences[i];
          if (getViewFactory().getReferenceCount(reference) == 1) {
            IViewPart viewPart = reference.getView(false);
            if (viewPart != null) {
              viewsToClose.add(viewPart);
              if (saveParts && reference.isDirty()) {
                partsToSave.add(viewPart);
              }
            }
          }
    }
        if (saveParts && perspList.size() == 1) {
          // collect editors that are dirty
          IEditorReference[] editorReferences = getEditorReferences();
          for (int i = 0; i < editorReferences.length; i++) {
        IEditorReference reference = editorReferences[i];
          if (reference.isDirty()) {
            IEditorPart editorPart = reference.getEditor(false);
            if (editorPart != null) {
              partsToSave.add(editorPart);
            }
          }
      }
View Full Code Here

Examples of org.eclipse.ui.IViewReference

            perspective.dispose();
        }
        perspList = new PerspectiveList();

        // Capture views.
        IViewReference refs[] = viewFactory.getViews();

        if (refs.length > 0) {
            // Dispose views.
            for (int i = 0; i < refs.length; i++) {
                final WorkbenchPartReference ref = (WorkbenchPartReference) refs[i];
View Full Code Here

Examples of org.eclipse.ui.IViewReference

    /**
     * See IWorkbenchPage@findView.
     */
    public IViewPart findView(String id) {
        IViewReference ref = findViewReference(id);
        if (ref == null) {
      return null;
    }
        return ref.getView(true);
    }
View Full Code Here

Examples of org.eclipse.ui.IViewReference

        if (persp == null) {
      persp = getActivePerspective();
    }
   
        if (persp != null) {
            IViewReference refs[] = persp.getViewReferences();
            ArrayList parts = new ArrayList(refs.length);
            for (int i = 0; i < refs.length; i++) {
                IWorkbenchPart part = refs[i].getPart(restore);
                if (part != null) {
          parts.add(part);
View Full Code Here

Examples of org.eclipse.ui.IViewReference

              window.firePerspectiveActivated(WorkbenchPage.this, myPerspective
                                .getDesc());
       
                        // Restore active part.
                        if (myActivePartId != null) {
                            IViewReference ref = myPerspective.findView(
                                myActivePartId, mySecondaryId);
                           
                            if (ref != null) {
                                activationList.setActive(ref);
                            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.