Search in sources :

Example 1 with DialogDef

use of org.eclipse.sapphire.ui.forms.DialogDef in project liferay-ide by liferay.

the class NewLiferayProfileMarkerResolution method promptUser.

@Override
protected int promptUser(IProject project, NewLiferayPluginProjectOp op) {
    NewLiferayProfile newLiferayProfile = op.getNewLiferayProfiles().insert();
    Reference<DialogDef> dialogRef = DefinitionLoader.sdef(NewLiferayPluginProjectWizard.class).dialog("NewLiferayProfile");
    SapphireDialog dialog = new SapphireDialog(UIUtil.getActiveShell(), newLiferayProfile, dialogRef);
    dialog.setBlockOnOpen(true);
    int result = dialog.open();
    if (result == SapphireDialog.OK) {
        IDOMModel domModel = null;
        try {
            IFile pomFile = project.getFile(IMavenConstants.POM_FILE_NAME);
            domModel = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(pomFile);
            MavenUtil.createNewLiferayProfileNode(domModel.getDocument(), newLiferayProfile);
            domModel.save();
        } catch (Exception e) {
            LiferayMavenCore.logError("Unable to save new Liferay profiles to project pom.", e);
        } finally {
            if (domModel != null) {
                domModel.releaseFromEdit();
            }
        }
        NewLiferayProfileActionHandler.addToActiveProfiles(op, newLiferayProfile);
    } else {
        op.getNewLiferayProfiles().remove(newLiferayProfile);
    }
    return result;
}
Also used : DialogDef(org.eclipse.sapphire.ui.forms.DialogDef) IFile(org.eclipse.core.resources.IFile) IDOMModel(org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel) NewLiferayProfile(com.liferay.ide.project.core.model.NewLiferayProfile) NewLiferayPluginProjectWizard(com.liferay.ide.project.ui.wizard.NewLiferayPluginProjectWizard) SapphireDialog(org.eclipse.sapphire.ui.forms.swt.SapphireDialog)

Example 2 with DialogDef

use of org.eclipse.sapphire.ui.forms.DialogDef in project liferay-ide by liferay.

the class PluginsSDKNotSetResolution method run.

public void run(IMarker marker) {
    if (marker.getResource() instanceof IProject) {
        final IProject proj = (IProject) marker.getResource();
        final LiferayPluginSDKOp op = (LiferayPluginSDKOp) (LiferayPluginSDKOp.TYPE.instantiate().initialize());
        DefinitionLoader loader = DefinitionLoader.context(getClass());
        final Reference<DialogDef> dialogRef = loader.sdef("com.liferay.ide.project.ui.dialog.SelectPluginsSDKDialog").dialog("ConfigureLiferaySDK");
        final SapphireDialog dialog = new SapphireDialog(UIUtil.getActiveShell(), op, dialogRef);
        dialog.setBlockOnOpen(true);
        final int result = dialog.open();
        if (result != SapphireDialog.CANCEL) {
            String sdkName = op.getPluginsSDKName().content();
            SDKUtil.saveSDKNameSetting(proj, sdkName);
        }
    }
}
Also used : DialogDef(org.eclipse.sapphire.ui.forms.DialogDef) DefinitionLoader(org.eclipse.sapphire.ui.def.DefinitionLoader) LiferayPluginSDKOp(com.liferay.ide.project.core.model.LiferayPluginSDKOp) SapphireDialog(org.eclipse.sapphire.ui.forms.swt.SapphireDialog) IProject(org.eclipse.core.resources.IProject)

Example 3 with DialogDef

use of org.eclipse.sapphire.ui.forms.DialogDef in project liferay-ide by liferay.

the class SelectActiveProfilesMarkerResolution method promptUser.

protected int promptUser(IProject project, NewLiferayPluginProjectOp op) {
    Reference<DialogDef> dialogRef = DefinitionLoader.sdef(NewLiferayPluginProjectWizard.class).dialog("SelectActiveProfiles");
    SapphireDialog dialog = new SapphireDialog(UIUtil.getActiveShell(), op, dialogRef);
    dialog.setBlockOnOpen(true);
    return dialog.open();
}
Also used : DialogDef(org.eclipse.sapphire.ui.forms.DialogDef) NewLiferayPluginProjectWizard(com.liferay.ide.project.ui.wizard.NewLiferayPluginProjectWizard) SapphireDialog(org.eclipse.sapphire.ui.forms.swt.SapphireDialog)

Aggregations

DialogDef (org.eclipse.sapphire.ui.forms.DialogDef)3 SapphireDialog (org.eclipse.sapphire.ui.forms.swt.SapphireDialog)3 NewLiferayPluginProjectWizard (com.liferay.ide.project.ui.wizard.NewLiferayPluginProjectWizard)2 LiferayPluginSDKOp (com.liferay.ide.project.core.model.LiferayPluginSDKOp)1 NewLiferayProfile (com.liferay.ide.project.core.model.NewLiferayProfile)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 DefinitionLoader (org.eclipse.sapphire.ui.def.DefinitionLoader)1 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)1