Model Refactoring in Visual Paradigm Desktop

 

Model Refactoring in Visual Paradigm Desktop allows you to move diagrams and model elements between projects that have an established project-reference relationship. It helps you reorganize project structures, extract reusable model components into shared library projects, and consolidate common definitions so that multiple projects can work with the same modeling resources.

What Is Model Refactoring?

Model Refactoring is a project management and model organization capability in Visual Paradigm Desktop. It enables you to transfer diagrams and model elements from one project to another when the projects are connected through project referencing.

In Visual Paradigm, a project can reference another project and access its model elements without having to recreate them. Model Refactoring takes this concept further by allowing you to move existing modeling resources between projects. This is particularly useful when you identify common elements in separate projects and want to extract them into a shared project, such as a model library.

For example, imagine that you are developing two separate projects: a vehicle maintenance system for car washing and another system for car repair. Both projects may require common model elements such as Car, Manufacturer, Vehicle, and Customer.

Instead of maintaining separate definitions of these elements in both projects, you can use Model Refactoring to move the common elements into a shared library project. Both projects can then reference the library and reuse the same model definitions.

Model Refactoring also works in the opposite direction. If an element in a shared library turns out to be specific to one project, you can move it back into that project.

In short, Model Refactoring helps transform independently maintained project content into a more organized, reusable, and consistent modeling structure.

Why Is Model Refactoring Important?

As modeling projects grow, it is common to discover overlapping requirements, duplicated model definitions, and components that could be shared across different projects. Without an effective way to reorganize these resources, maintaining multiple projects can become increasingly difficult.

Model Refactoring addresses these challenges by allowing you to restructure existing project content without having to recreate the diagrams and model elements from scratch.

Eliminate Duplicated Model Definitions

When different projects define the same business entities, classes, processes, or other model elements independently, inconsistencies can emerge over time. For example, two projects may contain separate definitions of the same Customer class. A change made to one definition may not be reflected in the other.

By refactoring common elements into a shared project, you can establish a single source of truth for those definitions. Referencing projects can then reuse the shared elements instead of maintaining independent copies.

Improve Project Organization

Not every model element belongs in the project where it was originally created. As requirements evolve, you may discover that some elements represent common concepts suitable for a shared model library.

Model Refactoring allows you to extract these elements into a dedicated project, separating reusable modeling resources from project-specific content.

Increase Model Consistency

Maintaining one shared definition of a common model element reduces the risk of different projects developing conflicting representations of the same concept. When projects reference the same model element, they can work with a common definition rather than relying on manually synchronized copies.

Reuse Existing Modeling Work

Creating a reusable model library does not have to mean starting over. You can identify useful components in existing projects and refactor them into a referenced project. This allows you to build reusable modeling resources from work that has already been completed.

Adapt to Changing Project Boundaries

Project structures are not necessarily permanent. An element that was initially considered a shared resource may later turn out to be specific to one project. Because Model Refactoring supports moving elements in both directions, you can reorganize your project structure as your understanding of the system evolves.

Key Capabilities of Model Refactoring

Model Refactoring provides several operations for reorganizing project content. You can move individual model elements, transfer entire diagrams, and bring resources from a referenced project back into your current project.

Refactor Model Elements to a Referenced Project

You can select model elements in your current project and transfer them to a referenced project. This is useful when extracting common components from an existing project to establish a reusable model library.

For example, a UML class diagram project may contain classes such as Customer, Address, Product, and Order. If Customer and Address are also needed by other projects, you can refactor these classes into a shared library project.

After refactoring, the current project can continue using the elements through its project reference. Other projects referencing the same library can also reuse them.

Visual Paradigm provides a dedicated Refactor to Referenced Project command in the Model Explorer context menu for this operation.

Refactor Diagrams to a Referenced Project

In addition to individual model elements, you can refactor an entire diagram to a referenced project.

Refactoring a diagram transfers both the diagram itself and the model elements represented on it. This is useful when a complete diagram represents a reusable model area that should be maintained in a shared project.

For example, if a project contains a common organizational structure represented in an Organization Chart, you can move the diagram and its associated model content into a shared project for other projects to reference.

To initiate this operation, right-click the diagram and select Utilities > Refactor to Referenced Project….

Refactor Model Elements from a Referenced Project

Model Refactoring also supports moving model elements from a referenced project into the current project.

This is useful when an element that was previously managed as a shared resource is no longer appropriate for the shared library. For example, a class initially included in a common library may eventually be identified as specific to one application.

You can select the referenced project in the Model Explorer, locate the required element, and use the Refactor to Current Project command to bring it into the current project.

Refactor Diagrams from a Referenced Project

You can also bring an entire diagram from a referenced project into your current project.

This operation transfers the diagram together with the shapes on it, allowing you to incorporate an existing diagram into your project without manually recreating its contents.

You can locate the diagram in the Model Explorer or Diagram Navigator, right-click it, and select Refactor to Current Project….

Intelligent Handling of Related Model Elements

A model element rarely exists in isolation. It may have relationships with other elements, serve as the type of an attribute, or contain its own members. Moving only the selected element without considering these dependencies could leave the model incomplete or inconsistent.

Visual Paradigm Model Refactoring takes related model elements into consideration when determining what needs to be transferred.

Identify Connected Elements

When you refactor a model element, Visual Paradigm can identify connectors associated with the selected elements. For example, if two classes are connected by an association and you refactor one of them, the related connector may also need to be included in the refactoring operation.

This helps preserve the relationships represented in your model.

Include Dependent Model Elements

Related elements may also include model elements that depend on the selected element.

For example, consider a class named Vehicle that is used as the type of an attribute in another class. If you refactor Vehicle, Visual Paradigm can identify the dependent class and include it in the list of related elements to be considered.

Handle Member Elements

Model elements may contain their own members. For example, a UML class contains attributes and operations, while an entity in an ER diagram contains columns.

When refactoring a class, its attributes and operations are considered as part of the refactoring. Similarly, refactoring an entity can involve its columns.

Recursively Analyze Model Dependencies

Visual Paradigm does not limit dependency checking to the elements directly connected to the original selection. The search for relevant project data is performed recursively.

Whenever a related element is identified, Visual Paradigm performs the same dependency checking on that element. This continues until the relevant elements have been examined.

This recursive analysis helps identify a more complete set of model resources that may need to move together, reducing the risk of overlooking dependencies during project restructuring.

Review Related Diagrams Before Refactoring

A model element may appear in multiple diagrams. When refactoring an element that has a master view in another diagram, Visual Paradigm checks whether the related diagrams should also be included in the operation.

If the Include Related Diagrams window appears, you can decide how to proceed.

Include Related Diagrams

You can choose to include the listed diagrams in the refactoring operation. This moves the diagrams along with the selected model elements to the referenced project.

This option is useful when the related diagrams belong logically to the shared model content you are extracting. However, because the operation cannot be undone, review the listed diagrams carefully before proceeding.

Remove Master Views Instead

If you want to keep the related diagrams in the current project, you can stop the refactoring operation and remove the relevant master views first.

Open the affected diagrams and delete the views of the selected model elements. Make sure you delete the diagram views rather than the underlying model elements. Once the master views have been removed, you can perform the refactoring again.

Preview Refactoring Changes Before Proceeding

When moving model elements or diagrams from a referenced project into the current project, Visual Paradigm provides an option to preview the changes before executing the operation.

The preview presents the items involved in the refactoring and the actions that will be performed. It helps you understand the scope of the operation, particularly when the selected elements have multiple dependencies.

After reviewing the proposed changes, you can choose to continue with the refactoring or cancel the operation. You can also choose to proceed without opening the preview.

This is especially valuable when working with large shared model libraries or projects containing complex relationships.

How to Use Model Refactoring in Visual Paradigm

Model Refactoring is performed through the Model Explorer and Diagram Navigator. Before starting, make sure that the source and destination projects have the required project-reference relationship.

Prerequisite: Establish a Project Reference

Model Refactoring only works between projects that have a reference relationship. If the destination library project does not yet exist or has not been referenced by the current project, prepare the referenced project first.

You can learn more about establishing and maintaining project references in the Maintaining Project Reference guide.

Move Model Elements to a Referenced Project

  1. Open the project containing the model elements you want to move.
  2. Open the Model Explorer. If it is not visible, go to View > Panes > Model Explorer.
  3. Locate and select the model elements you want to refactor.
  4. Right-click the selected elements and choose Refactor to Referenced Project….
  5. Save the project when prompted. If you decline to save, the refactoring operation will stop.
  6. If the Include Related Diagrams window appears, decide whether to include the listed diagrams or stop and remove their master views.
  7. Review the related model elements identified by Visual Paradigm. Select the elements you want to include and click Continue.
  8. Once the refactoring is completed, the project will reopen. You can access the transferred elements through the referenced project in the Model Explorer.

Move a Diagram to a Referenced Project

  1. Open the project containing the diagram.
  2. Locate the diagram you want to move.
  3. Right-click the diagram and select Utilities > Refactor to Referenced Project….
  4. Save the project when prompted.
  5. Review any related diagrams and model elements identified during the operation.
  6. Confirm the operation to complete the refactoring.
  7. After the project reopens, the diagram and its associated model elements are available through the referenced project.

Move Model Elements from a Referenced Project

  1. Open the current project.
  2. Open the Model Explorer.
  3. Use the project selection dropdown at the top of the Model Explorer to select the referenced project containing the elements you need.
  4. Select the model elements you want to move into the current project.
  5. Right-click and select Refactor to Current Project….
  6. Read the confirmation message and check the prerequisites before continuing.
  7. Choose whether to preview the proposed changes. Review the identified elements and actions.
  8. Click Continue to complete the operation. Once the project reopens, the transferred elements are available in the current project.

Move a Diagram from a Referenced Project

  1. Open the Model Explorer or Diagram Navigator.
  2. Select the referenced project from the Model Explorer dropdown if necessary.
  3. Locate the diagram you want to transfer.
  4. Right-click the diagram and select Refactor to Current Project….
  5. Review the confirmation message and choose whether to preview the proposed changes.
  6. Review the identified related elements and confirm the operation.
  7. After completion, the diagram is available in the current project, with its shapes referencing the appropriate model elements.

Practical Use Cases for Model Refactoring

Model Refactoring is particularly useful in situations where modeling resources need to be shared, consolidated, or reorganized across multiple projects.

Creating a Shared Model Library

An organization may maintain several independent application projects, each requiring common business entities such as Customer, Employee, Department, Product, and Address.

Rather than defining these elements repeatedly, the organization can create a shared model library and refactor the common elements from existing projects into it. Each application project can then reference the library and reuse the shared definitions.

Consolidating Common Business Process Models

Different business units may maintain separate process modeling projects. Some processes, such as employee onboarding, procurement, or approval workflows, may be common across these projects.

Model Refactoring allows suitable diagrams and model elements to be transferred into a shared project, making common process models easier to reuse and maintain.

Building Reusable UML Model Components

Software architects may create common UML components such as authentication services, user management classes, or shared domain entities that are needed by multiple systems.

These components can be extracted into a referenced project so that other UML projects can reuse the same model definitions.

Separating Reusable and Project-Specific Models

During early modeling, it is not always clear which elements will become shared resources. As a project develops, some elements may be identified as common components while others remain specific to the original project.

Model Refactoring makes it possible to reorganize these elements as their roles become clearer. Common elements can be extracted into a library, while project-specific elements can remain in or be moved back to their respective projects.

Reorganizing an Existing Modeling Environment

A mature modeling environment may contain years of accumulated diagrams and model elements. Some resources may have originally been created in the wrong project or may have become common to several projects over time.

Model Refactoring provides a way to reorganize these existing resources into a more logical project structure without recreating them manually.

Important Considerations Before Refactoring

Model Refactoring changes how project data is organized and referenced. Before performing the operation, it is important to understand several considerations.

Refactoring Cannot Be Undone

Model Refactoring is a structural project operation and cannot be undone through the normal Undo command. Projects are saved before the operation proceeds.

It is therefore recommended that you review the selected elements, related diagrams, and proposed changes carefully before confirming the operation.

Related Project Files Must Be Available

When moving model elements from a referenced project into the current project, Visual Paradigm needs to examine related project files to identify potential dependencies and update project references where necessary.

The related project files must be located within the workspace folder or one of its subdirectories. Visual Paradigm scans the projects available in this workspace when analyzing the potential impact of the operation.

Teamwork Projects Require Additional Preparation

If you are working with a team using VPository, Teamwork Server, or another repository type, make sure that all related projects are checked out before performing the refactoring.

Visual Paradigm cannot detect related project files that exist only on the server. Having the relevant projects checked out helps ensure that the necessary project updates can be performed locally.

Review Related Diagrams Carefully

A selected model element may have master views in other diagrams. Decide whether those diagrams should move with the element or remain in the original project.

If you want to retain the diagrams in the original project, remove the relevant master views before attempting the refactoring again. Be careful to remove diagram views rather than the underlying model elements.

Model Refactoring vs. Duplicating Model Elements

Visual Paradigm also allows you to duplicate model elements from a referenced project. Although both capabilities support model reuse, they serve different purposes.

Aspect Model Refactoring Duplicating Model Elements
Primary purpose Move existing modeling resources between projects. Create a copy of an element from a referenced project.
Ownership Transfers the element to the destination project. Creates a separate element in the current project.
Typical use Extracting common elements into a shared library or reorganizing project content. Using an existing element as the starting point for an independent model definition.
Relationship to original The element is moved rather than retained as two independent definitions. The duplicated element is a separate copy.

Choose Model Refactoring when you want to change where existing model resources are maintained. Choose duplication when you need an independent copy that can be developed separately.

Model Refactoring in Visual Paradigm Desktop: Availability

Model Refactoring is part of the Project Referencing capabilities in Visual Paradigm Desktop.

Available editions: Standard Edition, Professional Edition, and Enterprise Edition.

Project Referencing is not included in the Community or Modeler editions.

For the latest feature and edition information, see the Visual Paradigm Desktop Editions Comparison.

Frequently Asked Questions About Model Refactoring

What does Model Refactoring do in Visual Paradigm?

Model Refactoring moves diagrams and model elements between projects that have a project-reference relationship. It helps reorganize project content, extract reusable model components, and maintain common model definitions in shared library projects.

Can I refactor individual model elements instead of entire diagrams?

Yes. Visual Paradigm supports refactoring individual model elements through the Model Explorer. You can select the elements you want to move without having to transfer an entire diagram.

Can I refactor an entire diagram?

Yes. You can refactor a diagram to a referenced project or bring a diagram from a referenced project into the current project. The operation includes the diagram and the model elements represented on it.

Can I move model elements from a referenced project back to my current project?

Yes. Select the referenced project in the Model Explorer, right-click the model element, and choose Refactor to Current Project. This allows you to move previously shared elements back into a project that needs to manage them independently.

Does Model Refactoring automatically identify related model elements?

Yes. Visual Paradigm examines related model elements, including connectors, dependent elements, and member elements. The dependency analysis is performed recursively to identify relevant elements that may also need to be transferred.

Can I preview the changes before refactoring?

Yes. When refactoring elements or diagrams from a referenced project into the current project, you can choose to preview the proposed changes. The preview lists the elements involved and the actions that will be performed.

Can Model Refactoring be undone?

No. Model Refactoring cannot be undone through the normal Undo command. Review the proposed changes carefully and prepare appropriate project backups before proceeding.

Do I need a referenced project to use Model Refactoring?

Yes. Model Refactoring only works between projects that have an established project-reference relationship. Set up the required reference before attempting to transfer modeling resources.

Is Model Refactoring the same as code refactoring?

No. Model Refactoring in Visual Paradigm is concerned with moving diagrams and model elements between referenced project files. It is a model organization and project restructuring capability, rather than a source-code refactoring operation such as renaming methods, extracting functions, or changing code structure.

Organize and Reuse Your Models with Visual Paradigm

Effective model management involves more than creating diagrams. As projects grow and modeling resources become shared across different systems, having a structured way to organize and reuse model content becomes increasingly important.

With Model Refactoring, Visual Paradigm Desktop helps you extract reusable model elements, transfer diagrams between referenced projects, manage related dependencies, and reorganize existing modeling resources.

Whether you are building a shared model library, consolidating common business models, or restructuring an established modeling environment, Model Refactoring provides a practical way to keep your projects organized and your model definitions consistent.

Explore Visual Paradigm Desktop to discover a comprehensive modeling environment for software design, business process modeling, enterprise architecture, and more.

Scroll to Top