-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
archi-modelrepository-plugin object-history
- Loading branch information
Showing
6 changed files
with
161 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...modelrepository/src/org/archicontribs/modelrepository/grafico/GraficoFileConventions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.archicontribs.modelrepository.grafico; | ||
|
||
import java.io.File; | ||
|
||
import org.eclipse.emf.ecore.EObject; | ||
|
||
import com.archimatetool.model.FolderType; | ||
import com.archimatetool.model.IFolder; | ||
import com.archimatetool.model.IIdentifier; | ||
|
||
public final class GraficoFileConventions { | ||
|
||
private GraficoFileConventions() { | ||
// utility class | ||
} | ||
|
||
public static File forFolder(File parentFolder, IFolder iFolder) { | ||
return new File(parentFolder, GraficoFileConventions.getNameFor(iFolder)); | ||
} | ||
|
||
public static File forElement(File modelFolder, IFolder iFolder, EObject elem) { | ||
File elemFolder = new File(modelFolder, GraficoFileConventions.getNameFor(iFolder)); | ||
return GraficoFileConventions.forElement(elemFolder, elem); | ||
} | ||
|
||
public static File forElement(File elemFolder, EObject elem) { | ||
return new File(elemFolder, elem.getClass().getSimpleName() + "_" + ((IIdentifier)elem).getId() + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ | ||
} | ||
|
||
/** | ||
* Generate a proper name for directory creation | ||
* | ||
* @param folder | ||
* @return | ||
*/ | ||
public static String getNameFor(IFolder folder) { | ||
return folder.getType() == FolderType.USER ? folder.getId().toString() : folder.getType().toString(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.