org.eclipse.ant.ui_3.5.101.v20120110-1739

16:41:22.125 INFO  jd.cli.Main - Decompiling org.eclipse.ant.ui_3.5.101.v20120110-1739.jar
package org.eclipse.ant.internal.ui;

import org.eclipse.ant.internal.ui.editor.text.XMLTextHover;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextDoubleClickStrategy;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.swt.graphics.Point;

public class AntDoubleClickStrategy
  implements ITextDoubleClickStrategy
{
  public void doubleClicked(ITextViewer textViewer)
  {
    int offset = getSelectedRangex;
    if (offset < 0) {
      return;
    }
    IRegion region = XMLTextHover.getRegion(textViewer, offset);
    if (region != null) {
      textViewer.setSelectedRange(region.getOffset(), region.getLength());
    }
  }
}

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

import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;

public class AntImageDescriptor
  extends CompositeImageDescriptor
{
  public static final int HAS_ERRORS = 1;
  public static final int IMPORTED = 2;
  public static final int HAS_WARNINGS = 4;
  private ImageDescriptor fBaseImage;
  private int fFlags;
  private Point fSize;
  
  public AntImageDescriptor(ImageDescriptor baseImage, int flags)
  {
    setBaseImage(baseImage);
    setFlags(flags);
  }
  
  protected Point getSize()
  {
    if (fSize == null)
    {
      ImageData data = getBaseImage().getImageData();
      setSize(new Point(width, height));
    }
    return fSize;
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof AntImageDescriptor)) {
      return false;
    }
    AntImageDescriptor other = (AntImageDescriptor)object;
    return (getBaseImage().equals(other.getBaseImage())) && (getFlags() == other.getFlags());
  }
  
  public int hashCode()
  {
    return getBaseImage().hashCode() | getFlags();
  }
  
  protected void drawCompositeImage(int width, int height)
  {
    ImageData bg = getBaseImage().getImageData();
    if (bg == null) {
      bg = DEFAULT_IMAGE_DATA;
    }
    drawImage(bg, 0, 0);
    drawOverlays();
  }
  
  protected void drawOverlays()
  {
    int flags = getFlags();
    int y = 0;
    ImageData data = null;
    if ((flags & 0x2) != 0)
    {
      data = AntUIImages.getImageDescriptor("org.eclipse.ant.ui.ovrImport").getImageData();
      drawImage(data, 0, 0);
    }
    if ((flags & 0x1) != 0)
    {
      y = getSizey;
      data = AntUIImages.getImageDescriptor("org.eclipse.ant.ui.ovrError").getImageData();
      y -= height;
      drawImage(data, 0, y);
    }
    else if ((flags & 0x4) != 0)
    {
      y = getSizey;
      data = AntUIImages.getImageDescriptor("org.eclipse.ant.ui.ovrWarning").getImageData();
      y -= height;
      drawImage(data, 0, y);
    }
  }
  
  protected ImageDescriptor getBaseImage()
  {
    return fBaseImage;
  }
  
  protected void setBaseImage(ImageDescriptor baseImage)
  {
    fBaseImage = baseImage;
  }
  
  protected int getFlags()
  {
    return fFlags;
  }
  
  protected void setFlags(int flags)
  {
    fFlags = flags;
  }
  
  protected void setSize(Point size)
  {
    fSize = size;
  }
}

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

import java.io.File;
import org.eclipse.ant.core.IAntPropertyValueProvider;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.JavaCore;

public class AntPropertyValueProvider
  implements IAntPropertyValueProvider
{
  public String getAntPropertyValue(String propertyName)
  {
    String value = null;
    if ("eclipse.target".equals(propertyName)) {
      try
      {
        IPath home = JavaCore.getClasspathVariable("ECLIPSE_HOME");
        if (home != null)
        {
          value = home.toFile().getAbsolutePath();
          if (value.endsWith("/")) {
            value = value.substring(0, value.length() - 1);
          }
        }
      }
      catch (Exception e)
      {
        AntUIPlugin.log(e);
      }
    }
    return value;
  }
}

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

import org.eclipse.ant.core.AntRunner;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.application.WorkbenchAdvisor;

public class AntRunnerWorkbenchAdvisor
  extends WorkbenchAdvisor
{
  private Object fContext;
  
  protected AntRunnerWorkbenchAdvisor(Object context)
  {
    fContext = context;
  }
  
  public String getInitialWindowPerspectiveId()
  {
    return null;
  }
  
  public void preStartup()
  {
    try
    {
      new AntRunner().run(fContext);
    }
    catch (Exception e)
    {
      AntUIPlugin.log(e);
    }
    try
    {
      ResourcesPlugin.getWorkspace().save(true, null);
    }
    catch (CoreException e)
    {
      AntUIPlugin.log(e.getStatus());
    }
  }
  
  public boolean openWindows()
  {
    return false;
  }
}

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

import org.eclipse.ant.internal.ui.editor.text.AntEditorProcInstrScanner;
import org.eclipse.ant.internal.ui.editor.text.AntEditorTagScanner;
import org.eclipse.ant.internal.ui.editor.text.MultilineDamagerRepairer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.StringConverter;
import org.eclipse.jface.text.ITextDoubleClickStrategy;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.presentation.IPresentationReconciler;
import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;

public class AntSourceViewerConfiguration
  extends TextSourceViewerConfiguration
{
  private AntEditorTagScanner tagScanner;
  private AntEditorProcInstrScanner instructionScanner;
  private MultilineDamagerRepairer damageRepairer;
  private MultilineDamagerRepairer dtdDamageRepairer;
  private TextAttribute xmlCommentAttribute;
  private TextAttribute xmlDtdAttribute;
  
  public AntSourceViewerConfiguration()
  {
    super(AntUIPlugin.getDefault().getCombinedPreferenceStore());
  }
  
  private AntEditorProcInstrScanner getDefaultScanner()
  {
    if (instructionScanner == null) {
      instructionScanner = new AntEditorProcInstrScanner();
    }
    return instructionScanner;
  }
  
  private AntEditorTagScanner getTagScanner()
  {
    if (tagScanner == null) {
      tagScanner = new AntEditorTagScanner();
    }
    return tagScanner;
  }
  
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer)
  {
    PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    
    MultilineDamagerRepairer dr = new MultilineDamagerRepairer(getDefaultScanner());
    reconciler.setDamager(dr, "__dftl_partition_content_type");
    reconciler.setRepairer(dr, "__dftl_partition_content_type");
    
    dr = new MultilineDamagerRepairer(getTagScanner());
    reconciler.setDamager(dr, "__xml_tag");
    reconciler.setRepairer(dr, "__xml_tag");
    
    int style = getStyle("org.eclipse.ant.ui.commentsColor");
    xmlCommentAttribute = new TextAttribute(AntUIPlugin.getPreferenceColor("org.eclipse.ant.ui.commentsColor"), null, style);
    damageRepairer = new MultilineDamagerRepairer(null, xmlCommentAttribute);
    reconciler.setDamager(damageRepairer, "__xml_comment");
    reconciler.setRepairer(damageRepairer, "__xml_comment");
    
    style = getStyle("org.eclipse.ant.ui.dtdColor");
    xmlDtdAttribute = new TextAttribute(AntUIPlugin.getPreferenceColor("org.eclipse.ant.ui.dtdColor"), null, style);
    dtdDamageRepairer = new MultilineDamagerRepairer(null, xmlDtdAttribute);
    reconciler.setDamager(dtdDamageRepairer, "__xml_dtd");
    reconciler.setRepairer(dtdDamageRepairer, "__xml_dtd");
    
    return reconciler;
  }
  
  private int getStyle(String pref)
  {
    int style = 0;
    if (fPreferenceStore.getBoolean(pref + "_bold")) {
      style |= 0x1;
    }
    if (fPreferenceStore.getBoolean(pref + "_italic")) {
      style |= 0x2;
    }
    return style;
  }
  
  public void adaptToPreferenceChange(PropertyChangeEvent event)
  {
    if (tagScanner == null) {
      return;
    }
    tagScanner.adaptToPreferenceChange(event);
    instructionScanner.adaptToPreferenceChange(event);
    String property = event.getProperty();
    if (property.startsWith("org.eclipse.ant.ui.commentsColor")) {
      xmlCommentAttribute = adaptTextAttribute(event, property, xmlCommentAttribute, damageRepairer);
    } else if (property.startsWith("org.eclipse.ant.ui.dtdColor")) {
      xmlDtdAttribute = adaptTextAttribute(event, property, xmlDtdAttribute, dtdDamageRepairer);
    }
  }
  
  private TextAttribute adaptTextAttribute(PropertyChangeEvent event, String property, TextAttribute textAttribute, MultilineDamagerRepairer repairer)
  {
    if (property.endsWith("_bold")) {
      textAttribute = adaptToStyleChange(event, 1, textAttribute);
    } else if (property.endsWith("_italic")) {
      textAttribute = adaptToStyleChange(event, 2, textAttribute);
    } else {
      textAttribute = adaptToColorChange(event, textAttribute);
    }
    repairer.setDefaultTextAttribute(textAttribute);
    return textAttribute;
  }
  
  private TextAttribute adaptToStyleChange(PropertyChangeEvent event, int styleAttribute, TextAttribute textAttribute)
  {
    boolean eventValue = false;
    Object value = event.getNewValue();
    if ((value instanceof Boolean)) {
      eventValue = ((Boolean)value).booleanValue();
    } else if ("true".equals(value)) {
      eventValue = true;
    }
    boolean activeValue = (textAttribute.getStyle() & styleAttribute) == styleAttribute;
    if (activeValue != eventValue) {
      textAttribute = new TextAttribute(textAttribute.getForeground(), textAttribute.getBackground(), eventValue ? textAttribute.getStyle() | styleAttribute : textAttribute.getStyle() & (styleAttribute ^ 0xFFFFFFFF));
    }
    return textAttribute;
  }
  
  private TextAttribute adaptToColorChange(PropertyChangeEvent event, TextAttribute textAttribute)
  {
    RGB rgb = null;
    
    Object value = event.getNewValue();
    if ((value instanceof RGB)) {
      rgb = (RGB)value;
    } else if ((value instanceof String)) {
      rgb = StringConverter.asRGB((String)value);
    }
    if (rgb != null) {
      textAttribute = new TextAttribute(ColorManager.getDefault().getColor(rgb), textAttribute.getBackground(), textAttribute.getStyle());
    }
    return textAttribute;
  }
  
  public String[] getConfiguredContentTypes(ISourceViewer sourceViewer)
  {
    return new String[] {
      "__dftl_partition_content_type", 
      "__xml_comment", 
      "__xml_tag", 
      "__xml_cdata", 
      "__xml_dtd" };
  }
  
  public int getTabWidth(ISourceViewer sourceViewer)
  {
    return fPreferenceStore.getInt("tabWidth");
  }
  
  public boolean affectsTextPresentation(PropertyChangeEvent event)
  {
    String property = event.getProperty();
    
    return (property.startsWith("org.eclipse.ant.ui.textColor")) || (property.startsWith("org.eclipse.ant.ui.processingInstructionsColor")) || (property.startsWith("org.eclipse.ant.ui.constantStringsColor")) || (property.startsWith("org.eclipse.ant.ui.tagsColor")) || (property.startsWith("org.eclipse.ant.ui.commentsColor")) || (property.startsWith("org.eclipse.ant.ui.dtdColor"));
  }
  
  public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer)
  {
    return "org.eclipse.ant.ui.antPartitioning";
  }
  
  public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType)
  {
    if ("__xml_tag".equals(contentType)) {
      return new AntDoubleClickStrategy();
    }
    return super.getDoubleClickStrategy(sourceViewer, contentType);
  }
}

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

import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.osgi.framework.Bundle;

public class AntUIImages
{
  private static ImageRegistry imageRegistry;
  private static ImageDescriptorRegistry imageDescriptorRegistry;
  private static String ICONS_PATH = "$nl$/icons/full/";
  private static final String LOCALTOOL = ICONS_PATH + "elcl16/";
  private static final String OBJECT = ICONS_PATH + "obj16/";
  private static final String OVR = ICONS_PATH + "ovr16/";
  private static final String WIZ = ICONS_PATH + "wizban/";
  private static final String T_ETOOL = ICONS_PATH + "etool16";
  
  private static void declareImages()
  {
    declareRegistryImage("org.eclipse.ant.ui.IMG_PROPERTY", OBJECT + "property_obj.gif");
    declareRegistryImage("org.eclipse.ant.ui.html_tab_obj", OBJECT + "task_obj.gif");
    declareRegistryImage("org.eclipse.ant.ui.template_obj", OBJECT + "template_obj.gif");
    
    declareRegistryImage("org.eclipse.ant.ui.segmentEdit", T_ETOOL + "segment_edit.gif");
    declareRegistryImage("org.eclipse.ant.ui.markOccurrences", T_ETOOL + "mark_occurrences.gif");
    
    declareRegistryImage("org.eclipse.ant.ui.ant", OBJECT + "ant.gif");
    declareRegistryImage("org.eclipse.ant.ui.remove", LOCALTOOL + "remove_co.gif");
    declareRegistryImage("org.eclipse.ant.ui.removeAll", LOCALTOOL + "removeall_co.gif");
    declareRegistryImage("org.eclipse.ant.ui.add", LOCALTOOL + "add_co.gif");
    declareRegistryImage("org.eclipse.ant.ui.run", LOCALTOOL + "run_tool.gif");
    declareRegistryImage("org.eclipse.ant.ui.search", LOCALTOOL + "search.gif");
    
    declareRegistryImage("org.eclipse.ant.ui.filterInternalTargets", LOCALTOOL + "filter_internal_targets.gif");
    declareRegistryImage("org.eclipse.ant.ui.filterImportedElements", LOCALTOOL + "filter_imported_elements.gif");
    declareRegistryImage("org.eclipse.ant.ui.filterProperties", LOCALTOOL + "filter_properties.gif");
    declareRegistryImage("org.eclipse.ant.ui.filterTopLevel", LOCALTOOL + "filter_top_level.gif");
    declareRegistryImage("org.eclipse.ant.ui.linkWithEditor", LOCALTOOL + "synced.gif");
    declareRegistryImage("org.eclipse.ant.ui.sortOutline", LOCALTOOL + "alpha_mode.gif");
    declareRegistryImage("org.eclipse.ant.ui.IMG_REFRESH", LOCALTOOL + "refresh.gif");
    
    declareRegistryImage("org.eclipse.ant.ui.antProject", OBJECT + "ant_buildfile.gif");
    declareRegistryImage("org.eclipse.ant.ui.antTarget", OBJECT + "targetpublic_obj.gif");
    declareRegistryImage("org.eclipse.ant.ui.antPrivateTarget", OBJECT + "targetinternal_obj.gif");
    declareRegistryImage("org.eclipse.ant.ui.antDefaultTarget", OBJECT + "defaulttarget_obj.gif");
    declareRegistryImage("org.eclipse.ant.ui.antTargetError", OBJECT + "ant_target_err.gif");
    
    declareRegistryImage("org.eclipse.ant.ui.IMG_TAB_CLASSPATH", OBJECT + "classpath.gif");
    declareRegistryImage("org.eclipse.ant.ui.type", OBJECT + "type.gif");
    declareRegistryImage("org.eclipse.ant.ui.antTaskdef", OBJECT + "taskdef_obj.gif");
    declareRegistryImage("org.eclipse.ant.ui.antMacrodef", OBJECT + "macrodef_obj.gif");
    declareRegistryImage("org.eclipse.ant.ui.antImport", OBJECT + "import_obj.gif");
    declareRegistryImage("org.eclipse.ant.ui.antEclipse", OBJECT + "eclipse_obj.gif");
    
    declareRegistryImage("org.eclipse.ant.ui.IMG_WIZARD_BANNER", WIZ + "ant_wiz.png");
    declareRegistryImage("org.eclipse.ant.ui.IMG_EXPORT_WIZARD_BANNER", WIZ + "export_ant_wiz.png");
    declareRegistryImage("org.eclipse.ant.ui.IMG_TAB_ANT_TARGETS", LOCALTOOL + "ant_targets.gif");
    
    declareRegistryImage("org.eclipse.ant.ui.ovrError", OVR + "error_co.gif");
    declareRegistryImage("org.eclipse.ant.ui.ovrWarning", OVR + "warning_co.gif");
    declareRegistryImage("org.eclipse.ant.ui.ovrImport", OVR + "import_co.gif");
  }
  
  private static final void declareRegistryImage(String key, String path)
  {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle(AntUIPlugin.getUniqueIdentifier());
    URL url = null;
    if (bundle != null)
    {
      url = FileLocator.find(bundle, new Path(path), null);
      desc = ImageDescriptor.createFromURL(url);
    }
    imageRegistry.put(key, desc);
  }
  
  public static ImageRegistry getImageRegistry()
  {
    if (imageRegistry == null) {
      initializeImageRegistry();
    }
    return imageRegistry;
  }
  
  public static ImageRegistry initializeImageRegistry()
  {
    imageRegistry = new ImageRegistry(AntUIPlugin.getStandardDisplay());
    declareImages();
    return imageRegistry;
  }
  
  public static Image getImage(String key)
  {
    return getImageRegistry().get(key);
  }
  
  public static ImageDescriptor getImageDescriptor(String key)
  {
    return getImageRegistry().getDescriptor(key);
  }
  
  public static Image getImage(CompositeImageDescriptor imageDescriptor)
  {
    if (imageDescriptorRegistry == null) {
      imageDescriptorRegistry = new ImageDescriptorRegistry();
    }
    return imageDescriptorRegistry.get(imageDescriptor);
  }
  
  public static void disposeImageDescriptorRegistry()
  {
    if (imageDescriptorRegistry != null) {
      imageDescriptorRegistry.dispose();
    }
  }
  
  public static synchronized boolean isInitialized()
  {
    return imageDescriptorRegistry != null;
  }
}

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

import org.eclipse.osgi.util.NLS;

public class AntUIModelMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.ant.internal.ui.AntUIModelMessages";
  public static String ImageDescriptorRegistry_Allocating_image_for_wrong_display_1;
  public static String AntUtil_6;
  public static String AntUtil_7;
  public static String AntUtil_0;
  public static String AntUtil_1;
  public static String AntUtil_2;
  
  static
  {
    NLS.initializeMessages("org.eclipse.ant.internal.ui.AntUIModelMessages", AntUIModelMessages.class);
  }
}

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

import java.util.Locale;
import org.eclipse.ant.internal.ui.editor.text.AntEditorDocumentProvider;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
import org.eclipse.ui.texteditor.IDocumentProvider;

public class AntUIPlugin
  extends AbstractUIPlugin
{
  public static final int INTERNAL_ERROR = 120;
  private static AntUIPlugin plugin;
  public static final String PI_ANTUI = "org.eclipse.ant.ui";
  private IPreferenceStore fCombinedPreferenceStore;
  private IDocumentProvider fDocumentProvider;
  
  public AntUIPlugin()
  {
    plugin = this;
  }
  
  /* Error */
  public void stop(org.osgi.framework.BundleContext context)
    throws java.lang.Exception
  {
    // Byte code:
    //   0: invokestatic 166	org/eclipse/ant/internal/ui/AntUIImages:disposeImageDescriptorRegistry	()V
    //   3: invokestatic 179	org/eclipse/ant/internal/ui/editor/DecayCodeCompletionDataStructuresThread:cancel	()V
    //   6: invokestatic 177	org/eclipse/ant/internal/ui/ColorManager:getDefault	()Lorg/eclipse/ant/internal/ui/ColorManager;
    //   9: invokevirtual 176	org/eclipse/ant/internal/ui/ColorManager:dispose	()V
    //   12: goto +11 -> 23
    //   15: astore_2
    //   16: aload_0
    //   17: aload_1
    //   18: invokespecial 187	org/eclipse/ui/plugin/AbstractUIPlugin:stop	(Lorg/osgi/framework/BundleContext;)V
    //   21: aload_2
    //   22: athrow
    //   23: aload_0
    //   24: aload_1
    //   25: invokespecial 187	org/eclipse/ui/plugin/AbstractUIPlugin:stop	(Lorg/osgi/framework/BundleContext;)V
    //   28: return
    // Line number table:
    //   Java source line #83	-> byte code offset #0
    //   Java source line #84	-> byte code offset #3
    //   Java source line #85	-> byte code offset #6
    //   Java source line #86	-> byte code offset #15
    //   Java source line #87	-> byte code offset #16
    //   Java source line #88	-> byte code offset #21
    //   Java source line #87	-> byte code offset #23
    //   Java source line #89	-> byte code offset #28
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	29	0	this	AntUIPlugin
    //   0	29	1	context	org.osgi.framework.BundleContext
    //   15	7	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	15	15	finally
  }
  
  public static AntUIPlugin getDefault()
  {
    return plugin;
  }
  
  public static String getUniqueIdentifier()
  {
    return "org.eclipse.ant.ui";
  }
  
  public static void log(Throwable t)
  {
    IStatus status = new Status(4, "org.eclipse.ant.ui", 120, "Error logged from Ant UI: ", t);
    log(status);
  }
  
  public static void log(IStatus status)
  {
    getDefault().getLog().log(status);
  }
  
  public static void log(String message, Throwable exception)
  {
    IStatus status = newErrorStatus(message, exception);
    log(status);
  }
  
  public static IStatus newErrorStatus(String message, Throwable exception)
  {
    if (message == null) {
      return new Status(4, "org.eclipse.ant.ui", 0, "", exception);
    }
    return new Status(4, "org.eclipse.ant.ui", 0, message, exception);
  }
  
  public static Display getStandardDisplay()
  {
    Display display = Display.getCurrent();
    if (display == null) {
      display = Display.getDefault();
    }
    return display;
  }
  
  protected ImageRegistry createImageRegistry()
  {
    return AntUIImages.initializeImageRegistry();
  }
  
  public static Color getPreferenceColor(String pref)
  {
    return ColorManager.getDefault().getColor(PreferenceConverter.getColor(getDefault().getCombinedPreferenceStore(), pref));
  }
  
  public static IWorkbenchPage getActivePage()
  {
    IWorkbenchWindow window = getActiveWorkbenchWindow();
    if (window != null) {
      return window.getActivePage();
    }
    return null;
  }
  
  public static IWorkbenchWindow getActiveWorkbenchWindow()
  {
    return getDefault().getWorkbench().getActiveWorkbenchWindow();
  }
  
  public static boolean isMacOS()
  {
    String osname = System.getProperty("os.name").toLowerCase(Locale.US);
    return osname.indexOf("mac") != -1;
  }
  
  public IPreferenceStore getCombinedPreferenceStore()
  {
    if (fCombinedPreferenceStore == null)
    {
      IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
      fCombinedPreferenceStore = new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), generalTextStore });
    }
    return fCombinedPreferenceStore;
  }
  
  public synchronized IDocumentProvider getDocumentProvider()
  {
    if (fDocumentProvider == null) {
      fDocumentProvider = new AntEditorDocumentProvider();
    }
    return fDocumentProvider;
  }
}

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

import org.eclipse.ant.internal.ui.editor.text.IAntEditorColorConstants;
import org.eclipse.ant.internal.ui.preferences.AntEditorPreferenceConstants;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.editors.text.EditorsUI;

public class AntUIPreferenceInitializer
  extends AbstractPreferenceInitializer
{
  public void initializeDefaultPreferences()
  {
    IPreferenceStore prefs = AntUIPlugin.getDefault().getPreferenceStore();
    prefs.setDefault("ant.findBuildFileNames", "build.xml");
    
    prefs.setDefault("documentation.url", "http://ant.apache.org/manual");
    prefs.setDefault("workspacejre", false);
    
    EditorsUI.useAnnotationsPreferencePage(prefs);
    EditorsUI.useQuickDiffPreferencePage(prefs);
    if (AntUIPlugin.isMacOS()) {
      prefs.setDefault("toolsJAR", false);
    } else {
      prefs.setDefault("toolsJAR", true);
    }
    prefs.setDefault("errorDialog", true);
    
    prefs.setDefault("anteditor.filterInternalTargets", false);
    prefs.setDefault("anteditor.filterImportedElements", false);
    prefs.setDefault("anteditor.filterProperties", false);
    prefs.setDefault("anteditor.filterTopLevel", false);
    
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.textColor", IAntEditorColorConstants.DEFAULT);
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.processingInstructionsColor", IAntEditorColorConstants.PROC_INSTR);
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.constantStringsColor", IAntEditorColorConstants.STRING);
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.tagsColor", IAntEditorColorConstants.TAG);
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.commentsColor", IAntEditorColorConstants.XML_COMMENT);
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.dtdColor", IAntEditorColorConstants.XML_DTD);
    
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.errorColor", new RGB(255, 0, 0));
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.warningColor", new RGB(250, 100, 0));
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.informationColor", new RGB(0, 0, 255));
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.verboseColor", new RGB(0, 200, 125));
    PreferenceConverter.setDefault(prefs, "org.eclipse.ant.ui.debugColor", new RGB(0, 0, 0));
    
    AntEditorPreferenceConstants.initializeDefaultValues(prefs);
  }
}

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

import java.io.File;
import org.eclipse.ant.internal.ui.model.LocationProvider;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.ui.IEditorInput;

class AntUtil$1
  extends LocationProvider
{
  private final IFile val$file;
  private final File val$buildFile;
  
  AntUtil$1(IEditorInput $anonymous0, IFile paramIFile, File paramFile)
  {
    super($anonymous0);val$file = paramIFile;val$buildFile = paramFile;
  }
  
  public IFile getFile()
  {
    return val$file;
  }
  
  public IPath getLocation()
  {
    if (val$file == null) {
      return new Path(val$buildFile.getAbsolutePath());
    }
    return val$file.getLocation();
  }
}

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

import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;

class AntUtil$2
  implements Runnable
{
  private final String val$urlString;
  private final Shell val$shell;
  private final String val$errorDialogTitle;
  
  AntUtil$2(String paramString1, Shell paramShell, String paramString2)
  {
    val$urlString = paramString1;val$shell = paramShell;val$errorDialogTitle = paramString2;
  }
  
  public void run()
  {
    IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
    try
    {
      IWebBrowser browser = support.createBrowser(AntUtil.access$0());
      AntUtil.access$1(browser.getId());
      browser.openURL(new URL(val$urlString));
      return;
    }
    catch (PartInitException e)
    {
      AntUIPlugin.log(e.getStatus());
    }
    catch (MalformedURLException e)
    {
      AntUIPlugin.log(e);
    }
    String platform = SWT.getPlatform();
    boolean succeeded = true;
    if (("motif".equals(platform)) || ("gtk".equals(platform)))
    {
      Program program = Program.findProgram("html");
      if (program == null) {
        program = Program.findProgram("htm");
      }
      if (program != null) {
        succeeded = program.execute(val$urlString.toString());
      }
    }
    else
    {
      succeeded = Program.launch(val$urlString.toString());
    }
    if (!succeeded) {
      MessageDialog.openInformation(val$shell, val$errorDialogTitle, AntUIModelMessages.AntUtil_1);
    }
  }
}

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

import com.ibm.icu.text.MessageFormat;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Target;
import org.eclipse.ant.core.AntCorePlugin;
import org.eclipse.ant.internal.core.AntCoreUtil;
import org.eclipse.ant.internal.launching.AntLaunchingUtil;
import org.eclipse.ant.internal.ui.editor.AntEditor;
import org.eclipse.ant.internal.ui.model.AntElementNode;
import org.eclipse.ant.internal.ui.model.AntModel;
import org.eclipse.ant.internal.ui.model.AntProjectNode;
import org.eclipse.ant.internal.ui.model.AntTargetNode;
import org.eclipse.ant.internal.ui.model.IAntModel;
import org.eclipse.ant.internal.ui.model.LocationProvider;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filebuffers.LocationKind;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.ui.console.FileLink;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.SWT;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
import org.eclipse.ui.console.IHyperlink;
import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;

public final class AntUtil
{
  public static final String ATTRIBUTE_SEPARATOR = ",";
  public static final char ANT_CLASSPATH_DELIMITER = '*';
  public static final String ANT_HOME_CLASSPATH_PLACEHOLDER = "G";
  public static final String ANT_GLOBAL_USER_CLASSPATH_PLACEHOLDER = "UG";
  private static String fgBrowserId;
  
  public static String combineStrings(String[] strings)
  {
    return AntLaunchingUtil.combineStrings(strings);
  }
  
  public static String[] getTargetNames(ILaunchConfiguration configuration)
    throws CoreException
  {
    return AntLaunchingUtil.getTargetNames(configuration);
  }
  
  public static Map getProperties(ILaunchConfiguration configuration)
    throws CoreException
  {
    return AntLaunchingUtil.getProperties(configuration);
  }
  
  public static String getAntHome(ILaunchConfiguration configuration)
    throws CoreException
  {
    return AntLaunchingUtil.getAntHome(configuration);
  }
  
  public static String[] getPropertyFiles(ILaunchConfiguration configuration)
    throws CoreException
  {
    String attribute = configuration.getAttribute("org.eclipse.ui.externaltools.ATTR_ANT_PROPERTY_FILES", null);
    if (attribute == null) {
      return null;
    }
    String[] propertyFiles = parseString(attribute, ",");
    for (int i = 0; i < propertyFiles.length; i++)
    {
      String propertyFile = propertyFiles[i];
      propertyFile = expandVariableString(propertyFile, AntUIModelMessages.AntUtil_6);
      propertyFiles[i] = propertyFile;
    }
    return propertyFiles;
  }
  
  public static AntTargetNode[] getTargets(String path, ILaunchConfiguration config)
    throws CoreException
  {
    File buildfile = getBuildFile(path);
    if (buildfile == null) {
      return null;
    }
    URL[] urls = getCustomClasspath(config);
    
    IAntModel model = getAntModel(buildfile, urls, false, false, false);
    try
    {
      model.setProperties(getAllProperties(config));
    }
    catch (CoreException localCoreException) {}
    model.setPropertyFiles(getPropertyFiles(config));
    AntProjectNode project = model.getProjectNode();
    model.dispose();
    return getTargets(project);
  }
  
  private static Map getAllProperties(ILaunchConfiguration config)
    throws CoreException
  {
    String allArgs = config.getAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", null);
    Map properties = new HashMap();
    if (allArgs != null)
    {
      String[] arguments = ExternalToolsUtil.parseStringIntoList(allArgs);
      
      List filtered = new ArrayList();
      Pattern pattern = Pattern.compile("\\$\\{.*_prompt.*\\}");
      IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
      for (int i = 0; i < arguments.length; i++)
      {
        String arg = arguments[i];
        if ((arg.startsWith("-D")) && 
          (!pattern.matcher(arg).find())) {
          filtered.add(manager.performStringSubstitution(arg, false));
        }
      }
      AntCoreUtil.processMinusDProperties(filtered, properties);
    }
    Map configProperties = getProperties(config);
    if (configProperties != null)
    {
      Iterator keys = configProperties.keySet().iterator();
      while (keys.hasNext())
      {
        String name = (String)keys.next();
        if (properties.get(name) == null) {
          properties.put(name, configProperties.get(name));
        }
      }
    }
    return properties;
  }
  
  private static AntTargetNode[] getTargets(AntProjectNode project)
  {
    if ((project == null) || (!project.hasChildren())) {
      return null;
    }
    List targets = new ArrayList();
    Iterator possibleTargets = project.getChildNodes().iterator();
    while (possibleTargets.hasNext())
    {
      AntElementNode node = (AntElementNode)possibleTargets.next();
      if ((node instanceof AntTargetNode)) {
        targets.add(node);
      }
    }
    if (targets.size() == 0) {
      return null;
    }
    return (AntTargetNode[])targets.toArray(new AntTargetNode[targets.size()]);
  }
  
  public static AntTargetNode[] getTargets(String path)
  {
    File buildfile = getBuildFile(path);
    if (buildfile == null) {
      return null;
    }
    IAntModel model = getAntModel(buildfile, null, false, true, true);
    AntProjectNode project = model.getProjectNode();
    if (project == null)
    {
      model.dispose();
      return null;
    }
    AntTargetNode[] targets = getTargets(project);
    if (targets == null)
    {
      Hashtable antTargets = project.getProject().getTargets();
      Target implicitTarget = (Target)antTargets.get("");
      if (implicitTarget != null)
      {
        AntTargetNode implicitTargetNode = new AntTargetNode(implicitTarget);
        project.addChildNode(implicitTargetNode);
        return new AntTargetNode[] { implicitTargetNode };
      }
    }
    return targets;
  }
  
  public static IAntModel getAntModel(String buildFilePath, boolean needsLexicalResolution, boolean needsPositionResolution, boolean needsTaskResolution)
  {
    IAntModel model = getAntModel(getBuildFile(buildFilePath), null, needsLexicalResolution, needsPositionResolution, needsTaskResolution);
    return model;
  }
  
  private static File getBuildFile(String path)
  {
    File buildFile = new File(path);
    if ((!buildFile.isFile()) || (!buildFile.exists())) {
      return null;
    }
    return buildFile;
  }
  
  private static IAntModel getAntModel(File buildFile, URL[] urls, boolean needsLexical, boolean needsPosition, boolean needsTask)
  {
    if ((buildFile == null) || (!buildFile.exists())) {
      return null;
    }
    IDocument doc = getDocument(buildFile);
    if (doc == null) {
      return null;
    }
    IFile file = getFileForLocation(buildFile.getAbsolutePath(), null);
    LocationProvider provider = new LocationProvider(null)
    {
      private final IFile val$file;
      private final File val$buildFile;
      
      public IFile getFile()
      {
        return val$file;
      }
      
      public IPath getLocation()
      {
        if (val$file == null) {
          return new Path(val$buildFile.getAbsolutePath());
        }
        return val$file.getLocation();
      }
    };
    IAntModel model = new AntModel(doc, null, provider, needsLexical, needsPosition, needsTask);
    if (urls != null) {
      model.setClassLoader(AntCorePlugin.getPlugin().getNewClassLoader(urls));
    }
    return model;
  }
  
  private static IDocument getDocument(File buildFile)
  {
    ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
    IPath location = new Path(buildFile.getAbsolutePath());
    boolean connected = false;
    try
    {
      ITextFileBuffer buffer = manager.getTextFi
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

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