org.eclipse.emf.exporter_2.6.0.v20120130-0943

lExporter().getReferencedGenPackageExportInfo(genPackage).getArtifactURI() == null)
        {
          setErrorMessage(ExporterPlugin.INSTANCE.getString("_UI_ReferencedGenPackageNoArtifact_error"));
          return;
        }
      }
    }
  }
  
  protected List<GenPackage> getReferencedGenPackagesToCheck(List<GenPackage> genPackages, boolean reloadReferencedGenPackagesTable)
  {
    if (reloadReferencedGenPackagesTable) {
      for (Iterator<GenPackage> i = genPackages.iterator(); i.hasNext();)
      {
        GenPackage genPackage = (GenPackage)i.next();
        if (getModelExporter().getReferencedGenPackageExportInfo(genPackage).getArtifactURI() == null) {
          i.remove();
        }
      }
    }
    return genPackages;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.base.ModelExporterPackagePage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution.base;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.codegen.ecore.genmodel.provider.GenModelEditPlugin;
import org.eclipse.emf.common.ui.dialogs.DiagnosticDialog;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticException;
import org.eclipse.emf.common.util.Monitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.converter.ui.contribution.base.ModelConverterWizard;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.exporter.ExporterPlugin;
import org.eclipse.emf.exporter.ModelExporter;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import org.osgi.service.prefs.BackingStoreException;

public abstract class ModelExporterWizard
  extends ModelConverterWizard
{
  protected static final String PREFERENCE_SAVE_EXPORTER = "ModelExporterWizard.SaveExporter";
  protected static final String PREFERENCE_SAVE_PACKAGE_URI = "ModelExporterWizard.SavePackageURI";
  
  public ModelExporter getModelExporter()
  {
    return (ModelExporter)getModelConverter();
  }
  
  public void init(IWorkbench workbench, IStructuredSelection selection)
  {
    super.init(workbench, selection);
    
    Object object = selection.getFirstElement();
    try
    {
      if ((object instanceof IFile))
      {
        URI uri = URI.createPlatformResourceURI(((IFile)object).getFullPath().toString(), true);
        getModelExporter().loadGenModel(uri);
      }
      else if ((object instanceof GenModel))
      {
        getModelExporter().setGenModel((GenModel)object);
      }
    }
    catch (DiagnosticException exception)
    {
      Diagnostic diagnostic = exception.getDiagnostic();
      DiagnosticDialog.openProblem(
        getShell(), 
        GenModelEditPlugin.INSTANCE.getString("_UI_ModelProblems_title"), 
        ExporterPlugin.INSTANCE.getString("_UI_InvalidModel_message"), 
        diagnostic);
    }
    readPreferencesSettings();
    if (getModelExporter().getDirectoryURI() == null)
    {
      GenModel genModel = getModelExporter().getGenModel();
      if ((genModel != null) && (genModel.eResource() != null))
      {
        URI uri = genModel.eResource().getURI().trimSegments(1);
        getModelExporter().setDirectoryURI(uri.toString() + "/");
      }
    }
  }
  
  protected void readPreferencesSettings()
  {
    IPreferencesService preferencesService = Platform.getPreferencesService();
    
    ModelExporter modelExporter = getModelExporter();
    
    modelExporter.setSaveEPackageArtifactURI(preferencesService.getBoolean("org.eclipse.emf.exporter", "ModelExporterWizard.SavePackageURI", false, null));
    
    modelExporter.setSaveExporter(preferencesService.getBoolean("org.eclipse.emf.exporter", "ModelExporterWizard.SaveExporter", false, null));
  }
  
  protected void writePreferencesSettings()
  {
    IEclipsePreferences node = new InstanceScope().getNode("org.eclipse.emf.exporter");
    ModelExporter modelExporter = getModelExporter();
    
    node.putBoolean("ModelExporterWizard.SavePackageURI", modelExporter.isSaveEPackageArtifactURI());
    node.putBoolean("ModelExporterWizard.SaveExporter", modelExporter.isSaveExporter());
    try
    {
      node.flush();
    }
    catch (BackingStoreException exception)
    {
      ExporterPlugin.INSTANCE.log(exception);
    }
  }
  
  protected Diagnostic doPerformFinish(Monitor monitor)
    throws Exception
  {
    Diagnostic diagnostic = getModelExporter().export(monitor);
    getModelExporter().save();
    writePreferencesSettings();
    return diagnostic;
  }
}

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

import org.eclipse.swt.custom.ControlEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Widget;

public abstract class ExporterUIUtil$CompositeEditorHelper
  implements Listener
{
  protected Composite composite;
  protected ControlEditor compositeEditor;
  
  protected ExporterUIUtil$CompositeEditorHelper(Composite composite)
  {
    this.composite = composite;
    composite.addListener(13, this);
    composite.addListener(14, this);
    composite.addListener(12, this);
    
    compositeEditor = createControlEditor(composite);
    compositeEditor.horizontalAlignment = 16384;
    compositeEditor.grabHorizontal = true;
  }
  
  protected ControlEditor createControlEditor(Composite composite)
  {
    return new ControlEditor(composite);
  }
  
  public void handleEvent(Event event)
  {
    if (widget == composite) {
      switch (type)
      {
      case 13: 
      case 14: 
        compositeSelected(event);
        break;
      case 12: 
        compositeDisposed();
      }
    }
  }
  
  protected void compositeSelected(Event event)
  {
    disposeOldEditorControl(compositeEditor.getEditor());
    
    Widget item = item;
    Control editorControl = createEditorControl(item);
    if (editorControl != null) {
      setEditor(editorControl, item);
    }
  }
  
  protected void compositeDisposed()
  {
    composite.removeListener(13, this);
    composite.removeListener(14, this);
    composite.removeListener(12, this);
    composite = null;
  }
  
  protected void disposeOldEditorControl(Control control)
  {
    if ((control != null) && (!control.isDisposed()))
    {
      control.removeListener(13, this);
      control.dispose();
    }
  }
  
  protected void setEditor(Control editorControl, Widget item)
  {
    compositeEditor.setEditor(editorControl);
  }
  
  protected abstract Control createEditorControl(Widget paramWidget);
}

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

import org.eclipse.swt.custom.ControlEditor;
import org.eclipse.swt.custom.TreeEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;

public abstract class ExporterUIUtil$TreeEditorHelper
  extends ExporterUIUtil.CompositeEditorHelper
{
  public ExporterUIUtil$TreeEditorHelper(Tree tree)
  {
    super(tree);
  }
  
  protected ControlEditor createControlEditor(Composite composite)
  {
    return new TreeEditor((Tree)composite);
  }
  
  public void setColumn(int index)
  {
    TreeColumn treeColumn = ((Tree)composite).getColumn(index);
    
    TreeEditor treeEditor = (TreeEditor)compositeEditor;
    minimumWidth = treeColumn.getWidth();
    treeEditor.setColumn(index);
  }
  
  public int getColumn()
  {
    return ((TreeEditor)compositeEditor).getColumn();
  }
  
  protected void setEditor(Control editorControl, Widget item)
  {
    ((TreeEditor)compositeEditor).setEditor(editorControl, (TreeItem)item);
  }
}

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

import org.eclipse.swt.custom.ControlEditor;
import org.eclipse.swt.custom.TreeEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;

public class ExporterUIUtil
{
  public static abstract class CompositeEditorHelper
    implements Listener
  {
    protected Composite composite;
    protected ControlEditor compositeEditor;
    
    protected CompositeEditorHelper(Composite composite)
    {
      this.composite = composite;
      composite.addListener(13, this);
      composite.addListener(14, this);
      composite.addListener(12, this);
      
      compositeEditor = createControlEditor(composite);
      compositeEditor.horizontalAlignment = 16384;
      compositeEditor.grabHorizontal = true;
    }
    
    protected ControlEditor createControlEditor(Composite composite)
    {
      return new ControlEditor(composite);
    }
    
    public void handleEvent(Event event)
    {
      if (widget == composite) {
        switch (type)
        {
        case 13: 
        case 14: 
          compositeSelected(event);
          break;
        case 12: 
          compositeDisposed();
        }
      }
    }
    
    protected void compositeSelected(Event event)
    {
      disposeOldEditorControl(compositeEditor.getEditor());
      
      Widget item = item;
      Control editorControl = createEditorControl(item);
      if (editorControl != null) {
        setEditor(editorControl, item);
      }
    }
    
    protected void compositeDisposed()
    {
      composite.removeListener(13, this);
      composite.removeListener(14, this);
      composite.removeListener(12, this);
      composite = null;
    }
    
    protected void disposeOldEditorControl(Control control)
    {
      if ((control != null) && (!control.isDisposed()))
      {
        control.removeListener(13, this);
        control.dispose();
      }
    }
    
    protected void setEditor(Control editorControl, Widget item)
    {
      compositeEditor.setEditor(editorControl);
    }
    
    protected abstract Control createEditorControl(Widget paramWidget);
  }
  
  public static abstract class TreeEditorHelper
    extends ExporterUIUtil.CompositeEditorHelper
  {
    public TreeEditorHelper(Tree tree)
    {
      super();
    }
    
    protected ControlEditor createControlEditor(Composite composite)
    {
      return new TreeEditor((Tree)composite);
    }
    
    public void setColumn(int index)
    {
      TreeColumn treeColumn = ((Tree)composite).getColumn(index);
      
      TreeEditor treeEditor = (TreeEditor)compositeEditor;
      minimumWidth = treeColumn.getWidth();
      treeEditor.setColumn(index);
    }
    
    public int getColumn()
    {
      return ((TreeEditor)compositeEditor).getColumn();
    }
    
    protected void setEditor(Control editorControl, Widget item)
    {
      ((TreeEditor)compositeEditor).setEditor(editorControl, (TreeItem)item);
    }
  }
}

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

import org.eclipse.emf.codegen.ecore.genmodel.GenAnnotation;
import org.eclipse.emf.codegen.ecore.genmodel.GenBase;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.common.util.EList;

public class ExporterUtil
{
  public static GenAnnotation findOrCreateGenAnnotation(GenBase genBase, String source)
  {
    GenAnnotation genAnnotation = genBase.getGenAnnotation(source);
    if (genAnnotation == null)
    {
      genAnnotation = genBase.getGenModel().createGenAnnotation();
      genAnnotation.setSource(source);
      genBase.getGenAnnotations().add(genAnnotation);
    }
    return genAnnotation;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.util.ExporterUtil
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
1 2 3

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