Search in sources :

Example 1 with ModifyFacetedProjectWizard

use of org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard in project webtools.sourceediting by eclipse.

the class DataModelFacetCreationWizardPage method createPresetPanel.

protected void createPresetPanel(Composite top) {
    final IFacetedProjectWorkingCopy workingCopy = ((ModifyFacetedProjectWizard) getWizard()).getFacetedProjectWorkingCopy();
    final IFilter<IPreset> filter = new AbstractFilter<IPreset>() {

        {
            IFacetedProjectListener fpjwcListenerForPreset = new IFacetedProjectListener() {

                @Override
                public void handleEvent(final IFacetedProjectEvent event) {
                    handleProjectFacetsChangedEvent((IProjectFacetsChangedEvent) event);
                }
            };
            facetedProjectListeners.add(fpjwcListenerForPreset);
            workingCopy.addListener(fpjwcListenerForPreset, IFacetedProjectEvent.Type.PROJECT_FACETS_CHANGED);
        }

        @Override
        public boolean check(final IPreset preset) {
            final IProjectFacetVersion primaryFacetVersion = getPrimaryFacetVersion();
            return preset.getProjectFacets().contains(primaryFacetVersion);
        }

        private void handleProjectFacetsChangedEvent(final IProjectFacetsChangedEvent event) {
            for (IProjectFacetVersion fv : event.getFacetsWithChangedVersions()) {
                if (fv.getProjectFacet() == getPrimaryFacet()) {
                    final IFilterEvent<IPreset> filterEvent = new FilterEvent<IPreset>(this, IFilterEvent.Type.FILTER_CHANGED);
                    notifyListeners(filterEvent);
                }
            }
        }
    };
    final PresetSelectionPanel ppanel = new PresetSelectionPanel(top, workingCopy, filter);
    ppanel.setLayoutData(gdhfill());
}
Also used : IFacetedProjectListener(org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener) FilterEvent(org.eclipse.wst.common.project.facet.core.util.FilterEvent) AbstractFilter(org.eclipse.wst.common.project.facet.core.util.AbstractFilter) IFacetedProjectEvent(org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent) IProjectFacetVersion(org.eclipse.wst.common.project.facet.core.IProjectFacetVersion) ModifyFacetedProjectWizard(org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard) IProjectFacetsChangedEvent(org.eclipse.wst.common.project.facet.core.events.IProjectFacetsChangedEvent) PresetSelectionPanel(org.eclipse.wst.common.project.facet.ui.PresetSelectionPanel) IPreset(org.eclipse.wst.common.project.facet.core.IPreset) IFacetedProjectWorkingCopy(org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy)

Example 2 with ModifyFacetedProjectWizard

use of org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard in project mdw-designer by CenturyLinkCloud.

the class ServerSettingsPage method initValues.

public void initValues() {
    configurator = ServerConfigurator.Factory.create(getServerSettings());
    ContainerType type = ServerSettings.getContainerTypeFromClass(this.getClass().getSimpleName());
    if (type != null) {
        String prevServerHome = MdwPlugin.getStringPref(type + "-" + ProjectPersist.MDW_SERVER_HOME);
        if (prevServerHome.length() > 0)
            getServerSettings().setHome(prevServerHome);
        if (getServerSettings().getHome() != null)
            serverHomeTextField.setText(getServerSettings().getHome());
        if (getServerSettings().isServiceMix())
            getServerSettings().setContainerVersion("4.4.1");
        if (getServerSettings().isFuse())
            getServerSettings().setContainerVersion("6.1.0");
        String prevJdkHome = MdwPlugin.getStringPref(type + "-" + ProjectPersist.MDW_SERVER_JDK_HOME);
        if (prevJdkHome.length() > 0)
            getServerSettings().setJdkHome(prevJdkHome);
        if (getServerSettings().getJdkHome() != null)
            jdkHomeTextField.setText(getServerSettings().getJdkHome());
        String prevServerHost = MdwPlugin.getStringPref(type + "-" + ProjectPersist.MDW_SERVER_HOST);
        if (prevServerHost.length() > 0 && getProject().isRemote())
            getServerSettings().setHost(prevServerHost);
        else
            getServerSettings().setHost(ServerSettings.DEFAULT_HOST);
        serverHostTextField.setText(getServerSettings().getHost());
        String prevServerPort = MdwPlugin.getStringPref(type + "-" + ProjectPersist.MDW_SERVER_PORT);
        if (prevServerPort.length() > 0 && getProject().isRemote()) {
            try {
                getServerSettings().setPort(Integer.parseInt(prevServerPort));
            } catch (NumberFormatException ex) {
                MdwPlugin.setStringPref(type + "-" + ProjectPersist.MDW_SERVER_PORT, String.valueOf(getDefaultServerPort()));
            }
        } else {
            getServerSettings().setPort(getDefaultServerPort());
        }
        serverPortTextField.setText(String.valueOf(getServerSettings().getPort()));
        String prevServerUser = MdwPlugin.getStringPref(type + "-" + ProjectPersist.MDW_SERVER_USER);
        if (prevServerUser.length() > 0)
            getServerSettings().setUser(prevServerUser);
        else
            getServerSettings().setUser(getDefaultServerUser());
        serverUserTextField.setText(getServerSettings().getUser());
    }
    if (!getProject().checkRequiredVersion(5, 0)) {
        IProjectFacetVersion pfv = ProjectFacetsManager.getProjectFacet("mdw.workflow").getVersion("1.1");
        IFacetedProjectWorkingCopy wc = ((ModifyFacetedProjectWizard) getWizard()).getFacetedProjectWorkingCopy();
        wc.changeProjectFacetVersion(pfv);
    }
}
Also used : IProjectFacetVersion(org.eclipse.wst.common.project.facet.core.IProjectFacetVersion) ContainerType(com.centurylink.mdw.plugin.project.model.ServerSettings.ContainerType) ModifyFacetedProjectWizard(org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard) IFacetedProjectWorkingCopy(org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy)

Aggregations

IFacetedProjectWorkingCopy (org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy)2 IProjectFacetVersion (org.eclipse.wst.common.project.facet.core.IProjectFacetVersion)2 ModifyFacetedProjectWizard (org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard)2 ContainerType (com.centurylink.mdw.plugin.project.model.ServerSettings.ContainerType)1 IPreset (org.eclipse.wst.common.project.facet.core.IPreset)1 IFacetedProjectEvent (org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent)1 IFacetedProjectListener (org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener)1 IProjectFacetsChangedEvent (org.eclipse.wst.common.project.facet.core.events.IProjectFacetsChangedEvent)1 AbstractFilter (org.eclipse.wst.common.project.facet.core.util.AbstractFilter)1 FilterEvent (org.eclipse.wst.common.project.facet.core.util.FilterEvent)1 PresetSelectionPanel (org.eclipse.wst.common.project.facet.ui.PresetSelectionPanel)1