Skip to content

Commit 5f76b96

Browse files
Make occurrence highlighting configurable: Antlr 3+4, Groovy, Expression Language, CSS, JS, JSON
1 parent 8816020 commit 5f76b96

File tree

51 files changed

+3375
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3375
-8
lines changed

enterprise/web.el/nbproject/project.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@
304304
<specification-version>1.11</specification-version>
305305
</run-dependency>
306306
</dependency>
307+
<dependency>
308+
<code-name-base>org.openide.awt</code-name-base>
309+
<build-prerequisite/>
310+
<compile-dependency/>
311+
<run-dependency>
312+
<specification-version>7.98</specification-version>
313+
</run-dependency>
314+
</dependency>
307315
<dependency>
308316
<code-name-base>org.openide.filesystems</code-name-base>
309317
<build-prerequisite/>

enterprise/web.el/src/org/netbeans/modules/web/el/ELOccurrencesFinder.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.netbeans.modules.csl.api.OffsetRange;
3636
import org.netbeans.modules.parsing.spi.Scheduler;
3737
import org.netbeans.modules.parsing.spi.SchedulerEvent;
38+
import org.netbeans.modules.web.el.options.MarkOccurencesSettings;
3839
import org.openide.filesystems.FileObject;
3940
import org.openide.util.Exceptions;
4041
import org.openide.util.Pair;
@@ -87,6 +88,20 @@ public void cancel() {
8788
this.cancelled = true;
8889
}
8990

91+
@Override
92+
public boolean isKeepMarks() {
93+
return MarkOccurencesSettings
94+
.getCurrentNode()
95+
.getBoolean(MarkOccurencesSettings.KEEP_MARKS, true);
96+
}
97+
98+
@Override
99+
public boolean isMarkOccurrencesEnabled() {
100+
return MarkOccurencesSettings
101+
.getCurrentNode()
102+
.getBoolean(MarkOccurencesSettings.ON_OFF, true);
103+
}
104+
90105
private void computeOccurrences(final ELParserResult parserResult) {
91106
ELElement current = parserResult.getElementAt(caretPosition);
92107
if (current == null) {

enterprise/web.el/src/org/netbeans/modules/web/el/layer.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@
7070
</folder>
7171
</folder>
7272
</folder>
73+
<folder name="MarkOccurrences">
74+
<folder name="text">
75+
<folder name="x-el">
76+
<file name="MarkOccurences.instance">
77+
<attr name="instanceOf" stringvalue="org.netbeans.spi.options.OptionsPanelController"/>
78+
<attr name="instanceCreate" newvalue="org.netbeans.modules.web.el.options.MarkOccurencesOptionsPanelController"/>
79+
</file>
80+
</folder>
81+
</folder>
82+
</folder>
7383
</folder>
7484
</folder>
7585

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
CTL_OnOff_CheckBox=Mark &Occurrences Of Symbol Under Caret
19+
ACSD_OnOff_CB=Checkbox switching mark occurrences on/off
20+
MarkOccurrencesPanel.AccessibleContext.accessibleDescription=Panel for Expression Language Mark Occurrences
21+
MarkOccurrencesPanel.AccessibleContext.accessibleName=Expression Language Mark Occurrences Panel
22+
MarkOccurrencesPanel.onOffCheckBox.AccessibleContext.accessibleName=Mark Occurrences Of Symbol Under Caret
23+
MarkOccurencesPanel.keepMarksCheckBox.text=Keep Marks
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.netbeans.modules.web.el.options;
20+
21+
import java.beans.PropertyChangeListener;
22+
import java.beans.PropertyChangeSupport;
23+
import javax.swing.JComponent;
24+
import org.netbeans.spi.options.OptionsPanelController;
25+
import org.openide.util.HelpCtx;
26+
import org.openide.util.Lookup;
27+
28+
public final class MarkOccurencesOptionsPanelController extends OptionsPanelController {
29+
30+
private MarkOccurencesPanel panel;
31+
32+
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
33+
private boolean changed;
34+
35+
@Override
36+
public void update() {
37+
getPanel().load(this);
38+
}
39+
40+
@Override
41+
public void applyChanges() {
42+
getPanel().store();
43+
}
44+
45+
@Override
46+
public void cancel() {
47+
// need not do anything special, if no changes have been persisted yet
48+
}
49+
50+
@Override
51+
public boolean isValid() {
52+
return true; // Always valid
53+
}
54+
55+
@Override
56+
public boolean isChanged() {
57+
return getPanel().changed();
58+
}
59+
60+
@Override
61+
public HelpCtx getHelpCtx() {
62+
return new HelpCtx("netbeans.optionsDialog.el.markoccurrences");
63+
}
64+
65+
@Override
66+
public synchronized JComponent getComponent(Lookup masterLookup) {
67+
return getPanel();
68+
}
69+
70+
public synchronized MarkOccurencesPanel getPanel() {
71+
if (panel == null) {
72+
panel = new MarkOccurencesPanel(this);
73+
}
74+
return panel;
75+
}
76+
77+
@Override
78+
public void addPropertyChangeListener(PropertyChangeListener l) {
79+
pcs.addPropertyChangeListener(l);
80+
}
81+
82+
@Override
83+
public void removePropertyChangeListener(PropertyChangeListener l) {
84+
pcs.removePropertyChangeListener(l);
85+
}
86+
87+
void changed() {
88+
if (!changed) {
89+
changed = true;
90+
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
91+
}
92+
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
93+
}
94+
95+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<!--
4+
5+
Licensed to the Apache Software Foundation (ASF) under one
6+
or more contributor license agreements. See the NOTICE file
7+
distributed with this work for additional information
8+
regarding copyright ownership. The ASF licenses this file
9+
to you under the Apache License, Version 2.0 (the
10+
"License"); you may not use this file except in compliance
11+
with the License. You may obtain a copy of the License at
12+
13+
http://www.apache.org/licenses/LICENSE-2.0
14+
15+
Unless required by applicable law or agreed to in writing,
16+
software distributed under the License is distributed on an
17+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18+
KIND, either express or implied. See the License for the
19+
specific language governing permissions and limitations
20+
under the License.
21+
22+
-->
23+
24+
<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
25+
<Properties>
26+
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
27+
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
28+
<EmptyBorder bottom="8" left="8" right="8" top="8"/>
29+
</Border>
30+
</Property>
31+
<Property name="focusCycleRoot" type="boolean" value="true"/>
32+
<Property name="focusTraversalPolicy" type="java.awt.FocusTraversalPolicy" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
33+
<Connection code="new java.awt.FocusTraversalPolicy() {&#xa; public java.awt.Component getDefaultComponent(java.awt.Container focusCycleRoot){&#xa; return onOffCheckBox;&#xa; }//end getDefaultComponent&#xa;&#xa; public java.awt.Component getFirstComponent(java.awt.Container focusCycleRoot){&#xa; return onOffCheckBox;&#xa; }//end getFirstComponent&#xa;&#xa; public java.awt.Component getLastComponent(java.awt.Container focusCycleRoot){&#xa; return onOffCheckBox;&#xa; }//end getLastComponent&#xa;&#xa; public java.awt.Component getComponentAfter(java.awt.Container focusCycleRoot, java.awt.Component aComponent){&#xa; return onOffCheckBox;//end getComponentAfter&#xa; }&#xa; public java.awt.Component getComponentBefore(java.awt.Container focusCycleRoot, java.awt.Component aComponent){&#xa; return onOffCheckBox;//end getComponentBefore&#xa;&#xa; }}&#xa; " type="code"/>
34+
</Property>
35+
</Properties>
36+
<AccessibilityProperties>
37+
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
38+
<ResourceString bundle="org/netbeans/modules/web/el/options/Bundle.properties" key="MarkOccurrencesPanel.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
39+
</Property>
40+
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
41+
<ResourceString bundle="org/netbeans/modules/web/el/options/Bundle.properties" key="MarkOccurrencesPanel.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
42+
</Property>
43+
</AccessibilityProperties>
44+
<AuxValues>
45+
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
46+
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
47+
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
48+
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
49+
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
50+
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
51+
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
52+
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
53+
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,75,0,0,2,18"/>
54+
</AuxValues>
55+
56+
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
57+
<SubComponents>
58+
<Component class="javax.swing.JCheckBox" name="onOffCheckBox">
59+
<Properties>
60+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
61+
<ResourceString bundle="org/netbeans/modules/web/el/options/Bundle.properties" key="CTL_OnOff_CheckBox" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
62+
</Property>
63+
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
64+
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
65+
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
66+
</Border>
67+
</Property>
68+
</Properties>
69+
<AccessibilityProperties>
70+
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
71+
<ResourceString bundle="org/netbeans/modules/web/el/options/Bundle.properties" key="MarkOccurrencesPanel.onOffCheckBox.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
72+
</Property>
73+
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
74+
<ResourceString bundle="org/netbeans/modules/web/el/options/Bundle.properties" key="ACSD_OnOff_CB" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
75+
</Property>
76+
</AccessibilityProperties>
77+
<Constraints>
78+
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
79+
<GridBagConstraints gridX="0" gridY="0" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="12" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/>
80+
</Constraint>
81+
</Constraints>
82+
</Component>
83+
<Component class="javax.swing.JCheckBox" name="keepMarksCheckBox">
84+
<Properties>
85+
<Property name="mnemonic" type="int" value="115"/>
86+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87+
<ResourceString bundle="org/netbeans/modules/web/el/options/Bundle.properties" key="MarkOccurencesPanel.keepMarksCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
88+
</Property>
89+
</Properties>
90+
<AccessibilityProperties>
91+
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
92+
<ResourceString bundle="org/netbeans/modules/web/el/options/Bundle.properties" key="MarkOccurencesPanel.keepMarksCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
93+
</Property>
94+
</AccessibilityProperties>
95+
<Constraints>
96+
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
97+
<GridBagConstraints gridX="0" gridY="1" gridWidth="0" gridHeight="0" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="20" insetsBottom="8" insetsRight="0" anchor="18" weightX="0.0" weightY="1.0"/>
98+
</Constraint>
99+
</Constraints>
100+
</Component>
101+
</SubComponents>
102+
</Form>

0 commit comments

Comments
 (0)