View | Details | Raw Unified | Return to bug 148836 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/gmf/internal/bridge/transform/TransformToGenModelOperation.java (+9 lines)
Lines 180-185 Link Here
180
			}
180
			}
181
			subTask(monitor, 30, Messages.TransformToGenModelOperation_task_load, cancelMessage);
181
			subTask(monitor, 30, Messages.TransformToGenModelOperation_task_load, cancelMessage);
182
			GenModel genModel = gmd.get(rs);
182
			GenModel genModel = gmd.get(rs);
183
			if (genModel == null) {
184
				if (uri == null) {
185
					this.myStaleGenmodelStatus = Status.CANCEL_STATUS;
186
					this.myGenModel = null;
187
					return null;
188
				}
189
				IStatus notFound = Plugin.createError(Messages.GenModelDetector_e_not_found, null);
190
				throw new CoreException(notFound);
191
			}
183
			subTask(monitor, 40, Messages.TransformToGenModelOperation_task_validate, cancelMessage);
192
			subTask(monitor, 40, Messages.TransformToGenModelOperation_task_validate, cancelMessage);
184
			StaleGenModelDetector staleDetector = new StaleGenModelDetector(genModel);
193
			StaleGenModelDetector staleDetector = new StaleGenModelDetector(genModel);
185
			IStatus stale = staleDetector.detect();
194
			IStatus stale = staleDetector.detect();
(-)src/org/eclipse/gmf/internal/bridge/transform/GenModelConfigurationPage.java (-4 / +12 lines)
Lines 120-129 Link Here
120
	void findGenmodel() {
120
	void findGenmodel() {
121
		try {
121
		try {
122
			GenModel genModel = getOperation().findGenmodel(getResourceSet());
122
			GenModel genModel = getOperation().findGenmodel(getResourceSet());
123
			Resource r = genModel.eResource();
123
			if (genModel != null) {
124
			URI genURI = r.getURI();
124
				Resource r = genModel.eResource();
125
			setURI(genURI);
125
				URI genURI = r.getURI();
126
			updateURI();
126
				setURI(genURI);
127
				updateURI();
128
			} else {
129
				setPageComplete(true);
130
				updateControls();
131
			}
127
		} catch (CoreException e) {
132
		} catch (CoreException e) {
128
			setErrorMessage(e.getMessage());
133
			setErrorMessage(e.getMessage());
129
			updateControls();
134
			updateControls();
Lines 156-161 Link Here
156
	@Override
161
	@Override
157
	protected Resource doLoadResource(IProgressMonitor monitor) throws CoreException {
162
	protected Resource doLoadResource(IProgressMonitor monitor) throws CoreException {
158
		GenModel genModel = getOperation().loadGenModel(getResourceSet(), getURI(), monitor);
163
		GenModel genModel = getOperation().loadGenModel(getResourceSet(), getURI(), monitor);
164
		if (genModel == null) {
165
			return null;
166
		}
159
		return genModel.eResource();
167
		return genModel.eResource();
160
	}
168
	}
161
169
(-)src/org/eclipse/gmf/internal/bridge/transform/TransformToGenModelWizard.java (-1 / +22 lines)
Lines 14-21 Link Here
14
import java.lang.reflect.InvocationTargetException;
14
import java.lang.reflect.InvocationTargetException;
15
15
16
import org.eclipse.core.resources.IFile;
16
import org.eclipse.core.resources.IFile;
17
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
19
import org.eclipse.emf.common.util.URI;
21
import org.eclipse.emf.common.util.URI;
20
import org.eclipse.emf.ecore.resource.ResourceSet;
22
import org.eclipse.emf.ecore.resource.ResourceSet;
21
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
23
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
Lines 23-28 Link Here
23
import org.eclipse.gmf.internal.common.ui.ResourceLocationProvider;
25
import org.eclipse.gmf.internal.common.ui.ResourceLocationProvider;
24
import org.eclipse.jface.operation.IRunnableWithProgress;
26
import org.eclipse.jface.operation.IRunnableWithProgress;
25
import org.eclipse.jface.viewers.IStructuredSelection;
27
import org.eclipse.jface.viewers.IStructuredSelection;
28
import org.eclipse.jface.wizard.IWizardPage;
26
import org.eclipse.jface.wizard.Wizard;
29
import org.eclipse.jface.wizard.Wizard;
27
import org.eclipse.jface.wizard.WizardDialog;
30
import org.eclipse.jface.wizard.WizardDialog;
28
import org.eclipse.jface.wizard.WizardPage;
31
import org.eclipse.jface.wizard.WizardPage;
Lines 72-78 Link Here
72
		genModelPage.setTitle(Messages.TransformToGenModelWizard_title_genmodel);
75
		genModelPage.setTitle(Messages.TransformToGenModelWizard_title_genmodel);
73
		genModelPage.setDescription(Messages.TransformToGenModelWizard_descr_genmodel);
76
		genModelPage.setDescription(Messages.TransformToGenModelWizard_descr_genmodel);
74
		genModelPage.setPageComplete(false);
77
		genModelPage.setPageComplete(false);
75
		genModelPage.setModelRequired(true);
78
		genModelPage.setModelRequired(false);
76
		addPage(genModelPage);
79
		addPage(genModelPage);
77
80
78
		transformOptionPage = new ViewmapProducerWizardPage(PAGE_ID_TRANSFORM);
81
		transformOptionPage = new ViewmapProducerWizardPage(PAGE_ID_TRANSFORM);
Lines 83-88 Link Here
83
		
86
		
84
	}
87
	}
85
	
88
	
89
	/* (non-Javadoc)
90
	 * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
91
	 */
92
	@Override
93
	public IWizardPage getNextPage(IWizardPage page) {
94
		if (page == mapModelPage) {
95
			try {
96
				GenModel genmmodel = getTransformOperation().findGenmodel(resourceSet);
97
				if (genmmodel == null) {
98
					return transformOptionPage;
99
				}
100
			} catch (CoreException e) {
101
				genModelPage.setStatusMessage(e.getStatus());
102
			}
103
		}
104
		return super.getNextPage(page);
105
	}
106
	
86
	public void init(IWorkbench workbench, IStructuredSelection selection) {
107
	public void init(IWorkbench workbench, IStructuredSelection selection) {
87
		this.mySelection = selection;
108
		this.mySelection = selection;
88
		setWindowTitle(Messages.TransformToGenModelWizard_title_wizard);
109
		setWindowTitle(Messages.TransformToGenModelWizard_title_wizard);
(-)src/org/eclipse/gmf/internal/bridge/transform/ModelConfigurationPage.java (-1 / +2 lines)
Lines 71-78 Link Here
71
			if (target instanceof CoreException) {
71
			if (target instanceof CoreException) {
72
				CoreException ce = (CoreException) target;
72
				CoreException ce = (CoreException) target;
73
				setStatusMessage(ce.getStatus());
73
				setStatusMessage(ce.getStatus());
74
			} else {
75
				setStatusMessage(Plugin.createError(target.getMessage(), target));
74
			}
76
			}
75
			setStatusMessage(Plugin.createError(target.getMessage(), target));
76
		} catch (InterruptedException e) {
77
		} catch (InterruptedException e) {
77
			setStatusMessage(Status.CANCEL_STATUS);
78
			setStatusMessage(Status.CANCEL_STATUS);
78
		}
79
		}

Return to bug 148836