Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:49:00+00:00 2026-05-27T06:49:00+00:00

I am developing an application [desktop swing application] which requires me to do refactoring

  • 0

I am developing an application [desktop swing application] which requires me to do refactoring via code. [I know the interface and feature is already provided by the eclipse IDE but I am required to do this via code

the first phase of refactoring that i require to do is move selected package [the option to select is given via checkboxes that displays all the available packages in the workspace using the idea of JDT. I used tutorial at this location: http://www.vogella.de/articles/EclipseJDT/article.html ]

Now that I have selected the packages that I wish to move to another package,

I used this piece of code

233.   for (IPackageFragment mypackage : packages) {
234.                    if ((mypackage.getKind() == IPackageFragmentRoot.K_SOURCE) && (searchifSelected(mypackage.getElementName())==true) ){
235.                        IJavaElement container = newModule.getPrimaryElement();
236.                        mypackage.move(container, null, null, true, null);
                }
     }

searchifSelected(mypackage.getElementName())==true tells me if I have selected this particular package to be moved

IJavaElement container = newModule.getPrimaryElement(); is the container [new package] that will contain the selected packages

mypackage.move(container, null, null, true, null); as far as I read it, this command is supposed to move “mypackage” to “container” as a “child”.

however, I am facing this problem:

 Java Model Exception: Java Model Status [Invalid destination: 'devFromSupplier [in src [in test]]']
at org.eclipse.jdt.internal.core.MultiOperation.processElements(MultiOperation.java:175)
at org.eclipse.jdt.internal.core.CopyResourceElementsOperation.processElements(CopyResourceElementsOperation.java:417)
at org.eclipse.jdt.internal.core.MultiOperation.executeOperation(MultiOperation.java:90)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:793)
at org.eclipse.jdt.internal.core.JavaModel.runOperation(JavaModel.java:297)
at org.eclipse.jdt.internal.core.JavaModel.move(JavaModel.java:258)
at org.eclipse.jdt.internal.core.PackageFragment.move(PackageFragment.java:420)
at newmodulewizrd.ui.Integrate.printPackageInfos(Integrate.java:236)
at newmodulewizrd.ui.Integrate.printProjectInfo(Integrate.java:177)
at newmodulewizrd.ui.Integrate.getWorkSpace(Integrate.java:149)
at newmodulewizrd.ui.Integrate.moveToOneModule(Integrate.java:120)
at newmodulewizrd.ui.Integrate$1.actionPerformed(Integrate.java:79)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

which I think means that I am giving the wrong arguments.

can somebody help what should I do about it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:49:01+00:00Added an answer on May 27, 2026 at 6:49 am

    For those who r facing the same problem, i found another way to do it, i.e use rename method and make it work as move function. although, it might/might not be the best option.

    i replace above code with this code

         for (IPackageFragment mypackage : packages) {
                    if ((mypackage.getKind() == IPackageFragmentRoot.K_SOURCE) && (searchifSelected(mypackage.getElementName())==true) ){
                        mypackage.rename(textfield.getText()+"."+mypackage.getElementName(), true, null);
                    }
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are developing a desktop application using Java Swing that requires to show width
I'm developing a console Java application(Not swing) using java.awt.Desktop class, which will launch the
Developing a desktop application based on Java + Swing I faced the problem of
I am developing a Java desktop application and I use Swing to build the
I am developing a Java Desktop Application with GUI implemented in SWING. I hava
I am developing a desktop Java application with GUI implemented through Swing . I
I am developing a Desktop application which we install on client machines but it
I am relatively new to C#/.Net. I'm developing a desktop application that requires multi
I'm developing a Desktop Application in java(jdk 1.6) with swing but having a problem
I've been developing a remote desktop application which runs as a Windows service, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.