Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/formatter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12688/src/org/rubypeople/rdt/internal/ui/preferences/formatter Added Files: CommentsTabPage.java CreateProfileDialog.java ProfileManager.java FormatterMessages.properties RubyPreview.java IndentationTabPage.java ModifyDialogTabPage.java CodeFormatterConfigurationBlock.java RenameProfileDialog.java RubyScriptPreview.java ModifyDialog.java ProfileVersioner.java AlreadyExistsDialog.java FormatterMessages.java ProfileStore.java Log Message: new code for new code formatting preferences --- NEW FILE: CommentsTabPage.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences.formatter; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Observable; import java.util.Observer; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; import org.rubypeople.rdt.core.formatter.DefaultCodeFormatterConstants; /** * Tab page for the comment formatter settings. */ public class CommentsTabPage extends ModifyDialogTabPage { private final static class Controller implements Observer { private final Collection fMasters; private final Collection fSlaves; public Controller(Collection masters, Collection slaves) { fMasters = masters; fSlaves = slaves; for (final Iterator iter = fMasters.iterator(); iter.hasNext();) { ((CheckboxPreference) iter.next()).addObserver(this); } update(null, null); } public void update(Observable o, Object arg) { boolean enabled = true; for (final Iterator iter = fMasters.iterator(); iter.hasNext();) { enabled &= ((CheckboxPreference) iter.next()).getChecked(); } for (final Iterator iter = fSlaves.iterator(); iter.hasNext();) { final Object obj = iter.next(); if (obj instanceof Preference) { ((Preference) obj).setEnabled(enabled); } else if (obj instanceof Control) { ((Group) obj).setEnabled(enabled); } } } } private final static String PREVIEW = createPreviewHeader("An example for comment formatting. This example is meant to illustrate the various possibilities offered by <i>Eclipse</i> in order to format comments.") + //$NON-NLS-1$ "require 'open-uri'\n" + //$NON-NLS-1$ "#\n" + //$NON-NLS-1$ "# This is the comment for the example module.\n" + //$NON-NLS-1$ "#\n" + //$NON-NLS-1$ " module Example\n" + //$NON-NLS-1$ " #\n" + //$NON-NLS-1$ " #\n" + //$NON-NLS-1$ " # These possibilities include:\n" + //$NON-NLS-1$ " # * Formatting of header comments. * Formatting of Rdoc tags\n" + //$NON-NLS-1$ " #\n" + //$NON-NLS-1$ " def self.bar; puts 'hello bar'; end\n" + //$NON-NLS-1$ " #\n" + //$NON-NLS-1$ " # The following is some sample code which illustrates source formatting within Rdoc comments:\n" + //$NON-NLS-1$ " # <tt>class Example\n# @a= 1\n# @b= true\n# end</tt>\n" + //$NON-NLS-1$ " #\n" + //$NON-NLS-1$ " def foo(a, b); puts a + b; end\n" + //$NON-NLS-1$ "end"; //$NON-NLS-1$ private RubyScriptPreview fPreview; public CommentsTabPage(ModifyDialog modifyDialog, Map workingValues) { super(modifyDialog, workingValues); } protected void doCreatePreferences(Composite composite, int numColumns) { // global group final Group globalGroup = createGroup(numColumns, composite, FormatterMessages.CommentsTabPage_group1_title); final CheckboxPreference global = createPrefTrueFalse(globalGroup, numColumns, FormatterMessages.CommentsTabPage_enable_comment_formatting, DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT); final CheckboxPreference header = createPrefTrueFalse(globalGroup, numColumns, FormatterMessages.CommentsTabPage_format_header, DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER); // blank lines group final Group settingsGroup = createGroup(numColumns, composite, FormatterMessages.CommentsTabPage_group2_title); final CheckboxPreference blankComments = createPrefTrueFalse(settingsGroup, numColumns, FormatterMessages.CommentsTabPage_clear_blank_lines, DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES); final Group widthGroup = createGroup(numColumns, composite, FormatterMessages.CommentsTabPage_group3_title); final NumberPreference lineWidth = createNumberPref(widthGroup, numColumns, FormatterMessages.CommentsTabPage_line_width, DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, 0, 9999); Collection masters, slaves; masters = new ArrayList(); masters.add(global); slaves = new ArrayList(); slaves.add(settingsGroup); slaves.add(header); slaves.add(blankComments); slaves.add(lineWidth); new Controller(masters, slaves); masters = new ArrayList(); masters.add(global); slaves = new ArrayList(); new Controller(masters, slaves); } protected void initializePage() { fPreview.setPreviewText(PREVIEW); } /* * (non-Javadoc) * * @see org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialogTabPage#doCreateJavaPreview(org.eclipse.swt.widgets.Composite) */ protected RubyPreview doCreateRubyPreview(Composite parent) { fPreview = new RubyScriptPreview(fWorkingValues, parent); return fPreview; } /* * (non-Javadoc) * * @see org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialogTabPage#doUpdatePreview() */ protected void doUpdatePreview() { fPreview.update(); } private CheckboxPreference createPrefTrueFalse(Composite composite, int numColumns, String text, String key) { return createCheckboxPref(composite, numColumns, text, key, FALSE_TRUE); } } --- NEW FILE: ProfileStore.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences.formatter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IScopeContext; import org.osgi.service.prefs.BackingStoreException; import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.internal.ui.RubyPlugin; import org.rubypeople.rdt.internal.ui.RubyUIException; import org.rubypeople.rdt.internal.ui.RubyUIStatus; import org.rubypeople.rdt.internal.ui.preferences.PreferencesAccess; import org.rubypeople.rdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile; import org.rubypeople.rdt.internal.ui.preferences.formatter.ProfileManager.Profile; import org.rubypeople.rdt.ui.RubyUI; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class ProfileStore { /** * A SAX event handler to parse the xml format for profiles. */ private final static class ProfileDefaultHandler extends DefaultHandler { private List fProfiles; private int fVersion; private String fName; private Map fSettings; public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equals(XML_NODE_SETTING)) { final String key= attributes.getValue(XML_ATTRIBUTE_ID); final String value= attributes.getValue(XML_ATTRIBUTE_VALUE); fSettings.put(key, value); } else if (qName.equals(XML_NODE_PROFILE)) { fName= attributes.getValue(XML_ATTRIBUTE_NAME); fSettings= new HashMap(200); } else if (qName.equals(XML_NODE_ROOT)) { fProfiles= new ArrayList(); try { fVersion= Integer.parseInt(attributes.getValue(XML_ATTRIBUTE_VERSION)); } catch (NumberFormatException ex) { throw new SAXException(ex); } } } public void endElement(String uri, String localName, String qName) { if (qName.equals(XML_NODE_PROFILE)) { fProfiles.add(new CustomProfile(fName, fSettings, fVersion)); fName= null; fSettings= null; } } public List getProfiles() { return fProfiles; } } /** * Preference key where all profiles are stored */ private static final String PREF_FORMATTER_PROFILES= "org.eclipse.jdt.ui.formatterprofiles"; //$NON-NLS-1$ /** * Preference key where all profiles are stored */ private static final String PREF_FORMATTER_PROFILES_VERSION= "org.eclipse.jdt.ui.formatterprofiles.version"; //$NON-NLS-1$ /** * Identifiers for the XML file. */ private final static String XML_NODE_ROOT= "profiles"; //$NON-NLS-1$ private final static String XML_NODE_PROFILE= "profile"; //$NON-NLS-1$ private final static String XML_NODE_SETTING= "setting"; //$NON-NLS-1$ private final static String XML_ATTRIBUTE_VERSION= "version"; //$NON-NLS-1$ private final static String XML_ATTRIBUTE_ID= "id"; //$NON-NLS-1$ private final static String XML_ATTRIBUTE_NAME= "name"; //$NON-NLS-1$ private final static String XML_ATTRIBUTE_VALUE= "value"; //$NON-NLS-1$ private ProfileStore() { } /** * @return Returns the collection of profiles currently stored in the preference store or * <code>null</code> if the loading failed. The elements are of type {@link CustomProfile} * and are all updated to the latest version. * @throws CoreException */ public static List readProfiles(IScopeContext instanceScope) throws CoreException { List res= readProfilesFromPreferences(PREF_FORMATTER_PROFILES, instanceScope); if (res == null) { return readOldForCompatibility(instanceScope); } return res; } public static void writeProfiles(Collection profiles, IScopeContext instanceScope) throws CoreException { ByteArrayOutputStream stream= new ByteArrayOutputStream(2000); try { writeProfilesToStream(profiles, stream); String val; try { val= stream.toString("UTF-8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { val= stream.toString(); } IEclipsePreferences uiPreferences = instanceScope.getNode(RubyUI.ID_PLUGIN); uiPreferences.put(PREF_FORMATTER_PROFILES, val); uiPreferences.putInt(PREF_FORMATTER_PROFILES_VERSION, ProfileVersioner.CURRENT_VERSION); } finally { try { stream.close(); } catch (IOException e) { /* ignore */ } } } private static List readProfilesFromPreferences(String key, IScopeContext instanceScope) throws CoreException { String string= instanceScope.getNode(RubyUI.ID_PLUGIN).get(key, null); if (string != null && string.length() > 0) { byte[] bytes; try { bytes= string.getBytes("UTF-8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { bytes= string.getBytes(); } InputStream is= new ByteArrayInputStream(bytes); try { List res= readProfilesFromStream(new InputSource(is)); if (res != null) { for (int i= 0; i < res.size(); i++) { ProfileVersioner.updateAndComplete((CustomProfile) res.get(i)); } } return res; } finally { try { is.close(); } catch (IOException e) { /* ignore */ } } } return null; } /** * Read the available profiles from the internal XML file and return them * as collection. * @return returns a list of <code>CustomProfile</code> or <code>null</code> */ private static List readOldForCompatibility(IScopeContext instanceScope) { // in 3.0 M9 and less the profiles were stored in a file in the plugin's meta data final String STORE_FILE= "code_formatter_profiles.xml"; //$NON-NLS-1$ File file= RubyPlugin.getDefault().getStateLocation().append(STORE_FILE).toFile(); if (!file.exists()) return null; try { // note that it's wrong to use a file reader when XML declares UTF-8: Kept for compatibility final FileReader reader= new FileReader(file); try { List res= readProfilesFromStream(new InputSource(reader)); if (res != null) { for (int i= 0; i < res.size(); i++) { ProfileVersioner.updateAndComplete((CustomProfile) res.get(i)); } writeProfiles(res, instanceScope); } file.delete(); // remove after successful write return res; } finally { reader.close(); } } catch (CoreException e) { RubyPlugin.log(e); // log but ignore } catch (IOException e) { RubyPlugin.log(e); // log but ignore } return null; } /** * Read the available profiles from the internal XML file and return them * as collection or <code>null</code> if the file is not a profile file. * @param file The file to read from * @return returns a list of <code>CustomProfile</code> or <code>null</code> * @throws CoreException */ public static List readProfilesFromFile(File file) throws CoreException { try { final FileInputStream reader= new FileInputStream(file); try { return readProfilesFromStream(new InputSource(reader)); } finally { try { reader.close(); } catch (IOException e) { /* ignore */ } } } catch (IOException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message); } } /** * Load profiles from a XML stream and add them to a map or <code>null</code> if the source is not a profile store. * @param inputSource The input stream * @return returns a list of <code>CustomProfile</code> or <code>null</code> * @throws CoreException */ private static List readProfilesFromStream(InputSource inputSource) throws CoreException { final ProfileDefaultHandler handler= new ProfileDefaultHandler(); try { final SAXParserFactory factory= SAXParserFactory.newInstance(); final SAXParser parser= factory.newSAXParser(); parser.parse(inputSource, handler); } catch (SAXException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message); } catch (IOException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message); } catch (ParserConfigurationException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message); } return handler.getProfiles(); } /** * Write the available profiles to the internal XML file. * @param profiles List of <code>CustomProfile</code> * @param file File to write * @throws CoreException */ public static void writeProfilesToFile(Collection profiles, File file) throws CoreException { final OutputStream writer; try { writer= new FileOutputStream(file); try { writeProfilesToStream(profiles, writer); } finally { try { writer.close(); } catch (IOException e) { /* ignore */ } } } catch (IOException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message); } } /** * Save profiles to an XML stream * @param profiles List of <code>CustomProfile</code> * @param stream Stream to write * @throws CoreException */ private static void writeProfilesToStream(Collection profiles, OutputStream stream) throws CoreException { try { final DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); final DocumentBuilder builder= factory.newDocumentBuilder(); final Document document= builder.newDocument(); final Element rootElement = document.createElement(XML_NODE_ROOT); rootElement.setAttribute(XML_ATTRIBUTE_VERSION, Integer.toString(ProfileVersioner.CURRENT_VERSION)); document.appendChild(rootElement); 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); } } Transformer transformer=TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ transformer.transform(new DOMSource(document), new StreamResult(stream)); } catch (TransformerException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message); } catch (ParserConfigurationException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message); } } /* * Create a new profile element in the specified document. The profile is not added * to the document by this method. */ private static Element createProfileElement(Profile profile, Document document) { final Element element= document.createElement(XML_NODE_PROFILE); element.setAttribute(XML_ATTRIBUTE_NAME, profile.getName()); element.setAttribute(XML_ATTRIBUTE_VERSION, Integer.toString(profile.getVersion())); final Iterator keyIter= ProfileManager.getKeys().iterator(); while (keyIter.hasNext()) { final String key= (String)keyIter.next(); final String value= (String)profile.getSettings().get(key); if (value != null) { final Element setting= document.createElement(XML_NODE_SETTING); setting.setAttribute(XML_ATTRIBUTE_ID, key); setting.setAttribute(XML_ATTRIBUTE_VALUE, value); element.appendChild(setting); } else { RubyPlugin.logErrorMessage("ProfileStore: Profile does not contain value for key " + key); //$NON-NLS-1$ } } return element; } public static void checkCurrentOptionsVersion() { PreferencesAccess access= PreferencesAccess.getOriginalPreferences(); IScopeContext instanceScope= access.getInstanceScope(); IEclipsePreferences uiPreferences= instanceScope.getNode(RubyUI.ID_PLUGIN); int version= uiPreferences.getInt(PREF_FORMATTER_PROFILES_VERSION, 0); if (version >= ProfileVersioner.CURRENT_VERSION) { return; // is up to date } try { List profiles= ProfileStore.readProfiles(instanceScope); if (profiles == null) { profiles= Collections.EMPTY_LIST; } ProfileManager manager= new ProfileManager(profiles, instanceScope, access); if (manager.getSelected() instanceof CustomProfile) { manager.commitChanges(instanceScope); // updates RubyCore options } uiPreferences.putInt(PREF_FORMATTER_PROFILES_VERSION, ProfileVersioner.CURRENT_VERSION); savePreferences(instanceScope); IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (int i= 0; i < projects.length; i++) { IScopeContext scope= access.getProjectScope(projects[i]); if (ProfileManager.hasProjectSpecificSettings(scope)) { manager= new ProfileManager(profiles, scope, access); manager.commitChanges(scope); // updates RubyCore project options savePreferences(scope); } } } catch (CoreException e) { RubyPlugin.log(e); } catch (BackingStoreException e) { RubyPlugin.log(e); } } private static void savePreferences(final IScopeContext context) throws BackingStoreException { try { context.getNode(RubyUI.ID_PLUGIN).flush(); } finally { context.getNode(RubyCore.PLUGIN_ID).flush(); } } /* * Creates a UI exception for logging purposes */ private static RubyUIException createException(Throwable t, String message) { return new RubyUIException(RubyUIStatus.createError(IStatus.ERROR, message, t)); } } --- NEW FILE: FormatterMessages.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * is...@be... * - 103706 [formatter] indent empty lines *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences.formatter; import org.eclipse.osgi.util.NLS; /** * Helper class to get NLSed messages. */ final class FormatterMessages extends NLS { private static final String BUNDLE_NAME= FormatterMessages.class.getName(); private FormatterMessages() { // Do not instantiate } public static String WhiteSpaceTabPage_assignments; public static String WhiteSpaceTabPage_assignments_before_assignment_operator; public static String WhiteSpaceTabPage_assignments_after_assignment_operator; public static String WhiteSpaceTabPage_operators; public static String WhiteSpaceTabPage_operators_before_binary_operators; public static String WhiteSpaceTabPage_operators_after_binary_operators; public static String WhiteSpaceTabPage_operators_before_unary_operators; public static String WhiteSpaceTabPage_operators_after_unary_operators; public static String WhiteSpaceTabPage_operators_before_prefix_operators; public static String WhiteSpaceTabPage_operators_after_prefix_operators; public static String WhiteSpaceTabPage_operators_before_postfix_operators; public static String WhiteSpaceTabPage_operators_after_postfix_operators; public static String WhiteSpaceTabPage_classes; public static String WhiteSpaceTabPage_classes_before_opening_brace_of_a_class; public static String WhiteSpaceTabPage_classes_before_opening_brace_of_anon_class; public static String WhiteSpaceTabPage_classes_before_comma_implements; public static String WhiteSpaceTabPage_classes_after_comma_implements; public static String WhiteSpaceTabPage_methods; public static String WhiteSpaceTabPage_constructors; public static String WhiteSpaceTabPage_fields; public static String WhiteSpaceTabPage_fields_before_comma; public static String WhiteSpaceTabPage_fields_after_comma; public static String WhiteSpaceTabPage_localvars; public static String WhiteSpaceTabPage_localvars_before_comma; public static String WhiteSpaceTabPage_localvars_after_comma; public static String WhiteSpaceTabPage_arrayinit; public static String WhiteSpaceTabPage_arraydecls; public static String WhiteSpaceTabPage_arrayelem; public static String WhiteSpaceTabPage_arrayalloc; public static String WhiteSpaceTabPage_calls; public static String WhiteSpaceTabPage_calls_before_comma_in_method_args; public static String WhiteSpaceTabPage_calls_after_comma_in_method_args; public static String WhiteSpaceTabPage_calls_before_comma_in_alloc; public static String WhiteSpaceTabPage_calls_after_comma_in_alloc; public static String WhiteSpaceTabPage_calls_before_comma_in_qalloc; public static String WhiteSpaceTabPage_calls_after_comma_in_qalloc; public static String WhiteSpaceTabPage_statements; public static String WhiteSpaceTabPage_blocks; public static String WhiteSpaceTabPage_switch; public static String WhiteSpaceTabPage_switch_before_case_colon; public static String WhiteSpaceTabPage_switch_before_default_colon; public static String WhiteSpaceTabPage_do; public static String WhiteSpaceTabPage_synchronized; public static String WhiteSpaceTabPage_try; public static String WhiteSpaceTabPage_if; public static String WhiteSpaceTabPage_assert; public static String WhiteSpaceTabPage_for; public static String WhiteSpaceTabPage_for_before_comma_init; public static String WhiteSpaceTabPage_for_after_comma_init; public static String WhiteSpaceTabPage_for_before_comma_inc; public static String WhiteSpaceTabPage_for_after_comma_inc; public static String WhiteSpaceTabPage_labels; public static String WhiteSpaceTabPage_annotations; public static String WhiteSpaceTabPage_annotation_types; public static String WhiteSpaceTabPage_enums; public static String WhiteSpaceTabPage_wildcardtype; public static String WhiteSpaceTabPage_param_type_ref; public static String WhiteSpaceTabPage_type_arguments; public static String WhiteSpaceTabPage_type_parameters; public static String WhiteSpaceTabPage_conditionals; public static String WhiteSpaceTabPage_typecasts; public static String WhiteSpaceTabPage_parenexpr; public static String WhiteSpaceTabPage_declarations; public static String WhiteSpaceTabPage_expressions; public static String WhiteSpaceTabPage_arrays; public static String WhiteSpaceTabPage_parameterized_types; public static String WhiteSpaceTabPage_after_opening_brace; public static String WhiteSpaceTabPage_after_closing_brace; public static String WhiteSpaceTabPage_before_opening_brace; public static String WhiteSpaceTabPage_before_closing_brace; public static String WhiteSpaceTabPage_between_empty_braces; public static String WhiteSpaceTabPage_after_opening_paren; public static String WhiteSpaceTabPage_after_closing_paren; public static String WhiteSpaceTabPage_before_opening_paren; public static String WhiteSpaceTabPage_before_closing_paren; public static String WhiteSpaceTabPage_between_empty_parens; public static String WhiteSpaceTabPage_after_opening_bracket; public static String WhiteSpaceTabPage_before_opening_bracket; public static String WhiteSpaceTabPage_before_closing_bracket; public static String WhiteSpaceTabPage_between_empty_brackets; public static String WhiteSpaceTabPage_before_comma_in_params; public static String WhiteSpaceTabPage_after_comma_in_params; public static String WhiteSpaceTabPage_before_comma_in_throws; public static String WhiteSpaceTabPage_after_comma_in_throws; public static String WhiteSpaceTabPage_before_ellipsis; public static String WhiteSpaceTabPage_after_ellipsis; public static String WhiteSpaceTabPage_before_comma; public static String WhiteSpaceTabPage_after_comma; public static String WhiteSpaceTabPage_after_semicolon; public static String WhiteSpaceTabPage_before_semicolon; public static String WhiteSpaceTabPage_before_colon; public static String WhiteSpaceTabPage_after_colon; public static String WhiteSpaceTabPage_before_question; public static String WhiteSpaceTabPage_after_question; public static String WhiteSpaceTabPage_before_at; public static String WhiteSpaceTabPage_after_at; public static String WhiteSpaceTabPage_after_opening_angle_bracket; public static String WhiteSpaceTabPage_after_closing_angle_bracket; public static String WhiteSpaceTabPage_before_opening_angle_bracket; public static String WhiteSpaceTabPage_before_closing_angle_bracket; public static String WhiteSpaceTabPage_before_and_list; public static String WhiteSpaceTabPage_after_and_list; public static String WhiteSpaceTabPage_enum_decl_before_opening_brace; public static String WhiteSpaceTabPage_enum_decl_before_comma; public static String WhiteSpaceTabPage_enum_decl_after_comma; public static String WhiteSpaceTabPage_enum_const_arg_before_opening_paren; public static String WhiteSpaceTabPage_enum_const_arg_after_opening_paren; public static String WhiteSpaceTabPage_enum_const_arg_between_empty_parens; public static String WhiteSpaceTabPage_enum_const_arg_before_comma; public static String WhiteSpaceTabPage_enum_const_arg_after_comma; public static String WhiteSpaceTabPage_enum_const_arg_before_closing_paren; public static String WhiteSpaceTabPage_enum_const_before_opening_brace; public static String WhiteSpaceTabPage_annot_type_method_before_opening_paren; public static String WhiteSpaceTabPage_annot_type_method_between_empty_parens; public static String WhiteSpaceTabPage_before_parenthesized_expressions; public static String WhiteSpaceTabPage_insert_space; public static String WhiteSpaceOptions_return; public static String WhiteSpaceOptions_before; public static String WhiteSpaceOptions_after; public static String WhiteSpaceOptions_operator; public static String WhiteSpaceOptions_assignment_operator; public static String WhiteSpaceOptions_binary_operator; public static String WhiteSpaceOptions_unary_operator; public static String WhiteSpaceOptions_prefix_operator; public static String WhiteSpaceOptions_postfix_operator; public static String WhiteSpaceOptions_opening_paren; public static String WhiteSpaceOptions_catch; public static String WhiteSpaceOptions_for; public static String WhiteSpaceOptions_if; public static String WhiteSpaceOptions_switch; public static String WhiteSpaceOptions_synchronized; public static String WhiteSpaceOptions_while; public static String WhiteSpaceOptions_assert; public static String WhiteSpaceOptions_member_function_declaration; public static String WhiteSpaceOptions_constructor; public static String WhiteSpaceOptions_method; public static String WhiteSpaceOptions_method_call; public static String WhiteSpaceOptions_paren_expr; public static String WhiteSpaceOptions_enum_constant_body; public static String WhiteSpaceOptions_enum_constant_arguments; public static String WhiteSpaceOptions_enum_declaration; public static String WhiteSpaceOptions_annotation_modifier; public static String WhiteSpaceOptions_annotation_modifier_args; public static String WhiteSpaceOptions_annotation_type_member; public static String WhiteSpaceOptions_annotation_type; public static String WhiteSpaceOptions_type_cast; public static String WhiteSpaceOptions_parameterized_type; public static String WhiteSpaceOptions_type_arguments; public static String WhiteSpaceOptions_type_parameters; public static String WhiteSpaceOptions_vararg_parameter; public static String WhiteSpaceOptions_closing_paren; public static String WhiteSpaceOptions_opening_brace; public static String WhiteSpaceOptions_closing_brace; public static String WhiteSpaceOptions_opening_bracket; public static String WhiteSpaceOptions_closing_bracket; public static String WhiteSpaceOptions_class_decl; public static String WhiteSpaceOptions_anon_class_decl; public static String WhiteSpaceOptions_initializer; public static String WhiteSpaceOptions_block; public static String WhiteSpaceOptions_array_decl; public static String WhiteSpaceOptions_array_element_access; public static String WhiteSpaceOptions_array_alloc; public static String WhiteSpaceOptions_array_init; public static String WhiteSpaceOptions_arguments; public static String WhiteSpaceOptions_initialization; public static String WhiteSpaceOptions_incrementation; public static String WhiteSpaceOptions_parameters; public static String WhiteSpaceOptions_explicit_constructor_call; public static String WhiteSpaceOptions_alloc_expr; public static String WhiteSpaceOptions_throws; public static String WhiteSpaceOptions_mult_decls; public static String WhiteSpaceOptions_local_vars; public static String WhiteSpaceOptions_fields; public static String WhiteSpaceOptions_implements_clause; public static String WhiteSpaceOptions_colon; public static String WhiteSpaceOptions_conditional; public static String WhiteSpaceOptions_wildcard; public static String WhiteSpaceOptions_label; public static String WhiteSpaceOptions_comma; public static String WhiteSpaceOptions_semicolon; public static String WhiteSpaceOptions_question_mark; public static String WhiteSpaceOptions_between_empty_parens; public static String WhiteSpaceOptions_between_empty_braces; public static String WhiteSpaceOptions_between_empty_brackets; public static String WhiteSpaceOptions_constructor_decl; public static String WhiteSpaceOptions_method_decl; public static String WhiteSpaceOptions_case; public static String WhiteSpaceOptions_default; public static String WhiteSpaceOptions_statements; public static String WhiteSpaceOptions_before_opening_paren; public static String WhiteSpaceOptions_after_opening_paren; public static String WhiteSpaceOptions_before_closing_paren; public static String WhiteSpaceOptions_after_closing_paren; public static String WhiteSpaceOptions_before_opening_brace; public static String WhiteSpaceOptions_after_opening_brace; public static String WhiteSpaceOptions_after_closing_brace; public static String WhiteSpaceOptions_before_closing_brace; public static String WhiteSpaceOptions_before_opening_bracket; public static String WhiteSpaceOptions_after_opening_bracket; public static String WhiteSpaceOptions_before_closing_bracket; public static String WhiteSpaceOptions_before_opening_angle_bracket; public static String WhiteSpaceOptions_after_opening_angle_bracket; public static String WhiteSpaceOptions_before_closing_angle_bracket; public static String WhiteSpaceOptions_after_closing_angle_bracket; public static String WhiteSpaceOptions_before_operator; public static String WhiteSpaceOptions_after_operator; public static String WhiteSpaceOptions_before_comma; public static String WhiteSpaceOptions_after_comma; public static String WhiteSpaceOptions_after_colon; public static String WhiteSpaceOptions_before_colon; public static String WhiteSpaceOptions_before_semicolon; public static String WhiteSpaceOptions_after_semicolon; public static String WhiteSpaceOptions_before_question_mark; public static String WhiteSpaceOptions_after_question_mark; public static String WhiteSpaceOptions_before_at; public static String WhiteSpaceOptions_after_at; public static String WhiteSpaceOptions_before_and; public static String WhiteSpaceOptions_after_and; public static String WhiteSpaceOptions_before_ellipsis; public static String WhiteSpaceOptions_after_ellipsis; public static String WhiteSpaceOptions_return_with_parenthesized_expression; public static String LineWrappingTabPage_compact_if_else; public static String LineWrappingTabPage_extends_clause; public static String LineWrappingTabPage_enum_constant_arguments; public static String LineWrappingTabPage_enum_constants; public static String LineWrappingTabPage_implements_clause; public static String LineWrappingTabPage_parameters; public static String LineWrappingTabPage_arguments; public static String LineWrappingTabPage_qualified_invocations; public static String LineWrappingTabPage_throws_clause; public static String LineWrappingTabPage_object_allocation; public static String LineWrappingTabPage_qualified_object_allocation; public static String LineWrappingTabPage_array_init; public static String LineWrappingTabPage_explicit_constructor_invocations; public static String LineWrappingTabPage_conditionals; public static String LineWrappingTabPage_binary_exprs; public static String LineWrappingTabPage_indentation_default; public static String LineWrappingTabPage_indentation_on_column; public static String LineWrappingTabPage_indentation_by_one; public static String LineWrappingTabPage_class_decls; public static String LineWrappingTabPage_method_decls; public static String LineWrappingTabPage_constructor_decls; public static String LineWrappingTabPage_function_calls; public static String LineWrappingTabPage_expressions; public static String LineWrappingTabPage_statements; public static String LineWrappingTabPage_enum_decls; public static String LineWrappingTabPage_wrapping_policy_label_text; public static String LineWrappingTabPage_indentation_policy_label_text; public static String LineWrappingTabPage_force_split_checkbox_text; public static String LineWrappingTabPage_force_split_checkbox_multi_text; public static String LineWrappingTabPage_line_width_for_preview_label_text; public static String LineWrappingTabPage_group; public static String LineWrappingTabPage_multi_group; public static String LineWrappingTabPage_multiple_selections; public static String LineWrappingTabPage_occurences; public static String LineWrappingTabPage_splitting_do_not_split; public static String LineWrappingTabPage_splitting_wrap_when_necessary; public static String LineWrappingTabPage_splitting_always_wrap_first_others_when_necessary; public static String LineWrappingTabPage_splitting_wrap_always; public static String LineWrappingTabPage_splitting_wrap_always_indent_all_but_first; public static String LineWrappingTabPage_splitting_wrap_always_except_first_only_if_necessary; public static String LineWrappingTabPage_width_indent; public static String LineWrappingTabPage_width_indent_option_max_line_width; public static String LineWrappingTabPage_width_indent_option_default_indent_wrapped; public static String LineWrappingTabPage_width_indent_option_default_indent_array; public static String LineWrappingTabPage_error_invalid_value; public static String LineWrappingTabPage_enum_superinterfaces; public static String LineWrappingTabPage_assignment_alignment; public static String AlreadyExistsDialog_message_profile_already_exists; public static String AlreadyExistsDialog_message_profile_name_empty; public static String AlreadyExistsDialog_dialog_title; public static String AlreadyExistsDialog_dialog_label; public static String AlreadyExistsDialog_rename_radio_button_desc; public static String AlreadyExistsDialog_overwrite_radio_button_desc; public static String BlankLinesTabPage_preview_header; public static String BlankLinesTabPage_compilation_unit_group_title; public static String BlankLinesTabPage_compilation_unit_option_before_package; public static String BlankLinesTabPage_compilation_unit_option_after_package; public static String BlankLinesTabPage_compilation_unit_option_before_import; public static String BlankLinesTabPage_compilation_unit_option_after_import; public static String BlankLinesTabPage_compilation_unit_option_between_type_declarations; public static String BlankLinesTabPage_class_group_title; public static String BlankLinesTabPage_class_option_before_first_decl; public static String BlankLinesTabPage_class_option_before_decls_of_same_kind; public static String BlankLinesTabPage_class_option_before_member_class_decls; public static String BlankLinesTabPage_class_option_before_field_decls; public static String BlankLinesTabPage_class_option_before_method_decls; public static String BlankLinesTabPage_class_option_at_beginning_of_method_body; public static String BlankLinesTabPage_blank_lines_group_title; public static String BlankLinesTabPage_blank_lines_option_empty_lines_to_preserve; public static String BracesTabPage_preview_header; public static String BracesTabPage_position_same_line; public static String BracesTabPage_position_next_line; public static String BracesTabPage_position_next_line_indented; public static String BracesTabPage_position_next_line_on_wrap; public static String BracesTabPage_group_brace_positions_title; public static String BracesTabPage_option_class_declaration; public static String BracesTabPage_option_anonymous_class_declaration; public static String BracesTabPage_option_method_declaration; public static String BracesTabPage_option_constructor_declaration; public static String BracesTabPage_option_blocks; public static String BracesTabPage_option_blocks_in_case; public static String BracesTabPage_option_switch_case; public static String BracesTabPage_option_array_initializer; public static String BracesTabPage_option_keep_empty_array_initializer_on_one_line; public static String BracesTabPage_option_enum_declaration; public static String BracesTabPage_option_enumconst_declaration; public static String BracesTabPage_option_annotation_type_declaration; public static String CodingStyleConfigurationBlock_save_profile_dialog_title; public static String CodingStyleConfigurationBlock_save_profile_error_title; public static String CodingStyleConfigurationBlock_save_profile_error_message; public static String CodingStyleConfigurationBlock_load_profile_dialog_title; public static String CodingStyleConfigurationBlock_load_profile_error_title; public static String CodingStyleConfigurationBlock_load_profile_error_message; public static String CodingStyleConfigurationBlock_load_profile_error_too_new_title; public static String CodingStyleConfigurationBlock_load_profile_error_too_new_message; public static String CodingStyleConfigurationBlock_preview_title; public static String CodingStyleConfigurationBlock_save_profile_overwrite_title; public static String CodingStyleConfigurationBlock_save_profile_overwrite_message; public static String CodingStyleConfigurationBlock_edit_button_desc; public static String CodingStyleConfigurationBlock_show_button_desc; public static String CodingStyleConfigurationBlock_rename_button_desc; public static String CodingStyleConfigurationBlock_remove_button_desc; public static String CodingStyleConfigurationBlock_new_button_desc; public static String CodingStyleConfigurationBlock_load_button_desc; public static String CodingStyleConfigurationBlock_save_button_desc; public static String CodingStyleConfigurationBlock_preview_label_text; public static String CodingStyleConfigurationBlock_error_reading_xml_message; public static String CodingStyleConfigurationBlock_error_serializing_xml_message; public static String CodingStyleConfigurationBlock_delete_confirmation_title; public static String CodingStyleConfigurationBlock_delete_confirmation_question; public static String CommentsTabPage_group1_title; public static String CommentsTabPage_enable_comment_formatting; public static String CommentsTabPage_format_header; public static String CommentsTabPage_format_html; public static String CommentsTabPage_format_code_snippets; public static String CommentsTabPage_group2_title; public static String CommentsTabPage_clear_blank_lines; public static String CommentsTabPage_blank_line_before_javadoc_tags; public static String CommentsTabPage_indent_javadoc_tags; public static String CommentsTabPage_indent_description_after_param; public static String CommentsTabPage_new_line_after_param_tags; public static String CommentsTabPage_group3_title; public static String CommentsTabPage_line_width; public static String ControlStatementsTabPage_preview_header; public static String ControlStatementsTabPage_general_group_title; public static String ControlStatementsTabPage_general_group_insert_new_line_before_else_statements; public static String ControlStatementsTabPage_general_group_insert_new_line_before_catch_statements; public static String ControlStatementsTabPage_general_group_insert_new_line_before_finally_statements; public static String ControlStatementsTabPage_general_group_insert_new_line_before_while_in_do_statements; public static String ControlStatementsTabPage_if_else_group_title; public static String ControlStatementsTabPage_if_else_group_keep_then_on_same_line; public static String ControlStatementsTabPage_if_else_group_keep_simple_if_on_one_line; public static String ControlStatementsTabPage_if_else_group_keep_else_on_same_line; public static String ControlStatementsTabPage_if_else_group_keep_else_if_on_one_line; public static String ControlStatementsTabPage_if_else_group_keep_guardian_clause_on_one_line; public static String CreateProfileDialog_status_message_profile_with_this_name_already_exists; public static String CreateProfileDialog_status_message_profile_name_is_empty; public static String CreateProfileDialog_dialog_title; public static String CreateProfileDialog_profile_name_label_text; public static String CreateProfileDialog_base_profile_label_text; public static String CreateProfileDialog_open_edit_dialog_checkbox_text; public static String IndentationTabPage_preview_header; public static String IndentationTabPage_general_group_title; public static String IndentationTabPage_general_group_option_tab_policy; public static String IndentationTabPage_general_group_option_tab_policy_SPACE; public static String IndentationTabPage_general_group_option_tab_policy_TAB; public static String IndentationTabPage_general_group_option_tab_policy_MIXED; public static String IndentationTabPage_general_group_option_tab_size; public static String IndentationTabPage_general_group_option_indent_size; public static String IndentationTabPage_indent_group_title; public static String IndentationTabPage_class_group_option_indent_declarations_within_class_body; public static String IndentationTabPage_class_group_option_indent_declarations_within_enum_const; public static String IndentationTabPage_class_group_option_indent_declarations_within_enum_decl; public static String IndentationTabPage_block_group_option_indent_statements_compare_to_body; public static String IndentationTabPage_block_group_option_indent_statements_compare_to_block; public static String IndentationTabPage_switch_group_option_indent_statements_within_switch_body; public static String IndentationTabPage_switch_group_option_indent_statements_within_case_body; public static String IndentationTabPage_switch_group_option_indent_break_statements; public static String IndentationTabPage_indent_empty_lines; public static String IndentationTabPage_use_tabs_only_for_leading_indentations; public static String ModifyDialog_dialog_title; public static String ModifyDialog_apply_button; public static String ModifyDialog_dialog_show_title; public static String ModifyDialog_dialog_show_warning_builtin; public static String ModifyDialog_tabpage_braces_title; public static String ModifyDialog_tabpage_indentation_title; public static String ModifyDialog_tabpage_whitespace_title; public static String ModifyDialog_tabpage_blank_lines_title; public static String ModifyDialog_tabpage_new_lines_title; public static String ModifyDialog_tabpage_control_statements_title; public static String ModifyDialog_tabpage_line_wrapping_title; public static String ModifyDialog_tabpage_comments_title; public static String ModifyDialogTabPage_preview_label_text; public static String NewLinesTabPage_preview_header; public static String NewLinesTabPage_newlines_group_title; public static String NewLinesTabPage_newlines_group_option_empty_class_body; public static String NewLinesTabPage_newlines_group_option_empty_anonymous_class_body; public static String NewLinesTabPage_newlines_group_option_empty_enum_declaration; public static String NewLinesTabPage_newlines_group_option_empty_enum_constant; public static String NewLinesTabPage_newlines_group_option_empty_method_body; public static String NewLinesTabPage_newlines_group_option_empty_block; public static String NewLinesTabPage_newlines_group_option_empty_end_of_file; public static String NewLinesTabPage_empty_statement_group_title; public static String NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line; public static String NewLinesTabPage_arrayInitializer_group_title; public static String NewLinesTabPage_array_group_option_after_opening_brace_of_array_initializer; public static String NewLinesTabPage_array_group_option_before_closing_brace_of_array_initializer; public static String NewLinesTabPage_annotations_group_title; public static String NewLinesTabPage_annotations_group_option_after_annotation; public static String ProfileManager_eclipse_profile_name; public static String ProfileManager_ruby_conventions_profile_name; public static String ProfileManager_unmanaged_profile; public static String ProfileManager_unmanaged_profile_with_name; public static String RenameProfileDialog_status_message_profile_with_this_name_already_exists; public static String RenameProfileDialog_status_message_profile_name_empty; public static String RenameProfileDialog_dialog_title; public static String RenameProfileDialog_dialog_label_enter_a_new_name; public static String ModifyDialogTabPage_error_msg_values_text_unassigned; public static String ModifyDialogTabPage_error_msg_values_items_text_unassigned; public static String ModifyDialogTabPage_NumberPreference_error_invalid_key; public static String ModifyDialogTabPage_NumberPreference_error_invalid_value; public static String RubyPreview_formatter_exception; public static String WhiteSpaceTabPage_sort_by_java_element; public static String WhiteSpaceTabPage_sort_by_syntax_element; static { NLS.initializeMessages(BUNDLE_NAME, FormatterMessages.class); } } --- NEW FILE: CreateProfileDialog.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences.formatter; import java.util.HashMap; import java.util.List; import java.util.Map; import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.StatusDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.rubypeople.rdt.internal.ui.RubyPlugin; import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo; import org.rubypeople.rdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile; import org.rubypeople.rdt.internal.ui.preferences.formatter.ProfileManager.Profile; import org.rubypeople.rdt.ui.RubyUI; /** * The dialog to create a new profile. */ public class CreateProfileDialog extends StatusDialog { private static final String PREF_OPEN_EDIT_DIALOG = RubyUI.ID_PLUGIN + ".codeformatter.create_profile_dialog.open_edit"; //$NON-NLS-1$ private Text fNameText; private Combo fProfileCombo; private Button fEditCheckbox; private final static StatusInfo fOk = new StatusInfo(); private final static StatusInfo fEmpty = new StatusInfo(IStatus.ERROR, FormatterMessages.CreateProfileDialog_status_message_profile_name_is_empty); private final static StatusInfo fDuplicate = new StatusInfo( IStatus.ERROR, FormatterMessages.CreateProfileDialog_status_message_profile_with_this_name_already_exists); private final ProfileManager fProfileManager; private final List fSortedProfiles; private final String[] fSortedNames; private CustomProfile fCreatedProfile; protected boolean fOpenEditDialog; public CreateProfileDialog(Shell parentShell, ProfileManager profileManager) { super(parentShell); fProfileManager = profileManager; fSortedProfiles = fProfileManager.getSortedProfiles(); fSortedNames = fProfileManager.getSortedDisplayNames(); } public void create() { super.create(); setTitle(FormatterMessages.CreateProfileDialog_dialog_title); } public Control createDialogArea(Composite parent) { final int numColumns = 2; GridData gd; final GridLayout layout = new GridLayout(numColumns, false); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(layout); // Create "Profile name:" label gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; gd.widthHint = convertWidthInCharsToPixels(60); final Label nameLabel = new Label(composite, SWT.WRAP); nameLabel.setText(FormatterMessages.CreateProfileDialog_profile_name_label_text); nameLabel.setLayoutData(gd); // Create text field to enter name gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER); fNameText.setLayoutData(gd); fNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { doValidation(); } }); // Create "Initialize settings ..." label gd = new GridData(); gd.horizontalSpan = numColumns; Label profileLabel = new Label(composite, SWT.WRAP); profileLabel.setText(FormatterMessages.CreateProfileDialog_base_profile_label_text); profileLabel.setLayoutData(gd); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); fProfileCombo.setLayoutData(gd); // "Open the edit dialog now" checkbox gd = new GridData(); gd.horizontalSpan = numColumns; fEditCheckbox = new Button(composite, SWT.CHECK); fEditCheckbox.setText(FormatterMessages.CreateProfileDialog_open_edit_dialog_checkbox_text); fEditCheckbox.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { fOpenEditDialog = ((Button) e.widget).getSelection(); } public void widgetDefaultSelected(SelectionEvent e) { } }); final IDialogSettings dialogSettings = RubyPlugin.getDefault().getDialogSettings();// .get(PREF_OPEN_EDIT_DIALOG); if (dialogSettings.get(PREF_OPEN_EDIT_DIALOG) != null) { fOpenEditDialog = dialogSettings.getBoolean(PREF_OPEN_EDIT_DIALOG); } else { fOpenEditDialog = true; } ... [truncated message content] |