Skip to content

Commit

Permalink
eclipse-kitalpha#20 Fix technical debt issues
Browse files Browse the repository at this point in the history
Change-Id: Id5583adc42f757815d3bc94bbfc97bdf625dcf7a
  • Loading branch information
arnauddieumegard committed May 12, 2021
1 parent f44ef92 commit b79fbe0
Show file tree
Hide file tree
Showing 23 changed files with 795 additions and 719 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="generated"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Generated with EGF 1.3.0.v20150924-1035
//Generated with EGF 1.6.2.202001031546
package org.polarsys.kitalpha.pdt.docgen.content;

import org.polarsys.kitalpha.pdt.docgen.wizard.general.HTMLDocGenContext;
Expand Down Expand Up @@ -39,18 +39,11 @@ public static synchronized extensionPointsContent create(String lineSeparator) {
protected final String TEXT_7 = "</h1>" + NL + "<hr style=\"width:98%; align : center; \" /> " + NL + "</div>" + NL
+ "" + NL + "<div style=\"position: absolute; top: 160px; left: 1%; z-index: 1; width: 98%;\">" + NL;
protected final String TEXT_8 = NL;
protected final String TEXT_9 = NL;
protected final String TEXT_10 = NL + NL;
protected final String TEXT_11 = NL;
protected final String TEXT_12 = NL + "<h2>Representation</h2>";
protected final String TEXT_13 = NL + NL + "</p>";
protected final String TEXT_14 = NL + "<p><strong>";
protected final String TEXT_15 = "</strong></p>";
protected final String TEXT_16 = NL;
protected final String TEXT_17 = NL;
protected final String TEXT_18 = NL;
protected final String TEXT_19 = NL;
protected final String TEXT_20 = NL;
protected final String TEXT_9 = NL + NL;
protected final String TEXT_10 = NL + "<h2>Representation</h2>";
protected final String TEXT_11 = NL + NL + "</p>";
protected final String TEXT_12 = NL + "<p><strong>";
protected final String TEXT_13 = "</strong></p>";

public extensionPointsContent() {
//Here is the constructor
Expand Down Expand Up @@ -86,8 +79,8 @@ public String generate(Object argument) throws Exception {
ctx.getReporter().executionFinished(OutputManager.computeExecutionOutput(ctx), ctx);
}

stringBuffer.append(TEXT_19);
stringBuffer.append(TEXT_20);
stringBuffer.append(TEXT_8);
stringBuffer.append(TEXT_8);
return stringBuffer.toString();
}

Expand Down Expand Up @@ -199,31 +192,31 @@ protected void method_content(final StringBuffer stringBuffer, final PatternCont
}

String pageKey = extensionPointID;
String extensionPointPage = org.polarsys.kitalpha.pdt.docgen.helpers.ExtensionPointsHelpers.extensionPointsPages
.get(pageKey);
String extensionPointPage = org.polarsys.kitalpha.pdt.docgen.helpers.ExtensionPointsHelpers
.getExtensionPointsPage(pageKey);

stringBuffer.append(TEXT_8);
stringBuffer.append(TEXT_9);
stringBuffer.append(TEXT_8);
stringBuffer.append(extensionPointPage);
stringBuffer.append(TEXT_10);
stringBuffer.append(TEXT_9);

String extensionPointKey = extensionPointID + " Extension Point schema";
DRepresentation diagram = org.polarsys.kitalpha.pdt.docgen.helpers.ExtensionPointsHelpers.extensionPointsDiagrams
.get(extensionPointKey);
stringBuffer.append(TEXT_11);
DRepresentation diagram = org.polarsys.kitalpha.pdt.docgen.helpers.ExtensionPointsHelpers
.getExtensionPointsDiagram(extensionPointKey);
stringBuffer.append(TEXT_8);

if (diagram != null) {
stringBuffer.append(TEXT_12);
stringBuffer.append(TEXT_10);
}
stringBuffer.append(TEXT_13);
stringBuffer.append(TEXT_11);

if ((diagram instanceof DSemanticDiagram)
&& (((DSemanticDiagram) diagram).getDescription().getName().equals("Extension Point schema"))) {
String generatedFolder = fileNameService.getFileName(((DSemanticDiagram) diagram).getTarget());
stringBuffer.append(TEXT_14);
stringBuffer.append(TEXT_12);
stringBuffer.append(((DSemanticDiagram) diagram).getDescription().getName());
stringBuffer.append(TEXT_15);
stringBuffer.append(TEXT_16);
stringBuffer.append(TEXT_13);
stringBuffer.append(TEXT_8);
{
//<%@ egf:patternCall patternId="platform:/plugin/org.polarsys.kitalpha.doc.gen.business.core/egf/HTMLDocGenCommon.fcore#LogicalName=org.polarsys.kitalpha.doc.gen.business.core.sirius.DiagramGenerator" args="diagram:diagram, outputFolder:outputFolder, projectName:projectName, generatedFolder:generatedFolder, fileNameService:fileNameService, helper:helper"%>

Expand All @@ -246,7 +239,7 @@ protected void method_content(final StringBuffer stringBuffer, final PatternCont

}

stringBuffer.append(TEXT_17);
stringBuffer.append(TEXT_8);

if (diagramsInclusion) {
if (lastExtensionPoint == (ExtensionPoint) element) {
Expand All @@ -257,7 +250,7 @@ protected void method_content(final StringBuffer stringBuffer, final PatternCont
}
}

stringBuffer.append(TEXT_18);
stringBuffer.append(TEXT_8);
InternalPatternContext ictx = (InternalPatternContext) ctx;
new Node.DataLeaf(ictx.getNode(), getClass(), "content", stringBuffer.toString());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Generated with EGF 1.3.0.v20150924-1035
//Generated with EGF 1.6.2.202001031546
package org.polarsys.kitalpha.pdt.docgen.content;

import org.polarsys.kitalpha.pdt.docgen.wizard.general.HTMLDocGenContext;
Expand Down Expand Up @@ -40,20 +40,12 @@ public static synchronized extensionsContent create(String lineSeparator) {
protected final String TEXT_7 = "</h1>" + NL + "<hr style=\"width:98%; align : center; \" /> " + NL + "</div>" + NL
+ "" + NL + "<div style=\"position: absolute; top: 160px; left: 1%; z-index: 1; width: 98%;\">" + NL;
protected final String TEXT_8 = NL;
protected final String TEXT_9 = NL;
protected final String TEXT_10 = NL;
protected final String TEXT_11 = NL;
protected final String TEXT_12 = NL + NL + NL;
protected final String TEXT_13 = NL;
protected final String TEXT_14 = NL + "<h2>Representation</h2>";
protected final String TEXT_15 = NL + NL + "</p>";
protected final String TEXT_16 = NL + "<p><strong>";
protected final String TEXT_17 = "</strong></p>";
protected final String TEXT_18 = NL;
protected final String TEXT_19 = NL;
protected final String TEXT_20 = NL + "\t\t\t\t" + NL + "\t\t\t\t" + NL;
protected final String TEXT_21 = NL;
protected final String TEXT_22 = NL;
protected final String TEXT_9 = NL + NL + NL;
protected final String TEXT_10 = NL + "<h2>Representation</h2>";
protected final String TEXT_11 = NL + NL + "</p>";
protected final String TEXT_12 = NL + "<p><strong>";
protected final String TEXT_13 = "</strong></p>";
protected final String TEXT_14 = NL + "\t\t\t\t" + NL + "\t\t\t\t" + NL;

public extensionsContent() {
//Here is the constructor
Expand Down Expand Up @@ -89,8 +81,8 @@ public String generate(Object argument) throws Exception {
ctx.getReporter().executionFinished(OutputManager.computeExecutionOutput(ctx), ctx);
}

stringBuffer.append(TEXT_21);
stringBuffer.append(TEXT_22);
stringBuffer.append(TEXT_8);
stringBuffer.append(TEXT_8);
return stringBuffer.toString();
}

Expand Down Expand Up @@ -210,34 +202,34 @@ protected void method_content(final StringBuffer stringBuffer, final PatternCont
}
}

stringBuffer.append(TEXT_9);
stringBuffer.append(TEXT_8);

String pageKey = extensionID + "_" + ((Extension) element).getExtensionPoint().getId();
String extensionPage = org.polarsys.kitalpha.pdt.docgen.helpers.ExtensionsHelpers.extensionsPages.get(pageKey);
String extensionPage = org.polarsys.kitalpha.pdt.docgen.helpers.ExtensionsHelpers.getExtensionPage(pageKey);

stringBuffer.append(TEXT_10);
stringBuffer.append(TEXT_11);
stringBuffer.append(TEXT_8);
stringBuffer.append(TEXT_8);
stringBuffer.append(extensionPage);
stringBuffer.append(TEXT_12);
stringBuffer.append(TEXT_9);

String extensionKey = IntrospectionServices.getLabelForGivenExtension((Extension) element)
+ " Extension Schema";
DRepresentation diagram = org.polarsys.kitalpha.pdt.docgen.helpers.ExtensionsHelpers.extensionDiagrams
.get(extensionKey);
stringBuffer.append(TEXT_13);
DRepresentation diagram = org.polarsys.kitalpha.pdt.docgen.helpers.ExtensionsHelpers
.getExtensionDiagram(extensionKey);
stringBuffer.append(TEXT_8);

if (diagram != null) {
stringBuffer.append(TEXT_14);
stringBuffer.append(TEXT_10);
}
stringBuffer.append(TEXT_15);
stringBuffer.append(TEXT_11);

if ((diagram instanceof DSemanticDiagram)
&& (((DSemanticDiagram) diagram).getDescription().getName().equals("Extension Schema"))) {
String generatedFolder = fileNameService.getFileName(((DSemanticDiagram) diagram).getTarget());
stringBuffer.append(TEXT_16);
stringBuffer.append(TEXT_12);
stringBuffer.append(((DSemanticDiagram) diagram).getDescription().getName());
stringBuffer.append(TEXT_17);
stringBuffer.append(TEXT_18);
stringBuffer.append(TEXT_13);
stringBuffer.append(TEXT_8);
{
//<%@ egf:patternCall patternId="platform:/plugin/org.polarsys.kitalpha.doc.gen.business.core/egf/HTMLDocGenCommon.fcore#LogicalName=org.polarsys.kitalpha.doc.gen.business.core.sirius.DiagramGenerator" args="diagram:diagram, outputFolder:outputFolder, projectName:projectName, generatedFolder:generatedFolder, fileNameService:fileNameService, helper:helper"%>

Expand All @@ -260,7 +252,7 @@ protected void method_content(final StringBuffer stringBuffer, final PatternCont

}

stringBuffer.append(TEXT_19);
stringBuffer.append(TEXT_8);

if (diagramsInclusion) {
if (lastExtension == (Extension) element && lastExtension != null) {
Expand All @@ -272,7 +264,7 @@ protected void method_content(final StringBuffer stringBuffer, final PatternCont
}
}

stringBuffer.append(TEXT_20);
stringBuffer.append(TEXT_14);
InternalPatternContext ictx = (InternalPatternContext) ctx;
new Node.DataLeaf(ictx.getNode(), getClass(), "content", stringBuffer.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ public void clearCurrentAird(){
TransactionalEditingDomain editingDomain = _localSession.getTransactionalEditingDomain();
CommandStack commandStack = editingDomain.getCommandStack();

for (DView dView : views) {
// EList<DRepresentation> representations = dView.getOwnedRepresentations();
// Set<DRepresentation> representationsSet = new HashSet<DRepresentation>();
// representationsSet.addAll(representations);
// DeleteRepresentationCommand command = new DeleteRepresentationCommand(_localSession, representationsSet);

for (DView dView : views) {
EList<DRepresentationDescriptor> ownedRepresentationDescriptors = dView.getOwnedRepresentationDescriptors();
Set<DRepresentationDescriptor> representationsSet = new HashSet<DRepresentationDescriptor>();
representationsSet.addAll(ownedRepresentationDescriptors);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.polarsys.kitalpha.pdt.docgen.helpers;

public class Constants {

private Constants() {}

protected static final String ALT_AFTER_IMGSRCICONOPEN_CLOSE = "\" alt=\"\"/>";
protected static final String IMG_SRC_ICON_OPEN = "<img src=\"../icon/";
protected static final String TR_OPEN = "<tr>";
protected static final String TR_CLOSE = "</tr>";
protected static final String TD_OPEN = "<td>";
protected static final String TD_CLOSE = "</td>";
protected static final String UL_STYLE_LIST_STYLE_TYPE_NONE_OPEN = "<ul style=\"list-style-type:none\">";
protected static final String UL_STYLE_LIST_STYLE_TYPE_DISC_OPEN = "<ul style=\"list-style-type:disc\">";
protected static final String UL_CLOSE = "</ul>";
protected static final String LI_OPEN = "<li>";
protected static final String LI_CLOSE = "</li>";

protected static final String ELEMENTS = " elements)";
protected static final String ELEMENT = " element)";

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
*
*/
public class EclipseModelHelpers {

private EclipseModelHelpers() {}

public static String getEclipseModelName(EclipseModel currentModel){
return currentModel.getName();
}

public static int getReferencedEclipseModelsCount(EclipseModel currentModel){
public static int getReferencedEclipseModelsCount(){

//TODO retourner le nombre de model lié au model courant pour créer autant d'index helper
// int count = 0;
Expand All @@ -39,7 +42,7 @@ public static int getReferencedEclipseModelsCount(EclipseModel currentModel){
public static String getEclipseModelPage(EclipseModel currentModel,
String projectName, String folderName, int indentationIndice) {

StringBuffer buffer = new StringBuffer();
StringBuilder stringBuilder = new StringBuilder();

// get package's icon
String imageFileName = LabelProviderHelper.getImageFileName(
Expand All @@ -48,43 +51,41 @@ public static String getEclipseModelPage(EclipseModel currentModel,
String text = Helpers.getLabel(currentModel);

// starting page's creation
buffer.append("<h" + indentationIndice + ">");
buffer.append("<img src=\"../icon/");
buffer.append(imageFileName);
buffer.append("\" alt=\"\"/>");
buffer.append(" " + text);
buffer.append("</h" + indentationIndice + ">");

buffer.append(getEclipseModelContents(currentModel, projectName,
stringBuilder.append("<h" + indentationIndice + ">");
stringBuilder.append("<img src=\"../icon/");
stringBuilder.append(imageFileName);
stringBuilder.append("\" alt=\"\"/>");
stringBuilder.append(" " + text);
stringBuilder.append("</h" + indentationIndice + ">");

stringBuilder.append(getEclipseModelContents(currentModel, projectName,
folderName, (indentationIndice + 1)));

return buffer.toString();
return stringBuilder.toString();
}

private static String getEclipseModelContents(EclipseModel currentModel,
String projectName, String folderName, int indentationIndice) {

StringBuffer buffer = new StringBuffer();
StringBuilder stringBuilder = new StringBuilder();
EList<Repository> repositories = null;

if (currentModel.getRepositories() != null) {
repositories = currentModel.getRepositories();
}

if (repositories != null) {
buffer.append(getContainedRepositoriesContent(currentModel,
projectName, folderName, (indentationIndice + 1),
repositories));
stringBuilder.append(
getContainedRepositoriesContent(projectName, folderName, (indentationIndice + 1), repositories));
}

return buffer.toString();
return stringBuilder.toString();
}

private static String getContainedRepositoriesContent(
EclipseModel currentModel, String projectName, String folderName,
private static String getContainedRepositoriesContent(String projectName, String folderName,
int indentationIndice, EList<Repository> repositories) {

StringBuffer buffer = new StringBuffer();
StringBuilder stringBuilder = new StringBuilder();
int repoNumber = 0;

String title = "";
Expand All @@ -102,29 +103,29 @@ private static String getContainedRepositoriesContent(
}

if (!title.equals("")) {
buffer.append("<h" + indentationIndice + ">");
buffer.append(title + element);
buffer.append("</h" + indentationIndice + ">");
stringBuilder.append("<h" + indentationIndice + ">");
stringBuilder.append(title + element);
stringBuilder.append("</h" + indentationIndice + ">");
}

// now i creat sub-packages' list
if (repoNumber > 0) {
buffer.append("<ul style=\"list-style-type:disc\">");
stringBuilder.append("<ul style=\"list-style-type:disc\">");
for (Repository repository : repositories) {
buffer.append("<li>");
stringBuilder.append("<li>");
String imageName = LabelProviderHelper.getImageFileName(
repository, projectName, folderName);
buffer.append("<img src=\"../icon/");
buffer.append(imageName);
buffer.append("\" alt=\"\"/>");
buffer.append(" "
stringBuilder.append("<img src=\"../icon/");
stringBuilder.append(imageName);
stringBuilder.append("\" alt=\"\"/>");
stringBuilder.append(" "
+ Helpers.getTypeHyperLink(repository,
LabelProviderHelper.getText(repository)));
buffer.append("</li>");
stringBuilder.append("</li>");
}
buffer.append("</ul>");
stringBuilder.append("</ul>");
}

return buffer.toString();
return stringBuilder.toString();
}
}
Loading

0 comments on commit b79fbe0

Please sign in to comment.