Examples of PerspectiveRegistry


Examples of org.eclipse.ui.internal.registry.PerspectiveRegistry

    /**
     * Save a singleton over the user selection.
     */
    private void saveNonSingleton(IWorkbenchPage page, PerspectiveDescriptor oldDesc) {
        // Get reg.
        PerspectiveRegistry reg = (PerspectiveRegistry) WorkbenchPlugin
                .getDefault().getPerspectiveRegistry();

        // Get persp name.
        SavePerspectiveDialog dlg = new SavePerspectiveDialog(page.getWorkbenchWindow()
                .getShell(), reg);
        // Look up the descriptor by id again to ensure it is still valid.
        IPerspectiveDescriptor description = reg.findPerspectiveWithId(oldDesc.getId());
        dlg.setInitialSelection(description);
        if (dlg.open() != IDialogConstants.OK_ID) {
            return;
        }

        // Create descriptor.
        PerspectiveDescriptor newDesc = (PerspectiveDescriptor) dlg.getPersp();
        if (newDesc == null) {
            String name = dlg.getPerspName();
            newDesc = reg.createPerspective(name,
                    (PerspectiveDescriptor) description);
            if (newDesc == null) {
                MessageDialog.openError(dlg.getShell(), WorkbenchMessages.SavePerspective_errorTitle,
                        WorkbenchMessages.SavePerspective_errorMessage);
                return;
View Full Code Here

Examples of org.eclipse.ui.internal.registry.PerspectiveRegistry

     * Return the perspective registry.
     * @return IPerspectiveRegistry. The registry for the receiver.
     */
    public IPerspectiveRegistry getPerspectiveRegistry() {
      if (perspRegistry == null) {
            perspRegistry = new PerspectiveRegistry();
            // the load methods can touch on WorkbenchImages if an image is
      // missing so we need to wrap the call in
      // a startup block for the case where a custom descriptor exists on
      // startup that does not have an image
      // associated with it. See bug 196352.
View Full Code Here

Examples of org.eclipse.ui.internal.registry.PerspectiveRegistry

     * Creates a new presentation from a persistence file.
     * Note: This method should not modify the current state of the perspective.
     */
    private void loadCustomPersp(PerspectiveDescriptor persp) {
        //get the layout from the registry 
        PerspectiveRegistry perspRegistry = (PerspectiveRegistry) WorkbenchPlugin
                .getDefault().getPerspectiveRegistry();
        try {
            IMemento memento = perspRegistry.getCustomPersp(persp.getId());
            // Restore the layout state.
            MultiStatus status = new MultiStatus(
                    PlatformUI.PLUGIN_ID,
                    IStatus.OK,
                    NLS.bind(WorkbenchMessages.Perspective_unableToRestorePerspective, persp.getLabel()),
View Full Code Here

Examples of org.eclipse.ui.internal.registry.PerspectiveRegistry

        }
    }

    private void unableToOpenPerspective(PerspectiveDescriptor persp,
            IStatus status) {
        PerspectiveRegistry perspRegistry = (PerspectiveRegistry) WorkbenchPlugin
                .getDefault().getPerspectiveRegistry();
        perspRegistry.deletePerspective(persp);
        // If this is a predefined perspective, we will not be able to delete
        // the perspective (we wouldn't want to).  But make sure to delete the
        // customized portion.
        persp.deleteCustomDefinition();
        String title = WorkbenchMessages.Perspective_problemRestoringTitle;
View Full Code Here

Examples of org.eclipse.ui.internal.registry.PerspectiveRegistry

     * Save the layout.
     */
    public void saveDescAs(IPerspectiveDescriptor desc) {
        PerspectiveDescriptor realDesc = (PerspectiveDescriptor) desc;
        //get the layout from the registry 
        PerspectiveRegistry perspRegistry = (PerspectiveRegistry) WorkbenchPlugin
                .getDefault().getPerspectiveRegistry();
        // Capture the layout state. 
        XMLMemento memento = XMLMemento.createWriteRoot("perspective");//$NON-NLS-1$
        IStatus status = saveState(memento, realDesc, false);
        if (status.getSeverity() == IStatus.ERROR) {
            ErrorDialog.openError((Shell) null, WorkbenchMessages.Perspective_problemSavingTitle,
                    WorkbenchMessages.Perspective_problemSavingMessage,
                    status);
            return;
        }
        //save it to the preference store
        try {
            perspRegistry.saveCustomPersp(realDesc, memento);
            descriptor = realDesc;
        } catch (IOException e) {
            perspRegistry.deletePerspective(realDesc);
            MessageDialog.openError((Shell) null, WorkbenchMessages.Perspective_problemSavingTitle,
                    WorkbenchMessages.Perspective_problemSavingMessage);
        }
    }
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.