You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2013/04/29 16:51:06 UTC
svn commit: r1477113 [13/18] - in
/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide:
./ core/ core/builder/ core/codeassist/ core/extensions/ core/packages/
core/parser/ core/search/ debug/ debug/ui/ debug/ui/handlers/ debug/u...
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/editor/RutaEditor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/editor/RutaEditor.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/editor/RutaEditor.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/editor/RutaEditor.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,510 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.editor;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.core.RutaLanguageToolkit;
+import org.apache.uima.ruta.ide.core.codeassist.RutaReferenceDeclarationVisitor;
+import org.apache.uima.ruta.ide.core.codeassist.RutaReferenceVisitor;
+import org.apache.uima.ruta.ide.core.codeassist.RutaRuleIdVisitor;
+import org.apache.uima.ruta.ide.core.codeassist.RutaSelectionParser;
+import org.apache.uima.ruta.ide.parser.ast.RutaAction;
+import org.apache.uima.ruta.ide.parser.ast.RutaCondition;
+import org.apache.uima.ruta.ide.parser.ast.RutaRule;
+import org.apache.uima.ruta.ide.ui.RutaPartitions;
+import org.apache.uima.ruta.ide.ui.RutaPreferenceConstants;
+import org.apache.uima.ruta.ide.ui.text.RutaPairMatcher;
+import org.apache.uima.ruta.ide.ui.text.folding.RutaFoldingStructureProvider;
+import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.compiler.env.ISourceModule;
+import org.eclipse.dltk.core.IDLTKLanguageToolkit;
+import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.ISourceRange;
+import org.eclipse.dltk.core.ISourceReference;
+import org.eclipse.dltk.core.ModelException;
+import org.eclipse.dltk.internal.ui.actions.FoldingActionGroup;
+import org.eclipse.dltk.internal.ui.editor.DLTKEditorMessages;
+import org.eclipse.dltk.internal.ui.editor.ScriptEditor;
+import org.eclipse.dltk.internal.ui.editor.ScriptOutlinePage;
+import org.eclipse.dltk.internal.ui.editor.ScriptSourceViewer;
+import org.eclipse.dltk.internal.ui.editor.ToggleCommentAction;
+import org.eclipse.dltk.ui.actions.IScriptEditorActionDefinitionIds;
+import org.eclipse.dltk.ui.text.ScriptTextTools;
+import org.eclipse.dltk.ui.text.folding.IFoldingStructureProvider;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentExtension3;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.ITextViewerExtension5;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.ICharacterPairMatcher;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.search.internal.ui.SearchPlugin;
+import org.eclipse.search2.internal.ui.text.Highlighter;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.texteditor.IUpdate;
+import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
+import org.eclipse.ui.texteditor.TextOperationAction;
+
+public class RutaEditor extends ScriptEditor {
+
+ protected class FormatElementAction extends Action implements IUpdate {
+
+ /*
+ * @since 3.2
+ */
+ FormatElementAction() {
+ setEnabled(isEditorInputModifiable());
+ }
+
+ /*
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ @Override
+ public void run() {
+
+ final ScriptSourceViewer viewer = (ScriptSourceViewer) getSourceViewer();
+ if (viewer.isEditable()) {
+
+ final Point selection = viewer.rememberSelection();
+ try {
+ viewer.setRedraw(false);
+
+ final String type = TextUtilities.getContentType(viewer.getDocument(),
+ RutaPartitions.TM_PARTITIONING, selection.x, true);
+ if (type.equals(IDocument.DEFAULT_CONTENT_TYPE) && selection.y == 0) {
+
+ try {
+ final IModelElement element = getElementAt(selection.x, true);
+ if (element != null && element.exists()) {
+
+ final int kind = element.getElementType();
+ if (kind == IModelElement.TYPE || kind == IModelElement.METHOD) {
+
+ final ISourceReference reference = (ISourceReference) element;
+ final ISourceRange range = reference.getSourceRange();
+
+ if (range != null) {
+ viewer.setSelectedRange(range.getOffset(), range.getLength());
+ viewer.doOperation(ISourceViewer.FORMAT);
+ }
+ }
+ }
+ } catch (ModelException exception) {
+ // Should not happen
+ }
+ } else {
+ viewer.setSelectedRange(selection.x, 1);
+ viewer.doOperation(ISourceViewer.FORMAT);
+ }
+ } catch (BadLocationException exception) {
+ // Can not happen
+ } finally {
+
+ viewer.setRedraw(true);
+ viewer.restoreSelection();
+ }
+ }
+ }
+
+ /*
+ * @see org.eclipse.ui.texteditor.IUpdate#update()
+ *
+ * @since 3.2
+ */
+ public void update() {
+ setEnabled(isEditorInputModifiable());
+ }
+ }
+
+ public static final String EDITOR_ID = "org.apache.uima.ruta.ide.ui.editor.RutaEditor";
+
+ public static final String EDITOR_CONTEXT = "#RutaEditorContext";
+
+ public static final String RULER_CONTEXT = "#RutaRulerContext";
+
+ private IFoldingStructureProvider foldingProvider;
+
+ private RutaPairMatcher bracketMatcher;
+
+ private void configureToggleCommentAction() {
+ IAction action = getAction("ToggleComment"); //$NON-NLS-1$
+ if (action instanceof ToggleCommentAction) {
+ ISourceViewer sourceViewer = getSourceViewer();
+ SourceViewerConfiguration configuration = getSourceViewerConfiguration();
+ ((ToggleCommentAction) action).configure(sourceViewer, configuration);
+ }
+ }
+
+ // public void dispose() {
+ // super.dispose();
+ // highlighter.dispose();
+ // }
+
+ @Override
+ protected void initializeEditor() {
+ super.initializeEditor();
+
+ setEditorContextMenuId(EDITOR_CONTEXT);
+ setRulerContextMenuId(RULER_CONTEXT);
+ }
+
+ @Override
+ protected void createActions() {
+ super.createActions();
+
+ // Comment
+ Action action = new TextOperationAction(DLTKEditorMessages.getBundleForConstructedKeys(),
+ "Comment.", this, ITextOperationTarget.PREFIX); //$NON-NLS-1$
+ action.setActionDefinitionId(IScriptEditorActionDefinitionIds.COMMENT);
+ setAction("Comment", action); //$NON-NLS-1$
+ markAsStateDependentAction("Comment", true); //$NON-NLS-1$
+
+ // Uncomment
+ action = new TextOperationAction(DLTKEditorMessages.getBundleForConstructedKeys(),
+ "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX); //$NON-NLS-1$
+ action.setActionDefinitionId(IScriptEditorActionDefinitionIds.UNCOMMENT);
+ setAction("Uncomment", action); //$NON-NLS-1$
+ markAsStateDependentAction("Uncomment", true); //$NON-NLS-1$
+
+ // Toggle comment
+ action = new ToggleCommentAction(DLTKEditorMessages.getBundleForConstructedKeys(),
+ "ToggleComment.", this); //$NON-NLS-1$
+ action.setActionDefinitionId(IScriptEditorActionDefinitionIds.TOGGLE_COMMENT);
+ setAction("ToggleComment", action); //$NON-NLS-1$
+ markAsStateDependentAction("ToggleComment", true); //$NON-NLS-1$
+ configureToggleCommentAction();
+
+ action = new TextOperationAction(DLTKEditorMessages.getBundleForConstructedKeys(),
+ "Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$
+ action.setActionDefinitionId(IScriptEditorActionDefinitionIds.FORMAT);
+ setAction("Format", action); //$NON-NLS-1$
+ markAsStateDependentAction("Format", true); //$NON-NLS-1$
+ markAsSelectionDependentAction("Format", true); //$NON-NLS-1$
+ // PlatformUI.getWorkbench().getHelpSystem().setHelp(action,
+ // IJavaHelpContextIds.FORMAT_ACTION);
+ }
+
+ final static String[] properties = new String[] {
+ RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS,
+ RutaPreferenceConstants.EDITOR_FOLDING_EXCLUDE_LIST,
+ RutaPreferenceConstants.EDITOR_FOLDING_INCLUDE_LIST, };
+
+ private Highlighter highlighter;
+
+ private HashMap<Annotation, Position> myAnnotations;
+
+ @Override
+ protected String[] getFoldingEventPreferenceKeys() {
+ return properties;
+ }
+
+ // protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
+ // String property = event.getProperty();
+ // try {
+ // ISourceViewer sourceViewer = getSourceViewer();
+ // if (sourceViewer == null) {
+ // return;
+ // }
+ // if (RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS
+ // .equals(property)
+ // || RutaPreferenceConstants.EDITOR_FOLDING_COMMENTS_WITH_NEWLINES
+ // .equals(property)
+ // || RutaPreferenceConstants.EDITOR_FOLDING_EXCLUDE_LIST
+ // .equals(property)
+ // || RutaPreferenceConstants.EDITOR_FOLDING_INCLUDE_LIST
+ // .equals(property)
+ // || PreferenceConstants.EDITOR_FOLDING_LINES_LIMIT
+ // .equals(property)) {
+ //
+ // if (sourceViewer instanceof ProjectionViewer) {
+ // fProjectionModelUpdater.initialize();
+ // }
+ // return;
+ // }
+ // } finally {
+ // super.handlePreferenceStoreChanged(event);
+ // }
+ // }
+
+ @Override
+ public IPreferenceStore getScriptPreferenceStore() {
+ return RutaIdePlugin.getDefault().getPreferenceStore();
+ }
+
+ @Override
+ public ScriptTextTools getTextTools() {
+ return RutaIdePlugin.getDefault().getTextTools();
+ }
+
+ @Override
+ protected ScriptOutlinePage doCreateOutlinePage() {
+ return new RutaOutlinePage(this, RutaIdePlugin.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ protected void connectPartitioningToElement(IEditorInput input, IDocument document) {
+ if (document instanceof IDocumentExtension3) {
+ IDocumentExtension3 doc = (IDocumentExtension3) document;
+ if (doc.getDocumentPartitioner(RutaPartitions.TM_PARTITIONING) == null) {
+ IDocumentSetupParticipant participant = new RutaDocumentSetupParticipant();
+ participant.setup(document);
+ }
+ }
+ }
+
+ @Override
+ protected IFoldingStructureProvider getFoldingStructureProvider() {
+ if (foldingProvider == null) {
+ foldingProvider = new RutaFoldingStructureProvider();
+ }
+
+ return foldingProvider;
+ }
+
+ @Override
+ protected FoldingActionGroup createFoldingActionGroup() {
+ return new FoldingActionGroup(this, getViewer(), RutaIdePlugin.getDefault()
+ .getPreferenceStore());
+ }
+
+ @Override
+ public String getEditorId() {
+ return EDITOR_ID;
+ }
+
+ protected void selectionChanged() {
+
+ if (getSelectionProvider() == null)
+ return;
+
+ super.selectionChanged();
+
+ if (myAnnotations != null && !myAnnotations.isEmpty()) {
+ removeAnnotations(myAnnotations.keySet());
+ }
+
+ RutaSelectionParser parser = new RutaSelectionParser();
+ ISourceModule unit = (ISourceModule) getInputModelElement();
+ ModuleDeclaration parsed = parser.parse(unit);
+ ISourceViewer sourceViewer = getSourceViewer();
+ StyledText styledText = sourceViewer.getTextWidget();
+ int caret = 0;
+ if (sourceViewer instanceof ITextViewerExtension5) {
+ ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
+ caret = extension.widgetOffset2ModelOffset(styledText.getCaretOffset());
+ } else {
+ int offset = sourceViewer.getVisibleRegion().getOffset();
+ caret = offset + styledText.getCaretOffset();
+ }
+ RutaReferenceVisitor visitor1 = new RutaReferenceVisitor(caret);
+ ASTNode node = null;
+ try {
+ parsed.traverse(visitor1);
+ } catch (Exception e) {
+ }
+ node = visitor1.getResult();
+ if (node == null) {
+ RutaReferenceDeclarationVisitor visitor2 = new RutaReferenceDeclarationVisitor(
+ caret);
+ try {
+ parsed.traverse(visitor2);
+ } catch (Exception e) {
+ }
+ node = visitor2.getResult();
+ }
+ if (node != null) {
+ ReferenceFinder refFinder = new ReferenceFinder(node);
+ try {
+ parsed.traverse(refFinder);
+ } catch (Exception e) {
+ }
+ List<ASTNode> result = refFinder.getResult();
+ myAnnotations = new HashMap<Annotation, Position>(result.size());
+ for (ASTNode each : result) {
+ Annotation annotation = new Annotation(SearchPlugin.SEARCH_ANNOTATION_TYPE, true, null);
+ Position position = null;
+ int sourceStart = each.sourceStart();
+ int sourceEnd = each.sourceEnd();
+ if (each instanceof RutaAction) {
+ RutaAction e = (RutaAction) each;
+ sourceStart = e.getNameStart();
+ sourceEnd = e.getNameEnd();
+ } else if (each instanceof RutaCondition) {
+ RutaCondition e = (RutaCondition) each;
+ sourceStart = e.getNameStart();
+ sourceEnd = e.getNameEnd();
+ }
+ position = new Position(sourceStart, sourceEnd - sourceStart);
+ myAnnotations.put(annotation, position);
+ }
+ addAnnotations(myAnnotations);
+ }
+
+ }
+
+ public void highlightElement(int id) {
+ if (myAnnotations != null && !myAnnotations.isEmpty()) {
+ removeAnnotations(myAnnotations.keySet());
+ }
+
+ RutaSelectionParser parser = new RutaSelectionParser();
+ ISourceModule unit = (ISourceModule) getInputModelElement();
+ ModuleDeclaration parsed = parser.parse(unit);
+ RutaRuleIdVisitor visitor = new RutaRuleIdVisitor(id);
+ try {
+ parsed.traverse(visitor);
+ } catch (Exception e) {
+ }
+ RutaRule rule = visitor.getResult();
+ myAnnotations = new HashMap<Annotation, Position>();
+ if (rule != null) {
+ Annotation annotation = new Annotation(SearchPlugin.SEARCH_ANNOTATION_TYPE, true, null);
+ int sourceStart = rule.sourceStart();
+ int sourceEnd = rule.sourceEnd();
+ Position position = new Position(sourceStart, sourceEnd - sourceStart);
+ getSourceViewer().revealRange(sourceStart, sourceEnd - sourceStart);
+ myAnnotations.put(annotation, position);
+ }
+ addAnnotations(myAnnotations);
+ }
+
+ private void removeAnnotations(Collection<Annotation> annotations) {
+ IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
+ for (Annotation annotation : annotations) {
+ model.removeAnnotation(annotation);
+ }
+ }
+
+ private void addAnnotations(Map<Annotation, Position> annotationToPositionMap) {
+ IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
+ for (Annotation a : annotationToPositionMap.keySet()) {
+ Position p = annotationToPositionMap.get(a);
+ model.addAnnotation(a, p);
+ }
+ }
+
+ @Override
+ protected void initializeKeyBindingScopes() {
+ setKeyBindingScopes(new String[] { "org.apache.uima.ruta.ide.ui.textMarkerEditorScope" }); //$NON-NLS-1$
+ }
+
+ @Override
+ public IDLTKLanguageToolkit getLanguageToolkit() {
+ return RutaLanguageToolkit.getDefault();
+ }
+
+ @Override
+ public String getCallHierarchyID() {
+ return "org.eclipse.dltk.callhierarchy.view";
+ }
+
+ /**
+ * Jumps to the matching bracket.
+ */
+ @Override
+ public void gotoMatchingBracket() {
+ ISourceViewer sourceViewer = getSourceViewer();
+ IDocument document = sourceViewer.getDocument();
+ if (document == null)
+ return;
+
+ IRegion selection = getSignedSelection(sourceViewer);
+
+ int selectionLength = Math.abs(selection.getLength());
+ if (selectionLength > 1) {
+ setStatusLineErrorMessage("No bracket selected");
+ sourceViewer.getTextWidget().getDisplay().beep();
+ return;
+ }
+
+ // #26314
+ int sourceCaretOffset = selection.getOffset() + selection.getLength();
+ if (isSurroundedByBrackets(document, sourceCaretOffset))
+ sourceCaretOffset -= selection.getLength();
+
+ IRegion region = bracketMatcher.match(document, sourceCaretOffset);
+ if (region == null) {
+ setStatusLineErrorMessage("No matching bracket found");
+ sourceViewer.getTextWidget().getDisplay().beep();
+ return;
+ }
+
+ int offset = region.getOffset();
+ int length = region.getLength();
+
+ if (length < 1)
+ return;
+
+ int anchor = bracketMatcher.getAnchor();
+ // http://dev.eclipse.org/bugs/show_bug.cgi?id=34195
+ int targetOffset = (ICharacterPairMatcher.RIGHT == anchor) ? offset + 1 : offset + length;
+
+ boolean visible = false;
+ if (sourceViewer instanceof ITextViewerExtension5) {
+ ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
+ visible = (extension.modelOffset2WidgetOffset(targetOffset) > -1);
+ } else {
+ IRegion visibleRegion = sourceViewer.getVisibleRegion();
+ // http://dev.eclipse.org/bugs/show_bug.cgi?id=34195
+ visible = (targetOffset >= visibleRegion.getOffset() && targetOffset <= visibleRegion
+ .getOffset() + visibleRegion.getLength());
+ }
+
+ if (!visible) {
+ setStatusLineErrorMessage("Matching bracket is outside selected element");
+ sourceViewer.getTextWidget().getDisplay().beep();
+ return;
+ }
+
+ if (selection.getLength() < 0)
+ targetOffset -= selection.getLength();
+
+ sourceViewer.setSelectedRange(targetOffset, selection.getLength());
+ sourceViewer.revealRange(targetOffset, selection.getLength());
+ }
+
+ @Override
+ protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
+ bracketMatcher = new RutaPairMatcher(BRACKETS, this);
+ support.setCharacterPairMatcher(bracketMatcher);
+ support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR);
+
+ super.configureSourceViewerDecorationSupport(support);
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/editor/RutaOutlinePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/editor/RutaOutlinePage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/editor/RutaOutlinePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/editor/RutaOutlinePage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.ui.editor;
+
+import java.util.ArrayList;
+
+import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.internal.ui.editor.ScriptEditor;
+import org.eclipse.dltk.internal.ui.editor.ScriptOutlinePage;
+import org.eclipse.dltk.ui.DLTKPluginImages;
+import org.eclipse.dltk.ui.actions.MemberFilterActionGroup;
+import org.eclipse.dltk.ui.viewsupport.MemberFilterAction;
+import org.eclipse.dltk.ui.viewsupport.ModelElementFilter;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.IActionBars;
+
+public class RutaOutlinePage extends ScriptOutlinePage {
+
+ public RutaOutlinePage(ScriptEditor editor, IPreferenceStore store) {
+ super(editor, store);
+ }
+
+ @Override
+ protected void registerSpecialToolbarActions(IActionBars actionBars) {
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+
+ MemberFilterActionGroup fMemberFilterActionGroup = new MemberFilterActionGroup(fOutlineViewer,
+ fStore);
+
+ String title, helpContext;
+ ArrayList actions = new ArrayList(3);
+
+ // fill-in actions variables
+
+ title = ActionMessages.MemberFilterActionGroup_hide_variables_label;
+ // TODO help support
+ helpContext = "";// IDLTKHelpContextIds.FILTER_FIELDS_ACTION;
+ MemberFilterAction hideVariables = new MemberFilterAction(fMemberFilterActionGroup, title,
+ new ModelElementFilter(IModelElement.FIELD), helpContext, true);
+ hideVariables.setDescription(ActionMessages.MemberFilterActionGroup_hide_variables_description);
+ hideVariables.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_variables_tooltip);
+ DLTKPluginImages.setLocalImageDescriptors(hideVariables, "filter_fields.gif"); //$NON-NLS-1$
+ actions.add(hideVariables);
+
+ // procedures
+
+ title = ActionMessages.MemberFilterActionGroup_hide_functions_label;
+ // TODO help support
+ helpContext = "";// IDLTKHelpContextIds.FILTER_STATIC_ACTION;
+ MemberFilterAction hideProcedures = new MemberFilterAction(fMemberFilterActionGroup, title,
+ new ModelElementFilter(IModelElement.METHOD), helpContext, true);
+ hideProcedures
+ .setDescription(ActionMessages.MemberFilterActionGroup_hide_functions_description);
+ hideProcedures.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_functions_tooltip);
+ // TODO: add correct icon
+ DLTKPluginImages.setLocalImageDescriptors(hideProcedures, "filter_methods.gif"); //$NON-NLS-1$
+ actions.add(hideProcedures);
+
+ // namespaces
+
+ title = ActionMessages.MemberFilterActionGroup_hide_classes_label;
+ // TODO help support
+ helpContext = "";// IDLTKHelpContextIds.FILTER_PUBLIC_ACTION;
+ MemberFilterAction hideNamespaces = new MemberFilterAction(fMemberFilterActionGroup, title,
+ new ModelElementFilter(IModelElement.TYPE), helpContext, true);
+ hideNamespaces.setDescription(ActionMessages.MemberFilterActionGroup_hide_classes_description);
+ hideNamespaces.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_classes_tooltip);
+ DLTKPluginImages.setLocalImageDescriptors(hideNamespaces, "filter_classes.gif"); //$NON-NLS-1$
+ actions.add(hideNamespaces);
+
+ // order corresponds to order in toolbar
+ MemberFilterAction[] fFilterActions = (MemberFilterAction[]) actions
+ .toArray(new MemberFilterAction[actions.size()]);
+
+ fMemberFilterActionGroup.setActions(fFilterActions);
+
+ fMemberFilterActionGroup.contributeToToolBar(toolBarManager);
+ }
+}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleClassVariablesHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleClassVariablesHandler.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleClassVariablesHandler.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleClassVariablesHandler.java Mon Apr 29 14:50:56 2013
@@ -17,10 +17,10 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.ui.handlers;
+package org.apache.uima.ruta.ide.ui.handlers;
-import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
-import org.apache.uima.textmarker.ide.debug.TextMarkerDebugConstants;
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.debug.RutaDebugConstants;
import org.eclipse.dltk.debug.ui.handlers.AbstractToggleClassVariableHandler;
import org.eclipse.dltk.ui.PreferencesAdapter;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -32,7 +32,7 @@ public class ToggleClassVariablesHandler
*/
@Override
protected String getModelId() {
- return TextMarkerDebugConstants.DEBUG_MODEL_ID;
+ return RutaDebugConstants.DEBUG_MODEL_ID;
}
/*
@@ -40,6 +40,6 @@ public class ToggleClassVariablesHandler
*/
@Override
protected IPreferenceStore getPreferenceStore() {
- return new PreferencesAdapter(TextMarkerIdePlugin.getDefault().getPluginPreferences());
+ return new PreferencesAdapter(RutaIdePlugin.getDefault().getPluginPreferences());
}
}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleGlobalVariablesHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleGlobalVariablesHandler.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleGlobalVariablesHandler.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleGlobalVariablesHandler.java Mon Apr 29 14:50:56 2013
@@ -17,10 +17,10 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.ui.handlers;
+package org.apache.uima.ruta.ide.ui.handlers;
-import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
-import org.apache.uima.textmarker.ide.debug.TextMarkerDebugConstants;
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.debug.RutaDebugConstants;
import org.eclipse.dltk.debug.ui.handlers.AbstractToggleGlobalVariableHandler;
import org.eclipse.dltk.ui.PreferencesAdapter;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -31,7 +31,7 @@ public class ToggleGlobalVariablesHandle
*/
@Override
protected String getModelId() {
- return TextMarkerDebugConstants.DEBUG_MODEL_ID;
+ return RutaDebugConstants.DEBUG_MODEL_ID;
}
/*
@@ -39,6 +39,6 @@ public class ToggleGlobalVariablesHandle
*/
@Override
protected IPreferenceStore getPreferenceStore() {
- return new PreferencesAdapter(TextMarkerIdePlugin.getDefault().getPluginPreferences());
+ return new PreferencesAdapter(RutaIdePlugin.getDefault().getPluginPreferences());
}
}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleLocalVariablesHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleLocalVariablesHandler.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleLocalVariablesHandler.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/handlers/ToggleLocalVariablesHandler.java Mon Apr 29 14:50:56 2013
@@ -17,10 +17,10 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.ui.handlers;
+package org.apache.uima.ruta.ide.ui.handlers;
-import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
-import org.apache.uima.textmarker.ide.debug.TextMarkerDebugConstants;
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.debug.RutaDebugConstants;
import org.eclipse.dltk.debug.ui.handlers.AbstractToggleLocalVariableHandler;
import org.eclipse.dltk.ui.PreferencesAdapter;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -32,7 +32,7 @@ public class ToggleLocalVariablesHandler
*/
@Override
protected String getModelId() {
- return TextMarkerDebugConstants.DEBUG_MODEL_ID;
+ return RutaDebugConstants.DEBUG_MODEL_ID;
}
/*
@@ -40,6 +40,6 @@ public class ToggleLocalVariablesHandler
*/
@Override
protected IPreferenceStore getPreferenceStore() {
- return new PreferencesAdapter(TextMarkerIdePlugin.getDefault().getPluginPreferences());
+ return new PreferencesAdapter(RutaIdePlugin.getDefault().getPluginPreferences());
}
}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/hierarchy/RutaHierarchyInformationControl.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/hierarchy/RutaHierarchyInformationControl.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/hierarchy/RutaHierarchyInformationControl.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/hierarchy/RutaHierarchyInformationControl.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.hierarchy;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.dltk.internal.ui.typehierarchy.HierarchyInformationControl;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Shell;
+
+public class RutaHierarchyInformationControl extends HierarchyInformationControl {
+
+ public RutaHierarchyInformationControl(Shell parent, int shellStyle, int treeStyle) {
+ super(parent, shellStyle, treeStyle);
+ }
+
+ @Override
+ protected IPreferenceStore getPreferenceStore() {
+ return RutaIdePlugin.getDefault().getPreferenceStore();
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/infoviews/RutaDocumentationView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/infoviews/RutaDocumentationView.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/infoviews/RutaDocumentationView.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/infoviews/RutaDocumentationView.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.infoviews;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.eclipse.dltk.ui.infoviews.AbstractDocumentationView;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class RutaDocumentationView extends AbstractDocumentationView {
+ @Override
+ protected IPreferenceStore getPreferenceStore() {
+ return RutaIdePlugin.getDefault().getPreferenceStore();
+ }
+
+ @Override
+ protected String getNature() {
+ return RutaNature.NATURE_ID;
+ }
+}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/Messages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/Messages.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/Messages.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/Messages.java Mon Apr 29 14:50:56 2013
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.ui.preferences;
+package org.apache.uima.ruta.ide.ui.preferences;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.apache.uima.textmarker.ide.ui.formatter.messages";
+ private static final String BUNDLE_NAME = "org.apache.uima.ruta.ide.ui.formatter.messages";
- public static String TextMarkerFormatterPreferencePage_description;
+ public static String RutaFormatterPreferencePage_description;
static {
// init resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuildPathsBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuildPathsBlock.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuildPathsBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuildPathsBlock.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.dltk.ui.util.IStatusChangeListener;
+import org.eclipse.dltk.ui.wizards.BuildpathsBlock;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+
+public class RutaBuildPathsBlock extends BuildpathsBlock {
+ public RutaBuildPathsBlock(IRunnableContext runnableContext, IStatusChangeListener context,
+ int pageToShow, boolean useNewPage, IWorkbenchPreferenceContainer pageContainer) {
+ super(runnableContext, context, pageToShow, useNewPage, pageContainer);
+ }
+
+ @Override
+ protected IPreferenceStore getPreferenceStore() {
+ return RutaIdePlugin.getDefault().getPreferenceStore();
+ }
+
+ @Override
+ protected boolean supportZips() {
+ return true;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuilderPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuilderPreferencePage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuilderPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuilderPreferencePage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.core.RutaCorePreferences;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * Preference page to manage preferences for the ide plugin.
+ */
+public class RutaBuilderPreferencePage extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
+
+ private BooleanFieldEditor builderImport;
+ private FieldEditor builderResolve;
+ private BooleanFieldEditor builderShortNames;
+
+ public RutaBuilderPreferencePage() {
+ setPreferenceStore(RutaIdePlugin.getDefault().getPreferenceStore());
+ setDescription("Builder");
+ }
+
+ @Override
+ protected void createFieldEditors() {
+ builderResolve = new BooleanFieldEditor(RutaCorePreferences.BUILDER_RESOLVE_IMPORTS,
+ RutaPreferencesMessages.BuilderResolveImports, getFieldEditorParent());
+ addField(builderResolve);
+
+ builderImport = new BooleanFieldEditor(RutaCorePreferences.BUILDER_IMPORT_BY_NAME,
+ RutaPreferencesMessages.BuilderImportByName, getFieldEditorParent());
+ addField(builderImport);
+
+ builderShortNames = new BooleanFieldEditor(RutaCorePreferences.BUILDER_IGNORE_DUPLICATE_SHORTNAMES,
+ RutaPreferencesMessages.BuilderIgnoreDuplicateShortnames, getFieldEditorParent());
+ addField(builderShortNames);
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+
+}
\ No newline at end of file
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuildpathPropertyPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuildpathPropertyPage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuildpathPropertyPage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaBuildpathPropertyPage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.core.RutaLanguageToolkit;
+import org.eclipse.dltk.core.IDLTKLanguageToolkit;
+import org.eclipse.dltk.ui.preferences.BuildPathsPropertyPage;
+import org.eclipse.dltk.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.dltk.ui.wizards.BuildpathsBlock;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+
+public class RutaBuildpathPropertyPage extends BuildPathsPropertyPage implements
+ IWorkbenchPropertyPage {
+ public RutaBuildpathPropertyPage() {
+ }
+
+ @Override
+ protected BuildpathsBlock createBuildPathBlock(IWorkbenchPreferenceContainer pageContainer) {
+ return new RutaBuildPathsBlock(new BusyIndicatorRunnableContext(), this, getSettings()
+ .getInt(INDEX), false, pageContainer);
+ }
+
+ public IDLTKLanguageToolkit getLanguageToolkit() {
+ return RutaLanguageToolkit.getDefault();
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaConsolePreferenceInitializer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaConsolePreferenceInitializer.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaConsolePreferenceInitializer.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaConsolePreferenceInitializer.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.ui.console.RutaConsoleConstants;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class RutaConsolePreferenceInitializer extends AbstractPreferenceInitializer {
+
+ public RutaConsolePreferenceInitializer() {
+ }
+
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = RutaIdePlugin.getDefault().getPreferenceStore();
+ store.setDefault(RutaConsoleConstants.PREF_NEW_PROMPT,
+ RutaConsoleConstants.DEFAULT_NEW_PROMPT);
+ store.setDefault(RutaConsoleConstants.PREF_CONTINUE_PROMPT,
+ RutaConsoleConstants.DEFAULT_CONTINUE_PROMPT);
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaConsolePreferences.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaConsolePreferences.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaConsolePreferences.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaConsolePreferences.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.ui.console.RutaConsoleConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class RutaConsolePreferences extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private Text newPrompt;
+
+ private Text appendPrompt;
+
+ @Override
+ protected IPreferenceStore doGetPreferenceStore() {
+ return RutaIdePlugin.getDefault().getPreferenceStore();
+ }
+
+ protected void createPrompt(Composite parent, Object data) {
+ Font font = parent.getFont();
+
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayoutData(data);
+ group.setFont(font);
+ group.setText("Prompt");
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ group.setLayout(layout);
+
+ // New command
+ Label newPromptLabel = new Label(group, SWT.NONE);
+ newPromptLabel.setFont(font);
+ newPromptLabel.setText("New command:");
+
+ newPrompt = new Text(group, SWT.BORDER);
+ newPrompt.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateValues();
+ }
+ });
+ newPrompt.setLayoutData(new GridData(GridData.FILL, SWT.NONE, true, false));
+
+ // Append command
+ Label appendCommandLabel = new Label(group, SWT.NONE);
+ appendCommandLabel.setFont(font);
+ appendCommandLabel.setText("Append command:");
+
+ appendPrompt = new Text(group, SWT.BORDER);
+ appendPrompt.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateValues();
+ }
+ });
+ appendPrompt.setLayoutData(new GridData(GridData.FILL, SWT.NONE, true, false));
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite top = new Composite(parent, SWT.NONE);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+
+ top.setLayout(layout);
+
+ createPrompt(top, new GridData(GridData.FILL, SWT.NONE, true, false));
+
+ initializeValues();
+ validateValues();
+
+ return top;
+ }
+
+ protected void initializeValues() {
+ IPreferenceStore store = getPreferenceStore();
+
+ newPrompt.setText(store.getString(RutaConsoleConstants.PREF_NEW_PROMPT));
+
+ appendPrompt.setText(store.getString(RutaConsoleConstants.PREF_CONTINUE_PROMPT));
+ }
+
+ protected void validateValues() {
+ if (StringUtils.isEmpty(newPrompt.getText())) {
+ setErrorMessage("Empty prompt");
+ setValid(false);
+ } else if (StringUtils.isEmpty(appendPrompt.getText())) {
+ setErrorMessage("Empty prompt");
+ setValid(false);
+ } else {
+ setErrorMessage(null);
+ setValid(true);
+ }
+ }
+
+ public void init(IWorkbench workbench) {
+
+ }
+
+ @Override
+ protected void performDefaults() {
+ newPrompt.setText("=>");
+ appendPrompt.setText("->");
+ }
+
+ @Override
+ public boolean performOk() {
+ IPreferenceStore store = getPreferenceStore();
+
+ store.setValue(RutaConsoleConstants.PREF_NEW_PROMPT, newPrompt.getText());
+ store.setValue(RutaConsoleConstants.PREF_CONTINUE_PROMPT, appendPrompt.getText());
+
+ return true;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaContentAssistConfigurationBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaContentAssistConfigurationBlock.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaContentAssistConfigurationBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaContentAssistConfigurationBlock.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import java.util.ArrayList;
+
+import org.eclipse.dltk.ui.PreferenceConstants;
+import org.eclipse.dltk.ui.preferences.CodeAssistConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class RutaContentAssistConfigurationBlock extends CodeAssistConfigurationBlock {
+ public RutaContentAssistConfigurationBlock(PreferencePage mainPreferencePage,
+ OverlayPreferenceStore store) {
+ super(mainPreferencePage, store);
+ }
+
+ @Override
+ protected void getOverlayKeys(ArrayList overlayKeys) {
+ super.getOverlayKeys(overlayKeys);
+
+ // overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.BOOLEAN,
+ // RutaPreferenceConstants.CODEASSIST_FILTER_INTERNAL_API));
+ //
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS));
+ }
+
+ // protected void addAutoActivationSection(Composite composite) {
+ // super.addAutoActivationSection(composite);
+ // String label = "Auto activation triggers for &TM:";
+ // addLabelledTextField(composite, label,
+ // PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS, 4, 2,
+ // false);
+ // }
+
+ @Override
+ public Control createControl(Composite parent) {
+ Composite control = (Composite) super.createControl(parent);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+
+ Composite composite = createSubsection(control, null, "Filtering");
+ composite.setLayout(layout);
+
+ return control;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorAssistancePreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorAssistancePreferencePage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorAssistancePreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorAssistancePreferencePage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPreferencePage;
+import org.eclipse.dltk.ui.preferences.IPreferenceConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+public class RutaEditorAssistancePreferencePage extends
+ AbstractConfigurationBlockPreferencePage {
+
+ /*
+ * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
+ */
+ @Override
+ protected String getHelpId() {
+
+ return null;
+ }
+
+ /*
+ * @see
+ * org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
+ */
+ @Override
+ protected void setDescription() {
+ String description = "&Code Assistance";
+ setDescription(description);
+ }
+
+ /*
+ * @seeorg.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#
+ * setPreferenceStore()
+ */
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(RutaIdePlugin.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ protected Label createDescriptionLabel(Composite parent) {
+ return null; // no description for new look.
+ }
+
+ /*
+ * @seeorg.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#
+ * createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
+ */
+ @Override
+ protected IPreferenceConfigurationBlock createConfigurationBlock(
+ OverlayPreferenceStore overlayPreferenceStore) {
+ return new RutaContentAssistConfigurationBlock(this, overlayPreferenceStore);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorColoringConfigurationBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorColoringConfigurationBlock.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorColoringConfigurationBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorColoringConfigurationBlock.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import java.io.InputStream;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.ui.RutaPartitions;
+import org.apache.uima.ruta.ide.ui.RutaPreferenceConstants;
+import org.apache.uima.ruta.ide.ui.editor.RutaDocumentSetupParticipant;
+import org.apache.uima.ruta.ide.ui.text.SimpleRutaSourceViewerConfiguration;
+import org.eclipse.dltk.internal.ui.editor.ScriptSourceViewer;
+import org.eclipse.dltk.ui.preferences.AbstractScriptEditorColoringConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.IPreferenceConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.dltk.ui.preferences.PreferencesMessages;
+import org.eclipse.dltk.ui.text.IColorManager;
+import org.eclipse.dltk.ui.text.ScriptSourceViewerConfiguration;
+import org.eclipse.dltk.ui.text.ScriptTextTools;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.source.IOverviewRuler;
+import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.jface.text.source.projection.ProjectionViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class RutaEditorColoringConfigurationBlock extends
+ AbstractScriptEditorColoringConfigurationBlock implements IPreferenceConfigurationBlock {
+
+ private static final String PREVIEW_FILE_NAME = "PreviewFile.txt";
+
+ private static final String[][] fSyntaxColorListModel = new String[][] {
+ { PreferencesMessages.DLTKEditorPreferencePage_singleLineComment,
+ RutaPreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR, sCommentsCategory },
+ { PreferencesMessages.DLTKEditorPreferencePage_CommentTaskTags,
+ RutaPreferenceConstants.COMMENT_TASK_TAGS, sCommentsCategory },
+ { PreferencesMessages.DLTKEditorPreferencePage_strings,
+ RutaPreferenceConstants.EDITOR_STRING_COLOR, sCoreCategory },
+
+ { PreferencesMessages.DLTKEditorPreferencePage_numbers,
+ RutaPreferenceConstants.EDITOR_NUMBER_COLOR, sCoreCategory },
+ { RutaPreferencesMessages.RutaEditorPreferencePage_condition_colors,
+ RutaPreferenceConstants.EDITOR_CONDITION_COLOR, sCoreCategory },
+
+ { RutaPreferencesMessages.RutaEditorPreferencePage_action_colors,
+ RutaPreferenceConstants.EDITOR_ACTION_COLOR, sCoreCategory },
+
+ { RutaPreferencesMessages.RutaEditorPreferencePage_declaration_colors,
+ RutaPreferenceConstants.EDITOR_DECLARATION_DEFINITION_COLOR, sCoreCategory },
+
+ { RutaPreferencesMessages.RutaEditorPreferencePage_basicsymbols_colors,
+ RutaPreferenceConstants.EDITOR_BASICSYMBOL_DEFINITION_COLOR, sCoreCategory },
+
+ { RutaPreferencesMessages.RutaEditorPreferencePage_function_colors,
+ RutaPreferenceConstants.EDITOR_FUNCTION_COLOR, sCoreCategory },
+
+ { RutaPreferencesMessages.RutaEditorPreferencePage_then_colors,
+ RutaPreferenceConstants.EDITOR_THEN_COLOR, sCoreCategory },
+
+ { RutaPreferencesMessages.TodoTaskDescription,// .
+ // DLTKEditorPreferencePage_CommentTaskTags
+ // ,
+ RutaPreferenceConstants.COMMENT_TASK_TAGS, sCommentsCategory }
+ /*
+ * { PreferencesMessages.DLTKEditorPreferencePage_variables,
+ * RutaPreferenceConstants.EDITOR_VARIABLE_COLOR, sCoreCategory }
+ */};
+
+ public RutaEditorColoringConfigurationBlock(OverlayPreferenceStore store) {
+ super(store);
+ }
+
+ @Override
+ protected String[][] getSyntaxColorListModel() {
+ return fSyntaxColorListModel;
+ }
+
+ @Override
+ protected ProjectionViewer createPreviewViewer(Composite parent, IVerticalRuler verticalRuler,
+ IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles,
+ IPreferenceStore store) {
+ return new ScriptSourceViewer(parent, verticalRuler, overviewRuler, showAnnotationsOverview,
+ styles, store);
+ }
+
+ @Override
+ protected ScriptSourceViewerConfiguration createSimpleSourceViewerConfiguration(
+ IColorManager colorManager, IPreferenceStore preferenceStore, ITextEditor editor,
+ boolean configureFormatter) {
+ return new SimpleRutaSourceViewerConfiguration(colorManager, preferenceStore, editor,
+ RutaPartitions.TM_PARTITIONING, configureFormatter);
+ }
+
+ @Override
+ protected void setDocumentPartitioning(IDocument document) {
+ RutaDocumentSetupParticipant participant = new RutaDocumentSetupParticipant();
+ participant.setup(document);
+ }
+
+ @Override
+ protected InputStream getPreviewContentReader() {
+ return getClass().getResourceAsStream(PREVIEW_FILE_NAME);
+ }
+
+ @Override
+ protected ScriptTextTools getTextTools() {
+ return RutaIdePlugin.getDefault().getTextTools();
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorHoverPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorHoverPreferencePage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorHoverPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorHoverPreferencePage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPreferencePage;
+import org.eclipse.dltk.ui.preferences.IPreferenceConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.dltk.ui.preferences.PreferencesMessages;
+import org.eclipse.dltk.ui.preferences.ScriptEditorHoverConfigurationBlock;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+public class RutaEditorHoverPreferencePage extends AbstractConfigurationBlockPreferencePage {
+
+ /*
+ * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
+ */
+ @Override
+ protected String getHelpId() {
+
+ return null;
+ }
+
+ /*
+ * @see
+ * org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
+ */
+ @Override
+ protected void setDescription() {
+ String description = PreferencesMessages.DLTKEditorPreferencePage_hoverTab_title;
+ setDescription(description);
+ }
+
+ /*
+ * @seeorg.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#
+ * setPreferenceStore()
+ */
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(RutaIdePlugin.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ protected Label createDescriptionLabel(Composite parent) {
+ return null; // no description for new look.
+ }
+
+ /*
+ * @seeorg.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#
+ * createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
+ */
+ @Override
+ protected IPreferenceConfigurationBlock createConfigurationBlock(
+ OverlayPreferenceStore overlayPreferenceStore) {
+ return new ScriptEditorHoverConfigurationBlock(this, overlayPreferenceStore,
+ RutaNature.NATURE_ID);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorPreferencesPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorPreferencesPage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorPreferencesPage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorPreferencesPage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPreferencePage;
+import org.eclipse.dltk.ui.preferences.EditorConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.IPreferenceConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+public class RutaEditorPreferencesPage extends AbstractConfigurationBlockPreferencePage {
+
+ /*
+ * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
+ */
+ @Override
+ protected String getHelpId() {
+ return "";
+ }
+
+ /*
+ * @see
+ * org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
+ */
+ @Override
+ protected void setDescription() {
+ String description = RutaPreferencesMessages.RutaEditorPreferencePage_general;
+ setDescription(description);
+ }
+
+ @Override
+ protected Label createDescriptionLabel(Composite parent) {
+ return null;
+ }
+
+ /*
+ * @seeorg.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#
+ * setPreferenceStore()
+ */
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(RutaIdePlugin.getDefault().getPreferenceStore());
+ }
+
+ /*
+ * @seeorg.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#
+ * createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
+ */
+ @Override
+ protected IPreferenceConfigurationBlock createConfigurationBlock(
+ OverlayPreferenceStore overlayPreferenceStore) {
+ return new EditorConfigurationBlock(this, overlayPreferenceStore);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorSyntaxColoringPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorSyntaxColoringPreferencePage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorSyntaxColoringPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaEditorSyntaxColoringPreferencePage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPreferencePage;
+import org.eclipse.dltk.ui.preferences.IPreferenceConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.dltk.ui.preferences.PreferencesMessages;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+public class RutaEditorSyntaxColoringPreferencePage extends
+ AbstractConfigurationBlockPreferencePage {
+
+ /*
+ * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
+ */
+ @Override
+ protected String getHelpId() {
+ return "";
+ }
+
+ /*
+ * @see
+ * org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
+ */
+ @Override
+ protected void setDescription() {
+ String description = PreferencesMessages.DLTKEditorPreferencePage_colors;
+ setDescription(description);
+ }
+
+ @Override
+ protected Label createDescriptionLabel(Composite parent) {
+ return null;
+ }
+
+ /*
+ * @seeorg.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#
+ * setPreferenceStore()
+ */
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(RutaIdePlugin.getDefault().getPreferenceStore());
+ }
+
+ /*
+ * @seeorg.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#
+ * createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
+ */
+ @Override
+ protected IPreferenceConfigurationBlock createConfigurationBlock(
+ OverlayPreferenceStore overlayPreferenceStore) {
+ return new RutaEditorColoringConfigurationBlock(overlayPreferenceStore);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFoldingConfigurationBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFoldingConfigurationBlock.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFoldingConfigurationBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFoldingConfigurationBlock.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.ui.text.folding.RutaFoldingPreferenceBlock;
+import org.eclipse.dltk.ui.preferences.FoldingConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.dltk.ui.text.folding.IFoldingPreferenceBlock;
+import org.eclipse.jface.preference.PreferencePage;
+
+
+public class RutaFoldingConfigurationBlock extends FoldingConfigurationBlock {
+
+ public RutaFoldingConfigurationBlock(OverlayPreferenceStore store, PreferencePage p) {
+ super(store, p);
+ }
+
+ @Override
+ protected IFoldingPreferenceBlock createFoldingPreferenceBlock() {
+ return new RutaFoldingPreferenceBlock(fStore, getPreferencePage());
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFoldingPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFoldingPreferencePage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFoldingPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFoldingPreferencePage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPreferencePage;
+import org.eclipse.dltk.ui.preferences.IPreferenceConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.dltk.ui.preferences.PreferencesMessages;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * The page for setting the editor options.
+ */
+public final class RutaFoldingPreferencePage extends AbstractConfigurationBlockPreferencePage {
+
+ /*
+ * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
+ */
+ @Override
+ protected String getHelpId() {
+ // return IScriptHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE;
+ return null;
+ }
+
+ /*
+ * @see
+ * org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
+ */
+ @Override
+ protected void setDescription() {
+ String description = PreferencesMessages.EditorPreferencePage_folding_title;
+ setDescription(description);
+ }
+
+ /*
+ * @seeorg.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#
+ * setPreferenceStore()
+ */
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(RutaIdePlugin.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ protected Label createDescriptionLabel(Composite parent) {
+ return null; // no description for new look.
+ }
+
+ /*
+ * @seeorg.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#
+ * createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
+ */
+ @Override
+ protected IPreferenceConfigurationBlock createConfigurationBlock(
+ OverlayPreferenceStore overlayPreferenceStore) {
+ return new RutaFoldingConfigurationBlock(overlayPreferenceStore, this);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFormatterPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFormatterPreferencePage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFormatterPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaFormatterPreferencePage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.apache.uima.ruta.ide.ui.RutaPartitions;
+import org.apache.uima.ruta.ide.ui.RutaPreferenceConstants;
+import org.apache.uima.ruta.ide.ui.text.SimpleRutaSourceViewerConfiguration;
+import org.eclipse.dltk.ui.formatter.AbstractFormatterPreferencePage;
+import org.eclipse.dltk.ui.preferences.PreferenceKey;
+import org.eclipse.dltk.ui.text.IColorManager;
+import org.eclipse.dltk.ui.text.ScriptSourceViewerConfiguration;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Preference page for Ruta debugging engines
+ */
+public class RutaFormatterPreferencePage extends AbstractFormatterPreferencePage {
+
+ private static final PreferenceKey FORMATTER = new PreferenceKey(RutaIdePlugin.PLUGIN_ID,
+ RutaPreferenceConstants.FORMATTER_ID);
+
+ @Override
+ protected String getNatureId() {
+ return RutaNature.NATURE_ID;
+ }
+
+ @Override
+ protected PreferenceKey getFormatterPreferenceKey() {
+ return FORMATTER;
+ }
+
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ return RutaIdePlugin.getDefault().getDialogSettings();
+ }
+
+ @Override
+ protected String getPreferencePageId() {
+ return "org.apache.uima.ruta.ide.preferences.formatter"; //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getPropertyPageId() {
+ return "org.apache.uima.ruta.ide.propertyPage.formatter"; //$NON-NLS-1$
+ }
+
+ @Override
+ protected ScriptSourceViewerConfiguration createSimpleSourceViewerConfiguration(
+ IColorManager colorManager, IPreferenceStore preferenceStore, ITextEditor editor,
+ boolean configureFormatter) {
+ return new SimpleRutaSourceViewerConfiguration(colorManager, preferenceStore, editor,
+ RutaPartitions.TM_PARTITIONING, configureFormatter);
+ }
+
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(RutaIdePlugin.getDefault().getPreferenceStore());
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalConfigurationBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalConfigurationBlock.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalConfigurationBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalConfigurationBlock.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.ui.preferences;
+
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class RutaGlobalConfigurationBlock extends AbstractConfigurationBlock {
+
+ public RutaGlobalConfigurationBlock(OverlayPreferenceStore store,
+ PreferencePage mainPreferencePage) {
+ super(store, mainPreferencePage);
+ }
+
+ public Control createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+
+ return composite;
+ }
+}