org.eclipse.emf.ecore.editor_2.7.0.v20120130-0943

16:43:31.020 INFO  jd.cli.Main - Decompiling org.eclipse.emf.ecore.editor_2.7.0.v20120130-0943.jar
package org.eclipse.emf.ecore.action;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.presentation.DynamicModelWizard;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionDelegate;

public class CreateDynamicInstanceAction
  extends ActionDelegate
  implements IActionDelegate
{
  protected static final URI PLATFORM_RESOURCE = URI.createPlatformResourceURI("/", false);
  protected EClass eClass;
  
  public void run(IAction action)
  {
    URI uri = eClass.eResource().getURI();
    IStructuredSelection selection = StructuredSelection.EMPTY;
    if ((uri != null) && (uri.isHierarchical())) {
      if ((uri.isRelative()) || ((uri = uri.deresolve(PLATFORM_RESOURCE)).isRelative()))
      {
        IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toString()));
        if (file.exists()) {
          selection = new StructuredSelection(file);
        }
      }
    }
    DynamicModelWizard dynamicModelWizard = new DynamicModelWizard(eClass);
    dynamicModelWizard.init(PlatformUI.getWorkbench(), selection);
    WizardDialog wizardDialog = 
      new WizardDialog(
      PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 
      dynamicModelWizard);
    
    wizardDialog.open();
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IStructuredSelection))
    {
      Object object = ((IStructuredSelection)selection).getFirstElement();
      if ((object instanceof EClass))
      {
        eClass = ((EClass)object);
        
        action.setEnabled(!eClass.isAbstract());
        return;
      }
    }
    eClass = null;
    action.setEnabled(false);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.action.CreateDynamicInstanceAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.action;

import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.emf.ecore.resource.Resource.Factory.Registry;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionDelegate;
import org.eclipse.ui.part.FileEditorInput;

public class OpenEditorAction
  extends ActionDelegate
  implements IActionDelegate
{
  protected IFile file;
  
  public void run(IAction action)
  {
    IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchPage page = workbenchWindow.getActivePage();
    try
    {
      page.openEditor(
        new FileEditorInput(file), 
        action.getId().indexOf("XML") == -1 ? 
        "org.eclipse.emf.ecore.presentation.ReflectiveEditorID" : 
        "org.eclipse.emf.ecore.presentation.XMLReflectiveEditorID");
    }
    catch (PartInitException exception)
    {
      MessageDialog.openError(workbenchWindow.getShell(), "Open Editor", exception.getMessage());
    }
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IStructuredSelection))
    {
      Object object = ((IStructuredSelection)selection).getFirstElement();
      if ((object instanceof IFile))
      {
        file = ((IFile)object);
        
        action.setEnabled(
          (action.getId().indexOf("XML") != -1) || 
          (Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey(
          file.getFullPath().getFileExtension())));
        return;
      }
    }
    file = null;
    action.setEnabled(false);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.action.OpenEditorAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import org.eclipse.core.resources.IFile;
import org.eclipse.ui.actions.WorkspaceModifyOperation;

class DynamicModelWizard$1
  extends WorkspaceModifyOperation
{
  DynamicModelWizard$1(DynamicModelWizard paramDynamicModelWizard, IFile paramIFile) {}
  
  /* Error */
  protected void execute(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
  {
    // Byte code:
    //   0: new 71	org/eclipse/emf/ecore/resource/impl/ResourceSetImpl
    //   3: dup
    //   4: invokespecial 129	org/eclipse/emf/ecore/resource/impl/ResourceSetImpl:<init>	()V
    //   7: astore_2
    //   8: aload_2
    //   9: invokeinterface 139 1 0
    //   14: invokeinterface 141 1 0
    //   19: invokestatic 127	org/eclipse/emf/ecore/plugin/EcorePlugin:computePlatformURIMap	()Ljava/util/Map;
    //   22: invokeinterface 131 2 0
    //   27: aload_0
    //   28: getfield 121	org/eclipse/emf/ecore/presentation/DynamicModelWizard$1:val$modelFile	Lorg/eclipse/core/resources/IFile;
    //   31: invokeinterface 133 1 0
    //   36: invokeinterface 134 1 0
    //   41: iconst_1
    //   42: invokestatic 126	org/eclipse/emf/common/util/URI:createPlatformResourceURI	(Ljava/lang/String;Z)Lorg/eclipse/emf/common/util/URI;
    //   45: astore_3
    //   46: aload_2
    //   47: aload_3
    //   48: invokeinterface 140 2 0
    //   53: astore 4
    //   55: aload_0
    //   56: getfield 122	org/eclipse/emf/ecore/presentation/DynamicModelWizard$1:this$0	Lorg/eclipse/emf/ecore/presentation/DynamicModelWizard;
    //   59: invokevirtual 128	org/eclipse/emf/ecore/presentation/DynamicModelWizard:createInitialModel	()Lorg/eclipse/emf/ecore/EObject;
    //   62: astore 5
    //   64: aload 5
    //   66: ifnull +18 -> 84
    //   69: aload 4
    //   71: invokeinterface 138 1 0
    //   76: aload 5
    //   78: invokeinterface 136 2 0
    //   83: pop
    //   84: new 58	java/util/HashMap
    //   87: dup
    //   88: invokespecial 125	java/util/HashMap:<init>	()V
    //   91: astore 6
    //   93: aload 6
    //   95: ldc 2
    //   97: getstatic 120	java/lang/Boolean:TRUE	Ljava/lang/Boolean;
    //   100: invokeinterface 132 3 0
    //   105: pop
    //   106: aload 6
    //   108: ldc 1
    //   110: bipush 80
    //   112: invokestatic 124	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   115: invokeinterface 132 3 0
    //   120: pop
    //   121: aload 4
    //   123: aload 6
    //   125: invokeinterface 137 2 0
    //   130: goto +28 -> 158
    //   133: astore_2
    //   134: aload_2
    //   135: invokevirtual 123	java/lang/Exception:printStackTrace	()V
    //   138: aload_1
    //   139: invokeinterface 135 1 0
    //   144: goto +20 -> 164
    //   147: astore 7
    //   149: aload_1
    //   150: invokeinterface 135 1 0
    //   155: aload 7
    //   157: athrow
    //   158: aload_1
    //   159: invokeinterface 135 1 0
    //   164: return
    // Line number table:
    //   Java source line #136	-> byte code offset #0
    //   Java source line #137	-> byte code offset #8
    //   Java source line #141	-> byte code offset #27
    //   Java source line #145	-> byte code offset #46
    //   Java source line #149	-> byte code offset #55
    //   Java source line #150	-> byte code offset #64
    //   Java source line #152	-> byte code offset #69
    //   Java source line #157	-> byte code offset #84
    //   Java source line #158	-> byte code offset #93
    //   Java source line #159	-> byte code offset #106
    //   Java source line #160	-> byte code offset #121
    //   Java source line #162	-> byte code offset #133
    //   Java source line #164	-> byte code offset #134
    //   Java source line #168	-> byte code offset #138
    //   Java source line #167	-> byte code offset #147
    //   Java source line #168	-> byte code offset #149
    //   Java source line #169	-> byte code offset #155
    //   Java source line #168	-> byte code offset #158
    //   Java source line #170	-> byte code offset #164
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	165	0	this	1
    //   0	165	1	progressMonitor	org.eclipse.core.runtime.IProgressMonitor
    //   7	40	2	resourceSet	org.eclipse.emf.ecore.resource.ResourceSet
    //   133	2	2	exception	Exception
    //   45	3	3	fileURI	org.eclipse.emf.common.util.URI
    //   53	69	4	resource	org.eclipse.emf.ecore.resource.Resource
    //   62	15	5	rootObject	org.eclipse.emf.ecore.EObject
    //   91	33	6	options	java.util.Map<Object, Object>
    //   147	9	7	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	130	133	java/lang/Exception
    //   0	138	147	finally
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.DynamicModelWizard.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.part.ISetSelectionTarget;

class DynamicModelWizard$2
  implements Runnable
{
  DynamicModelWizard$2(DynamicModelWizard paramDynamicModelWizard, IWorkbenchPart paramIWorkbenchPart, ISelection paramISelection) {}
  
  public void run()
  {
    ((ISetSelectionTarget)val$activePart).selectReveal(val$targetSelection);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.DynamicModelWizard.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;

public class DynamicModelWizard$DynamicModelWizardNewFileCreationPage
  extends WizardNewFileCreationPage
{
  protected IFile modelFile;
  
  public DynamicModelWizard$DynamicModelWizardNewFileCreationPage(DynamicModelWizard paramDynamicModelWizard, String pageId, IStructuredSelection selection)
  {
    super(pageId, selection);
  }
  
  protected boolean validatePage()
  {
    if (super.validatePage())
    {
      String requiredExt = EcoreEditorPlugin.INSTANCE.getString("_UI_DynamicInstanceFilenameExtension");
      String enteredExt = new Path(getFileName()).getFileExtension();
      if ((enteredExt == null) || (!enteredExt.equals(requiredExt)))
      {
        setErrorMessage(EcoreEditorPlugin.INSTANCE.getString("_WARN_FilenameExtension", new Object[] { requiredExt }));
        return false;
      }
      return true;
    }
    return false;
  }
  
  public boolean performFinish()
  {
    modelFile = getModelFile();
    return true;
  }
  
  public IFile getModelFile()
  {
    return 
      modelFile == null ? 
      ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())) : 
      modelFile;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.DynamicModelWizard.DynamicModelWizardNewFileCreationPage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import java.util.Iterator;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.EMFEditPlugin;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.part.ISetSelectionTarget;

public class DynamicModelWizard
  extends Wizard
  implements INewWizard
{
  protected EClass eClass;
  protected DynamicModelWizardNewFileCreationPage newFileCreationPage;
  protected IStructuredSelection selection;
  protected IWorkbench workbench;
  
  public DynamicModelWizard(EClass eClass)
  {
    this.eClass = eClass;
  }
  
  public void init(IWorkbench workbench, IStructuredSelection selection)
  {
    this.workbench = workbench;
    this.selection = selection;
    setDefaultPageImageDescriptor(
      ExtendedImageRegistry.INSTANCE.getImageDescriptor(EMFEditPlugin.INSTANCE.getImage("full/wizban/NewModel")));
  }
  
  EObject createInitialModel()
  {
    return EcoreUtil.create(eClass);
  }
  
  public boolean performFinish()
  {
    try
    {
      final IFile modelFile = getModelFile();
      
      WorkspaceModifyOperation operation = 
        new WorkspaceModifyOperation()
        {
          /* Error */
          protected void execute(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
          {
            // Byte code:
            //   0: new 71	org/eclipse/emf/ecore/resource/impl/ResourceSetImpl
            //   3: dup
            //   4: invokespecial 129	org/eclipse/emf/ecore/resource/impl/ResourceSetImpl:<init>	()V
            //   7: astore_2
            //   8: aload_2
            //   9: invokeinterface 139 1 0
            //   14: invokeinterface 141 1 0
            //   19: invokestatic 127	org/eclipse/emf/ecore/plugin/EcorePlugin:computePlatformURIMap	()Ljava/util/Map;
            //   22: invokeinterface 131 2 0
            //   27: aload_0
            //   28: getfield 121	org/eclipse/emf/ecore/presentation/DynamicModelWizard$1:val$modelFile	Lorg/eclipse/core/resources/IFile;
            //   31: invokeinterface 133 1 0
            //   36: invokeinterface 134 1 0
            //   41: iconst_1
            //   42: invokestatic 126	org/eclipse/emf/common/util/URI:createPlatformResourceURI	(Ljava/lang/String;Z)Lorg/eclipse/emf/common/util/URI;
            //   45: astore_3
            //   46: aload_2
            //   47: aload_3
            //   48: invokeinterface 140 2 0
            //   53: astore 4
            //   55: aload_0
            //   56: getfield 122	org/eclipse/emf/ecore/presentation/DynamicModelWizard$1:this$0	Lorg/eclipse/emf/ecore/presentation/DynamicModelWizard;
            //   59: invokevirtual 128	org/eclipse/emf/ecore/presentation/DynamicModelWizard:createInitialModel	()Lorg/eclipse/emf/ecore/EObject;
            //   62: astore 5
            //   64: aload 5
            //   66: ifnull +18 -> 84
            //   69: aload 4
            //   71: invokeinterface 138 1 0
            //   76: aload 5
            //   78: invokeinterface 136 2 0
            //   83: pop
            //   84: new 58	java/util/HashMap
            //   87: dup
            //   88: invokespecial 125	java/util/HashMap:<init>	()V
            //   91: astore 6
            //   93: aload 6
            //   95: ldc 2
            //   97: getstatic 120	java/lang/Boolean:TRUE	Ljava/lang/Boolean;
            //   100: invokeinterface 132 3 0
            //   105: pop
            //   106: aload 6
            //   108: ldc 1
            //   110: bipush 80
            //   112: invokestatic 124	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
            //   115: invokeinterface 132 3 0
            //   120: pop
            //   121: aload 4
            //   123: aload 6
            //   125: invokeinterface 137 2 0
            //   130: goto +28 -> 158
            //   133: astore_2
            //   134: aload_2
            //   135: invokevirtual 123	java/lang/Exception:printStackTrace	()V
            //   138: aload_1
            //   139: invokeinterface 135 1 0
            //   144: goto +20 -> 164
            //   147: astore 7
            //   149: aload_1
            //   150: invokeinterface 135 1 0
            //   155: aload 7
            //   157: athrow
            //   158: aload_1
            //   159: invokeinterface 135 1 0
            //   164: return
            // Line number table:
            //   Java source line #136	-> byte code offset #0
            //   Java source line #137	-> byte code offset #8
            //   Java source line #141	-> byte code offset #27
            //   Java source line #145	-> byte code offset #46
            //   Java source line #149	-> byte code offset #55
            //   Java source line #150	-> byte code offset #64
            //   Java source line #152	-> byte code offset #69
            //   Java source line #157	-> byte code offset #84
            //   Java source line #158	-> byte code offset #93
            //   Java source line #159	-> byte code offset #106
            //   Java source line #160	-> byte code offset #121
            //   Java source line #162	-> byte code offset #133
            //   Java source line #164	-> byte code offset #134
            //   Java source line #168	-> byte code offset #138
            //   Java source line #167	-> byte code offset #147
            //   Java source line #168	-> byte code offset #149
            //   Java source line #169	-> byte code offset #155
            //   Java source line #168	-> byte code offset #158
            //   Java source line #170	-> byte code offset #164
            // Local variable table:
            //   start	length	slot	name	signature
            //   0	165	0	this	1
            //   0	165	1	progressMonitor	org.eclipse.core.runtime.IProgressMonitor
            //   7	40	2	resourceSet	org.eclipse.emf.ecore.resource.ResourceSet
            //   133	2	2	exception	Exception
            //   45	3	3	fileURI	org.eclipse.emf.common.util.URI
            //   53	69	4	resource	org.eclipse.emf.ecore.resource.Resource
            //   62	15	5	rootObject	EObject
            //   91	33	6	options	java.util.Map<Object, Object>
            //   147	9	7	localObject	Object
            // Exception table:
            //   from	to	target	type
            //   0	130	133	java/lang/Exception
            //   0	138	147	finally
          }
        };
        getContainer().run(false, false, operation);
        
        IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
        IWorkbenchPage page = workbenchWindow.getActivePage();
        final IWorkbenchPart activePart = page.getActivePart();
        if ((activePart instanceof ISetSelectionTarget))
        {
          final ISelection targetSelection = new StructuredSelection(modelFile);
          getShell().getDisplay().asyncExec(
            new Runnable()
            {
              public void run()
              {
                ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
              }
            });
        }
        try
        {
          IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString());
          if (editorDescriptor != null) {
            page.openEditor(new FileEditorInput(modelFile), editorDescriptor.getId());
          }
        }
        catch (PartInitException exception)
        {
          MessageDialog.openError(
            workbenchWindow.getShell(), EcoreEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
          return false;
        }
        return true;
      }
      catch (Exception exception)
      {
        exception.printStackTrace();
      }
      return false;
    }
    
    public class DynamicModelWizardNewFileCreationPage
      extends WizardNewFileCreationPage
    {
      protected IFile modelFile;
      
      public DynamicModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection)
      {
        super(selection);
      }
      
      protected boolean validatePage()
      {
        if (super.validatePage())
        {
          String requiredExt = EcoreEditorPlugin.INSTANCE.getString("_UI_DynamicInstanceFilenameExtension");
          String enteredExt = new Path(getFileName()).getFileExtension();
          if ((enteredExt == null) || (!enteredExt.equals(requiredExt)))
          {
            setErrorMessage(EcoreEditorPlugin.INSTANCE.getString("_WARN_FilenameExtension", new Object[] { requiredExt }));
            return false;
          }
          return true;
        }
        return false;
      }
      
      public boolean performFinish()
      {
        modelFile = getModelFile();
        return true;
      }
      
      public IFile getModelFile()
      {
        return 
          modelFile == null ? 
          ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())) : 
          modelFile;
      }
    }
    
    public void addPages()
    {
      newFileCreationPage = new DynamicModelWizardNewFileCreationPage("Whatever", selection);
      newFileCreationPage.setTitle(EcoreEditorPlugin.INSTANCE.getString("_UI_DynamicModelWizard_label"));
      newFileCreationPage.setDescription(
        EcoreEditorPlugin.INSTANCE.getString("_UI_DynamicModelWizard_description", new Object[] { eClass.getName() }));
      newFileCreationPage.setFileName(
        eClass.getName() + "." + EcoreEditorPlugin.INSTANCE.getString("_UI_DynamicInstanceFilenameExtension"));
      addPage(newFileCreationPage);
      if ((selection != null) && (!selection.isEmpty()))
      {
        Object selectedElement = selection.iterator().next();
        if ((selectedElement instanceof IResource))
        {
          IResource selectedResource = (IResource)selectedElement;
          if (selectedResource.getType() == 1) {
            selectedResource = selectedResource.getParent();
          }
          if (((selectedResource instanceof IFolder)) || ((selectedResource instanceof IProject)))
          {
            newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
            
            String defaultModelBaseFilename = eClass.getName();
            String defaultModelFilenameExtension = EcoreEditorPlugin.INSTANCE.getString("_UI_DynamicInstanceFilenameExtension");
            String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
            for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; i++) {
              modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
            }
            newFileCreationPage.setFileName(modelFilename);
          }
        }
      }
    }
    
    public IFile getModelFile()
    {
      return newFileCreationPage.getModelFile();
    }
  }

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.DynamicModelWizard
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;

class EcoreActionBarContributor$1
  extends Action
{
  EcoreActionBarContributor$1(EcoreActionBarContributor paramEcoreActionBarContributor, String $anonymous0)
  {
    super($anonymous0);
  }
  
  public void run()
  {
    try
    {
      this$0.getPage().showView("org.eclipse.ui.views.PropertySheet");
    }
    catch (PartInitException exception)
    {
      EcoreEditorPlugin.INSTANCE.log(exception);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import org.eclipse.emf.common.ui.viewer.IViewerProvider;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.Viewer;

class EcoreActionBarContributor$2
  extends Action
{
  EcoreActionBarContributor$2(EcoreActionBarContributor paramEcoreActionBarContributor, String $anonymous0)
  {
    super($anonymous0);
  }
  
  public boolean isEnabled()
  {
    return this$0.activeEditorPart instanceof IViewerProvider;
  }
  
  public void run()
  {
    if ((this$0.activeEditorPart instanceof IViewerProvider))
    {
      Viewer viewer = ((IViewerProvider)this$0.activeEditorPart).getViewer();
      if (viewer != null) {
        viewer.refresh();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import org.eclipse.emf.common.ui.action.ViewerFilterAction;
import org.eclipse.emf.ecore.EGenericType;
import org.eclipse.emf.ecore.ETypeParameter;
import org.eclipse.jface.viewers.Viewer;

class EcoreActionBarContributor$3
  extends ViewerFilterAction
{
  EcoreActionBarContributor$3(EcoreActionBarContributor paramEcoreActionBarContributor, String $anonymous0, int $anonymous1)
  {
    super($anonymous0, $anonymous1);
  }
  
  protected void refreshViewers()
  {
    super.refreshViewers();
    if ((this$0.lastSelectionChangedEvent != null) && ((this$0.activeEditorPart instanceof EcoreEditor))) {
      this$0.selectionChanged(this$0.lastSelectionChangedEvent);
    }
  }
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    return (isChecked()) || ((!(element instanceof ETypeParameter)) && (!(element instanceof EGenericType)));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;

class EcoreActionBarContributor$4
  implements IMenuListener
{
  EcoreActionBarContributor$4(EcoreActionBarContributor paramEcoreActionBarContributor) {}
  
  public void menuAboutToShow(IMenuManager menuManager)
  {
    menuManager.updateAll(true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.EcoreUtil.ContentTreeIterator;

class EcoreActionBarContributor$ExtendedLoadResourceAction$ExtendedLoadResourceDialog$1
  extends EcoreUtil.ContentTreeIterator<Object>
{
  private static final long serialVersionUID = 1L;
  
  EcoreActionBarContributor$ExtendedLoadResourceAction$ExtendedLoadResourceDialog$1(EcoreActionBarContributor.ExtendedLoadResourceAction.ExtendedLoadResourceDialog paramExtendedLoadResourceDialog, Collection $anonymous0)
  {
    super($anonymous0);
  }
  
  protected Iterator<? extends EObject> getEObjectChildren(EObject eObject)
  {
    return 
      (eObject instanceof EPackage) ? 
      ((EPackage)eObject).getESubpackages().iterator() : 
      Collections.emptyList().iterator();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.ExtendedLoadResourceAction.ExtendedLoadResourceDialog.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Text;

class EcoreActionBarContributor$ExtendedLoadResourceAction$ExtendedLoadResourceDialog$2
  extends SelectionAdapter
{
  EcoreActionBarContributor$ExtendedLoadResourceAction$ExtendedLoadResourceDialog$2(EcoreActionBarContributor.ExtendedLoadResourceAction.ExtendedLoadResourceDialog paramExtendedLoadResourceDialog) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    EcoreActionBarContributor.ExtendedLoadResourceAction.RegisteredPackageDialog registeredPackageDialog = new EcoreActionBarContributor.ExtendedLoadResourceAction.RegisteredPackageDialog(this$2.getShell());
    registeredPackageDialog.open();
    Object[] result = registeredPackageDialog.getResult();
    if (result != null)
    {
      List<?> nsURIs = Arrays.asList(result);
      if (registeredPackageDialog.isDevelopmentTimeVersion())
      {
        ResourceSet resourceSet = new ResourceSetImpl();
        resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap());
        StringBuffer uris = new StringBuffer();
        Map<String, URI> ePackageNsURItoGenModelLocationMap = EcorePlugin.getEPackageNsURIToGenModelLocationMap();
        int i = 0;
        Resource resource;
        for (int length = result.length; i < length; i++)
        {
          URI location = (URI)ePackageNsURItoGenModelLocationMap.get(result[i]);
          resource = resourceSet.getResource(location, true);
          EcoreUtil.resolveAll(resource);
        }
        for (Resource resource : resourceSet.getResources()) {
          for (EPackage ePackage : this$2.getAllPackages(resource)) {
            if (nsURIs.contains(ePackage.getNsURI()))
            {
              uris.append(resource.getURI());
              uris.append("  ");
              break;
            }
          }
        }
        EcoreActionBarContributor.ExtendedLoadResourceAction.ExtendedLoadResourceDialog.access$0(this$2).setText((EcoreActionBarContributor.ExtendedLoadResourceAction.ExtendedLoadResourceDialog.access$0(this$2).getText() + "  " + uris.toString()).trim());
      }
      else
      {
        StringBuffer uris = new StringBuffer();
        int i = 0;
        for (int length = result.length; i < length; i++)
        {
          uris.append(result[i]);
          uris.append("  ");
        }
        EcoreActionBarContributor.ExtendedLoadResourceAction.ExtendedLoadResourceDialog.access$0(this$2).setText((EcoreActionBarContributor.ExtendedLoadResourceAction.ExtendedLoadResourceDialog.access$0(this$2).getText() + "  " + uris.toString()).trim());
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.ExtendedLoadResourceAction.ExtendedLoadResourceDialog.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EPackage.Registry;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.EcoreUtil.ContentTreeIterator;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class EcoreActionBarContributor$ExtendedLoadResourceAction$ExtendedLoadResourceDialog
  extends LoadResourceAction.LoadResourceDialog
{
  protected Set<EPackage> registeredPackages = new LinkedHashSet();
  
  public EcoreActionBarContributor$ExtendedLoadResourceAction$ExtendedLoadResourceDialog(Shell parent, EditingDomain domain)
  {
    super(parent, domain);
  }
  
  protected boolean processResource(Resource resource)
  {
    ResourceSet resourceSet = domain.getResourceSet();
    if (!resourceSet.getResources().contains(resource))
    {
      EPackage.Registry packageRegistry = resourceSet.getPackageRegistry();
      for (EPackage ePackage : getAllPackages(resource))
      {
        packageRegistry.put(ePackage.getNsURI(), ePackage);
        registeredPackages.add(ePackage);
      }
    }
    return true;
  }
  
  public Set<EPackage> getRegisteredPackages()
  {
    return registeredPackages;
  }
  
  protected Collection<EPackage> getAllPackages(Resource resource)
  {
    List<EPackage> result = new ArrayList();
    for (TreeIterator<?> j = 
          new EcoreUtil.ContentTreeIterator(resource.getContents())
        {
          private static final long serialVersionUID = 1L;
          
          protected Iterator<? extends EObject> getEObjectChildren(EObject eObject)
          {
            return 
              (eObject instanceof EPackage) ? 
              ((EPackage)eObject).getESubpackages().iterator() : 
              Collections.emptyList().iterator();
          }
        }; 
        
          j.hasNext();)
    {
      Object content = j.next();
      if ((content instanceof EPackage)) {
        result.add((EPackage)content);
      }
    }
    return result;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = (Composite)super.createDialogArea(parent);
    Composite buttonComposite = (Composite)composite.getChildren()[0];
    Button browseRegisteredPackagesButton = new Button(buttonComposite, 8);
    browseRegisteredPackagesButton.setText(EcoreEditorPlugin.INSTANCE.getString("_UI_BrowseRegisteredPackages_label"));
    prepareBrowseRegisteredPackagesButton(browseRegisteredPackagesButton);
    
    FormData data = new FormData();
    Control[] children = buttonComposite.getChildren();
    left = new FormAttachment(0, 0);
    right = new FormAttachment(children[0], -10);
    browseRegisteredPackagesButton.setLayoutData(data);
    
    return composite;
  }
  
  protected void prepareBrowseRegisteredPackagesButton(Button browseRegisteredPackagesButton)
  {
    browseRegisteredPackagesButton.addSelectionListener(
      new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent event)
        {
          EcoreActionBarContributor.ExtendedLoadResourceAction.RegisteredPackageDialog registeredPackageDialog = new EcoreActionBarContributor.ExtendedLoadResourceAction.RegisteredPackageDialog(getShell());
          registeredPackageDialog.open();
          Object[] result = registeredPackageDialog.getResult();
          if (result != null)
          {
            List<?> nsURIs = Arrays.asList(result);
            if (registeredPackageDialog.isDevelopmentTimeVersion())
            {
              ResourceSet resourceSet = new ResourceSetImpl();
              resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap());
              StringBuffer uris = new StringBuffer();
              Map<String, URI> ePackageNsURItoGenModelLocationMap = EcorePlugin.getEPackageNsURIToGenModelLocationMap();
              int i = 0;
              Resource resource;
              for (int length = result.length; i < length; i++)
              {
                URI location = (URI)ePackageNsURItoGenModelLocationMap.get(result[i]);
                resource = resourceSet.getResource(location, true);
                EcoreUtil.resolveAll(resource);
              }
              for (Resource resource : resourceSet.getResources()) {
                for (EPackage ePackage : getAllPackages(resource)) {
                  if (nsURIs.contains(ePackage.getNsURI()))
                  {
                    uris.append(resource.getURI());
                    uris.append("  ");
                    break;
                  }
                }
              }
              uriField.setText((uriField.getText() + "  " + uris.toString()).trim());
            }
            else
            {
              StringBuffer uris = new StringBuffer();
              int i = 0;
              for (int length = result.length; i < length; i++)
              {
                uris.append(result[i]);
                uris.append("  ");
              }
              uriField.setText((uriField.getText() + "  " + uris.toString()).trim());
            }
          }
        }
      });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.ExtendedLoadResourceAction.ExtendedLoadResourceDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

class EcoreActionBarContributor$ExtendedLoadResourceAction$RegisteredPackageDialog$1
  extends LabelProvider
{
  public Image getImage(Object element)
  {
    return ExtendedImageRegistry.getInstance().getImage(EcoreEditPlugin.INSTANCE.getImage("full/obj16/EPackage"));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.ExtendedLoadResourceAction.RegisteredPackageDialog.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.ecore.presentation;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class EcoreActionBarContributor$ExtendedLoadResourceAction$RegisteredPackageDialog$2
  extends SelectionAdapter
{
  EcoreActionBarContributor$ExtendedLoadResourceAction$RegisteredPackageDialog$2(EcoreActionBarContributor.ExtendedLoadResourceAction.RegisteredPackageDialog paramRegisteredPackage
1 2 3 4 5

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