Skip to content

Commit

Permalink
Apply Palladio formatting and clean-up rules
Browse files Browse the repository at this point in the history
  • Loading branch information
FloBoJa committed Jan 25, 2024
1 parent 4e23852 commit 99bdb63
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,27 @@ public void cleanup(final IProgressMonitor arg0) throws CleanupFailedException {

@Override
public void execute(final IProgressMonitor arg0) throws JobFailedException, UserCanceledException {
final Repository repository = (Repository) getBlackboard().getPartition(repositoryKey);
if ((repository != null) && !repository.eContents().isEmpty()) {
writeFile(arg0, START_UML + new PcmComponentDiagramGenerator(repository).getDiagramText() + END_UML,
final Repository repository = (Repository) this.getBlackboard()
.getPartition(this.repositoryKey);
if ((repository != null) && !repository.eContents()
.isEmpty()) {
this.writeFile(arg0, START_UML + new PcmComponentDiagramGenerator(repository).getDiagramText() + END_UML,
COMPONENT_DIAGRAM_NAME);
}

final System system = (System) getBlackboard().getPartition(systemKey);
if ((system != null) && !system.eContents().isEmpty()) {
writeFile(arg0, START_UML + new PcmSystemDiagramGenerator(system).getDiagramText() + END_UML,
final System system = (System) this.getBlackboard()
.getPartition(this.systemKey);
if ((system != null) && !system.eContents()
.isEmpty()) {
this.writeFile(arg0, START_UML + new PcmSystemDiagramGenerator(system).getDiagramText() + END_UML,
SYSTEM_DIAGRAM_NAME);
}

final Allocation allocation = (Allocation) getBlackboard().getPartition(allocationKey);
if ((allocation != null) && !allocation.eContents().isEmpty()) {
writeFile(arg0, START_UML + new PcmAllocationDiagramGenerator(allocation).getDiagramText() + END_UML,
final Allocation allocation = (Allocation) this.getBlackboard()
.getPartition(this.allocationKey);
if ((allocation != null) && !allocation.eContents()
.isEmpty()) {
this.writeFile(arg0, START_UML + new PcmAllocationDiagramGenerator(allocation).getDiagramText() + END_UML,
ALLOCATION_DIAGRAM_NAME);
}
}
Expand All @@ -84,9 +90,11 @@ public String getName() {
}

private void writeFile(final IProgressMonitor monitor, final String plantUmlSource, final String fileName) {
if (outputFolder.isPlatformResource()) {
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
final IFile file = root.getFile(new Path(outputFolder.appendSegment(fileName).toPlatformString(true)));
if (this.outputFolder.isPlatformResource()) {
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace()
.getRoot();
final IFile file = root.getFile(new Path(this.outputFolder.appendSegment(fileName)
.toPlatformString(true)));
try {
if (!file.exists()) {
file.create(new ByteArrayInputStream(new byte[0]), IResource.FORCE, monitor);
Expand All @@ -97,7 +105,8 @@ private void writeFile(final IProgressMonitor monitor, final String plantUmlSour
}

} else {
final String path = outputFolder.appendSegment(fileName).devicePath();
final String path = this.outputFolder.appendSegment(fileName)
.devicePath();
try (FileWriter writer = new FileWriter(path)) {
writer.append(plantUmlSource);
} catch (final IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public RetrieverJob(final RetrieverConfiguration configuration) {
RetrieverBlackboardKeys.RULE_ENGINE_MOCORE_OUTPUT_ALLOCATION,
RetrieverBlackboardKeys.RULE_ENGINE_MOCORE_OUTPUT_RESOURCE_ENVIRONMENT));

super.add(new PlantUmlJob(getBlackboard(), configuration.getOutputFolder(),
super.add(new PlantUmlJob(this.getBlackboard(), configuration.getOutputFolder(),
RetrieverBlackboardKeys.RULE_ENGINE_MOCORE_OUTPUT_REPOSITORY,
RetrieverBlackboardKeys.RULE_ENGINE_MOCORE_OUTPUT_SYSTEM,
RetrieverBlackboardKeys.RULE_ENGINE_MOCORE_OUTPUT_ALLOCATION));
Expand Down

0 comments on commit 99bdb63

Please sign in to comment.