-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#179: Merge branch 'dev_eclipseplugin'
- Loading branch information
Showing
30 changed files
with
561 additions
and
196 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
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
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
33 changes: 33 additions & 0 deletions
33
...-eclipse/cobigen-eclipse/src/com/capgemini/cobigen/eclipse/common/AbstractCobiGenJob.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,33 @@ | ||
package com.capgemini.cobigen.eclipse.common; | ||
|
||
import org.eclipse.jface.operation.IRunnableWithProgress; | ||
|
||
/** | ||
* Abstract long running background job providing exception handling facilities. | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
public abstract class AbstractCobiGenJob implements IRunnableWithProgress { | ||
|
||
/** | ||
* Exception occurred during processing | ||
*/ | ||
protected RuntimeException occurredException; | ||
|
||
/** | ||
* Returns the field 'occurredException' | ||
* @return value of occurredException | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
public RuntimeException getOccurredException() { | ||
return occurredException; | ||
} | ||
|
||
/** | ||
* States whether an exception occurred during processing. | ||
* @return <code>true</code> if an exception occurred, <code>false</code> otherwise. | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
public boolean isExceptionOccurred() { | ||
return occurredException != null; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...e/src/com/capgemini/cobigen/eclipse/common/exceptions/CobiGenEclipseRuntimeException.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,26 @@ | ||
package com.capgemini.cobigen.eclipse.common.exceptions; | ||
|
||
/** | ||
* | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
public class CobiGenEclipseRuntimeException extends RuntimeException { | ||
|
||
/** | ||
* Default serial version UID. | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Creates a new {@link CobiGenEclipseRuntimeException} for the given message and cause. | ||
* @param message | ||
* error message | ||
* @param cause | ||
* of the exception | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
public CobiGenEclipseRuntimeException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
} |
24 changes: 0 additions & 24 deletions
24
...eclipse/src/com/capgemini/cobigen/eclipse/common/exceptions/NotYetSupportedException.java
This file was deleted.
Oops, something went wrong.
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
104 changes: 104 additions & 0 deletions
104
...-eclipse/cobigen-eclipse/src/com/capgemini/cobigen/eclipse/generator/AnalyzeInputJob.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,104 @@ | ||
package com.capgemini.cobigen.eclipse.generator; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
import org.apache.log4j.MDC; | ||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.capgemini.cobigen.CobiGen; | ||
import com.capgemini.cobigen.eclipse.common.AbstractCobiGenJob; | ||
import com.capgemini.cobigen.eclipse.common.constants.InfrastructureConstants; | ||
import com.capgemini.cobigen.extension.to.TemplateTo; | ||
import com.google.common.collect.Lists; | ||
|
||
/** | ||
* Job implementation for processing long running operations of CobiGen off the ui thread. | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
public class AnalyzeInputJob extends AbstractCobiGenJob { | ||
|
||
/** Logger instance. */ | ||
private static final Logger LOG = LoggerFactory.getLogger(AnalyzeInputJob.class); | ||
|
||
/** | ||
* CobiGen API | ||
*/ | ||
private CobiGen cobigen; | ||
|
||
/** | ||
* input objects to be analyzed | ||
*/ | ||
private List<Object> inputs; | ||
|
||
/** | ||
* Determined matching templates | ||
*/ | ||
private List<TemplateTo> resultMatchingTemplates = Lists.newArrayList(); | ||
|
||
/** | ||
* States whether the generation input is a single non container input. | ||
*/ | ||
private boolean resultSingleNonContainerInput; | ||
|
||
/** | ||
* Creates a new job for analyzing the inputs regarding matching templates etc. | ||
* @param cobigen | ||
* CobiGen instance | ||
* @param inputs | ||
* input objects to be analyzed | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
public AnalyzeInputJob(CobiGen cobigen, List<Object> inputs) { | ||
this.cobigen = cobigen; | ||
this.inputs = inputs; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
@Override | ||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { | ||
MDC.put(InfrastructureConstants.CORRELATION_ID, UUID.randomUUID().toString()); | ||
|
||
try { | ||
LOG.info("Determine matching templates..."); | ||
monitor.beginTask("Determine matching templates...", inputs.size() + 1); | ||
for (Object input : inputs) { | ||
resultMatchingTemplates.addAll(cobigen.getMatchingTemplates(input)); | ||
monitor.worked(1); | ||
} | ||
LOG.info("Determine if input is container..."); | ||
resultSingleNonContainerInput = | ||
inputs.size() == 1 && !cobigen.combinesMultipleInputs(inputs.get(0)); | ||
monitor.done(); | ||
} catch (RuntimeException e) { | ||
occurredException = e; | ||
} | ||
|
||
MDC.remove(InfrastructureConstants.CORRELATION_ID); | ||
} | ||
|
||
/** | ||
* Returns the field 'resultMatchingTemplates' | ||
* @return value of resultMatchingTemplates | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
public List<TemplateTo> getResultMatchingTemplates() { | ||
return resultMatchingTemplates; | ||
} | ||
|
||
/** | ||
* Returns the field 'resultSingleNonContainerInput' | ||
* @return value of resultSingleNonContainerInput | ||
* @author mbrunnli (Jan 10, 2016) | ||
*/ | ||
public boolean isResultSingleNonContainerInput() { | ||
return resultSingleNonContainerInput; | ||
} | ||
|
||
} |
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.