View | Details | Raw Unified | Return to bug 172194
Collapse All | Expand All

(-)src/org/eclipse/gmf/internal/bridge/transform/TransformOptions.java (-7 / +14 lines)
Lines 25-56 Link Here
25
	public static final String PREF_USE_MAP_MODE = "use_map_mode"; //$NON-NLS-1$
25
	public static final String PREF_USE_MAP_MODE = "use_map_mode"; //$NON-NLS-1$
26
	public static final String PREF_USE_RUNTIME_FIGURES = "use_runtime_figures"; //$NON-NLS-1$
26
	public static final String PREF_USE_RUNTIME_FIGURES = "use_runtime_figures"; //$NON-NLS-1$
27
	
27
	
28
	private static String[] PROP_NAMES = new String[] {
29
		PREF_GENERATE_RCP, 
30
		PREF_USE_MAP_MODE, 
31
		PREF_USE_RUNTIME_FIGURES 
32
		};
33
	
28
	private Preferences myPreferences;
34
	private Preferences myPreferences;
29
	
35
	
30
	public TransformOptions() {
36
	public TransformOptions() {
31
		myPreferences = new Preferences();
32
		reset();
37
		reset();
33
	}
38
	}
34
	
39
35
	private Preferences getPreferences() {
40
	private Preferences getPreferences() {
41
		if (myPreferences == null) {
42
			myPreferences = new Preferences();
43
		}
36
		return myPreferences;
44
		return myPreferences;
37
	}
45
	}
38
	
46
	
39
	public void reset() {
47
	public void reset() {
40
		Preferences pluginPrefs = Plugin.getDefault().getPluginPreferences();
48
		Preferences pluginPrefs = Plugin.getDefault().getPluginPreferences();
41
		copyPreferences(pluginPrefs, myPreferences);
49
		copyPreferences(pluginPrefs, getPreferences());
42
	}
50
	}
43
	
51
	
44
	public void flush() {
52
	public void flush() {
45
		Preferences pluginPrefs = Plugin.getDefault().getPluginPreferences();
53
		Preferences pluginPrefs = Plugin.getDefault().getPluginPreferences();
46
		copyPreferences(myPreferences, pluginPrefs);
54
		copyPreferences(getPreferences(), pluginPrefs);
47
		Plugin.getDefault().savePluginPreferences();
55
		Plugin.getDefault().savePluginPreferences();
48
	}
56
	}
49
	
57
	
50
	private void copyPreferences(Preferences source, Preferences target) {
58
	private void copyPreferences(Preferences source, Preferences target) {
51
		String[] propNames = source.propertyNames();
59
		for (int i = 0; i < PROP_NAMES.length; i++) {
52
		for (int i = 0; i < propNames.length; i++) {
60
			String name = PROP_NAMES[i];
53
			String name = propNames[i];
54
			String value = source.getString(name);
61
			String value = source.getString(name);
55
			target.setValue(name, value);
62
			target.setValue(name, value);
56
		}
63
		}
(-)src/org/eclipse/gmf/internal/bridge/transform/TransformToGenModelWizard.java (-1 / +6 lines)
Lines 59-65 Link Here
59
		newFileCreationPage = new GMFGenNewFileCreationPage(PAGE_ID_GMFGEN, mySelection);
59
		newFileCreationPage = new GMFGenNewFileCreationPage(PAGE_ID_GMFGEN, mySelection);
60
		newFileCreationPage.setTitle(Messages.TransformToGenModelWizard_title_gmfgen);
60
		newFileCreationPage.setTitle(Messages.TransformToGenModelWizard_title_gmfgen);
61
		newFileCreationPage.setDescription(Messages.TransformToGenModelWizard_descr_gmfgen);
61
		newFileCreationPage.setDescription(Messages.TransformToGenModelWizard_descr_gmfgen);
62
		newFileCreationPage.setFileName(WizardUtil.getDefaultFileName(mySelection, defaultName, GMFGenNewFileCreationPage.EXT_GMFGEN));
62
		IFile file = WizardUtil.findExistingFile(mySelection, GMFGenNewFileCreationPage.EXT_GMFGEN);
63
		if (file != null) {
64
			newFileCreationPage.setFileName(file.getName());
65
		} else {
66
			newFileCreationPage.setFileName(WizardUtil.getDefaultFileName(mySelection, defaultName, GMFGenNewFileCreationPage.EXT_GMFGEN));
67
		}
63
		addPage(newFileCreationPage);
68
		addPage(newFileCreationPage);
64
		
69
		
65
		resourceSet = new ResourceSetImpl();
70
		resourceSet = new ResourceSetImpl();
(-)src/org/eclipse/gmf/internal/bridge/transform/GMFGenNewFileCreationPage.java (-5 / +10 lines)
Lines 44-49 Link Here
44
	public void createControl(Composite parent) {
44
	public void createControl(Composite parent) {
45
		resourceGroupEmulator = new ResourceGroupEmulator();
45
		resourceGroupEmulator = new ResourceGroupEmulator();
46
		super.createControl(parent);
46
		super.createControl(parent);
47
		validateFileExists();
47
	}
48
	}
48
49
49
	protected boolean validatePage() {
50
	protected boolean validatePage() {
Lines 57-67 Link Here
57
				return false;
58
				return false;
58
			}
59
			}
59
			else {
60
			else {
60
		        IPath resourcePath = getContainerFullPath().append(
61
		        validateFileExists();
61
		        		getFileName());
62
		        if (isFileExists(resourcePath)) {
63
					setMessage(Messages.ResourceGroup_nameExists, IMessageProvider.WARNING);
64
				}
65
				return true;
62
				return true;
66
			}
63
			}
67
		}
64
		}
Lines 70-75 Link Here
70
		}
67
		}
71
	}
68
	}
72
69
70
	private void validateFileExists() {
71
		IPath resourcePath = getContainerFullPath().append(
72
				getFileName());
73
		if (isFileExists(resourcePath)) {
74
			setMessage(Messages.ResourceGroup_nameExists, IMessageProvider.WARNING);
75
		}
76
	}
77
73
	public IFile getModelFile() {
78
	public IFile getModelFile() {
74
		return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
79
		return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
75
	}
80
	}

Return to bug 172194