org.eclipse.emf.edit.ui_2.7.0.v20120130-0943

   return result;
  }
  
  public static IEditorDescriptor getDefaultEditor(String fileName)
  {
    return (fileName != null) && (fileName.length() != 0) ? 
      getDefaultEditor(fileName, Platform.getContentTypeManager().findContentTypesFor(fileName)) : 
      null;
  }
  
  public static IEditorDescriptor getDefaultEditor(InputStream contents, String fileName)
  {
    if (contents != null) {
      try
      {
        return getDefaultEditor(fileName, Platform.getContentTypeManager().findContentTypesFor(contents, fileName));
      }
      catch (IOException e)
      {
        EMFEditUIPlugin.INSTANCE.log(e);
      }
    }
    return getDefaultEditor(fileName);
  }
  
  private static IEditorDescriptor getDefaultEditor(String fileName, IContentType[] contentTypes)
  {
    IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
    if (contentTypes.length == 0) {
      return editorRegistry.getDefaultEditor(fileName, null);
    }
    IEditorDescriptor result = null;
    for (int i = 0; (result == null) && (i < contentTypes.length); i++) {
      result = editorRegistry.getDefaultEditor(fileName, contentTypes[i]);
    }
    return result;
  }
  
  public static IEditorDescriptor getDefaultEditor(org.eclipse.emf.common.util.URI uri, URIConverter uriConverter)
  {
    String fileName = org.eclipse.emf.common.util.URI.decode(uri.lastSegment());
    if (uriConverter == null) {
      uriConverter = URIConverter.INSTANCE;
    }
    InputStream stream = null;
    try
    {
      stream = uriConverter.createInputStream(uri);
      return getDefaultEditor(stream, fileName);
    }
    catch (IOException e)
    {
      IEditorDescriptor localIEditorDescriptor;
      EMFEditUIPlugin.INSTANCE.log(e);
      return getDefaultEditor(fileName);
    }
    finally
    {
      close(stream);
    }
  }
  
  private static void close(InputStream stream)
  {
    if (stream != null) {
      try
      {
        stream.close();
      }
      catch (IOException e)
      {
        EMFEditUIPlugin.INSTANCE.log(e);
      }
    }
  }
  
  public static IEditorDescriptor[] getEditors(String fileName, boolean defaultsOnly)
  {
    return (fileName != null) && (fileName.length() != 0) ? 
      getEditors(fileName, Platform.getContentTypeManager().findContentTypesFor(fileName), defaultsOnly) : 
      new IEditorDescriptor[0];
  }
  
  public static IEditorDescriptor[] getEditors(InputStream contents, String fileName, boolean defaultsOnly)
  {
    if (contents != null) {
      try
      {
        return getEditors(fileName, Platform.getContentTypeManager().findContentTypesFor(contents, fileName), defaultsOnly);
      }
      catch (IOException e)
      {
        EMFEditUIPlugin.INSTANCE.log(e);
      }
    }
    return getEditors(fileName, defaultsOnly);
  }
  
  private static IEditorDescriptor[] getEditors(String fileName, IContentType[] contentTypes, boolean defaultsOnly)
  {
    IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
    if (contentTypes.length == 0) {
      return editorRegistry.getEditors(fileName, null);
    }
    List<IEditorDescriptor> result = new UniqueEList();
    IContentType[] arrayOfIContentType;
    int j = (arrayOfIContentType = contentTypes).length;
    for (int i = 0; i < j; i++)
    {
      IContentType contentType = arrayOfIContentType[i];
      if (defaultsOnly)
      {
        IEditorDescriptor editor = editorRegistry.getDefaultEditor(fileName, contentType);
        if (editor != null) {
          result.add(editor);
        }
      }
      else
      {
        result.addAll(Arrays.asList(editorRegistry.getEditors(fileName, contentType)));
      }
    }
    return (IEditorDescriptor[])result.toArray(new IEditorDescriptor[result.size()]);
  }
  
  public static IEditorDescriptor[] getEditors(org.eclipse.emf.common.util.URI uri, URIConverter uriConverter, boolean defaultsOnly)
  {
    String fileName = org.eclipse.emf.common.util.URI.decode(uri.lastSegment());
    if (uriConverter == null) {
      uriConverter = URIConverter.INSTANCE;
    }
    InputStream stream = null;
    try
    {
      stream = uriConverter.createInputStream(uri);
      return getEditors(stream, fileName, defaultsOnly);
    }
    catch (IOException e)
    {
      IEditorDescriptor[] arrayOfIEditorDescriptor;
      EMFEditUIPlugin.INSTANCE.log(e);
      return getEditors(fileName, defaultsOnly);
    }
    finally
    {
      close(stream);
    }
  }
  
  private static class EclipseUtil
  {
    static final Class<?> FILE_CLASS;
    static final Class<?> FILE_REVISION_CLASS;
    static final Method FILE_REVISION_GET_URI_METHOD;
    static final Class<?> URI_EDITOR_INPUT_CLASS;
    
    static
    {
      Class<?> fileClass = null;
      try
      {
        fileClass = IFile.class;
      }
      catch (Throwable localThrowable) {}
      FILE_CLASS = fileClass;
      
      Class<?> fileRevisionClass = null;
      Method fileRevisionGetURIMethod = null;
      Bundle bundle = Platform.getBundle("org.eclipse.team.core");
      if ((bundle != null) && ((bundle.getState() & 0x2C) != 0)) {
        try
        {
          fileRevisionClass = bundle.loadClass("org.eclipse.team.core.history.IFileRevision");
          fileRevisionGetURIMethod = fileRevisionClass.getMethod("getURI", new Class[0]);
        }
        catch (Throwable localThrowable1) {}
      }
      FILE_REVISION_CLASS = fileRevisionClass;
      FILE_REVISION_GET_URI_METHOD = fileRevisionGetURIMethod;
      
      Class<?> uriEditorInputClass = null;
      try
      {
        uriEditorInputClass = IURIEditorInput.class;
      }
      catch (Throwable localThrowable2) {}
      URI_EDITOR_INPUT_CLASS = uriEditorInputClass;
    }
    
    public static org.eclipse.emf.common.util.URI getURI(IEditorInput editorInput)
    {
      if (FILE_CLASS != null)
      {
        IFile file = (IFile)editorInput.getAdapter(FILE_CLASS);
        if (file != null) {
          return org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
        }
      }
      if (FILE_REVISION_CLASS != null)
      {
        Object fileRevision = editorInput.getAdapter(FILE_REVISION_CLASS);
        if (fileRevision != null) {
          try
          {
            return org.eclipse.emf.common.util.URI.createURI(((java.net.URI)FILE_REVISION_GET_URI_METHOD.invoke(fileRevision, new Object[0])).toString());
          }
          catch (Throwable exception)
          {
            EMFEditUIPlugin.INSTANCE.log(exception);
          }
        }
      }
      if (URI_EDITOR_INPUT_CLASS != null) {
        if ((editorInput instanceof IURIEditorInput)) {
          return org.eclipse.emf.common.util.URI.createURI(((IURIEditorInput)editorInput).getURI().toString()).trimFragment();
        }
      }
      return null;
    }
    
    public static IEditorInput createFileEditorInput(IFile file)
    {
      return new FileEditorInput(file);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.ui.util.EditUIUtil
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.ui.util;

public abstract interface QueryDelegateTextViewer$Factory$Descriptor
{
  public abstract QueryDelegateTextViewer.Factory getFactory();
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.ui.util.QueryDelegateTextViewer.Factory.Descriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.ui.util;

import java.util.HashMap;

public class QueryDelegateTextViewer$Factory$Registry$Impl
  extends HashMap<String, Object>
  implements QueryDelegateTextViewer.Factory.Registry
{
  private static final long serialVersionUID = 1L;
  
  public Object get(Object key)
  {
    Object factory = super.get(key);
    if ((factory instanceof QueryDelegateTextViewer.Factory.Descriptor))
    {
      QueryDelegateTextViewer.Factory.Descriptor factoryDescriptor = (QueryDelegateTextViewer.Factory.Descriptor)factory;
      factory = factoryDescriptor.getFactory();
      put((String)key, factory);
      return factory;
    }
    return factory;
  }
  
  public QueryDelegateTextViewer.Factory getFactory(String uri)
  {
    return (QueryDelegateTextViewer.Factory)get(uri);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.ui.util.QueryDelegateTextViewer.Factory.Registry.Impl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.ui.util;

import java.util.HashMap;
import java.util.Map;

public abstract interface QueryDelegateTextViewer$Factory$Registry
  extends Map<String, Object>
{
  public static final Registry INSTANCE = new Impl();
  
  public abstract QueryDelegateTextViewer.Factory getFactory(String paramString);
  
  public static class Impl
    extends HashMap<String, Object>
    implements QueryDelegateTextViewer.Factory.Registry
  {
    private static final long serialVersionUID = 1L;
    
    public Object get(Object key)
    {
      Object factory = super.get(key);
      if ((factory instanceof QueryDelegateTextViewer.Factory.Descriptor))
      {
        QueryDelegateTextViewer.Factory.Descriptor factoryDescriptor = (QueryDelegateTextViewer.Factory.Descriptor)factory;
        factory = factoryDescriptor.getFactory();
        put((String)key, factory);
        return factory;
      }
      return factory;
    }
    
    public QueryDelegateTextViewer.Factory getFactory(String uri)
    {
      return (QueryDelegateTextViewer.Factory)get(uri);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.ui.util.QueryDelegateTextViewer.Factory.Registry
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.ui.util;

import java.util.HashMap;
import java.util.Map;
import org.eclipse.swt.widgets.Composite;

public abstract interface QueryDelegateTextViewer$Factory
{
  public abstract QueryDelegateTextViewer createTextViewer(Composite paramComposite, int paramInt);
  
  public static abstract interface Descriptor
  {
    public abstract QueryDelegateTextViewer.Factory getFactory();
  }
  
  public static abstract interface Registry
    extends Map<String, Object>
  {
    public static final Registry INSTANCE = new Impl();
    
    public abstract QueryDelegateTextViewer.Factory getFactory(String paramString);
    
    public static class Impl
      extends HashMap<String, Object>
      implements QueryDelegateTextViewer.Factory.Registry
    {
      private static final long serialVersionUID = 1L;
      
      public Object get(Object key)
      {
        Object factory = super.get(key);
        if ((factory instanceof QueryDelegateTextViewer.Factory.Descriptor))
        {
          QueryDelegateTextViewer.Factory.Descriptor factoryDescriptor = (QueryDelegateTextViewer.Factory.Descriptor)factory;
          factory = factoryDescriptor.getFactory();
          put((String)key, factory);
          return factory;
        }
        return factory;
      }
      
      public QueryDelegateTextViewer.Factory getFactory(String uri)
      {
        return (QueryDelegateTextViewer.Factory)get(uri);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.ui.util.QueryDelegateTextViewer.Factory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.ui.util;

import java.util.HashMap;
import java.util.Map;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.swt.widgets.Composite;

public abstract interface QueryDelegateTextViewer
  extends ITextViewer
{
  public abstract void setContext(EClassifier paramEClassifier);
  
  public abstract void setParameters(Map<String, EClassifier> paramMap);
  
  public static abstract interface Factory
  {
    public abstract QueryDelegateTextViewer createTextViewer(Composite paramComposite, int paramInt);
    
    public static abstract interface Descriptor
    {
      public abstract QueryDelegateTextViewer.Factory getFactory();
    }
    
    public static abstract interface Registry
      extends Map<String, Object>
    {
      public static final Registry INSTANCE = new Impl();
      
      public abstract QueryDelegateTextViewer.Factory getFactory(String paramString);
      
      public static class Impl
        extends HashMap<String, Object>
        implements QueryDelegateTextViewer.Factory.Registry
      {
        private static final long serialVersionUID = 1L;
        
        public Object get(Object key)
        {
          Object factory = super.get(key);
          if ((factory instanceof QueryDelegateTextViewer.Factory.Descriptor))
          {
            QueryDelegateTextViewer.Factory.Descriptor factoryDescriptor = (QueryDelegateTextViewer.Factory.Descriptor)factory;
            factory = factoryDescriptor.getFactory();
            put((String)key, factory);
            return factory;
          }
          return factory;
        }
        
        public QueryDelegateTextViewer.Factory getFactory(String uri)
        {
          return (QueryDelegateTextViewer.Factory)get(uri);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.ui.util.QueryDelegateTextViewer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.ui.view;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.jface.action.Action;

public class ExtendedPropertySheetPage$LocateValueAction
  extends Action
{
  public ExtendedPropertySheetPage$LocateValueAction(ExtendedPropertySheetPage paramExtendedPropertySheetPage)
  {
    setText(EMFEditUIPlugin.INSTANCE.getString("_UI_LocateValue_action"));
    setToolTipText(EMFEditUIPlugin.INSTANCE.getString("_UI_LocateValue_action_tool_tip"));
    setImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(EMFEditUIPlugin.INSTANCE.getImage("full/elcl16/LocateValue")));
    setDisabledImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(EMFEditUIPlugin.INSTANCE.getImage("full/dlcl16/LocateValue")));
  }
  
  public void run()
  {
    List<Object> selection = new ArrayList();
    for (Object object : this$0.objectsToSelect) {
      selection.add(this$0.editingDomain.getWrapper(object));
    }
    this$0.setSelectionToViewer(selection);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage.LocateValueAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.edit.ui.view;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.views.properties.PropertySheetEntry;
import org.eclipse.ui.views.properties.PropertySheetPage;

public class ExtendedPropertySheetPage
  extends PropertySheetPage
{
  protected List<Object> objectsToSelect = new ArrayList();
  protected AdapterFactoryEditingDomain editingDomain;
  protected IAction locateValueAction = new LocateValueAction();
  
  protected class LocateValueAction
    extends Action
  {
    public LocateValueAction()
    {
      setText(EMFEditUIPlugin.INSTANCE.getString("_UI_LocateValue_action"));
      setToolTipText(EMFEditUIPlugin.INSTANCE.getString("_UI_LocateValue_action_tool_tip"));
      setImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(EMFEditUIPlugin.INSTANCE.getImage("full/elcl16/LocateValue")));
      setDisabledImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(EMFEditUIPlugin.INSTANCE.getImage("full/dlcl16/LocateValue")));
    }
    
    public void run()
    {
      List<Object> selection = new ArrayList();
      for (Object object : objectsToSelect) {
        selection.add(editingDomain.getWrapper(object));
      }
      setSelectionToViewer(selection);
    }
  }
  
  public ExtendedPropertySheetPage(AdapterFactoryEditingDomain editingDomain)
  {
    this.editingDomain = editingDomain;
  }
  
  protected void setSelectionToViewer(List<?> selection) {}
  
  public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager)
  {
    super.makeContributions(menuManager, toolBarManager, statusLineManager);
    toolBarManager.add(locateValueAction);
  }
  
  public void handleEntrySelection(ISelection selection)
  {
    super.handleEntrySelection(selection);
    objectsToSelect.clear();
    if ((!selection.isEmpty()) && ((selection instanceof IStructuredSelection)))
    {
      IStructuredSelection structuredSelection = (IStructuredSelection)selection;
      if (structuredSelection.size() == 1)
      {
        Object object = structuredSelection.getFirstElement();
        if ((object instanceof PropertySheetEntry))
        {
          PropertySheetEntry entry = (PropertySheetEntry)object;
          Object[] values = entry.getValues();
          if (values != null) {
            for (int i = 0; i < values.length; i++)
            {
              Object value = values[i];
              if ((value instanceof IItemPropertySource))
              {
                Object realValue = ((IItemPropertySource)value).getEditableValue(null);
                if ((realValue instanceof Collection)) {
                  for (Object o : (Collection)realValue) {
                    addObjectToSelect(o);
                  }
                } else {
                  addObjectToSelect(realValue);
                }
              }
            }
          }
        }
      }
    }
    locateValueAction.setEnabled(!objectsToSelect.isEmpty());
  }
  
  protected void addObjectToSelect(Object object)
  {
    if ((object instanceof EObject)) {
      objectsToSelect.add(object);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
1 2 3 4 5 6 7 8

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-2019. Infinite Loop Ltd