Search in sources :

Example 1 with DelegateConfigurationElement

use of org.eclipse.wst.web.internal.DelegateConfigurationElement in project webtools.sourceediting by eclipse.

the class NewProjectDataModelFacetWizard method postPerformFinish.

/**
 * <p>
 * Invoked after the user has clicked the "Finish" button of the wizard. The default
 * implementation will attempt to update the final perspective to the value specified by
 * { @link #getFinalPerspectiveID() }
 * </p>
 *
 * @throws InvocationTargetException
 *
 * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizard#postPerformFinish()
 */
protected void postPerformFinish() throws InvocationTargetException {
    String projName = getProjectName();
    IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projName);
    IWorkbench workbench = WSTWebUIPlugin.getDefault().getWorkbench();
    // add to the selected working sets
    if (newProject != null && beginingPages != null && beginingPages.length > 0 && beginingPages[0] instanceof DataModelFacetCreationWizardPage) {
        DataModelFacetCreationWizardPage mainPage = (DataModelFacetCreationWizardPage) beginingPages[0];
        IWorkingSet[] workingSets = mainPage.getSelectedWorkingSets();
        workbench.getWorkingSetManager().addToWorkingSets(newProject, workingSets);
    }
    // open the "final" perspective
    if (getFinalPerspectiveID() != null && getFinalPerspectiveID().length() > 0) {
        final IConfigurationElement element = new DelegateConfigurationElement(configurationElement) {

            @Override
            public String getAttribute(String aName) {
                if (aName.equals("finalPerspective")) {
                    // $NON-NLS-1$
                    return getFinalPerspectiveID();
                }
                return super.getAttribute(aName);
            }
        };
        BasicNewProjectResourceWizard.updatePerspective(element);
    } else
        BasicNewProjectResourceWizard.updatePerspective(configurationElement);
    // select and reveal
    BasicNewResourceWizard.selectAndReveal(newProject, workbench.getActiveWorkbenchWindow());
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) DelegateConfigurationElement(org.eclipse.wst.web.internal.DelegateConfigurationElement) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IProject(org.eclipse.core.resources.IProject) IWorkingSet(org.eclipse.ui.IWorkingSet)

Example 2 with DelegateConfigurationElement

use of org.eclipse.wst.web.internal.DelegateConfigurationElement in project liferay-ide by liferay.

the class BaseProjectWizard method openLiferayPerspective.

protected void openLiferayPerspective(IProject newProject) {
    final IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage activePage = workbench.getActiveWorkbenchWindow().getActivePage();
    IPerspectiveDescriptor perspective = activePage.getPerspective();
    if (perspective.getId().equals(LiferayWorkspacePerspectiveFactory.ID)) {
        return;
    }
    // open the "final" perspective
    final IConfigurationElement element = new DelegateConfigurationElement(null) {

        @Override
        public String getAttribute(String aName) {
            if (aName.equals("finalPerspective")) {
                return LiferayWorkspacePerspectiveFactory.ID;
            }
            return super.getAttribute(aName);
        }
    };
    BasicNewProjectResourceWizard.updatePerspective(element);
    // select and reveal
    BasicNewResourceWizard.selectAndReveal(newProject, workbench.getActiveWorkbenchWindow());
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IPerspectiveDescriptor(org.eclipse.ui.IPerspectiveDescriptor) DelegateConfigurationElement(org.eclipse.wst.web.internal.DelegateConfigurationElement) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 3 with DelegateConfigurationElement

use of org.eclipse.wst.web.internal.DelegateConfigurationElement in project liferay-ide by liferay.

the class NewLiferayPluginProjectWizard method openLiferayPerspective.

@Override
protected void openLiferayPerspective(IProject newProject) {
    final IWorkbench workbench = PlatformUI.getWorkbench();
    // open the "final" perspective
    final IConfigurationElement element = new DelegateConfigurationElement(null) {

        @Override
        public String getAttribute(String aName) {
            if (aName.equals("finalPerspective")) {
                return LiferayPerspectiveFactory.ID;
            }
            return super.getAttribute(aName);
        }
    };
    BasicNewProjectResourceWizard.updatePerspective(element);
    // select and reveal
    BasicNewResourceWizard.selectAndReveal(newProject, workbench.getActiveWorkbenchWindow());
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) DelegateConfigurationElement(org.eclipse.wst.web.internal.DelegateConfigurationElement) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Aggregations

IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)3 IWorkbench (org.eclipse.ui.IWorkbench)3 DelegateConfigurationElement (org.eclipse.wst.web.internal.DelegateConfigurationElement)3 IProject (org.eclipse.core.resources.IProject)1 IPerspectiveDescriptor (org.eclipse.ui.IPerspectiveDescriptor)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkingSet (org.eclipse.ui.IWorkingSet)1