osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
39 stars 8 forks source link

Unnecessary Plug-in Dependencies #1376

Closed joeseibel closed 5 years ago

joeseibel commented 6 years ago

We should remove all unnecessary plug-in dependencies.

lwrage commented 6 years ago

Leave this open. There are likely more dependencies that can be removed.

lwrage commented 5 years ago

Found that org.osate.workspace depends on UI plugins. When building/running standalone this pulls in unnecessary UI plugins. Either remove dependency or put contributed AADL into another plugin.

AaronGreenhouse commented 5 years ago

Looking at IAadlProject interface and its implementation AadlProject. The interface is used within the plug-in, but not really anywhere else. OsateCorePlugin.create() returns an IAadlProject, but nothing ever calls it. Nothing calls the methods in IAadlWorkpace that return IAadlProject.

The only thing outside the plug-in that uses IAadlWorkspace is OsateCorePlugin.create() but nothing ever calls it.

AaronGreenhouse commented 5 years ago

Nothing outside the plug-in uses IAadlElement.

AaronGreenhouse commented 5 years ago

Interface IOpenable isn't even implemented.

AaronGreenhouse commented 5 years ago

Interface IParent is only extended by IAadlWorkspace which we've already seen is useless.

AaronGreenhouse commented 5 years ago

Exception AadlModelException is only used by IAadlElement and friends.

AaronGreenhouse commented 5 years ago

I'm going to get rid of the above classes/interfaces.

AaronGreenhouse commented 5 years ago

Also got rid of OsateCorePlugin.create()

AaronGreenhouse commented 5 years ago

Utility class ForAllIFile is completely unused. Going to delete.

AaronGreenhouse commented 5 years ago

PreferenceInitializer is referenced in the plugin.xml file. It is used to set the default values for the workspace preference values. This probably should not be in the "internal" package org.osate.internal.workspace.

AaronGreenhouse commented 5 years ago

Classes CharOperation and CoreUtility are unused. Removing.

AaronGreenhouse commented 5 years ago

IResourceUtility is only used by ReinstantiateAadl.getCurrentSelection(). It uses the method isInstanceFile. This should be changed to have a local test method, or test in more simplified manner. The isInstanceFile method seems heavy-weight.

AaronGreenhouse commented 5 years ago

The plug-in contains a copy of antlr.jar that is reexports.

This is relied upon by org.osate.annexsupport and org.osate.xtext.aadl2.

Not sure if this is a good or bad thing?

AaronGreenhouse commented 5 years ago

The plug-in contains the standard predeclared property sets as contributed resource extensions. These are okay.

AaronGreenhouse commented 5 years ago

The plug-in depends on org.eclipse.ui because of workbench preferences. The getPreferenceStore() method comes from AbstractUIPlugin. The preference store classes seem to be part of the ui plug-ins.

AaronGreenhouse commented 5 years ago

The dependency org.eclipse.emf.common doesn't seem to be necessary (at least after removing all the dead classes).

AaronGreenhouse commented 5 years ago

org.eclipse.core.runtime and org.eclipse.core.resources are needed for IResourceUtility. Can be removed when this class is dealt with.

AaronGreenhouse commented 5 years ago

At this point this package is left with

As stated above, IResourceUtility is only used by ReinstantiateAadl.getCurrentSelection(). It uses the method isInstanceFile. What is the right way to test if a file is an instance file? I searched the rest of the workspace, and everything else is just testing the file extension. We should update ReinstantiateAadl and get rid of IResourceUtility which then means we can get rid of the dependencies on org.eclipse.core.runtime and org.eclipse.core.resources.

The bigger problem is the workbench preferences which unfortunately are tied to the UI. Clearly these should be separate from the contributed resources.

Do we really need to be carrying around antlr.jar?

AaronGreenhouse commented 5 years ago

WorkspacePlugin shows signs of old conventions that are still left around.

AaronGreenhouse commented 5 years ago

IResourceUtilty declares names for resource properties that seem like they should be useful, but no one uses them anywhere:

    public static final QualifiedName ResourceWithSyntaxErrors = new QualifiedName("org.osate.ResourceWithSyntaxErrors",
            "BadAadlFile");
    public static final QualifiedName ResourceDerived = new QualifiedName("org.osate.ResourceDerived",
            "IResourceDerived");
    public static final QualifiedName IsInstanceModel = new QualifiedName("org.osate.IsInstanceModel",
            "IsInstanceModel");
AaronGreenhouse commented 5 years ago

As I said before, the only actual use of anything in IResourceUtility outside of itself is in the ReinstantiateAadl action handler. This can be changed to just test the file extension against WorkspacePlugin.INSTANCE_FILE_EXT which is what things in the graphics editor and a few others places do.

I'm interested in getting comments on the two above issues (multiple naming conventions and resource properties) before I fully make this change and remove the class IResourceUtility.

AaronGreenhouse commented 5 years ago

Looking WorkspacePlugin

AaronGreenhouse commented 5 years ago

We should separate the workbench preference stuff from the contributed resources. Ideally I would keep the contributed resources in org.osate.workbench and move the workbench preferences to an existing plug-in. The plug-in org.osate.ui is the obvious choice, but most of the workbench preferences references come from org.osate.xtext.aadl2.ui and I don't know if it is okay for that plug-in to depend on org.osate.ui.

AaronGreenhouse commented 5 years ago

Marking CharOperation, CoreUtility, and ForAllIFile as @Deprecated

AaronGreenhouse commented 5 years ago

Copied IResourceUtility.isInsanceFile() to org.osate.ui.handlers.ReinstantiateAadl to remove it's one use. .

AaronGreenhouse commented 5 years ago

Marked AADL_PROPERTIES_FILES, AADL_PROJECT_FILE, AADL_PACKAGES_DIR, and PROPERTY_SETS_DIR as @deprecated. (In WorkspacePlugin)

AaronGreenhouse commented 5 years ago

Going to move all the workbench preferences stuff to org.osate.core. Everything that uses the preferences already depends on this project.

AaronGreenhouse commented 5 years ago

Removed dependency on org.eclipse.ui. Had to fiddle with a method in CoreUtility to make this work.

AaronGreenhouse commented 5 years ago

Also moving antlr.jar to org.osate.core. Everything that needs it already depends on org.osate.core.

AaronGreenhouse commented 5 years ago

Removing dependencies on org.osate.workspace from

AaronGreenhouse commented 5 years ago

Actually left the dependencies of org.osate.ocarina alone because that is in a different repository.