org.jupe.plugin
Class JupeProject

java.lang.Object
  extended by org.jupe.plugin.JupeProject

public class JupeProject
extends java.lang.Object

Represents a project that uses Jupe. A Jupe project has to have a UML2 model.

In the current implementation, a project stays a Jupe project even when the last Jupe editor is closed, in order to avoid reloading of the UML2 model.

Author:
Michael Pradel

Constructor Summary
JupeProject(org.eclipse.core.resources.IProject project, ClassDiagramEditor editor)
          Creates a new JupeProject.
 
Method Summary
 void addEditor(ClassDiagramEditor editor)
          Get a collection of all registered source entities.
 void exportModelSubSet(java.util.Collection<org.eclipse.core.resources.IFile> jupeFiles, org.eclipse.emf.common.util.URI fileURI)
          Exports all UML2 element contained in the given diagrams to an XMI file.
 IChangeHandler getFileHandler()
           
 IChangeHandler getFolderHandler()
           
 UML2ModelFactory getModelFactory()
           
 UML2ModelFinder getModelFinder()
          Get the model finder for this project.
 UML2ModelRoot getModelRoot()
          Get the UML2 model modelRoot for this Jupe project.
 java.util.Set<ClassDiagram> getOpenedDiagrams()
          Get the currently opened diagrams in all editors for this project.
 org.eclipse.core.resources.IProject getProject()
          Get the project that is a Jupe project.
 org.eclipse.core.runtime.jobs.ISchedulingRule getSchedulingRule()
          Creates a scheduling rule for the this project which is used for jobs which manipulate it.
 ISource getSource()
          Get the source that is associated with that project.
 boolean isAutoSync()
          Determines if auto synchronization is enabled.
 void loadUML2Model()
          Loads the UML2 Model from the location defined in the preferences.
 boolean removeEditor(ClassDiagramEditor editor)
          Removes a Jupe editor from this project.
 void saveUML2Model()
          Saves UML2 Model to location defined in the preferences.
 void saveUML2Model(org.eclipse.emf.common.util.URI fileURI)
          Saves the UML2 model under the given file URI.
 void setSource(ISource newSource)
          Set the source that is associated with that project.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JupeProject

public JupeProject(org.eclipse.core.resources.IProject project,
                   ClassDiagramEditor editor)
Creates a new JupeProject. It has to be added using JupePlugin.addJupeProject(JupeProject) afterwards.

Parameters:
project - The IProject that uses Jupe.
editor - The Jupe editor that has been created in the project, or null if none is open right now.
Method Detail

addEditor

public void addEditor(ClassDiagramEditor editor)
Get a collection of all registered source entities.

Parameters:
editor - A Jupe editor used by this project.

exportModelSubSet

public void exportModelSubSet(java.util.Collection<org.eclipse.core.resources.IFile> jupeFiles,
                              org.eclipse.emf.common.util.URI fileURI)
Exports all UML2 element contained in the given diagrams to an XMI file.

Parameters:
jupeFiles - A collection of .jupe files to export.

getFileHandler

public IChangeHandler getFileHandler()

getFolderHandler

public IChangeHandler getFolderHandler()

getModelFactory

public UML2ModelFactory getModelFactory()

getModelFinder

public UML2ModelFinder getModelFinder()
Get the model finder for this project.

Returns:
The model finder for this project.

getModelRoot

public UML2ModelRoot getModelRoot()
Get the UML2 model modelRoot for this Jupe project.

Returns:
The UML2 model modelRoot for this project.

getOpenedDiagrams

public java.util.Set<ClassDiagram> getOpenedDiagrams()
Get the currently opened diagrams in all editors for this project.

Returns:
The currently opened diagrams in all editors for this project.

getProject

public org.eclipse.core.resources.IProject getProject()
Get the project that is a Jupe project.

Returns:
The project that uses Jupe.

getSchedulingRule

public org.eclipse.core.runtime.jobs.ISchedulingRule getSchedulingRule()
Creates a scheduling rule for the this project which is used for jobs which manipulate it.

Returns:
Returns a scheduling rule for the this project.

getSource

public ISource getSource()
Get the source that is associated with that project.

Returns:
The project's source, e.g. JavaSource for Java projetcs, or null if it's not defined.

isAutoSync

public boolean isAutoSync()
Determines if auto synchronization is enabled.

Returns:
True, if the auto sync property is enabled, false otherwise.

loadUML2Model

public void loadUML2Model()
Loads the UML2 Model from the location defined in the preferences.


removeEditor

public boolean removeEditor(ClassDiagramEditor editor)
Removes a Jupe editor from this project. This method has to be called whenever a Jupe editor is closed.

Parameters:
editor - The Jupe editor that is closed.
Returns:
True, if it has been successfully removed, false otherwise.

saveUML2Model

public void saveUML2Model()
Saves UML2 Model to location defined in the preferences.


saveUML2Model

public void saveUML2Model(org.eclipse.emf.common.util.URI fileURI)
Saves the UML2 model under the given file URI.

Parameters:
fileURI - Model save location.

setSource

public void setSource(ISource newSource)
Set the source that is associated with that project.

Parameters:
newSource - The source of this project, e.g. JavaSource for Java projects.