Search in sources :

Example 1 with WrappedException

use of org.eclipse.emf.common.util.WrappedException in project tdi-studio-se by Talend.

the class BusinessInitDiagramFileAction method run.

/**
     * @generated NOT
     */
public void run(IAction action) {
    TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
    ResourceSet resourceSet = new ResourceSetImpl();
    EObject diagramRoot = null;
    try {
        Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(mySelectedModelFile.getFullPath().toString()), true);
        diagramRoot = (EObject) resource.getContents().get(0);
    } catch (WrappedException ex) {
        BusinessDiagramEditorPlugin.getInstance().logError(Messages.getString("BusinessInitDiagramFileAction.UnableToLoadResource") + mySelectedModelFile.getFullPath().toString(), //$NON-NLS-1$
        ex);
    }
    if (diagramRoot == null) {
        MessageDialog.openError(myPart.getSite().getShell(), Messages.getString("BusinessInitDiagramFileAction.Error"), //$NON-NLS-1$ //$NON-NLS-2$
        Messages.getString("BusinessInitDiagramFileAction.LoadFaild"));
        return;
    }
    Wizard wizard = new BusinessNewDiagramFileWizard(mySelectedModelFile, myPart.getSite().getPage(), mySelection, diagramRoot, editingDomain);
    IDialogSettings pluginDialogSettings = BusinessDiagramEditorPlugin.getInstance().getDialogSettings();
    //$NON-NLS-1$
    IDialogSettings initDiagramFileSettings = pluginDialogSettings.getSection("InisDiagramFile");
    if (initDiagramFileSettings == null) {
        //$NON-NLS-1$
        initDiagramFileSettings = pluginDialogSettings.addNewSection("InisDiagramFile");
    }
    wizard.setDialogSettings(initDiagramFileSettings);
    wizard.setForcePreviousAndNextButtons(false);
    wizard.setWindowTitle(//$NON-NLS-1$ //$NON-NLS-2$
    Messages.getString("BusinessInitDiagramFileAction.IntialNew") + BusinessProcessEditPart.MODEL_ID + Messages.getString("BusinessInitDiagramFileAction.DiagramFile"));
    WizardDialog dialog = new WizardDialog(myPart.getSite().getShell(), wizard);
    dialog.create();
    dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
    dialog.open();
}
Also used : WrappedException(org.eclipse.emf.common.util.WrappedException) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) Wizard(org.eclipse.jface.wizard.Wizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

WrappedException (org.eclipse.emf.common.util.WrappedException)1 EObject (org.eclipse.emf.ecore.EObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)1 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)1 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)1 Wizard (org.eclipse.jface.wizard.Wizard)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1