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/07/17 10:28:08 UTC
svn commit: r1504047 [10/17] - in /uima/sandbox/ruta/trunk/ruta-ep-ide-ui:
./ icons/ schema/ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/uima/
src/main/java/org/apache/uima/ruta/ src/main/java/org...
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/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-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalConfigurationBlock.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalConfigurationBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalConfigurationBlock.java Wed Jul 17 08:28:02 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;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalPreferencePage.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaGlobalPreferencePage.java Wed Jul 17 08:28:02 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.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdeUIPlugin;
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPreferencePage;
+import org.eclipse.dltk.ui.preferences.IPreferenceConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+
+public class RutaGlobalPreferencePage extends AbstractConfigurationBlockPreferencePage {
+
+ @Override
+ protected IPreferenceConfigurationBlock createConfigurationBlock(
+ OverlayPreferenceStore overlayPreferenceStore) {
+ return new RutaGlobalConfigurationBlock(overlayPreferenceStore, this);
+ }
+
+ @Override
+ protected String getHelpId() {
+ return null;
+ }
+
+ @Override
+ protected void setDescription() {
+ String description = RutaPreferencesMessages.RutaGlobalPreferencePage_description;
+ setDescription(description);
+ }
+
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(RutaIdeUIPlugin.getDefault().getPreferenceStore());
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaPreferencesMessages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaPreferencesMessages.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaPreferencesMessages.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaPreferencesMessages.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,84 @@
+/*
+ * 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.osgi.util.NLS;
+
+public class RutaPreferencesMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.apache.uima.ruta.ide.ui.preferences.RutaPreferencesMessages";//$NON-NLS-1$
+
+
+
+ private RutaPreferencesMessages() {
+ // Do not instantiate
+ }
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, RutaPreferencesMessages.class);
+ }
+
+ public static String RutaGlobalPreferencePage_description;
+
+ public static String RutaEditorPreferencePage_general;
+
+ public static String RutaSmartTypingConfigurationBlock_typing_smartTab;
+
+ public static String RutaSmartTypingConfigurationBlock_closeBrackets;
+
+ public static String RutaSmartTypingConfigurationBlock_closeStrings;
+
+ public static String RutaSmartTypingConfigurationBlock_closeBraces;
+
+ public static String RutaSmartTypingConfigurationBlock_typing_tabTitle;
+
+ public static String RutaEditorPreferencePage_condition_colors;
+
+ public static String RutaEditorPreferencePage_action_colors;
+
+ public static String RutaEditorPreferencePage_declaration_colors;
+
+ public static String RutaEditorPreferencePage_basicsymbols_colors;
+
+ public static String RutaEditorPreferencePage_function_colors;
+
+ public static String RutaEditorPreferencePage_then_colors;
+
+ public static String RutaSmartTypingConfigurationBlock_smartPaste_full;
+
+ public static String RutaSmartTypingConfigurationBlock_smartPaste_simple;
+
+ public static String RutaSmartTypingConfigurationBlock_tabs_title;
+
+ public static String RutaSmartTypingConfigurationBlock_autoclose_title;
+
+ public static String TodoTaskDescription;
+
+ public static String BuilderResolveImports;
+
+ public static String BuilderImportByName;
+
+ public static String BuilderIgnoreDuplicateShortnames;
+
+ public static String ProjectClearOutput;
+
+ public static String NoVMInDevMode;
+
+ public static String AddSDI;
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaProjectPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaProjectPreferencePage.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaProjectPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaProjectPreferencePage.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,65 @@
+/*
+ * 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.RutaIdeUIPlugin;
+import org.apache.uima.ruta.ide.core.RutaCorePreferences;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+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 RutaProjectPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private BooleanFieldEditor clearOutput;
+
+ private BooleanFieldEditor noVM;
+
+ private BooleanFieldEditor addSDI;
+
+ public RutaProjectPreferencePage() {
+ setPreferenceStore(RutaIdeUIPlugin.getDefault().getPreferenceStore());
+ setDescription("Project Management");
+ }
+
+ @Override
+ protected void createFieldEditors() {
+ clearOutput = new BooleanFieldEditor(RutaCorePreferences.PROJECT_CLEAR_OUTPUT,
+ RutaPreferencesMessages.ProjectClearOutput, getFieldEditorParent());
+ addField(clearOutput);
+
+ noVM = new BooleanFieldEditor(RutaCorePreferences.NO_VM_IN_DEV_MODE,
+ RutaPreferencesMessages.NoVMInDevMode, getFieldEditorParent());
+ addField(noVM);
+
+ addSDI = new BooleanFieldEditor(RutaCorePreferences.ADD_SDI,
+ RutaPreferencesMessages.AddSDI, getFieldEditorParent());
+ addField(addSDI);
+
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+}
\ No newline at end of file
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaPropertyPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaPropertyPage.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaPropertyPage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaPropertyPage.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+public class RutaPropertyPage extends PropertyPage {
+
+ @Override
+ protected Control createContents(Composite parent) {
+ return new Composite(parent, SWT.NONE);
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaSmartTypingConfigurationBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaSmartTypingConfigurationBlock.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaSmartTypingConfigurationBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaSmartTypingConfigurationBlock.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,225 @@
+/*
+ * 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 java.util.List;
+
+import org.apache.uima.ruta.ide.RutaIdeUIPlugin;
+import org.apache.uima.ruta.ide.ui.RutaPreferenceConstants;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.dltk.internal.corext.util.Messages;
+import org.eclipse.dltk.ui.CodeFormatterConstants;
+import org.eclipse.dltk.ui.PreferenceConstants;
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlock;
+import org.eclipse.dltk.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.dltk.ui.preferences.PreferencesMessages;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.Link;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+/**
+ * Configures Editor typing preferences.
+ */
+class RutaSmartTypingConfigurationBlock extends AbstractConfigurationBlock {
+
+ public RutaSmartTypingConfigurationBlock(OverlayPreferenceStore store) {
+ super(store);
+
+ store.addKeys(createOverlayStoreKeys());
+ }
+
+ private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
+
+ List keys = new ArrayList();
+
+ keys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CLOSE_STRINGS));
+ keys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CLOSE_BRACKETS));
+ keys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CLOSE_BRACES));
+ keys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_SMART_TAB));
+ keys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
+ RutaPreferenceConstants.EDITOR_SMART_PASTE_MODE));
+
+ return (OverlayPreferenceStore.OverlayKey[]) keys
+ .toArray(new OverlayPreferenceStore.OverlayKey[keys.size()]);
+ }
+
+ public Control createControl(Composite parent) {
+ Composite control = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ control.setLayout(layout);
+
+ Composite composite = createSubsection(control, null,
+ RutaPreferencesMessages.RutaSmartTypingConfigurationBlock_autoclose_title);
+ addAutoclosingSection(composite);
+
+ composite = createSubsection(control, null,
+ RutaPreferencesMessages.RutaSmartTypingConfigurationBlock_tabs_title);
+ addTabSection(composite);
+
+ composite = createSubsection(control, null,
+ PreferencesMessages.SmartTypingConfigurationBlock_pasting_title);
+ addPasteSection(composite);
+
+ return control;
+ }
+
+ private void addPasteSection(Composite composite) {
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+
+ String label = null;
+
+ label = RutaPreferencesMessages.RutaSmartTypingConfigurationBlock_smartPaste_simple;
+ addRadioButton(composite, label, RutaPreferenceConstants.EDITOR_SMART_PASTE_MODE,
+ RutaPreferenceConstants.EDITOR_SMART_PASTE_MODE_SIMPLE);
+
+ label = RutaPreferencesMessages.RutaSmartTypingConfigurationBlock_smartPaste_full;
+ addRadioButton(composite, label, RutaPreferenceConstants.EDITOR_SMART_PASTE_MODE,
+ RutaPreferenceConstants.EDITOR_SMART_PASTE_MODE_FULL);
+
+ }
+
+ private void addTabSection(Composite composite) {
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+
+ String label;
+ label = RutaPreferencesMessages.RutaSmartTypingConfigurationBlock_typing_smartTab;
+ addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_TAB, 0);
+
+ createMessage(composite);
+ }
+
+ private void addAutoclosingSection(Composite composite) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+
+ String label;
+
+ label = RutaPreferencesMessages.RutaSmartTypingConfigurationBlock_closeStrings;
+ addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS, 0);
+
+ label = RutaPreferencesMessages.RutaSmartTypingConfigurationBlock_closeBrackets;
+ addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS, 0);
+
+ label = RutaPreferencesMessages.RutaSmartTypingConfigurationBlock_closeBraces;
+ addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES, 0);
+ }
+
+ private void createMessage(final Composite composite) {
+ // TODO create a link with an argument, so the formatter preference page
+ // can open the
+ // current profile automatically.
+ String linkTooltip = PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tooltip;
+ String text;
+ String indentMode = RutaIdeUIPlugin.getDefault().getPreferenceStore()
+ .getString(CodeFormatterConstants.FORMATTER_TAB_CHAR);
+ if (CodeFormatterConstants.TAB.equals(indentMode))
+ text = Messages.format(
+ PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tab_text,
+ new String[] { Integer.toString(getTabDisplaySize()) });
+ else
+ text = Messages.format(
+ PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_others_text,
+ new String[] { Integer.toString(getTabDisplaySize()), getIndentMode() });
+
+ final Link link = new Link(composite, SWT.NONE);
+ link.setText(text);
+ link.setToolTipText(linkTooltip);
+ GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
+ gd.widthHint = 300; // don't get wider initially
+ link.setLayoutData(gd);
+ link.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PreferencesUtil.createPreferenceDialogOn(link.getShell(),
+ "org.apache.uima.ruta.ide.ui.EditorPreferences", null, null); //$NON-NLS-1$
+ }
+ });
+
+ final IPreferenceStore combinedStore = getPreferenceStore();
+ final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
+ private boolean fHasRun = false;
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if (fHasRun)
+ return;
+ if (composite.isDisposed())
+ return;
+ String property = event.getProperty();
+ if (CodeFormatterConstants.FORMATTER_TAB_CHAR.equals(property)
+ || CodeFormatterConstants.FORMATTER_TAB_SIZE.equals(property)) {
+ fHasRun = true;
+ link.dispose();
+ createMessage(composite);
+ Dialog.applyDialogFont(composite);
+ composite.redraw();
+ composite.layout();
+ }
+ }
+ };
+ combinedStore.addPropertyChangeListener(propertyChangeListener);
+ link.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
+ combinedStore.removePropertyChangeListener(propertyChangeListener);
+ }
+ });
+ }
+
+ private String getIndentMode() {
+ String indentMode = RutaIdeUIPlugin.getDefault().getPreferenceStore()
+ .getString(CodeFormatterConstants.FORMATTER_TAB_CHAR);
+
+ if (CodeFormatterConstants.SPACE.equals(indentMode))
+ return PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_spaces;
+
+ if (CodeFormatterConstants.TAB.equals(indentMode))
+ return PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tabs;
+
+ if (CodeFormatterConstants.MIXED.equals(indentMode))
+ return PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tabsAndSpaces;
+
+ Assert.isTrue(false, "Illegal indent mode - must not happen"); //$NON-NLS-1$
+ return null;
+ }
+
+ private int getTabDisplaySize() {
+ return RutaIdeUIPlugin.getDefault().getPreferenceStore()
+ .getInt(CodeFormatterConstants.FORMATTER_TAB_SIZE);
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaSmartTypingPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaSmartTypingPreferencePage.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaSmartTypingPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaSmartTypingPreferencePage.java Wed Jul 17 08:28:02 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.preferences;
+
+import org.apache.uima.ruta.ide.RutaIdeUIPlugin;
+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 RutaSmartTypingPreferencePage extends AbstractConfigurationBlockPreferencePage {
+
+ /*
+ * @see
+ * org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
+ */
+ @Override
+ protected void setDescription() {
+ String description = RutaPreferencesMessages.RutaSmartTypingConfigurationBlock_typing_tabTitle;
+ setDescription(description);
+ }
+
+ /*
+ * @seeorg.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#
+ * setPreferenceStore()
+ */
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(RutaIdeUIPlugin.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 RutaSmartTypingConfigurationBlock(overlayPreferenceStore);
+ }
+
+ @Override
+ protected String getHelpId() {
+ return "";
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaTodoTaskPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaTodoTaskPreferencePage.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaTodoTaskPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/preferences/RutaTodoTaskPreferencePage.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,120 @@
+/*
+ * 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.RutaIdeUIPlugin;
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.dltk.ui.PreferencesAdapter;
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage;
+import org.eclipse.dltk.ui.preferences.AbstractOptionsBlock;
+import org.eclipse.dltk.ui.preferences.AbstractTodoTaskOptionsBlock;
+import org.eclipse.dltk.ui.preferences.PreferenceKey;
+import org.eclipse.dltk.ui.util.IStatusChangeListener;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+
+public class RutaTodoTaskPreferencePage extends AbstractConfigurationBlockPropertyAndPreferencePage {
+
+ static final PreferenceKey CASE_SENSITIVE = AbstractTodoTaskOptionsBlock
+ .createCaseSensitiveKey(RutaIdeUIPlugin.PLUGIN_ID);
+
+ static final PreferenceKey ENABLED = AbstractTodoTaskOptionsBlock
+ .createEnabledKey(RutaIdeUIPlugin.PLUGIN_ID);
+
+ static final PreferenceKey TAGS = AbstractTodoTaskOptionsBlock
+ .createTagKey(RutaIdeUIPlugin.PLUGIN_ID);
+
+ protected PreferenceKey[] getPreferenceKeys() {
+ return new PreferenceKey[] { TAGS, ENABLED, CASE_SENSITIVE };
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPreferencePage #getHelpId()
+ */
+ @Override
+ protected String getHelpId() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPreferencePage #setDescription()
+ */
+ @Override
+ protected void setDescription() {
+ setDescription(RutaPreferencesMessages.TodoTaskDescription);
+ }
+
+ protected Preferences getPluginPreferences() {
+ return RutaIdeUIPlugin.getDefault().getPluginPreferences();
+ }
+
+ @Override
+ protected AbstractOptionsBlock createOptionsBlock(IStatusChangeListener newStatusChangedListener,
+ IProject project, IWorkbenchPreferenceContainer container) {
+ return new AbstractTodoTaskOptionsBlock(newStatusChangedListener, project, getPreferenceKeys(),
+ container) {
+ @Override
+ protected PreferenceKey getTags() {
+ return TAGS;
+ }
+
+ @Override
+ protected PreferenceKey getEnabledKey() {
+ return ENABLED;
+ }
+
+ @Override
+ protected PreferenceKey getCaseSensitiveKey() {
+ return CASE_SENSITIVE;
+ }
+ };
+ }
+
+ @Override
+ protected String getNatureId() {
+ return RutaNature.NATURE_ID;
+ }
+
+ @Override
+ protected String getProjectHelpId() {
+ return null;
+ }
+
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(new PreferencesAdapter(RutaIdeUIPlugin.getDefault().getPluginPreferences()));
+ }
+
+ @Override
+ protected String getPreferencePageId() {
+ return "org.apache.uima.ruta.ide.preferences.todo";
+ }
+
+ @Override
+ protected String getPropertyPageId() {
+ return "org.apache.uima.ruta.ide.propertyPage.todo";
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/search/RutaSearchPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/search/RutaSearchPage.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/search/RutaSearchPage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/search/RutaSearchPage.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,31 @@
+/*
+ * 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.search;
+
+import org.apache.uima.ruta.ide.core.RutaLanguageToolkit;
+import org.eclipse.dltk.core.IDLTKLanguageToolkit;
+import org.eclipse.dltk.ui.search.ScriptSearchPage;
+
+public class RutaSearchPage extends ScriptSearchPage {
+ @Override
+ protected IDLTKLanguageToolkit getLanguageToolkit() {
+ return RutaLanguageToolkit.getDefault();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaCodeTemplatesPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaCodeTemplatesPreferencePage.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaCodeTemplatesPreferencePage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaCodeTemplatesPreferencePage.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,75 @@
+/*
+ * 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.templates;
+
+import org.apache.uima.ruta.ide.RutaIdeUIPlugin;
+import org.apache.uima.ruta.ide.ui.RutaPartitions;
+import org.apache.uima.ruta.ide.ui.text.RutaTextTools;
+import org.apache.uima.ruta.ide.ui.text.SimpleRutaSourceViewerConfiguration;
+import org.eclipse.dltk.ui.templates.ScriptTemplateAccess;
+import org.eclipse.dltk.ui.templates.ScriptTemplatePreferencePage;
+import org.eclipse.dltk.ui.text.ScriptSourceViewerConfiguration;
+import org.eclipse.jface.text.IDocument;
+
+/**
+ * Ruta code templates preference page
+ */
+public class RutaCodeTemplatesPreferencePage extends ScriptTemplatePreferencePage {
+
+ /*
+ * @see
+ * org.eclipse.dltk.ui.templates.ScriptTemplatePreferencePage#createSourceViewerConfiguration()
+ */
+ @Override
+ protected ScriptSourceViewerConfiguration createSourceViewerConfiguration() {
+ return new SimpleRutaSourceViewerConfiguration(getTextTools().getColorManager(),
+ getPreferenceStore(), null, RutaPartitions.RUTA_PARTITIONING, false);
+ }
+
+ /*
+ * @see
+ * org.eclipse.dltk.ui.templates.ScriptTemplatePreferencePage#setDocumentParticioner(org.eclipse
+ * .jface.text.IDocument)
+ */
+ @Override
+ protected void setDocumentParticioner(IDocument document) {
+ getTextTools().setupDocumentPartitioner(document, RutaPartitions.RUTA_PARTITIONING);
+ }
+
+ /*
+ * @see org.eclipse.dltk.ui.templates.ScriptTemplatePreferencePage#setPreferenceStore()
+ */
+ @Override
+ protected void setPreferenceStore() {
+ setPreferenceStore(RutaIdeUIPlugin.getDefault().getPreferenceStore());
+ }
+
+ /*
+ * @see org.eclipse.dltk.ui.templates.ScriptTemplatePreferencePage#getTemplateAccess()
+ */
+ @Override
+ protected ScriptTemplateAccess getTemplateAccess() {
+ return RutaTemplateAccess.getInstance();
+ }
+
+ private RutaTextTools getTextTools() {
+ return RutaIdeUIPlugin.getDefault().getTextTools();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateAccess.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateAccess.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateAccess.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateAccess.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,66 @@
+/*
+ * 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.templates;
+
+import org.apache.uima.ruta.ide.RutaIdeUIPlugin;
+import org.eclipse.dltk.ui.templates.ScriptTemplateAccess;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Provides access to Ruta template store.
+ */
+public class RutaTemplateAccess extends ScriptTemplateAccess {
+ // Template
+ private static final String CUSTOM_TEMPLATES_KEY = "org.eclipse.ruta.Templates";
+
+ private static RutaTemplateAccess instance;
+
+ public static RutaTemplateAccess getInstance() {
+ if (instance == null) {
+ instance = new RutaTemplateAccess();
+ }
+
+ return instance;
+ }
+
+ /*
+ * @see org.eclipse.dltk.ui.templates.ScriptTemplateAccess#getContextTypeId()
+ */
+ @Override
+ protected String getContextTypeId() {
+ return RutaUniversalTemplateContextType.CONTEXT_TYPE_ID;
+ }
+
+ /*
+ * @see org.eclipse.dltk.ui.templates.ScriptTemplateAccess#getCustomTemplatesKey()
+ */
+ @Override
+ protected String getCustomTemplatesKey() {
+ return CUSTOM_TEMPLATES_KEY;
+ }
+
+ /*
+ * @see org.eclipse.dltk.ui.templates.ScriptTemplateAccess#getPreferenceStore()
+ */
+ @Override
+ protected IPreferenceStore getPreferenceStore() {
+ return RutaIdeUIPlugin.getDefault().getPreferenceStore();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateCompletionProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateCompletionProcessor.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateCompletionProcessor.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateCompletionProcessor.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,54 @@
+/*
+ * 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.templates;
+
+import org.eclipse.dltk.ui.templates.ScriptTemplateAccess;
+import org.eclipse.dltk.ui.templates.ScriptTemplateCompletionProcessor;
+import org.eclipse.dltk.ui.text.completion.ScriptContentAssistInvocationContext;
+
+public class RutaTemplateCompletionProcessor extends ScriptTemplateCompletionProcessor {
+
+ private static char[] IGNORE = new char[] { '.' };
+
+ public RutaTemplateCompletionProcessor(ScriptContentAssistInvocationContext context) {
+ super(context);
+ }
+
+ /*
+ * @see org.eclipse.dltk.ui.templates.ScriptTemplateCompletionProcessor#getContextTypeId()
+ */
+ @Override
+ protected String getContextTypeId() {
+ return RutaUniversalTemplateContextType.CONTEXT_TYPE_ID;
+ }
+
+ /*
+ * @see org.eclipse.dltk.ui.templates.ScriptTemplateCompletionProcessor#getTemplateAccess()
+ */
+ @Override
+ protected ScriptTemplateAccess getTemplateAccess() {
+ return RutaTemplateAccess.getInstance();
+ }
+
+ @Override
+ protected char[] getIgnore() {
+ return IGNORE;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateContext.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateContext.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateContext.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaTemplateContext.java Wed Jul 17 08:28:02 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.templates;
+
+import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.ui.templates.ScriptTemplateContext;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.templates.TemplateContextType;
+
+public class RutaTemplateContext extends ScriptTemplateContext {
+
+ public RutaTemplateContext(TemplateContextType type, IDocument document, int completionOffset,
+ int completionLength, ISourceModule sourceModule) {
+ super(type, document, completionOffset, completionLength, sourceModule);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaUniversalTemplateContextType.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaUniversalTemplateContextType.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaUniversalTemplateContextType.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/templates/RutaUniversalTemplateContextType.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.templates;
+
+import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.ui.templates.ScriptTemplateContext;
+import org.eclipse.dltk.ui.templates.ScriptTemplateContextType;
+import org.eclipse.jface.text.IDocument;
+
+public class RutaUniversalTemplateContextType extends ScriptTemplateContextType {
+ public static final String CONTEXT_TYPE_ID = "rutaUniversalTemplateContextType";
+
+ public RutaUniversalTemplateContextType() {
+ // empty constructor
+ }
+
+ public RutaUniversalTemplateContextType(String id) {
+ super(id);
+ }
+
+ public RutaUniversalTemplateContextType(String id, String name) {
+ super(id, name);
+ }
+
+ @Override
+ public ScriptTemplateContext createContext(IDocument document, int offset, int length,
+ ISourceModule sourceModule) {
+ return new RutaTemplateContext(this, document, offset, length, sourceModule);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/ExternalTypeHyperlink.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/ExternalTypeHyperlink.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/ExternalTypeHyperlink.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/ExternalTypeHyperlink.java Wed Jul 17 08:28:02 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.text;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.dltk.internal.ui.editor.DLTKEditorMessages;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class ExternalTypeHyperlink implements IHyperlink {
+ private final IRegion region;
+
+ private final IFile file;
+
+ private final String nodeText;
+
+ private final String tsString;
+
+ private final ITextEditor textEditor;
+
+ public ExternalTypeHyperlink(String nodeText, IRegion region, IFile file, String tsString,
+ ITextEditor textEditor) {
+ this.nodeText = nodeText;
+ this.region = region;
+ this.file = file;
+ this.tsString = tsString;
+ this.textEditor = textEditor;
+ }
+
+ public IRegion getHyperlinkRegion() {
+ return region;
+ }
+
+ public String getHyperlinkText() {
+ return nodeText + " in " + tsString;
+ }
+
+ public String getTypeLabel() {
+ return DLTKEditorMessages.ModelElementHyperlink_typeLabel;
+ }
+
+ public void open() {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ page.openEditor(new FileEditorInput(file), "taeconfigurator.editors.MultiPageEditor");
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/ExternalTypeHyperlinkDetector.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/ExternalTypeHyperlinkDetector.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/ExternalTypeHyperlinkDetector.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/ExternalTypeHyperlinkDetector.java Wed Jul 17 08:28:02 2013
@@ -0,0 +1,183 @@
+/*
+ * 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.text;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.resource.ResourceManager;
+import org.apache.uima.resource.metadata.TypeDescription;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.ruta.ide.core.builder.RutaProjectUtils;
+import org.apache.uima.ruta.ide.core.codeassist.RutaReferenceVisitor;
+import org.apache.uima.ruta.ide.core.codeassist.RutaSelectionParser;
+import org.apache.uima.ruta.ide.parser.ast.RutaModuleDeclaration;
+import org.apache.uima.ruta.ide.parser.ast.RutaTypeConstants;
+import org.apache.uima.ruta.ide.parser.ast.RutaVariableReference;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.Assert;
+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.IModelElement;
+import org.eclipse.dltk.internal.ui.editor.EditorUtility;
+import org.eclipse.dltk.internal.ui.editor.ScriptEditor;
+import org.eclipse.dltk.internal.ui.text.ScriptWordFinder;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class ExternalTypeHyperlinkDetector implements IHyperlinkDetector {
+ private ITextEditor fTextEditor;
+
+ public ExternalTypeHyperlinkDetector(ITextEditor editor) {
+ Assert.isNotNull(editor);
+ fTextEditor = editor;
+ }
+
+ public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region,
+ boolean canShowMultipleHyperlinks) {
+ if (region == null || !(fTextEditor instanceof ScriptEditor))
+ return null;
+
+ int offset = region.getOffset();
+
+ IModelElement input = EditorUtility.getEditorInputModelElement(fTextEditor, false);
+ if (input == null)
+ return null;
+
+ try {
+ IDocument document = fTextEditor.getDocumentProvider().getDocument(
+ fTextEditor.getEditorInput());
+ IRegion wordRegion = ScriptWordFinder.findWord(document, offset);
+ if (wordRegion == null)
+ return null;
+ if (input instanceof ISourceModule) {
+ ISourceModule sm = (ISourceModule) input;
+ IModelElement modelElement = sm.getModelElement();
+ RutaSelectionParser parser = new RutaSelectionParser();
+ ModuleDeclaration moduleDeclaration = parser.parse(sm);
+ String word = document.get(wordRegion.getOffset(), wordRegion.getLength());
+ RutaReferenceVisitor referenceVisitor = new RutaReferenceVisitor(wordRegion.getOffset());
+ moduleDeclaration.traverse(referenceVisitor);
+ ASTNode node = referenceVisitor.getResult();
+ if (node instanceof RutaVariableReference
+ && moduleDeclaration instanceof RutaModuleDeclaration) {
+ RutaVariableReference vr = (RutaVariableReference) node;
+ RutaModuleDeclaration parsed = (RutaModuleDeclaration) moduleDeclaration;
+ if (vr.getType() == RutaTypeConstants.RUTA_TYPE_AT) {
+ String nodeText = vr.getStringRepresentation();
+ Collection<String> importedTypeSystems = parsed.descriptorInfo.getImportedTypeSystems();
+ List<IHyperlink> result = new ArrayList<IHyperlink>();
+ for (String tsString : importedTypeSystems) {
+ IFolder folder = modelElement.getScriptProject().getProject()
+ .getFolder(RutaProjectUtils.getDefaultDescriptorLocation());
+ String xmlFilePath = tsString.replaceAll("\\.", "/");
+ xmlFilePath = xmlFilePath.substring(0, xmlFilePath.length()) + ".xml";
+ Set<String> types = getTypes(folder, xmlFilePath);
+ if (types.contains(nodeText)) {
+ IFile iFile = getFile(folder, xmlFilePath);
+ IHyperlink link = new ExternalTypeHyperlink(nodeText, wordRegion, iFile, tsString,
+ fTextEditor);
+ result.add(link);
+ }
+ }
+ if (!result.isEmpty()) {
+ return result.toArray(new IHyperlink[] {});
+ } else {
+ return null;
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ return null;
+ }
+ return null;
+ }
+
+ private Set<String> getTypes(IFolder folder, String filePath) throws InvalidXMLException,
+ IOException {
+ Set<String> types = new HashSet<String>();
+ IFile iFile = getFile(folder, filePath);
+ URL url;
+ try {
+ url = iFile.getLocationURI().toURL();
+ ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
+ resMgr.setDataPath(folder.getLocation().toPortableString());
+ types = getTypes(url, resMgr);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ return types;
+ }
+
+ private Set<String> getTypes(URL resource, ResourceManager resMgr) throws IOException,
+ InvalidXMLException {
+ Set<String> types = new HashSet<String>();
+ TypeSystemDescription typeSysDescr = null;
+ typeSysDescr = UIMAFramework.getXMLParser().parseTypeSystemDescription(
+ new XMLInputSource(resource));
+ typeSysDescr.resolveImports(resMgr);
+ for (TypeDescription each : typeSysDescr.getTypes()) {
+ String name = each.getName();
+ String[] nameSpace = name.split("[.]");
+ types.add(nameSpace[nameSpace.length - 1]);
+ StringBuffer fullName = new StringBuffer();
+ if (nameSpace.length > 0) {
+ fullName.append(nameSpace[0]);
+ }
+ for (int i = 1; i < nameSpace.length; i++) {
+ // TODO fix workaround
+ if (!nameSpace[i].equals("type")) {
+ fullName.append('.');
+ fullName.append(nameSpace[i]);
+ }
+ }
+ types.add(fullName.toString());
+ }
+ return types;
+ }
+
+ private IFile getFile(IFolder folder, String filePath) {
+ int lastDot = filePath.lastIndexOf('.');
+ int sndLastDot = filePath.lastIndexOf('.', lastDot - 1);
+ String fName = filePath;
+ if (sndLastDot >= 0) {
+ String subFolder = filePath.substring(0, sndLastDot);
+ folder = folder.getFolder(subFolder);
+ fName = filePath.substring(sndLastDot + 1);
+ }
+ return folder.getFile(fName);
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/Messages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/Messages.java?rev=1504047&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/Messages.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/Messages.java Wed Jul 17 08:28:02 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.text;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.apache.uima.ruta.ide.ui.text.messages"; //$NON-NLS-1$
+
+ public static String RutaRequirePackageMarkerResolution_addPackageToBuildpath;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}