org.eclipse.wst.xml.ui_1.1.202.v201112071516

16:49:33.800 INFO  jd.cli.Main - Decompiling org.eclipse.wst.xml.ui_1.1.202.v201112071516.jar
package org.eclipse.wst.xml.ui;

import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider;
import org.w3c.dom.Attr;
import org.w3c.dom.Node;

class StructuredTextViewerConfigurationXML$1
  extends JFaceNodeLabelProvider
{
  final StructuredTextViewerConfigurationXML this$0;
  
  StructuredTextViewerConfigurationXML$1(StructuredTextViewerConfigurationXML paramStructuredTextViewerConfigurationXML)
  {
    this$0 = paramStructuredTextViewerConfigurationXML;
  }
  
  public String getText(Object element)
  {
    if (element == null) {
      return null;
    }
    StringBuffer s = new StringBuffer();
    Node node = (Node)element;
    while (node != null)
    {
      if (node.getNodeType() != 9) {
        s.insert(0, super.getText(node));
      }
      if (node.getNodeType() == 2) {
        node = ((Attr)node).getOwnerElement();
      } else {
        node = node.getParentNode();
      }
      if ((node != null) && (node.getNodeType() != 9)) {
        s.insert(0, '/');
      }
    }
    return s.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.formatter.IContentFormatter;
import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
import org.eclipse.wst.xml.core.internal.provisional.contenttype.ContentTypeIdForXML;
import org.eclipse.wst.xml.core.internal.text.rules.StructuredTextPartitionerForXML;
import org.eclipse.wst.xml.ui.internal.XMLFormattingStrategy;
import org.eclipse.wst.xml.ui.internal.autoedit.AutoEditStrategyForTabs;
import org.eclipse.wst.xml.ui.internal.contentassist.XMLStructuredContentAssistProcessor;
import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider;
import org.eclipse.wst.xml.ui.internal.style.LineStyleProviderForXML;
import org.w3c.dom.Attr;
import org.w3c.dom.Node;

public class StructuredTextViewerConfigurationXML
  extends StructuredTextViewerConfiguration
{
  private String[] fConfiguredContentTypes;
  private LineStyleProvider fLineStyleProviderForXML;
  private ILabelProvider fStatusLineLabelProvider;
  
  public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType)
  {
    List allStrategies = new ArrayList(0);
    
    IAutoEditStrategy[] superStrategies = super.getAutoEditStrategies(sourceViewer, contentType);
    for (int i = 0; i < superStrategies.length; i++) {
      allStrategies.add(superStrategies[i]);
    }
    allStrategies.add(new AutoEditStrategyForTabs());
    
    return (IAutoEditStrategy[])allStrategies.toArray(new IAutoEditStrategy[allStrategies.size()]);
  }
  
  public String[] getConfiguredContentTypes(ISourceViewer sourceViewer)
  {
    if (fConfiguredContentTypes == null)
    {
      String[] xmlTypes = StructuredTextPartitionerForXML.getConfiguredContentTypes();
      fConfiguredContentTypes = new String[xmlTypes.length + 2];
      fConfiguredContentTypes[0] = "org.eclipse.wst.sse.ST_DEFAULT";
      fConfiguredContentTypes[1] = "org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE";
      int index = 0;
      index += 2;System.arraycopy(xmlTypes, 0, fConfiguredContentTypes, index, xmlTypes.length);
    }
    return fConfiguredContentTypes;
  }
  
  protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType)
  {
    IContentAssistProcessor processor = new XMLStructuredContentAssistProcessor(
      getContentAssistant(), partitionType, sourceViewer);
    return new IContentAssistProcessor[] { processor };
  }
  
  public IContentFormatter getContentFormatter(ISourceViewer sourceViewer)
  {
    IContentFormatter formatter = super.getContentFormatter(sourceViewer);
    if (!(formatter instanceof MultiPassContentFormatter)) {
      formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), "org.eclipse.wst.xml.XML_DEFAULT");
    }
    ((MultiPassContentFormatter)formatter).setMasterStrategy(new XMLFormattingStrategy());
    
    return formatter;
  }
  
  public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType)
  {
    Vector vector = new Vector();
    
    Preferences preferences = XMLCorePlugin.getDefault().getPluginPreferences();
    int indentationWidth = preferences.getInt("indentationSize");
    String indentCharPref = preferences.getString("indentationChar");
    boolean useSpaces = "space".equals(indentCharPref);
    for (int i = 0; i <= indentationWidth; i++)
    {
      StringBuffer prefix = new StringBuffer();
      boolean appendTab = false;
      if (useSpaces)
      {
        for (int j = 0; j + i < indentationWidth; j++) {
          prefix.append(' ');
        }
        if (i != 0) {
          appendTab = true;
        }
      }
      else
      {
        for (int j = 0; j < i; j++) {
          prefix.append(' ');
        }
        if (i != indentationWidth) {
          appendTab = true;
        }
      }
      if (appendTab)
      {
        prefix.append('\t');
        vector.add(prefix.toString());
        
        prefix.deleteCharAt(prefix.length() - 1);
      }
      vector.add(prefix.toString());
    }
    vector.add("");
    
    return (String[])vector.toArray(new String[vector.size()]);
  }
  
  public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType)
  {
    LineStyleProvider[] providers = (LineStyleProvider[])null;
    if ((partitionType == "org.eclipse.wst.xml.XML_DEFAULT") || (partitionType == "org.eclipse.wst.xml.XML_CDATA") || (partitionType == "org.eclipse.wst.xml.XML_COMMENT") || (partitionType == "org.eclipse.wst.xml.XML_DECL") || (partitionType == "org.eclipse.wst.xml.XML_PI")) {
      providers = new LineStyleProvider[] { getLineStyleProviderForXML() };
    }
    return providers;
  }
  
  private LineStyleProvider getLineStyleProviderForXML()
  {
    if (fLineStyleProviderForXML == null) {
      fLineStyleProviderForXML = new LineStyleProviderForXML();
    }
    return fLineStyleProviderForXML;
  }
  
  public ILabelProvider getStatusLineLabelProvider(ISourceViewer sourceViewer)
  {
    if (fStatusLineLabelProvider == null) {
      fStatusLineLabelProvider = new JFaceNodeLabelProvider()
      {
        public String getText(Object element)
        {
          if (element == null) {
            return null;
          }
          StringBuffer s = new StringBuffer();
          Node node = (Node)element;
          while (node != null)
          {
            if (node.getNodeType() != 9) {
              s.insert(0, super.getText(node));
            }
            if (node.getNodeType() == 2) {
              node = ((Attr)node).getOwnerElement();
            } else {
              node = node.getParentNode();
            }
            if ((node != null) && (node.getNodeType() != 9)) {
              s.insert(0, '/');
            }
          }
          return s.toString();
        }
      };
    }
    return fStatusLineLabelProvider;
  }
  
  protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer)
  {
    Map targets = super.getHyperlinkDetectorTargets(sourceViewer);
    targets.put(ContentTypeIdForXML.ContentTypeID_XML, null);
    return targets;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

abstract class DOMObserver$DocumentAdapter
  implements INodeAdapter
{
  final DOMObserver this$0;
  
  public DOMObserver$DocumentAdapter(DOMObserver paramDOMObserver)
  {
    this$0 = paramDOMObserver;
  }
  
  public void connect(Document document)
  {
    ((INodeNotifier)document).addAdapter(this);
    adapt(document.getDocumentElement());
  }
  
  public void dicconnect(Document document)
  {
    ((INodeNotifier)document).removeAdapter(this);
  }
  
  public void adapt(Element element)
  {
    if ((element != null) && 
      (((INodeNotifier)element).getExistingAdapter(this) == null))
    {
      ((INodeNotifier)element).addAdapter(this);
      for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
        if (child.getNodeType() == 1) {
          adapt((Element)child);
        }
      }
    }
  }
  
  public boolean isAdapterForType(Object type)
  {
    return type == this;
  }
  
  public abstract void notifyChanged(INodeNotifier paramINodeNotifier, int paramInt1, Object paramObject1, Object paramObject2, Object paramObject3, int paramInt2);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.internal.DOMObserver.DocumentAdapter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

class DOMObserver$MyDocumentAdapter
  extends DOMObserver.DocumentAdapter
{
  final DOMObserver this$0;
  
  DOMObserver$MyDocumentAdapter(DOMObserver paramDOMObserver)
  {
    super(paramDOMObserver);this$0 = paramDOMObserver;
  }
  
  public void notifyChanged(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
  {
    switch (eventType)
    {
    case 2: 
      if ((newValue instanceof Element)) {
        adapt((Element)newValue);
      }
      break;
    case 1: 
    case 4: 
    case 5: 
      Node node = (Node)notifier;
      if (node.getNodeType() == 1) {
        switch (eventType)
        {
        case 1: 
        case 4: 
          this$0.invokeDelayedCMDocumentLoad();
          break;
        }
      } else if (node.getNodeType() == 9) {
        this$0.invokeDelayedCMDocumentLoad();
      }
      break;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.internal.DOMObserver.MyDocumentAdapter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.wst.sse.ui.internal.SSEUIMessages;

class DOMObserver$TimerJob
  extends Job
{
  final DOMObserver this$0;
  
  public DOMObserver$TimerJob(DOMObserver paramDOMObserver)
  {
    super(SSEUIMessages.LoadingReferencedGrammars);
    this$0 = paramDOMObserver;
  }
  
  public IStatus run(IProgressMonitor monitor)
  {
    monitor.beginTask("", -1);
    Thread.currentThread().setPriority(1);
    this$0.invokeCMDocumentLoad();
    monitor.done();
    return Status.OK_STATUS;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.internal.DOMObserver.TimerJob
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.CMDocumentManager;
import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
import org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.CMDocumentLoader;
import org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.InferredGrammarBuildingCMDocumentLoader;
import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class DOMObserver
{
  abstract class DocumentAdapter
    implements INodeAdapter
  {
    public DocumentAdapter() {}
    
    public void connect(Document document)
    {
      ((INodeNotifier)document).addAdapter(this);
      adapt(document.getDocumentElement());
    }
    
    public void dicconnect(Document document)
    {
      ((INodeNotifier)document).removeAdapter(this);
    }
    
    public void adapt(Element element)
    {
      if ((element != null) && 
        (((INodeNotifier)element).getExistingAdapter(this) == null))
      {
        ((INodeNotifier)element).addAdapter(this);
        for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
          if (child.getNodeType() == 1) {
            adapt((Element)child);
          }
        }
      }
    }
    
    public boolean isAdapterForType(Object type)
    {
      return type == this;
    }
    
    public abstract void notifyChanged(INodeNotifier paramINodeNotifier, int paramInt1, Object paramObject1, Object paramObject2, Object paramObject3, int paramInt2);
  }
  
  class MyDocumentAdapter
    extends DOMObserver.DocumentAdapter
  {
    MyDocumentAdapter()
    {
      super();
    }
    
    public void notifyChanged(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
    {
      switch (eventType)
      {
      case 2: 
        if ((newValue instanceof Element)) {
          adapt((Element)newValue);
        }
        break;
      case 1: 
      case 4: 
      case 5: 
        Node node = (Node)notifier;
        if (node.getNodeType() == 1) {
          switch (eventType)
          {
          case 1: 
          case 4: 
            invokeDelayedCMDocumentLoad();
            break;
          }
        } else if (node.getNodeType() == 9) {
          invokeDelayedCMDocumentLoad();
        }
        break;
      }
    }
  }
  
  class TimerJob
    extends Job
  {
    public TimerJob()
    {
      super();
    }
    
    public IStatus run(IProgressMonitor monitor)
    {
      monitor.beginTask("", -1);
      Thread.currentThread().setPriority(1);
      invokeCMDocumentLoad();
      monitor.done();
      return Status.OK_STATUS;
    }
  }
  
  private Job timer = new TimerJob();
  protected Document fDocument;
  protected boolean isGrammarInferenceEnabled;
  private boolean fIsDisabled = false;
  private boolean fIsLoading = false;
  
  public DOMObserver(IStructuredModel model)
  {
    fDocument = ((model instanceof IDOMModel) ? ((IDOMModel)model).getDocument() : null);
    if (fDocument != null)
    {
      MyDocumentAdapter adapter = new MyDocumentAdapter();
      adapter.connect(fDocument);
      
      ModelQuery modelQuery = ModelQueryUtil.getModelQuery(fDocument);
      if ((modelQuery != null) && (modelQuery.getCMDocumentManager() != null))
      {
        CMDocumentManager cmDocumentManager = modelQuery.getCMDocumentManager();
        cmDocumentManager.setPropertyEnabled("autoLoad", false);
      }
      INodeAdapter domObserverAdapter = ((INodeNotifier)fDocument).getExistingAdapter(DOMObserverAdapter.class);
      if (domObserverAdapter == null)
      {
        domObserverAdapter = new DOMObserverAdapter();
        ((INodeNotifier)fDocument).addAdapter(domObserverAdapter);
      }
      ((DOMObserverAdapter)domObserverAdapter).setDOMObserver(this);
    }
  }
  
  public void init()
  {
    timer.schedule();
  }
  
  public void invokeCMDocumentLoad()
  {
    if (fIsDisabled) {
      return;
    }
    try
    {
      fIsLoading = true;
      
      ModelQuery modelQuery = ModelQueryUtil.getModelQuery(fDocument);
      if ((modelQuery != null) && (modelQuery.getCMDocumentManager() != null))
      {
        CMDocumentLoader loader = isGrammarInferenceEnabled ? new InferredGrammarBuildingCMDocumentLoader(fDocument, modelQuery) : new CMDocumentLoader(fDocument, modelQuery);
        loader.loadCMDocuments();
      }
    }
    finally
    {
      fIsLoading = false;
    }
  }
  
  public void invokeDelayedCMDocumentLoad()
  {
    if (fIsDisabled) {
      return;
    }
    timer.schedule(2000L);
  }
  
  public void setGrammarInferenceEnabled(boolean isEnabled)
  {
    isGrammarInferenceEnabled = isEnabled;
  }
  
  boolean setDisabled(boolean isDisabled, boolean forced)
  {
    boolean success = true;
    if (fIsDisabled != isDisabled)
    {
      fIsDisabled = isDisabled;
      if (forced) {
        if (isDisabled) {
          success = timer.cancel();
        } else {
          invokeCMDocumentLoad();
        }
      }
    }
    return success;
  }
  
  boolean isLoading()
  {
    return fIsLoading;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.internal.DOMObserver
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;

public class DOMObserverAdapter
  implements INodeAdapter
{
  private DOMObserver fObserver = null;
  
  public boolean isAdapterForType(Object type)
  {
    return type == DOMObserverAdapter.class;
  }
  
  public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {}
  
  void setDOMObserver(DOMObserver observer)
  {
    fObserver = observer;
  }
  
  public boolean disableObserver(boolean disable, boolean force)
  {
    return fObserver.setDisabled(disable, force);
  }
  
  public boolean isObserverLoading()
  {
    return fObserver.isLoading();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.internal.DOMObserverAdapter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

public abstract interface IProductConstants
{
  public static final String PERSPECTIVE_EXPLORER_VIEW = "idPerspectiveHierarchyView";
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.internal.IProductConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

import com.ibm.icu.util.StringTokenizer;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.Bundle;

public class Logger
{
  private static final String PLUGIN_ID = "org.eclipse.wst.xml.ui";
  public static final int ERROR = 4;
  public static final int ERROR_DEBUG = 204;
  public static final int INFO = 1;
  public static final int INFO_DEBUG = 201;
  public static final int OK = 0;
  public static final int OK_DEBUG = 200;
  private static final String TRACEFILTER_LOCATION = "/debug/tracefilter";
  public static final int WARNING = 2;
  public static final int WARNING_DEBUG = 202;
  
  protected static void _log(int level, String message, Throwable exception)
  {
    if (((level == 200) || (level == 201) || (level == 202) || (level == 204)) && 
      (!isDebugging())) {
      return;
    }
    int severity = 0;
    switch (level)
    {
    case 1: 
    case 201: 
      severity = 1;
      break;
    case 2: 
    case 202: 
      severity = 2;
      break;
    case 4: 
    case 204: 
      severity = 4;
    }
    message = message != null ? message : "null";
    Status statusObj = new Status(severity, "org.eclipse.wst.xml.ui", severity, message, exception);
    Bundle bundle = Platform.getBundle("org.eclipse.wst.xml.ui");
    if (bundle != null) {
      Platform.getLog(bundle).log(statusObj);
    }
  }
  
  protected static void _trace(String category, String message, Throwable exception)
  {
    if (isTracing(category))
    {
      message = message != null ? message : "null";
      Status statusObj = new Status(0, "org.eclipse.wst.xml.ui", 0, message, exception);
      Bundle bundle = Platform.getBundle("org.eclipse.wst.xml.ui");
      if (bundle != null) {
        Platform.getLog(bundle).log(statusObj);
      }
    }
  }
  
  public static boolean isDebugging()
  {
    return Platform.inDebugMode();
  }
  
  public static boolean isTracing(String category)
  {
    if (!isDebugging()) {
      return false;
    }
    String traceFilter = Platform.getDebugOption("org.eclipse.wst.xml.ui/debug/tracefilter");
    if (traceFilter != null)
    {
      StringTokenizer tokenizer = new StringTokenizer(traceFilter, ",");
      while (tokenizer.hasMoreTokens())
      {
        String cat = tokenizer.nextToken().trim();
        if (category.equals(cat)) {
          return true;
        }
      }
    }
    return false;
  }
  
  public static void log(int level, String message)
  {
    _log(level, message, null);
  }
  
  public static void log(int level, String message, Throwable exception)
  {
    _log(level, message, exception);
  }
  
  public static void logException(String message, Throwable exception)
  {
    _log(4, message, exception);
  }
  
  public static void logException(Throwable exception)
  {
    _log(4, exception.getMessage(), exception);
  }
  
  public static void trace(String category, String message)
  {
    _trace(category, message, null);
  }
  
  public static void traceException(String category, String message, Throwable exception)
  {
    _trace(category, message, exception);
  }
  
  public static void traceException(String category, Throwable exception)
  {
    _trace(category, exception.getMessage(), exception);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.internal.Logger
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

import org.eclipse.core.runtime.IProduct;
import org.eclipse.core.runtime.Platform;

public class ProductProperties
{
  static final String ID_PERSPECTIVE_EXPLORER_VIEW = "org.eclipse.ui.navigator.ProjectExplorer";
  
  public static String getProperty(String key)
  {
    if (key == null) {
      return null;
    }
    String value = null;
    if (Platform.getProduct() != null) {
      value = Platform.getProduct().getProperty(key);
    }
    if ((value == null) && 
      (key.equals("idPerspectiveHierarchyView"))) {
      return "org.eclipse.ui.navigator.ProjectExplorer";
    }
    return value;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.internal.ProductProperties
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

import java.util.LinkedList;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.TypedPosition;
import org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy;
import org.eclipse.jface.text.formatter.IFormattingContext;
import org.eclipse.jface.text.formatter.IFormattingStrategyExtension;
import org.eclipse.text.edits.TextEdit;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.ui.internal.Logger;
import org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter;

public class XMLFormattingStrategy
  extends ContextBasedFormattingStrategy
  implements IFormattingStrategyExtension
{
  private final LinkedList fDocuments = new LinkedList();
  private final LinkedList fPartitions = new LinkedList();
  private IRegion fRegion;
  private DefaultXMLPartitionFormatter formatter = new DefaultXMLPartitionFormatter();
  
  public void format()
  {
    super.format();
    
    IDocument document = (IDocument)fDocuments.removeFirst();
    TypedPosition partition = (TypedPosition)fPartitions.removeFirst();
    if ((document != null) && (partition != null) && (fRegion != null)) {
      try
      {
        if ((document instanceof IStructuredDocument))
        {
          IStructuredModel model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument)document);
          if (model != null) {
            try
            {
              TextEdit edit = formatter.format(model, fRegion.getOffset(), fRegion.getLength());
              if (edit != null) {
                try
                {
                  model.aboutToChangeModel();
                  edit.apply(document);
                }
                finally
                {
                  model.changedModel();
                }
              }
            }
            finally
            {
              model.releaseFromEdit();
            }
          }
        }
      }
      catch (BadLocationException e)
      {
        Logger.log(1, e.getMessage());
      }
    }
  }
  
  public void formatterStarts(IFormattingContext context)
  {
    super.formatterStarts(context);
    
    fPartitions.addLast(context.getProperty("formatting.context.partition"));
    fDocuments.addLast(context.getProperty("formatting.context.medium"));
    fRegion = ((IRegion)context.getProperty("formatting.context.region"));
  }
  
  public void formatterStops()
  {
    super.formatterStops();
    
    fPartitions.clear();
    fDocuments.clear();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.xml.ui.internal.XMLFormattingStrategy
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.xml.ui.internal;

import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.osgi.util.NLS;

public class XMLUIMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.xml.ui.internal.XMLUIPluginResources";
  private static ResourceBundle fResourceBundle;
  public static String Sample_XML_doc;
  public static String Comment_Delimiters_UI_;
  public static String Comment_Content_UI_;
  public static String Tag_Delimiters_UI_;
  public static String Tag_Names_UI_;
  public static String Attribute_Names_UI_;
  public static String Attribute_Equals_UI_;
  public static String Attribute_Values_UI_;
  public static String Declaration_Delimiters_UI_;
  public static String Content_UI_;
  public static String CDATA_Delimiters_UI_;
  public static String CDATA_Content_UI_;
  public static String Processing_Instruction_Del_UI_;
  public static String Processing_Instruction_Con_UI__UI_;
  public static String DOCTYPE_Name_UI_;
  public static String DOCTYPE_SYSTEM_PUBLIC_Keyw_UI_;
  public static String DOCTYPE_Public_Reference_UI_;
  public static String DOCTYPE_System_Reference_UI_;
  public static String Entity_Reference_UI_;
  public static String DELETE;
  public static String ADD_PROCESSING_INSTRUCTION;
  public static String _UI_MENU_ADD_AFTER;
  public static String _UI_MENU_ADD_ATTRIBUTE;
  public static String _UI_MENU_ADD_BEFORE;
  public static String _UI_MENU_ADD_CHILD;
  public static String _UI_MENU_REMOVE;
  public static String _UI_MENU_REPLACE_WITH;
  public static String _UI_MENU_EDIT_DOCTYPE;
  public static String _UI_LABEL_UNDO_REPLACE_DESCRIPTION;
  public static String _UI_LABEL_EDIT_DOCTYPE;
  public static String _UI_INFO_EXPAND_ALL;
  public static String _UI_INFO_COLLAPSE_ALL;
  public static String _UI_MENU_ADD_DTD_INFORMATION;
  public static String _UI_MENU_ADD_SCHEMA_INFORMATION;
  public static String _UI_MENU_EDIT_PROCESSING_INSTRUCTION;
  public static String _UI_MENU_EDIT_NAMESPACES;
  public static String _UI_MENU_ADD_DTD_INFORMATION_TITLE;
  public static String _UI_MENU_EDIT_PROCESSING_INSTRUCTION_TITLE;
  public static String _UI_MENU_EDIT_SCHEMA_INFORMATION_TITLE;
  public static String _UI_MENU_NEW_ATTRIBUTE;
  public static String _UI_MENU_NEW_ATTRIBUTE_TITLE;
  public static String _UI_MENU_EDIT_ATTRIBUTE;
  public static String _UI_MENU_EDIT_ATTRIBUTE_TITLE;
  public static String _UI_MENU_NEW_ELEMENT;
  public static String _UI_MENU_NEW_ELEMENT_TITLE;
  public static String _UI_MENU_RENAME;
  public static String _UI_MENU_RENAME_TITLE;
  public static String _UI_LABEL_ELEMENT_NAME;
  public static String _UI_MENU_ADD_COMMENT;
  public static String _UI_MENU_ADD_PROCESSING_INSTRUCTION;
  public static String _UI_MENU_ADD_CDATA_SECTION;
  public static String _UI_MENU_ADD_PCDATA;
  public static String _UI_MENU_COMMENT;
  public static String _UI_MENU_PROCESSING_INSTRUCTION;
  public static String _UI_MENU_CDATA_SECTION;
  public static String _UI_MENU_PCDATA;
  public static String _UI_MENU_ADD;
  public static String _UI_COMMENT_VALUE;
  public static String _UI_PI_TARGET_VALUE;
  public static String _UI_PI_DATA_VALUE;
  public static String _UI_LABEL_ROOT_ELEMENT_VALUE;
  public static String _UI_LABEL_TARGET_COLON;
  public static String _UI_LABEL_DATA_COLON;
  public static String _UI_LABEL_ROOT_ELEMENT_NAME_COLON;
  public static String _UI_LABEL_PUBLIC_ID_COLON;
  public static String _UI_LABEL_SYSTEM_ID_COLON;
  public static String _UI_LABEL_BROWSE;
  public static String _UI_LABEL_BROWSE_1;
  public static String _UI_LABEL_SELECT_XML_CATALOG_ENTRY;
  public static String _UI_LABEL_SPECIFY_SYSTEM_ID;
  public static String _UI_LABEL_SELECT_FILE;
  public static String _UI_LABEL_KEY;
  public static String _UI_LABEL_URI;
  public static String _UI_LABEL_XML_CATALOG_COLON;
  public static String _UI_LABEL_NAMESPACE_NAME;
  public static String _UI_LABEL_LOCATION_HINT;
  public static String _UI_LABEL_PREFIX;
  public static String _UI_LABEL_NAMESPACE_NAME_COLON;
  public static String _UI_LABEL_LOCATION_HINT_COLON;
  public static String _UI_LABEL_PREFIX_COLON;
  public static String _UI_NO_NAMESPACE_NAME;
  public static String _UI_NO_PREFIX;
  public static String _UI_LABEL_XML_SCHEMA_INFORMATION;
  public static String _UI_LABEL_NAME_COLON;
  public static String _UI_LABEL_VALUE_COLON;
  public static String _UI_BUTTON_DELETE;
  public static String _UI_BUTTON_NEW;
  public static String _UI_BUTTON_EDIT;
  public static String _UI_LABEL_NEW_NAMESPACE_INFORMATION;
  public static String _UI_RADIO_BUTTON_SELECT_FROM_WORKSPACE;
  public static String _UI_RADIO_BUTTON_SELECT_FROM_CATALOG;
  public static String _UI_WARNING_MORE_THAN_ONE_NS_WITH_NAME;
  public static String _UI_WARNING_MORE_THAN_ONE_NS_WITHOUT_NAME;
  public static String _UI_WARNING_MORE_THAN_ONE_NS_WITHOUT_PREFIX;
  public static String _UI_WARNING_MORE_THAN_ONE_NS_WITH_PREFIX;
  public static String _UI_WARNING_SCHEMA_CAN_NOT_BE_LOCATED;
  public static String _UI_WARNING_LOCATION_HINT_NOT_SPECIFIED;
  public static String _UI_WARNING_NAMESPACE_NAME_NOT_SPECIFIED;
  public static String _UI_WARNING_PREFIX_NOT_SPECIFIED;
  public static String _UI_WARNING_ROOT_ELEMENT_MUST_BE_SPECIFIED;
  public static String _UI_WARNING_SYSTEM_ID_MUST_BE_SPECIFIED;
  public static String _UI_INVALID_NAME;
  public static String _UI_ENTER_REQ_PREFIX_AND_NAMESPACE;
  public static String _UI_SELECT_REGISTERED_NAMESPACES;
  public static String _UI_SPECIFY_NEW_NAMESPACE;
  public static String _UI_SELECT_NAMESPACE_TO_ADD;
  public static String _UI_ADD_NAMESPACE_DECLARATIONS;
  public static String _UI_NAMESPACE_DECLARATIONS;
  public static String _UI_TARGET_NAMESPACE;
  public static String _ERROR_XML_ATTRIBUTE_ALREADY_EXISTS;
  public static String _ERROR_XML_ATTRIBUTE_IS_INVALID;
  public static String error_message_goes_here;
  public static String SurroundWithNewElementQuickAssistProposal_0;
  public static String SurroundWithNewElementQuickAssistProposal_1;
  public static String RenameInFileQuickAssistProposal_0;
  public static String RenameInFileQuickAssistProposal_1;
  public static String InsertRequiredAttrsQuickAssistProposal_0;
  public static String InsertRequiredAttrsQuickAssistProposal_1;
  public static String EncodingSettings_0;
  public static String EncodingSettings_1;
  public static String DragNodeCommand_0;
  public static String DragNodeCommand_1;
  public static String CommonEditNamespacesDialog_0;
  public static String JFaceNodeAdapter_1;
  public static String QuickFixProcessorXML_0;
  public static String QuickFixProcessorXML_1;
  public static String QuickFixProcessorXML_2;
  public static String QuickFixProcessorXML_3;
  public static String QuickFixProcessorXML_4;
  public static String QuickFixProcessorXML_5;
  public static String QuickFixProcessorXML_6;
  public static String QuickFixProcessorXML_7;
  public static String QuickFixProcessorXML_8;
  public static String QuickFixProcessorXML_9;
  public static String QuickFixProcessorXML_10;
  public static String QuickFixProcessorXML_11;
  public static String QuickFixProcessorXML_12;
  public static String QuickFixProcessorXML_13;
  public static String QuickFixProcessorXML_14;
  public static String QuickFixProcessorXML_15;
  public static String XMLPropertySourceAdapter_0;
  public static String WorkbenchDefaultEncodingSettings_0;
  public static String refreshoutline_0;
  public static String Creating_files_encoding;
  public static String End_tag_has_attributes;
  public static String Attribute__is_missing_a_value;
  public static String Attribute__has_no_value;
  public static String Missing_end_tag_;
  public static String Missing_start_tag_;
  public static String ReconcileStepForMarkup_0;
  public static String ReconcileStepForMarkup_1;
  public static String ReconcileStepForMarkup_2;
  public static String ReconcileStepForMarkup_3;
  public static String ReconcileStepForMarkup_4;
  public static String ReconcileStepForMarkup_5;
  public static String ReconcileStepForMarkup_6;
  public static String End_with_;
  public static String SEVERE_internal_error_occu_UI_;
  public static String No_known_attribute__UI_;
  public static String Content_Assist_not_availab_UI_;
  public static String Element__is_unknown;
  public static String Comment__;
  public static String Close_with__;
  public static String End_with__;
  public static String Close_with___;
  public static String Close_with____;
  public static String _Has_no_available_child;
  public static String No_known_child_tag;
  public static String __Has_no_known_child;
  public static String No_known_child_tag_names;
  public static String The_document_element__;
  public static String No_definition_for_in;
  public static String No_definition_for;
  public static String No_content_model_for;
  public static String No_content_model_found_UI_;
  public static String Cleanup_UI_;
  public static String Compress_empty_element_tags_UI_;
  public static String Insert_required_attributes_UI_;
  public static String Insert_missing_tags_UI_;
  public static String Quote_attribute_values_UI_;
  public static String Format_source_UI_;
  public static String Convert_EOL_codes_UI_;
  public static String Insert_XML_decl;
  public static String EOL_Windows_UI;
  public static String EOL_Unix_UI;
  public static String EOL_Mac_UI;
  public static String Creating_files;
  public static String Encoding_desc;
  public static String Encoding;
  public static String Creating_or_saving_files;
  public static String End_of_line_code_desc;
  public static String End_of_line_code;
  public static String EOL_Windows;
  public static String EOL_Unix;
  public static String EOL_Mac;
  public static String EOL_NoTranslation;
  public static String XMLFilesPreferencePage_ExtensionLabel;
  public static String XMLFilesPreferencePage_ExtensionError;
  public static String XMLContentAssistPreferencePage_Auto_Activation_UI_;
  public static String XMLContentAssistPreferencePage_Cycling_UI_;
  public static String Automatically_make_suggest_UI_;
  public static String Auto_Activation_Delay;
  public static String Not_an_integer;
  public static String Missing_integer;
  public static String Prompt_when_these_characte_UI_;
  public static String Formatting_UI_;
  public static String Line_width__UI_;
  public static String Split_multiple_attributes;
  public static String Align_final_bracket;
  public static String Preserve_PCDATA_Content;
  public static String Space_before_empty_close_tag;
  public static String Indent_using_tabs;
  public static String Indent_using_spaces;
  public static String Indentation_size;
  public static String Indentation_size_tip;
  public static String Clear_all_blank_lines_UI_;
  public static String Format_comments;
  public static String Format_comments_join_lines;
  public static String Grammar_Constraints;
  public static String Use_inferred_grammar_in_absence_of;
  public static String Suggestion_Strategy;
  public static String Suggestion_Strategy_Lax;
  public static String Suggestion_Strategy_Strict;
  public static String Element____1;
  public static String Content_Model____2;
  public static String Attribute____3;
  public static String Data_Type____4;
  public static String Enumerated_Values____5;
  public static String Default_Value____6;
  public static String Documentation_view_default_msg;
  public static String SourceMenu_label;
  public static String Comment_label;
  public static String Comment_tooltip;
  public static String Comment_description;
  public static String Uncomment_label;
  public static String Uncomment_tooltip;
  public static String Uncomment_description;
  public static String ToggleComment_label;
  public static String ToggleComment_tooltip;
  public static String ToggleComment_description;
  public static String AddBlockComment_label;
  public static String AddBlockComment_tooltip;
  public static String AddBlockComment_description;
  public static String RemoveBlockComment_label;
  public static String RemoveBlockComment_tooltip;
  public static String RemoveBlockComment_description;
  public static String CleanupDocument_label;
  public static String CleanupDocument_tooltip;
  public static String CleanupDocument_description;
  public static String FindOccurrences_label;
  public static String OpenFileFromSource_label;
  public static String OpenFileFromSource_tooltip;
  public static String OpenFileFromSource_description;
  public static String XMLContentOutlineConfiguration_0;
  public static String XMLTyping_Auto_Complete;
  public static String XMLTyping_Auto_Remove;
  public static String XMLTyping_Complete_Comments;
  public static String XMLTyping_Close_Strings;
  public static String XMLTyping_Close_Brackets;
  public static String XMLTyping_Complete_End_Tags;
  public static String XMLTyping_Complete_Elements;
  public static String XMLTyping_Remove_End_Tags;
  public static String XMLTyping_Start_Tag;
  public static String XMLTyping_End_Tag;
  public static String StructureSelectEnclosing_label;
  public static String StructureSelectEnclosing_tooltip;
  public static String StructureSelectEnclosing_description;
  public static String StructureSelectNext_label;
  public static String StructureSelectNext_tooltip;
  public static String StructureSelectNext_description;
  public static String StructureSelectPrevious_label;
  public static String StructureSelectPrevious_tooltip;
  public static String StructureSelectPrevious_description;
  public static String MESSAGE_XML_VALIDATION_MESSAGE_UI_;
  public static String Indicate_no_grammar_specified;
  public static String Indicate_no_document_element;
  public static String Indicate_no_grammar_specified_severities_error;
  public stati
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd