Commit f550e0a3 authored by Florian's avatar Florian

refactoring

parent 05b71727
......@@ -7,7 +7,7 @@ import kieker.analysis.domain.AggregatedOperationCall;
/**
* @author Florian Echternkamp
*/
public class AggregatedOperationCallViewerComparator extends CallViewerComparator {
public class AggregatedOperationCallViewerComparator extends AnalysisViewerComparator {
public AggregatedOperationCallViewerComparator() {
super();
......
......@@ -6,7 +6,7 @@ import kieker.analysis.domain.AggregatedOperationCall;
/**
* @author Florian Echternkamp
*/
public class AggregatedTraceViewerComparator extends CallViewerComparator {
public class AggregatedTraceViewerComparator extends AnalysisViewerComparator {
public AggregatedTraceViewerComparator() {
super();
......
......@@ -7,13 +7,13 @@ import org.eclipse.swt.SWT;
* @author Florian Echternkamp
*/
public class CallViewerComparator extends ViewerComparator {
public class AnalysisViewerComparator extends ViewerComparator {
protected int propertyIndex;
protected static final int DESCENDING = 1;
protected int direction = DESCENDING;
public CallViewerComparator() {
public AnalysisViewerComparator() {
this.propertyIndex = 0;
direction = DESCENDING;
}
......
......@@ -7,7 +7,7 @@ import kieker.analysis.domain.OperationCall;
* @author Florian Echternkamp
*/
public class OperationCallViewerComparator extends CallViewerComparator {
public class OperationCallViewerComparator extends AnalysisViewerComparator {
public OperationCallViewerComparator() {
super();
......
......@@ -7,7 +7,7 @@ import kieker.analysis.domain.OperationCall;
* @author Florian Echternkamp
*/
public class TraceViewerComparator extends CallViewerComparator {
public class TraceViewerComparator extends AnalysisViewerComparator {
public TraceViewerComparator() {
super();
......
......@@ -90,11 +90,39 @@ public class OpenFileHandler extends AbstractHandler {
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) {
if (editorPart instanceof ITextEditor) {
ITextEditor editor = (ITextEditor) editorPart;
IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
if (doc != null) {
String method = getMethodNameFromOperationString(operation);
String[] parameters = getParametersFromOperationString(operation);
String returnType = getReturnTypeFromOperationString(operation);
IMethod[] methArray = null;
try {
methArray = type.getMethods();
......@@ -102,21 +130,6 @@ public class OpenFileHandler extends AbstractHandler {
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) {
try {
boolean hasName = method.contains(meth.getElementName());
......
......@@ -18,6 +18,8 @@ import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
*/
public abstract class AbstractFolderSelectionHandler extends AbstractHandler {
public int tab;
public IFolder getFolder(ExecutionEvent event){
IFolder folder = null;
ISelection sel = HandlerUtil.getCurrentSelection(event);
......@@ -33,6 +35,12 @@ public abstract class AbstractFolderSelectionHandler extends AbstractHandler {
return folder;
}
public Object execute(ExecutionEvent event) {
IViewPart partView = showView(event);
setTab(partView, tab);
return null;
}
public IViewPart showView(ExecutionEvent event){
try {
IFolder folder = getFolder(event);
......@@ -46,7 +54,7 @@ public abstract class AbstractFolderSelectionHandler extends AbstractHandler {
return null;
}
public void setInputs(IViewPart partView, int focusOnTab){
public void setTab(IViewPart partView, int focusOnTab){
if (partView instanceof AnalysisTreeView) {
AnalysisTreeView view = (AnalysisTreeView) partView;
view.setFocus(focusOnTab);
......
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;
/**
* @author Florian Echternkamp
*/
public class AggregatedOperationCallTreeViewHandler extends AbstractFolderSelectionHandler {
public Object execute(ExecutionEvent event) {
IViewPart partView = showView(event);
setInputs(partView, AnalysisTreeView.AGGROPCALLTAB);
return null;
public AggregatedOperationCallTreeViewHandler(){
tab = AnalysisTreeView.AGGROPCALLTAB;
}
}
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;
/**
* @author Florian Echternkamp
*/
public class AggregatedTraceTreeViewHandler extends AbstractFolderSelectionHandler {
public Object execute(ExecutionEvent event) {
IViewPart partView = showView(event);
setInputs(partView, AnalysisTreeView.AGGRTRACETAB);
return null;
public AggregatedTraceTreeViewHandler() {
tab = AnalysisTreeView.AGGRTRACETAB;
}
}
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;
/**
* @author Florian Echternkamp
*/
public class OperationCallTreeViewHandler extends AbstractFolderSelectionHandler {
public Object execute(ExecutionEvent event) {
IViewPart partView = showView(event);
setInputs(partView, AnalysisTreeView.OPCALLTAB);
return null;
public OperationCallTreeViewHandler() {
tab = AnalysisTreeView.OPCALLTAB;
}
}
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;
/**
......@@ -10,10 +7,8 @@ import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
*/
public class ShowMonitoringLogsHandler extends AbstractFolderSelectionHandler {
public Object execute(ExecutionEvent event) {
IViewPart partView = showView(event);
setInputs(partView, AnalysisTreeView.MONITORINGSTATSTAB);
return null;
public ShowMonitoringLogsHandler() {
tab = AnalysisTreeView.MONITORINGSTATSTAB;
}
}
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;
/**
......@@ -10,10 +7,8 @@ import kieker.tools.eclipse.analysis.view.AnalysisTreeView;
*/
public class TraceTreeViewHandler extends AbstractFolderSelectionHandler {
public Object execute(ExecutionEvent event) {
IViewPart partView = showView(event);
setInputs(partView, AnalysisTreeView.TRACETAB);
return null;
public TraceTreeViewHandler() {
tab = AnalysisTreeView.TRACETAB;
}
}
......@@ -20,7 +20,7 @@ public class FilterModifyListener implements ModifyListener {
this.text = text;
}
public void resetText(){
public void setText(){
filter.setSearchText(text.getText());
viewer.refresh();
TreeColumn[] treeColumns = viewer.getTree().getColumns();
......@@ -30,11 +30,7 @@ public class FilterModifyListener implements ModifyListener {
@Override
public void modifyText(ModifyEvent e) {
filter.setSearchText(text.getText());
viewer.refresh();
TreeColumn[] treeColumns = viewer.getTree().getColumns();
for (TreeColumn treeColumn : treeColumns)
treeColumn.pack();
setText();
}
}
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;
/**
* @author Florian Echternkamp
*/
public abstract class AbstractMultipleTypesCallLabelProvider extends ColumnLabelProvider {
public abstract class AbstractLabelProvider extends ColumnLabelProvider {
public String getText(Object element) {
......
......@@ -5,7 +5,7 @@ import kieker.analysis.domain.AggregatedOperationCall;
/**
* @author Florian Echternkamp
*/
public class CallsLabelProvider extends AbstractAggregationCallLabelProvider {
public class CallsLabelProvider extends AbstractLabelProvider {
@Override
public String getString(AggregatedOperationCall opCall) {
......
......@@ -12,7 +12,7 @@ import kieker.tools.eclipse.analysis.model.Properties;
/**
* @author Florian Echternkamp
*/
public class ComponentLabelProvider extends AbstractMultipleTypesCallLabelProvider {
public class ComponentLabelProvider extends AbstractLabelProvider {
String compRepresentation;
public ComponentLabelProvider() {
Activator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
......
......@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall;
/**
* @author Florian Echternkamp
*/
public class ContainerLabelProvider extends AbstractMultipleTypesCallLabelProvider {
public class ContainerLabelProvider extends AbstractLabelProvider {
@Override
public String getString(AggregatedOperationCall opCall) {
......
......@@ -13,7 +13,7 @@ import kieker.tools.eclipse.analysis.provider.DataProvider;
/**
* @author Florian Echternkamp
*/
public class DurationLabelProvider extends AbstractMultipleTypesCallLabelProvider {
public class DurationLabelProvider extends AbstractLabelProvider {
String timeUnit = "";
TimeUnit newUnit;
......
......@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall;
/**
* @author Florian Echternkamp
*/
public class FailedLabelProvider extends AbstractMultipleTypesCallLabelProvider {
public class FailedLabelProvider extends AbstractLabelProvider {
@Override
public String getString(AggregatedOperationCall opCall) {
......
......@@ -17,7 +17,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
* @author Florian Echternkamp
*/
public class OperationLabelProvider extends AbstractMultipleTypesCallLabelProvider {
public class OperationLabelProvider extends AbstractLabelProvider {
ISharedImages images;
String opRepresentation;
......
......@@ -5,7 +5,7 @@ import kieker.analysis.domain.OperationCall;
/**
* @author Florian Echternkamp
*/
public class PercentLabelProvider extends AbstractMultipleTypesCallLabelProvider {
public class PercentLabelProvider extends AbstractLabelProvider {
@Override
public String getString(OperationCall opCall) {
......
......@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall;
/**
* @author Florian Echternkamp
*/
public class StackDepthLabelProvider extends AbstractMultipleTypesCallLabelProvider {
public class StackDepthLabelProvider extends AbstractLabelProvider {
@Override
public String getString(OperationCall opCall) {
......
......@@ -6,7 +6,7 @@ import kieker.analysis.domain.OperationCall;
/**
* @author Florian Echternkamp
*/
public class StackSizeLabelProvider extends AbstractMultipleTypesCallLabelProvider {
public class StackSizeLabelProvider extends AbstractLabelProvider {
@Override
public String getString(OperationCall opCall) {
......
......@@ -8,7 +8,7 @@ import kieker.tools.eclipse.analysis.provider.DataProvider;
/**
* @author Florian Echternkamp
*/
public class TimestampLabelProvider extends AbstractMultipleTypesCallLabelProvider {
public class TimestampLabelProvider extends AbstractLabelProvider {
@Override
public String getString(OperationCall opCall) {
......
......@@ -5,7 +5,7 @@ import kieker.analysis.domain.OperationCall;
/**
* @author Florian Echternkamp
*/
public class TraceLabelProvider extends AbstractCallLabelProvider {
public class TraceLabelProvider extends AbstractLabelProvider {
@Override
public String getString(OperationCall opCall) {
......
......@@ -19,33 +19,27 @@ public class OpCallTabTester extends PropertyTester {
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if ("checkOpCallTab".equals(property)) {
if (receiver instanceof OperationCall) {
IViewPart analysisView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.findView(AnalysisTreeView.VIEWNAME);
if (analysisView instanceof AnalysisTreeView) {
AnalysisTreeView view = (AnalysisTreeView) analysisView;
TabFolder tabFolder = view.getTabFolder();
if (tabFolder.getSelectionIndex() == AnalysisTreeView.OPCALLTAB) {
return true;
}
}
checkTab(AnalysisTreeView.OPCALLTAB);
}
} else if("checkAggrOpCallTab".equals(property)){
if (receiver instanceof AggregatedOperationCall) {
checkTab(AnalysisTreeView.AGGROPCALLTAB);
}
}
return false;
}
private boolean checkTab(int tab){
IViewPart analysisView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.findView(AnalysisTreeView.VIEWNAME);
if (analysisView instanceof AnalysisTreeView) {
AnalysisTreeView view = (AnalysisTreeView) analysisView;
TabFolder tabFolder = view.getTabFolder();
if (tabFolder.getSelectionIndex() == AnalysisTreeView.AGGROPCALLTAB) {
if (tabFolder.getSelectionIndex() == tab) {
return true;
}
}
}
}
return false;
}
......
......@@ -39,7 +39,7 @@ import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.part.ViewPart;
import kieker.tools.eclipse.analysis.comparator.CallViewerComparator;
import kieker.tools.eclipse.analysis.comparator.AnalysisViewerComparator;
import kieker.tools.eclipse.analysis.helper.TreeFilter;
import kieker.tools.eclipse.analysis.listener.FilterModifyListener;
import kieker.tools.eclipse.analysis.model.ColumnDef;
......@@ -168,7 +168,7 @@ public abstract class AbstractJFaceView extends ViewPart {
getSite().setSelectionProvider(viewer);
}
void createTreeViewerColumns(TreeViewer viewer, CallViewerComparator comparator, ColumnDef[] cols) {
void createTreeViewerColumns(TreeViewer viewer, AnalysisViewerComparator comparator, ColumnDef[] cols) {
int i = 0;
for (ColumnDef col : cols) {
createTreeViewerColumn(viewer, comparator, col.getStyle(), col.getName(), col.getWidth(),
......@@ -176,7 +176,7 @@ public abstract class AbstractJFaceView extends ViewPart {
}
}
void createTreeViewerColumn(TreeViewer viewer, CallViewerComparator comparator, int style, String title, int width,
void createTreeViewerColumn(TreeViewer viewer, AnalysisViewerComparator comparator, int style, String title, int width,
ColumnLabelProvider provider, int index) {
TreeViewerColumn viewCol = new TreeViewerColumn(viewer, style);
TreeColumn col = viewCol.getColumn();
......@@ -187,7 +187,7 @@ public abstract class AbstractJFaceView extends ViewPart {
viewCol.setLabelProvider(provider);
}
SelectionAdapter getSelectionAdapter(final TreeViewer viewer, final CallViewerComparator comparator,
SelectionAdapter getSelectionAdapter(final TreeViewer viewer, final AnalysisViewerComparator comparator,
final TreeColumn column, final int index) {
SelectionAdapter selectionAdapter = new SelectionAdapter() {
@Override
......
......@@ -125,7 +125,7 @@ public class AnalysisTreeView extends AbstractJFaceView {
TypedListener l = (TypedListener) listener[0];
if(l.getEventListener() instanceof FilterModifyListener){
((FilterModifyListener) l.getEventListener()).resetText();
((FilterModifyListener) l.getEventListener()).setText();
}
}
}
......
......@@ -6,7 +6,8 @@ import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.IWorkbench;
......@@ -27,9 +28,10 @@ public class PluginPreferencesPage extends FieldEditorPreferencePage implements
@Override
protected void createFieldEditors() {
Composite composite = new Composite(getFieldEditorParent(), SWT.NONE);
RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
rowLayout.justify = true;
composite.setLayout(rowLayout);
GridLayout layout = new GridLayout(2, false);
layout.verticalSpacing = 10;
composite.setLayout(layout);
Group appearance = createGroup(composite, Messages.PluginPreferencesPage_GroupAppearance);
......@@ -62,6 +64,18 @@ public class PluginPreferencesPage extends FieldEditorPreferencePage implements
private Group createGroup(Composite parent, String text) {
Group group = new Group(parent, SWT.NONE);
group.setText(text);
GridLayout layout = new GridLayout(1, false);
layout.verticalSpacing = 30;
group.setLayout(layout);
GridData gridData = new GridData();
gridData.horizontalSpan = 2;
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
group.setLayoutData(gridData);
return group;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment