Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Problem with implementation the swt directorydialog as a plugin
Problem with implementation the swt directorydialog as a plugin [message #30890] Mon, 03 November 2008 23:00
Artur Zeiler is currently offline Artur ZeilerFriend
Messages: 10
Registered: July 2009
Junior Member
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
Previous Topic:Plug in with cyclic dependencies?
Next Topic:Problem with implementation the swt directorydialog as a plugin
Goto Forum:
  


Current Time: Wed Jul 28 21:27:03 GMT 2021

Powered by FUDForum. Page generated in 0.01441 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top