Skip to content
Snippets Groups Projects
Commit ed147912 authored by Nikolaus Huber's avatar Nikolaus Huber
Browse files

implemented basic functionality to start adaptation process in eclipse

git-svn-id: https://se1.informatik.uni-wuerzburg.de/usvn/svn/code/code/DMM/trunk@11942 9e42b895-fcda-4063-8a3b-11be15eb1bbd
parent 662ad2fd
No related branches found
No related tags found
No related merge requests found
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Adaptation
Bundle-SymbolicName: edu.kit.ipd.descartes.adaptation
Bundle-SymbolicName: edu.kit.ipd.descartes.adaptation;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: edu.kit.ipd.descartes.adaptation.Activator
Require-Bundle: edu.kit.ipd.descartes.mm.resourcelandscape;bundle-version="1.0.0",
edu.kit.ipd.descartes.mm.adaptation;bundle-version="1.0.0",
org.eclipse.ui,
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ocl
org.eclipse.ocl,
edu.kit.ipd.descartes.mm.resourcelandscape;bundle-version="1.0.0",
edu.kit.ipd.descartes.mm.adaptation;bundle-version="1.0.0",
edu.kit.ipd.descartes.ql.core.engine;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: edu.kit.ipd.descartes.ql.models.mapping.domain,
Import-Package: edu.kit.ipd.descartes.ql.lang.descartesQL,
edu.kit.ipd.descartes.ql.models.mapping.domain,
edu.kit.ipd.descartes.ql.models.mapping.mapping,
edu.kit.ipd.descartes.ql.models.repository,
org.eclipse.core.resources,
......
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.actionSets">
<actionSet
id="edu.kit.ipd.descartes.adaptation.adaptationFrameworkActionSet"
label="Adaptation Framework Action Set"
visible="true">
<menu
id="adaptationFrameworkMenu"
label="Adaptation &amp;Framework">
<separator
name="edu.kit.ipd.descartes.adaptation.AdaptationSeparator">
</separator>
</menu>
<action
class="edu.kit.ipd.descartes.adaptation.actions.StartAdaptationAction"
id="edu.kit.ipd.descartes.adaptation.actions.StartAdaptationAction"
label="Start &amp;Adaptation"
menubarPath="adaptationFrameworkMenu/Adaptation Framework"
toolbarPath="Adaptation Framework"
tooltip="Starts the adaptation process">
</action>
</actionSet>
</extension>
</plugin>
package edu.kit.ipd.descartes.adaptation.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import edu.kit.ipd.descartes.adaptation.ql.QueryEngineAdapter;
/**
* Our sample action implements workbench action delegate.
* The action proxy will be created by the workbench and
* shown in the UI. When the user tries to use the action,
* this delegate will be created and execution will be
* delegated to it.
* @see IWorkbenchWindowActionDelegate
*/
public class StartAdaptationAction implements IWorkbenchWindowActionDelegate {
private IWorkbenchWindow window;
/**
* The constructor.
*/
public StartAdaptationAction() {
}
/**
* The action has been activated. The argument of the
* method represents the 'real' action sitting
* in the workbench UI.
* @see IWorkbenchWindowActionDelegate#run
*/
public void run(IAction action) {
MessageDialog.openInformation(
window.getShell(),
"External",
"Watch the console to see messages about the Adaptation Process");
QueryEngineAdapter qea = new QueryEngineAdapter("/by_dmm-model/optimizationTest.pdr");
System.out.println(qea.queryActiveServers());
}
/**
* Selection in the workbench has been changed. We
* can change the state of the 'real' action here
* if we want, but this can only happen after
* the delegate has been created.
* @see IWorkbenchWindowActionDelegate#selectionChanged
*/
public void selectionChanged(IAction action, ISelection selection) {
}
/**
* We can use this method to dispose of any system
* resources we previously allocated.
* @see IWorkbenchWindowActionDelegate#dispose
*/
public void dispose() {
}
/**
* We will cache window object in order to
* be able to provide parent shell for the message dialog.
* @see IWorkbenchWindowActionDelegate#init
*/
public void init(IWorkbenchWindow window) {
this.window = window;
}
}
\ No newline at end of file
......@@ -34,7 +34,7 @@ public class ObjectivesHelper {
List<Specification> specs = event.getTriggers().getObjective().getSpecifications();
for (Specification specification : specs) {
MetricType m = specification.getMetricType();
// TODO: Connect QueryEngine: Double actualValue = QueryLanguageAdapter.getValueForMetricType(m);
// TODO: Connect QueryEngine: Double actualValue = QueryEngineAdapter.getValueForMetricType(m);
Double actualValue = WeightedSumWeightingFunctionHelper.getValueForMetricType(m, result);
Double threshold = specification.getValue();
if (!ObjectivesHelper.compare(actualValue, threshold, specification.getRelationalOperator()))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment