+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.tests.uml2sd.load;
import java.net.URL;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.AsyncMessageReturn;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BasicExecutionOccurrence;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
-// Referenced classes of package org.eclipse.hyades.uml2sd.ztest:
-// OpenToolBox
-
+/**
+ * Test loader class.
+ */
+@SuppressWarnings("javadoc")
public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterProvider, ISDPagingProvider, ISelectionListener {
public SDView v;
this(""); //$NON-NLS-1$
}
+ @SuppressWarnings("unused")
public TestLoaders(String name) {
page = 1;
}
}
}
- for (int i = 0; i < testFrame.lifeLinesCount(); i++)
+ for (int i = 0; i < testFrame.lifeLinesCount(); i++) {
if (i > 0) {
ExecutionOccurrence occ = new ExecutionOccurrence();
occ.setStartOccurrence(testFrame.getSyncMessage(i).getEventOccurrence() + 1);
testFrame.getLifeline(i).addExecution(occ);
occ.setName("******************* Execution Occurance TEST ****************");
}
+ }
Stop s = new Stop();
s.setLifeline(testFrame.getLifeline(1));
occ.setEndOccurrence(testFrame.getSyncMessageReturn(i - 1).getEventOccurrence());
testFrame.getLifeline(0).addExecution(occ);
}
- }
+ }
v.setFrame(testFrame);
}
public boolean find(Criteria toSearch) {
Frame frame = v.getFrame();
- if (frame == null)
+ if (frame == null) {
return false;
+ }
if (findResults == null || findCriteria == null || !findCriteria.compareTo(toSearch)) {
findResults = new ArrayList<GraphNode>();
findCriteria = toSearch;
if (findCriteria.isLifeLineSelected()) {
for (int i = 0; i < frame.lifeLinesCount(); i++) {
- if (findCriteria.matches(frame.getLifeline(i).getName()))
+ if (findCriteria.matches(frame.getLifeline(i).getName())) {
findResults.add(frame.getLifeline(i));
+ }
}
}
ArrayList<GraphNode> msgs = new ArrayList<GraphNode>();
if (findCriteria.isSyncMessageSelected()) {
for (int i = 0; i < frame.syncMessageCount(); i++) {
- if (findCriteria.matches(frame.getSyncMessage(i).getName()))
+ if (findCriteria.matches(frame.getSyncMessage(i).getName())) {
msgs.add(frame.getSyncMessage(i));
+ }
}
- for (int i = 0; i < frame.syncMessageReturnCount(); i++)
- if (findCriteria.matches(frame.getSyncMessageReturn(i).getName()))
+ for (int i = 0; i < frame.syncMessageReturnCount(); i++) {
+ if (findCriteria.matches(frame.getSyncMessageReturn(i).getName())) {
msgs.add(frame.getSyncMessageReturn(i));
+ }
+ }
}
// if(msgs.size() > 0) {
msgs = new ArrayList<GraphNode>();
if (findCriteria.isAsyncMessageSelected()) {
- for (int i = 0; i < frame.asyncMessageCount(); i++)
- if (findCriteria.matches(frame.getAsyncMessage(i).getName()))
+ for (int i = 0; i < frame.asyncMessageCount(); i++) {
+ if (findCriteria.matches(frame.getAsyncMessage(i).getName())) {
msgs.add(frame.getAsyncMessage(i));
+ }
+ }
- for (int i = 0; i < frame.asyncMessageReturnCount(); i++)
- if (findCriteria.matches(frame.getAsyncMessageReturn(i).getName()))
+ for (int i = 0; i < frame.asyncMessageReturnCount(); i++) {
+ if (findCriteria.matches(frame.getAsyncMessageReturn(i).getName())) {
msgs.add(frame.getAsyncMessageReturn(i));
+ }
+ }
}
// if(msgs.size() > 0) {
@SuppressWarnings("rawtypes")
List selection = v.getSDWidget().getSelection();
- if (selection != null && selection.size() == 1)
+ if (selection != null && selection.size() == 1) {
currentFindIndex = findResults.indexOf(selection.get(0)) + 1;
- else
+ } else {
currentFindIndex = 0;
+ }
} else {
currentFindIndex++;
}
if (findResults.size() > currentFindIndex) {
- GraphNode current = (GraphNode) findResults.get(currentFindIndex);
+ GraphNode current = findResults.get(currentFindIndex);
v.getSDWidget().moveTo(current);
return true;
- } else {
- // return notFoundYet(findCriteria); // search in other page
- return false;
}
- // return false;
+ // return notFoundYet(findCriteria); // search in other page
+ return false;
}
@Override
}
}
- for (int i = 0; i < frame.syncMessageReturnCount(); i++)
+ for (int i = 0; i < frame.syncMessageReturnCount(); i++) {
if (filterCriteria.getCriteria().matches(frame.getSyncMessageReturn(i).getName())) {
frame.getSyncMessageReturn(i).setVisible(false);
found = true;
}
+ }
}
v.getSDWidget().redraw();
@SuppressWarnings("nls")
public Image getResourceImage(String _name) {
- ImageDescriptor img;
+ ImageDescriptor imgage;
try {
URL BASIC_URL = new URL("platform", "localhost", "plugin");
URL url = new URL(BASIC_URL, (new StringBuilder("plugin/org.eclipse.linuxtools.tmf.ui/icons/")).append(_name).toString());
- img = ImageDescriptor.createFromURL(url);
- return img.createImage();
+ imgage = ImageDescriptor.createFromURL(url);
+ return imgage.createImage();
} catch (Exception e) {
System.err.println(e);
}
@Override
public void dispose() {
- if (img != null)
+ if (img != null) {
img.dispose();
+ }
}
}
public void firstPage() {
page = 0;
createFrame();
-
+
}
@Override