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 [16/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/text/completion/RutaCompletionProposalLabelProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaCompletionProposalLabelProvider.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaCompletionProposalLabelProvider.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaCompletionProposalLabelProvider.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,55 @@
+/*
+ * 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.completion;
+
+import org.eclipse.dltk.core.CompletionProposal;
+import org.eclipse.dltk.ui.text.completion.CompletionProposalLabelProvider;
+
+public class RutaCompletionProposalLabelProvider extends CompletionProposalLabelProvider {
+  @Override
+  protected String createMethodProposalLabel(CompletionProposal methodProposal) {
+    StringBuffer nameBuffer = new StringBuffer();
+
+    // method name
+    nameBuffer.append(methodProposal.getName());
+
+    // parameters
+    nameBuffer.append('(');
+    appendParameterList(nameBuffer, methodProposal);
+    nameBuffer.append(')');
+
+    return nameBuffer.toString();
+  }
+
+  @Override
+  protected String createOverrideMethodProposalLabel(CompletionProposal methodProposal) {
+    StringBuffer nameBuffer = new StringBuffer();
+
+    // method name
+    nameBuffer.append(methodProposal.getName());
+
+    // parameters
+    nameBuffer.append('(');
+    appendParameterList(nameBuffer, methodProposal);
+    nameBuffer.append(")  "); //$NON-NLS-1$
+
+    return nameBuffer.toString();
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaContentAssistPreference.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaContentAssistPreference.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaContentAssistPreference.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaContentAssistPreference.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.text.completion;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.dltk.ui.text.ScriptTextTools;
+import org.eclipse.dltk.ui.text.completion.ContentAssistPreference;
+
+public class RutaContentAssistPreference extends ContentAssistPreference {
+  static RutaContentAssistPreference sDefault;
+
+  @Override
+  protected ScriptTextTools getTextTools() {
+    return RutaIdePlugin.getDefault().getTextTools();
+  }
+
+  public static ContentAssistPreference getDefault() {
+    if (sDefault == null) {
+      sDefault = new RutaContentAssistPreference();
+    }
+    return sDefault;
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaNoTypeCompletionProposalComputer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaNoTypeCompletionProposalComputer.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaNoTypeCompletionProposalComputer.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaNoTypeCompletionProposalComputer.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,63 @@
+/*
+ * 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.completion;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.ui.templates.RutaTemplateCompletionProcessor;
+import org.eclipse.dltk.core.CompletionProposal;
+import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalCollector;
+import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalComputer;
+import org.eclipse.dltk.ui.text.completion.ScriptContentAssistInvocationContext;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.templates.TemplateCompletionProcessor;
+
+public class RutaNoTypeCompletionProposalComputer extends ScriptCompletionProposalComputer {
+
+  @Override
+  protected ScriptCompletionProposalCollector createCollector(
+          ScriptContentAssistInvocationContext context) {
+    ScriptCompletionProposalCollector collector = new RutaCompletionProposalCollector(
+            context.getSourceModule());
+
+    collector.setIgnored(CompletionProposal.FIELD_REF, false);
+    collector.setIgnored(CompletionProposal.KEYWORD, false);
+    collector.setIgnored(CompletionProposal.PACKAGE_REF, false);
+    collector.setIgnored(CompletionProposal.LABEL_REF, false);
+    collector.setIgnored(CompletionProposal.LOCAL_VARIABLE_REF, false);
+    collector.setIgnored(CompletionProposal.METHOD_DECLARATION, false);
+    collector.setIgnored(CompletionProposal.METHOD_NAME_REFERENCE, false);
+    collector.setIgnored(CompletionProposal.METHOD_REF, false);
+    collector.setIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION, false);
+    collector.setIgnored(CompletionProposal.VARIABLE_DECLARATION, false);
+
+    // collector.setIgnored(CompletionProposal.TYPE_REF, true);
+    collector.setIgnored(CompletionProposal.TYPE_REF, false);
+    IPreferenceStore preferenceStore = RutaIdePlugin.getDefault().getPreferenceStore();
+
+    return collector;
+  }
+
+  @Override
+  protected TemplateCompletionProcessor createTemplateProposalComputer(
+          ScriptContentAssistInvocationContext context) {
+    return new RutaTemplateCompletionProcessor(context);
+  }
+
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaOverrideCompletionProposal.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaOverrideCompletionProposal.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaOverrideCompletionProposal.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaOverrideCompletionProposal.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,87 @@
+/*
+ * 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.completion;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.dltk.core.IScriptProject;
+import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.ui.PreferenceConstants;
+import org.eclipse.dltk.ui.text.completion.ScriptTypeCompletionProposal;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ContextInformation;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+
+public class RutaOverrideCompletionProposal extends ScriptTypeCompletionProposal implements
+        ICompletionProposalExtension4 {
+
+  private String methodName;
+
+  public RutaOverrideCompletionProposal(IScriptProject project, ISourceModule cu,
+          String methodName, String[] paramTypes, int start, int length, String displayName,
+          String completionProposal) {
+    super(completionProposal, cu, start, length, null, displayName, 0);
+    Assert.isNotNull(project);
+    Assert.isNotNull(methodName);
+    Assert.isNotNull(paramTypes);
+    Assert.isNotNull(cu);
+
+    this.methodName = methodName;
+
+    setReplacementString(completionProposal);
+  }
+
+  @Override
+  public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) {
+    return methodName;
+  }
+
+  @Override
+  protected boolean updateReplacementString(IDocument document, char trigger, int offset)
+          throws CoreException, BadLocationException {
+    final IDocument buffer = new Document(document.get());
+    int index = offset - 1;
+    while (index >= 0 && Character.isJavaIdentifierPart(buffer.getChar(index)))
+      index--;
+    final int length = offset - index - 1;
+    buffer.replace(index + 1, length, " "); //$NON-NLS-1$
+    return true;
+  }
+
+  public boolean isAutoInsertable() {
+    return false;
+  }
+
+  @Override
+  public IContextInformation getContextInformation() {
+    return new ContextInformation(getDisplayString(), getDisplayString());
+  }
+
+  @Override
+  protected boolean insertCompletion() {
+    IPreferenceStore preference = RutaIdePlugin.getDefault().getPreferenceStore();
+    return preference.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION);
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaScriptCompletionProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaScriptCompletionProcessor.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaScriptCompletionProcessor.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaScriptCompletionProcessor.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.text.completion;
+
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.eclipse.dltk.ui.text.completion.ScriptCompletionProcessor;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationPresenter;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.ui.IEditorPart;
+
+public class RutaScriptCompletionProcessor extends ScriptCompletionProcessor {
+  public RutaScriptCompletionProcessor(IEditorPart editor, ContentAssistant assistant,
+          String partition) {
+    super(editor, assistant, partition);
+  }
+
+   @Override
+  protected String getNatureId() {
+    return RutaNature.NATURE_ID;
+  }
+
+  protected static class Validator implements IContextInformationValidator,
+          IContextInformationPresenter {
+
+    private int initialOffset;
+
+    public boolean isContextInformationValid(int offset) {
+      return Math.abs(offset - initialOffset) < 5;
+    }
+
+    public void install(IContextInformation info, ITextViewer viewer, int offset) {
+      initialOffset = offset;
+    }
+
+    public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
+      return false;
+    }
+  }
+
+ 
+  private IContextInformationValidator validator;
+
+  @Override
+  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/text/completion/RutaScriptCompletionProposal.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaScriptCompletionProposal.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaScriptCompletionProposal.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaScriptCompletionProposal.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,59 @@
+/*
+ * 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.completion;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.dltk.ui.PreferenceConstants;
+import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposal;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.graphics.Image;
+
+public class RutaScriptCompletionProposal extends ScriptCompletionProposal {
+
+  public RutaScriptCompletionProposal(String replacementString, int replacementOffset,
+          int replacementLength, Image image, String displayString, int relevance) {
+    super(replacementString, replacementOffset, replacementLength, image, displayString, relevance);
+  }
+
+  public RutaScriptCompletionProposal(String replacementString, int replacementOffset,
+          int replacementLength, Image image, String displayString, int relevance, boolean isInDoc) {
+    super(replacementString, replacementOffset, replacementLength, image, displayString, relevance,
+            isInDoc);
+  }
+
+  @Override
+  protected boolean isSmartTrigger(char trigger) {
+    if (trigger == '.') {
+      return true;
+    }
+    return false;
+  }
+
+  @Override
+  protected boolean isCamelCaseMatching() {
+    return true;
+  }
+
+  @Override
+  protected boolean insertCompletion() {
+    IPreferenceStore preference = RutaIdePlugin.getDefault().getPreferenceStore();
+    return preference.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION);
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaTypeCompletionProposalComputer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaTypeCompletionProposalComputer.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaTypeCompletionProposalComputer.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/completion/RutaTypeCompletionProposalComputer.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,61 @@
+/*
+ * 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.completion;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.ui.templates.RutaTemplateCompletionProcessor;
+import org.eclipse.dltk.core.CompletionProposal;
+import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalCollector;
+import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalComputer;
+import org.eclipse.dltk.ui.text.completion.ScriptContentAssistInvocationContext;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.templates.TemplateCompletionProcessor;
+
+public class RutaTypeCompletionProposalComputer extends ScriptCompletionProposalComputer {
+
+  @Override
+  protected ScriptCompletionProposalCollector createCollector(
+          ScriptContentAssistInvocationContext context) {
+    ScriptCompletionProposalCollector collector = new RutaCompletionProposalCollector(
+            context.getSourceModule());
+
+    collector.setIgnored(CompletionProposal.FIELD_REF, true);
+    collector.setIgnored(CompletionProposal.KEYWORD, true);
+    collector.setIgnored(CompletionProposal.LABEL_REF, true);
+    collector.setIgnored(CompletionProposal.LOCAL_VARIABLE_REF, true);
+    collector.setIgnored(CompletionProposal.METHOD_DECLARATION, true);
+    collector.setIgnored(CompletionProposal.METHOD_NAME_REFERENCE, true);
+    collector.setIgnored(CompletionProposal.METHOD_REF, true);
+    collector.setIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION, true);
+    collector.setIgnored(CompletionProposal.VARIABLE_DECLARATION, true);
+
+    collector.setIgnored(CompletionProposal.TYPE_REF, false);
+
+    IPreferenceStore preferenceStore = RutaIdePlugin.getDefault().getPreferenceStore();
+
+    return collector;
+  }
+
+  @Override
+  protected TemplateCompletionProcessor createTemplateProposalComputer(
+          ScriptContentAssistInvocationContext context) {
+    return new RutaTemplateCompletionProcessor(context);
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingMessages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingMessages.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingMessages.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingMessages.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.text.folding;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class RutaFoldingMessages extends NLS {
+
+  private static final String BUNDLE_NAME = "org.apache.uima.ruta.ide.ui.text.folding.RutaFoldingMessages";//$NON-NLS-1$
+
+  private RutaFoldingMessages() {
+  }
+
+  public static String DefaultFoldingPreferenceBlock_headers;
+
+  public static String DefaultFoldingPreferenceBlock_innerTypes;
+
+  public static String DefaultFoldingPreferenceBlock_methods;
+
+  public static String RutaFoldingPreferenceBlock_0;
+
+  public static String RutaFoldingPreferenceBlock_10;
+
+  public static String RutaFoldingPreferenceBlock_11;
+
+  public static String RutaFoldingPreferenceBlock_12;
+
+  public static String RutaFoldingPreferenceBlock_13;
+
+  public static String RutaFoldingPreferenceBlock_14;
+
+  public static String RutaFoldingPreferenceBlock_15;
+
+  public static String RutaFoldingPreferenceBlock_16;
+
+  public static String RutaFoldingPreferenceBlock_2;
+
+  public static String RutaFoldingPreferenceBlock_3;
+
+  public static String RutaFoldingPreferenceBlock_4;
+
+  public static String RutaFoldingPreferenceBlock_6;
+
+  static {
+    NLS.initializeMessages(BUNDLE_NAME, RutaFoldingMessages.class);
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingPreferenceBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingPreferenceBlock.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingPreferenceBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingPreferenceBlock.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,318 @@
+/*
+ * 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.folding;
+
+import java.util.ArrayList;
+
+import org.apache.uima.ruta.ide.ui.RutaPreferenceConstants;
+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.OverlayPreferenceStore.OverlayKey;
+import org.eclipse.dltk.ui.preferences.PreferencesMessages;
+import org.eclipse.dltk.ui.text.folding.IFoldingPreferenceBlock;
+import org.eclipse.dltk.ui.util.PixelConverter;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+public class RutaFoldingPreferenceBlock extends AbstractConfigurationBlock implements
+        IFoldingPreferenceBlock {
+
+  protected class ListBlock {
+    private ListViewer fList;
+
+    private String fKey;
+
+    private Button fAddButton;
+
+    private Button fRemoveButton;
+
+    public ListBlock(Composite parent, String key) {
+      fKey = key;
+      createControl(parent);
+    }
+
+    private Control createControl(Composite parent) {
+      Font font = parent.getFont();
+      Composite comp = new Composite(parent, SWT.NONE);
+      GridLayout topLayout = new GridLayout();
+      topLayout.numColumns = 2;
+      topLayout.marginHeight = 0;
+      topLayout.marginWidth = 0;
+      comp.setLayout(topLayout);
+      GridData gd = new GridData(GridData.FILL_BOTH);
+      comp.setLayoutData(gd);
+      fList = new ListViewer(comp);
+      gd = new GridData(GridData.FILL_BOTH);
+      gd.heightHint = 6;
+      fList.getControl().setLayoutData(gd);
+      Composite pathButtonComp = new Composite(comp, SWT.NONE);
+      GridLayout pathButtonLayout = new GridLayout();
+      pathButtonLayout.marginHeight = 0;
+      pathButtonLayout.marginWidth = 0;
+      pathButtonComp.setLayout(pathButtonLayout);
+      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
+      pathButtonComp.setLayoutData(gd);
+      pathButtonComp.setFont(font);
+      fAddButton = createPushButton(pathButtonComp,
+              RutaFoldingMessages.RutaFoldingPreferenceBlock_0);
+      fAddButton.addSelectionListener(new SelectionListener() {
+        public void widgetDefaultSelected(SelectionEvent e) {
+        }
+
+        public void widgetSelected(SelectionEvent e) {
+          IInputValidator validator = new IInputValidator() {
+            public String isValid(String newText) {
+              if (newText.trim().length() > 0 && newText.matches("[_a-zA-Z]*")) //$NON-NLS-1$
+                return null;
+              return RutaFoldingMessages.RutaFoldingPreferenceBlock_2;
+            }
+          };
+          InputDialog dlg = new InputDialog(null,
+                  RutaFoldingMessages.RutaFoldingPreferenceBlock_3,
+                  RutaFoldingMessages.RutaFoldingPreferenceBlock_4, "", validator);
+          if (dlg.open() == Window.OK) {
+            fList.add(dlg.getValue());
+            save();
+          }
+        }
+      });
+      fRemoveButton = createPushButton(pathButtonComp,
+              RutaFoldingMessages.RutaFoldingPreferenceBlock_6);
+      fRemoveButton.addSelectionListener(new SelectionListener() {
+        public void widgetDefaultSelected(SelectionEvent e) {
+        }
+
+        public void widgetSelected(SelectionEvent e) {
+          ISelection s = fList.getSelection();
+          if (s instanceof IStructuredSelection) {
+            IStructuredSelection sel = (IStructuredSelection) s;
+            fList.remove(sel.toArray());
+            save();
+          }
+        }
+      });
+      return comp;
+    }
+
+    protected Button createPushButton(Composite parent, String label) {
+      Button button = new Button(parent, SWT.PUSH);
+      button.setFont(parent.getFont());
+      if (label != null) {
+        button.setText(label);
+      }
+      GridData gd = new GridData();
+      button.setLayoutData(gd);
+      gd.widthHint = getButtonWidthHint(button);
+      gd.horizontalAlignment = GridData.FILL;
+      return button;
+    }
+
+    /**
+     * Returns a width hint for a button control.
+     */
+    public int getButtonWidthHint(Button button) {
+      button.setFont(JFaceResources.getDialogFont());
+      PixelConverter converter = new PixelConverter(button);
+      int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+      return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+    }
+
+    private String[] getEntries() {
+      return fList.getList().getItems();
+    }
+
+    private void setEntries(String items[]) {
+      fList.remove(fList.getList().getItems());
+      for (int i = 0; i < items.length; i++) {
+        if (items[i].trim().length() > 0)
+          fList.add(items[i]);
+      }
+    }
+
+    public void save() {
+      String items[] = getEntries();
+      StringBuffer buf = new StringBuffer();
+      for (int i = 0; i < items.length; i++) {
+        buf.append(items[i]);
+        if (i != items.length - 1)
+          buf.append(","); //$NON-NLS-1$
+      }
+      getPreferenceStore().setValue(fKey, buf.toString());
+    }
+
+    public void initialize() {
+      String val = getPreferenceStore().getString(fKey);
+      if (val != null) {
+        String items[] = val.split(","); //$NON-NLS-1$
+        setEntries(items);
+      }
+
+    }
+
+    public void performDefault() {
+      String val = getPreferenceStore().getDefaultString(fKey);
+      if (val != null) {
+        String items[] = val.split(","); //$NON-NLS-1$
+        setEntries(items);
+      }
+    }
+  }
+
+  private ListBlock fExcludePatterns;
+
+  private ListBlock fIncludePatterns;
+
+  private OverlayPreferenceStore fOverlayStore;
+
+  private OverlayKey[] fKeys;
+
+  public RutaFoldingPreferenceBlock(OverlayPreferenceStore store,
+          PreferencePage mainPreferencePage) {
+    super(store, mainPreferencePage);
+    fOverlayStore = store;
+    fKeys = createKeys();
+    fOverlayStore.addKeys(fKeys);
+  }
+
+  private OverlayKey[] createKeys() {
+    ArrayList overlayKeys = new ArrayList();
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
+            RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
+            PreferenceConstants.EDITOR_FOLDING_LINES_LIMIT));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+            RutaPreferenceConstants.EDITOR_FOLDING_INCLUDE_LIST));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+            RutaPreferenceConstants.EDITOR_FOLDING_EXCLUDE_LIST));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+            RutaPreferenceConstants.EDITOR_FOLDING_INIT_BLOCKS));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+            RutaPreferenceConstants.EDITOR_FOLDING_INIT_COMMENTS));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+            RutaPreferenceConstants.EDITOR_FOLDING_INIT_NAMESPACES));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+            PreferenceConstants.EDITOR_COMMENTS_FOLDING_ENABLED));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+            RutaPreferenceConstants.EDITOR_FOLDING_COMMENTS_WITH_NEWLINES));
+    OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys
+            .size()];
+    overlayKeys.toArray(keys);
+    return keys;
+  }
+
+  public Control createControl(Composite composite) {
+    Composite inner = new Composite(composite, SWT.NONE);
+    GridLayout layout = new GridLayout();
+    layout.numColumns = 1;
+    inner.setLayout(layout);
+
+    Composite blockFolding = createSubsection(inner, null,
+            RutaFoldingMessages.RutaFoldingPreferenceBlock_10);
+    blockFolding.setLayout(new GridLayout());
+
+    addRadioButton(blockFolding, RutaFoldingMessages.RutaFoldingPreferenceBlock_11,
+            RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS,
+            RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS_OFF);
+    addRadioButton(blockFolding, RutaFoldingMessages.RutaFoldingPreferenceBlock_12,
+            RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS,
+            RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS_EXCLUDE);
+    fExcludePatterns = new ListBlock(blockFolding,
+            RutaPreferenceConstants.EDITOR_FOLDING_EXCLUDE_LIST);
+    addRadioButton(blockFolding, RutaFoldingMessages.RutaFoldingPreferenceBlock_13,
+            RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS,
+            RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS_INCLUDE);
+    fIncludePatterns = new ListBlock(blockFolding,
+            RutaPreferenceConstants.EDITOR_FOLDING_INCLUDE_LIST);
+
+    IInputValidator val = new IInputValidator() {
+
+      public String isValid(String number) {
+        if (number.length() == 0) {
+          return PreferencesMessages.DLTKEditorPreferencePage_empty_input;
+        } else {
+          try {
+            int value = Integer.parseInt(number);
+            if (value < 2)
+              return "You may input numbers >= 2.";
+          } catch (NumberFormatException e) {
+            return "Input is not a number";
+          }
+        }
+        return null;
+      }
+
+    };
+
+    addLabelledTextField(blockFolding, "Minimal amount of lines to be folded(>=2):",
+            PreferenceConstants.EDITOR_FOLDING_LINES_LIMIT, 3, 1, true, val);
+
+    Composite commentFolding = createSubsection(inner, null,
+            RutaFoldingMessages.RutaFoldingPreferenceBlock_14);
+    commentFolding.setLayout(new GridLayout());
+
+    addCheckBox(commentFolding, RutaFoldingMessages.RutaFoldingPreferenceBlock_15,
+            PreferenceConstants.EDITOR_COMMENTS_FOLDING_ENABLED, 0);
+
+    Composite initialFolding = createSubsection(inner, null,
+            RutaFoldingMessages.RutaFoldingPreferenceBlock_16);
+    initialFolding.setLayout(new GridLayout());
+
+    addCheckBox(initialFolding, RutaFoldingMessages.DefaultFoldingPreferenceBlock_headers,
+            RutaPreferenceConstants.EDITOR_FOLDING_INIT_COMMENTS, 0);
+    addCheckBox(initialFolding, RutaFoldingMessages.DefaultFoldingPreferenceBlock_innerTypes,
+            RutaPreferenceConstants.EDITOR_FOLDING_INIT_NAMESPACES, 0);
+    addCheckBox(initialFolding, RutaFoldingMessages.DefaultFoldingPreferenceBlock_methods,
+            RutaPreferenceConstants.EDITOR_FOLDING_INIT_BLOCKS, 0);
+
+    return inner;
+  }
+
+  @Override
+  public void initialize() {
+    super.initialize();
+    fExcludePatterns.initialize();
+    fIncludePatterns.initialize();
+  }
+
+  @Override
+  public void performDefaults() {
+    super.performDefaults();
+    fExcludePatterns.performDefault();
+    fIncludePatterns.performDefault();
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingStructureProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingStructureProvider.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingStructureProvider.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/text/folding/RutaFoldingStructureProvider.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,301 @@
+/*
+ * 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.folding;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.apache.uima.ruta.ide.parser.ast.RutaStatement;
+import org.apache.uima.ruta.ide.ui.RutaPartitions;
+import org.apache.uima.ruta.ide.ui.RutaPreferenceConstants;
+import org.apache.uima.ruta.ide.ui.text.RutaPartitionScanner;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.declarations.MethodDeclaration;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.ast.declarations.TypeDeclaration;
+import org.eclipse.dltk.ast.parser.ISourceParser;
+import org.eclipse.dltk.ast.references.SimpleReference;
+import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.compiler.env.ModuleSource;
+import org.eclipse.dltk.core.DLTKLanguageManager;
+import org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.rules.IPartitionTokenScanner;
+
+public class RutaFoldingStructureProvider extends AbstractASTFoldingStructureProvider {
+
+  // ~ Instance fields
+
+  private List fBlockExcludeList = new ArrayList();
+
+  /* preferences */
+  private int fBlockFolding = 0;
+
+  private List fBlockIncludeList = new ArrayList();
+
+  private boolean fInitCollapseBlocks = true;
+
+  private boolean fInitCollapseComments = true;
+
+  private boolean fInitCollapseNamespaces = true;
+
+  // ~ Methods
+
+  @Override
+  protected CodeBlock[] getCodeBlocks(String code, int offset) {
+    /*
+     * if an ASTVisitor implementation is created for this, just override getFoldingVisitor() and
+     * remove this method
+     */
+    ISourceParser pp = null;
+    pp = DLTKLanguageManager.getSourceParser(RutaNature.NATURE_ID);
+    ModuleDeclaration md = (ModuleDeclaration) pp.parse(new ModuleSource(code), null);
+    List statements = md.getStatements();
+    if (statements == null) {
+      return new CodeBlock[0];
+    }
+
+    List result = new ArrayList();
+    traverse(result, statements, offset, code);
+
+    return (CodeBlock[]) result.toArray(new CodeBlock[result.size()]);
+  }
+
+  private void checkStatement(String code, int offset, List result, Statement sst) {
+    if (sst instanceof RutaStatement) {
+      RutaStatement statement = (RutaStatement) sst;
+      result.add(new CodeBlock(statement, new Region(offset + statement.sourceStart(), statement
+              .sourceEnd() - statement.sourceStart())));
+
+      Iterator si = statement.getExpressions().iterator();
+      // while (si.hasNext()) {
+      // Expression ex = (Expression) si.next();
+      // if (ex instanceof BlockDeclaration) {
+      // BlockDeclaration be = (BlockDeclaration) ex;
+      // try {
+      // String newContents = code.substring(
+      // be.sourceStart() + 1, be.sourceEnd() - 1);
+      // CodeBlock[] cb = getCodeBlocks(newContents, offset
+      // + be.sourceStart() + 1);
+      // for (int j = 0; j < cb.length; j++) {
+      // result.add(cb[j]);
+      // }
+      // } catch (StringIndexOutOfBoundsException e) {
+      // }
+      // }
+      // }
+    }
+  }
+
+  private void traverse(List result, List statements, int offset, String code) {
+    for (Iterator iterator = statements.iterator(); iterator.hasNext();) {
+      ASTNode node = (ASTNode) iterator.next();
+      if (node instanceof RutaStatement) {
+        checkStatement(code, offset, result, (Statement) node);
+      } else if (node instanceof TypeDeclaration) {
+        TypeDeclaration statement = (TypeDeclaration) node;
+        result.add(new CodeBlock(statement, new Region(offset + statement.sourceStart(), statement
+                .sourceEnd() - statement.sourceStart())));
+        traverse(result, statement.getStatements(), offset, code);
+      } else if (node instanceof MethodDeclaration) {
+        MethodDeclaration statement = (MethodDeclaration) node;
+        result.add(new CodeBlock(statement, new Region(offset + statement.sourceStart(), statement
+                .sourceEnd() - statement.sourceStart())));
+        traverse(result, statement.getStatements(), offset, code);
+      }
+    }
+  }
+
+  /*
+   * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getCommentPartition()
+   */
+  @Override
+  protected String getCommentPartition() {
+    return RutaPartitions.TM_COMMENT;
+  }
+
+  /*
+   * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getLog()
+   */
+  @Override
+  protected ILog getLog() {
+    return RutaIdePlugin.getDefault().getLog();
+  }
+
+  /*
+   * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getPartition()
+   */
+  @Override
+  protected String getPartition() {
+    return RutaPartitions.TM_PARTITIONING;
+  }
+
+  /*
+   * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getPartitionScanner()
+   */
+  @Override
+  protected IPartitionTokenScanner getPartitionScanner() {
+    return new RutaPartitionScanner();
+  }
+
+  /*
+   * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getPartitionTypes()
+   */
+  @Override
+  protected String[] getPartitionTypes() {
+    return RutaPartitions.TM_PARTITION_TYPES;
+  }
+
+  /*
+   * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getNatureId()
+   */
+  @Override
+  protected String getNatureId() {
+    return RutaNature.NATURE_ID;
+  }
+
+  /*
+   * @see
+   * org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#initializePreferences(
+   * org.eclipse.jface.preference.IPreferenceStore)
+   */
+  @Override
+  protected void initializePreferences(IPreferenceStore store) {
+    super.initializePreferences(store);
+    fBlockFolding = store.getInt(RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS);
+
+    String t = store.getString(RutaPreferenceConstants.EDITOR_FOLDING_EXCLUDE_LIST);
+    String[] items = t.split(",");
+    fBlockExcludeList.clear();
+    for (int i = 0; i < items.length; i++) {
+      if (items[i].trim().length() > 0) {
+        fBlockExcludeList.add(items[i]);
+      }
+    }
+
+    t = store.getString(RutaPreferenceConstants.EDITOR_FOLDING_INCLUDE_LIST);
+    items = t.split(",");
+    fBlockIncludeList.clear();
+    for (int i = 0; i < items.length; i++) {
+      if (items[i].trim().length() > 0) {
+        fBlockIncludeList.add(items[i]);
+      }
+    }
+
+    fFoldNewLines = store
+            .getBoolean(RutaPreferenceConstants.EDITOR_FOLDING_COMMENTS_WITH_NEWLINES);
+    fInitCollapseBlocks = store
+            .getBoolean(RutaPreferenceConstants.EDITOR_FOLDING_INIT_BLOCKS);
+    fInitCollapseComments = store
+            .getBoolean(RutaPreferenceConstants.EDITOR_FOLDING_INIT_COMMENTS);
+    fInitCollapseNamespaces = store
+            .getBoolean(RutaPreferenceConstants.EDITOR_FOLDING_INIT_NAMESPACES);
+  }
+
+  @Override
+  protected boolean initiallyCollapse(ASTNode s, FoldingStructureComputationContext ctx) {
+    if (s instanceof RutaStatement) {
+      RutaStatement statement = (RutaStatement) s;
+      if (!(statement.getAt(0) instanceof SimpleReference)) {
+        return false;
+      }
+
+      String name = null;
+      name = ((SimpleReference) statement.getAt(0)).getName();
+      if (name.equals("namespace")) {
+        return ctx.allowCollapsing() && fInitCollapseNamespaces;
+      }
+
+      return ctx.allowCollapsing() && fInitCollapseBlocks;
+    }
+
+    return false;
+  }
+
+  /*
+   * @see
+   * org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#initiallyCollapseComments
+   * (org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider.
+   * FoldingStructureComputationContext)
+   */
+  protected boolean initiallyCollapseComments(FoldingStructureComputationContext ctx) {
+    return ctx.allowCollapsing() && fInitCollapseComments;
+  }
+
+  /*
+   * @see
+   * org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#mayCollapse(org.eclipse
+   * .dltk.ast.statements.Statement,
+   * org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider
+   * .FoldingStructureComputationContext)
+   */
+  protected boolean canFold(String name) {
+    switch (fBlockFolding) {
+      case RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS_OFF: {
+        if (name.equals("proc") || name.equals("namespace")) {
+          return true;
+        }
+
+        return false;
+      }
+      case RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS_INCLUDE: {
+        if (fBlockIncludeList.contains(name)) {
+          return true;
+        }
+
+        return false;
+      }
+      case RutaPreferenceConstants.EDITOR_FOLDING_BLOCKS_EXCLUDE: {
+        if (fBlockExcludeList.contains(name)) {
+          return false;
+        }
+
+        return true;
+      }
+    }
+    return false;
+  }
+
+  @Override
+  protected boolean mayCollapse(ASTNode s, FoldingStructureComputationContext ctx) {
+    if (s instanceof TypeDeclaration) {
+      return canFold("namespace");
+    } else if (s instanceof MethodDeclaration) {
+      return canFold("proc");
+    } else if (s instanceof RutaStatement) {
+      RutaStatement statement = (RutaStatement) s;
+      if (!(statement.getAt(0) instanceof SimpleReference)) {
+        return false;
+      }
+
+      String name = null;
+      name = ((SimpleReference) statement.getAt(0)).getName();
+      return canFold(name);
+    }
+
+    return false;
+  }
+
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaFileCreationPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaFileCreationPage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaFileCreationPage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaFileCreationPage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,62 @@
+/*
+ * 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.wizards;
+
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.dltk.core.IScriptFolder;
+import org.eclipse.dltk.ui.wizards.NewSourceModulePage;
+
+
+public class RutaFileCreationPage extends NewSourceModulePage {
+
+  @Override
+  protected String getPageDescription() {
+    return "This wizard creates a new Ruta script file.";
+  }
+
+  @Override
+  protected String getFileContent() {
+    StringBuilder sb = new StringBuilder();
+    sb.append("PACKAGE ");
+    IScriptFolder scriptFolder = getScriptFolder();
+    IPath path =  scriptFolder.getPath().removeFirstSegments(1);
+    String pathString = "";
+    for (int i = 1; i < path.segments().length; i++) {
+      pathString += path.segments()[i];
+      if (i < path.segments().length - 1) {
+        pathString += ".";
+      }
+    }
+    sb.append(pathString);
+    sb.append(";\n");
+    return sb.toString();
+  }
+
+  @Override
+  protected String getRequiredNature() {
+    return RutaNature.NATURE_ID;
+  }
+
+  @Override
+  protected String getPageTitle() {
+    return "Create a new Ruta script file";
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaFileCreationWizard.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaFileCreationWizard.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaFileCreationWizard.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaFileCreationWizard.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.wizards;
+
+import org.apache.uima.ruta.ide.ui.RutaImages;
+import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.dltk.ui.wizards.NewSourceModulePage;
+import org.eclipse.dltk.ui.wizards.NewSourceModuleWizard;
+
+public class RutaFileCreationWizard extends NewSourceModuleWizard {
+  public static final String ID_WIZARD = "org.apache.uima.ruta.ide.ui.wizards.RutaFileCreationWizard";
+
+  public RutaFileCreationWizard() {
+    setDefaultPageImageDescriptor(RutaImages.DESC_WIZBAN_FILE_CREATION);
+    setDialogSettings(DLTKUIPlugin.getDefault().getDialogSettings());
+    setWindowTitle("Create Ruta File");
+  }
+
+  @Override
+  protected NewSourceModulePage createNewSourceModulePage() {
+    return new RutaFileCreationPage();
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaJavaContainerPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaJavaContainerPage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaJavaContainerPage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaJavaContainerPage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,55 @@
+/*
+ * 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.wizards;
+import org.eclipse.dltk.core.IBuildpathEntry;
+import org.eclipse.dltk.core.IScriptProject;
+import org.eclipse.dltk.internal.ui.wizards.IBuildpathContainerPage;
+import org.eclipse.dltk.ui.wizards.IBuildpathContainerPageExtension;
+import org.eclipse.dltk.ui.wizards.NewElementWizardPage;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class RutaJavaContainerPage extends NewElementWizardPage implements IBuildpathContainerPage, IBuildpathContainerPageExtension{
+
+  public RutaJavaContainerPage() {
+    super("RutaJavaContainerPage");
+  }
+
+  public void createControl(Composite composite) {
+    
+  }
+
+  public void initialize(IScriptProject project, IBuildpathEntry[] currentEntries) {
+    
+  }
+
+  public boolean finish() {
+    return false;
+  }
+
+  public IBuildpathEntry getSelection() {
+    return null;
+  }
+
+  public void setSelection(IBuildpathEntry containerEntry) {
+  }
+
+ 
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaPackageCreationWizard.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaPackageCreationWizard.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaPackageCreationWizard.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaPackageCreationWizard.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.wizards;
+
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.dltk.core.IProjectFragment;
+import org.eclipse.dltk.ui.wizards.NewPackageCreationWizard;
+import org.eclipse.dltk.ui.wizards.NewPackageWizardPage;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+public class RutaPackageCreationWizard extends NewPackageCreationWizard {
+  public static final String ID_WIZARD = "org.apache.uima.ruta.ide.ui.wizards.NewPackageCreationWizard";
+
+  @Override
+  protected NewPackageWizardPage createNewPackageWizardPage() {
+    return new NewPackageWizardPage() {
+      @Override
+      public void createPackage(IProgressMonitor monitor) throws CoreException,
+              InterruptedException {
+        if (monitor == null) {
+          monitor = new NullProgressMonitor();
+        }
+        IProjectFragment root = getProjectFragment();
+        String packName = getPackageText();
+        packName = packName.replaceAll("[.]", "/");
+        fCreatedScriptFolder = root.createScriptFolder(packName, true, monitor);
+        if (monitor.isCanceled()) {
+          throw new InterruptedException();
+        }
+      }
+
+      @Override
+      protected String getRequiredNature() {
+        return RutaNature.NATURE_ID;
+      }
+
+      @Override
+      public void init(IStructuredSelection selection) {
+        super.init(selection);
+        setPackageText("", true);
+      }
+    };
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectCreationWizard.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectCreationWizard.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectCreationWizard.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectCreationWizard.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,222 @@
+/*
+ * 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.wizards;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.ruta.engine.RutaEngine;
+import org.apache.uima.ruta.ide.core.RutaNature;
+import org.apache.uima.ruta.ide.core.builder.RutaProjectUtils;
+import org.apache.uima.ruta.ide.ui.RutaImages;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.IBuildpathEntry;
+import org.eclipse.dltk.internal.ui.util.CoreUtility;
+import org.eclipse.dltk.internal.ui.wizards.buildpath.BPListElement;
+import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.dltk.ui.wizards.BuildpathsBlock;
+import org.eclipse.dltk.ui.wizards.ProjectWizard;
+import org.eclipse.dltk.ui.wizards.ProjectWizardFirstPage;
+import org.eclipse.dltk.ui.wizards.ProjectWizardSecondPage;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
+
+public class RutaProjectCreationWizard extends ProjectWizard {
+
+  public static final String ID_WIZARD = "org.apache.uima.ruta.ide.ui.wizards.RutaProjectWizard"; //$NON-NLS-1$
+
+  private ProjectWizardFirstPage fFirstPage;
+
+  private ProjectWizardSecondPage fSecondPage;
+
+  private IConfigurationElement fConfigElement;
+
+  public RutaProjectCreationWizard() {
+    setDefaultPageImageDescriptor(RutaImages.DESC_WIZBAN_PROJECT_CREATION);
+    setDialogSettings(DLTKUIPlugin.getDefault().getDialogSettings());
+    setWindowTitle(RutaWizardMessages.ProjectCreationWizard_title);
+  }
+
+  @Override
+  public void addPages() {
+    super.addPages();
+    fFirstPage = new RutaProjectWizardFirstPage();
+
+    fFirstPage.setTitle(RutaWizardMessages.ProjectCreationWizardFirstPage_title);
+    fFirstPage.setDescription(RutaWizardMessages.ProjectCreationWizardFirstPage_description);
+    addPage(fFirstPage);
+    fSecondPage = new RutaProjectWizardSecondPage(fFirstPage);
+    addPage(fSecondPage);
+  }
+
+  @Override
+  protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
+    super.finishPage(monitor);
+    createProject(monitor);
+  }
+
+  public void createProject(IProgressMonitor monitor) throws CoreException {
+    IProject project = fSecondPage.getScriptProject().getProject();
+    IFolder folder = project.getFolder(RutaProjectUtils.getDefaultInputLocation());
+    if (!folder.exists()) {
+      CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 1));
+    }
+    folder = project.getFolder(RutaProjectUtils.getDefaultOutputLocation());
+    if (!folder.exists()) {
+      CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 1));
+    }
+    folder = project.getFolder(RutaProjectUtils.getDefaultTestLocation());
+    if (!folder.exists()) {
+      CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 1));
+    }
+    IFolder descFolder = project.getFolder(RutaProjectUtils.getDefaultDescriptorLocation());
+    if (!descFolder.exists()) {
+      CoreUtility.createFolder(descFolder, true, true, new SubProgressMonitor(monitor, 1));
+    }
+    IFolder srcFolder = project.getFolder(RutaProjectUtils.getDefaultScriptLocation());
+    if (!srcFolder.exists()) {
+      CoreUtility.createFolder(srcFolder, true, true, new SubProgressMonitor(monitor, 1));
+    }
+    IFolder rsrcFolder = project.getFolder(RutaProjectUtils.getDefaultResourcesLocation());
+    if (!rsrcFolder.exists()) {
+      CoreUtility.createFolder(rsrcFolder, true, true, new SubProgressMonitor(monitor, 1));
+    }
+
+    IFolder utilsFolder = descFolder.getFolder("utils");
+    if (!utilsFolder.exists()) {
+      CoreUtility.createFolder(utilsFolder, true, true, new SubProgressMonitor(monitor, 1));
+    }
+
+    List<BPListElement> buildpathEntries = new ArrayList<BPListElement>();
+    for (IBuildpathEntry buildpathEntry : fSecondPage.getRawBuildPath()) {
+      BPListElement createFromExisting = BPListElement.createFromExisting(buildpathEntry,
+              fSecondPage.getScriptProject());
+      if (createFromExisting.getBuildpathEntry().getEntryKind() != IBuildpathEntry.BPE_SOURCE) {
+        buildpathEntries.add(createFromExisting);
+      }
+    }
+    IBuildpathEntry newSourceEntry = DLTKCore.newSourceEntry(srcFolder.getFullPath());
+    buildpathEntries.add(BPListElement.createFromExisting(newSourceEntry,
+            fSecondPage.getScriptProject()));
+
+    BuildpathsBlock.flush(buildpathEntries, fSecondPage.getScriptProject(), monitor);
+    copyDescriptors(descFolder);
+
+    RutaProjectUtils.addProjectDataPath(project, descFolder);
+
+    descFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+
+  }
+
+  public static void copyDescriptors(IFolder descFolder) {
+    File descDir = descFolder.getLocation().toFile();
+    File utilsDir = new File(descFolder.getLocation().toFile(), "utils/");
+    copy(descDir, "BasicTypeSystem.xml");
+    copy(descDir, "BasicEngine.xml");
+    copy(descDir, "InternalTypeSystem.xml");
+    
+    copy(utilsDir, "Modifier.xml");
+    copy(utilsDir, "AnnotationWriter.xml");
+    copy(utilsDir, "StyleMapCreator.xml");
+    copy(utilsDir, "XMIWriter.xml");
+    copy(utilsDir, "SourceDocumentInformation.xml");
+    copy(utilsDir, "PlainTextAnnotator.xml");
+    copy(utilsDir, "PlainTextTypeSystem.xml");
+    copy(utilsDir, "HtmlAnnotator.xml");
+    copy(utilsDir, "HtmlTypeSystem.xml");
+    copy(utilsDir, "HtmlConverter.xml");
+  }
+
+  private static void copy(File dir, String fileName) {
+    InputStream in = null;
+    OutputStream out = null;
+    in = RutaEngine.class.getResourceAsStream(fileName);
+    try {
+      out = new FileOutputStream(new File(dir, fileName));
+    } catch (FileNotFoundException e) {
+      System.err.println(e);
+    }
+    if (in != null && out != null) {
+      copy(in, out);
+    }
+
+  }
+
+  static void copy(InputStream fis, OutputStream fos) {
+    try {
+      byte[] buffer = new byte[0xFFFF];
+      for (int len; (len = fis.read(buffer)) != -1;)
+        fos.write(buffer, 0, len);
+    } catch (IOException e) {
+      System.err.println(e);
+    } finally {
+      if (fis != null) {
+        try {
+          fis.close();
+        } catch (IOException e) {
+          System.err.println(e);
+        }
+      }
+      if (fos != null) {
+        try {
+          fos.close();
+        } catch (IOException e) {
+          System.err.println(e);
+        }
+      }
+    }
+  }
+
+  @Override
+  public boolean performFinish() {
+    boolean res = super.performFinish();
+    if (res) {
+      BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
+      selectAndReveal(fSecondPage.getScriptProject().getProject());
+    }
+    return res;
+  }
+
+  public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
+    fConfigElement = cfig;
+  }
+
+  @Override
+  public boolean performCancel() {
+    return super.performCancel();
+  }
+
+  @Override
+  public String getScriptNature() {
+    return RutaNature.NATURE_ID;
+  }
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectWizardFirstPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectWizardFirstPage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectWizardFirstPage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectWizardFirstPage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,92 @@
+/*
+ * 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.wizards;
+
+import org.eclipse.dltk.ui.wizards.ProjectWizardFirstPage;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+
+final class RutaProjectWizardFirstPage extends ProjectWizardFirstPage {
+
+  private Button useAnalysis;
+
+  private Group packagesGroup;
+
+  private Label labelElement;
+
+  public RutaProjectWizardFirstPage() {
+    setTitle(RutaWizardMessages.ProjectCreationWizardFirstPage_title);
+    setDescription(RutaWizardMessages.ProjectCreationWizardFirstPage_description);
+  }
+
+  
+  @Override
+  protected IInterpreterGroup createInterpreterGroup(Composite parent) {
+    return new DefaultInterpreterGroup(parent);
+  }
+
+  @Override
+  protected boolean interpeterRequired() {
+    /* Specially allow to create TCL project without interpreter */
+    return false;
+  }
+
+  // protected void createCustomGroups(Composite composite) {
+  // super.createCustomGroups(composite);
+  //
+  // packagesGroup = new Group(composite, SWT.NONE);
+  // GridData gridData = new GridData(GridData.FILL, SWT.FILL, true, false);
+  // gridData.widthHint = convertWidthInCharsToPixels(50);
+  // packagesGroup.setLayoutData(gridData);
+  // packagesGroup.setLayout(new GridLayout(1, false));
+  // packagesGroup
+  // .setText(RutaWizardMessages.RutaProjectWizardFirstPage_packageDetector);
+  // this.useAnalysis = new Button(packagesGroup, SWT.CHECK);
+  // this.useAnalysis
+  // .setText(RutaWizardMessages.RutaProjectWizardFirstPage_packageDetector_checkbox);
+  // this.useAnalysis.setSelection(true);
+  // labelElement = new Label(packagesGroup, SWT.NONE);
+  // labelElement
+  // .setText(RutaWizardMessages.RutaProjectWizardFirstPage_packageDetector_description);
+  // Observer o = new Observer() {
+  // public void update(Observable o, Object arg) {
+  // boolean inWorkspace = fLocationGroup.isInWorkspace();
+  // packagesGroup.setEnabled(!inWorkspace);
+  // useAnalysis.setEnabled(!inWorkspace);
+  // labelElement.setEnabled(!inWorkspace);
+  // }
+  // };
+  // fLocationGroup.addObserver(o);
+  // ((RutaInterpreterGroup) getInterpreterGroup()).addObserver(o);
+  // }
+
+  public boolean useAnalysis() {
+    final boolean result[] = { false };
+    useAnalysis.getDisplay().syncExec(new Runnable() {
+      public void run() {
+        result[0] = useAnalysis.getSelection();
+      }
+    });
+    return result[0];
+  }
+
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectWizardSecondPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectWizardSecondPage.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectWizardSecondPage.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaProjectWizardSecondPage.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,67 @@
+/*
+ * 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.wizards;
+
+import org.apache.uima.ruta.ide.ui.preferences.RutaBuildPathsBlock;
+import org.eclipse.dltk.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.dltk.ui.util.IStatusChangeListener;
+import org.eclipse.dltk.ui.wizards.BuildpathsBlock;
+import org.eclipse.dltk.ui.wizards.ProjectWizardFirstPage;
+import org.eclipse.dltk.ui.wizards.ProjectWizardSecondPage;
+
+final class RutaProjectWizardSecondPage extends ProjectWizardSecondPage {
+  RutaProjectWizardSecondPage(ProjectWizardFirstPage mainPage) {
+    super(mainPage);
+  }
+
+  @Override
+  protected BuildpathsBlock createBuildpathBlock(IStatusChangeListener listener) {
+    return new RutaBuildPathsBlock(new BusyIndicatorRunnableContext(), listener, 0,
+            useNewSourcePage(), null);
+  }
+ 
+
+ 
+  // protected BuildpathDetector createBuildpathDetector(
+  // IProgressMonitor monitor, IDLTKLanguageToolkit toolkit)
+  // throws CoreException {
+  // RutaBuildpathDetector detector = new RutaBuildpathDetector(
+  // getCurrProject(), toolkit);
+  //
+  // RutaProjectWizardFirstPage page = (RutaProjectWizardFirstPage) this
+  // .getFirstPage();
+  // detector.setUseAnalysis(page.useAnalysis());
+  // detector.detectBuildpath(new SubProgressMonitor(monitor, 20));
+  // return detector;
+  // }
+
+  // protected void postConfigureProject() throws CoreException {
+  // final IProject project = getCurrProject();
+  // final IEnvironment environment = EnvironmentManager
+  // .getEnvironment(project);
+  // if (environment != null && !environment.isLocal()) {
+  // final Map options = new HashMap();
+  // options.put(DLTKCore.INDEXER_ENABLED, DLTKCore.DISABLED);
+  // options.put(DLTKCore.BUILDER_ENABLED, DLTKCore.DISABLED);
+  // DLTKCore.create(project).setOptions(options);
+  // }
+  // }
+
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaWizardMessages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaWizardMessages.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaWizardMessages.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/wizards/RutaWizardMessages.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.ui.wizards;
+
+import org.eclipse.osgi.util.NLS;
+
+public class RutaWizardMessages extends NLS {
+
+  private static final String BUNDLE_NAME = "org.apache.uima.ruta.ide.ui.wizards.RutaWizardMessages";//$NON-NLS-1$
+
+  private RutaWizardMessages() {
+  }
+
+  public static String ProjectCreationWizard_title;
+
+  public static String ProjectCreationWizardFirstPage_title;
+
+  public static String ProjectCreationWizardFirstPage_description;
+
+  static {
+    NLS.initializeMessages(BUNDLE_NAME, RutaWizardMessages.class);
+  }
+}

Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/CheckValidator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/CheckValidator.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/CheckValidator.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/CheckValidator.java Mon Apr 29 14:50:56 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.uima.textmarker.ide.validator;
+package org.apache.uima.ruta.ide.validator;
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.dltk.core.IScriptProject;
@@ -26,13 +26,13 @@ import org.eclipse.dltk.core.builder.IBu
 
 public class CheckValidator extends AbstractBuildParticipantType {
 
-  private static final String ID = "org.apache.uima.textmarker.ide.validator.checkvalidator"; //$NON-NLS-1$
+  private static final String ID = "org.apache.uima.ruta.ide.validator.checkvalidator"; //$NON-NLS-1$
 
-  private static final String NAME = "TextMarker Checker"; //$NON-NLS-1$
+  private static final String NAME = "Ruta Checker"; //$NON-NLS-1$
 
   @Override
   public IBuildParticipant createBuildParticipant(IScriptProject project) throws CoreException {
-    return new TextMarkerChecker(project);
+    return new RutaChecker(project);
   }
 
 }

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/RutaChecker.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/RutaChecker.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/RutaChecker.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/RutaChecker.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,89 @@
+/*
+ * 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.validator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.core.IScriptProject;
+import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.core.SourceParserUtil;
+import org.eclipse.dltk.core.builder.IBuildContext;
+import org.eclipse.dltk.core.builder.IBuildParticipant;
+import org.eclipse.dltk.core.builder.IBuildParticipantExtension;
+
+public class RutaChecker implements IBuildParticipant, IBuildParticipantExtension {
+  List<IBuildParticipant> buildParticipants = null;
+
+  public RutaChecker(IScriptProject project) {
+    buildParticipants = new ArrayList<IBuildParticipant>();
+    try {
+      buildParticipants.add(new RutaTypeChecker(project));
+      buildParticipants.add(new RutaVarRefChecker());
+      buildParticipants.add(new RutaEngineAndCallChecker(project));
+      buildParticipants.add(new RutaRessourceChecker(project));
+    } catch (CoreException e) {
+      e.printStackTrace();
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.dltk.core.builder.IBuildParticipant#build(org.eclipse.dltk
+   * .core.builder.IBuildContext)
+   */
+  public void build(IBuildContext context) throws CoreException {
+    // if ast not declared in context ..
+    Object mdObj = context.get(IBuildContext.ATTR_MODULE_DECLARATION);
+    if (!(mdObj instanceof ModuleDeclaration)) {
+      // ...temporary inefficient hack to get live error msgs
+      // TODO refactor
+      ISourceModule sourceModule = context.getSourceModule();
+      ModuleDeclaration md = SourceParserUtil.getModuleDeclaration(sourceModule, null);
+      context.set(IBuildContext.ATTR_MODULE_DECLARATION, md);
+    }
+    for (IBuildParticipant buildP : buildParticipants) {
+      buildP.build(context);
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.dltk.core.builder.IBuildParticipantExtension#beginBuild(int)
+   */
+  public boolean beginBuild(int buildType) {
+    return true;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.dltk.core.builder.IBuildParticipantExtension#endBuild(org
+   * .eclipse.core.runtime.IProgressMonitor)
+   */
+  public void endBuild(IProgressMonitor monitor) {
+  }
+
+}

Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/RutaCheckerDefaultProblem.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/RutaCheckerDefaultProblem.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/RutaCheckerDefaultProblem.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/validator/RutaCheckerDefaultProblem.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,50 @@
+/*
+ * 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.validator;
+
+import org.apache.uima.ruta.ide.parser.ast.RutaAbstractDeclaration;
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.compiler.problem.DefaultProblem;
+import org.eclipse.dltk.compiler.problem.ProblemSeverity;
+
+public class RutaCheckerDefaultProblem extends DefaultProblem {
+
+    public RutaCheckerDefaultProblem(String fileName, String message,
+          RutaAbstractDeclaration node, int line, int column, ProblemSeverity severity) {
+    super(fileName, message, RutaProblemIdentifier.PROBLEM, new String[] {}, severity, node.getNameStart(), node.getNameEnd(), line, column);
+  }
+
+  public RutaCheckerDefaultProblem(String fileName, String message,
+          RutaAbstractDeclaration node, int line) {
+    super(fileName, message, 0, new String[] {}, ProblemSeverity.ERROR, node.getNameStart(), node.getNameEnd(),
+            line);
+  }
+
+  public RutaCheckerDefaultProblem(String fileName, String message, ASTNode node, int line) {
+    this(fileName, message, node, line, ProblemSeverity.ERROR);
+  }
+
+  public RutaCheckerDefaultProblem(String fileName, String message, ASTNode node, int line,
+          ProblemSeverity severity) {
+    super(fileName, message, 0, new String[] {}, severity, node.sourceStart(), node.sourceEnd(),
+            line);
+  }
+
+}