Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-dev] Problem with implementation the swt directorydialog as a plugin

This sort of question should be posted/asked on newsgroups. However, 
looking at your plug-in XML, your action references the 
"upload.SampleAction" class (i.e. class attribute). I think it should 
reference the "DirectoryDialogWindow" class instead.

Darin 



Artur Zeiler <artur.zeiler@xxxxxx> 
Sent by: pde-dev-bounces@xxxxxxxxxxx
11/03/2008 04:28 PM
Please respond to
"Eclipse PDE general developers list." <pde-dev@xxxxxxxxxxx>


To
pde-dev@xxxxxxxxxxx
cc

Subject
[pde-dev] Problem with implementation the swt directorydialog as a plugin






Hi all,

i'm trying to develop an DirectoryDialog plugin, where i can push the 
button and then the DirectoryDialog window opens, to select a directory.
This works fine, without using the PDE, but when i try to implement this 
as a plugin and i push the button to start the plugin, nothing happens and
i even don't get an error message.
I tried evertyhing possible and searched the web for a solution, without 
success.
Maybe i forgot to add a library in the dependency?
I hope someone can help me.

Here is my code for the class which implements 
IWorkbenchWindowActionDelegate :

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;

public class DirectoryDialogWindow implements 
IWorkbenchWindowActionDelegate
{
 
    private IWorkbenchWindow window;
 
    @Override
    public void dispose()
    {
        // TODO Auto-generated method stub

    }

    @Override
    public void init(IWorkbenchWindow window)
    {
        this.window = window;
 
    }
 
    @Override
    public void run(IAction action)
    {
        SelectDirectory.dirUpload();
    }

    @Override
    public void selectionChanged(IAction action, ISelection selection)
    {
        // TODO Auto-generated method stub

    }

}


And here's the code which opens the DirectoryDialog:(works fine, without 
using this class as a plugin)

import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class SelectDirectory {

  public static void dirUpload()
  {
    Display display = new Display();
    final Shell shell = new Shell(display);

    DirectoryDialog dlg = new DirectoryDialog(shell);

    dlg.setText("Upload Data to Solr");

    dlg.setMessage("Select a directory");

    String dir = dlg.open();
 
    if (dir != null) {
      System.out.println( dir);
    }

    while (!shell.isDisposed())
    {
      if (!display.readAndDispatch())
      {
        display.sleep();
      }
    }
 
    display.dispose();
 
  }

My Manifest.MF:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Upload Plug-in
Bundle-SymbolicName: solr.upload;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: upload.Activator
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 org.eclipse.swt;bundle-version="3.4.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

And my plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
   <extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            id="solr.upload.actionSet"
            label="Solr Upload ActionSet"
            visible="true">
         <menu
               id="solr.upload.menue"
               label="Solr"
               path="additions">
         </menu>
         <action
               accelerator="Ctrl+6"
               class="upload.SampleAction"
               id="helloWorld.action1"
               label="Upload Data"
               menubarPath="solr.upload.menue/group1"
               style="push"
               tooltip="Upload Data">
         </action> 
      </actionSet>
   </extension>
 
   <extension point="org.eclipse.ui.perspectiveExtensions">
    <perspectiveExtension
        targetID="org.eclipse.ui.resourcePerspective">
      <actionSet
          id="solr.upload.actionSet">
      </actionSet>
    </perspectiveExtension>
    </extension>
 
</plugin>

I would very thankful when someone could help me.

Regards

_______________________________________________
pde-dev mailing list
pde-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pde-dev




Back to the top