Lines 38-46
Link Here
|
38 |
import org.eclipse.gmf.gmfgraph.Canvas; |
38 |
import org.eclipse.gmf.gmfgraph.Canvas; |
39 |
import org.eclipse.gmf.gmfgraph.DiagramElement; |
39 |
import org.eclipse.gmf.gmfgraph.DiagramElement; |
40 |
import org.eclipse.gmf.gmfgraph.FigureGallery; |
40 |
import org.eclipse.gmf.gmfgraph.FigureGallery; |
|
|
41 |
import org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch; |
41 |
import org.eclipse.gmf.gmfgraph.util.RuntimeFQNSwitch; |
42 |
import org.eclipse.gmf.gmfgraph.util.RuntimeFQNSwitch; |
|
|
43 |
import org.eclipse.gmf.gmfgraph.util.RuntimeLiteFQNSwitch; |
42 |
import org.eclipse.gmf.graphdef.codegen.StandaloneGenerator; |
44 |
import org.eclipse.gmf.graphdef.codegen.StandaloneGenerator; |
43 |
import org.eclipse.gmf.internal.graphdef.codegen.StandaloneGalleryConverter; |
45 |
import org.eclipse.gmf.internal.graphdef.codegen.StandaloneGalleryConverter; |
|
|
46 |
import org.eclipse.jface.dialogs.IMessageProvider; |
44 |
import org.eclipse.jface.wizard.Wizard; |
47 |
import org.eclipse.jface.wizard.Wizard; |
45 |
import org.eclipse.jface.wizard.WizardPage; |
48 |
import org.eclipse.jface.wizard.WizardPage; |
46 |
import org.eclipse.osgi.util.ManifestElement; |
49 |
import org.eclipse.osgi.util.ManifestElement; |
Lines 48-53
Link Here
|
48 |
import org.eclipse.pde.core.plugin.IPluginModel; |
51 |
import org.eclipse.pde.core.plugin.IPluginModel; |
49 |
import org.eclipse.pde.core.plugin.IPluginReference; |
52 |
import org.eclipse.pde.core.plugin.IPluginReference; |
50 |
import org.eclipse.pde.ui.IFieldData; |
53 |
import org.eclipse.pde.ui.IFieldData; |
|
|
54 |
import org.eclipse.pde.ui.templates.BooleanOption; |
51 |
import org.eclipse.pde.ui.templates.OptionTemplateSection; |
55 |
import org.eclipse.pde.ui.templates.OptionTemplateSection; |
52 |
import org.eclipse.pde.ui.templates.TemplateOption; |
56 |
import org.eclipse.pde.ui.templates.TemplateOption; |
53 |
import org.osgi.framework.Bundle; |
57 |
import org.osgi.framework.Bundle; |
Lines 61-66
Link Here
|
61 |
|
65 |
|
62 |
public static final String OPTION_MAIN_PACKAGE_NAME = SECTION_ID + ".mainPackageName"; |
66 |
public static final String OPTION_MAIN_PACKAGE_NAME = SECTION_ID + ".mainPackageName"; |
63 |
public static final String OPTION_NEEDS_MAP_MODE = SECTION_ID + ".needsMapMode"; |
67 |
public static final String OPTION_NEEDS_MAP_MODE = SECTION_ID + ".needsMapMode"; |
|
|
68 |
public static final String OPTION_USE_RUNTIME_FIGURES = SECTION_ID + ".useRuntimeFigures"; |
64 |
public static final String OPTION_INPUT_RESOURCE_FULL_PATH = SECTION_ID + ".inputResource"; |
69 |
public static final String OPTION_INPUT_RESOURCE_FULL_PATH = SECTION_ID + ".inputResource"; |
65 |
public static final String OPTION_OUTPUT_GALLERY_FULL_PATH = SECTION_ID + ".outputGallery"; |
70 |
public static final String OPTION_OUTPUT_GALLERY_FULL_PATH = SECTION_ID + ".outputGallery"; |
66 |
public static final String OPTION_OUTPUT_DIAGRAM_ELEMENTS_FULL_PATH = SECTION_ID + ".outputDiagramElements"; |
71 |
public static final String OPTION_OUTPUT_DIAGRAM_ELEMENTS_FULL_PATH = SECTION_ID + ".outputDiagramElements"; |
Lines 70-75
Link Here
|
70 |
private FileNameOption myOutputGalleryPathOption; |
75 |
private FileNameOption myOutputGalleryPathOption; |
71 |
private FileNameOption myOutputDiagramElementsPathOption; |
76 |
private FileNameOption myOutputDiagramElementsPathOption; |
72 |
private final InputValidationState myCachedInputValidationState; |
77 |
private final InputValidationState myCachedInputValidationState; |
|
|
78 |
private BooleanOption myNeedsMapModeOption; |
79 |
private BooleanOption myUseRuntimeFiguresOption; |
80 |
private final boolean shouldWarnLiteVerstionDoesNotSupportMapMode; |
73 |
private ManifestElement[] myRequiredBundles; |
81 |
private ManifestElement[] myRequiredBundles; |
74 |
|
82 |
|
75 |
public ConverterSection(){ |
83 |
public ConverterSection(){ |
Lines 80-87
Link Here
|
80 |
myOutputGalleryPathOption.setRequired(false); |
88 |
myOutputGalleryPathOption.setRequired(false); |
81 |
myOutputDiagramElementsPathOption = addFileNameOption(true, OPTION_OUTPUT_DIAGRAM_ELEMENTS_FULL_PATH, "Mirror diagram elements", "", THE_ONLY_PAGE_INDEX); |
89 |
myOutputDiagramElementsPathOption = addFileNameOption(true, OPTION_OUTPUT_DIAGRAM_ELEMENTS_FULL_PATH, "Mirror diagram elements", "", THE_ONLY_PAGE_INDEX); |
82 |
myOutputDiagramElementsPathOption.setRequired(false); |
90 |
myOutputDiagramElementsPathOption.setRequired(false); |
83 |
addOption(OPTION_NEEDS_MAP_MODE, "Use IMapMode", false, THE_ONLY_PAGE_INDEX); |
91 |
myNeedsMapModeOption = (BooleanOption) addOption(OPTION_NEEDS_MAP_MODE, "Use IMapMode", false, THE_ONLY_PAGE_INDEX); |
|
|
92 |
myUseRuntimeFiguresOption = (BooleanOption) addOption(OPTION_USE_RUNTIME_FIGURES, "Use Enhanced Figures", true, THE_ONLY_PAGE_INDEX); |
84 |
myCachedInputValidationState = new InputValidationState(myOutputGalleryPathOption, myOutputDiagramElementsPathOption); |
93 |
myCachedInputValidationState = new InputValidationState(myOutputGalleryPathOption, myOutputDiagramElementsPathOption); |
|
|
94 |
shouldWarnLiteVerstionDoesNotSupportMapMode = Platform.getBundle("org.eclipse.gmf.codegen.lite") != null; |
85 |
} |
95 |
} |
86 |
|
96 |
|
87 |
public void addPages(Wizard wizard) { |
97 |
public void addPages(Wizard wizard) { |
Lines 104-110
Link Here
|
104 |
FigureGallery[] figures = findFigures(input); |
114 |
FigureGallery[] figures = findFigures(input); |
105 |
assert(figures.length > 0); |
115 |
assert(figures.length > 0); |
106 |
StandaloneGenerator.Config config = new StandaloneGeneratorConfigAdapter(this); |
116 |
StandaloneGenerator.Config config = new StandaloneGeneratorConfigAdapter(this); |
107 |
StandaloneGenerator generator = new StandaloneGenerator(figures, config, new RuntimeFQNSwitch()); |
117 |
FigureQualifiedNameSwitch fqnSwitch; |
|
|
118 |
if (myUseRuntimeFiguresOption.isSelected()) { |
119 |
fqnSwitch = new RuntimeFQNSwitch(); |
120 |
} else { |
121 |
fqnSwitch = new RuntimeLiteFQNSwitch(); |
122 |
} |
123 |
StandaloneGenerator generator = new StandaloneGenerator(figures, config, fqnSwitch); |
108 |
generator.setSkipPluginStructure(false); |
124 |
generator.setSkipPluginStructure(false); |
109 |
try { |
125 |
try { |
110 |
generator.run(new SubProgressMonitor(monitor, 1)); |
126 |
generator.run(new SubProgressMonitor(monitor, 1)); |
Lines 211-216
Link Here
|
211 |
} |
227 |
} |
212 |
|
228 |
|
213 |
public void validateOptions(TemplateOption changed) { |
229 |
public void validateOptions(TemplateOption changed) { |
|
|
230 |
if ((myUseRuntimeFiguresOption.equals(changed) || myNeedsMapModeOption.equals(changed)) && shouldWarnLiteVerstionDoesNotSupportMapMode) { |
231 |
boolean useRuntimeFigures = myUseRuntimeFiguresOption.isSelected(); |
232 |
boolean needsMapMode = myNeedsMapModeOption.isSelected(); |
233 |
if (!useRuntimeFigures && needsMapMode) { |
234 |
getTheOnlyPage().setMessage("It is not recommended to use IMapMode for pure-GEF diagram editors", IMessageProvider.INFORMATION); |
235 |
} else { |
236 |
getTheOnlyPage().setMessage(null); |
237 |
} |
238 |
} |
214 |
if (OPTION_NEEDS_MAP_MODE.equals(changed)){ |
239 |
if (OPTION_NEEDS_MAP_MODE.equals(changed)){ |
215 |
//does not affect state |
240 |
//does not affect state |
216 |
return; |
241 |
return; |