org.cfeclipse.cfml.snippets_1.0.0.201310241731

16:41:19.534 INFO  jd.cli.Main - Decompiling org.cfeclipse.cfml.snippets_1.0.0.201310241731.jar
package org.cfeclipse.cfml.snippets;

import java.io.File;
import java.io.PrintStream;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.cfeclipse.cfml.snippets.preferences.CFMLPreferenceManager;
import org.cfeclipse.cfml.snippets.properties.CFMLPropertyManager;
import org.cfeclipse.cfml.snippets.util.CFPluginImages;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class SnippetPlugin
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.cfeclipse.cfml.snippets";
  private static SnippetPlugin plugin;
  private PreferenceStore propertyStore;
  private ResourceBundle resourceBundle;
  private CFMLPropertyManager fPropertyManager;
  private CFMLPreferenceManager fPreferenceManager;
  
  public SnippetPlugin()
  {
    plugin = this;
    try
    {
      resourceBundle = ResourceBundle.getBundle("plugin");
    }
    catch (MissingResourceException x)
    {
      x.printStackTrace(System.err);
      resourceBundle = null;
    }
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    CFPluginImages.initCFPluginImages();
    propertyStore = new PreferenceStore(getDefault().getStateLocation().toString() + 
      "/properties.ini");
    fPreferenceManager = new CFMLPreferenceManager();
    try
    {
      fPropertyManager = new CFMLPropertyManager();
    }
    catch (Exception e)
    {
      e.printStackTrace();
      System.out.println(e);
    }
    String defaultSnippetPath = getDefault().getStateLocation().toString() + "/snippets";
    File f = new File(defaultSnippetPath);
    if (!f.exists()) {
      f.mkdir();
    }
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static SnippetPlugin getDefault()
  {
    return plugin;
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    return imageDescriptorFromPlugin("org.cfeclipse.cfml.snippets", path);
  }
  
  public static IWorkspace getWorkspace()
  {
    return ResourcesPlugin.getWorkspace();
  }
  
  public PreferenceStore getPropertyStore()
  {
    return propertyStore;
  }
  
  public CFMLPropertyManager getPropertyManager()
  {
    return fPropertyManager;
  }
  
  public CFMLPreferenceManager getPreferenceManager()
  {
    return fPreferenceManager;
  }
  
  protected void initializeDefaultPluginPreferences()
  {
    fPreferenceManager.initializeDefaultValues();
  }
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.SnippetPlugin
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.commands;

import java.io.PrintStream;
import org.cfeclipse.cfml.snippets.util.Encloser;
import org.cfeclipse.cfml.snippets.views.snips.SnipKeyCombos;
import org.cfeclipse.cfml.snippets.views.snips.SnipReader;
import org.cfeclipse.cfml.snippets.views.snips.SnipVarParser;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.part.MultiPageEditorPart;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;

public class InsertSnippetCommand
  extends AbstractHandler
{
  protected String start = "";
  protected String end = "";
  
  public InsertSnippetCommand() {}
  
  public InsertSnippetCommand(String triggerText, Shell shell)
  {
    SnipKeyCombos keyCombos = new SnipKeyCombos();
    ITextEditor editor = (ITextEditor)Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    ISelection sel = editor.getSelectionProvider().getSelection();
    
    String fileName = keyCombos.getKeyCombo(triggerText);
    
    SnipReader snipReader = new SnipReader();
    IFile activeFile = null;
    if ((editor.getEditorInput() instanceof IFileEditorInput)) {
      activeFile = ((IFileEditorInput)editor.getEditorInput()).getFile();
    }
    snipReader.read(keyCombos.getSnippetFolder() + fileName);
    
    start = SnipVarParser.parse(snipReader.getSnipStartBlock(), activeFile, shell);
    end = SnipVarParser.parse(snipReader.getSnipEndBlock(), activeFile, shell);
    
    Encloser encloser = new Encloser();
    encloser.enclose(doc, (ITextSelection)sel, start, end);
  }
  
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
    Shell shell = editorPart.getSite().getShell();
    ITextEditor editor = null;
    if ((editorPart instanceof ITextEditor)) {
      editor = (ITextEditor)editorPart;
    } else if ((editorPart instanceof MultiPageEditorPart)) {
      editor = (ITextEditor)editorPart.getAdapter(ITextEditor.class);
    }
    ITextSelection sel = (ITextSelection)editor.getSelectionProvider().getSelection();
    IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    if ((editor != null) && (editor.isEditable()))
    {
      SnipKeyCombos keyCombos = new SnipKeyCombos();
      
      String sequence = "";
      
      int cursorOffset = sel.getOffset();
      int lastSpaceOffset = -1;
      
      FindReplaceDocumentAdapter finder = new FindReplaceDocumentAdapter(doc);
      try
      {
        IRegion lastSpace = finder.find(cursorOffset - 1, "[^\\*0-9a-zA-Z_-]", false, false, false, true);
        if (lastSpace == null) {
          lastSpaceOffset = 0;
        } else {
          lastSpaceOffset = lastSpace.getOffset() + 1;
        }
        if (cursorOffset > lastSpaceOffset) {
          if (cursorOffset != doc.getLength())
          {
            System.out.println("yep");
            IRegion nextSpace = finder
              .find(cursorOffset - 1, "[^\\*0-9a-zA-Z_-]", true, false, false, true);
            if ((nextSpace != null) && (nextSpace.getOffset() == cursorOffset)) {
              sequence = doc.get().substring(lastSpaceOffset, cursorOffset);
            }
          }
          else
          {
            sequence = doc.get().substring(lastSpaceOffset, cursorOffset);
          }
        }
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
      if (sequence.length() == 0) {
        System.out.println("no trigger text has been passed in");
      }
      if (sequence.length() > 0)
      {
        String[] stringArray = sequence.split("\\*");
        String trigger = stringArray[0];
        int loopcount = 1;
        if (stringArray.length > 1) {
          loopcount = Integer.parseInt(stringArray[1].trim());
        }
        String fileName = keyCombos.getKeyCombo(trigger);
        
        SnipReader snipReader = new SnipReader();
        
        IFile activeFile = null;
        if ((editor.getEditorInput() instanceof IFileEditorInput)) {
          activeFile = ((IFileEditorInput)editor.getEditorInput()).getFile();
        }
        if (fileName == null)
        {
          MessageBox dialog = new MessageBox(shell, 1);
          dialog.setMessage("No snippet found for : " + sequence);
          dialog.open();
          return null;
        }
        snipReader.read(fileName);
        
        String indentString = "";
        try
        {
          int lineNumber = doc.getLineOfOffset(lastSpaceOffset);
          int lineOffset = doc.getLineOffset(lineNumber);
          indentString = doc.get().substring(lineOffset, lastSpaceOffset);
        }
        catch (Exception e)
        {
          System.err.println(e);
        }
        if (indentString.length() > 0) {
          snipReader.performIndent(indentString);
        }
        String snippet = "";
        
        int finalCursorOffset = -1;
        for (int i = 0; i < loopcount; i++)
        {
          start = SnipVarParser.parse(snipReader.getSnipStartBlock(), activeFile, shell);
          end = SnipVarParser.parse(snipReader.getSnipEndBlock(), activeFile, shell);
          if ((start == null) || (end == null))
          {
            snippet = null;
            break;
          }
          snippet = start + end;
          if ((snippet != null) && (snippet.length() > 0))
          {
            Encloser encloser = new Encloser();
            encloser.enclose(doc, sel, snippet, "");
            
            int offset = sel.getOffset();
            offset += sel.getLength();
            offset += snippet.length();
            if (i == 0) {
              try
              {
                doc.replace(lastSpaceOffset, sequence.length(), "");
                sel = new TextSelection(doc, offset - sequence.length(), 0);
                if (end.length() <= 0) {
                  break label771;
                }
                finalCursorOffset = lastSpaceOffset + start.length();
              }
              catch (Exception e)
              {
                e.printStackTrace();
              }
            } else {
              sel = new TextSelection(doc, offset, 0);
            }
            label771:
            editor.setHighlightRange(offset, 0, true);
          }
          else
          {
            MessageBox dialog = new MessageBox(shell, 1);
            dialog.setMessage("No key combo specified for : " + trigger + "in " + keyCombos.getKeyCombosFilePath());
            dialog.open();
          }
        }
        if (finalCursorOffset > 0) {
          editor.setHighlightRange(finalCursorOffset, 0, true);
        }
      }
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.commands.InsertSnippetCommand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.editors.actions;

import org.cfeclipse.cfml.snippets.util.Encloser;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;

public class GenericEncloserAction
  extends Encloser
  implements IWorkbenchWindowActionDelegate, IEditorActionDelegate
{
  protected ITextEditor editor = null;
  protected String start = "";
  protected String end = "";
  
  public GenericEncloserAction() {}
  
  public GenericEncloserAction(String start, String end)
  {
    setEnclosingStrings(start, end);
  }
  
  public void setEnclosingStrings(String start, String end)
  {
    this.start = start;
    this.end = end;
  }
  
  public void setActiveEditor(IAction action, IEditorPart targetEditor)
  {
    if ((targetEditor instanceof ITextEditor)) {
      editor = ((ITextEditor)targetEditor);
    }
  }
  
  public void run()
  {
    run(null);
  }
  
  public void run(IAction action)
  {
    if ((editor != null) && (editor.isEditable()))
    {
      IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
      ISelection sel = editor.getSelectionProvider().getSelection();
      enclose(doc, (ITextSelection)sel, start, end);
      
      int offset = ((ITextSelection)sel).getOffset();
      offset += ((ITextSelection)sel).getLength();
      offset += start.length();
      
      editor.setHighlightRange(offset, 0, true);
      
      editor.resetHighlightRange();
    }
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if (editor != null) {
      setActiveEditor(null, editor.getSite().getPage().getActiveEditor());
    }
  }
  
  public void dispose() {}
  
  public void init(IWorkbenchWindow window)
  {
    IEditorPart activeEditor = window.getActivePage().getActiveEditor();
    if ((activeEditor instanceof ITextEditor)) {
      editor = ((ITextEditor)activeEditor);
    }
  }
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.editors.actions.GenericEncloserAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.handlers;

import org.cfeclipse.cfml.snippets.commands.InsertSnippetCommand;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;

public class SnippetActionHandler
  extends AbstractHandler
{
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    InsertSnippetCommand snippetCommand = new InsertSnippetCommand();
    return snippetCommand.execute(event);
  }
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.handlers.SnippetActionHandler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.net;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;

public class ClientHttpRequest
{
  URLConnection connection;
  OutputStream os = null;
  Map cookies = new HashMap();
  
  protected void connect()
    throws IOException
  {
    if (os == null) {
      os = connection.getOutputStream();
    }
  }
  
  protected void write(char c)
    throws IOException
  {
    connect();
    os.write(c);
  }
  
  protected void write(String s)
    throws IOException
  {
    connect();
    os.write(s.getBytes());
  }
  
  protected void newline()
    throws IOException
  {
    connect();
    write("\r\n");
  }
  
  protected void writeln(String s)
    throws IOException
  {
    connect();
    write(s);
    newline();
  }
  
  private static Random random = new Random();
  
  protected static String randomString()
  {
    return Long.toString(random.nextLong(), 36);
  }
  
  String boundary = "---------------------------" + randomString() + randomString() + randomString();
  
  private void boundary()
    throws IOException
  {
    write("--");
    write(boundary);
  }
  
  public ClientHttpRequest(URLConnection connection)
    throws IOException
  {
    this.connection = connection;
    connection.setDoOutput(true);
    connection.setRequestProperty("Content-Type", 
      "multipart/form-data; boundary=" + boundary);
  }
  
  public ClientHttpRequest(URL url)
    throws IOException
  {
    this(url.openConnection());
  }
  
  public ClientHttpRequest(String urlString)
    throws IOException
  {
    this(new URL(urlString));
  }
  
  private void postCookies()
  {
    StringBuffer cookieList = new StringBuffer();
    for (Iterator i = cookies.entrySet().iterator(); i.hasNext();)
    {
      Map.Entry entry = (Map.Entry)i.next();
      cookieList.append(entry.getKey().toString() + "=" + entry.getValue());
      if (i.hasNext()) {
        cookieList.append("; ");
      }
    }
    if (cookieList.length() > 0) {
      connection.setRequestProperty("Cookie", cookieList.toString());
    }
  }
  
  public void setCookie(String name, String value)
    throws IOException
  {
    cookies.put(name, value);
  }
  
  public void setCookies(Map cookies)
    throws IOException
  {
    if (cookies == null) {
      return;
    }
    this.cookies.putAll(cookies);
  }
  
  public void setCookies(String[] cookies)
    throws IOException
  {
    if (cookies == null) {
      return;
    }
    for (int i = 0; i < cookies.length - 1; i += 2) {
      setCookie(cookies[i], cookies[(i + 1)]);
    }
  }
  
  private void writeName(String name)
    throws IOException
  {
    newline();
    write("Content-Disposition: form-data; name=\"");
    write(name);
    write('"');
  }
  
  public void setParameter(String name, String value)
    throws IOException
  {
    boundary();
    writeName(name);
    newline();newline();
    writeln(value);
  }
  
  private static void pipe(InputStream in, OutputStream out)
    throws IOException
  {
    byte[] buf = new byte[500000];
    synchronized (in)
    {
      int nread;
      while ((nread = in.read(buf, 0, buf.length)) >= 0)
      {
        int nread;
        out.write(buf, 0, nread);
      }
    }
    int nread;
    out.flush();
    buf = (byte[])null;
  }
  
  public void setParameter(String name, String filename, InputStream is)
    throws IOException
  {
    boundary();
    writeName(name);
    write("; filename=\"");
    write(filename);
    write('"');
    newline();
    write("Content-Type: ");
    String type = URLConnection.guessContentTypeFromName(filename);
    if (type == null) {
      type = "application/octet-stream";
    }
    writeln(type);
    newline();
    pipe(is, os);
    newline();
  }
  
  public void setParameter(String name, File file)
    throws IOException
  {
    setParameter(name, file.getPath(), new FileInputStream(file));
  }
  
  public void setParameter(String name, Object object)
    throws IOException
  {
    if ((object instanceof File)) {
      setParameter(name, (File)object);
    } else {
      setParameter(name, object.toString());
    }
  }
  
  public void setParameters(Map parameters)
    throws IOException
  {
    if (parameters == null) {
      return;
    }
    for (Iterator i = parameters.entrySet().iterator(); i.hasNext();)
    {
      Map.Entry entry = (Map.Entry)i.next();
      setParameter(entry.getKey().toString(), entry.getValue());
    }
  }
  
  public void setParameters(Object[] parameters)
    throws IOException
  {
    if (parameters == null) {
      return;
    }
    for (int i = 0; i < parameters.length - 1; i += 2) {
      setParameter(parameters[i].toString(), parameters[(i + 1)]);
    }
  }
  
  public InputStream post()
    throws IOException
  {
    boundary();
    writeln("--");
    os.close();
    return connection.getInputStream();
  }
  
  public InputStream post(Map parameters)
    throws IOException
  {
    setParameters(parameters);
    return post();
  }
  
  public InputStream post(Object[] parameters)
    throws IOException
  {
    setParameters(parameters);
    return post();
  }
  
  public InputStream post(Map cookies, Map parameters)
    throws IOException
  {
    setCookies(cookies);
    setParameters(parameters);
    return post();
  }
  
  public InputStream post(String[] cookies, Object[] parameters)
    throws IOException
  {
    setCookies(cookies);
    setParameters(parameters);
    return post();
  }
  
  public InputStream post(String name, Object value)
    throws IOException
  {
    setParameter(name, value);
    return post();
  }
  
  public InputStream post(String name1, Object value1, String name2, Object value2)
    throws IOException
  {
    setParameter(name1, value1);
    return post(name2, value2);
  }
  
  public InputStream post(String name1, Object value1, String name2, Object value2, String name3, Object value3)
    throws IOException
  {
    setParameter(name1, value1);
    return post(name2, value2, name3, value3);
  }
  
  public InputStream post(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4)
    throws IOException
  {
    setParameter(name1, value1);
    return post(name2, value2, name3, value3, name4, value4);
  }
  
  public static InputStream post(URL url, Map parameters)
    throws IOException
  {
    return new ClientHttpRequest(url).post(parameters);
  }
  
  public static InputStream post(URL url, Object[] parameters)
    throws IOException
  {
    return new ClientHttpRequest(url).post(parameters);
  }
  
  public static InputStream post(URL url, Map cookies, Map parameters)
    throws IOException
  {
    return new ClientHttpRequest(url).post(cookies, parameters);
  }
  
  public static InputStream post(URL url, String[] cookies, Object[] parameters)
    throws IOException
  {
    return new ClientHttpRequest(url).post(cookies, parameters);
  }
  
  public static InputStream post(URL url, String name1, Object value1)
    throws IOException
  {
    return new ClientHttpRequest(url).post(name1, value1);
  }
  
  public static InputStream post(URL url, String name1, Object value1, String name2, Object value2)
    throws IOException
  {
    return new ClientHttpRequest(url).post(name1, value1, name2, value2);
  }
  
  public static InputStream post(URL url, String name1, Object value1, String name2, Object value2, String name3, Object value3)
    throws IOException
  {
    return new ClientHttpRequest(url).post(name1, value1, name2, value2, name3, value3);
  }
  
  public static InputStream post(URL url, String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4)
    throws IOException
  {
    return new ClientHttpRequest(url).post(name1, value1, name2, value2, name3, value3, name4, value4);
  }
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.net.ClientHttpRequest
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.preferences;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.internal.Workbench;
import org.tizen.common.core.application.InstallPathConfig;

public class CFMLPreferenceConstants
{
  public static final String SNIPPETS_PATH = ;
  public static final String P_SNIPPETS_PATH = "_snippetsPath";
  public static final String P_TAB_WIDTH = "_tabWidth";
  public static final String P_INSERT_SPACES_FOR_TABS = "spacesForTabs";
  
  public static void setDefaults(IPreferenceStore store)
  {
    store.setDefault("_snippetsPath", SNIPPETS_PATH);
    store.setDefault("_tabWidth", Workbench.getInstance().getPreferenceStore().getInt("_tabWidth"));
    store.setDefault("spacesForTabs", Workbench.getInstance().getPreferenceStore().getBoolean("spacesForTabs"));
  }
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.preferences.CFMLPreferenceConstants
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.preferences;

import java.io.PrintStream;
import org.cfeclipse.cfml.snippets.SnippetPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.StringConverter;
import org.eclipse.swt.graphics.RGB;

public class CFMLPreferenceManager
{
  private IPreferenceStore store;
  
  public CFMLPreferenceManager()
  {
    store = SnippetPlugin.getDefault().getPreferenceStore();
  }
  
  public boolean getBooleanPref(String prefKey)
  {
    return store.getBoolean(prefKey);
  }
  
  public String getStringPref(String prefKey)
  {
    return store.getString(prefKey);
  }
  
  public void initializeDefaultValues()
  {
    CFMLPreferenceConstants.setDefaults(store);
    SnipExPreferenceConstants.setDefaults(store);
  }
  
  public RGB getColor(String key)
  {
    String rgbString = store.getString(key);
    if (rgbString.length() <= 0)
    {
      rgbString = store.getDefaultString(key);
      if (rgbString.length() <= 0)
      {
        try
        {
          rgbString = null;
          System.out.println(rgbString.length());
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        System.err.println("Color key: " + key + 
          " is a no show using black");
        rgbString = "0,0,0";
      }
    }
    rgbString = deParen(rgbString);
    
    RGB newcolor = null;
    try
    {
      newcolor = StringConverter.asRGB(deParen(rgbString));
    }
    catch (Exception e)
    {
      System.err.println("Woah... got an odd color passed: " + key);
      e.printStackTrace(System.err);
    }
    return newcolor;
  }
  
  private String deParen(String item)
  {
    String d = item.replace('{', ' ').replace('}', ' ');
    d = d.replaceAll("[RGB ]", "").trim();
    return d;
  }
  
  public String snippetsPath()
  {
    return store.getString("_snippetsPath").trim();
  }
  
  public String getPluginStateLocation()
  {
    return SnippetPlugin.getDefault().getStateLocation().toString();
  }
  
  public int tabWidth()
  {
    System.out.println("Tab width retrieved as: " + store.getInt("_tabWidth"));
    return Integer.parseInt(store.getString(
      "_tabWidth").trim());
  }
  
  public int defaultTabWidth()
  {
    return store.getDefaultInt("_tabWidth");
  }
  
  public boolean insertSpacesForTabs()
  {
    return 
    
      store.getString("spacesForTabs").trim().equalsIgnoreCase("true");
  }
  
  public boolean defaultSpacesForTabs()
  {
    return 
      store.getDefaultBoolean("spacesForTabs");
  }
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.preferences.CFMLPreferenceManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.preferences;

import org.eclipse.jface.preference.IPreferenceStore;

public class SnipExPreferenceConstants
{
  public static final String P_SNIPEX_URL1 = "snipExURL1";
  public static final String P_SNIPEX_URL2 = "snipExURL2";
  public static final String P_SNIPEX_URL3 = "snipExURL3";
  public static final String P_SNIPEX_URL4 = "snipExURL4";
  public static final String P_SNIPEX_URL5 = "snipExURL5";
  public static final String P_SNIPEX_URL6 = "snipExURL6";
  public static final String P_SNIPEX_URL7 = "snipExURL7";
  public static final String P_SNIPEX_URL8 = "snipExURL8";
  public static final String DEFAULT_SNIPEX_URL1 = "";
  public static final String DEFAULT_SNIPEX_URL2 = "";
  public static final String DEFAULT_SNIPEX_URL3 = "";
  public static final String DEFAULT_SNIPEX_URL4 = "";
  public static final String DEFAULT_SNIPEX_URL5 = "";
  public static final String DEFAULT_SNIPEX_URL6 = "";
  public static final String DEFAULT_SNIPEX_URL7 = "";
  public static final String DEFAULT_SNIPEX_URL8 = "";
  
  public static void setDefaults(IPreferenceStore store)
  {
    store.setDefault("snipExURL1", "");
    store.setDefault("snipExURL2", "");
    store.setDefault("snipExURL3", "");
    store.setDefault("snipExURL4", "");
    store.setDefault("snipExURL5", "");
    store.setDefault("snipExURL5", "");
    store.setDefault("snipExURL5", "");
    store.setDefault("snipExURL5", "");
  }
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.preferences.SnipExPreferenceConstants
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.preferences;

import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.swt.widgets.Composite;

class SnipExPreferencePage$1
  extends DirectoryFieldEditor
{
  SnipExPreferencePage$1(SnipExPreferencePage paramSnipExPreferencePage, String $anonymous0, String $anonymous1, Composite $anonymous2)
  {
    super($anonymous0, $anonymous1, $anonymous2);
  }
  
  /* Error */
  protected void doFillIntoGrid(Composite parent, int numColumns)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: iload_2
    //   3: invokespecial 26	org/eclipse/jface/preference/DirectoryFieldEditor:doFillIntoGrid	(Lorg/eclipse/swt/widgets/Composite;I)V
    //   6: bipush 28
    //   8: istore_3
    //   9: aload_0
    //   10: aload_1
    //   11: invokevirtual 28	org/cfeclipse/cfml/snippets/preferences/SnipExPreferencePage$1:getTextControl	(Lorg/eclipse/swt/widgets/Composite;)Lorg/eclipse/swt/widgets/Text;
    //   14: astore 4
    //   16: new 32	org/eclipse/swt/layout/GridData
    //   19: dup
    //   20: invokespecial 34	org/eclipse/swt/layout/GridData:<init>	()V
    //   23: astore 5
    //   25: aload 5
    //   27: iload_2
    //   28: iconst_1
    //   29: isub
    //   30: putfield 37	org/eclipse/swt/layout/GridData:horizontalSpan	I
    //   33: new 41	org/eclipse/swt/graphics/GC
    //   36: dup
    //   37: aload 4
    //   39: invokespecial 43	org/eclipse/swt/graphics/GC:<init>	(Lorg/eclipse/swt/graphics/Drawable;)V
    //   42: astore 6
    //   44: aload 6
    //   46: ldc 46
    //   48: invokevirtual 48	org/eclipse/swt/graphics/GC:textExtent	(Ljava/lang/String;)Lorg/eclipse/swt/graphics/Point;
    //   51: astore 7
    //   53: aload 5
    //   55: iload_3
    //   56: aload 7
    //   58: getfield 52	org/eclipse/swt/graphics/Point:x	I
    //   61: imul
    //   62: putfield 57	org/eclipse/swt/layout/GridData:widthHint	I
    //   65: aload 4
    //   67: aload 5
    //   69: invokevirtual 60	org/eclipse/swt/widgets/Text:setLayoutData	(Ljava/lang/Object;)V
    //   72: goto +13 -> 85
    //   75: astore 8
    //   77: aload 6
    //   79: invokevirtual 66	org/eclipse/swt/graphics/GC:dispose	()V
    //   82: aload 8
    //   84: athrow
    //   85: aload 6
    //   87: invokevirtual 66	org/eclipse/swt/graphics/GC:dispose	()V
    //   90: return
    // Line number table:
    //   Java source line #40	-> byte code offset #0
    //   Java source line #42	-> byte code offset #6
    //   Java source line #43	-> byte code offset #9
    //   Java source line #44	-> byte code offset #16
    //   Java source line #45	-> byte code offset #25
    //   Java source line #46	-> byte code offset #33
    //   Java source line #48	-> byte code offset #44
    //   Java source line #49	-> byte code offset #53
    //   Java source line #50	-> byte code offset #65
    //   Java source line #51	-> byte code offset #75
    //   Java source line #52	-> byte code offset #77
    //   Java source line #53	-> byte code offset #82
    //   Java source line #52	-> byte code offset #85
    //   Java source line #54	-> byte code offset #90
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	91	0	this	1
    //   0	91	1	parent	Composite
    //   0	91	2	numColumns	int
    //   8	48	3	widthInChars	int
    //   14	52	4	textField	org.eclipse.swt.widgets.Text
    //   23	45	5	gd	org.eclipse.swt.layout.GridData
    //   42	44	6	gc	org.eclipse.swt.graphics.GC
    //   51	6	7	extent	org.eclipse.swt.graphics.Point
    //   75	8	8	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   44	75	75	finally
  }
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.preferences.SnipExPreferencePage.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.preferences;

import org.cfeclipse.cfml.snippets.SnippetPlugin;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public class SnipExPreferencePage
  extends FieldEditorPreferencePage
  implements IWorkbenchPreferencePage
{
  CFMLPreferenceManager cfmlpm;
  DirectoryFieldEditor snippetsPathField;
  CFMLPreferenceManager preferenceManager;
  
  public SnipExPreferencePage()
  {
    super(1);
    setPreferenceStore(SnippetPlugin.getDefault().getPreferenceStore());
    setDescription("These preferences will allow you to customize the what SnipEx servers will be aggregated in your snippet view.\n\n");
    cfmlpm = SnippetPlugin.getDefault().getPreferenceManager();
  }
  
  protected void createFieldEditors()
  {
    DirectoryFieldEditor directoryFieldEditor = new DirectoryFieldEditor("_snippetsPath", "Snippets directory", getFieldEditorParent())
    {
      /* Error */
      protected void doFillIntoGrid(Composite parent, int numColumns)
      {
        // Byte code:
        //   0: aload_0
        //   1: aload_1
        //   2: iload_2
        //   3: invokespecial 26	org/eclipse/jface/preference/DirectoryFieldEditor:doFillIntoGrid	(Lorg/eclipse/swt/widgets/Composite;I)V
        //   6: bipush 28
        //   8: istore_3
        //   9: aload_0
        //   10: aload_1
        //   11: invokevirtual 28	org/cfeclipse/cfml/snippets/preferences/SnipExPreferencePage$1:getTextControl	(Lorg/eclipse/swt/widgets/Composite;)Lorg/eclipse/swt/widgets/Text;
        //   14: astore 4
        //   16: new 32	org/eclipse/swt/layout/GridData
        //   19: dup
        //   20: invokespecial 34	org/eclipse/swt/layout/GridData:<init>	()V
        //   23: astore 5
        //   25: aload 5
        //   27: iload_2
        //   28: iconst_1
        //   29: isub
        //   30: putfield 37	org/eclipse/swt/layout/GridData:horizontalSpan	I
        //   33: new 41	org/eclipse/swt/graphics/GC
        //   36: dup
        //   37: aload 4
        //   39: invokespecial 43	org/eclipse/swt/graphics/GC:<init>	(Lorg/eclipse/swt/graphics/Drawable;)V
        //   42: astore 6
        //   44: aload 6
        //   46: ldc 46
        //   48: invokevirtual 48	org/eclipse/swt/graphics/GC:textExtent	(Ljava/lang/String;)Lorg/eclipse/swt/graphics/Point;
        //   51: astore 7
        //   53: aload 5
        //   55: iload_3
        //   56: aload 7
        //   58: getfield 52	org/eclipse/swt/graphics/Point:x	I
        //   61: imul
        //   62: putfield 57	org/eclipse/swt/layout/GridData:widthHint	I
        //   65: aload 4
        //   67: aload 5
        //   69: invokevirtual 60	org/eclipse/swt/widgets/Text:setLayoutData	(Ljava/lang/Object;)V
        //   72: goto +13 -> 85
        //   75: astore 8
        //   77: aload 6
        //   79: invokevirtual 66	org/eclipse/swt/graphics/GC:dispose	()V
        //   82: aload 8
        //   84: athrow
        //   85: aload 6
        //   87: invokevirtual 66	org/eclipse/swt/graphics/GC:dispose	()V
        //   90: return
        // Line number table:
        //   Java source line #40	-> byte code offset #0
        //   Java source line #42	-> byte code offset #6
        //   Java source line #43	-> byte code offset #9
        //   Java source line #44	-> byte code offset #16
        //   Java source line #45	-> byte code offset #25
        //   Java source line #46	-> byte code offset #33
        //   Java source line #48	-> byte code offset #44
        //   Java source line #49	-> byte code offset #53
        //   Java source line #50	-> byte code offset #65
        //   Java source line #51	-> byte code offset #75
        //   Java source line #52	-> byte code offset #77
        //   Java source line #53	-> byte code offset #82
        //   Java source line #52	-> byte code offset #85
        //   Java source line #54	-> byte code offset #90
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	91	0	this	1
        //   0	91	1	parent	Composite
        //   0	91	2	numColumns	int
        //   8	48	3	widthInChars	int
        //   14	52	4	textField	org.eclipse.swt.widgets.Text
        //   23	45	5	gd	org.eclipse.swt.layout.GridData
        //   42	44	6	gc	org.eclipse.swt.graphics.GC
        //   51	6	7	extent	org.eclipse.swt.graphics.Point
        //   75	8	8	localObject	Object
        // Exception table:
        //   from	to	target	type
        //   44	75	75	finally
      }
    };
    addField(directoryFieldEditor);
    addField(new StringFieldEditor("snipExURL1", "URL 1", getFieldEditorParent()));
    addField(new StringFieldEditor("snipExURL2", "URL 2", getFieldEditorParent()));
    addField(new StringFieldEditor("snipExURL3", "URL 3", getFieldEditorParent()));
    addField(new StringFieldEditor("snipExURL4", "URL 4", getFieldEditorParent()));
    addField(new StringFieldEditor("snipExURL5", "URL 5", getFieldEditorParent()));
    addField(new StringFieldEditor("snipExURL6", "URL 6", getFieldEditorParent()));
    addField(new StringFieldEditor("snipExURL7", "URL 7", getFieldEditorParent()));
    addField(new StringFieldEditor("snipExURL8", "URL 8", getFieldEditorParent()));
  }
  
  protected void performDefaults()
  {
    super.performDefaults();
    snippetsPathField.setStringValue(preferenceManager.getPluginStateLocation());
  }
  
  public void init(IWorkbench workbench) {}
}

/* Location:
 * Qualified Name:     org.cfeclipse.cfml.snippets.preferences.SnipExPreferencePage
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.cfeclipse.cfml.snippets.properties;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.cfeclipse.cfml.snippets.SnippetPlugin;
import org.cfeclipse.cfml.snippets.preferences.CFMLPreferenceManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.ide.ResourceUtil;
import org.eclipse.ui.internal.Workbench;

public class CFMLPropertyManager
{
  private CFMLPreferenceManager preferenceManager;
  private ArrayList listeners;
  
  public CFMLPropertyManager()
  {
    preferenceManager = SnippetPlugin.getDefault().getPreferenceManager();
    listeners = new ArrayList();
  }
  
  public IPreferenceStore getStore(IProject project)
  {
    return new ProjectPropertyStore(project);
  }
  
  public void initializeDefaultValues(IProject project)
  {
    IPreferenceStore store = new ProjectPropertyStore(project);
    store.setDefault("_snippetsPath", preferenceManager.snippetsPath());
  }
  
  public String snippetsPath(IProject project)
  {
    IPreferenceStore store = new ProjectPropertyStore(project);
    String snippetsPath = store.getString("_snippetsPath").trim();
    if (snippetsPath.length() == 0)
    {
      snippetsPath = preferenceManager.snippetsPath();
      if (snippetsPath.length() == 0) {
        return defaultSnippetsPath();
      }
    }
    return snippetsPath;
  }
  
  public String defaultSnippetsPath()
  {
    return preferenceManager.snippetsPath();
  }
  
  private IResource[] getSelectedResources(IStructuredSelection selection)
  {
    Set<IResource> result = new HashSet();
    for (Object o : selection.toList())
    {
      IResource resource = (IResource)getAdapter(o, IResource.class);
      if (resource != null) {
        result.add(resource);
      }
    }
    return (IResource[])result.toArray(new IResource[result.size()]);
  }
  
  private Object getAdapter(Object adaptable, Class c)
  {
    if (c.isInstance(adaptable)) {
      return adaptable;
    }
    if ((adaptable instanceof IAd
1 2 3 4 5 6

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