Html code style settings

This commit is contained in:
Olesya Smirnova
2005-01-24 11:37:13 +03:00
parent 23f7656556
commit 0b130fec22
6 changed files with 1079 additions and 268 deletions
@@ -763,6 +763,30 @@ public class CodeStyleSettings implements Cloneable, JDOMExternalizable {
public boolean XML_SPACE_AROUND_EQUALITY_IN_ATTRINUTE = false;
public boolean XML_SPACE_AROUND_TAG_NAME = false;
// ---------------------------------------------------------------------------------------
// ---------------------------------- HTML formatting options -------------------------
public boolean HTML_KEEP_WHITESPACES = false;
public int HTML_ATTRIBUTE_WRAP = WRAP_AS_NEEDED;
public int HTML_TEXT_WRAP = WRAP_AS_NEEDED;
public boolean HTML_KEEP_LINE_BREAKS = true;
public int HTML_KEEP_BLANK_LINES = 2;
public boolean HTML_ALIGN_ATTRIBUTES = true;
public boolean HTML_ALIGN_TEXT = false;
public boolean HTML_SPACE_AROUND_EQUALITY_IN_ATTRINUTE = false;
public boolean HTML_SPACE_AROUND_TAG_NAME = false;
public String HTML_ELEMENTS_TO_INSERT_NEW_LINE_BEFORE = "body,div,p,form,h1,h2,h3";
public String HTML_ELEMENTS_TO_REMOVE_NEW_LINE_BEFORE = "br";
public String HTML_DO_NOT_ALIGN_CHILDREN_OF = "html,body";
public int HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_SIZE = 7000;
public String HTML_TEXT_ELEMENTS = "a,b,img,span";
public String HTML_KEEP_WHITESPACES_INSIDE = "span";
// ---------------------------------------------------------------------------------------
//-----------------------------------JSPX formatting settings-----------------------------
@@ -31,23 +31,24 @@
*/
package com.intellij.application.options;
import com.intellij.openapi.options.BaseConfigurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import javax.swing.*;
public class CodeStyleXmlConfigurable implements Configurable{
private CodeStyleXmlPanel myPanel;
public abstract class CodeStyleAbstractConfigurable implements Configurable{
private CodeStyleAbstractPanel myPanel;
private final CodeStyleSettings mySettings;
private final String myDisplayName;
public CodeStyleXmlConfigurable(CodeStyleSettings settings) {
public CodeStyleAbstractConfigurable(CodeStyleSettings settings, final String displayName) {
mySettings = settings;
myDisplayName = displayName;
}
public String getDisplayName() {
return "XML";
return myDisplayName;
}
public Icon getIcon() {
@@ -59,10 +60,12 @@ public class CodeStyleXmlConfigurable implements Configurable{
}
public JComponent createComponent() {
myPanel = new CodeStyleXmlPanel(mySettings);
myPanel = createPanel();
return myPanel.getPanel();
}
protected abstract CodeStyleAbstractPanel createPanel();
public void apply() throws ConfigurationException {
myPanel.apply(mySettings);
}
@@ -0,0 +1,168 @@
/*
* Copyright (c) 2004 JetBrains s.r.o. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* -Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* -Redistribution in binary form must reproduct the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* Neither the name of JetBrains or IntelliJ IDEA
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. JETBRAINS AND ITS LICENSORS SHALL NOT
* BE LIABLE FOR ANY DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT
* OF OR RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL JETBRAINS OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN
* IF JETBRAINS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
*/
package com.intellij.application.options;
import com.intellij.ide.highlighter.HighlighterFactory;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.EditorSettings;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.util.IncorrectOperationException;
import javax.swing.*;
public abstract class CodeStyleAbstractPanel {
private static Logger LOG = Logger.getInstance("#com.intellij.application.options.CodeStyleXmlPanel");
protected final Editor myEditor;
protected final CodeStyleSettings mySettings;
private boolean myShouldUpdatePreview;
protected final static int[] ourWrappings = new int[] {CodeStyleSettings.DO_NOT_WRAP,
CodeStyleSettings.WRAP_AS_NEEDED,
CodeStyleSettings.WRAP_ON_EVERY_ITEM,
CodeStyleSettings.WRAP_ALWAYS};
public CodeStyleAbstractPanel(CodeStyleSettings settings) {
mySettings = settings;
myEditor = createEditor();
}
protected static final Editor createEditor() {
EditorFactory editorFactory = EditorFactory.getInstance();
Document editorDocument = editorFactory.createDocument("");
EditorEx editor = (EditorEx)editorFactory.createViewer(editorDocument);
EditorSettings editorSettings = editor.getSettings();
editorSettings.setWhitespacesShown(true);
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setLineNumbersShown(false);
editorSettings.setFoldingOutlineShown(false);
editorSettings.setAdditionalColumnsCount(0);
editorSettings.setAdditionalLinesCount(1);
EditorColorsScheme scheme = editor.getColorsScheme();
scheme.setColor(EditorColors.CARET_ROW_COLOR, null);
editor.setHighlighter(HighlighterFactory.createXMLHighlighter(scheme));
return editor;
}
protected final void updatePreview() {
if (!myShouldUpdatePreview) {
return;
}
final String text = getPreviewText();
final Project project = ProjectManager.getInstance().getDefaultProject();
final PsiManager manager = PsiManager.getInstance(project);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
PsiElementFactory factory = manager.getElementFactory();
try {
PsiFile psiFile = factory.createFileFromText("a." + getFileType().getDefaultExtension(), text);
CodeStyleSettings clone = (CodeStyleSettings)mySettings.clone();
apply(clone);
CodeStyleSettingsManager.getInstance(project).setTemporarySettings(clone);
CodeStyleManager.getInstance(project).reformat(psiFile);
CodeStyleSettingsManager.getInstance(project).dropTemporarySettings();
myEditor.getSettings().setTabSize(clone.getTabSize(getFileType()));
Document document = myEditor.getDocument();
document.replaceString(0, document.getTextLength(), psiFile.getText());
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
});
}
protected abstract FileType getFileType();
protected abstract String getPreviewText();
public abstract void apply(CodeStyleSettings settings);
public final void reset() {
myShouldUpdatePreview = false;
try {
resetImpl();
}
finally {
myShouldUpdatePreview = true;
updatePreview();
}
}
protected int getIndexForWrapping(int value) {
for (int i = 0; i < ourWrappings.length; i++) {
int ourWrapping = ourWrappings[i];
if (ourWrapping == value) return i;
}
LOG.assertTrue(false);
return 0;
}
public abstract boolean isModified(CodeStyleSettings settings);
public abstract JComponent getPanel();
public final void dispose() {
EditorFactory.getInstance().releaseEditor(myEditor);
}
protected abstract void resetImpl();
protected void fillWrappingCombo(final JComboBox wrapCombo) {
wrapCombo.addItem("Do not wrap");
wrapCombo.addItem("Wrap if long");
wrapCombo.addItem("Chop down if long");
wrapCombo.addItem("Wrap always");
}
}
@@ -0,0 +1,285 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.CodeStyleHtmlPanel">
<grid id="677fa" binding="myPanel" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="4" y="9" width="552" height="416"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="9aabb" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="0" y="0" width="332" height="307"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="f230c" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="3" width="80" height="14"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Keep blank lines:"/>
</properties>
</component>
<component id="18182" class="javax.swing.JTextField" binding="myKeepBlankLines">
<constraints>
<xy x="124" y="0" width="40" height="20"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0">
<preferred-size width="40" height="-1"/>
</grid>
</constraints>
<properties>
<columns value="3"/>
</properties>
</component>
<component id="d4efa" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="29" width="80" height="14"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Wrap attributes:"/>
</properties>
</component>
<component id="8bb88" class="javax.swing.JComboBox" binding="myWrapAttributes">
<constraints>
<xy x="124" y="25" width="208" height="23"/>
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="2" anchor="8" fill="1"/>
</constraints>
<properties>
<enabled value="true"/>
</properties>
</component>
<hspacer id="b6d89">
<constraints>
<xy x="164" y="4" width="168" height="11"/>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1"/>
</constraints>
</hspacer>
<component id="96c04" class="javax.swing.JComboBox" binding="myTextWrapping">
<constraints>
<xy x="124" y="53" width="208" height="23"/>
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="2" anchor="8" fill="1"/>
</constraints>
<properties/>
</component>
<component id="77e79" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="57" width="53" height="14"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Wrap text:"/>
</properties>
</component>
<grid id="6063" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="124" y="81" width="208" height="76"/>
<grid row="3" column="1" row-span="3" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
</constraints>
<properties/>
<border type="etched" title="Spaces:"/>
<children>
<component id="f4575" class="javax.swing.JCheckBox" binding="mySpacesAroundEquality">
<constraints>
<xy x="6" y="20" width="135" height="22"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Around &quot;=&quot; in attribute"/>
</properties>
</component>
<component id="8f9a9" class="javax.swing.JCheckBox" binding="mySpacesAroundTagName">
<constraints>
<xy x="6" y="48" width="108" height="22"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Around tag name"/>
</properties>
</component>
</children>
</grid>
<component id="8a13c" class="javax.swing.JCheckBox" binding="myAlignAttributes">
<constraints>
<xy x="0" y="81" width="98" height="22"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Align attributes"/>
</properties>
</component>
<component id="165dc" class="javax.swing.JCheckBox" binding="myAlignText">
<constraints>
<xy x="0" y="108" width="71" height="22"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Align text"/>
</properties>
</component>
<component id="959da" class="javax.swing.JCheckBox" binding="myKeepWhiteSpaces">
<constraints>
<xy x="0" y="135" width="114" height="22"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Keep white spaces"/>
</properties>
</component>
<grid id="ca5bb" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="0" y="162" width="332" height="145"/>
<grid row="6" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="fe20d" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="3" width="110" height="14"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Insert new line before:"/>
</properties>
</component>
<component id="99b92" class="javax.swing.JTextField" binding="myInsertNewLineTagNames">
<constraints>
<xy x="133" y="0" width="199" height="20"/>
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="160eb" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="28" width="120" height="14"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Remove new line before:"/>
</properties>
</component>
<component id="2084f" class="javax.swing.JTextField" binding="myRemoveNewLineTagNames">
<constraints>
<xy x="133" y="25" width="199" height="20"/>
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="93fdf" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="53" width="122" height="14"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Do not indent children of:"/>
</properties>
</component>
<component id="65b85" class="javax.swing.JTextField" binding="myDoNotAlignChildrenTagNames">
<constraints>
<xy x="133" y="50" width="199" height="20"/>
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="9646b" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="103" width="72" height="14"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Text elements:"/>
</properties>
</component>
<component id="121a0" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="78" width="104" height="14"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="or if tag size mo then "/>
</properties>
</component>
<component id="547a0" class="javax.swing.JTextField" binding="myDoNotAlignChildrenMinSize">
<constraints>
<xy x="133" y="75" width="151" height="20"/>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="a3eda" class="javax.swing.JLabel">
<constraints>
<xy x="294" y="78" width="38" height="14"/>
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="symbols"/>
</properties>
</component>
<component id="18980" class="javax.swing.JTextField" binding="myTextElementsTagNames">
<constraints>
<xy x="133" y="100" width="199" height="20"/>
<grid row="4" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="c84da" class="javax.swing.JTextField" binding="myKeepWhiteSpacesTagNames">
<constraints>
<xy x="133" y="125" width="199" height="20"/>
<grid row="5" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="1ade9" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="128" width="123" height="14"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Keep white spaces inside:"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<xy id="3dbb2" binding="myPreviewPanel" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="342" y="0" width="210" height="416"/>
<grid row="0" column="1" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
</constraints>
<properties/>
<border type="etched" title="Preview"/>
<children/>
</xy>
<vspacer id="9276c">
<constraints>
<xy x="160" y="307" width="11" height="109"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2"/>
</constraints>
</vspacer>
</children>
</grid>
</form>
@@ -0,0 +1,428 @@
/*
* Copyright (c) 2004 JetBrains s.r.o. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* -Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* -Redistribution in binary form must reproduct the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* Neither the name of JetBrains or IntelliJ IDEA
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. JETBRAINS AND ITS LICENSORS SHALL NOT
* BE LIABLE FOR ANY DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT
* OF OR RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL JETBRAINS OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN
* IF JETBRAINS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
*/
package com.intellij.application.options;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel {
private JTextField myKeepBlankLines;
private JComboBox myWrapAttributes;
private JCheckBox myAlignAttributes;
private JCheckBox myKeepWhiteSpaces;
private JPanel myPanel;
private JPanel myPreviewPanel;
private JCheckBox mySpacesAroundEquality;
private JCheckBox mySpacesAroundTagName;
private JCheckBox myAlignText;
private JComboBox myTextWrapping;
private JTextField myInsertNewLineTagNames;
private JTextField myRemoveNewLineTagNames;
private JTextField myDoNotAlignChildrenTagNames;
private JTextField myKeepWhiteSpacesTagNames;
private JTextField myTextElementsTagNames;
private JTextField myDoNotAlignChildrenMinSize;
public CodeStyleHtmlPanel(CodeStyleSettings settings) {
super(settings);
myPreviewPanel.setLayout(new BorderLayout());
myPreviewPanel.add(myEditor.getComponent(), BorderLayout.CENTER);
fillWrappingCombo(myWrapAttributes);
fillWrappingCombo(myTextWrapping);
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
updatePreview();
}
};
myKeepBlankLines.addActionListener(actionListener);
myWrapAttributes.addActionListener(actionListener);
myTextWrapping.addActionListener(actionListener);
myKeepWhiteSpaces.addActionListener(actionListener);
myAlignAttributes.addActionListener(actionListener);
mySpacesAroundEquality.addActionListener(actionListener);
mySpacesAroundTagName.addActionListener(actionListener);
myAlignText.addActionListener(actionListener);
final DocumentListener documentListener = new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
updatePreview();
}
public void insertUpdate(DocumentEvent e) {
updatePreview();
}
public void removeUpdate(DocumentEvent e) {
updatePreview();
}
};
myKeepBlankLines.getDocument().addDocumentListener(documentListener);
myInsertNewLineTagNames.getDocument().addDocumentListener(documentListener);
myRemoveNewLineTagNames.getDocument().addDocumentListener(documentListener);
myDoNotAlignChildrenTagNames.getDocument().addDocumentListener(documentListener);
myDoNotAlignChildrenMinSize.getDocument().addDocumentListener(documentListener);
myTextElementsTagNames.getDocument().addDocumentListener(documentListener);
myKeepWhiteSpacesTagNames.getDocument().addDocumentListener(documentListener);
}
public void apply(CodeStyleSettings settings) {
settings.HTML_KEEP_BLANK_LINES = getIntValue(myKeepBlankLines);
settings.HTML_ATTRIBUTE_WRAP = ourWrappings[myWrapAttributes.getSelectedIndex()];
settings.HTML_TEXT_WRAP = ourWrappings[myTextWrapping.getSelectedIndex()];
settings.HTML_ALIGN_ATTRIBUTES = myAlignAttributes.isSelected();
settings.HTML_ALIGN_TEXT = myAlignText.isSelected();
settings.HTML_KEEP_WHITESPACES = myKeepWhiteSpaces.isSelected();
settings.HTML_SPACE_AROUND_EQUALITY_IN_ATTRINUTE = mySpacesAroundEquality.isSelected();
settings.HTML_SPACE_AROUND_TAG_NAME = mySpacesAroundTagName.isSelected();
settings.HTML_ELEMENTS_TO_INSERT_NEW_LINE_BEFORE = myInsertNewLineTagNames.getText();
settings.HTML_ELEMENTS_TO_REMOVE_NEW_LINE_BEFORE = myRemoveNewLineTagNames.getText();
settings.HTML_DO_NOT_ALIGN_CHILDREN_OF = myDoNotAlignChildrenTagNames.getText();
settings.HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_SIZE = getIntValue(myDoNotAlignChildrenMinSize);
settings.HTML_TEXT_ELEMENTS = myTextElementsTagNames.getText();
settings.HTML_KEEP_WHITESPACES_INSIDE = myKeepWhiteSpacesTagNames.getText();
}
private int getIntValue(JTextField keepBlankLines) {
try {
return Integer.parseInt(keepBlankLines.getText());
}
catch (NumberFormatException e) {
return 0;
}
}
protected void resetImpl() {
myKeepBlankLines.setText(String.valueOf(mySettings.HTML_KEEP_BLANK_LINES));
myWrapAttributes.setSelectedIndex(getIndexForWrapping(mySettings.HTML_ATTRIBUTE_WRAP));
myTextWrapping.setSelectedIndex(getIndexForWrapping(mySettings.HTML_TEXT_WRAP));
myAlignAttributes.setSelected(mySettings.HTML_ALIGN_ATTRIBUTES);
myAlignText.setSelected(mySettings.HTML_ALIGN_TEXT);
myKeepWhiteSpaces.setSelected(mySettings.HTML_KEEP_WHITESPACES);
mySpacesAroundTagName.setSelected(mySettings.HTML_SPACE_AROUND_TAG_NAME);
mySpacesAroundEquality.setSelected(mySettings.HTML_SPACE_AROUND_EQUALITY_IN_ATTRINUTE);
myInsertNewLineTagNames.setText(mySettings.HTML_ELEMENTS_TO_INSERT_NEW_LINE_BEFORE);
myRemoveNewLineTagNames.setText(mySettings.HTML_ELEMENTS_TO_REMOVE_NEW_LINE_BEFORE);
myDoNotAlignChildrenTagNames.setText(mySettings.HTML_DO_NOT_ALIGN_CHILDREN_OF);
myDoNotAlignChildrenMinSize.setText(String.valueOf(mySettings.HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_SIZE));
myTextElementsTagNames.setText(mySettings.HTML_TEXT_ELEMENTS);
myKeepWhiteSpacesTagNames.setText(mySettings.HTML_KEEP_WHITESPACES_INSIDE);
}
public boolean isModified(CodeStyleSettings settings) {
if (settings.HTML_KEEP_BLANK_LINES != getIntValue(myKeepBlankLines)) {
return true;
}
if (settings.HTML_ATTRIBUTE_WRAP != ourWrappings[myWrapAttributes.getSelectedIndex()]) {
return true;
}
if (settings.HTML_TEXT_WRAP != ourWrappings[myTextWrapping.getSelectedIndex()]) {
return true;
}
if (settings.HTML_ALIGN_ATTRIBUTES != myAlignAttributes.isSelected()) {
return true;
}
if (settings.HTML_ALIGN_TEXT != myAlignText.isSelected()) {
return true;
}
if (settings.HTML_KEEP_WHITESPACES != myKeepWhiteSpaces.isSelected()) {
return true;
}
if (settings.HTML_SPACE_AROUND_EQUALITY_IN_ATTRINUTE != mySpacesAroundEquality.isSelected()){
return true;
}
if (settings.HTML_SPACE_AROUND_TAG_NAME != mySpacesAroundTagName.isSelected()){
return true;
}
if (!Comparing.equal(settings.HTML_ELEMENTS_TO_INSERT_NEW_LINE_BEFORE, myInsertNewLineTagNames.getText().trim())){
return true;
}
if (!Comparing.equal(settings.HTML_ELEMENTS_TO_REMOVE_NEW_LINE_BEFORE, myRemoveNewLineTagNames.getText().trim())){
return true;
}
if (!Comparing.equal(settings.HTML_DO_NOT_ALIGN_CHILDREN_OF, myDoNotAlignChildrenTagNames.getText().trim())){
return true;
}
if (settings.HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_SIZE != getIntValue(myDoNotAlignChildrenMinSize)){
return true;
}
if (!Comparing.equal(settings.HTML_TEXT_ELEMENTS, myTextElementsTagNames.getText().trim())){
return true;
}
if (!Comparing.equal(settings.HTML_KEEP_WHITESPACES_INSIDE, myKeepWhiteSpacesTagNames.getText().trim())){
return true;
}
return false;
}
public JComponent getPanel() {
return myPanel;
}
protected String getPreviewText() {
return "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" +
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n" +
"<head>\n" +
"<title>ReSharper: The Most Intelligent Add-In To VisualStudio .NET</title>\n" +
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n" +
"<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"../css/main.css\"/>\n" +
"<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"../css/resharper.css\"/>\n" +
"<link rel=\"stylesheet\" type=\"text/css\" media=\"print\" href=\"../css/print.css\"/>\n" +
"<link rel=\"Shortcut Icon\" href=\"../favicon.ico\" type=\"image/x-icon\"/>\n" +
"\n" +
"</head>\n" +
"\n" +
"<body class=\"resharperbg\">\n" +
"<div id=\"container\">\n" +
"\n" +
" <div id=\"top\">\n" +
" <div id=\"logo\"><a href=\"../index.html\"><img src=\"../img/logo_bw.gif\" width=\"124\" height=\"44\" alt=\"JetBrains home\"/></a></div>\n" +
"\n" +
" <div id=\"nav\">\n" +
" <ul id=\"topnav\">\n" +
" <li class=\"home\"><a href=\"../index.html\">Home</a></li>\n" +
" <li class=\"act\"><a href=\"../products.html\">Products</a></li>\n" +
" <li><a href=\"../support\">Support</a></li>\n" +
"\t\t\t\t<li><a href=\"../devnet\">Developers</a></li>\n" +
" <li><a href=\"../company\">Company</a></li>\n" +
" </ul>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div id=\"bannerre\"><h2>ReSharper</h2></div>\n" +
" <div id=\"subnavresharper\">\n" +
" <ul id=\"subnavre\">\n" +
"\t <li class=\"active\">ReSharper home</li>\n" +
"\t <li><a href=\"features\">Features</a></li>\n" +
"\t <li><a href=\"documentation\">Documentation</a></li>\n" +
" <li><a href=\"licensing\">Licensing Policy</a></li>\n" +
"\t <li><a href=\"download\">Download</a></li>\n" +
"\t <li><a href=\"buy\">Buy</a></li>\n" +
"\t</ul>\n" +
" </div>\n" +
"\n" +
" <div class=\"clear\"></div>\n" +
" <div id=\"bc\"><a href=\"../index.html\">Home</a><img src=\"../img/bc.gif\" alt=\">\"/><a href=\"../products.html\">Products</a><img src=\"../img/bc.gif\" alt=\">\"/>ReSharper</div>\n" +
" <div id=\"subcontent\">\n" +
" <a class=\"nol\" href=\"buy/specials\"><img src=\"../img/banners/rsb4.gif\" alt=\"\"/></a>\n" +
" <br/>\n" +
" \t<div id=\"whatsnew_res\"><h4>License Lottery</h4></div>\n" +
" <div id=\"wnew\">\n" +
" <p><b>Participate and win</b> <br/>\n" +
" <a href=\"survey.html\">free ReSharper license</a>\n" +
" </p>\n" +
" </div>\n" +
"\n" +
" <br/>\n" +
"\n" +
" <div id=\"greybox\">\n" +
" \t\t<h4>Keep Me Informed</h4>\n" +
" \t\t<p>Subscribe to JetBrains product news and documentation updates</p>\n" +
"\n" +
" \t\t<form name=\"subscribe\" action=\"http://www.jetbrains.com/forms/subscribe\" method=\"post\">\n" +
" name:\n" +
" \t\t<div>\n" +
" \t\t\t<input size=\"18\" class=\"text\" name=\"name\"/>\n" +
" \t\t</div>\n" +
" \t\te-mail:\n" +
" \t\t<div>\n" +
" \t\t\t<input size=\"18\" class=\"text\" name=\"email\"/>\n" +
" \t\t</div>\n" +
" \t\t<a href=\"javascript: document.forms.subscribe.submit();\"><img src=\"../img/button_subscribe.gif\" width=\"140\" height=\"26\" alt=\"subscribe\"/></a>\n" +
" \t\t</form>\n" +
" \t</div>\n" +
" \t<div id=\"quote\">\n" +
" <p class=\"text\">&quot;Resharper has been making its way through my team like a virus. I've been using it for a couple of months now, and I think I can say I'm sold.&quot;</p>\n" +
" <p class=\"author\"><a target=\"\" href=\"http://hyperthink.net/blog/PermaLink,guid,c84fb408-a764-48f4-870e-498191031c89.aspx\">Steve Maine</a>, <br/>Solutions developer,<br/> Avanade</p>\n" +
" </div>\n" +
" <p class=\"spacer\"></p>\n" +
"\n" +
" <div id=\"quote\">\n" +
" <p class=\"text\">&quot;Incidentally, if you want excellent refactoring support for C# in Visual Studio.Net\n" +
" today, check out JetBrains' super ReSharper tool. It supports renaming, extracting methods, turning fields\n" +
" into properties, encapsulating code with if or while constructs, templates and much more!&quot;</p>\n" +
" <p class=\"author\"><a target=\"\" href=\"http://dotnetjunkies.net/WebLog/roydictus/archive/2004/11/16/32279.aspx\">Roy Dictus</a>, <br/>Architect and Trainer,<br/> U2U, Belgium's leading .Net Competence Center</p>\n" +
" </div>\n" +
" <p class=\"spacer\"></p>\n" +
"\n" +
" <div id=\"quote\">\n" +
" <p class=\"text\">&quot;If you are a C# developer you simply owe it to yourself to get this tool. It has\n" +
" dramatically made my life better (SERIOUSLY!). I put it up there with amazing tools…&quot;</p>\n" +
" <p class=\"author\"><a target=\"\" href=\"http://agiledamon.blogspot.com/2004/09/my-latest-net-developers-best-friend.html\">Damon Wilder Carr</a>, <br/>Chief Technologist and CEO,<br/> Agilerfactor</p>\n" +
" </div>\n" +
" <p class=\"spacer\"></p>\n" +
"\n" +
" <div>\n" +
" <a class=\"nol\" title=\"opens in a new window\" href=\"http://www.adtmag.com/article.asp?id=9843\" target=\"blank\">\n" +
" <img src=\"../img/logos/logo_adt.gif\" alt=\"ADT Magazine reviews ReSharper\" width=\"100\" height=\"32\"/></a>\n" +
" <p class=\"aw\"><a title=\"opens in a new window\" href=\"http://www.adtmag.com/article.asp?id=9843\" target=\"blank\">ADT Magazine reviews ReSharper 1.0.1</a></p>\n" +
" <br/>\n" +
" <a class=\"nol\" title=\"opens in a new window\" href=\"http://www.sdtimes.com/news/101/story11.htm\" target=\"blank\"><img src=\"../img/logos/logo_sd_times.gif\" width=\"90\" height=\"33\" alt=\"SD Times reviews ReSharper\"/></a>\n" +
" <p class=\"aw\"><a title=\"opens in a new window\" href=\"http://www.sdtimes.com/news/101/story11.htm\" target=\"blank\">&quot;Another IDEA: JetBrains to Launch C#, RAD Tools&quot;</a></p>\n" +
" </div>\n" +
"\n" +
" </div>\n" +
"\n" +
" <div id=\"content\">\n" +
" <h1>The Most Intelligent Add-In To VisualStudio.NET</h1>\n" +
" <div id=\"product\">\n" +
" <div id=\"firstcol\">\n" +
" <p style=\"margin-bottom:3.5em; margin-top:0.5em;\"><img src=\"../img/resharper1.gif\" width=\"266\" height=\"45\" alt=\"ReSharper 1.0\"/></p>\n" +
" </div>\n" +
" <div id=\"secondcol\">\n" +
" <p class=\"moredownload\"><a href=\"download/index.html\" title=\"Download IntelliJ IDEA Java IDE\"><b>download</b></a></p>\n" +
" <p class=\"morebuy\"><a href=\"buy/index.html\" title=\"Buy IntelliJ IDEA Java IDE\"><b>buy</b></a></p>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"clear\"></div>\n" +
" <hr class=\"hide\"/>\n" +
" <div id=\"overview\">\n" +
"\t\t\t<p class=\"bigtext\">ReSharper was created with the single purpose in mind: to increase the productivity of\n" +
" C# developers. It comes equipped with a rich set of features, such as intelligent coding assistance, on-the-fly\n" +
" error highlighting and quick error correction, unmatched support for code refactoring, and a whole lot more.\n" +
" ReSharper's tight integration with Visual Studio .NET provides quick and easy access to all of its advanced\n" +
" features right from the IDE.</p>\n" +
" <p class=\"more\"><a class=\"nol\" href=\"documentation/1.0_DataSheet.pdf\" target=\"blank\"><img src=\"../img/icon_pdf.gif\" width=\"16\" height=\"16\" alt=\"PDF\"/></a>&nbsp; <a href=\"documentation/1.0_DataSheet.pdf\" target=\"blank\">ReSharper Data Sheet</a> <span class=\"number\">(111 Kb)</span></p>\n" +
" <p class=\"more\"><a class=\"nol\" href=\"documentation/1.0_ReferenceCard.pdf\" target=\"blank\"><img src=\"../img/icon_pdf.gif\" width=\"16\" height=\"16\" alt=\"PDF\"/></a>&nbsp; <a href=\"documentation/1.0_ReferenceCard.pdf\" target=\"blank\">ReSharper 1.0 Default Keymap</a> <span class=\"number\">(44 Kb)</span></p>\n" +
" <br/>\n" +
"\n" +
" <h3>ReSharper Key Features</h3>\n" +
" <br/>\n" +
" <div class=\"feature\">\n" +
" <h3>Error Highlighting</h3>\n" +
" <img src=\"features/previews/errors.gif\" alt=\"Error Highlighting\"/>\n" +
" <p>One of the most powerful and helpful features in ReSharper is its ability to quickly detect and\n" +
" highlight errors in code, without the need to compile it. ReSharper automatically analyzes your code while\n" +
" you work and will highlight a variety of possible syntax or logical errors. It can also detect and emphasize\n" +
" statements or constructs that you should be warned about (e.g., unused or uninitialized variables).</p>\n" +
" <p><a href=\"features/highlighting.html\">More about this feature…</a></p>\n" +
" </div>\n" +
" <div class=\"feature\">\n" +
" <h3>Error Quick-Fixes</h3>\n" +
" <img src=\"features/previews/undefinedMethod.gif\" alt=\"Error Quick Fixes\"/>\n" +
" <p>Not only does ReSharper highlight errors, but it also provides useful quick-fixes that enable you to\n" +
" instantly correct the code. When you place the caret on a highlighted error, if quick-fixes for this error\n" +
" are available, a small light-bulb icon pops up at the relevant line. Click it or use the Alt+Enter shortcut,\n" +
" to see the list of available quick-fixes. Select the desired quick-fix and press Enter to apply it. </p>\n" +
" <p><a href=\"features/quickFixes.html\">More about this feature…</a></p>\n" +
" </div>\n" +
" <div class=\"feature\">\n" +
" <h3>Refactoring Support</h3>\n" +
" <p>Refactoring can significantly improve your code design and efficiency. ReSharper's automated refactoring\n" +
" support takes care of code consistency and compilability after even the most dramatic modifications.</p>\n" +
" <p>ReSharper supports the following types of refactoring:</p>\n" +
" <ul class=\"starlist\">\n" +
" <li>Rename symbol with reference correction</li>\n" +
" <li>Move type to another namespace with reference correction</li>\n" +
" <li>Move type declaration to a separate file</li>\n" +
" <li>Change method signature (add/remove/reorder parameters, change parameter type or return type)</li>\n" +
" <li>Extract method</li>\n" +
" <li>Introduce variable</li>\n" +
" <li>Inline variable</li>\n" +
" <li>Convert method to property</li>\n" +
" <li>Convert property to method(s)</li>\n" +
" </ul>\n" +
" <p><a href=\"features/refactoring.html\">More about this feature…</a></p>\n" +
" </div>\n" +
" <div class=\"feature\">\n" +
" <h3>Live Templates</h3>\n" +
" <img src=\"features/previews/itar.gif\" alt=\"Live Templates\"/>\n" +
" <p>Live templates represent predefined code fragments that can &quot;interact&quot; with the developer\n" +
" when inserted. You can use them to insert common or custom code constructs into a source code file quickly,\n" +
" efficiently, and accurately.</p>\n" +
" <p>Just type a particular template's abbreviation, then press the Tab key to expand it into your source file.</p>\n" +
" <p><a href=\"features/liveTemplates.html\">More about this feature…</a></p>\n" +
" </div>\n" +
"\n" +
" <p>To get the full story on ReSharper&#146;s feature set, please visit the <a href=\"features/index.html\">Features</a> page.</p>\n" +
"\n" +
" <h3>Why ReSharper</h3>\n" +
" <p>ReSharper makes C# development a real pleasure. It decreases the time you spend on routine, repetitive\n" +
" handwork, giving you more time to focus on the task at hand. Its robust set of features for automatic error-checking\n" +
" and code correction cuts development time and increases your efficiency. You'll find that ReSharper quickly\n" +
" pays back it's cost in increased developer productivity and improved code quality.</p>\n" +
" <p>The wait is over… ReSharper is here and now C# developers can experience what we mean when we say\n" +
" \"Develop with pleasure!\" <a href=\"download\">Download a copy today</a>!</p>\n" +
" </div>\n" +
"\n" +
" </div>\n" +
"</div>\n" +
" <hr class=\"hide\"/>\n" +
" <div class=\"clear\"></div>\n" +
"<div id=\"fcontainer\">\n" +
" <div id=\"footer\">\n" +
" <div id=\"copy\">Copyright &copy; 2000-2004 JetBrains. All rights reserved</div>\n" +
" <div id=\"mail\">Comments? Write to <a href=\"mailto:webmaster@jetbrains.com\">webmaster@jetbrains.com</a></div>\n" +
" </div>\n" +
"</div>\n" +
"\n" +
"</body>\n" +
"</html>";
}
protected FileType getFileType() {
return StdFileTypes.HTML;
}
}
@@ -31,65 +31,36 @@
*/
package com.intellij.application.options;
import com.intellij.ide.highlighter.HighlighterFactory;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.EditorSettings;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.util.IncorrectOperationException;
import javax.swing.*;
import javax.swing.event.DocumentListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class CodeStyleXmlPanel {
private static Logger LOG = Logger.getInstance("#com.intellij.application.options.CodeStyleXmlPanel");
public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{
private JTextField myKeepBlankLines;
private JComboBox myWrapAttributes;
private JCheckBox myAlignAttributes;
private JCheckBox myKeepWhiteSpaces;
private final Editor myEditor;
private final CodeStyleSettings mySettings;
private boolean myShouldUpdatePreview;
private JPanel myPreviewPanel;
private JPanel myPanel;
private JPanel myPreviewPanel;
private final static int[] ourWrappings = new int[] {CodeStyleSettings.DO_NOT_WRAP,
CodeStyleSettings.WRAP_AS_NEEDED,
CodeStyleSettings.WRAP_ON_EVERY_ITEM,
CodeStyleSettings.WRAP_ALWAYS};
private JCheckBox mySpacesAroundEquality;
private JCheckBox mySpacesAroundTagName;
public CodeStyleXmlPanel(CodeStyleSettings settings) {
mySettings = settings;
myEditor = createEditor();
super(settings);
myPreviewPanel.setLayout(new BorderLayout());
myPreviewPanel.add(myEditor.getComponent(), BorderLayout.CENTER);
myWrapAttributes.addItem("Do not wrap");
myWrapAttributes.addItem("Wrap if long");
myWrapAttributes.addItem("Chop down if long");
myWrapAttributes.addItem("Wrap always");
fillWrappingCombo(myWrapAttributes);
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -119,205 +90,6 @@ public class CodeStyleXmlPanel {
});
}
private static Editor createEditor() {
EditorFactory editorFactory = EditorFactory.getInstance();
Document editorDocument = editorFactory.createDocument("");
EditorEx editor = (EditorEx)editorFactory.createViewer(editorDocument);
EditorSettings editorSettings = editor.getSettings();
editorSettings.setWhitespacesShown(true);
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setLineNumbersShown(false);
editorSettings.setFoldingOutlineShown(false);
editorSettings.setAdditionalColumnsCount(0);
editorSettings.setAdditionalLinesCount(1);
EditorColorsScheme scheme = editor.getColorsScheme();
scheme.setColor(EditorColors.CARET_ROW_COLOR, null);
editor.setHighlighter(HighlighterFactory.createXMLHighlighter(scheme));
return editor;
}
private void updatePreview() {
if (!myShouldUpdatePreview) {
return;
}
final String text =
"<idea-plugin>\n" +
" <name>CVS</name>\n" +
" <description>CVS integration</description>\n" +
" <version>0.1</version>\n" +
" <vendor>IntelliJ</vendor>\n" +
" <idea-version min=\"4.0\" max=\"4.0\"/>\n" +
"\n" +
" <application-components>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration</implementation-class>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.application.CvsEntriesManager</implementation-class>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.connections.ssh.SSHPasswordProvider</implementation-class>\n" +
" <option name=\"workspace\" value=\"true\"/>\n" +
" </component>\n" +
"\n" +
" <component>\n" +
" <interface-class>com.intellij.openapi.cvsIntegration.CvsServices</interface-class>\n" +
" <implementation-class>com.intellij.cvsSupport2.impl.CvsServicesImpl</implementation-class>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.config.ImportConfiguration</implementation-class>\n" +
" </component>\n" +
"\n" +
" </application-components>\n" +
"\n" +
" <project-components>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.config.CvsConfiguration</implementation-class>\n" +
" <option name=\"workspace\" value=\"true\"/>\n" +
" </component>\n" +
"\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.CvsVcs2</implementation-class>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.ui.CvsTabbedWindow</implementation-class>\n" +
" <option name=\"workspace\" value=\"true\"/>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.application.CvsStorageSupportingDeletionComponent</implementation-class>\n" +
" </component>\n" +
"\n" +
" </project-components>\n" +
"\n" +
"\n" +
" <actions>\n" +
"\n" +
" <group id=\"CvsFileGroup\" text=\"CVS\">\n" +
" <separator/>\n" +
" <add-to-group group-id=\"FileMenu\" anchor=\"before\" relative-to-action=\"ExportToHTML\"/>\n" +
" <action id=\"Cvs.CheckoutProject\" class=\"com.intellij.cvsSupport2.actions.CheckoutAction\" text=\"C_heck Out from CVS...\" description=\"Get a copy of files from a CVS repository\"/>\n" +
" <action id=\"Cvs.Import\" class=\"com.intellij.cvsSupport2.actions.ImportAction\" text=\"Im_port into CVS...\" description=\"Put files into a CVS repository\"/>\n" +
" <action id=\"Cvs.BrowseCVSRepository\" class=\"com.intellij.cvsSupport2.actions.BrowseCvsRepositoryAction\" text=\"_Browse CVS Repository...\"\n" +
" description=\"Browse a CVS repository\"/>\n" +
" <separator/>\n" +
" </group>\n" +
"\n" +
" <group id=\"CvsGlobalGroup\" class=\"com.intellij.cvsSupport2.actions.Cvs2Group\" test=\"CVS\" text=\"_CVS\" popup=\"true\">\n" +
" <add-to-group group-id=\"VcsGroups\" anchor=\"last\"/>\n" +
" <separator/>\n" +
" <action id=\"GlobalSettings\" class=\"com.intellij.cvsSupport2.actions.GlobalSettingsAction\" text=\"_Global Settings\" description=\"Configure global CVS settings\"/>\n" +
" <action id=\"ConfigureCvsRoots\" class=\"com.intellij.cvsSupport2.actions.ConfigureCvsRootsAction\" text=\"Configure CVS _Roots\" description=\"Configure CVSroots\"/>\n" +
" <separator/>\n" +
" </group>\n" +
"\n" +
" <group id=\"CvsFilePopupGroup\" class=\"com.intellij.cvsSupport2.actions.Cvs2Group\" test=\"CVS\" text=\"_CVS\" popup=\"true\">\n" +
" <add-to-group group-id=\"VcsGroup\" anchor=\"last\"/>\n" +
" </group>\n" +
"\n" +
"\n" +
" <group id=\"UpdateActionGroup\">\n" +
" <reference id=\"$Delete\"/>\n" +
" <action id=\"Cvs.GetFromRepository\" class=\"com.intellij.cvsSupport2.actions.GetFileFromRepositoryAction\" text=\"Get\" description=\"Get from cvs repository\"/>\n" +
" <separator/>\n" +
" </group>\n" +
" <group id=\"AddOptionDialogActionGroup\" test=\"\"\n" +
" text=\"AddOptionDialogActionGroup\">\n" +
" <action id=\"Cvs.Ignore\" class=\"com.intellij.cvsSupport2.actions.IgnoreFileAction\" text=\"I_gnore\" description=\"Add file/directory to CVS ignore list ('.cvsignore')\">\n" +
" <add-to-group group-id=\"Vcs.CheckinProjectPopup\" anchor=\"last\"/>\n" +
" </action>\n" +
" </group>\n" +
"\n" +
" <group id=\"CvsActions\">\n" +
" <reference id=\"CheckinFiles\"/>\n" +
" <action id=\"Cvs.Rollback\" class=\"com.intellij.cvsSupport2.actions.CvsRollbackChangesAction\" text=\"Ro_llback Changes\" icon=\"/actions/rollback.png\" description=\"Rollback local changes\"/>\n" +
" <reference id=\"UpdateFiles\"/>\n" +
" <action id=\"Cvs.Checkout\" class=\"com.intellij.cvsSupport2.actions.CheckoutFileAction\" text=\"Chec_k Out\" description=\"Check out file or directory (and overwrite local version)\"/>\n" +
" <action id=\"Cvs.MergeAction\" class=\"com.intellij.cvsSupport2.actions.MergeAction\" text=\"_Merge\" description=\"Merge file visually\"/>\n" +
"\n" +
" <separator/>\n" +
"\n" +
"\n" +
" <action id=\"Cvs.Add\" class=\"com.intellij.cvsSupport2.actions.AddFileOrDirectoryAction\" text=\"_Add\" description=\"Add file/directory to CVS\"/>\n" +
" <action id=\"Cvs.UndoAdd\" class=\"com.intellij.cvsSupport2.actions.UnmarkAddedAction\" text=\"Undo 'Add'\" description=\"Undo adding file to CVS\"/>\n" +
" <action id=\"Cvs.Remove\" class=\"com.intellij.cvsSupport2.actions.RemoveLocallyDeletedFilesAction\" text=\"Remove\" description=\"Remove file from CVS\"/>\n" +
" <reference id=\"Cvs.Ignore\"/>\n" +
"\n" +
" <separator/>\n" +
" <action id=\"Cvs.Diff\" class=\"com.intellij.cvsSupport2.actions.DiffAction\" text=\"Compare with The _Same Version\" description=\"Show local changes to the file\"/>\n" +
" <action id=\"Cvs.CompareWithLastVersion\" class=\"com.intellij.cvsSupport2.actions.DiffWithCvsVersionAction\" text=\"Compare with _Latest Repository Version\"\n" +
" description=\"Compare local copy with the latest version from repository\"/>\n" +
" <action id=\"Cvs.DiffWithSelectedVersion\" class=\"com.intellij.cvsSupport2.actions.DiffWithSelectedVersionAction\"\n" +
" text=\"Compare with Se_lected Version...\" description=\"Compare local copy with some selected version\"/>\n" +
"\n" +
" <reference id=\"Vcs.ShowTabbedFileHistory\"/>\n" +
" <reference id=\"Vcs.ShowHistoryForBlock\"/>\n" +
" <action id=\"Cvs.Annotate\" class=\"com.intellij.cvsSupport2.actions.AnnotateToggleAction\" text=\"A_nnotate\" description=\"Show information about last modification date and author for each line\"/>\n" +
"\n" +
" <separator/>\n" +
" <action id=\"Cvs.CreateBranch\" class=\"com.intellij.cvsSupport2.actions.BranchAction\" text=\"Create _Branch...\" description=\"Create branch in CVS repository for file/directory\"/>\n" +
" <action id=\"Cvs.CreateTag\" class=\"com.intellij.cvsSupport2.actions.CreateTagAction\" text=\"C_reate Tag...\" description=\"Create tag in CVS repository for file/directory\"/>\n" +
" <action id=\"Cvs.DeleteTag\" class=\"com.intellij.cvsSupport2.actions.DeleteTagAction\" text=\"_Delete Tag...\" description=\"Delete tag from CVS repository for file/directory\"/>\n" +
" <separator/>\n" +
" <group id=\"EditAndWatch\" text=\"Ed_it and Watch\" popup=\"true\">\n" +
" <action id=\"Cvs.Edit\" class=\"com.intellij.cvsSupport2.actions.EditAction\" text=\"_Edit\" description=\"Start editing of file\"/>\n" +
" <action id=\"Cvs.Unedit\" class=\"com.intellij.cvsSupport2.actions.UneditAction\" text=\"_Unedit\" description=\"Cancel editing of file and undo local changes\"/>\n" +
" <action id=\"Cvs.Editors\" class=\"com.intellij.cvsSupport2.actions.ViewEditorsAction\" text=\"_Show Editors\" description=\"Show who is editing file/directory\"/>\n" +
" <separator/>\n" +
" <action id=\"Cvs.WatchOn\" class=\"com.intellij.cvsSupport2.actions.WatchOnAction\" text=\"Watch O_n\" description=\"Start watching file/directory\"/>\n" +
" <action id=\"Cvs.WatchOff\" class=\"com.intellij.cvsSupport2.actions.WatchOffAction\" text=\"Watch O_ff\" description=\"Stop watching file/directory\"/>\n" +
" <action id=\"Cvs.WatchAdd\" class=\"com.intellij.cvsSupport2.actions.WatchAddAction\" text=\"_Add Watch...\" description=\"Add watch for file/directory\"/>\n" +
" <action id=\"Cvs.WatchRemove\" class=\"com.intellij.cvsSupport2.actions.WatchRemoveAction\" text=\"_Remove Watch...\" description=\"Remove watch for file/directory\"/>\n" +
" <action id=\"Cvs.Watchers\" class=\"com.intellij.cvsSupport2.actions.ViewWatchersAction\" text=\"Show Watc_hers\" description=\"Show who is watching file/directory\"/>\n" +
" </group>\n" +
" <add-to-group group-id=\"UpdateActionGroup\" anchor=\"last\"/>\n" +
"\n" +
" <action id=\"Cvs.CheckinProjectPanel.Add\" class=\"com.intellij.cvsSupport2.checkinProject.AddUnknownFileToCvsAction\"\n" +
" text=\"Add to CVS...\" description=\"Add to CVS (used in Commit Project dialog only)\">\n" +
" <add-to-group group-id=\"Vcs.CheckinProjectPopup\" anchor=\"last\"/>\n" +
" </action>\n" +
"\n" +
" <action id=\"Cvs.CheckinProjectPanel.Delete\" class=\"com.intellij.cvsSupport2.actions.RemoveLocallyDeletedFilesAction\"\n" +
" text=\"Remove from CVS...\" description=\"Remove from CVS (used in Commit Project dialog only)\">\n" +
" <add-to-group group-id=\"Vcs.CheckinProjectPopup\" anchor=\"last\"/>\n" +
" </action>\n" +
"\n" +
" <add-to-group group-id=\"CvsFilePopupGroup\" anchor=\"last\"/>\n" +
" <add-to-group group-id=\"CvsGlobalGroup\" anchor=\"last\"/>\n" +
" </group>\n" +
" </actions>\n" +
"</idea-plugin>";
final Project project = ProjectManager.getInstance().getDefaultProject();
final PsiManager manager = PsiManager.getInstance(project);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
PsiElementFactory factory = manager.getElementFactory();
try {
PsiFile psiFile = factory.createFileFromText("a.xml", text);
CodeStyleSettings clone = (CodeStyleSettings)mySettings.clone();
apply(clone);
CodeStyleSettingsManager.getInstance(project).setTemporarySettings(clone);
CodeStyleManager.getInstance(project).reformat(psiFile);
CodeStyleSettingsManager.getInstance(project).dropTemporarySettings();
myEditor.getSettings().setTabSize(clone.getTabSize(StdFileTypes.XML));
Document document = myEditor.getDocument();
document.replaceString(0, document.getTextLength(), psiFile.getText());
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
});
}
public void apply(CodeStyleSettings settings) {
settings.XML_KEEP_BLANK_LINES = getIntValue(myKeepBlankLines);
settings.XML_ATTRIBUTE_WRAP = ourWrappings[myWrapAttributes.getSelectedIndex()];
@@ -337,30 +109,13 @@ public class CodeStyleXmlPanel {
}
}
public void reset() {
myShouldUpdatePreview = false;
try {
myKeepBlankLines.setText(String.valueOf(mySettings.XML_KEEP_BLANK_LINES));
myWrapAttributes.setSelectedIndex(getIndexForWrapping());
myAlignAttributes.setSelected(mySettings.XML_ALIGN_ATTRIBUTES);
myKeepWhiteSpaces.setSelected(mySettings.XML_KEEP_WHITESPACES);
mySpacesAroundTagName.setSelected(mySettings.XML_SPACE_AROUND_TAG_NAME);
mySpacesAroundEquality.setSelected(mySettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRINUTE);
}
finally {
myShouldUpdatePreview = true;
updatePreview();
}
}
private int getIndexForWrapping() {
int wrapping = mySettings.XML_ATTRIBUTE_WRAP;
for (int i = 0; i < ourWrappings.length; i++) {
int ourWrapping = ourWrappings[i];
if (ourWrapping == wrapping) return i;
}
LOG.assertTrue(false);
return 0;
protected void resetImpl() {
myKeepBlankLines.setText(String.valueOf(mySettings.XML_KEEP_BLANK_LINES));
myWrapAttributes.setSelectedIndex(getIndexForWrapping(mySettings.HTML_TEXT_WRAP));
myAlignAttributes.setSelected(mySettings.XML_ALIGN_ATTRIBUTES);
myKeepWhiteSpaces.setSelected(mySettings.XML_KEEP_WHITESPACES);
mySpacesAroundTagName.setSelected(mySettings.XML_SPACE_AROUND_TAG_NAME);
mySpacesAroundEquality.setSelected(mySettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRINUTE);
}
public boolean isModified(CodeStyleSettings settings) {
@@ -392,7 +147,155 @@ public class CodeStyleXmlPanel {
return myPanel;
}
public void dispose() {
EditorFactory.getInstance().releaseEditor(myEditor);
protected String getPreviewText() {
return "<idea-plugin>\n" +
" <name>CVS</name>\n" +
" <description>CVS integration</description>\n" +
" <version>0.1</version>\n" +
" <vendor>IntelliJ</vendor>\n" +
" <idea-version min=\"4.0\" max=\"4.0\"/>\n" +
"\n" +
" <application-components>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration</implementation-class>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.application.CvsEntriesManager</implementation-class>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.connections.ssh.SSHPasswordProvider</implementation-class>\n" +
" <option name=\"workspace\" value=\"true\"/>\n" +
" </component>\n" +
"\n" +
" <component>\n" +
" <interface-class>com.intellij.openapi.cvsIntegration.CvsServices</interface-class>\n" +
" <implementation-class>com.intellij.cvsSupport2.impl.CvsServicesImpl</implementation-class>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.config.ImportConfiguration</implementation-class>\n" +
" </component>\n" +
"\n" +
" </application-components>\n" +
"\n" +
" <project-components>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.config.CvsConfiguration</implementation-class>\n" +
" <option name=\"workspace\" value=\"true\"/>\n" +
" </component>\n" +
"\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.CvsVcs2</implementation-class>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.ui.CvsTabbedWindow</implementation-class>\n" +
" <option name=\"workspace\" value=\"true\"/>\n" +
" </component>\n" +
" <component>\n" +
" <implementation-class>com.intellij.cvsSupport2.application.CvsStorageSupportingDeletionComponent</implementation-class>\n" +
" </component>\n" +
"\n" +
" </project-components>\n" +
"\n" +
"\n" +
" <actions>\n" +
"\n" +
" <group id=\"CvsFileGroup\" text=\"CVS\">\n" +
" <separator/>\n" +
" <add-to-group group-id=\"FileMenu\" anchor=\"before\" relative-to-action=\"ExportToHTML\"/>\n" +
" <action id=\"Cvs.CheckoutProject\" class=\"com.intellij.cvsSupport2.actions.CheckoutAction\" text=\"C_heck Out from CVS...\" description=\"Get a copy of files from a CVS repository\"/>\n" +
" <action id=\"Cvs.Import\" class=\"com.intellij.cvsSupport2.actions.ImportAction\" text=\"Im_port into CVS...\" description=\"Put files into a CVS repository\"/>\n" +
" <action id=\"Cvs.BrowseCVSRepository\" class=\"com.intellij.cvsSupport2.actions.BrowseCvsRepositoryAction\" text=\"_Browse CVS Repository...\"\n" +
" description=\"Browse a CVS repository\"/>\n" +
" <separator/>\n" +
" </group>\n" +
"\n" +
" <group id=\"CvsGlobalGroup\" class=\"com.intellij.cvsSupport2.actions.Cvs2Group\" test=\"CVS\" text=\"_CVS\" popup=\"true\">\n" +
" <add-to-group group-id=\"VcsGroups\" anchor=\"last\"/>\n" +
" <separator/>\n" +
" <action id=\"GlobalSettings\" class=\"com.intellij.cvsSupport2.actions.GlobalSettingsAction\" text=\"_Global Settings\" description=\"Configure global CVS settings\"/>\n" +
" <action id=\"ConfigureCvsRoots\" class=\"com.intellij.cvsSupport2.actions.ConfigureCvsRootsAction\" text=\"Configure CVS _Roots\" description=\"Configure CVSroots\"/>\n" +
" <separator/>\n" +
" </group>\n" +
"\n" +
" <group id=\"CvsFilePopupGroup\" class=\"com.intellij.cvsSupport2.actions.Cvs2Group\" test=\"CVS\" text=\"_CVS\" popup=\"true\">\n" +
" <add-to-group group-id=\"VcsGroup\" anchor=\"last\"/>\n" +
" </group>\n" +
"\n" +
"\n" +
" <group id=\"UpdateActionGroup\">\n" +
" <reference id=\"$Delete\"/>\n" +
" <action id=\"Cvs.GetFromRepository\" class=\"com.intellij.cvsSupport2.actions.GetFileFromRepositoryAction\" text=\"Get\" description=\"Get from cvs repository\"/>\n" +
" <separator/>\n" +
" </group>\n" +
" <group id=\"AddOptionDialogActionGroup\" test=\"\"\n" +
" text=\"AddOptionDialogActionGroup\">\n" +
" <action id=\"Cvs.Ignore\" class=\"com.intellij.cvsSupport2.actions.IgnoreFileAction\" text=\"I_gnore\" description=\"Add file/directory to CVS ignore list ('.cvsignore')\">\n" +
" <add-to-group group-id=\"Vcs.CheckinProjectPopup\" anchor=\"last\"/>\n" +
" </action>\n" +
" </group>\n" +
"\n" +
" <group id=\"CvsActions\">\n" +
" <reference id=\"CheckinFiles\"/>\n" +
" <action id=\"Cvs.Rollback\" class=\"com.intellij.cvsSupport2.actions.CvsRollbackChangesAction\" text=\"Ro_llback Changes\" icon=\"/actions/rollback.png\" description=\"Rollback local changes\"/>\n" +
" <reference id=\"UpdateFiles\"/>\n" +
" <action id=\"Cvs.Checkout\" class=\"com.intellij.cvsSupport2.actions.CheckoutFileAction\" text=\"Chec_k Out\" description=\"Check out file or directory (and overwrite local version)\"/>\n" +
" <action id=\"Cvs.MergeAction\" class=\"com.intellij.cvsSupport2.actions.MergeAction\" text=\"_Merge\" description=\"Merge file visually\"/>\n" +
"\n" +
" <separator/>\n" +
"\n" +
"\n" +
" <action id=\"Cvs.Add\" class=\"com.intellij.cvsSupport2.actions.AddFileOrDirectoryAction\" text=\"_Add\" description=\"Add file/directory to CVS\"/>\n" +
" <action id=\"Cvs.UndoAdd\" class=\"com.intellij.cvsSupport2.actions.UnmarkAddedAction\" text=\"Undo 'Add'\" description=\"Undo adding file to CVS\"/>\n" +
" <action id=\"Cvs.Remove\" class=\"com.intellij.cvsSupport2.actions.RemoveLocallyDeletedFilesAction\" text=\"Remove\" description=\"Remove file from CVS\"/>\n" +
" <reference id=\"Cvs.Ignore\"/>\n" +
"\n" +
" <separator/>\n" +
" <action id=\"Cvs.Diff\" class=\"com.intellij.cvsSupport2.actions.DiffAction\" text=\"Compare with The _Same Version\" description=\"Show local changes to the file\"/>\n" +
" <action id=\"Cvs.CompareWithLastVersion\" class=\"com.intellij.cvsSupport2.actions.DiffWithCvsVersionAction\" text=\"Compare with _Latest Repository Version\"\n" +
" description=\"Compare local copy with the latest version from repository\"/>\n" +
" <action id=\"Cvs.DiffWithSelectedVersion\" class=\"com.intellij.cvsSupport2.actions.DiffWithSelectedVersionAction\"\n" +
" text=\"Compare with Se_lected Version...\" description=\"Compare local copy with some selected version\"/>\n" +
"\n" +
" <reference id=\"Vcs.ShowTabbedFileHistory\"/>\n" +
" <reference id=\"Vcs.ShowHistoryForBlock\"/>\n" +
" <action id=\"Cvs.Annotate\" class=\"com.intellij.cvsSupport2.actions.AnnotateToggleAction\" text=\"A_nnotate\" description=\"Show information about last modification date and author for each line\"/>\n" +
"\n" +
" <separator/>\n" +
" <action id=\"Cvs.CreateBranch\" class=\"com.intellij.cvsSupport2.actions.BranchAction\" text=\"Create _Branch...\" description=\"Create branch in CVS repository for file/directory\"/>\n" +
" <action id=\"Cvs.CreateTag\" class=\"com.intellij.cvsSupport2.actions.CreateTagAction\" text=\"C_reate Tag...\" description=\"Create tag in CVS repository for file/directory\"/>\n" +
" <action id=\"Cvs.DeleteTag\" class=\"com.intellij.cvsSupport2.actions.DeleteTagAction\" text=\"_Delete Tag...\" description=\"Delete tag from CVS repository for file/directory\"/>\n" +
" <separator/>\n" +
" <group id=\"EditAndWatch\" text=\"Ed_it and Watch\" popup=\"true\">\n" +
" <action id=\"Cvs.Edit\" class=\"com.intellij.cvsSupport2.actions.EditAction\" text=\"_Edit\" description=\"Start editing of file\"/>\n" +
" <action id=\"Cvs.Unedit\" class=\"com.intellij.cvsSupport2.actions.UneditAction\" text=\"_Unedit\" description=\"Cancel editing of file and undo local changes\"/>\n" +
" <action id=\"Cvs.Editors\" class=\"com.intellij.cvsSupport2.actions.ViewEditorsAction\" text=\"_Show Editors\" description=\"Show who is editing file/directory\"/>\n" +
" <separator/>\n" +
" <action id=\"Cvs.WatchOn\" class=\"com.intellij.cvsSupport2.actions.WatchOnAction\" text=\"Watch O_n\" description=\"Start watching file/directory\"/>\n" +
" <action id=\"Cvs.WatchOff\" class=\"com.intellij.cvsSupport2.actions.WatchOffAction\" text=\"Watch O_ff\" description=\"Stop watching file/directory\"/>\n" +
" <action id=\"Cvs.WatchAdd\" class=\"com.intellij.cvsSupport2.actions.WatchAddAction\" text=\"_Add Watch...\" description=\"Add watch for file/directory\"/>\n" +
" <action id=\"Cvs.WatchRemove\" class=\"com.intellij.cvsSupport2.actions.WatchRemoveAction\" text=\"_Remove Watch...\" description=\"Remove watch for file/directory\"/>\n" +
" <action id=\"Cvs.Watchers\" class=\"com.intellij.cvsSupport2.actions.ViewWatchersAction\" text=\"Show Watc_hers\" description=\"Show who is watching file/directory\"/>\n" +
" </group>\n" +
" <add-to-group group-id=\"UpdateActionGroup\" anchor=\"last\"/>\n" +
"\n" +
" <action id=\"Cvs.CheckinProjectPanel.Add\" class=\"com.intellij.cvsSupport2.checkinProject.AddUnknownFileToCvsAction\"\n" +
" text=\"Add to CVS...\" description=\"Add to CVS (used in Commit Project dialog only)\">\n" +
" <add-to-group group-id=\"Vcs.CheckinProjectPopup\" anchor=\"last\"/>\n" +
" </action>\n" +
"\n" +
" <action id=\"Cvs.CheckinProjectPanel.Delete\" class=\"com.intellij.cvsSupport2.actions.RemoveLocallyDeletedFilesAction\"\n" +
" text=\"Remove from CVS...\" description=\"Remove from CVS (used in Commit Project dialog only)\">\n" +
" <add-to-group group-id=\"Vcs.CheckinProjectPopup\" anchor=\"last\"/>\n" +
" </action>\n" +
"\n" +
" <add-to-group group-id=\"CvsFilePopupGroup\" anchor=\"last\"/>\n" +
" <add-to-group group-id=\"CvsGlobalGroup\" anchor=\"last\"/>\n" +
" </group>\n" +
" </actions>\n" +
"</idea-plugin>";
}
protected FileType getFileType() {
return StdFileTypes.XML;
}
}