| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e35265b commit 2476bd5
13 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,4 +7,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | |||
| 7 | 7 | Require-Bundle: org.junit;bundle-version="4.11.0", | |
| 8 | 8 | org.eclipse.angularjs.core;bundle-version="0.2.0", | |
| 9 | 9 | org.eclipse.wst.xml.core;bundle-version="1.1.800", | |
| 10 | - org.eclipse.wst.sse.core;bundle-version="1.1.800" | ||
| 10 | + org.eclipse.wst.sse.core;bundle-version="1.1.800", | ||
| 11 | + org.eclipse.core.resources;bundle-version="3.9.0" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,4 +26,6 @@ public class AngularCoreConstants { | |||
| 26 | 26 | public static String DIRECTIVE_COLON_DELIMITER = "directiveColonDelimiter"; //$NON-NLS-1$ | |
| 27 | 27 | public static final String DIRECTIVE_MINUS_DELIMITER = "directiveMinusDelimiter"; //$NON-NLS-1$ | |
| 28 | 28 | public static final String DIRECTIVE_UNDERSCORE_DELIMITER = "directiveUnderscoreDelimiter"; //$NON-NLS-1$ | |
| 29 | + public static final String EXPRESSION_START_SYMBOL = "startSymbol"; //$NON-NLS-1$ | ||
| 30 | + public static final String EXPRESSION_END_SYMBOL = "endSymbol"; //$NON-NLS-1$ | ||
| 29 | 31 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,8 @@ | |||
| 26 | 26 | import org.eclipse.core.runtime.Platform; | |
| 27 | 27 | import org.eclipse.core.runtime.QualifiedName; | |
| 28 | 28 | import org.eclipse.core.runtime.Status; | |
| 29 | + import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; | ||
| 30 | + import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; | ||
| 29 | 31 | ||
| 30 | 32 | import tern.angular.modules.AngularModulesManager; | |
| 31 | 33 | import tern.angular.modules.Directive; | |
@@ -52,6 +54,8 @@ public class AngularProject implements IDirectiveSyntax { | |||
| 52 | 54 | public static final String DEFAULT_END_SYMBOL = "}}"; | |
| 53 | 55 | ||
| 54 | 56 | private final IProject project; | |
| 57 | + private String startSymbol; | ||
| 58 | + private String endSymbol; | ||
| 55 | 59 | ||
| 56 | 60 | private final Map<ITernScriptPath, List<BaseModel>> folders; | |
| 57 | 61 | private static List<String> angularNatureAdapters; | |
@@ -70,6 +74,35 @@ public void onStop(ITernServer server) { | |||
| 70 | 74 | customDirectives.clear(); | |
| 71 | 75 | } | |
| 72 | 76 | }); | |
| 77 | + // initialize symbols from project preferences | ||
| 78 | + initializeSymbols(); | ||
| 79 | + AngularCorePreferencesSupport.getInstance() | ||
| 80 | + .getEclipsePreferences(project) | ||
| 81 | + .addPreferenceChangeListener(new IPreferenceChangeListener() { | ||
| 82 | + | ||
| 83 | + @Override | ||
| 84 | + public void preferenceChange(PreferenceChangeEvent event) { | ||
| 85 | + if (AngularCoreConstants.EXPRESSION_START_SYMBOL | ||
| 86 | + .equals(event.getKey())) { | ||
| 87 | + AngularProject.this.startSymbol = event | ||
| 88 | + .getNewValue().toString(); | ||
| 89 | + } else if (AngularCoreConstants.EXPRESSION_END_SYMBOL | ||
| 90 | + .equals(event.getKey())) { | ||
| 91 | + AngularProject.this.endSymbol = event.getNewValue() | ||
| 92 | + .toString(); | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + }); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * Initialize start/end symbols. | ||
| 100 | + */ | ||
| 101 | + private void initializeSymbols() { | ||
| 102 | + this.startSymbol = AngularCorePreferencesSupport.getInstance() | ||
| 103 | + .getStartSymbol(getProject()); | ||
| 104 | + this.endSymbol = AngularCorePreferencesSupport.getInstance() | ||
| 105 | + .getEndSymbol(getProject()); | ||
| 73 | 106 | } | |
| 74 | 107 | ||
| 75 | 108 | public static AngularProject getAngularProject(IProject project) | |
@@ -257,7 +290,7 @@ private void ensureNatureIsConfigured() throws CoreException { | |||
| 257 | 290 | * @return the start symbol used inside HTML for angular expression. | |
| 258 | 291 | */ | |
| 259 | 292 | public String getStartSymbol() { | |
| 260 | - return DEFAULT_START_SYMBOL; | ||
| 293 | + return startSymbol; | ||
| 261 | 294 | } | |
| 262 | 295 | ||
| 263 | 296 | /** | |
@@ -266,7 +299,7 @@ public String getStartSymbol() { | |||
| 266 | 299 | * @return the end symbol used inside HTML for angular expression. | |
| 267 | 300 | */ | |
| 268 | 301 | public String getEndSymbol() { | |
| 269 | - return DEFAULT_END_SYMBOL; | ||
| 302 | + return endSymbol; | ||
| 270 | 303 | } | |
| 271 | 304 | ||
| 272 | 305 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | 13 | import org.eclipse.angularjs.core.AngularCoreConstants; | |
| 14 | 14 | import org.eclipse.angularjs.core.AngularCorePlugin; | |
| 15 | + import org.eclipse.angularjs.core.AngularProject; | ||
| 15 | 16 | import org.eclipse.core.runtime.preferences.DefaultScope; | |
| 16 | 17 | import org.eclipse.core.runtime.preferences.IEclipsePreferences; | |
| 17 | 18 | ||
@@ -27,8 +28,14 @@ public static void initializeDefaultValues() { | |||
| 27 | 28 | IEclipsePreferences node = new DefaultScope() | |
| 28 | 29 | .getNode(AngularCorePlugin.PLUGIN_ID); | |
| 29 | 30 | // directive syntax | |
| 30 | - node.putBoolean(AngularCoreConstants.DIRECTIVE_STARTS_WITH_NOTHING, true); | ||
| 31 | + node.putBoolean(AngularCoreConstants.DIRECTIVE_STARTS_WITH_NOTHING, | ||
| 32 | + true); | ||
| 31 | 33 | node.putBoolean(AngularCoreConstants.DIRECTIVE_MINUS_DELIMITER, true); | |
| 34 | + // start/end symbols used in angular expression | ||
| 35 | + node.put(AngularCoreConstants.EXPRESSION_START_SYMBOL, | ||
| 36 | + AngularProject.DEFAULT_START_SYMBOL); | ||
| 37 | + node.put(AngularCoreConstants.EXPRESSION_END_SYMBOL, | ||
| 38 | + AngularProject.DEFAULT_END_SYMBOL); | ||
| 32 | 39 | } | |
| 33 | 40 | ||
| 34 | 41 | // Don't instantiate | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,8 +12,10 @@ | |||
| 12 | 12 | ||
| 13 | 13 | import org.eclipse.angularjs.core.AngularCoreConstants; | |
| 14 | 14 | import org.eclipse.angularjs.core.AngularCorePlugin; | |
| 15 | + import org.eclipse.angularjs.core.AngularProject; | ||
| 15 | 16 | import org.eclipse.core.resources.IProject; | |
| 16 | 17 | import org.eclipse.core.runtime.Preferences; | |
| 18 | + import org.eclipse.core.runtime.preferences.IEclipsePreferences; | ||
| 17 | 19 | ||
| 18 | 20 | import tern.eclipse.ide.core.preferences.PreferencesSupport; | |
| 19 | 21 | import tern.utils.StringUtils; | |
@@ -75,4 +77,41 @@ public boolean getBool(IProject project, String key) { | |||
| 75 | 77 | return StringUtils.asBoolean(result, false); | |
| 76 | 78 | } | |
| 77 | 79 | ||
| 80 | + /** | ||
| 81 | + * Return the {@link IEclipsePreferences} from the given project. | ||
| 82 | + * | ||
| 83 | + * @param project | ||
| 84 | + * @return the {@link IEclipsePreferences} from the given project. | ||
| 85 | + */ | ||
| 86 | + public IEclipsePreferences getEclipsePreferences(IProject project) { | ||
| 87 | + return preferencesSupport.getEclipsePreferences(project); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * Returns the start symbol to use for angular expression inside HTML for | ||
| 92 | + * the given project. | ||
| 93 | + * | ||
| 94 | + * @param project | ||
| 95 | + * @return the start symbol to use for angular expression inside HTML for | ||
| 96 | + * the given project. | ||
| 97 | + */ | ||
| 98 | + public String getStartSymbol(IProject project) { | ||
| 99 | + return preferencesSupport.getPreferencesValue( | ||
| 100 | + AngularCoreConstants.EXPRESSION_START_SYMBOL, | ||
| 101 | + AngularProject.DEFAULT_START_SYMBOL, project); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * Returns the end symbol to use for angular expression inside HTML for the | ||
| 106 | + * given project. | ||
| 107 | + * | ||
| 108 | + * @param project | ||
| 109 | + * @return the end symbol to use for angular expression inside HTML for the | ||
| 110 | + * given project. | ||
| 111 | + */ | ||
| 112 | + public String getEndSymbol(IProject project) { | ||
| 113 | + return preferencesSupport.getPreferencesValue( | ||
| 114 | + AngularCoreConstants.EXPRESSION_END_SYMBOL, | ||
| 115 | + AngularProject.DEFAULT_END_SYMBOL, project); | ||
| 116 | + } | ||
| 78 | 117 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,6 +24,7 @@ HTMLAngularTypingPreferencePage.name=Typing | |||
| 24 | 24 | # Project properties | |
| 25 | 25 | AngularMainPropertyPage.name=AngularJS | |
| 26 | 26 | DirectivesPropertyPage.name=Directives | |
| 27 | + ExpressionPropertyPage.name=Expression | ||
| 27 | 28 | ||
| 28 | 29 | # Hyperlink | |
| 29 | 30 | HTMLAngularHyperLinkDetector.name=HTML Angular HyperLink | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -205,7 +205,18 @@ | |||
| 205 | 205 | <test property="org.eclipse.angularjs.ui.isAngularProject" /> | |
| 206 | 206 | </adapt> | |
| 207 | 207 | </enabledWhen> | |
| 208 | - </page> | ||
| 208 | + </page> | ||
| 209 | + <page | ||
| 210 | + name="%ExpressionPropertyPage.name" | ||
| 211 | + category="org.eclipse.angularjs.internal.ui.properties.AngularMainPropertyPage" | ||
| 212 | + class="org.eclipse.angularjs.internal.ui.properties.ExpressionPropertyPage" | ||
| 213 | + id="org.eclipse.angularjs.internal.ui.properties.ExpressionPropertyPage"> | ||
| 214 | + <enabledWhen> | ||
| 215 | + <adapt type="org.eclipse.core.resources.IProject"> | ||
| 216 | + <test property="org.eclipse.angularjs.ui.isAngularProject" /> | ||
| 217 | + </adapt> | ||
| 218 | + </enabledWhen> | ||
| 219 | + </page> | ||
| 209 | 220 | </extension> | |
| 210 | 221 | ||
| 211 | 222 | <!-- Angular UI Adapter factories --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,7 @@ public final class AngularUIMessages extends NLS { | |||
| 47 | 47 | public static String TerminateTernServerAction_tooltip; | |
| 48 | 48 | public static String UnLinkToControllerAction_text; | |
| 49 | 49 | public static String UnLinkToControllerAction_tooltip; | |
| 50 | - | ||
| 50 | + | ||
| 51 | 51 | public static String AngularExplorerView_openFile_error; | |
| 52 | 52 | public static String AngularExplorerView_openFileDialog_title; | |
| 53 | 53 | ||
@@ -67,7 +67,10 @@ public final class AngularUIMessages extends NLS { | |||
| 67 | 67 | public static String DirectivesPropertyPage_minusDelimiter_label; | |
| 68 | 68 | public static String DirectivesPropertyPage_underscoreDelimiter_label; | |
| 69 | 69 | public static String DirectivesPropertyPage_directiveTestLabel_text; | |
| 70 | - | ||
| 70 | + | ||
| 71 | + public static String ExpressionPropertyPage_startSybol_label; | ||
| 72 | + public static String ExpressionPropertyPage_endSybol_label; | ||
| 73 | + | ||
| 71 | 74 | private AngularUIMessages() { | |
| 72 | 75 | } | |
| 73 | 76 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,4 +38,6 @@ DirectivesPropertyPage_delimiterLabel_text=Directive names must use following de | |||
| 38 | 38 | DirectivesPropertyPage_colonDelimiter_label=':' | |
| 39 | 39 | DirectivesPropertyPage_minusDelimiter_label='-' | |
| 40 | 40 | DirectivesPropertyPage_underscoreDelimiter_label='_' | |
| 41 | - DirectivesPropertyPage_directiveTestLabel_text=Here directive names which will available in completion for | ||
| 41 | + DirectivesPropertyPage_directiveTestLabel_text=Here directive names which will available in completion for | ||
| 42 | + ExpressionPropertyPage_startSybol_label=Start sybol: | ||
| 43 | + ExpressionPropertyPage_endSybol_label=End sybol: | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,13 +10,19 @@ | |||
| 10 | 10 | */ | |
| 11 | 11 | package org.eclipse.angularjs.internal.ui.properties; | |
| 12 | 12 | ||
| 13 | + import org.eclipse.angularjs.core.AngularCorePlugin; | ||
| 13 | 14 | import org.eclipse.angularjs.core.AngularProject; | |
| 15 | + import org.eclipse.core.resources.IProject; | ||
| 14 | 16 | import org.eclipse.core.resources.IResource; | |
| 17 | + import org.eclipse.core.resources.ProjectScope; | ||
| 15 | 18 | import org.eclipse.core.runtime.CoreException; | |
| 16 | 19 | import org.eclipse.core.runtime.IAdaptable; | |
| 20 | + import org.eclipse.core.runtime.preferences.IScopeContext; | ||
| 17 | 21 | import org.eclipse.jface.preference.FieldEditorPreferencePage; | |
| 22 | + import org.eclipse.jface.preference.IPreferenceStore; | ||
| 18 | 23 | import org.eclipse.jface.resource.ImageDescriptor; | |
| 19 | 24 | import org.eclipse.ui.IWorkbenchPropertyPage; | |
| 25 | + import org.eclipse.ui.preferences.ScopedPreferenceStore; | ||
| 20 | 26 | ||
| 21 | 27 | public abstract class AbstractAngularFieldEditorPropertyPage extends | |
| 22 | 28 | FieldEditorPreferencePage implements IWorkbenchPropertyPage { | |
@@ -66,4 +72,15 @@ private IResource getResource() { | |||
| 66 | 72 | return resource; | |
| 67 | 73 | } | |
| 68 | 74 | ||
| 75 | + @Override | ||
| 76 | + protected IPreferenceStore doGetPreferenceStore() { | ||
| 77 | + IProject project = null; | ||
| 78 | + try { | ||
| 79 | + project = getAngularProject().getProject(); | ||
| 80 | + } catch (CoreException e) { | ||
| 81 | + } | ||
| 82 | + IScopeContext projectScope = new ProjectScope(project); | ||
| 83 | + return new ScopedPreferenceStore(projectScope, | ||
| 84 | + AngularCorePlugin.PLUGIN_ID); | ||
| 85 | + } | ||
| 69 | 86 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments