You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2011/08/12 13:00:51 UTC

svn commit: r1157047 [13/27] - in /uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide: ./ .settings/ META-INF/ 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...

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebugPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebugPreferencePage.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebugPreferencePage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebugPreferencePage.java Fri Aug 12 11:00:38 2011
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.ide.debug.ui.preferences;
+
+import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.dltk.debug.core.DLTKDebugPreferenceConstants;
+import org.eclipse.dltk.debug.ui.preferences.AbstractDebuggingOptionsBlock;
+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.PreferenceKey;
+import org.eclipse.dltk.ui.util.IStatusChangeListener;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+
+public class TextMarkerDebugPreferencePage extends
+        AbstractConfigurationBlockPropertyAndPreferencePage {
+
+  private static PreferenceKey BREAK_ON_FIRST_LINE = new PreferenceKey(
+          TextMarkerIdePlugin.PLUGIN_ID, DLTKDebugPreferenceConstants.PREF_DBGP_BREAK_ON_FIRST_LINE);
+
+  private static PreferenceKey ENABLE_DBGP_LOGGING = new PreferenceKey(
+          TextMarkerIdePlugin.PLUGIN_ID, DLTKDebugPreferenceConstants.PREF_DBGP_ENABLE_LOGGING);
+
+  private static String PREFERENCE_PAGE_ID = "org.apache.uima.textmarker.ide.preferences.debug";
+
+  private static String PROPERTY_PAGE_ID = "org.apache.uima.textmarker.ide.propertyPage.debug";
+
+  @Override
+  protected AbstractOptionsBlock createOptionsBlock(IStatusChangeListener newStatusChangedListener,
+          IProject project, IWorkbenchPreferenceContainer container) {
+    return new AbstractDebuggingOptionsBlock(newStatusChangedListener, project, getKeys(),
+            container) {
+
+      @Override
+      protected PreferenceKey getBreakOnFirstLineKey() {
+        return BREAK_ON_FIRST_LINE;
+      }
+
+      @Override
+      protected PreferenceKey getDbgpLoggingEnabledKey() {
+        return ENABLE_DBGP_LOGGING;
+      }
+    };
+  }
+
+  /*
+   * @see
+   * org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#getHelpId()
+   */
+  @Override
+  protected String getHelpId() {
+    return null;
+  }
+
+  /*
+   * @see org.eclipse.dltk.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageId()
+   */
+  @Override
+  protected String getPreferencePageId() {
+    return PREFERENCE_PAGE_ID;
+  }
+
+  /*
+   * @seeorg.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#
+   * getProjectHelpId()
+   */
+  @Override
+  protected String getProjectHelpId() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /*
+   * @see org.eclipse.dltk.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageId()
+   */
+  @Override
+  protected String getPropertyPageId() {
+    return PROPERTY_PAGE_ID;
+  }
+
+  /*
+   * @see
+   * org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#setDescription
+   * ()
+   */
+  @Override
+  protected void setDescription() {
+    setDescription(TextMarkerDebugPreferenceMessages.TextMarkerDebugPreferencePage_description);
+  }
+
+  /*
+   * @seeorg.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#
+   * setPreferenceStore()
+   */
+  @Override
+  protected void setPreferenceStore() {
+    setPreferenceStore(new PreferencesAdapter(TextMarkerIdePlugin.getDefault()
+            .getPluginPreferences()));
+  }
+
+  private PreferenceKey[] getKeys() {
+    return new PreferenceKey[] { BREAK_ON_FIRST_LINE, ENABLE_DBGP_LOGGING };
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebugPreferencePage.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebugPreferencePage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebuggingEnginePreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebuggingEnginePreferencePage.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebuggingEnginePreferencePage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebuggingEnginePreferencePage.java Fri Aug 12 11:00:38 2011
@@ -0,0 +1,121 @@
+/*
+ * 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.textmarker.ide.debug.ui.preferences;
+
+import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
+import org.apache.uima.textmarker.ide.core.TextMarkerNature;
+import org.apache.uima.textmarker.ide.debug.TextMarkerDebugConstants;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.dltk.debug.ui.preferences.AbstractDebuggingEngineOptionsBlock;
+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.PreferenceKey;
+import org.eclipse.dltk.ui.util.IStatusChangeListener;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+
+public class TextMarkerDebuggingEnginePreferencePage extends
+        AbstractConfigurationBlockPropertyAndPreferencePage {
+
+  private static PreferenceKey DEBUGGING_ENGINE = new PreferenceKey(TextMarkerIdePlugin.PLUGIN_ID,
+          TextMarkerDebugConstants.DEBUGGING_ENGINE_ID_KEY);
+
+  private static final String PREFERENCE_PAGE_ID = "org.apache.uima.textmarker.ide.preferences.debug.engines";
+
+  private static final String PROPERTY_PAGE_ID = "org.apache.uima.textmarker.ide.propertyPage.debug.engines";
+
+  @Override
+  protected AbstractOptionsBlock createOptionsBlock(IStatusChangeListener newStatusChangedListener,
+          IProject project, IWorkbenchPreferenceContainer container) {
+    return new AbstractDebuggingEngineOptionsBlock(newStatusChangedListener, project, getKeys(),
+            container) {
+
+      @Override
+      protected String getNatureId() {
+        return TextMarkerNature.NATURE_ID;
+      }
+
+      @Override
+      protected PreferenceKey getSavedContributionKey() {
+        return DEBUGGING_ENGINE;
+      }
+    };
+  }
+
+  /*
+   * @see
+   * org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#getHelpId()
+   */
+  @Override
+  protected String getHelpId() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /*
+   * @see org.eclipse.dltk.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageId()
+   */
+  @Override
+  protected String getPreferencePageId() {
+    return PREFERENCE_PAGE_ID;
+  }
+
+  /*
+   * @seeorg.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#
+   * getProjectHelpId()
+   */
+  @Override
+  protected String getProjectHelpId() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /*
+   * @see org.eclipse.dltk.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageId()
+   */
+  @Override
+  protected String getPropertyPageId() {
+    return PROPERTY_PAGE_ID;
+  }
+
+  /*
+   * @see
+   * org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#setDescription
+   * ()
+   */
+  @Override
+  protected void setDescription() {
+    setDescription(TextMarkerDebugPreferenceMessages.TextMarkerDebugEnginePreferencePage_description);
+  }
+
+  /*
+   * @seeorg.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#
+   * setPreferenceStore()
+   */
+  @Override
+  protected void setPreferenceStore() {
+    setPreferenceStore(new PreferencesAdapter(TextMarkerIdePlugin.getDefault()
+            .getPluginPreferences()));
+  }
+
+  private PreferenceKey[] getKeys() {
+    return new PreferenceKey[] { DEBUGGING_ENGINE };
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebuggingEnginePreferencePage.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debug/ui/preferences/TextMarkerDebuggingEnginePreferencePage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunner.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunner.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunner.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunner.java Fri Aug 12 11:00:38 2011
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.ide.debugger;
+
+import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
+import org.apache.uima.textmarker.ide.debug.TextMarkerDebugConstants;
+import org.apache.uima.textmarker.ide.launching.IConfigurableRunner;
+import org.apache.uima.textmarker.ide.launching.ITextMarkerInterpreterRunnerConfig;
+import org.apache.uima.textmarker.ide.launching.TextMarkerInterpreterRunner;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.dltk.core.PreferencesLookupDelegate;
+import org.eclipse.dltk.launching.DebuggingEngineRunner;
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.InterpreterConfig;
+
+public class TextMarkerDebuggerRunner extends DebuggingEngineRunner implements IConfigurableRunner {
+
+  private static String ENGINE_ID = "org.apache.uima.textmarker.ide.debugger.preferences.TextMarkerDebuggerRunnerFactory";
+
+  ITextMarkerInterpreterRunnerConfig runnerconfig = TextMarkerInterpreterRunner.DEFAULT_CONFIG;
+
+  public TextMarkerDebuggerRunner(IInterpreterInstall install) {
+    super(install);
+  }
+
+  @Override
+  public String getDebugModelId() {
+    return TextMarkerDebugConstants.DEBUG_MODEL_ID;
+  }
+
+  @Override
+  public void run(InterpreterConfig config, ILaunch launch, IProgressMonitor monitor)
+          throws CoreException {
+    initializeLaunch(launch, config, createPreferencesLookupDelegate(launch));
+    TextMarkerInterpreterRunner.doRunImpl(config, launch, this.runnerconfig, monitor);
+  }
+
+  public void setRunnerConfig(ITextMarkerInterpreterRunnerConfig config) {
+    this.runnerconfig = config;
+  }
+
+  @Override
+  protected String getDebuggingEngineId() {
+    return ENGINE_ID;
+  }
+
+  @Override
+  protected String getDebugPreferenceQualifier() {
+    return TextMarkerIdePlugin.PLUGIN_ID;
+  }
+
+  @Override
+  protected String getDebuggingEnginePreferenceQualifier() {
+    return TextMarkerIdePlugin.PLUGIN_ID;
+  }
+
+  protected String getLoggingEnabledPreferenceKey() {
+    // not yet supported...
+    return null;
+  }
+
+  @Override
+  protected String getLogFileNamePreferenceKey() {
+    // not yet supported...
+    return null;
+  }
+
+  protected String getLogFilePathPreferenceKey() {
+    // not yet supported...
+    return null;
+  }
+
+  @Override
+  protected InterpreterConfig addEngineConfig(InterpreterConfig config,
+          PreferencesLookupDelegate delegate, ILaunch launch) throws CoreException {
+    return config;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunner.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunner.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunnerFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunnerFactory.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunnerFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunnerFactory.java Fri Aug 12 11:00:38 2011
@@ -0,0 +1,36 @@
+/*
+ * 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.textmarker.ide.debugger;
+
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.IInterpreterRunner;
+import org.eclipse.dltk.launching.IInterpreterRunnerFactory;
+
+public class TextMarkerDebuggerRunnerFactory implements IInterpreterRunnerFactory {
+
+  /*
+   * @see
+   * org.eclipse.dltk.launching.IInterpreterRunnerFactory#createRunner(org.eclipse.dltk.launching
+   * .IInterpreterInstall)
+   */
+  public IInterpreterRunner createRunner(IInterpreterInstall install) {
+    return new TextMarkerDebuggerRunner(install);
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunnerFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/TextMarkerDebuggerRunnerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.java Fri Aug 12 11:00:38 2011
@@ -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.textmarker.ide.debugger.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+public class PreferenceMessages {
+  private static final String BUNDLE_NAME = "org.apache.uima.textmarker.ide.debugger.preferences.PreferenceMessages";
+
+  static {
+    NLS.initializeMessages(BUNDLE_NAME, PreferenceMessages.class);
+  }
+
+  public static String PreferencesDescription;
+
+  public static String NoSettingsAvailable;
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.properties
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.properties?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.properties (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.properties Fri Aug 12 11:00:38 2011
@@ -0,0 +1,21 @@
+# ***************************************************************
+#  * 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.
+# ***************************************************************
+
+PreferencesDescription = TextMarker debugging engine settings.
+NoSettingsAvailable = There are no settings now.

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.properties
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/PreferenceMessages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/TextMarkerDebuggerPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/TextMarkerDebuggerPreferencePage.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/TextMarkerDebuggerPreferencePage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/TextMarkerDebuggerPreferencePage.java Fri Aug 12 11:00:38 2011
@@ -0,0 +1,115 @@
+/*
+ * 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.textmarker.ide.debugger.preferences;
+
+import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage;
+import org.eclipse.dltk.ui.preferences.AbstractOptionsBlock;
+import org.eclipse.dltk.ui.preferences.PreferenceKey;
+import org.eclipse.dltk.ui.util.IStatusChangeListener;
+import org.eclipse.dltk.ui.util.SWTFactory;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+
+public class TextMarkerDebuggerPreferencePage extends
+        AbstractConfigurationBlockPropertyAndPreferencePage {
+
+  private static String PREFERENCE_PAGE_ID = "org.apache.uima.textmarker.ide.preferences.debug.engines.debugger";
+
+  private static String PROPERTY_PAGE_ID = "org.apache.uima.textmarker.ide.propertyPage.debug.engines.debugger";
+
+  /*
+   * @seeorg.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#
+   * createOptionsBlock(org.eclipse.dltk.ui.util.IStatusChangeListener,
+   * org.eclipse.core.resources.IProject, org.eclipse.ui.preferences.IWorkbenchPreferenceContainer)
+   */
+  @Override
+  protected AbstractOptionsBlock createOptionsBlock(IStatusChangeListener newStatusChangedListener,
+          IProject project, IWorkbenchPreferenceContainer container) {
+    return new AbstractOptionsBlock(newStatusChangedListener, project, new PreferenceKey[] {},
+            container) {
+
+      @Override
+      protected Control createOptionsBlock(Composite parent) {
+        Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 1, 1,
+                GridData.FILL);
+        SWTFactory.createLabel(composite, PreferenceMessages.NoSettingsAvailable, 1);
+        return composite;
+      }
+    };
+  }
+
+  /*
+   * @see
+   * org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#getHelpId()
+   */
+  @Override
+  protected String getHelpId() {
+    return null;
+  }
+
+  /*
+   * @see org.eclipse.dltk.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageId()
+   */
+  @Override
+  protected String getPreferencePageId() {
+    return PREFERENCE_PAGE_ID;
+  }
+
+  /*
+   * @seeorg.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#
+   * getProjectHelpId()
+   */
+  @Override
+  protected String getProjectHelpId() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /*
+   * @see org.eclipse.dltk.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageId()
+   */
+  @Override
+  protected String getPropertyPageId() {
+    return PROPERTY_PAGE_ID;
+  }
+
+  /*
+   * @see
+   * org.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#setDescription
+   * ()
+   */
+  @Override
+  protected void setDescription() {
+    setDescription(PreferenceMessages.PreferencesDescription);
+  }
+
+  /*
+   * @seeorg.eclipse.dltk.ui.preferences.AbstractConfigurationBlockPropertyAndPreferencePage#
+   * setPreferenceStore()
+   */
+  @Override
+  protected void setPreferenceStore() {
+    setPreferenceStore(TextMarkerIdePlugin.getDefault().getPreferenceStore());
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/TextMarkerDebuggerPreferencePage.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/debugger/preferences/TextMarkerDebuggerPreferencePage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/Messages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/Messages.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/Messages.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/Messages.java Fri Aug 12 11:00:38 2011
@@ -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.textmarker.ide.formatter;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+  private static final String BUNDLE_NAME = "org.apache.uima.textmarker.ide.formatter.internal.messages"; //$NON-NLS-1$
+
+  public static String TextMarkerFormatter_contentCorrupted;
+  static {
+    // initialize resource bundle
+    NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+  }
+
+  private Messages() {
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/Messages.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/Messages.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormattedPrinter.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormattedPrinter.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormattedPrinter.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormattedPrinter.java Fri Aug 12 11:00:38 2011
@@ -0,0 +1,749 @@
+/*
+ * 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.textmarker.ide.formatter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.antlr.runtime.CommonToken;
+import org.apache.uima.textmarker.ide.parser.ast.TMConditionConstants;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerAbstractDeclaration;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerAction;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerBinaryArithmeticExpression;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerBlock;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerBooleanNumberExpression;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerCondition;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerDeclarationsStatement;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerDeclareDeclarationsStatement;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerExpression;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerFeatureDeclaration;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerListExpression;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerLogAction;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerPackageDeclaration;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerRule;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerRuleElement;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerStringExpression;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerStructureAction;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerTypeDeclaration;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerVariableReference;
+import org.eclipse.dltk.ast.ASTListNode;
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.declarations.Declaration;
+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.expressions.Expression;
+import org.eclipse.dltk.ast.expressions.StringLiteral;
+import org.eclipse.dltk.ast.statements.Block;
+import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.formatter.FormatterDocument;
+import org.eclipse.dltk.ui.formatter.IFormatterIndentGenerator;
+
+/**
+ * Formats a document.<br>
+ * Use the append methods within the visit methods to preserve the comments.
+ * 
+ * 
+ */
+public class TextMarkerFormattedPrinter extends ASTVisitor {
+
+  private FormatterDocument document;
+
+  private String lineDelimiter;
+
+  private static final String SEMI = ";";
+
+  private static final String CONCAT = " + ";
+
+  private static final String COMMA = ",";
+
+  private static final int NL_DECLS_COUNT = 2;
+
+  private static final String CURLY_OPEN = "{";
+
+  private static final String CURLY_CLOSE = "}";
+
+  private static final String BRACK_OPEN = "[";
+
+  private static final String BRACK_CLOSE = "]";
+
+  private static final String THEN = "->";
+
+  private static final String PAR_OPEN = "(";
+
+  private static final String PAR_CLOSE = ")";
+
+  private static final String EQUALS = " = ";
+
+  private IFormatterIndentGenerator indentGenerator;
+
+  private StringBuffer output;
+
+  private List<CommonToken> comments;
+
+  private Iterator<CommonToken> iterator;
+
+  private CommonToken currentComment;
+
+  private int indentLevel = 0;
+
+  private int lines_before_long_declarations;
+
+  private int maxLineLength;
+
+  private boolean inBlockDeclaration = false;
+
+  private Map<Integer, Object> lastStatements = new HashMap<Integer, Object>();
+
+  private int commentLineSince = 0;
+
+  // hotfix: 0 = false, 1 = first rule element, 3 = not first rule element
+  private int inLargeRule = 0;
+
+  private boolean retainLB = true;
+
+  public TextMarkerFormattedPrinter(FormatterDocument document, String lineDelimiter,
+          IFormatterIndentGenerator indentGenerator, List<CommonToken> comments,
+          TextMarkerFormatter tmf) {
+    this.document = document;
+    this.lineDelimiter = lineDelimiter;
+    this.indentGenerator = indentGenerator;
+    this.output = new StringBuffer();
+
+    // read format preferences
+    this.lines_before_long_declarations = tmf
+            .getInt(TextMarkerFormatterConstants.LINES_BEFORE_LONG_DECLARATIONS);
+    this.maxLineLength = tmf.getInt(TextMarkerFormatterConstants.MAX_LINE_LENGTH);
+
+    // comments
+    this.comments = comments == null ? new ArrayList<CommonToken>() : comments;
+    iterator = this.comments.iterator();
+    this.currentComment = iterator.hasNext() ? iterator.next() : null;
+  }
+
+  public String getOutput() {
+    appendLeftComments();
+    return this.output.toString();
+  }
+
+  @Override
+  public boolean visit(Statement s) throws Exception {
+
+    appendComments(s);
+    fillNewLines(s);
+
+    if (s instanceof TextMarkerDeclarationsStatement) {
+      // append new lines before LONG DECLARATIONS
+      TextMarkerDeclarationsStatement decls = (TextMarkerDeclarationsStatement) s;
+      // if (decls.getDeclarationsCount() > NL_DECLS_COUNT) {
+      // for (int i = 0; i < lines_before_long_declarations; i++) {
+      // appendNewLine();
+      // }
+      // }
+      // format declarations:
+      // print type token
+      appendIntoNewLine(document.get(decls.getTypeTokenStart(), decls.getTypeTokenEnd()) + " ");
+      // print parent if available
+      if (s instanceof TextMarkerDeclareDeclarationsStatement) {
+        TextMarkerDeclareDeclarationsStatement dds = (TextMarkerDeclareDeclarationsStatement) s;
+        ASTNode p = dds.getParent();
+        if (p != null) {
+          append(p);
+          append(" ");
+        }
+      }
+      // print identifiers
+      List<TextMarkerAbstractDeclaration> declarations = decls.getDeclarations();
+      traverseAstNodes(declarations);
+      // print init expr
+      if (decls.getInitExpr() != null) {
+        append(EQUALS);
+        decls.getInitExpr().traverse(this);
+      }
+      appendStatementEnd();
+      return false;
+    }
+    if (s instanceof TextMarkerRule) {
+      // traverse into container TextMarkerRule to format RuleElements
+      appendNewLine();
+      // Rules always just consists of RuleElements: whitespace separation
+      if (s.sourceEnd() - s.sourceStart() > 2 * maxLineLength) {
+        inLargeRule = 1;
+        indentLevel++;
+      }
+      List<ASTNode> childs = s.getChilds();
+      traverseAstNodes(childs, "");
+      appendStatementEnd();
+      if (inLargeRule > 0) {
+        indentLevel--;
+        inLargeRule = 0;
+      }
+      return false;
+      // return true;
+    }
+    // if (s instanceof TextMarkerVariableDeclaration && s.getKind() ==
+    // TMTypeConstants.TM_TYPE_WL ||
+    // s.getKind() == TMTC)
+    // special format for declaration statements (they're wrapped in a
+    // declarations-statement)
+    if (s instanceof TextMarkerTypeDeclaration) {
+      append(s);
+      List<TextMarkerFeatureDeclaration> features = ((TextMarkerTypeDeclaration) s).getFeatures();
+      if (features != null && !features.isEmpty()) {
+        append(PAR_OPEN);
+        for (TextMarkerFeatureDeclaration each : features) {
+          append(each.getType());
+          append(" ");
+          append(each.getName());
+          if (features.indexOf(each) < features.size() - 1) {
+            append(COMMA + " ");
+          }
+        }
+        append(PAR_CLOSE);
+      }
+      return false;
+    }
+
+    if (s instanceof Declaration && !(s instanceof TextMarkerPackageDeclaration)) {
+      append(s);
+      return false;
+    }
+    if (s instanceof TextMarkerPackageDeclaration) {
+      append(s);
+      appendStatementEnd();
+      return false;
+    }
+    // append SEMIs for all other statements
+    appendIntoNewLine(s);
+    appendStatementEnd();
+    return false;
+  }
+
+  private void fillNewLines(Object s) {
+    Object last = lastStatements.get(indentLevel);
+    // if (last == null && indentLevel > 0) {
+    // last = lastStatements.get(indentLevel - 1);
+    // }
+    if (last != null && retainLB) {
+      int start = 0;
+      int end = 0;
+      if (s instanceof Statement) {
+        end = ((ASTNode) s).sourceStart();
+      } else if (s instanceof CommonToken) {
+        end = ((CommonToken) s).getStartIndex();
+      }
+      if (last instanceof Statement) {
+        start = ((ASTNode) last).sourceEnd() + 1;
+      } else if (last instanceof CommonToken) {
+        start = ((CommonToken) last).getStopIndex();
+      }
+
+      if (start < end) {
+        String string = document.get(start, end);
+        String replaceAll = string.replaceAll(lineDelimiter, "");
+        double d = (string.length() - replaceAll.length()) / lineDelimiter.length()
+                - commentLineSince;
+        if (s instanceof CommonToken && commentLineSince == 0) {
+          d++;
+        }
+        for (int i = 1; i < d; i++) {
+          appendNewLine();
+        }
+        if (d < 2 && s instanceof TextMarkerDeclarationsStatement && !(last instanceof Declaration)) {
+          appendNewLine();
+        }
+        commentLineSince = 0;
+      }
+    }
+    lastStatements.put(indentLevel, s);
+  }
+
+  @Override
+  public boolean endvisit(Statement s) throws Exception {
+    // if (s instanceof TextMarkerRule) {
+    // append(SEMI);
+    // return true;
+    // }
+    return super.endvisit(s);
+  }
+
+  @Override
+  public boolean visit(Expression s) throws Exception {
+    // traverse Block (first child of root element:
+    if (s instanceof Block) {
+      return true;
+    }
+    // special format for RuleElements:
+    if (s instanceof TextMarkerRuleElement) {
+      TextMarkerRuleElement ruleEl = (TextMarkerRuleElement) s;
+      if (inLargeRule == 2) {
+        appendNewLine();
+      } else if (inLargeRule == 1) {
+        inLargeRule = 2;
+      }
+      appendRuleElement(ruleEl);
+      return false;
+    }
+    // special format for actions
+    if (s instanceof TextMarkerAction) {
+      TextMarkerAction a = (TextMarkerAction) s;
+      String name = document.get(a.getNameStart(), a.getNameEnd());
+      append(name);
+      List<? extends ASTNode> childs = a.getChilds();
+      if (childs != null && !childs.isEmpty()) {
+        append(PAR_OPEN);
+        // special format for create
+        if (a instanceof TextMarkerStructureAction) {
+          if (name.equals("TRIE")) {
+            printStructureAction2(a);
+          } else {
+            printStructureAction(a);
+          }
+        } else {
+          traverseAstNodes(childs);
+        }
+        // special format for log
+        if (a instanceof TextMarkerLogAction && ((TextMarkerLogAction) a).isLogLevelAssigned()) {
+          appendSeparator(COMMA);
+          TextMarkerLogAction logAction = (TextMarkerLogAction) a;
+          append(logAction.getLogLevelStart(), logAction.getLogLevelEnd());
+        }
+        append(PAR_CLOSE);
+      }
+      return false;
+    }
+    // special format for conditions
+    if (s instanceof TextMarkerCondition) {
+      TextMarkerCondition c = (TextMarkerCondition) s;
+      append(document.get(c.getNameStart(), c.getNameEnd()));
+      List<? extends ASTNode> childs = c.getChilds();
+      // minus is a condition without parameter parantheses:
+      if (s.getKind() != TMConditionConstants.COND_MINUS && childs != null && !childs.isEmpty()) {
+        append(PAR_OPEN);
+      }
+      traverseAstNodes(childs);
+      if (s.getKind() != TMConditionConstants.COND_MINUS && childs != null && !childs.isEmpty()) {
+        append(PAR_CLOSE);
+      }
+      return false;
+    }
+    // special format for boolean number expressions
+    if (s instanceof TextMarkerBooleanNumberExpression) {
+      TextMarkerBooleanNumberExpression tmbne = (TextMarkerBooleanNumberExpression) s;
+      append(PAR_OPEN);
+      if (tmbne.getE1() != null) {
+        tmbne.getE1().traverse(this);
+      }
+      append(tmbne.getOperator());
+      if (tmbne.getE2() != null) {
+        tmbne.getE2().traverse(this);
+      }
+      append(PAR_CLOSE);
+      return false;
+    }
+    // special format for string expressions
+    if (s instanceof TextMarkerStringExpression
+            && ((TextMarkerExpression) s).getExpression() != null) {
+      TextMarkerStringExpression tmse = (TextMarkerStringExpression) s;
+      List<?> childs = tmse.getExpression().getChilds();
+      Object object2 = childs.get(0);
+      if (object2 instanceof ASTNode) {
+        ASTNode astnode = (ASTNode) object2;
+        List<?> childs2 = astnode.getChilds();
+        for (Object object : childs2) {
+          if (object instanceof TextMarkerExpression) {
+            TextMarkerExpression expr = (TextMarkerExpression) object;
+            // if (expr.isInParantheses()) {
+            // append(PAR_OPEN);
+            // append(expr);
+            // append(PAR_CLOSE);
+            // } else {
+            append(expr);
+            // }
+          } else if (object instanceof StringLiteral) {
+            StringLiteral sl = (StringLiteral) object;
+            String value = sl.getValue();
+            append(value);
+          } else if (object instanceof TextMarkerVariableReference) {
+            TextMarkerVariableReference vr = (TextMarkerVariableReference) object;
+            append(vr.getName());
+          }
+          if (childs2.indexOf(object) < childs2.size() - 1) {
+            append(CONCAT);
+          }
+        }
+      } else {
+        append(s);
+      }
+      return false;
+    }
+    if (s instanceof TextMarkerListExpression) {
+      TextMarkerListExpression le = (TextMarkerListExpression) s;
+      append(CURLY_OPEN);
+      ASTListNode exprs = le.getExprs();
+      traverseAstNodes(exprs.getChilds());
+      append(CURLY_CLOSE);
+      return false;
+    }
+
+    // special format for paranthesed expressions: (expression)
+    // if (s instanceof TextMarkerExpression && ((TextMarkerExpression) s).isInParantheses()) {
+    // append(PAR_OPEN);
+    // append(s);
+    // append(PAR_CLOSE);
+    // return false;
+    // }
+    if (s instanceof TextMarkerBinaryArithmeticExpression) {
+      TextMarkerBinaryArithmeticExpression ba = (TextMarkerBinaryArithmeticExpression) s;
+      String operator = ba.getOperator();
+      append(operator);
+      append(PAR_OPEN);
+      traverseAstNodes(ba.getChilds());
+      append(PAR_CLOSE);
+    }
+    append(s);
+    return false;
+  }
+
+  /**
+   * structure actions like CREATE, FILL with assignments.
+   * 
+   * @param a
+   */
+  private void printStructureAction(TextMarkerAction a) {
+    TextMarkerStructureAction tmca = (TextMarkerStructureAction) a;
+    // structure
+    append(tmca.getStructure());
+    append(COMMA);
+    append(" ");
+    // number expressions
+    List<Expression> indices = tmca.getIndices();
+    if (indices != null) {
+      traverseAstNodes(indices);
+    }
+    if (!indices.isEmpty()) {
+      append(COMMA);
+      append(" ");
+    }
+    // assignments
+    Map<Expression, Expression> assignments = tmca.getAssignments();
+    Iterator it = assignments.entrySet().iterator();
+    while (it.hasNext()) {
+      if (assignments.size() > 3) {
+        appendNewLineAndIndent();
+      }
+      Map.Entry pairs = (Map.Entry) it.next();
+      try {
+        ((Expression) pairs.getKey()).traverse(this);
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+      append(EQUALS);
+      try {
+        ((Expression) pairs.getValue()).traverse(this);
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+      if (it.hasNext()) {
+        output.append(COMMA);
+        append(" ");
+      }
+    }
+  }
+
+  private void printStructureAction2(TextMarkerAction a) {
+    TextMarkerStructureAction tmca = (TextMarkerStructureAction) a;
+
+    Map<Expression, Expression> assignments = tmca.getAssignments();
+    Iterator it = assignments.entrySet().iterator();
+    while (it.hasNext()) {
+      if (assignments.size() > 3) {
+        appendNewLineAndIndent();
+      }
+      Map.Entry pairs = (Map.Entry) it.next();
+      try {
+        ((Expression) pairs.getKey()).traverse(this);
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+      append(EQUALS);
+      try {
+        ((Expression) pairs.getValue()).traverse(this);
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+      output.append(COMMA);
+      append(" ");
+    }
+    // structure
+
+    append(tmca.getStructure());
+    append(COMMA);
+    append(" ");
+    // number expressions
+    List<Expression> indices = tmca.getIndices();
+    if (indices != null) {
+      traverseAstNodes(indices);
+    }
+    // assignments
+
+  }
+
+  @Override
+  public boolean endvisit(Expression s) throws Exception {
+    return super.endvisit(s);
+  }
+
+  /**
+   * @param ruleEl
+   * @param conditions
+   * @param actions
+   */
+  private void appendRuleElement(TextMarkerRuleElement ruleEl) {
+    append(ruleEl.getHead());
+    List<Expression> conditions = ruleEl.getConditions();
+    List<Expression> actions = ruleEl.getActions();
+    // don't print {->} for empty rule elements
+
+    // print Quantifiers
+    List<? extends ASTNode> quantifierExpressions = ruleEl.getQuantifierExpressions();
+    if (quantifierExpressions != null && !quantifierExpressions.isEmpty()) {
+      if (quantifierExpressions.size() > 1) {
+        append(BRACK_OPEN);
+        for (ASTNode expression : quantifierExpressions) {
+          append(expression);
+          if (quantifierExpressions.indexOf(expression) < quantifierExpressions.size() - 1) {
+            append(COMMA);
+          }
+        }
+        append(BRACK_CLOSE);
+      } else if (quantifierExpressions.size() == 1) {
+        append(quantifierExpressions.get(0));
+      }
+    }
+    if (!inBlockDeclaration && conditions == null && actions == null) {
+      return;
+    }
+
+    if (!inBlockDeclaration
+            && ((conditions == null && actions.isEmpty()) || actions == null
+                    && (conditions != null) && conditions.isEmpty())) {
+      return;
+    }
+    append(CURLY_OPEN);
+    // print Conditions
+    if (conditions != null && !conditions.isEmpty()) {
+      traverseAstNodes(conditions);
+    }
+    if (conditions != null && !conditions.isEmpty()) {
+    }
+    // print Actions
+    if (actions != null && !actions.isEmpty()) {
+      if (conditions != null && !conditions.isEmpty()) {
+        append(" " + THEN + " ");
+      } else {
+        append(THEN + " ");
+      }
+      traverseAstNodes(actions);
+    }
+    append(CURLY_CLOSE);
+  }
+
+  /**
+   * @param astnodes
+   */
+  @SuppressWarnings("unchecked")
+  private void traverseAstNodes(List<? extends ASTNode> astnodes) {
+    traverseAstNodes(astnodes, COMMA);
+  }
+
+  /**
+   * @param astnodes
+   */
+  @SuppressWarnings("unchecked")
+  private void traverseAstNodes(List<? extends ASTNode> astnodes, String separator) {
+    if (astnodes == null) {
+      return;
+    }
+    Iterator iterator2 = astnodes.iterator();
+    while (iterator2.hasNext()) {
+      ASTNode node = (ASTNode) iterator2.next();
+      try {
+        node.traverse(this);
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+      if (iterator2.hasNext()) {
+        appendSeparator(separator);
+      }
+    }
+  }
+
+  private void appendSeparator(String separator) {
+    output.append(separator);
+    append(" ");
+  }
+
+  @Override
+  public boolean visit(MethodDeclaration s) throws Exception {
+    appendComments(s);
+    fillNewLines(s);
+
+    // Statement last = lastStatements.get(indentLevel);
+    // // if (last == null && indentLevel > 0) {
+    // // last = lastStatements.get(indentLevel - 1);
+    // // }
+    // if (last != null && retainLB) {
+    // int start = last.sourceEnd() + 1;
+    // int end = s.sourceStart();
+    // if (start < end) {
+    // String string = document.get(start, end);
+    // String replaceAll = string.replaceAll(lineDelimiter, "");
+    // double d = (string.length() - replaceAll.length()) / lineDelimiter.length()
+    // - commentLineSince;
+    // for (int i = 1; i < d; i++) {
+    // appendNewLine();
+    // }
+    // commentLineSince = 0;
+    // }
+    // }
+
+    if (s instanceof TextMarkerBlock) {
+      TextMarkerBlock b = (TextMarkerBlock) s;
+      appendIntoNewLine("BLOCK(");
+      append(b.getName());
+      append(") ");
+      this.inBlockDeclaration = true;
+      if (b.getRuleElement() != null) {
+        b.getRuleElement().traverse(this);
+      }
+      this.inBlockDeclaration = false;
+      append(" {");
+      indentLevel++;
+      b.getBody().traverse(this);
+      lastStatements.put(indentLevel, null);
+      indentLevel--;
+      lastStatements.put(indentLevel, s);
+      appendIntoNewLine("}");
+      appendNewLine();
+      return false;
+    }
+    return super.visit(s);
+  }
+
+  @Override
+  public boolean visit(ModuleDeclaration s) throws Exception {
+    return true;
+  }
+
+  @Override
+  public boolean visit(TypeDeclaration s) throws Exception {
+    return super.visit(s);
+  }
+
+  @Override
+  public boolean visitGeneral(ASTNode node) throws Exception {
+    return super.visitGeneral(node);
+  }
+
+  private void append(int begin, int end) {
+    append(document.get(begin, end));
+  }
+
+  private void append(String string) {
+    if (outputPosInLine() + string.length() > maxLineLength) {
+      appendNewLine();
+      indentGenerator.generateIndent(1, output);
+    }
+    output.append(string);
+  }
+
+  private void appendIntoNewLine(String string) {
+    appendNewLine();
+    output.append(string);
+  }
+
+  private void append(ASTNode s) {
+    appendComments(s);
+    // this.output.
+    append(document.get(s.sourceStart(), s.sourceEnd()));
+  }
+
+  private void appendIntoNewLine(ASTNode s) {
+    appendComments(s);
+    appendNewLine();
+    append(s);
+  }
+
+  private void appendNewLine() {
+    output.append(lineDelimiter);
+    indentGenerator.generateIndent(indentLevel, output);
+  }
+
+  private void appendNewLineAndIndent() {
+    output.append(lineDelimiter);
+    indentGenerator.generateIndent(indentLevel + 1, output);
+  }
+
+  private void appendStatementEnd() {
+    output.append(SEMI);
+  }
+
+  /**
+   * @param s
+   * @return
+   */
+  private int appendComments(ASTNode s) {
+    return appendComments(s.sourceStart());
+  }
+
+  /**
+   * @param start
+   * @return
+   */
+  private int appendComments(int start) {
+    while (currentComment != null && currentComment.getStartIndex() < start) {
+      String text = currentComment.getText();
+      fillNewLines(currentComment);
+      append(" " + text);
+      currentComment = iterator.hasNext() ? iterator.next() : null;
+      commentLineSince++;
+    }
+    return start;
+  }
+
+  private void appendLeftComments() {
+    while (currentComment != null) {
+      append(currentComment.getText());
+      currentComment = iterator.hasNext() ? iterator.next() : null;
+    }
+  }
+
+  private int outputPosInLine() {
+    String out = output.toString();
+    int lastIndexOf = out.lastIndexOf("\n");
+    return out.length() - lastIndexOf;
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormattedPrinter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormattedPrinter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java Fri Aug 12 11:00:38 2011
@@ -0,0 +1,230 @@
+/*
+ * 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.textmarker.ide.formatter;
+
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.Reader;
+import java.util.List;
+import java.util.Map;
+
+import org.antlr.runtime.BitSet;
+import org.antlr.runtime.CommonToken;
+import org.antlr.runtime.CommonTokenStream;
+import org.apache.uima.textmarker.ide.core.parser.TextMarkerParser;
+import org.apache.uima.textmarker.ide.core.parser.TextMarkerSourceParser;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.compiler.problem.IProblem;
+import org.eclipse.dltk.compiler.problem.IProblemReporter;
+import org.eclipse.dltk.formatter.AbstractScriptFormatter;
+import org.eclipse.dltk.formatter.FormatterDocument;
+import org.eclipse.dltk.ui.formatter.FormatterException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+
+public class TextMarkerFormatter extends AbstractScriptFormatter {
+
+  class DummyReporter implements IProblemReporter {
+
+    private boolean gotProblems = false;
+
+    @Override
+    public Object getAdapter(Class adapter) {
+      return null;
+    }
+
+    @Override
+    public void reportProblem(IProblem problem) {
+      setProblems(true);
+    }
+
+    public void setProblems(boolean gotProblems) {
+      this.gotProblems = gotProblems;
+    }
+
+    public boolean gotProblems() {
+      return gotProblems;
+    }
+  };
+
+  protected static final String[] INDENTING = { TextMarkerFormatterConstants.INDENT_BLOCK,
+      TextMarkerFormatterConstants.INDENT_STRUCTURE };
+
+  // protected static final String[] BLANK_LINES = { };
+
+  private final String lineDelimiter;
+
+  public TextMarkerFormatter(String lineDelimiter, Map preferences) {
+    super(preferences);
+    this.lineDelimiter = lineDelimiter;
+  }
+
+  public TextEdit format(String source, int offset, int length, int indent)
+          throws FormatterException {
+    String input = source;
+    // TODO implement useful format for code snippets
+    // final String input = source.substring(offset, offset + length);
+    if (input == "") {
+      return null;
+    }
+    TextMarkerSourceParser tmsp = new TextMarkerSourceParser();
+
+    DummyReporter reporter = new DummyReporter();
+
+    ModuleDeclaration md = tmsp.parse("format.tm".toCharArray(), source.toCharArray(), reporter);
+    CommonTokenStream tokenStream = tmsp.getTokenStream();
+
+    if (!reporter.gotProblems()) {
+
+      BitSet bs = new BitSet();
+      bs.add(TextMarkerParser.LINE_COMMENT);
+      bs.add(TextMarkerParser.COMMENT);
+      List<CommonToken> comments = tokenStream.getTokens(0, tokenStream.size(), bs);
+
+      final String output = format(input, md, comments, indent);
+      if (output != null) {
+        if (!input.equals(output)) {
+          return new ReplaceEdit(0, source.length(), output);
+          // return new ReplaceEdit(offset, length, output);
+          // if (!equalsIgnoreBlanks(new StringReader(input), new StringReader(output))) {
+          // // return new MultiTextEdit();
+          // return new ReplaceEdit(offset, length, output);
+          // } else {
+          // // TODO reset throwing exception
+          // return new MultiTextEdit();
+          // // throw new IllegalArgumentException("illegal format context");
+          // // System.err.println("illegal format context");
+          // }
+        } else {
+          return new MultiTextEdit();
+        }
+      }
+    }
+    return null;
+  }
+
+  /**
+   * @param input
+   * @param md
+   * @param indent
+   * @return the formatted code
+   */
+  private String format(String input, ModuleDeclaration md, List<CommonToken> comments, int indent) {
+    final FormatterDocument document = createDocument(input);
+
+    // compute new (formatted) document structure
+    TextMarkerFormattedPrinter tmfp = new TextMarkerFormattedPrinter(document, lineDelimiter,
+            createIndentGenerator(), comments, this);
+    try {
+      md.traverse(tmfp);
+    } catch (Exception e) {
+      // TODO Auto-generated catch block
+      e.printStackTrace();
+    }
+    return tmfp.getOutput();
+
+    // // compute new (formatted) document structure
+    // final TextMarkerFormatterNodeBuilder builder = new TextMarkerFormatterNodeBuilder();
+    // IFormatterContainerNode root = builder.build(md, document);
+    // // new TextMarkerFormatterNodeRewriter(result, document).rewrite(root);
+    // IFormatterContext context = new FormatterContext(indent);
+    // FormatterWriter writer = new FormatterWriter(document, lineDelimiter,
+    // createIndentGenerator());
+    // try {
+    // root.accept(context, writer);
+    // writer.flush(context);
+    // return writer.getOutput();
+    // } catch (Exception e) {
+    // e.printStackTrace();
+    // return null;
+    // }
+  }
+
+  /**
+   * Factory method for FormatterDocuments that represent the content with formatting options.<br>
+   * No formatting operations done in this method and no formatting done with the content of the
+   * formatterDocument in general.
+   * 
+   * @param input
+   * @return
+   */
+  private FormatterDocument createDocument(String input) {
+    FormatterDocument document = new FormatterDocument(input);
+    for (int i = 0; i < INDENTING.length; ++i) {
+      document.setBoolean(INDENTING[i], getBoolean(INDENTING[i]));
+    }
+    document.setInt(TextMarkerFormatterConstants.FORMATTER_TAB_SIZE,
+            getInt(TextMarkerFormatterConstants.FORMATTER_TAB_SIZE));
+    return document;
+  }
+
+  private boolean equalsIgnoreBlanks(Reader inputReader, Reader outputReader) {
+    LineNumberReader input = new LineNumberReader(inputReader);
+    LineNumberReader output = new LineNumberReader(outputReader);
+    for (;;) {
+      final String inputLine = readLine(input);
+      final String outputLine = readLine(output);
+      if (inputLine == null) {
+        if (outputLine == null) {
+          return true;
+        } else {
+          return false;
+        }
+      } else if (outputLine == null) {
+        return false;
+      } else if (!inputLine.equals(outputLine)) {
+        return false;
+      }
+    }
+  }
+
+  private String readLine(LineNumberReader reader) {
+    String line;
+    do {
+      try {
+        line = reader.readLine();
+      } catch (IOException e) {
+        return null; // just doing sth.
+      }
+      if (line == null) {
+        return line;
+      }
+      line = line.trim();
+    } while (line.length() == 0);
+    return line;
+  }
+
+  @Override
+  public int getInt(String key) {
+    return super.getInt(key);
+  }
+
+  @Override
+  protected boolean getBoolean(String key) {
+    return super.getBoolean(key);
+  }
+
+  @Override
+  protected String getString(String key) {
+    return super.getString(key);
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterConstants.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterConstants.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterConstants.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterConstants.java Fri Aug 12 11:00:38 2011
@@ -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.textmarker.ide.formatter;
+
+import org.eclipse.dltk.ui.CodeFormatterConstants;
+
+public class TextMarkerFormatterConstants {
+
+  public static final String FORMATTER_TAB_CHAR = CodeFormatterConstants.FORMATTER_TAB_CHAR;
+
+  public static final String FORMATTER_TAB_SIZE = CodeFormatterConstants.FORMATTER_TAB_SIZE;
+
+  public static final String FORMATTER_INDENTATION_SIZE = CodeFormatterConstants.FORMATTER_INDENTATION_SIZE;
+
+  public static final String FORMATTER_PROFILES = "formatter.profiles"; //$NON-NLS-1$
+
+  public static final String FORMATTER_ACTIVE_PROFILE = "formatter.profiles.active"; //$NON-NLS-1$
+
+  public static final String INDENT_BLOCK = "indent.block";
+
+  public static final String INDENT_STRUCTURE = "indent.structure";
+
+  // TODO implement smarter format options, first just indentation...
+  public static final String LINES_BEFORE_LONG_DECLARATIONS = "lines.before.long.declarations";
+
+  public static final String MAX_LINE_LENGTH = "wrapping.max.line.length";
+
+  // public static final String LINES_FILE_AFTER_GLOBAL =
+  // "line.file.global.after";
+  // public static final String LINES_FILE_BEFORE_FIRST_ =
+  // "line.file.block.between";
+  // public static final String LINES_FILE_BETWEEN_BLOCK =
+  // "line.file.block.between";
+  // public static final String LINES_FILE_BETWEEN_BLOCK =
+  // "line.file.block.between";
+  // public static final String LINES_FILE_BETWEEN_BLOCK =
+  // "line.file.block.between";
+  // public static final String LINES_FILE_BETWEEN_BLOCK =
+  // "line.file.block.between";
+  // public static final String LINES_FILE_BETWEEN_BLOCK =
+  // "line.file.block.between";
+
+  public static final String LINES_PRESERVE = "lines.preserve";
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterConstants.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterConstants.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterFactory.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterFactory.java Fri Aug 12 11:00:38 2011
@@ -0,0 +1,86 @@
+/*
+ * 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.textmarker.ide.formatter;
+
+import java.net.URL;
+import java.util.Map;
+
+import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
+import org.apache.uima.textmarker.ide.formatter.preferences.TextMarkerFormatterModifyDialog;
+import org.eclipse.dltk.formatter.AbstractScriptFormatterFactory;
+import org.eclipse.dltk.ui.formatter.IFormatterModifyDialog;
+import org.eclipse.dltk.ui.formatter.IFormatterModifyDialogOwner;
+import org.eclipse.dltk.ui.formatter.IScriptFormatter;
+import org.eclipse.dltk.ui.preferences.PreferenceKey;
+
+public class TextMarkerFormatterFactory extends AbstractScriptFormatterFactory {
+
+  private static final String[] KEYS = {
+      // TextMarkerUI.PLUGIN_ID :
+      TextMarkerFormatterConstants.FORMATTER_TAB_CHAR,
+      TextMarkerFormatterConstants.FORMATTER_INDENTATION_SIZE,
+      TextMarkerFormatterConstants.FORMATTER_TAB_SIZE,
+      // TextMarkerFormatterPlugin.PLUGIN_ID :
+      TextMarkerFormatterConstants.INDENT_BLOCK, TextMarkerFormatterConstants.INDENT_STRUCTURE,
+      TextMarkerFormatterConstants.LINES_BEFORE_LONG_DECLARATIONS,
+      TextMarkerFormatterConstants.MAX_LINE_LENGTH };
+
+  public PreferenceKey[] getPreferenceKeys() {
+    final PreferenceKey[] result = new PreferenceKey[KEYS.length];
+    for (int i = 0; i < KEYS.length; ++i) {
+      final String key = KEYS[i];
+      final String qualifier;
+      if (TextMarkerFormatterConstants.FORMATTER_TAB_CHAR.equals(key)
+              || TextMarkerFormatterConstants.FORMATTER_INDENTATION_SIZE.equals(key)
+              || TextMarkerFormatterConstants.FORMATTER_TAB_SIZE.equals(key)) {
+        qualifier = TextMarkerIdePlugin.PLUGIN_ID;
+      } else {
+        qualifier = TextMarkerIdePlugin.PLUGIN_ID;
+      }
+      result[i] = new PreferenceKey(qualifier, key);
+    }
+    return result;
+  }
+
+  @Override
+  public PreferenceKey getProfilesKey() {
+    return new PreferenceKey(TextMarkerIdePlugin.PLUGIN_ID,
+            TextMarkerFormatterConstants.FORMATTER_PROFILES);
+  }
+
+  public PreferenceKey getActiveProfileKey() {
+    return new PreferenceKey(TextMarkerIdePlugin.PLUGIN_ID,
+            TextMarkerFormatterConstants.FORMATTER_ACTIVE_PROFILE);
+  }
+
+  public IScriptFormatter createFormatter(String lineDelimiter, Map preferences) {
+    return new TextMarkerFormatter(lineDelimiter, preferences);
+  }
+
+  @Override
+  public URL getPreviewContent() {
+    return getClass().getResource("formatPreviewScript.tm"); //$NON-NLS-1$
+  }
+
+  public IFormatterModifyDialog createDialog(IFormatterModifyDialogOwner dialogOwner) {
+    return new TextMarkerFormatterModifyDialog(dialogOwner, this);
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterPreferenceInitializer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterPreferenceInitializer.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterPreferenceInitializer.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterPreferenceInitializer.java Fri Aug 12 11:00:38 2011
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.ide.formatter;
+
+import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class TextMarkerFormatterPreferenceInitializer extends AbstractPreferenceInitializer {
+
+  @Override
+  public void initializeDefaultPreferences() {
+    TextMarkerIdePlugin plugin = TextMarkerIdePlugin.getDefault();
+    IPreferenceStore store = plugin.getPreferenceStore();
+
+    store.setDefault(TextMarkerFormatterConstants.INDENT_BLOCK, true);
+    store.setDefault(TextMarkerFormatterConstants.INDENT_STRUCTURE, true);
+
+    store.setDefault(TextMarkerFormatterConstants.LINES_BEFORE_LONG_DECLARATIONS, 1);
+
+    store.setDefault(TextMarkerFormatterConstants.LINES_PRESERVE, 1);
+
+    store.setDefault(TextMarkerFormatterConstants.MAX_LINE_LENGTH, 100);
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterPreferenceInitializer.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatterPreferenceInitializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/bak_formatPreviewScript.tm
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/bak_formatPreviewScript.tm?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/bak_formatPreviewScript.tm (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/bak_formatPreviewScript.tm Fri Aug 12 11:00:38 2011
@@ -0,0 +1,55 @@
+PACKAGE org.apache.uima;
+
+SCRIPT org.apache.uima.DashTree;
+SCRIPT org.apache.uima.DashTreeError;
+SCRIPT org.apache.uima.BuildTree;
+TYPESYSTEM org.apache.uima.TerminologyTypeSystem;
+
+Document(CALL,DashTree);
+ 
+DECLARE link;
+entryContent curlyBracketsOpen inCurlyBrackets{-PARTOF,link}(MARK,link,3) curlyBracketsClose;
+
+Document(RETAINTYPE);
+
+// *** error handling ***
+Document(CALL,DashTreeError);
+// *** end of error handling ***
+
+// *** statistics ***
+INT count;
+Document{TOTALCOUNT,error,1,1000000,count}
+    (LOG,"Longmenu.txt: Es wurde(n) "+(count)+" Fehler gefunden!");
+Document{TOTALCOUNT,rootRow,1,1000000,count}
+    (LOG,"Longmenu.txt: Es wurde(n) "+(count)+" Wurzel-Elemente gefunden.");
+Document{TOTALCOUNT,childRow,1,1000000,count}
+    (LOG,"Longmenu.txt: Es wurde(n) "+(count)+" Kind-Elemente gefunden.");
+// *** end of statistics ***
+
+INT id;
+
+ACTION IncID = (ASSIGN,id,id+1);
+
+
+BLOCK(ChildRows) childRow {
+    childRow[1,9](ASSIGN,id,1+id;
+        CREATE,Term,
+        "Text" = entryContent,
+        "Info" = link,
+        "Id" = "A" + (id),
+        "TermType" = "answer");
+}
+
+BLOCK(RootRow) rootRow {
+    rootRow(ASSIGN,id,1+id;
+        CREATE,Term,
+        "Text" = entryContent,
+        "Info" = link,
+        "Id" = "A" + (id),
+        "TermType" = "answer");
+}
+
+Term{PARTOF,rootRow}(TRANSFER,Root);
+
+Term{PARTOF,rootRow}(MARK,SubTree,1,2) Term+{-PARTOF,rootRow};
+Document(CALL,BuildTree.BuildDashTree);

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/bak_formatPreviewScript.tm
------------------------------------------------------------------------------
    svn:executable = *

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/formatPreviewScript.tm
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/formatPreviewScript.tm?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/formatPreviewScript.tm (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/formatPreviewScript.tm Fri Aug 12 11:00:38 2011
@@ -0,0 +1,25 @@
+PACKAGE org.apache.uima;
+
+SCRIPT org.apache.uima.DashTree;
+SCRIPT org.apache.uima.DashTreeError;
+SCRIPT org.apache.uima.BuildTree;
+TYPESYSTEM org.apache.uima.TerminologyTypeSystem;
+
+Document{->CALL(DashTree)}; 
+DECLARE link1, link2, link3, link4;
+link1{PARTOF(link2)->MARK(link,3)};
+
+// *** error handling ***
+Document{->CALL(DashTreeError)};
+// *** end of error handling ***
+
+// *** blocks ***
+DECLARE childRow, Doc2;
+INT id;
+BOOLEAN b = false;
+
+BLOCK(ChildRows)childRow{}{childRow[1,9]{IF(b)->ASSIGN(id,1+id), ASSIGN(b,true)};Doc2{->MARK(childRow)};}
+
+// *** statistics ***
+INT count;
+Document{TOTALCOUNT(error,1,1000000,count)->LOG,"Longmenu.txt: Es wurde(n) "+(count)+" Fehler gefunden!")};
\ No newline at end of file

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/formatPreviewScript.tm
------------------------------------------------------------------------------
    svn:executable = *

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/messages.properties
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/messages.properties?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/messages.properties (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/messages.properties Fri Aug 12 11:00:38 2011
@@ -0,0 +1,20 @@
+# ***************************************************************
+#  * 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.
+# ***************************************************************
+
+TextMarkerFormatter_contentCorrupted=Content corrupted in formatter

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/messages.properties
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/preferences/Messages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/preferences/Messages.java?rev=1157047&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/preferences/Messages.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/preferences/Messages.java Fri Aug 12 11:00:38 2011
@@ -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.textmarker.ide.formatter.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+  private static final String BUNDLE_NAME = "org.apache.uima.textmarker.ide.formatter.preferences.messages"; //$NON-NLS-1$
+
+  // public static String TextMarkerFormatterBlankLinesPage_afterGlobalStatements;
+  // public static String TextMarkerFormatterBlankLinesPage_befireFirstDeclaration;
+  // public static String TextMarkerFormatterBlankLinesPage_beforeBlockDeclarations;
+  // public static String TextMarkerFormatterBlankLinesPage_betweenBlocks;
+  public static String TextMarkerFormatterBlankLinesPage_blankLinesBeforeDeclarations;
+
+  public static String TextMarkerFormatterBlankLinesPage_beforeDeclarations;
+
+  // public static String TextMarkerFormatterBlankLinesPage_existingBlankLines;
+  // public static String TextMarkerFormatterBlankLinesPage_numberOfEmptyLinesToPreserve;
+  // public static String TextMarkerFormatterCommentsPage_commentFormatting;
+  // public static String TextMarkerFormatterCommentsPage_enableCommentWrapping;
+  // public static String TextMarkerFormatterCommentsPage_maximumLineWidthForComments;
+  public static String TextMarkerFormatterLineWrappingPage_maximumLineLenght;
+
+  public static String TextMarkerFormatterLineWrappingPage_generalWrapping;
+
+  public static String TextMarkerFormatterIndentationTabPage_statementsWithinBlockBody;
+
+  public static String TextMarkerFormatterIndentationTabPage_assignmentsWithinCreateAction;
+
+  public static String TextMarkerFormatterIndentationTabPage_generalSettings;
+
+  public static String TextMarkerFormatterIndentationTabPage_indentationCharacter;
+
+  public static String TextMarkerFormatterIndentationTabPage_indentationSize;
+
+  public static String TextMarkerFormatterIndentationTabPage_indentWithinBlocks;
+
+  public static String TextMarkerFormatterIndentationTabPage_indentWithinCreateActions;
+
+  public static String TextMarkerFormatterIndentationTabPage_tabSize;
+
+  public static String TextMarkerFormatterModifyDialog_blankLines;
+
+  // public static String TextMarkerFormatterModifyDialog_comments;
+  public static String TextMarkerFormatterModifyDialog_indentation;
+
+  public static String TextMarkerFormatterModifyDialog_lineWrapping;
+
+  public static String TextMarkerFormatterModifyDialog_TextMarkerFormatter;
+  static {
+    // initialize resource bundle
+    NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+  }
+
+  private Messages() {
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/preferences/Messages.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/preferences/Messages.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain