Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2010-07-24 04:02:08 -0400
committerrbrooks2010-07-24 04:02:08 -0400
commit4ed8bddc791fda93940f238c5135556a07041dc0 (patch)
tree64a118285c5006c3a38320dbb2d374e8ea72a061 /plugins/org.eclipse.osee.ote.ui.message.util
parent542cc7344d3f129d64e47f547384297c8e1b1f43 (diff)
downloadorg.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.gz
org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.xz
org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.zip
converted all line terminators to unix style
Diffstat (limited to 'plugins/org.eclipse.osee.ote.ui.message.util')
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/.classpath14
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/.project56
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/build.properties8
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ClientMessageServiceTracker.java118
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ElementFilter.java100
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/IOteMessageClientView.java44
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java282
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java210
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/internal/Activator.java82
9 files changed, 457 insertions, 457 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/.classpath b/plugins/org.eclipse.osee.ote.ui.message.util/.classpath
index 8a8f1668cd..ad32c83a78 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/.classpath
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/.project b/plugins/org.eclipse.osee.ote.ui.message.util/.project
index 01428f98d8..652125d8c6 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/.project
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.osee.ote.ui.message.util</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.ote.ui.message.util</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/build.properties b/plugins/org.eclipse.osee.ote.ui.message.util/build.properties
index 41eb6ade2b..34d2e4d2da 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/build.properties
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/build.properties
@@ -1,4 +1,4 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ClientMessageServiceTracker.java b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ClientMessageServiceTracker.java
index 2d6aa1d31e..e67e7da8f5 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ClientMessageServiceTracker.java
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ClientMessageServiceTracker.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * 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:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ote.ui.message.util;
-
-import java.util.logging.Level;
-
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.ote.client.msg.IOteMessageService;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * @author Ken J. Aguilar
- *
- */
-public class ClientMessageServiceTracker extends ServiceTracker {
-
- private final IOteMessageClientView viewer;
-
- /**
- * @param context
- * @param filter
- * @param customizer
- */
- public ClientMessageServiceTracker(BundleContext context, IOteMessageClientView viewer) {
- super(context, IOteMessageService.class.getName(), null);
- this.viewer = viewer;
- }
-
- @Override
- public synchronized Object addingService(ServiceReference reference) {
- IOteMessageService service = (IOteMessageService)super.addingService(reference);
- try {
- viewer.oteMessageServiceAcquired(service);
- } catch (RuntimeException e) {
- OseeLog.log(ClientMessageServiceTracker.class, Level.SEVERE, "exception while notifying viewer of service", e);
- }
- return service;
- }
-
- @Override
- public synchronized void removedService(ServiceReference reference, Object service) {
- try {
- viewer.oteMessageServiceReleased();
- } catch (RuntimeException e) {
- OseeLog.log(ClientMessageServiceTracker.class, Level.SEVERE, "exception while notifying viewer of service stop", e);
- } finally {
- super.removedService(reference, service);
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.ui.message.util;
+
+import java.util.logging.Level;
+
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.ote.client.msg.IOteMessageService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * @author Ken J. Aguilar
+ *
+ */
+public class ClientMessageServiceTracker extends ServiceTracker {
+
+ private final IOteMessageClientView viewer;
+
+ /**
+ * @param context
+ * @param filter
+ * @param customizer
+ */
+ public ClientMessageServiceTracker(BundleContext context, IOteMessageClientView viewer) {
+ super(context, IOteMessageService.class.getName(), null);
+ this.viewer = viewer;
+ }
+
+ @Override
+ public synchronized Object addingService(ServiceReference reference) {
+ IOteMessageService service = (IOteMessageService)super.addingService(reference);
+ try {
+ viewer.oteMessageServiceAcquired(service);
+ } catch (RuntimeException e) {
+ OseeLog.log(ClientMessageServiceTracker.class, Level.SEVERE, "exception while notifying viewer of service", e);
+ }
+ return service;
+ }
+
+ @Override
+ public synchronized void removedService(ServiceReference reference, Object service) {
+ try {
+ viewer.oteMessageServiceReleased();
+ } catch (RuntimeException e) {
+ OseeLog.log(ClientMessageServiceTracker.class, Level.SEVERE, "exception while notifying viewer of service stop", e);
+ } finally {
+ super.removedService(reference, service);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ElementFilter.java b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ElementFilter.java
index a04fe1aa08..8e99f66c78 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ElementFilter.java
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/ElementFilter.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * 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:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ote.ui.message.util;
-
-import java.util.Arrays;
-import java.util.HashSet;
-
-import org.eclipse.osee.ote.message.elements.Element;
-
-/**
- * @author Ken J. Aguilar
- *
- */
-public class ElementFilter {
- private final HashSet<Class<? extends Element>> classes = new HashSet<Class<? extends Element>>();
- private boolean headerElementsAllowed = true;
-
- /**
- * @param allowHeaderElements the allowHeaderElements to set
- */
- public void setHeaderElementsAllowed(boolean headerElementsAllowed) {
- this.headerElementsAllowed = headerElementsAllowed;
- }
-
- public void addAllowableClass(Class<? extends Element> elementClass) {
- classes.add(elementClass);
- }
-
- public void addAllowableClass(Class<? extends Element>... elementClasses) {
- classes.addAll(Arrays.asList(elementClasses));
- }
-
- public boolean accept(Element e) {
- return classes.contains(e.getClass());
- }
-
- /**
- * @return the headerElementsAllowed
- */
- public boolean isHeaderElementsAllowed() {
- return headerElementsAllowed;
- }
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.ui.message.util;
+
+import java.util.Arrays;
+import java.util.HashSet;
+
+import org.eclipse.osee.ote.message.elements.Element;
+
+/**
+ * @author Ken J. Aguilar
+ *
+ */
+public class ElementFilter {
+ private final HashSet<Class<? extends Element>> classes = new HashSet<Class<? extends Element>>();
+ private boolean headerElementsAllowed = true;
+
+ /**
+ * @param allowHeaderElements the allowHeaderElements to set
+ */
+ public void setHeaderElementsAllowed(boolean headerElementsAllowed) {
+ this.headerElementsAllowed = headerElementsAllowed;
+ }
+
+ public void addAllowableClass(Class<? extends Element> elementClass) {
+ classes.add(elementClass);
+ }
+
+ public void addAllowableClass(Class<? extends Element>... elementClasses) {
+ classes.addAll(Arrays.asList(elementClasses));
+ }
+
+ public boolean accept(Element e) {
+ return classes.contains(e.getClass());
+ }
+
+ /**
+ * @return the headerElementsAllowed
+ */
+ public boolean isHeaderElementsAllowed() {
+ return headerElementsAllowed;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/IOteMessageClientView.java b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/IOteMessageClientView.java
index 6bc0fd8340..6ff815ea62 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/IOteMessageClientView.java
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/IOteMessageClientView.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * 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:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ote.ui.message.util;
-
-import org.eclipse.osee.ote.client.msg.IOteMessageService;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @author Ken J. Aguilar
- *
- */
-public interface IOteMessageClientView extends IViewPart {
- void oteMessageServiceAcquired(IOteMessageService service);
- void oteMessageServiceReleased();
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.ui.message.util;
+
+import org.eclipse.osee.ote.client.msg.IOteMessageService;
+import org.eclipse.ui.IViewPart;
+
+/**
+ * @author Ken J. Aguilar
+ *
+ */
+public interface IOteMessageClientView extends IViewPart {
+ void oteMessageServiceAcquired(IOteMessageService service);
+ void oteMessageServiceReleased();
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java
index 5db1fb61b6..aa43cad30a 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java
@@ -1,141 +1,141 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * 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:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ote.ui.message.util;
-
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.osee.ote.message.ElementPath;
-import org.eclipse.osee.ote.message.Message;
-import org.eclipse.osee.ote.message.elements.Element;
-import org.eclipse.osee.ote.message.elements.RecordElement;
-import org.eclipse.osee.ote.message.elements.RecordMap;
-import org.eclipse.osee.ote.service.IMessageDictionary;
-import org.eclipse.osee.ote.service.IOteClientService;
-import org.eclipse.osee.ote.ui.message.util.internal.Activator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * @author Ken J. Aguilar
- */
-public class MessageElementSelectionDialog extends ElementListSelectionDialog {
-
- public MessageElementSelectionDialog(Shell parent, Message<?, ?, ?> msg) {
- this(parent, msg, null);
- }
-
- public MessageElementSelectionDialog(Shell parent, String msg, ElementFilter filter) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalStateException {
- this(parent, getMessage(msg), filter);
- }
-
- public MessageElementSelectionDialog(Shell parent, Message<?, ?, ?> msg, ElementFilter filter) {
- super(parent, new LabelProvider());
- LinkedList<Element> topLevelElements = new LinkedList<Element>();
- LinkedList<Element> filterElements = new LinkedList<Element>();
- msg.getAllElements(topLevelElements);
-
- process(filter, topLevelElements, filterElements);
- setElements(filterElements.toArray());
- setMessage("Select a message element. Use * as the wild card character");
- setTitle("Message Element Selection");
- }
-
- private static Message<?, ?, ?> getMessage(String msg) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
- ServiceTracker tracker =
- new ServiceTracker(Activator.getDefault().getBundle().getBundleContext(),
- IOteClientService.class.getName(), null);
- tracker.open(true);
- try {
- IMessageDictionary dictionary = ((IOteClientService) tracker.waitForService(1000)).getLoadedDictionary();
- if (dictionary == null) {
- throw new IllegalStateException("no dictionary loaded");
- }
- return dictionary.lookupMessage(msg).newInstance();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new IllegalStateException("interrupted", e);
- } finally {
- tracker.close();
- }
- }
-
- private static final class LabelProvider implements ILabelProvider {
-
- @Override
- public Image getImage(Object element) {
- return null;
- }
-
- @Override
- public String getText(Object element) {
- Element msgElement = (Element) element;
- return new ElementPath(msgElement.getElementPath()).toString();
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
-
- };
-
- private void process(ElementFilter filter, List<Element> list, List<Element> destinationList) {
- for (Element element : list) {
- processElement(filter, element, destinationList);
- }
- }
-
- private void processElement(ElementFilter filter, Element element, List<Element> destinationList) {
- if (element instanceof RecordMap<?>) {
- processRecordMap(filter, (RecordMap<?>) element, destinationList);
- } else if (element instanceof RecordElement) {
- processRecordElement(filter, (RecordElement) element, destinationList);
- } else {
- if (filter == null || filter.accept(element)) {
- destinationList.add(element);
- }
- }
- }
-
- private void processRecordMap(ElementFilter filter, RecordMap<?> map, List<Element> destinationList) {
- for (int i = 0; i < map.length(); i++) {
- processRecordElement(filter, map.get(i), destinationList);
- }
-
- }
-
- private void processRecordElement(ElementFilter filter, RecordElement element, List<Element> destinationList) {
- if (element instanceof RecordMap<?>) {
- processRecordMap(filter, (RecordMap<?>) element, destinationList);
- } else {
- for (Element childElement : element.getElementMap().values()) {
- processElement(filter, childElement, destinationList);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.ui.message.util;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.osee.ote.message.ElementPath;
+import org.eclipse.osee.ote.message.Message;
+import org.eclipse.osee.ote.message.elements.Element;
+import org.eclipse.osee.ote.message.elements.RecordElement;
+import org.eclipse.osee.ote.message.elements.RecordMap;
+import org.eclipse.osee.ote.service.IMessageDictionary;
+import org.eclipse.osee.ote.service.IOteClientService;
+import org.eclipse.osee.ote.ui.message.util.internal.Activator;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * @author Ken J. Aguilar
+ */
+public class MessageElementSelectionDialog extends ElementListSelectionDialog {
+
+ public MessageElementSelectionDialog(Shell parent, Message<?, ?, ?> msg) {
+ this(parent, msg, null);
+ }
+
+ public MessageElementSelectionDialog(Shell parent, String msg, ElementFilter filter) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalStateException {
+ this(parent, getMessage(msg), filter);
+ }
+
+ public MessageElementSelectionDialog(Shell parent, Message<?, ?, ?> msg, ElementFilter filter) {
+ super(parent, new LabelProvider());
+ LinkedList<Element> topLevelElements = new LinkedList<Element>();
+ LinkedList<Element> filterElements = new LinkedList<Element>();
+ msg.getAllElements(topLevelElements);
+
+ process(filter, topLevelElements, filterElements);
+ setElements(filterElements.toArray());
+ setMessage("Select a message element. Use * as the wild card character");
+ setTitle("Message Element Selection");
+ }
+
+ private static Message<?, ?, ?> getMessage(String msg) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+ ServiceTracker tracker =
+ new ServiceTracker(Activator.getDefault().getBundle().getBundleContext(),
+ IOteClientService.class.getName(), null);
+ tracker.open(true);
+ try {
+ IMessageDictionary dictionary = ((IOteClientService) tracker.waitForService(1000)).getLoadedDictionary();
+ if (dictionary == null) {
+ throw new IllegalStateException("no dictionary loaded");
+ }
+ return dictionary.lookupMessage(msg).newInstance();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new IllegalStateException("interrupted", e);
+ } finally {
+ tracker.close();
+ }
+ }
+
+ private static final class LabelProvider implements ILabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ Element msgElement = (Element) element;
+ return new ElementPath(msgElement.getElementPath()).toString();
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ };
+
+ private void process(ElementFilter filter, List<Element> list, List<Element> destinationList) {
+ for (Element element : list) {
+ processElement(filter, element, destinationList);
+ }
+ }
+
+ private void processElement(ElementFilter filter, Element element, List<Element> destinationList) {
+ if (element instanceof RecordMap<?>) {
+ processRecordMap(filter, (RecordMap<?>) element, destinationList);
+ } else if (element instanceof RecordElement) {
+ processRecordElement(filter, (RecordElement) element, destinationList);
+ } else {
+ if (filter == null || filter.accept(element)) {
+ destinationList.add(element);
+ }
+ }
+ }
+
+ private void processRecordMap(ElementFilter filter, RecordMap<?> map, List<Element> destinationList) {
+ for (int i = 0; i < map.length(); i++) {
+ processRecordElement(filter, map.get(i), destinationList);
+ }
+
+ }
+
+ private void processRecordElement(ElementFilter filter, RecordElement element, List<Element> destinationList) {
+ if (element instanceof RecordMap<?>) {
+ processRecordMap(filter, (RecordMap<?>) element, destinationList);
+ } else {
+ for (Element childElement : element.getElementMap().values()) {
+ processElement(filter, childElement, destinationList);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java
index 23276b048e..f6b0cf4bd0 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * 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:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ote.ui.message.util;
-
-import java.util.ArrayList;
-import java.util.logging.Level;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.ote.service.IMessageDictionary;
-import org.eclipse.osee.ote.service.IOteClientService;
-import org.eclipse.osee.ote.service.MessageSink;
-import org.eclipse.osee.ote.ui.message.util.internal.Activator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-import org.osgi.util.tracker.ServiceTracker;
-
-
-/**
- * @author Ken J. Aguilar
- *
- */
-public class MessageSelectionDialog extends ElementListSelectionDialog {
-
-
- /**
- * @param parent
- */
- public MessageSelectionDialog(Shell parent) {
- super(parent, new ILabelProvider() {
-
- @Override
- public Image getImage(Object element) {
- return null;
- }
-
- @Override
- public String getText(Object element) {
- String msgName = (String) element;
- String packageName = msgName.substring(0, msgName
- .lastIndexOf('.'));
- String type = packageName.substring(packageName
- .lastIndexOf('.') + 1);
-
- return String.format("%s [%s]", msgName.substring(msgName
- .lastIndexOf('.') + 1), type);
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
-
- });
-
- ServiceTracker tracker =new ServiceTracker(Activator.getDefault().getBundle().getBundleContext(), IOteClientService.class.getName(), null);
- tracker.open(true);
- try {
- IMessageDictionary dictionary = ((IOteClientService)tracker.waitForService(1000)).getLoadedDictionary();
- final ArrayList<String> messages = new ArrayList<String>(4096);
- dictionary.generateMessageIndex(new MessageSink() {
-
- @Override
- public void absorbElement(String elementName) {
- }
-
- @Override
- public void absorbMessage(String messageName) {
- messages.add(messageName);
- }
-
- });
- setElements(messages.toArray());
- } catch (Exception e) {
- OseeLog.log(MessageSelectionDialog.class, Level.SEVERE,
- "failed to generate message listing", e);
- } finally {
- tracker.close();
- }
- setMessage("Select a message. Use * as the wild card character");
- setTitle("Message Selection");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.ui.message.util;
+
+import java.util.ArrayList;
+import java.util.logging.Level;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.ote.service.IMessageDictionary;
+import org.eclipse.osee.ote.service.IOteClientService;
+import org.eclipse.osee.ote.service.MessageSink;
+import org.eclipse.osee.ote.ui.message.util.internal.Activator;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.osgi.util.tracker.ServiceTracker;
+
+
+/**
+ * @author Ken J. Aguilar
+ *
+ */
+public class MessageSelectionDialog extends ElementListSelectionDialog {
+
+
+ /**
+ * @param parent
+ */
+ public MessageSelectionDialog(Shell parent) {
+ super(parent, new ILabelProvider() {
+
+ @Override
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ String msgName = (String) element;
+ String packageName = msgName.substring(0, msgName
+ .lastIndexOf('.'));
+ String type = packageName.substring(packageName
+ .lastIndexOf('.') + 1);
+
+ return String.format("%s [%s]", msgName.substring(msgName
+ .lastIndexOf('.') + 1), type);
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ });
+
+ ServiceTracker tracker =new ServiceTracker(Activator.getDefault().getBundle().getBundleContext(), IOteClientService.class.getName(), null);
+ tracker.open(true);
+ try {
+ IMessageDictionary dictionary = ((IOteClientService)tracker.waitForService(1000)).getLoadedDictionary();
+ final ArrayList<String> messages = new ArrayList<String>(4096);
+ dictionary.generateMessageIndex(new MessageSink() {
+
+ @Override
+ public void absorbElement(String elementName) {
+ }
+
+ @Override
+ public void absorbMessage(String messageName) {
+ messages.add(messageName);
+ }
+
+ });
+ setElements(messages.toArray());
+ } catch (Exception e) {
+ OseeLog.log(MessageSelectionDialog.class, Level.SEVERE,
+ "failed to generate message listing", e);
+ } finally {
+ tracker.close();
+ }
+ setMessage("Select a message. Use * as the wild card character");
+ setTitle("Message Selection");
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/internal/Activator.java b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/internal/Activator.java
index f60880598c..1713d6e3aa 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/internal/Activator.java
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/internal/Activator.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * 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:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ote.ui.message.util.internal;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- * @author Ken J. Aguilar
- */
-public class Activator extends AbstractUIPlugin {
- public static final String PLUGIN_ID = "org.eclipse.osee.ote.ui.message.util";
- private static Activator plugin;
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.ui.message.util.internal;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * @author Ken J. Aguilar
+ */
+public class Activator extends AbstractUIPlugin {
+ public static final String PLUGIN_ID = "org.eclipse.osee.ote.ui.message.util";
+ private static Activator plugin;
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
} \ No newline at end of file

Back to the top