Commit f550e0a3 authored by Florian's avatar Florian

refactoring

parent 05b71727
...@@ -7,7 +7,7 @@ import kieker.analysis.domain.AggregatedOperationCall; ...@@ -7,7 +7,7 @@ import kieker.analysis.domain.AggregatedOperationCall;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class AggregatedOperationCallViewerComparator extends CallViewerComparator { public class AggregatedOperationCallViewerComparator extends AnalysisViewerComparator {
public AggregatedOperationCallViewerComparator() { public AggregatedOperationCallViewerComparator() {
super(); super();
......
...@@ -6,7 +6,7 @@ import kieker.analysis.domain.AggregatedOperationCall; ...@@ -6,7 +6,7 @@ import kieker.analysis.domain.AggregatedOperationCall;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class AggregatedTraceViewerComparator extends CallViewerComparator { public class AggregatedTraceViewerComparator extends AnalysisViewerComparator {
public AggregatedTraceViewerComparator() { public AggregatedTraceViewerComparator() {
super(); super();
......
...@@ -7,13 +7,13 @@ import org.eclipse.swt.SWT; ...@@ -7,13 +7,13 @@ import org.eclipse.swt.SWT;
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class CallViewerComparator extends ViewerComparator { public class AnalysisViewerComparator extends ViewerComparator {
protected int propertyIndex; protected int propertyIndex;
protected static final int DESCENDING = 1; protected static final int DESCENDING = 1;
protected int direction = DESCENDING; protected int direction = DESCENDING;
public CallViewerComparator() { public AnalysisViewerComparator() {
this.propertyIndex = 0; this.propertyIndex = 0;
direction = DESCENDING; direction = DESCENDING;
} }
......
...@@ -7,7 +7,7 @@ import kieker.analysis.domain.OperationCall; ...@@ -7,7 +7,7 @@ import kieker.analysis.domain.OperationCall;
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class OperationCallViewerComparator extends CallViewerComparator { public class OperationCallViewerComparator extends AnalysisViewerComparator {
public OperationCallViewerComparator() { public OperationCallViewerComparator() {
super(); super();
......
...@@ -7,7 +7,7 @@ import kieker.analysis.domain.OperationCall; ...@@ -7,7 +7,7 @@ import kieker.analysis.domain.OperationCall;
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class TraceViewerComparator extends CallViewerComparator { public class TraceViewerComparator extends AnalysisViewerComparator {
public TraceViewerComparator() { public TraceViewerComparator() {
super(); super();
......
...@@ -89,34 +89,47 @@ public class OpenFileHandler extends AbstractHandler { ...@@ -89,34 +89,47 @@ public class OpenFileHandler extends AbstractHandler {
} }
return null; return null;
} }
String getMethodNameFromOperationString(String operation){
operation = operation.substring(0, operation.indexOf("("));
return operation.substring(operation.lastIndexOf(".") + 1, operation.length());
}
String getReturnTypeFromOperationString(String operation){
operation = operation.substring(0, operation.indexOf("("));
operation = operation.substring(0, operation.lastIndexOf(" "));
operation = operation.substring(operation.lastIndexOf(" ") + 1, operation.length());
return operation.substring(operation.lastIndexOf(".") + 1, operation.length());
}
String[] getParametersFromOperationString(String operation){
operation = operation.substring(operation.indexOf("("), operation.length());
operation = operation.replace("(", "").replace(")", "").replace(" ", "");
String[] parameters;
if (operation.equals("")) {
parameters = new String[0];
} else {
parameters = operation.split(",");
}
return parameters;
}
private void highlightCodeline(IEditorPart editorPart, String operation) { private void highlightCodeline(IEditorPart editorPart, String operation) {
if (editorPart instanceof ITextEditor) { if (editorPart instanceof ITextEditor) {
ITextEditor editor = (ITextEditor) editorPart; ITextEditor editor = (ITextEditor) editorPart;
IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput()); IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
if (doc != null) { if (doc != null) {
String method = getMethodNameFromOperationString(operation);
String[] parameters = getParametersFromOperationString(operation);
String returnType = getReturnTypeFromOperationString(operation);
IMethod[] methArray = null; IMethod[] methArray = null;
try { try {
methArray = type.getMethods(); methArray = type.getMethods();
} catch (JavaModelException e1) { } catch (JavaModelException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
String parameter = operation.substring(operation.indexOf("("), operation.length());
parameter = parameter.replace("(", "").replace(")", "").replace(" ", "");
String[] parameters;
if (parameter.equals("")) {
parameters = new String[0];
} else {
parameters = parameter.split(",");
}
operation = operation.substring(0, operation.indexOf("("));
String method = operation.substring(operation.lastIndexOf(".") + 1, operation.length());
String returnType = operation.substring(0, operation.lastIndexOf(" "));
returnType = returnType.substring(returnType.lastIndexOf(" ") + 1, returnType.length());
returnType = returnType.substring(returnType.lastIndexOf(".") + 1, returnType.length());
methodloop: for (IMethod meth : methArray) { methodloop: for (IMethod meth : methArray) {
try { try {
boolean hasName = method.contains(meth.getElementName()); boolean hasName = method.contains(meth.getElementName());
......
...@@ -18,6 +18,8 @@ import kieker.tools.eclipse.analysis.view.AnalysisTreeView; ...@@ -18,6 +18,8 @@ import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
*/ */
public abstract class AbstractFolderSelectionHandler extends AbstractHandler { public abstract class AbstractFolderSelectionHandler extends AbstractHandler {
public int tab;
public IFolder getFolder(ExecutionEvent event){ public IFolder getFolder(ExecutionEvent event){
IFolder folder = null; IFolder folder = null;
ISelection sel = HandlerUtil.getCurrentSelection(event); ISelection sel = HandlerUtil.getCurrentSelection(event);
...@@ -33,6 +35,12 @@ public abstract class AbstractFolderSelectionHandler extends AbstractHandler { ...@@ -33,6 +35,12 @@ public abstract class AbstractFolderSelectionHandler extends AbstractHandler {
return folder; return folder;
} }
public Object execute(ExecutionEvent event) {
IViewPart partView = showView(event);
setTab(partView, tab);
return null;
}
public IViewPart showView(ExecutionEvent event){ public IViewPart showView(ExecutionEvent event){
try { try {
IFolder folder = getFolder(event); IFolder folder = getFolder(event);
...@@ -46,7 +54,7 @@ public abstract class AbstractFolderSelectionHandler extends AbstractHandler { ...@@ -46,7 +54,7 @@ public abstract class AbstractFolderSelectionHandler extends AbstractHandler {
return null; return null;
} }
public void setInputs(IViewPart partView, int focusOnTab){ public void setTab(IViewPart partView, int focusOnTab){
if (partView instanceof AnalysisTreeView) { if (partView instanceof AnalysisTreeView) {
AnalysisTreeView view = (AnalysisTreeView) partView; AnalysisTreeView view = (AnalysisTreeView) partView;
view.setFocus(focusOnTab); view.setFocus(focusOnTab);
......
package kieker.tools.eclipse.analysis.handler.folder; package kieker.tools.eclipse.analysis.handler.folder;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.IViewPart;
import kieker.tools.eclipse.analysis.view.AnalysisTreeView; import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class AggregatedOperationCallTreeViewHandler extends AbstractFolderSelectionHandler { public class AggregatedOperationCallTreeViewHandler extends AbstractFolderSelectionHandler {
public AggregatedOperationCallTreeViewHandler(){
public Object execute(ExecutionEvent event) { tab = AnalysisTreeView.AGGROPCALLTAB;
IViewPart partView = showView(event);
setInputs(partView, AnalysisTreeView.AGGROPCALLTAB);
return null;
} }
} }
package kieker.tools.eclipse.analysis.handler.folder; package kieker.tools.eclipse.analysis.handler.folder;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.IViewPart;
import kieker.tools.eclipse.analysis.view.AnalysisTreeView; import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class AggregatedTraceTreeViewHandler extends AbstractFolderSelectionHandler { public class AggregatedTraceTreeViewHandler extends AbstractFolderSelectionHandler {
public AggregatedTraceTreeViewHandler() {
public Object execute(ExecutionEvent event) { tab = AnalysisTreeView.AGGRTRACETAB;
IViewPart partView = showView(event);
setInputs(partView, AnalysisTreeView.AGGRTRACETAB);
return null;
} }
} }
package kieker.tools.eclipse.analysis.handler.folder; package kieker.tools.eclipse.analysis.handler.folder;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.IViewPart;
import kieker.tools.eclipse.analysis.view.AnalysisTreeView; import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class OperationCallTreeViewHandler extends AbstractFolderSelectionHandler { public class OperationCallTreeViewHandler extends AbstractFolderSelectionHandler {
public OperationCallTreeViewHandler() {
public Object execute(ExecutionEvent event) { tab = AnalysisTreeView.OPCALLTAB;
IViewPart partView = showView(event);
setInputs(partView, AnalysisTreeView.OPCALLTAB);
return null;
} }
} }
package kieker.tools.eclipse.analysis.handler.folder; package kieker.tools.eclipse.analysis.handler.folder;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.IViewPart;
import kieker.tools.eclipse.analysis.view.AnalysisTreeView; import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
/** /**
...@@ -10,10 +7,8 @@ import kieker.tools.eclipse.analysis.view.AnalysisTreeView; ...@@ -10,10 +7,8 @@ import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
*/ */
public class ShowMonitoringLogsHandler extends AbstractFolderSelectionHandler { public class ShowMonitoringLogsHandler extends AbstractFolderSelectionHandler {
public Object execute(ExecutionEvent event) { public ShowMonitoringLogsHandler() {
IViewPart partView = showView(event); tab = AnalysisTreeView.MONITORINGSTATSTAB;
setInputs(partView, AnalysisTreeView.MONITORINGSTATSTAB);
return null;
} }
} }
package kieker.tools.eclipse.analysis.handler.folder; package kieker.tools.eclipse.analysis.handler.folder;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.IViewPart;
import kieker.tools.eclipse.analysis.view.AnalysisTreeView; import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
/** /**
...@@ -10,10 +7,8 @@ import kieker.tools.eclipse.analysis.view.AnalysisTreeView; ...@@ -10,10 +7,8 @@ import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
*/ */
public class TraceTreeViewHandler extends AbstractFolderSelectionHandler { public class TraceTreeViewHandler extends AbstractFolderSelectionHandler {
public Object execute(ExecutionEvent event) { public TraceTreeViewHandler() {
IViewPart partView = showView(event); tab = AnalysisTreeView.TRACETAB;
setInputs(partView, AnalysisTreeView.TRACETAB);
return null;
} }
} }
...@@ -20,7 +20,7 @@ public class FilterModifyListener implements ModifyListener { ...@@ -20,7 +20,7 @@ public class FilterModifyListener implements ModifyListener {
this.text = text; this.text = text;
} }
public void resetText(){ public void setText(){
filter.setSearchText(text.getText()); filter.setSearchText(text.getText());
viewer.refresh(); viewer.refresh();
TreeColumn[] treeColumns = viewer.getTree().getColumns(); TreeColumn[] treeColumns = viewer.getTree().getColumns();
...@@ -30,11 +30,7 @@ public class FilterModifyListener implements ModifyListener { ...@@ -30,11 +30,7 @@ public class FilterModifyListener implements ModifyListener {
@Override @Override
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
filter.setSearchText(text.getText()); setText();
viewer.refresh();
TreeColumn[] treeColumns = viewer.getTree().getColumns();
for (TreeColumn treeColumn : treeColumns)
treeColumn.pack();
} }
} }
package kieker.tools.eclipse.analysis.provider.label;
import kieker.analysis.domain.AggregatedOperationCall;
import org.eclipse.jface.viewers.ColumnLabelProvider;
/**
* @author Florian Echternkamp
*/
public abstract class AbstractAggregationCallLabelProvider extends ColumnLabelProvider {
@Override
public String getText(Object element) {
if (element instanceof AggregatedOperationCall) {
AggregatedOperationCall opCall = (AggregatedOperationCall) element;
return getString(opCall);
}
return "";
}
public String getString(AggregatedOperationCall opCall) {
return "";
}
}
package kieker.tools.eclipse.analysis.provider.label;
import kieker.analysis.domain.OperationCall;
import org.eclipse.jface.viewers.ColumnLabelProvider;
/**
* @author Florian Echternkamp
*/
public abstract class AbstractCallLabelProvider extends ColumnLabelProvider {
@Override
public String getText(Object element) {
if (element instanceof OperationCall) {
OperationCall opCall = (OperationCall) element;
return getString(opCall);
}
return "";
}
public String getString(OperationCall opCall) {
return "";
}
}
...@@ -9,7 +9,7 @@ import org.eclipse.jface.viewers.ColumnLabelProvider; ...@@ -9,7 +9,7 @@ import org.eclipse.jface.viewers.ColumnLabelProvider;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public abstract class AbstractMultipleTypesCallLabelProvider extends ColumnLabelProvider { public abstract class AbstractLabelProvider extends ColumnLabelProvider {
public String getText(Object element) { public String getText(Object element) {
......
...@@ -5,7 +5,7 @@ import kieker.analysis.domain.AggregatedOperationCall; ...@@ -5,7 +5,7 @@ import kieker.analysis.domain.AggregatedOperationCall;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class CallsLabelProvider extends AbstractAggregationCallLabelProvider { public class CallsLabelProvider extends AbstractLabelProvider {
@Override @Override
public String getString(AggregatedOperationCall opCall) { public String getString(AggregatedOperationCall opCall) {
......
...@@ -12,7 +12,7 @@ import kieker.tools.eclipse.analysis.model.Properties; ...@@ -12,7 +12,7 @@ import kieker.tools.eclipse.analysis.model.Properties;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class ComponentLabelProvider extends AbstractMultipleTypesCallLabelProvider { public class ComponentLabelProvider extends AbstractLabelProvider {
String compRepresentation; String compRepresentation;
public ComponentLabelProvider() { public ComponentLabelProvider() {
Activator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { Activator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
......
...@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall; ...@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class ContainerLabelProvider extends AbstractMultipleTypesCallLabelProvider { public class ContainerLabelProvider extends AbstractLabelProvider {
@Override @Override
public String getString(AggregatedOperationCall opCall) { public String getString(AggregatedOperationCall opCall) {
......
...@@ -13,7 +13,7 @@ import kieker.tools.eclipse.analysis.provider.DataProvider; ...@@ -13,7 +13,7 @@ import kieker.tools.eclipse.analysis.provider.DataProvider;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class DurationLabelProvider extends AbstractMultipleTypesCallLabelProvider { public class DurationLabelProvider extends AbstractLabelProvider {
String timeUnit = ""; String timeUnit = "";
TimeUnit newUnit; TimeUnit newUnit;
......
...@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall; ...@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class FailedLabelProvider extends AbstractMultipleTypesCallLabelProvider { public class FailedLabelProvider extends AbstractLabelProvider {
@Override @Override
public String getString(AggregatedOperationCall opCall) { public String getString(AggregatedOperationCall opCall) {
......
...@@ -17,7 +17,7 @@ import org.eclipse.jface.util.PropertyChangeEvent; ...@@ -17,7 +17,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class OperationLabelProvider extends AbstractMultipleTypesCallLabelProvider { public class OperationLabelProvider extends AbstractLabelProvider {
ISharedImages images; ISharedImages images;
String opRepresentation; String opRepresentation;
......
...@@ -5,7 +5,7 @@ import kieker.analysis.domain.OperationCall; ...@@ -5,7 +5,7 @@ import kieker.analysis.domain.OperationCall;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class PercentLabelProvider extends AbstractMultipleTypesCallLabelProvider { public class PercentLabelProvider extends AbstractLabelProvider {
@Override @Override
public String getString(OperationCall opCall) { public String getString(OperationCall opCall) {
......
...@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall; ...@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class StackDepthLabelProvider extends AbstractMultipleTypesCallLabelProvider { public class StackDepthLabelProvider extends AbstractLabelProvider {
@Override @Override
public String getString(OperationCall opCall) { public String getString(OperationCall opCall) {
......
...@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall; ...@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class StackSizeLabelProvider extends AbstractMultipleTypesCallLabelProvider { public class StackSizeLabelProvider extends AbstractLabelProvider {
@Override @Override
public String getString(OperationCall opCall) { public String getString(OperationCall opCall) {
......
...@@ -8,7 +8,7 @@ import kieker.tools.eclipse.analysis.provider.DataProvider; ...@@ -8,7 +8,7 @@ import kieker.tools.eclipse.analysis.provider.DataProvider;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class TimestampLabelProvider extends AbstractMultipleTypesCallLabelProvider { public class TimestampLabelProvider extends AbstractLabelProvider {
@Override @Override
public String getString(OperationCall opCall) { public String getString(OperationCall opCall) {
......
...@@ -5,7 +5,7 @@ import kieker.analysis.domain.OperationCall; ...@@ -5,7 +5,7 @@ import kieker.analysis.domain.OperationCall;
/** /**
* @author Florian Echternkamp * @author Florian Echternkamp
*/ */
public class TraceLabelProvider extends AbstractCallLabelProvider { public class TraceLabelProvider extends AbstractLabelProvider {
@Override @Override
public String getString(OperationCall opCall) { public String getString(OperationCall opCall) {
......
...@@ -19,34 +19,28 @@ public class OpCallTabTester extends PropertyTester { ...@@ -19,34 +19,28 @@ public class OpCallTabTester extends PropertyTester {
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if ("checkOpCallTab".equals(property)) { if ("checkOpCallTab".equals(property)) {