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 [11/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/RutaPartitions.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPartitions.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPartitions.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPartitions.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;
+
+import org.apache.uima.ruta.ide.core.RutaConstants;
+import org.eclipse.jface.text.IDocument;
+
+
+public interface RutaPartitions {
+
+ public final static String TM_PARTITIONING = RutaConstants.TM_PARTITIONING;
+
+ public final static String TM_COMMENT = "__ruta_comment";
+
+ public final static String TM_STRING = "__ruta_string";
+
+ public static final String TM_INNER_CODE = "__tm_inner_code";
+
+ public final static String[] TM_PARTITION_TYPES = new String[] { RutaPartitions.TM_STRING,
+ RutaPartitions.TM_COMMENT, IDocument.DEFAULT_CONTENT_TYPE };
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPerspective.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPerspective.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPerspective.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPerspective.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,130 @@
+/*
+ * 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;
+
+import org.apache.uima.ruta.ide.ui.wizards.RutaFileCreationWizard;
+import org.apache.uima.ruta.ide.ui.wizards.RutaPackageCreationWizard;
+import org.apache.uima.ruta.ide.ui.wizards.RutaProjectCreationWizard;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.progress.IProgressConstants;
+
+public class RutaPerspective implements IPerspectiveFactory {
+
+ public static final String TYPE_BROWSER = "org.apache.uima.caseditor.browser";
+
+ public static final String SELECTION_VIEW = "org.apache.uima.caseditor.selection";
+
+ public static final String ANNOTATION_TESTING = "org.apache.uima.ruta.testing.TestingView";
+
+ public static final String QUERY = "org.apache.uima.ruta.query.ui.ScriptQueryView";
+
+ public static final String TEXTRULER = "org.apache.uima.ruta.ml.MainView";
+
+ public static final String SCRIPT_EXPLORER = "org.eclipse.dltk.ui.ScriptExplorer";
+
+ public static final String NEW_FOLDER_WIZARD = "org.eclipse.ui.wizards.new.folder"; //$NON-NLS-1$
+
+ public static final String NEW_FILE_WIZARD = "org.eclipse.ui.wizards.new.file"; //$NON-NLS-1$
+
+ public static final String NEW_UNTITLED_TEXT_FILE_WIZARD = "org.eclipse.ui.editors.wizards.UntitledTextFileWizard"; //$NON-NLS-1$
+
+ public static final String ID_NEW_SOURCE_WIZARD = "org.apache.uima.ruta.ide.ui.wizards.NewSourceFolderCreationWizard";
+
+ public static final String ID_NEW_PACKAGE_WIZARD = "org.apache.uima.ruta.ide.ui.wizards.NewPackageCreationWizard";
+
+ protected void addNewWizardShortcuts(IPageLayout layout) {
+ layout.addNewWizardShortcut(RutaProjectCreationWizard.ID_WIZARD);
+ layout.addNewWizardShortcut(RutaFileCreationWizard.ID_WIZARD);
+
+ layout.addNewWizardShortcut(ID_NEW_SOURCE_WIZARD);
+ layout.addNewWizardShortcut(RutaPackageCreationWizard.ID_WIZARD);
+
+ layout.addNewWizardShortcut(NEW_FOLDER_WIZARD);
+ layout.addNewWizardShortcut(NEW_FILE_WIZARD);
+ layout.addNewWizardShortcut(NEW_UNTITLED_TEXT_FILE_WIZARD);
+ }
+
+ protected void addShowViewShortcuts(IPageLayout layout) {
+ layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+ layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+ layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
+
+ layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
+ layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
+
+ layout.addShowViewShortcut(SCRIPT_EXPLORER);
+ layout.addShowViewShortcut(TYPE_BROWSER);
+ layout.addShowViewShortcut(SELECTION_VIEW);
+ layout.addShowViewShortcut(TEXTRULER);
+ layout.addShowViewShortcut(ANNOTATION_TESTING);
+ layout.addShowViewShortcut(QUERY);
+
+ }
+
+ protected void addActionSets(IPageLayout layout) {
+
+ }
+
+ protected void createFolders(IPageLayout layout) {
+ final String editorArea = layout.getEditorArea();
+
+ IFolderLayout rightFolder = layout.createFolder("right", IPageLayout.RIGHT, (float) 0.75,
+ editorArea);
+ rightFolder.addView(IPageLayout.ID_OUTLINE);
+ rightFolder.addView(TYPE_BROWSER);
+
+ // Folder
+ IFolderLayout folder = layout.createFolder("left", IPageLayout.LEFT, (float) 0.2, editorArea); //$NON-NLS-1$
+
+ folder.addView(SCRIPT_EXPLORER);
+ folder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
+
+ // Output folder
+ IFolderLayout outputFolder = layout.createFolder(
+ "bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
+
+ outputFolder.addView(IPageLayout.ID_PROBLEM_VIEW);
+ outputFolder.addView(IPageLayout.ID_TASK_LIST);
+ outputFolder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
+ outputFolder.addView(SELECTION_VIEW);
+ outputFolder.addView(TEXTRULER);
+ outputFolder.addView(ANNOTATION_TESTING);
+ outputFolder.addView(QUERY);
+
+ outputFolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
+ outputFolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
+ outputFolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
+ }
+
+ protected void addPerspectiveShotcuts(IPageLayout layout) {
+ layout.addPerspectiveShortcut("org.apache.uima.ruta.ide.ui.explainPerspective");
+ }
+
+ public void createInitialLayout(IPageLayout layout) {
+ createFolders(layout);
+ addActionSets(layout);
+ addShowViewShortcuts(layout);
+ addNewWizardShortcuts(layout);
+ addPerspectiveShotcuts(layout);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPreferenceConstants.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPreferenceConstants.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPreferenceConstants.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaPreferenceConstants.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,320 @@
+/*
+ * 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;
+
+import org.apache.uima.ruta.ide.ui.text.RutaColorConstants;
+import org.eclipse.dltk.ui.CodeFormatterConstants;
+import org.eclipse.dltk.ui.PreferenceConstants;
+import org.eclipse.dltk.ui.preferences.NewScriptProjectPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.swt.graphics.RGB;
+
+
+public class RutaPreferenceConstants extends PreferenceConstants {
+
+ public static final String EDITOR_FOLDING_IMPORTS = "editor_folding_default_imports"; //$NON-NLS-1$
+
+ public static final String EDITOR_FOLDING_BLOCKS = "editor_folding_blocks"; //$NON-NLS-1$
+
+ public static final int EDITOR_FOLDING_BLOCKS_OFF = 0;
+
+ public static final int EDITOR_FOLDING_BLOCKS_INCLUDE = 1;
+
+ public static final int EDITOR_FOLDING_BLOCKS_EXCLUDE = 2;
+
+ public static final String EDITOR_FOLDING_INCLUDE_LIST = "editor_folding_include_list"; //$NON-NLS-1$
+
+ public static final String EDITOR_FOLDING_EXCLUDE_LIST = "editor_folding_exclude_list"; //$NON-NLS-1$
+
+ public static final String EDITOR_FOLDING_INIT_COMMENTS = "editor_folding_init_comments"; //$NON-NLS-1$
+
+ public static final String EDITOR_FOLDING_INIT_NAMESPACES = "editor_folding_init_namespaces"; //$NON-NLS-1$
+
+ public static final String EDITOR_FOLDING_INIT_BLOCKS = "editor_folding_init_blocks"; //$NON-NLS-1$
+
+ public static final String EDITOR_FOLDING_COMMENTS_WITH_NEWLINES = "editor_folding_comments_lines"; //$NON-NLS-1$
+
+ public static final String DOC_MAN_PAGES_LOCATIONS = "doc_man_pages_locations";
+
+ public static final String EDITOR_FOLDING_COMMENTS_FOLDING = "editor_folding_comments";
+
+ public final static String EDITOR_SINGLE_LINE_COMMENT_COLOR = RutaColorConstants.TM_SINGLE_LINE_COMMENT;
+
+ public final static String EDITOR_SINGLE_LINE_COMMENT_BOLD = RutaColorConstants.TM_SINGLE_LINE_COMMENT
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_SINGLE_LINE_COMMENT_ITALIC = RutaColorConstants.TM_SINGLE_LINE_COMMENT
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_SINGLE_LINE_COMMENT_STRIKETHROUGH = RutaColorConstants.TM_SINGLE_LINE_COMMENT
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_SINGLE_LINE_COMMENT_UNDERLINE = RutaColorConstants.TM_SINGLE_LINE_COMMENT
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_NUMBER_COLOR = RutaColorConstants.TM_NUMBER;
+
+ public final static String EDITOR_NUMBER_BOLD = RutaColorConstants.TM_NUMBER
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_NUMBER_ITALIC = RutaColorConstants.TM_NUMBER
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_NUMBER_STRIKETHROUGH = RutaColorConstants.TM_NUMBER
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_NUMBER_UNDERLINE = RutaColorConstants.TM_NUMBER
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_STRING_COLOR = RutaColorConstants.TM_STRING;
+
+ public final static String EDITOR_STRING_BOLD = RutaColorConstants.TM_STRING
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_STRING_ITALIC = RutaColorConstants.TM_STRING
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_STRING_STRIKETHROUGH = RutaColorConstants.TM_STRING
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_STRING_UNDERLINE = RutaColorConstants.TM_STRING
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_FUNCTION_COLOR = RutaColorConstants.TM_FUNCTION;
+
+ public final static String EDITOR_FUNCTION_COLOR_BOLD = RutaColorConstants.TM_FUNCTION
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_FUNCTION_COLOR_ITALIC = RutaColorConstants.TM_FUNCTION
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_FUNCTION_COLOR_STRIKETHROUGH = RutaColorConstants.TM_FUNCTION
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_FUNCTION_COLOR_UNDERLINE = RutaColorConstants.TM_FUNCTION
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_CONDITION_COLOR = RutaColorConstants.TM_CONDITION;
+
+ public final static String EDITOR_CONDITION_COLOR_BOLD = RutaColorConstants.TM_CONDITION
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_CONDITION_COLOR_ITALIC = RutaColorConstants.TM_CONDITION
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_CONDITION_COLOR_STRIKETHROUGH = RutaColorConstants.TM_CONDITION
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_CONDITION_COLOR_UNDERLINE = RutaColorConstants.TM_CONDITION
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_ACTION_COLOR = RutaColorConstants.TM_ACTION;
+
+ public final static String EDITOR_ACTION_COLOR_BOLD = RutaColorConstants.TM_ACTION
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_ACTION_COLOR_ITALIC = RutaColorConstants.TM_ACTION
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_ACTION_COLOR_STRIKETHROUGH = RutaColorConstants.TM_ACTION
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_ACTION_COLOR_UNDERLINE = RutaColorConstants.TM_ACTION
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_THEN_COLOR = RutaColorConstants.TM_THEN;
+
+ public final static String EDITOR_THEN_COLOR_BOLD = RutaColorConstants.TM_THEN
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_THEN_COLOR_ITALIC = RutaColorConstants.TM_THEN
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_THEN_COLOR_STRIKETHROUGH = RutaColorConstants.TM_THEN
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_THEN_COLOR_UNDERLINE = RutaColorConstants.TM_THEN
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_DECLARATION_DEFINITION_COLOR = RutaColorConstants.TM_DECLARATION;
+
+ public final static String EDITOR_DECLARATION_DEFINITION_COLOR_BOLD = RutaColorConstants.TM_DECLARATION
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_DECLARATION_DEFINITION_COLOR_ITALIC = RutaColorConstants.TM_DECLARATION
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_DECLARATION_DEFINITION_COLOR_STRIKETHROUGH = RutaColorConstants.TM_DECLARATION
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_DECLARATION_DEFINITION_COLOR_UNDERLINE = RutaColorConstants.TM_DECLARATION
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_BASICSYMBOL_DEFINITION_COLOR = RutaColorConstants.TM_BASICSYMBOL;
+
+ public final static String EDITOR_BASICSYMBOL_DEFINITION_COLOR_BOLD = RutaColorConstants.TM_BASICSYMBOL
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_BASICSYMBOL_DEFINITION_COLOR_ITALIC = RutaColorConstants.TM_BASICSYMBOL
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_BASICSYMBOL_DEFINITION_COLOR_STRIKETHROUGH = RutaColorConstants.TM_BASICSYMBOL
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_BASICSYMBOL_DEFINITION_COLOR_UNDERLINE = RutaColorConstants.TM_BASICSYMBOL
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_DOC_COMMENT_COLOR = RutaColorConstants.TM_DOC_COMMENT;
+
+ public final static String EDITOR_DOC_COMMENT_COLOR_BOLD = RutaColorConstants.TM_DOC_COMMENT
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_DOC_COMMENT_COLOR_ITALIC = RutaColorConstants.TM_DOC_COMMENT
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_DOC_COMMENT_COLOR_STRIKETHROUGH = RutaColorConstants.TM_DOC_COMMENT
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_DOC_COMMENT_COLOR_UNDERLINE = RutaColorConstants.TM_DOC_COMMENT
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_VARIABLE_COLOR = RutaColorConstants.TM_DOC_COMMENT;
+
+ public final static String EDITOR_VARIABLE_COLOR_BOLD = RutaColorConstants.TM_DOC_COMMENT
+ + EDITOR_BOLD_SUFFIX;
+
+ public final static String EDITOR_VARIABLE_COLOR_ITALIC = RutaColorConstants.TM_DOC_COMMENT
+ + EDITOR_ITALIC_SUFFIX;
+
+ public final static String EDITOR_VARIABLE_COLOR_STRIKETHROUGH = RutaColorConstants.TM_DOC_COMMENT
+ + EDITOR_STRIKETHROUGH_SUFFIX;
+
+ public final static String EDITOR_VARIABLE_COLOR_UNDERLINE = RutaColorConstants.TM_DOC_COMMENT
+ + EDITOR_UNDERLINE_SUFFIX;
+
+ public final static String EDITOR_SMART_PASTE_MODE = "smartPasteMode"; //$NON-NLS-1$
+
+ public final static int EDITOR_SMART_PASTE_MODE_SIMPLE = 1;
+
+ public final static int EDITOR_SMART_PASTE_MODE_FULL = 2;
+
+ public static final String DOC_TM_PAGES_LOCATIONS = "doc_tm_pages_location";
+
+ public static final String COMMENT_TASK_TAGS = RutaColorConstants.TM_TODO_TAG;// RutaColorConstants
+
+ public static final String COMMENT_TASK_TAGS_BOLD = COMMENT_TASK_TAGS + EDITOR_BOLD_SUFFIX;
+
+ /**
+ * A preference that controls the selected formatter.
+ */
+ public static final String FORMATTER_ID = "formatterId"; //$NON-NLS-1$
+
+ public static void initializeDefaultValues(IPreferenceStore store) {
+ PreferenceConstants.initializeDefaultValues(store);
+
+ PreferenceConverter.setDefault(store, COMMENT_TASK_TAGS, new RGB(127, 159, 191));
+ store.setDefault(COMMENT_TASK_TAGS_BOLD, true);
+
+ PreferenceConverter.setDefault(store,
+ RutaPreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR, new RGB(63, 127, 95));
+ store.setDefault(RutaPreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD, false);
+ store.setDefault(RutaPreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_ITALIC, false);
+
+ PreferenceConverter.setDefault(store, RutaPreferenceConstants.EDITOR_DOC_COMMENT_COLOR,
+ new RGB(63, 127, 95));
+
+ PreferenceConverter.setDefault(store, RutaPreferenceConstants.EDITOR_STRING_COLOR,
+ new RGB(42, 0, 255));
+ PreferenceConverter.setDefault(store, RutaPreferenceConstants.EDITOR_NUMBER_COLOR,
+ new RGB(128, 0, 0));
+
+ PreferenceConverter.setDefault(store, RutaPreferenceConstants.EDITOR_VARIABLE_COLOR,
+ new RGB(200, 0, 0));
+
+ // Functions
+ PreferenceConverter.setDefault(store, RutaPreferenceConstants.EDITOR_FUNCTION_COLOR,
+ new RGB(50, 50, 200));
+ store.setDefault(RutaPreferenceConstants.EDITOR_FUNCTION_COLOR_BOLD, true);
+
+ // Conditions
+ PreferenceConverter.setDefault(store, RutaPreferenceConstants.EDITOR_CONDITION_COLOR,
+ new RGB(0, 128, 0));
+ store.setDefault(RutaPreferenceConstants.EDITOR_CONDITION_COLOR_BOLD, true);
+
+ // Actions
+ PreferenceConverter.setDefault(store, RutaPreferenceConstants.EDITOR_ACTION_COLOR,
+ new RGB(0, 0, 128));
+ store.setDefault(RutaPreferenceConstants.EDITOR_ACTION_COLOR_BOLD, true);
+
+ // Then
+ PreferenceConverter.setDefault(store, RutaPreferenceConstants.EDITOR_THEN_COLOR, new RGB(
+ 0, 0, 0));
+ store.setDefault(RutaPreferenceConstants.EDITOR_THEN_COLOR_BOLD, true);
+
+ // Declarations
+ PreferenceConverter.setDefault(store,
+ RutaPreferenceConstants.EDITOR_DECLARATION_DEFINITION_COLOR, new RGB(128, 0, 0));
+ store.setDefault(RutaPreferenceConstants.EDITOR_DECLARATION_DEFINITION_COLOR_BOLD, true);
+
+ // basic tokens
+ PreferenceConverter.setDefault(store,
+ RutaPreferenceConstants.EDITOR_BASICSYMBOL_DEFINITION_COLOR, new RGB(128, 128,
+ 128));
+ store.setDefault(RutaPreferenceConstants.EDITOR_BASICSYMBOL_DEFINITION_COLOR_BOLD, true);
+
+ store.setDefault(PreferenceConstants.EDITOR_CLOSE_STRINGS, false);
+ store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACKETS, true);
+ store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACES, true);
+ store.setDefault(PreferenceConstants.EDITOR_SMART_TAB, true);
+ store.setDefault(PreferenceConstants.EDITOR_SMART_PASTE, true);
+ store.setDefault(PreferenceConstants.EDITOR_SMART_HOME_END, true);
+ store.setDefault(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION, true);
+ store.setDefault(PreferenceConstants.EDITOR_TAB_WIDTH, 4);
+ store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true);
+
+ // folding
+ store.setDefault(PreferenceConstants.EDITOR_FOLDING_ENABLED, true);
+ store.setDefault(PreferenceConstants.EDITOR_COMMENTS_FOLDING_ENABLED, true);
+ store.setDefault(RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS,
+ RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS_EXCLUDE);
+ store.setDefault(RutaPreferenceConstants.EDITOR_FOLDING_INCLUDE_LIST, "BLOCK");
+ store.setDefault(RutaPreferenceConstants.EDITOR_FOLDING_EXCLUDE_LIST, "");
+ store.setDefault(RutaPreferenceConstants.EDITOR_FOLDING_COMMENTS_WITH_NEWLINES, true);
+ store.setDefault(RutaPreferenceConstants.EDITOR_FOLDING_INIT_COMMENTS, true);
+ store.setDefault(PreferenceConstants.EDITOR_FOLDING_LINES_LIMIT, 5);
+
+ store.setDefault(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.SPACE);
+ store.setDefault(CodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
+ store.setDefault(CodeFormatterConstants.FORMATTER_INDENTATION_SIZE, "4");
+
+ NewScriptProjectPreferencePage.initDefaults(store);
+
+ store.setDefault(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES, false);
+ store.setDefault(PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE, false);
+ store.setDefault(PreferenceConstants.APPEARANCE_METHOD_TYPEPARAMETERS, true);
+ store.setDefault(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW, ""); //$NON-NLS-1$
+
+ store.setDefault(PreferenceConstants.SHOW_SOURCE_MODULE_CHILDREN, true);
+
+ store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS, ".");
+
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaProjectDecorator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaProjectDecorator.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaProjectDecorator.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaProjectDecorator.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;
+
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.eclipse.dltk.ui.AbstractScriptProjectDecorator;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+public class RutaProjectDecorator extends AbstractScriptProjectDecorator {
+
+ /*
+ * @see org.eclipse.dltk.ui.AbstractScriptProjectDecorator#getNatureId()
+ */
+ @Override
+ protected String getNatureId() {
+ return RutaNature.NATURE_ID;
+ }
+
+ /*
+ * @see org.eclipse.dltk.ui.AbstractScriptProjectDecorator#getProjectDecorator()
+ */
+ @Override
+ protected ImageDescriptor getProjectDecorator() {
+ return RutaImages.PROJECT_DECARATOR;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaSemanticPositionUpdater.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaSemanticPositionUpdater.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaSemanticPositionUpdater.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaSemanticPositionUpdater.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.apache.uima.ruta.ide.ui.text.RutaTextTools;
+import org.eclipse.dltk.compiler.env.IModuleSource;
+import org.eclipse.dltk.ui.editor.highlighting.ASTSemanticHighlighter;
+import org.eclipse.dltk.ui.editor.highlighting.ISemanticHighlightingRequestor;
+import org.eclipse.dltk.ui.editor.highlighting.SemanticHighlighting;
+
+
+public class RutaSemanticPositionUpdater extends ASTSemanticHighlighter {
+
+ private final ISemanticHighlightingExtension[] extensions;
+
+ private final ISemanticHighlightingRequestor[] requestors;
+
+ private static class SemanticPositionRequestorExtension implements ISemanticHighlightingRequestor {
+
+ private final ISemanticHighlightingRequestor requestor;
+
+ private final int offset;
+
+ /**
+ * @param requestor
+ * @param offset
+ */
+ public SemanticPositionRequestorExtension(ISemanticHighlightingRequestor requestor, int offset) {
+ this.offset = offset;
+ this.requestor = requestor;
+ }
+
+ public void addPosition(int start, int end, String highlightingKey) {
+ requestor.addPosition(start, end, highlightingKey);
+
+ }
+
+ }
+
+ public RutaSemanticPositionUpdater(ISemanticHighlightingExtension[] extensions) {
+ this.extensions = extensions;
+ this.requestors = new ISemanticHighlightingRequestor[extensions.length];
+ int offset = 0;
+ for (int i = 0; i < extensions.length; ++i) {
+ requestors[i] = new SemanticPositionRequestorExtension(this, offset);
+ offset += extensions[i].getHighlightings().length;
+ }
+ }
+
+
+
+ @Override
+ protected String getNature() {
+ return RutaNature.NATURE_ID;
+ }
+
+
+
+ public SemanticHighlighting[] getSemanticHighlightings() {
+ return new SemanticHighlighting[] {
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_DECLARATION_DEFINITION_COLOR,
+ null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_FUNCTION_COLOR, null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_ACTION_COLOR, null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_CONDITION_COLOR, null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_STRING_COLOR, null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_VARIABLE_COLOR,
+ RutaPreferenceConstants.EDITOR_CONDITION_COLOR, null) };
+ }
+
+
+
+ @Override
+ protected boolean doHighlighting(IModuleSource code) throws Exception {
+ return false;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaUILanguageToolkit.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaUILanguageToolkit.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaUILanguageToolkit.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaUILanguageToolkit.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,151 @@
+/*
+ * 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;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.core.RutaConstants;
+import org.apache.uima.ruta.ide.core.RutaLanguageToolkit;
+import org.apache.uima.ruta.ide.core.parser.RutaParseUtils;
+import org.apache.uima.ruta.ide.parser.ast.TMTypeConstants;
+import org.apache.uima.ruta.ide.ui.editor.RutaEditor;
+import org.apache.uima.ruta.ide.ui.text.SimpleRutaSourceViewerConfiguration;
+import org.eclipse.dltk.core.IDLTKLanguageToolkit;
+import org.eclipse.dltk.core.IField;
+import org.eclipse.dltk.core.IScriptFolder;
+import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.ui.AbstractDLTKUILanguageToolkit;
+import org.eclipse.dltk.ui.IDLTKUILanguageToolkit;
+import org.eclipse.dltk.ui.ScriptElementLabels;
+import org.eclipse.dltk.ui.text.ScriptSourceViewerConfiguration;
+import org.eclipse.dltk.ui.text.ScriptTextTools;
+import org.eclipse.dltk.ui.viewsupport.ScriptUILabelProvider;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class RutaUILanguageToolkit extends AbstractDLTKUILanguageToolkit {
+
+ private static RutaUILanguageToolkit toolkit = null;
+
+ public static IDLTKUILanguageToolkit getInstance() {
+ if (toolkit == null) {
+ toolkit = new RutaUILanguageToolkit();
+ }
+ return toolkit;
+ }
+
+ private static ScriptElementLabels sInstance = new ScriptElementLabels() {
+ @Override
+ protected void getScriptFolderLabel(IScriptFolder folder, StringBuffer buf) {
+ String name = folder.getElementName();
+ name = name.replace(IScriptFolder.PACKAGE_DELIMITER, '.');
+ buf.append(name);
+ }
+
+ @Override
+ protected void getFieldLabel(IField field, long flags, StringBuffer buf) {
+ super.getFieldLabel(field, flags, buf);
+ int i = RutaParseUtils.getTypeOfIModelElement(field);
+ String type = TMTypeConstants.typeStringOfInt.get(i);
+ if (type != null) {
+ type = type.toLowerCase();
+ buf.append(" : ");
+ buf.append(type);
+ }
+ }
+ };
+
+ @Override
+ public ScriptElementLabels getScriptElementLabels() {
+ return sInstance;
+ }
+
+ public IPreferenceStore getPreferenceStore() {
+ return RutaIdePlugin.getDefault().getPreferenceStore();
+ }
+
+ public IDLTKLanguageToolkit getCoreToolkit() {
+ return RutaLanguageToolkit.getDefault();
+ }
+
+ public IDialogSettings getDialogSettings() {
+ return RutaIdePlugin.getDefault().getDialogSettings();
+ }
+
+ @Override
+ public String getPartitioningId() {
+ return RutaConstants.TM_PARTITIONING;
+ }
+
+ @Override
+ public String getEditorId(Object inputElement) {
+ return RutaEditor.EDITOR_ID;
+ }
+
+ @Override
+ public String getInterpreterContainerId() {
+ return "org.apache.uima.ruta.ide.launching.INTERPRETER_CONTAINER";
+ }
+
+ @Override
+ public ScriptUILabelProvider createScriptUILabelProvider() {
+ return null;
+ }
+
+ @Override
+ public boolean getProvideMembers(ISourceModule element) {
+ return true;
+ }
+
+ @Override
+ public ScriptTextTools getTextTools() {
+ return RutaIdePlugin.getDefault().getTextTools();
+ }
+
+ @Override
+ public ScriptSourceViewerConfiguration createSourceViewerConfiguration() {
+ return new SimpleRutaSourceViewerConfiguration(getTextTools().getColorManager(),
+ getPreferenceStore(), null, getPartitioningId(), false);
+ }
+
+ private static final String INTERPRETERS_PREFERENCE_PAGE_ID = "org.apache.uima.ruta.ide.preferences.interpreters";
+
+ private static final String DEBUG_PREFERENCE_PAGE_ID = "org.apache.uima.ruta.ide.preferences.debug";
+
+ @Override
+ public String getInterpreterPreferencePage() {
+ return INTERPRETERS_PREFERENCE_PAGE_ID;
+ }
+
+ @Override
+ public String getDebugPreferencePage() {
+ return DEBUG_PREFERENCE_PAGE_ID;
+ }
+
+ private static final String[] EDITOR_PREFERENCE_PAGES_IDS = {
+ "org.apache.uima.ruta.ide.preferences.editor",
+ "org.apache.uima.ruta.ide.ui.editor.SyntaxColoring",
+ "org.apache.uima.ruta.ide.ui.editor.SmartTyping",
+ "org.apache.uima.ruta.ide.ui.editor.RutaFolding" };
+
+ @Override
+ public String[] getEditorPreferencePages() {
+ return EDITOR_PREFERENCE_PAGES_IDS;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaUIPreferenceInitializer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaUIPreferenceInitializer.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaUIPreferenceInitializer.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaUIPreferenceInitializer.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;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.dltk.compiler.util.Util;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.editors.text.EditorsUI;
+
+public class RutaUIPreferenceInitializer extends AbstractPreferenceInitializer {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences
+ * ()
+ */
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = RutaIdePlugin.getDefault().getPreferenceStore();
+
+ EditorsUI.useAnnotationsPreferencePage(store);
+ EditorsUI.useQuickDiffPreferencePage(store);
+ RutaPreferenceConstants.initializeDefaultValues(store);
+ store.setDefault(RutaPreferenceConstants.FORMATTER_ID, Util.EMPTY_STRING);
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/OpenRutaSearchPageAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/OpenRutaSearchPageAction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/OpenRutaSearchPageAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/OpenRutaSearchPageAction.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.actions;
+
+import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+public class OpenRutaSearchPageAction implements IWorkbenchWindowActionDelegate {
+
+ private static final String TM_SEARCH_PAGE_ID = "org.apache.uima.ruta.ide.ui.RutaSearchPage";
+
+ private IWorkbenchWindow window;
+
+ public OpenRutaSearchPageAction() {
+ }
+
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+
+ public void run(IAction action) {
+ if (window == null || window.getActivePage() == null) {
+ beep();
+ return;
+ }
+
+ NewSearchUI.openSearchDialog(window, TM_SEARCH_PAGE_ID);
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ public void dispose() {
+ window = null;
+ }
+
+ protected void beep() {
+ Shell shell = DLTKUIPlugin.getActiveWorkbenchShell();
+ if (shell != null && shell.getDisplay() != null)
+ shell.getDisplay().beep();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaGenerateActionGroup.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaGenerateActionGroup.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaGenerateActionGroup.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaGenerateActionGroup.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,41 @@
+/*
+ * 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.actions;
+
+import org.apache.uima.ruta.ide.ui.editor.RutaEditor;
+import org.eclipse.dltk.internal.ui.editor.DLTKEditorMessages;
+import org.eclipse.dltk.ui.actions.DLTKActionConstants;
+import org.eclipse.dltk.ui.actions.GenerateActionGroup;
+import org.eclipse.dltk.ui.actions.IScriptEditorActionDefinitionIds;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.texteditor.TextOperationAction;
+
+public class RutaGenerateActionGroup extends GenerateActionGroup {
+ public RutaGenerateActionGroup(RutaEditor editor, String groupName) {
+ super(editor, groupName);
+ Action action = new TextOperationAction(DLTKEditorMessages.getBundleForConstructedKeys(),
+ "Format.", editor, ISourceViewer.FORMAT); //$NON-NLS-1$
+ action.setActionDefinitionId(IScriptEditorActionDefinitionIds.FORMAT);
+ editor.setAction(DLTKActionConstants.FORMAT, action);
+ editor.markAsStateDependentAction(DLTKActionConstants.FORMAT, true);
+ editor.markAsSelectionDependentAction(DLTKActionConstants.FORMAT, true);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaOpenTypeAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaOpenTypeAction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaOpenTypeAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaOpenTypeAction.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,32 @@
+/*
+ * 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.actions;
+
+import org.apache.uima.ruta.ide.ui.RutaUILanguageToolkit;
+import org.eclipse.dltk.ui.IDLTKUILanguageToolkit;
+import org.eclipse.dltk.ui.actions.OpenTypeAction;
+
+
+public class RutaOpenTypeAction extends OpenTypeAction {
+ @Override
+ protected IDLTKUILanguageToolkit getUILanguageToolkit() {
+ return RutaUILanguageToolkit.getInstance();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaOpenTypeInHierarchyAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaOpenTypeInHierarchyAction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaOpenTypeInHierarchyAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaOpenTypeInHierarchyAction.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,32 @@
+/*
+ * 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.actions;
+
+import org.apache.uima.ruta.ide.ui.RutaUILanguageToolkit;
+import org.eclipse.dltk.ui.IDLTKUILanguageToolkit;
+import org.eclipse.dltk.ui.actions.OpenTypeInHierarchyAction;
+
+
+public class RutaOpenTypeInHierarchyAction extends OpenTypeInHierarchyAction {
+ @Override
+ protected IDLTKUILanguageToolkit getLanguageToolkit() {
+ return RutaUILanguageToolkit.getInstance();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaSelectAnnotationRulerAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaSelectAnnotationRulerAction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaSelectAnnotationRulerAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaSelectAnnotationRulerAction.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,195 @@
+/*
+ * 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.actions;
+
+import java.util.Iterator;
+import java.util.ResourceBundle;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.ui.text.RutaCorrectionProcessor;
+import org.eclipse.dltk.ui.PreferenceConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationAccessExtension;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
+import org.eclipse.ui.texteditor.AnnotationPreference;
+import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorExtension;
+import org.eclipse.ui.texteditor.SelectMarkerRulerAction;
+
+public class RutaSelectAnnotationRulerAction extends SelectMarkerRulerAction {
+
+ private ITextEditor fTextEditor;
+
+ private Position fPosition;
+
+ private Annotation fAnnotation;
+
+ private AnnotationPreferenceLookup fAnnotationPreferenceLookup;
+
+ private IPreferenceStore fStore;
+
+ private boolean fHasCorrection;
+
+ private ResourceBundle fBundle;
+
+ public RutaSelectAnnotationRulerAction(ResourceBundle bundle, String prefix,
+ ITextEditor editor, IVerticalRulerInfo ruler) {
+ super(bundle, prefix, editor, ruler);
+ fBundle = bundle;
+ fTextEditor = editor;
+
+ fAnnotationPreferenceLookup = EditorsUI.getAnnotationPreferenceLookup();
+ fStore = RutaIdePlugin.getDefault().getPreferenceStore();
+
+ // PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+ // IJavaHelpContextIds.JAVA_SELECT_MARKER_RULER_ACTION);
+ }
+
+ @Override
+ public void run() {
+ if (fStore.getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
+ return;
+
+ runWithEvent(null);
+ }
+
+ /*
+ * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event)
+ *
+ * @since 3.2
+ */
+ @Override
+ public void runWithEvent(Event event) {
+ // if (fAnnotation instanceof
+ // OverrideIndicatorManager.OverrideIndicator) {
+ // ((OverrideIndicatorManager.OverrideIndicator)fAnnotation).open();
+ // return;
+ // }
+
+ if (fHasCorrection) {
+ ITextOperationTarget operation = (ITextOperationTarget) fTextEditor
+ .getAdapter(ITextOperationTarget.class);
+ final int opCode = ISourceViewer.QUICK_ASSIST;
+ if (operation != null && operation.canDoOperation(opCode)) {
+ fTextEditor.selectAndReveal(fPosition.getOffset(), fPosition.getLength());
+ operation.doOperation(opCode);
+ }
+ return;
+ }
+
+ super.run();
+ }
+
+ @Override
+ public void update() {
+ findJavaAnnotation();
+ setEnabled(true); // super.update() might change this later
+
+ // if (fAnnotation instanceof
+ // OverrideIndicatorManager.OverrideIndicator) {
+ // initialize(fBundle,
+ // "JavaSelectAnnotationRulerAction.OpenSuperImplementation.");
+ // //$NON-NLS-1$
+ // return;
+ // }
+ if (fHasCorrection) {
+ // if (fAnnotation instanceof AssistAnnotation)
+ // initialize(fBundle,
+ // "JavaSelectAnnotationRulerAction.QuickAssist."); //$NON-NLS-1$
+ // else
+ initialize(fBundle, "JavaSelectAnnotationRulerAction.QuickFix."); //$NON-NLS-1$
+ return;
+ }
+
+ initialize(fBundle, "JavaSelectAnnotationRulerAction.GotoAnnotation."); //$NON-NLS-1$;
+ super.update();
+ }
+
+ private void findJavaAnnotation() {
+ fPosition = null;
+ fAnnotation = null;
+ fHasCorrection = false;
+
+ AbstractMarkerAnnotationModel model = getAnnotationModel();
+ IAnnotationAccessExtension annotationAccess = getAnnotationAccessExtension();
+
+ IDocument document = getDocument();
+ if (model == null)
+ return;
+
+ boolean hasAssistLightbulb = false;
+ // fStore.getBoolean(RutaPreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);
+
+ Iterator iter = model.getAnnotationIterator();
+ int layer = Integer.MIN_VALUE;
+
+ while (iter.hasNext()) {
+ Annotation annotation = (Annotation) iter.next();
+ if (annotation.isMarkedDeleted())
+ continue;
+
+ int annotationLayer = layer;
+ if (annotationAccess != null) {
+ annotationLayer = annotationAccess.getLayer(annotation);
+ if (annotationLayer < layer)
+ continue;
+ }
+
+ Position position = model.getPosition(annotation);
+ if (!includesRulerLine(position, document))
+ continue;
+
+ boolean isReadOnly = fTextEditor instanceof ITextEditorExtension
+ && ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly();
+ if (!isReadOnly && ((RutaCorrectionProcessor.hasCorrections(annotation)))) {
+ fPosition = position;
+ fAnnotation = annotation;
+ fHasCorrection = true;
+ layer = annotationLayer;
+ continue;
+ } else {
+ AnnotationPreference preference = fAnnotationPreferenceLookup
+ .getAnnotationPreference(annotation);
+ if (preference == null)
+ continue;
+
+ String key = preference.getVerticalRulerPreferenceKey();
+ if (key == null)
+ continue;
+
+ if (fStore.getBoolean(key)) {
+ fPosition = position;
+ fAnnotation = annotation;
+ fHasCorrection = false;
+ layer = annotationLayer;
+ }
+ }
+ }
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaSelectRulerAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaSelectRulerAction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaSelectRulerAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/actions/RutaSelectRulerAction.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,35 @@
+/*
+ * 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.actions;
+
+import org.eclipse.dltk.internal.ui.editor.DLTKEditorMessages;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class RutaSelectRulerAction extends AbstractRulerActionDelegate {
+
+ @Override
+ protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
+ return new RutaSelectAnnotationRulerAction(DLTKEditorMessages
+ .getBundleForConstructedKeys(), "SelectAnnotationRulerAction.", editor, rulerInfo); //$NON-NLS-1$
+ }
+}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/ConsoleMessages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/ConsoleMessages.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/console/ConsoleMessages.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/ConsoleMessages.java Mon Apr 29 14:50:56 2013
@@ -17,38 +17,38 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.ui.console;
+package org.apache.uima.ruta.ide.ui.console;
import org.eclipse.osgi.util.NLS;
public class ConsoleMessages extends NLS {
- private static final String BUNDLE_NAME = "org.apache.uima.textmarker.ide.debug.ui.console.ConsoleMessages";
+ private static final String BUNDLE_NAME = "org.apache.uima.ruta.ide.debug.ui.console.ConsoleMessages";
- public static String TextMarkerFileHyperlink_Information_1;
+ public static String RutaFileHyperlink_Information_1;
- public static String TextMarkerFileHyperlink_Error;
+ public static String RutaFileHyperlink_Error;
public static String ScriptStackTraceConsoleFactory_0;
public static String ScriptStackTraceConsole_0;
- public static String TextMarkerFileHyperlink_Source_not_found_for__0__2;
+ public static String RutaFileHyperlink_Source_not_found_for__0__2;
- public static String TextMarkerFileHyperlink_An_exception_occurred_while_following_link__3;
+ public static String RutaFileHyperlink_An_exception_occurred_while_following_link__3;
- public static String TextMarkerFileHyperlink_Unable_to_parse_type_name_from_hyperlink__5;
+ public static String RutaFileHyperlink_Unable_to_parse_type_name_from_hyperlink__5;
- public static String TextMarkerFileHyperlink_Unable_to_parse_line_number_from_hyperlink__6;
+ public static String RutaFileHyperlink_Unable_to_parse_line_number_from_hyperlink__6;
- public static String TextMarkerFileHyperlink_Unable_to_parse_line_number_from_hyperlink__7;
+ public static String RutaFileHyperlink_Unable_to_parse_line_number_from_hyperlink__7;
- public static String TextMarkerFileHyperlink_Unable_to_retrieve_hyperlink_text__8;
+ public static String RutaFileHyperlink_Unable_to_retrieve_hyperlink_text__8;
static {
NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);
}
- public static String TextMarkerFileHyperlink_0;
+ public static String RutaFileHyperlink_0;
- public static String TextMarkerFileHyperlink_1;
+ public static String RutaFileHyperlink_1;
}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/PasteRutaTextToConsoleAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/PasteRutaTextToConsoleAction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/PasteRutaTextToConsoleAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/PasteRutaTextToConsoleAction.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,70 @@
+/*
+ * 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.console;
+
+import org.eclipse.dltk.console.ui.IScriptConsole;
+import org.eclipse.dltk.console.ui.ScriptConsoleManager;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class PasteRutaTextToConsoleAction implements IEditorActionDelegate {
+
+ private ISelection selection;
+
+ private IEditorPart targetEditor;
+
+ protected IDocument getDocument() {
+ if (!(targetEditor instanceof ITextEditor))
+ return null;
+
+ ITextEditor editor = (ITextEditor) targetEditor;
+ IDocumentProvider dp = editor.getDocumentProvider();
+ return dp.getDocument(editor.getEditorInput());
+ }
+
+ public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+ this.targetEditor = targetEditor;
+ }
+
+ public void run(IAction action) {
+ ScriptConsoleManager manager = ScriptConsoleManager.getInstance();
+
+ IScriptConsole console = manager.getActiveScriptConsole(RutaConsole.CONSOLE_TYPE);
+
+ if (console == null) {
+ return;
+ }
+
+ if (selection instanceof ITextSelection) {
+ String text = ((ITextSelection) selection).getText();
+ console.insertText(text);
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/PasteRutaToConsole.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/PasteRutaToConsole.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/PasteRutaToConsole.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/PasteRutaToConsole.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,42 @@
+/*
+ * 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.console;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class PasteRutaToConsole implements IObjectActionDelegate {
+
+ private ISelection selection;
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+
+ }
+
+ public void run(IAction action) {
+ // TODO: implement
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsole.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsole.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsole.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsole.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.console;
+
+import org.eclipse.dltk.console.ui.ScriptConsole;
+
+public class RutaConsole extends ScriptConsole {
+ public static final String CONSOLE_TYPE = "tm_console";
+
+ public static final String CONSOLE_NAME = "Ruta Console";
+
+ public RutaConsole(RutaInterpreter interpreter, String id) {
+ super(CONSOLE_NAME + " [" + id + "]", CONSOLE_TYPE);
+
+ setInterpreter(interpreter);
+ setTextHover(new RutaConsoleTextHover(interpreter));
+ setContentAssistProcessor(new RutaConsoleCompletionProcessor(interpreter));
+
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleCompletionProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleCompletionProcessor.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleCompletionProcessor.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleCompletionProcessor.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,122 @@
+/*
+ * 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.console;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.dltk.console.IScriptConsoleShell;
+import org.eclipse.dltk.console.ScriptConsoleCompletionProposal;
+import org.eclipse.dltk.console.ui.IScriptConsoleViewer;
+import org.eclipse.dltk.console.ui.ScriptConsoleCompletionProcessor;
+import org.eclipse.dltk.ui.DLTKPluginImages;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationPresenter;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.swt.graphics.Image;
+
+public class RutaConsoleCompletionProcessor extends ScriptConsoleCompletionProcessor {
+
+ protected static class Validator implements IContextInformationValidator,
+ IContextInformationPresenter {
+
+ protected int installOffset;
+
+ public boolean isContextInformationValid(int offset) {
+ return Math.abs(installOffset - offset) < 5;
+ }
+
+ public void install(IContextInformation info, ITextViewer viewer, int offset) {
+ installOffset = offset;
+ }
+
+ public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
+ return false;
+ }
+ }
+
+ protected IProposalDecorator tmDecorator = new IProposalDecorator() {
+ public String formatProposal(ScriptConsoleCompletionProposal c) {
+ return c.getDisplay();
+ }
+
+ public Image getImage(ScriptConsoleCompletionProposal c) {
+ String type = c.getType();
+ if (type.equals("var")) {
+ return DLTKPluginImages.get(DLTKPluginImages.IMG_OBJS_LOCAL_VARIABLE);
+ } else if (type.equals("proc")) {
+ return DLTKPluginImages.get(DLTKPluginImages.IMG_METHOD_PUBLIC);
+ } else if (type.equals("command")) {
+ return DLTKPluginImages.get(DLTKPluginImages.IMG_METHOD_PRIVATE);
+ } else if (type.equals("func")) {
+ return DLTKPluginImages.get(DLTKPluginImages.IMG_OBJS_FIELD);
+ }
+
+ return null;
+ }
+ };
+
+ private IContextInformationValidator validator;
+
+ public RutaConsoleCompletionProcessor(IScriptConsoleShell interpreterShell) {
+ super(interpreterShell);
+ }
+
+ @Override
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return new char[] { '$' };
+ }
+
+ @Override
+ protected ICompletionProposal[] computeCompletionProposalsImpl(IScriptConsoleViewer viewer,
+ int offset) {
+
+ try {
+ String commandLine = viewer.getCommandLine();
+ int cursorPosition = offset - viewer.getCommandLineOffset();
+
+ List list = getInterpreterShell().getCompletions(commandLine, cursorPosition);
+
+ List proposals = createProposalsFromString(list, offset, tmDecorator);
+
+ return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return new ICompletionProposal[] {};
+ }
+
+ @Override
+ protected IContextInformation[] computeContextInformationImpl(ITextViewer viewer, int offset) {
+ return null;
+ }
+
+ public IContextInformationValidator getContextInformationValidator() {
+ if (validator == null) {
+ validator = new Validator();
+ }
+
+ return validator;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleConstants.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleConstants.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleConstants.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleConstants.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,33 @@
+/*
+ * 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.console;
+
+public final class RutaConsoleConstants {
+ private RutaConsoleConstants() {
+ }
+
+ public static final String PREF_NEW_PROMPT = "tmconsole.new_invitation";
+
+ public static final String PREF_CONTINUE_PROMPT = "tmconsole.continue_invitation";
+
+ public static final String DEFAULT_NEW_PROMPT = "=>";
+
+ public static final String DEFAULT_CONTINUE_PROMPT = "->";
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleFactory.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleFactory.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleFactory.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,85 @@
+/*
+ * 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.console;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.dltk.console.IScriptInterpreter;
+import org.eclipse.dltk.console.ScriptConsolePrompt;
+import org.eclipse.dltk.console.ui.IScriptConsole;
+import org.eclipse.dltk.console.ui.IScriptConsoleFactory;
+import org.eclipse.dltk.console.ui.ScriptConsole;
+import org.eclipse.dltk.console.ui.ScriptConsoleFactoryBase;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class RutaConsoleFactory extends ScriptConsoleFactoryBase implements
+ IScriptConsoleFactory {
+ protected IPreferenceStore getPreferenceStore() {
+ return RutaIdePlugin.getDefault().getPreferenceStore();
+ }
+
+ protected ScriptConsolePrompt makeInvitation() {
+ IPreferenceStore store = getPreferenceStore();
+ return new ScriptConsolePrompt(store.getString(RutaConsoleConstants.PREF_NEW_PROMPT),
+ store.getString(RutaConsoleConstants.PREF_CONTINUE_PROMPT));
+ }
+
+ protected RutaConsole makeConsole(RutaInterpreter interpreter, String id) {
+ RutaConsole console = new RutaConsole(interpreter, id);
+ console.setPrompt(makeInvitation());
+ return console;
+ }
+
+ private RutaConsole createConsoleInstance(IScriptInterpreter interpreter, String id) {
+ if (interpreter == null) {
+ try {
+ id = "default";
+ interpreter = new RutaInterpreter();
+ // RutaConsoleUtil.runDefaultRutaInterpreter((RutaInterpreter)
+ // interpreter);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ return makeConsole((RutaInterpreter) interpreter, id);
+ }
+
+ @Override
+ protected ScriptConsole createConsoleInstance() {
+ return createConsoleInstance(null, null);
+ }
+
+ public RutaConsoleFactory() {
+ super();
+ }
+
+ public void openConsole(IScriptInterpreter interpreter, String id) {
+ registerAndOpenConsole(createConsoleInstance(interpreter, id));
+ }
+
+ public IScriptConsole openConsole(IScriptInterpreter interpreter, String id, ILaunch launch) {
+ RutaConsole tmConsole = createConsoleInstance(interpreter, id);
+ tmConsole.setLaunch(launch);
+ registerAndOpenConsole(tmConsole);
+ return tmConsole;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleTextHover.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleTextHover.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleTextHover.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleTextHover.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,51 @@
+/*
+ * 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.console;
+
+import java.io.IOException;
+
+import org.eclipse.dltk.console.IScriptConsoleShell;
+import org.eclipse.dltk.console.ui.IScriptConsoleViewer;
+import org.eclipse.dltk.console.ui.ScriptConsoleTextHover;
+import org.eclipse.jface.text.IRegion;
+
+public class RutaConsoleTextHover extends ScriptConsoleTextHover {
+
+ private IScriptConsoleShell interpreterShell;
+
+ public RutaConsoleTextHover(IScriptConsoleShell interpreterShell) {
+ this.interpreterShell = interpreterShell;
+ }
+
+ @Override
+ protected String getHoverInfoImpl(IScriptConsoleViewer viewer, IRegion hoverRegion) {
+ try {
+ int cursorPosition = hoverRegion.getOffset() - viewer.getCommandLineOffset();
+
+ String commandLine = viewer.getCommandLine();
+
+ return interpreterShell.getDescription(commandLine, cursorPosition);
+ } catch (IOException e) {
+ // TODO: log exception
+ e.printStackTrace();
+ return null;
+ }
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleTracker.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleTracker.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleTracker.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleTracker.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,52 @@
+/*
+ * 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.console;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.ui.console.IHyperlink;
+import org.eclipse.ui.console.IPatternMatchListenerDelegate;
+import org.eclipse.ui.console.PatternMatchEvent;
+import org.eclipse.ui.console.TextConsole;
+
+public class RutaConsoleTracker implements IPatternMatchListenerDelegate {
+ private TextConsole console;
+
+ public void connect(TextConsole console) {
+ this.console = console;
+ }
+
+ public void disconnect() {
+ console = null;
+ }
+
+ protected TextConsole getConsole() {
+ return console;
+ }
+
+ public void matchFound(PatternMatchEvent event) {
+ try {
+ int offset = event.getOffset();
+ int length = event.getLength();
+ IHyperlink link = new RutaFileHyperlink(console);
+ console.addHyperlink(link, offset + 1, length - 2);
+ } catch (BadLocationException e) {
+ }
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleUtil.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleUtil.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleUtil.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaConsoleUtil.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,49 @@
+/*
+ * 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.console;
+
+import java.io.IOException;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.dltk.console.ScriptConsoleServer;
+import org.eclipse.dltk.core.environment.EnvironmentManager;
+import org.eclipse.dltk.core.environment.IExecutionEnvironment;
+import org.eclipse.dltk.core.environment.IFileHandle;
+import org.eclipse.dltk.launching.ScriptLaunchUtil;
+
+public class RutaConsoleUtil {
+
+ public static void runDefaultRutaInterpreter(RutaInterpreter interpreter)
+ throws CoreException, IOException {
+ ScriptConsoleServer server = ScriptConsoleServer.getInstance();
+
+ String id = server.register(interpreter);
+ String port = Integer.toString(server.getPort());
+
+ String[] args = new String[] { "127.0.0.1", port, id };
+
+ IExecutionEnvironment exeEnv = (IExecutionEnvironment) EnvironmentManager.getLocalEnvironment()
+ .getAdapter(IExecutionEnvironment.class);
+ IFileHandle scriptFile = RutaIdePlugin.getDefault().getConsoleProxy(exeEnv);
+ ScriptLaunchUtil.runScript(RutaNature.NATURE_ID, scriptFile, null, null, args, null);
+ }
+}