Unverified Commit d5a9964a authored by Junichi Yamamoto's avatar Junichi Yamamoto Committed by GitHub
Browse files

Merge pull request #3146 from junichi11/netbeans-5970-option-for-html-palette-completion

[NETBEANS-5970] Add the option for HTML palette completion
parents bf773408 79342943
......@@ -20,3 +20,4 @@ HtmlCompletionOptionsPanel.completionOffersEndTagAfterLt.text=Completion Offers
HtmlCompletionOptionsPanel.autoPopupCompletionWindow.text=Auto Popup Completion Window
HtmlCompletionOptionsPanel.endTagAutocompletionAutoPopupCheckBox.text=Auto Popup End Tag Auto Completion Window
HtmlCompletionOptionsPanel.endTagAutocompletionAutoPopupCheckBox.tooltip=Opens the end tag autocompletion window if user closes an open tag by the greater than (>) character.
HtmlCompletionOptionsPanel.enablePaletteCompletionCheckBox.text=Enable Palette Completion
......@@ -30,7 +30,7 @@
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
......@@ -50,8 +50,9 @@
<Component id="autocompleteQuotesCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="completionOffersEndTagAfterLt" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="endTagAutocompletionAutoPopupCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="enablePaletteCompletionCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="29" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
......@@ -60,7 +61,7 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="autoPopupCompletionWindow" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="autocompleteQuotesAfterEQSCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="autocompleteQuotesCheckBox" min="-2" max="-2" attributes="0"/>
......@@ -68,7 +69,9 @@
<Component id="completionOffersEndTagAfterLt" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="endTagAutocompletionAutoPopupCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="259" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="enablePaletteCompletionCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="220" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
......@@ -127,5 +130,15 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="endTagAutocompletionAutoPopupCheckBoxActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="enablePaletteCompletionCheckBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/netbeans/modules/html/editor/Bundle.properties" key="HtmlCompletionOptionsPanel.enablePaletteCompletionCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="enablePaletteCompletionCheckBoxActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
......@@ -17,27 +17,33 @@
* under the License.
*/
/*
/*
* HtmlCompletionOptionsPanel.java
*
* Created on 1.2.2010, 11:38:44
*/
package org.netbeans.modules.html.editor;
import java.util.Collections;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map;
import java.util.prefs.Preferences;
import javax.swing.GroupLayout;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.LayoutStyle;
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
/**
*
* @author marekfukala
*/
public class HtmlCompletionOptionsPanel extends javax.swing.JPanel {
public class HtmlCompletionOptionsPanel extends JPanel {
public static final String HTML_AUTOCOMPLETE_QUOTES_AFTER_EQS = "htmlAutocompleteQuotesAfterEQS"; //NOI18N
public static final boolean HTML_AUTOCOMPLETE_QUOTES_AFTER_EQS_DEFAULT = true;
......@@ -49,11 +55,15 @@ public class HtmlCompletionOptionsPanel extends javax.swing.JPanel {
public static final boolean HTML_COMPLETION_AUTOPOPUP_WINDOW_DEFAULT = true;
public static final String HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP = "htmlEndTagAutocompletionAutopopup"; //NOI18N
public static final boolean HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP_DEFAULT = true;
public static final String HTML_ENABLE_PALETTE_COMPLETION = "htmlEnablePaletteCompletion"; //NOI18N
public static final boolean HTML_ENABLE_PALETTE_COMPLETION_DEFAULT = true;
private final Map<String, Boolean> id2Saved = new HashMap<>();
private Preferences preferences;
private final Preferences preferences;
/** Creates new form HtmlCompletionOptionsPanel */
/**
* Creates new form HtmlCompletionOptionsPanel
*/
private HtmlCompletionOptionsPanel(Preferences preferences) {
this.preferences = preferences;
initComponents();
......@@ -62,124 +72,139 @@ public class HtmlCompletionOptionsPanel extends javax.swing.JPanel {
completionOffersEndTagAfterLt.setSelected(preferences.getBoolean(HTML_COMPLETION_END_TAG_ADTER_LT, HTML_COMPLETION_END_TAG_ADTER_LT_DEFAULT));
autoPopupCompletionWindow.setSelected(preferences.getBoolean(HTML_COMPLETION_AUTOPOPUP_WINDOW, HTML_COMPLETION_AUTOPOPUP_WINDOW_DEFAULT));
endTagAutocompletionAutoPopupCheckBox.setSelected(preferences.getBoolean(HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP, HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP_DEFAULT));
enablePaletteCompletionCheckBox.setSelected(preferences.getBoolean(HTML_ENABLE_PALETTE_COMPLETION, HTML_ENABLE_PALETTE_COMPLETION_DEFAULT));
id2Saved.put(HTML_AUTOCOMPLETE_QUOTES_AFTER_EQS, autocompleteQuotesAfterEQSCheckBox.isSelected());
id2Saved.put(HTML_AUTOCOMPLETE_QUOTES, autocompleteQuotesCheckBox.isSelected());
id2Saved.put(HTML_COMPLETION_END_TAG_ADTER_LT, completionOffersEndTagAfterLt.isSelected());
id2Saved.put(HTML_COMPLETION_AUTOPOPUP_WINDOW, autoPopupCompletionWindow.isSelected());
id2Saved.put(HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP, endTagAutocompletionAutoPopupCheckBox.isSelected());
id2Saved.put(HTML_ENABLE_PALETTE_COMPLETION, enablePaletteCompletionCheckBox.isSelected());
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
autocompleteQuotesAfterEQSCheckBox = new javax.swing.JCheckBox();
autocompleteQuotesCheckBox = new javax.swing.JCheckBox();
completionOffersEndTagAfterLt = new javax.swing.JCheckBox();
autoPopupCompletionWindow = new javax.swing.JCheckBox();
endTagAutocompletionAutoPopupCheckBox = new javax.swing.JCheckBox();
autocompleteQuotesAfterEQSCheckBox = new JCheckBox();
autocompleteQuotesCheckBox = new JCheckBox();
completionOffersEndTagAfterLt = new JCheckBox();
autoPopupCompletionWindow = new JCheckBox();
endTagAutocompletionAutoPopupCheckBox = new JCheckBox();
enablePaletteCompletionCheckBox = new JCheckBox();
setPreferredSize(new java.awt.Dimension(550, 400));
setPreferredSize(new Dimension(550, 400));
autocompleteQuotesAfterEQSCheckBox.setText(org.openide.util.NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.autocompleteQuotesAfterEQSCheckBox.text")); // NOI18N
autocompleteQuotesAfterEQSCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
autocompleteQuotesAfterEQSCheckBox.setText(NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.autocompleteQuotesAfterEQSCheckBox.text")); // NOI18N
autocompleteQuotesAfterEQSCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
autocompleteQuotesAfterEQSCheckBoxActionPerformed(evt);
}
});
autocompleteQuotesCheckBox.setText(org.openide.util.NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.autocompleteQuotesCheckBox.text")); // NOI18N
autocompleteQuotesCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
autocompleteQuotesCheckBox.setText(NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.autocompleteQuotesCheckBox.text")); // NOI18N
autocompleteQuotesCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
autocompleteQuotesCheckBoxActionPerformed(evt);
}
});
completionOffersEndTagAfterLt.setText(org.openide.util.NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.completionOffersEndTagAfterLt.text")); // NOI18N
completionOffersEndTagAfterLt.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
completionOffersEndTagAfterLt.setText(NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.completionOffersEndTagAfterLt.text")); // NOI18N
completionOffersEndTagAfterLt.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
completionOffersEndTagAfterLtActionPerformed(evt);
}
});
autoPopupCompletionWindow.setText(org.openide.util.NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.autoPopupCompletionWindow.text")); // NOI18N
autoPopupCompletionWindow.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
autoPopupCompletionWindow.setText(NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.autoPopupCompletionWindow.text")); // NOI18N
autoPopupCompletionWindow.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
autoPopupCompletionWindowActionPerformed(evt);
}
});
endTagAutocompletionAutoPopupCheckBox.setText(org.openide.util.NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.endTagAutocompletionAutoPopupCheckBox.text")); // NOI18N
endTagAutocompletionAutoPopupCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.endTagAutocompletionAutoPopupCheckBox.tooltip")); // NOI18N
endTagAutocompletionAutoPopupCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
endTagAutocompletionAutoPopupCheckBox.setText(NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.endTagAutocompletionAutoPopupCheckBox.text")); // NOI18N
endTagAutocompletionAutoPopupCheckBox.setToolTipText(NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.endTagAutocompletionAutoPopupCheckBox.tooltip")); // NOI18N
endTagAutocompletionAutoPopupCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
endTagAutocompletionAutoPopupCheckBoxActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
enablePaletteCompletionCheckBox.setText(NbBundle.getMessage(HtmlCompletionOptionsPanel.class, "HtmlCompletionOptionsPanel.enablePaletteCompletionCheckBox.text")); // NOI18N
enablePaletteCompletionCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
enablePaletteCompletionCheckBoxActionPerformed(evt);
}
});
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(autoPopupCompletionWindow)
.addComponent(autocompleteQuotesAfterEQSCheckBox)
.addComponent(autocompleteQuotesCheckBox)
.addComponent(completionOffersEndTagAfterLt)
.addComponent(endTagAutocompletionAutoPopupCheckBox))
.addContainerGap(29, Short.MAX_VALUE))
.addComponent(endTagAutocompletionAutoPopupCheckBox)
.addComponent(enablePaletteCompletionCheckBox))
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(autoPopupCompletionWindow)
.addGap(2, 2, 2)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(autocompleteQuotesAfterEQSCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(autocompleteQuotesCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(completionOffersEndTagAfterLt)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(endTagAutocompletionAutoPopupCheckBox)
.addContainerGap(259, Short.MAX_VALUE))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(enablePaletteCompletionCheckBox)
.addContainerGap(220, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void autocompleteQuotesAfterEQSCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autocompleteQuotesAfterEQSCheckBoxActionPerformed
private void autocompleteQuotesAfterEQSCheckBoxActionPerformed(ActionEvent evt) {//GEN-FIRST:event_autocompleteQuotesAfterEQSCheckBoxActionPerformed
preferences.putBoolean(HTML_AUTOCOMPLETE_QUOTES_AFTER_EQS, autocompleteQuotesAfterEQSCheckBox.isSelected());
}//GEN-LAST:event_autocompleteQuotesAfterEQSCheckBoxActionPerformed
private void autocompleteQuotesCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autocompleteQuotesCheckBoxActionPerformed
private void autocompleteQuotesCheckBoxActionPerformed(ActionEvent evt) {//GEN-FIRST:event_autocompleteQuotesCheckBoxActionPerformed
preferences.putBoolean(HTML_AUTOCOMPLETE_QUOTES, autocompleteQuotesCheckBox.isSelected());
}//GEN-LAST:event_autocompleteQuotesCheckBoxActionPerformed
private void completionOffersEndTagAfterLtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_completionOffersEndTagAfterLtActionPerformed
private void completionOffersEndTagAfterLtActionPerformed(ActionEvent evt) {//GEN-FIRST:event_completionOffersEndTagAfterLtActionPerformed
preferences.putBoolean(HTML_COMPLETION_END_TAG_ADTER_LT, completionOffersEndTagAfterLt.isSelected());
}//GEN-LAST:event_completionOffersEndTagAfterLtActionPerformed
private void autoPopupCompletionWindowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoPopupCompletionWindowActionPerformed
private void autoPopupCompletionWindowActionPerformed(ActionEvent evt) {//GEN-FIRST:event_autoPopupCompletionWindowActionPerformed
preferences.putBoolean(HTML_COMPLETION_AUTOPOPUP_WINDOW, autoPopupCompletionWindow.isSelected());
}//GEN-LAST:event_autoPopupCompletionWindowActionPerformed
private void endTagAutocompletionAutoPopupCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_endTagAutocompletionAutoPopupCheckBoxActionPerformed
preferences.putBoolean(HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP, endTagAutocompletionAutoPopupCheckBox.isSelected());
private void endTagAutocompletionAutoPopupCheckBoxActionPerformed(ActionEvent evt) {//GEN-FIRST:event_endTagAutocompletionAutoPopupCheckBoxActionPerformed
preferences.putBoolean(HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP, endTagAutocompletionAutoPopupCheckBox.isSelected());
}//GEN-LAST:event_endTagAutocompletionAutoPopupCheckBoxActionPerformed
private void enablePaletteCompletionCheckBoxActionPerformed(ActionEvent evt) {//GEN-FIRST:event_enablePaletteCompletionCheckBoxActionPerformed
preferences.putBoolean(HTML_ENABLE_PALETTE_COMPLETION, enablePaletteCompletionCheckBox.isSelected());
}//GEN-LAST:event_enablePaletteCompletionCheckBoxActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox autoPopupCompletionWindow;
private javax.swing.JCheckBox autocompleteQuotesAfterEQSCheckBox;
private javax.swing.JCheckBox autocompleteQuotesCheckBox;
private javax.swing.JCheckBox completionOffersEndTagAfterLt;
private javax.swing.JCheckBox endTagAutocompletionAutoPopupCheckBox;
private JCheckBox autoPopupCompletionWindow;
private JCheckBox autocompleteQuotesAfterEQSCheckBox;
private JCheckBox autocompleteQuotesCheckBox;
private JCheckBox completionOffersEndTagAfterLt;
private JCheckBox enablePaletteCompletionCheckBox;
private JCheckBox endTagAutocompletionAutoPopupCheckBox;
// End of variables declaration//GEN-END:variables
public static PreferencesCustomizer.Factory getCustomizerFactory() {
......@@ -192,7 +217,6 @@ public class HtmlCompletionOptionsPanel extends javax.swing.JPanel {
};
}
private static class CodeCompletionPreferencesCustomizer implements PreferencesCustomizer {
private final Preferences preferences;
......@@ -222,20 +246,20 @@ public class HtmlCompletionOptionsPanel extends javax.swing.JPanel {
public JComponent getComponent() {
if (component == null) {
component = new HtmlCompletionOptionsPanel(preferences);
}
}
return component;
}
}
}
String getSavedValue(String key) {
return Boolean.toString(id2Saved.get(key));
}
}
public static final class CustomCustomizerImpl extends PreferencesCustomizer.CustomCustomizer {
@Override
public String getSavedValue(PreferencesCustomizer customCustomizer, String key) {
if(customCustomizer instanceof CodeCompletionPreferencesCustomizer) {
if (customCustomizer instanceof CodeCompletionPreferencesCustomizer) {
return ((HtmlCompletionOptionsPanel) customCustomizer.getComponent()).getSavedValue(key);
}
return null;
......
......@@ -45,6 +45,7 @@ public class HtmlPreferences {
public static boolean completionOffersEndTagAfterLt;
private static boolean autoPopupCompletionWindow;
private static boolean autoPopupEndTagAutoCompletion;
private static boolean isPaletteCompletionEnabled;
//extract inlined style panel preferences
private static SelectorType selectorType;
......@@ -90,6 +91,9 @@ public class HtmlPreferences {
if (settingName == null || mimetypesWithEnabledHtmlErrorChecking_key.equals(settingName)) {
mimetypesWithEnabledHtmlErrorChecking = preferences.get(mimetypesWithEnabledHtmlErrorChecking_key, mimetypesWithEnabledHtmlErrorChecking_default);
}
if (settingName == null || HtmlCompletionOptionsPanel.HTML_ENABLE_PALETTE_COMPLETION.equals(settingName)) {
isPaletteCompletionEnabled = preferences.getBoolean(HtmlCompletionOptionsPanel.HTML_ENABLE_PALETTE_COMPLETION, HtmlCompletionOptionsPanel.HTML_ENABLE_PALETTE_COMPLETION_DEFAULT);
}
}
};
......@@ -134,12 +138,12 @@ public class HtmlPreferences {
lazyIntialize();
return completionOffersEndTagAfterLt;
}
public static boolean autoPopupCompletionWindow() {
lazyIntialize();
return autoPopupCompletionWindow;
}
public static boolean autoPopupEndTagAutoCompletion() {
lazyIntialize();
return autoPopupEndTagAutoCompletion;
......@@ -165,6 +169,10 @@ public class HtmlPreferences {
preferences.put(SECTION_MODE_PROPERTY_NAME, mode.name());
}
public static boolean isPaletteCompletionEnabled() {
lazyIntialize();
return isPaletteCompletionEnabled;
}
public static Collection<String> getMimetypesWithEnabledHtmlErrorChecking() {
lazyIntialize();
......@@ -187,7 +195,7 @@ public class HtmlPreferences {
if(html) {
enabled = !enabled;
}
if(mimescol.contains(mimetype)) {
if(enabled) {
return ; //already enabled
......@@ -209,7 +217,7 @@ public class HtmlPreferences {
}
private static boolean isHtmlMimeType(String mimetype) {
return "text/html".equals(mimetype) || "text/xhtml".equals(mimetype);
return "text/html".equals(mimetype) || "text/xhtml".equals(mimetype); // NOI18N
}
private static String encodeMimetypes(Collection<String> mimes) {
......
......@@ -42,9 +42,9 @@ import org.netbeans.api.html.lexer.HTMLTokenId;
import org.netbeans.api.lexer.Token;
import org.netbeans.api.lexer.TokenHierarchy;
import org.netbeans.api.lexer.TokenSequence;
import org.netbeans.editor.BaseDocument;
import org.netbeans.modules.csl.api.DataLoadersBridge;
import org.netbeans.modules.editor.NbEditorUtilities;
import org.netbeans.modules.html.editor.HtmlPreferences;
import org.netbeans.spi.editor.completion.*;
import org.netbeans.spi.editor.completion.support.AsyncCompletionQuery;
import org.netbeans.spi.editor.completion.support.AsyncCompletionTask;
......@@ -68,7 +68,8 @@ public class HtmlPaletteCompletionProvider implements CompletionProvider {
@Override
public CompletionTask createTask(int queryType, JTextComponent component) {
if ((queryType & COMPLETION_QUERY_TYPE & COMPLETION_ALL_QUERY_TYPE) != 0) {
if (HtmlPreferences.isPaletteCompletionEnabled() // NETBEANS-5970
&& (queryType & COMPLETION_QUERY_TYPE & COMPLETION_ALL_QUERY_TYPE) != 0) {
return new AsyncCompletionTask(new CCQuery(),
component);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment