Skip to content

Commit

Permalink
refs #65
Browse files Browse the repository at this point in the history
  • Loading branch information
pulse00 committed Sep 22, 2012
1 parent c6883ce commit 646b547
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.dltk.internal.ui.text.ScriptWordFinder;
import org.eclipse.dltk.ui.viewsupport.ISelectionListenerWithAST;
import org.eclipse.dltk.ui.viewsupport.SelectionListenerWithASTManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension4;
Expand Down Expand Up @@ -83,10 +84,12 @@
import com.dubture.twig.core.search.NodeFinder;
import com.dubture.twig.core.search.StringFinder;
import com.dubture.twig.core.search.VariableFinder;
import com.dubture.twig.ui.TwigUICorePlugin;
import com.dubture.twig.ui.editor.LineStyleProviderForTwig;
import com.dubture.twig.ui.editor.autoEdit.CloseTagAutoEditStrategyTwig;
import com.dubture.twig.ui.editor.autoEdit.IndentLineAutoEditStrategy;
import com.dubture.twig.ui.editor.autoEdit.MainAutoEditStrategy;
import com.dubture.twig.ui.preferences.PreferenceConstants;

/**
*
Expand Down Expand Up @@ -456,7 +459,14 @@ public IPresentationReconciler getPresentationReconciler(
public void selectionChanged(IEditorPart part, ITextSelection selection,
ISourceModule module, IModuleDeclaration astRoot)
{
updateOccurrenceAnnotations(selection, (TwigModuleDeclaration) astRoot);
IPreferenceStore store = TwigUICorePlugin.getDefault()
.getPreferenceStore();
boolean doMark = store
.getBoolean(PreferenceConstants.MARK_OCCURRENCES);

if (doMark) {
updateOccurrenceAnnotations(selection, (TwigModuleDeclaration) astRoot);
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,13 @@ public class PreferenceConstants

public static final String TEMPLATES_KEY = "org.eclipse.php.smarty.ui.editor.templates"; //$NON-NLS-1$

public static final String AUTOCLOSE_PRINT_TAGS = "autoclose_print_tags";
public static final String AUTOCLOSE_PRINT_TAGS = "autoclose_print_tags"; //$NON-NLS-1$

public static final String AUTOCLOSE_STATEMENT_TAGS = "autoclose_statement_tags";
public static final String AUTOCLOSE_STATEMENT_TAGS = "autoclose_statement_tags"; //$NON-NLS-1$

public static final String AUTOCREATE_STATEMENT_TAGS = "autocreate_statement_tags";
public static final String AUTOCREATE_STATEMENT_TAGS = "autocreate_statement_tags"; //$NON-NLS-1$

public static final String MARK_OCCURRENCES = "mark_occurrences"; //$NON-NLS-1$

public static final String EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX = "semanticHighlighting."; //$NON-NLS-1$

Expand Down Expand Up @@ -344,6 +346,8 @@ public class PreferenceConstants
*/
public final static String EDITOR_ADD_PHP_FOR_PHPSTART_TAGS = "autoAddPhpForPhpStartTags"; //$NON-NLS-1$



public static void initializeDefaultValues()
{

Expand Down Expand Up @@ -395,6 +399,7 @@ public static void initializeDefaultValues()
store.setDefault(getEnabledPreferenceKey(EDITOR_COMMENT_COLOR), true);

store.setDefault(TwigCoreConstants.SYNTAX_PROBLEM_SEVERITY, TwigCoreConstants.SYNTAX_IGNORE);
store.setDefault(MARK_OCCURRENCES, true);

// code assist
store.setDefault(AUTOCLOSE_PRINT_TAGS, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class TwigCodeassistPreferencePage extends AbstractPreferencePage
private Button autoclosePrintTags;
private Button autocloseStatementTags;
private Button autocreateStatementTags;
private Button markOccurrences;

public TwigCodeassistPreferencePage()
{
Expand All @@ -61,6 +62,8 @@ protected void initializeValues()
.getBoolean(PreferenceConstants.AUTOCLOSE_STATEMENT_TAGS));
autocreateStatementTags.setSelection(store
.getBoolean(PreferenceConstants.AUTOCREATE_STATEMENT_TAGS));
markOccurrences.setSelection(store
.getBoolean(PreferenceConstants.MARK_OCCURRENCES));
}

@Override
Expand All @@ -84,6 +87,7 @@ protected void performDefaults()
store.setValue(PreferenceConstants.AUTOCLOSE_PRINT_TAGS, true);
store.setValue(PreferenceConstants.AUTOCLOSE_STATEMENT_TAGS, true);
store.setValue(PreferenceConstants.AUTOCREATE_STATEMENT_TAGS, true);
store.setValue(PreferenceConstants.MARK_OCCURRENCES, true);

super.performDefaults();
}
Expand All @@ -100,6 +104,8 @@ public boolean performOk()
autocloseStatementTags.getSelection());
store.setValue(PreferenceConstants.AUTOCREATE_STATEMENT_TAGS,
autocreateStatementTags.getSelection());

store.setValue(PreferenceConstants.MARK_OCCURRENCES, markOccurrences.getSelection());

return super.performOk();

Expand Down Expand Up @@ -134,6 +140,17 @@ private void createMainBlock(Composite parent)
autocreateStatementTags = new Button(doubleClickGroup, SWT.CHECK);
autocreateStatementTags.setText("Autocreate Statements (%)");
autocreateStatementTags.setLayoutData(gd);

Group higlightGroup = new Group(result, SWT.NONE);

higlightGroup.setLayout(new GridLayout());
higlightGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
higlightGroup.setText("Highlighting");

markOccurrences = new Button(higlightGroup, SWT.CHECK);
markOccurrences.setText("Mark occurrences"); //$NON-NLS-1$
markOccurrences.setLayoutData(gd);


}

Expand Down

0 comments on commit 646b547

Please sign in to comment.