- This topic has 1 reply, 2 voices, and was last updated 19 years, 2 months ago by Riyad Kalla.
-
AuthorPosts
-
mithunkMemberHi all,
I am very new to plug-in development in Eclipse. I want to write a plug-in that displays a list of projects in StarTeam (Borland’s version control tool). This I am tryong out as a simple hands on experience. I am using “Hello World” template and modified its content. Below is my SampleAction.java.
package com.canarys.ExtractSTProjects.actions;import java.util.ArrayList;
import java.util.Arrays;
import java.util.Arrays;import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
//import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.*;
import org.eclipse.jface.window.*;
import com.starbase.starteam.*;import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;/**
* Our sample action implements workbench action delegate.
* The action proxy will be created by the workbench and
* shown in the UI. When the user tries to use the action,
* this delegate will be created and execution will be
* delegated to it.
* @see IWorkbenchWindowActionDelegate
*/
public class SampleAction extends ApplicationWindow implements IWorkbenchWindowActionDelegate {
private IWorkbenchWindow window;
/**
* The constructor.
*/
public SampleAction() {
super(null);
}protected org.eclipse.swt.widgets.Control createContents (Composite parent)
{
org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List (parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
Server server = new Server(“localhost”,49201);
Project[] projects = server.getProjects();
for(int i=0;i<projects.length;i++){
list.add(((Project)projects[i]).getName());
}
//list.setItems (new String [] {“Item 1”, “Item2”});
return list;
/*
Button b = new Button(parent, SWT.PUSH);
b.setText(“Hello World”);
return b;*/
/*Display display = new Display ();
final Shell shell = new Shell (display);
org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List (shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
list.setItems (new String [] {“Item 1”, “Item2”});
return list;*/
}/**
* The action has been activated. The argument of the
* method represents the ‘real’ action sitting
* in the workbench UI.
* @see IWorkbenchWindowActionDelegate#run
*/
public void run(IAction action) {
SampleAction obj = new SampleAction();
obj.setBlockOnOpen(true);
obj.open();
//Display.getCurrent().dispose();
}/**
* Selection in the workbench has been changed. We
* can change the state of the ‘real’ action here
* if we want, but this can only happen after
* the delegate has been created.
* @see IWorkbenchWindowActionDelegate#selectionChanged
*/
public void selectionChanged(IAction action, ISelection selection) {
}/**
* We can use this method to dispose of any system
* resources we previously allocated.
* @see IWorkbenchWindowActionDelegate#dispose
*/
public void dispose() {
}/**
* We will cache window object in order to
* be able to provide parent shell for the message dialog.
* @see IWorkbenchWindowActionDelegate#init
*/
public void init(IWorkbenchWindow window) {
this.window = window;
}}
I am getting the below error:
Unhandled event loop exception
Reason:
com/starbase/starteam/ServerSo please help in identifying the place where I am making a mistake.
Desperately waiting for your response.
Regards,
Mithun K
Riyad KallaMemberMoving to OT > Soft Dev.
-
AuthorPosts