[572753] fixed virtual dns loading and interaction with breadcrumb
The virtual dns viewer was not able to handle selections in the new
breadcrumb based editors.
Furthermore, because of a wrong import the tag providers where not
correctly loaded on startup.
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=572753
Change-Id: Ibfae32e7b2cc891b3f068f88fc085d84f881cba8
diff --git a/plugins/org.eclipse.fordiac.ide.systemconfiguration/src/org/eclipse/fordiac/ide/systemconfiguration/views/VirtualDNSViewer.java b/plugins/org.eclipse.fordiac.ide.systemconfiguration/src/org/eclipse/fordiac/ide/systemconfiguration/views/VirtualDNSViewer.java
index 7adb285..a657c8e 100644
--- a/plugins/org.eclipse.fordiac.ide.systemconfiguration/src/org/eclipse/fordiac/ide/systemconfiguration/views/VirtualDNSViewer.java
+++ b/plugins/org.eclipse.fordiac.ide.systemconfiguration/src/org/eclipse/fordiac/ide/systemconfiguration/views/VirtualDNSViewer.java
@@ -17,6 +17,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.fordiac.ide.application.editors.FBNetworkEditor;
import org.eclipse.fordiac.ide.gef.dnd.ParameterValueTemplateTransfer;
import org.eclipse.fordiac.ide.model.libraryElement.Application;
@@ -364,21 +365,15 @@
private void updateContents() {
if (null != system) {
-
setPartName(viewName + ": " + system.getName()); //$NON-NLS-1$
- try {
- provider = SystemManager.INSTANCE.getTagProvider(Class.forName(VirtualDNSTagProvider.class.getName()),
- system);
- if (provider != null) {
- final Object object = provider.getModelObject();
- if (object instanceof VirtualDNSManagement) {
- management = (VirtualDNSManagement) object;
- newConfiguration.setEnabled(true);
- availableDNS.setEnabled(true);
- }
+ provider = SystemManager.INSTANCE.getTagProvider(VirtualDNSTagProvider.class, system);
+ if (provider != null) {
+ final Object object = provider.getModelObject();
+ if (object instanceof VirtualDNSManagement) {
+ management = (VirtualDNSManagement) object;
+ newConfiguration.setEnabled(true);
+ availableDNS.setEnabled(true);
}
- } catch (final ClassNotFoundException e) {
- // ignore, just do not visualize anything
}
} else {
setPartName(viewName);
@@ -399,19 +394,22 @@
public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
if ((null != sectionClient) && (!sectionClient.isDisposed())) {
- AutomationSystem newSystem = null;
- if (part instanceof SystemConfigurationEditor) {
- newSystem = ((SystemConfigurationEditor) part).getSystem();
- } else if (part instanceof FBNetworkEditor) {
- newSystem = ((FBNetworkEditor) part).getSystem();
- } else if (part instanceof ResourceDiagramEditor) {
- newSystem = ((ResourceDiagramEditor) part).getSystem();
- } else if (part instanceof CommonNavigator) {
- if (selection instanceof TreeSelection) {
- newSystem = handleSystemTreeSelection((TreeSelection) selection);
+ AutomationSystem newSystem = part.getAdapter(AutomationSystem.class);
+
+ if (null == newSystem) {
+ if (part instanceof SystemConfigurationEditor) {
+ newSystem = ((SystemConfigurationEditor) part).getSystem();
+ } else if (part instanceof FBNetworkEditor) {
+ newSystem = ((FBNetworkEditor) part).getSystem();
+ } else if (part instanceof ResourceDiagramEditor) {
+ newSystem = ((ResourceDiagramEditor) part).getSystem();
+ } else if (part instanceof CommonNavigator) {
+ if (selection instanceof TreeSelection) {
+ newSystem = handleSystemTreeSelection((TreeSelection) selection);
+ }
+ } else {
+ // TODO add type navigator
}
- } else {
- // TODO add type navigator
}
if (null != newSystem && system != newSystem) { // if no system is selected (normally when changing to
@@ -428,7 +426,9 @@
AutomationSystem retval = null;
if (1 == selection.size()) {
final Object obj = selection.getFirstElement();
- if (obj instanceof AutomationSystem) {
+ if ((obj instanceof IFile) && (SystemManager.isSystemFile(obj))) {
+ SystemManager.INSTANCE.getSystem((IFile) obj);
+ } else if (obj instanceof AutomationSystem) {
retval = (AutomationSystem) obj;
} else if (obj instanceof SystemConfiguration) {
retval = ((SystemConfiguration) obj).getAutomationSystem();
diff --git a/plugins/org.eclipse.fordiac.ide.systemmanagement.ui/src/org/eclipse/fordiac/ide/systemmanagement/ui/editors/AutomationSystemEditor.java b/plugins/org.eclipse.fordiac.ide.systemmanagement.ui/src/org/eclipse/fordiac/ide/systemmanagement/ui/editors/AutomationSystemEditor.java
index 8c648c3..6520049 100644
--- a/plugins/org.eclipse.fordiac.ide.systemmanagement.ui/src/org/eclipse/fordiac/ide/systemmanagement/ui/editors/AutomationSystemEditor.java
+++ b/plugins/org.eclipse.fordiac.ide.systemmanagement.ui/src/org/eclipse/fordiac/ide/systemmanagement/ui/editors/AutomationSystemEditor.java
@@ -290,6 +290,9 @@
}
return adapter.cast(outlinePage);
}
+ if (adapter == AutomationSystem.class) {
+ return adapter.cast(system);
+ }
return super.getAdapter(adapter);
}
diff --git a/plugins/org.eclipse.fordiac.ide.systemmanagement/src/org/eclipse/fordiac/ide/systemmanagement/SystemManager.java b/plugins/org.eclipse.fordiac.ide.systemmanagement/src/org/eclipse/fordiac/ide/systemmanagement/SystemManager.java
index c431ec3..535504c 100644
--- a/plugins/org.eclipse.fordiac.ide.systemmanagement/src/org/eclipse/fordiac/ide/systemmanagement/SystemManager.java
+++ b/plugins/org.eclipse.fordiac.ide.systemmanagement/src/org/eclipse/fordiac/ide/systemmanagement/SystemManager.java
@@ -38,7 +38,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.fordiac.ide.model.Activator;
import org.eclipse.fordiac.ide.model.dataexport.SystemExporter;
import org.eclipse.fordiac.ide.model.dataimport.SystemImporter;
import org.eclipse.fordiac.ide.model.libraryElement.AutomationSystem;