Bug 105926 [Formatter] Exporting Unnamed profile fails silently
When attempting to export an "Unnamed Profile" from the Project Preferences > Java Code Style > Formatter it will fail silently when it gets to ProfileStore.writeProfilesToStream(): for(final Iterator iter= profiles.iterator(); iter.hasNext();) { final Profile profile= (Profile)iter.next(); if (profile.isProfileToSave()) { final Element profileElement= createProfileElement(profile, document); rootElement.appendChild(profileElement); } } Since the unnamed profile is considered a shared profile and will write an xml file with the content. <?xml version="1.0" encoding="UTF-8"?> <profiles version="8"/> Instead of silently generating an xml file with no content it should rather throw up an error/warning or force a rename dialog. I'll try working on a patch to this respect.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java
label.setText(text);
		label.setLayoutData(gd);
		return label;		
	}
	
	private Composite createComposite(Composite parent, int numColumns) {
		final Composite composite = new Composite(parent, SWT.NONE);
		composite.setFont(parent.getFont());
		
		final GridLayout layout = new GridLayout(numColumns, false);
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		composite.setLayout(layout);
		return composite;
	}
	
	private void configurePreview(Composite composite, int numColumns) {
		fJavaPreview= new CompilationUnitPreview(fProfileManager.getSelected().getSettings(), composite);
		fJavaPreview.setPreviewText(PREVIEW);
	    
		final GridData gd = new GridData(GridData.FILL_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL);
		gd.horizontalSpan = numColumns;
		gd.verticalSpan= 7;
		gd.widthHint = 0;
		gd.heightHint = 0;
		fJavaPreview.getControl().setLayoutData(gd);
	}
	public final boolean hasProjectSpecificOptions(IProject project) {
		if (project != null) {
			return ProfileManager.hasProjectSpecificSettings(new ProjectScope(project));