Author: kayyagari
Date: Sat Aug 21 16:55:46 2010
New Revision: 987789
URL: http://svn.apache.org/viewvc?rev=987789&view=rev
Log:
o adding a new RCP plugin
Added:
directory/sandbox/kayyagari/studio-http/ (with props)
directory/sandbox/kayyagari/studio-http/.classpath
directory/sandbox/kayyagari/studio-http/.project
directory/sandbox/kayyagari/studio-http/META-INF/
directory/sandbox/kayyagari/studio-http/META-INF/MANIFEST.MF
directory/sandbox/kayyagari/studio-http/build.properties
directory/sandbox/kayyagari/studio-http/contexts.xml
directory/sandbox/kayyagari/studio-http/icons/
directory/sandbox/kayyagari/studio-http/icons/sample.gif (with props)
directory/sandbox/kayyagari/studio-http/plugin.xml
directory/sandbox/kayyagari/studio-http/src/
directory/sandbox/kayyagari/studio-http/src/org/
directory/sandbox/kayyagari/studio-http/src/org/apache/
directory/sandbox/kayyagari/studio-http/src/org/apache/directory/
directory/sandbox/kayyagari/studio-http/src/org/apache/directory/studio/
directory/sandbox/kayyagari/studio-http/src/org/apache/directory/studio/http/
directory/sandbox/kayyagari/studio-http/src/org/apache/directory/studio/http/views/
directory/sandbox/kayyagari/studio-http/src/org/apache/directory/studio/http/views/ConfigView.java
directory/sandbox/kayyagari/studio-http/src/studio_http/
directory/sandbox/kayyagari/studio-http/src/studio_http/Activator.java
Propchange: directory/sandbox/kayyagari/studio-http/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Aug 21 16:55:46 2010
@@ -0,0 +1,2 @@
+bin/*
+.settings/*
Added: directory/sandbox/kayyagari/studio-http/.classpath
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/studio-http/.classpath?rev=987789&view=auto
==============================================================================
--- directory/sandbox/kayyagari/studio-http/.classpath (added)
+++ directory/sandbox/kayyagari/studio-http/.classpath Sat Aug 21 16:55:46 2010
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: directory/sandbox/kayyagari/studio-http/.project
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/studio-http/.project?rev=987789&view=auto
==============================================================================
--- directory/sandbox/kayyagari/studio-http/.project (added)
+++ directory/sandbox/kayyagari/studio-http/.project Sat Aug 21 16:55:46 2010
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>studio-http</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: directory/sandbox/kayyagari/studio-http/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/studio-http/META-INF/MANIFEST.MF?rev=987789&view=auto
==============================================================================
--- directory/sandbox/kayyagari/studio-http/META-INF/MANIFEST.MF (added)
+++ directory/sandbox/kayyagari/studio-http/META-INF/MANIFEST.MF Sat Aug 21 16:55:46 2010
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Studio-http
+Bundle-SymbolicName: studio-http; singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: studio_http.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: directory/sandbox/kayyagari/studio-http/build.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/studio-http/build.properties?rev=987789&view=auto
==============================================================================
--- directory/sandbox/kayyagari/studio-http/build.properties (added)
+++ directory/sandbox/kayyagari/studio-http/build.properties Sat Aug 21 16:55:46 2010
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ contexts.xml
Added: directory/sandbox/kayyagari/studio-http/contexts.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/studio-http/contexts.xml?rev=987789&view=auto
==============================================================================
--- directory/sandbox/kayyagari/studio-http/contexts.xml (added)
+++ directory/sandbox/kayyagari/studio-http/contexts.xml Sat Aug 21 16:55:46 2010
@@ -0,0 +1,12 @@
+<contexts>
+ <context id="viewer" title="Sample View">
+ <description>This is the context help for the sample view with a table viewer. It
was generated by a PDE template.</description>
+ <topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive
help">
+ <enablement>
+ <with variable="platform">
+ <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/>
+ </with>
+ </enablement>
+ </topic>
+ </context>
+</contexts>
Added: directory/sandbox/kayyagari/studio-http/icons/sample.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/studio-http/icons/sample.gif?rev=987789&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/kayyagari/studio-http/icons/sample.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/kayyagari/studio-http/plugin.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/studio-http/plugin.xml?rev=987789&view=auto
==============================================================================
--- directory/sandbox/kayyagari/studio-http/plugin.xml (added)
+++ directory/sandbox/kayyagari/studio-http/plugin.xml Sat Aug 21 16:55:46 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ name="Configuration Category"
+ id="studio-http">
+ </category>
+ <view
+ name="Configuration View"
+ icon="icons/sample.gif"
+ category="studio-http"
+ class="org.apache.directory.studio.http.views.ConfigView"
+ id="org.apache.directory.studio.http.views.ConfigView">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.eclipse.jdt.ui.JavaPerspective">
+ <view
+ ratio="0.5"
+ relative="org.eclipse.ui.views.TaskList"
+ relationship="right"
+ id="org.apache.directory.studio.http.views.ConfigView">
+ </view>
+ </perspectiveExtension>
+ </extension>
+ <extension
+ point="org.eclipse.help.contexts">
+ <contexts
+ file="contexts.xml">
+ </contexts>
+ </extension>
+
+</plugin>
Added: directory/sandbox/kayyagari/studio-http/src/org/apache/directory/studio/http/views/ConfigView.java
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/studio-http/src/org/apache/directory/studio/http/views/ConfigView.java?rev=987789&view=auto
==============================================================================
--- directory/sandbox/kayyagari/studio-http/src/org/apache/directory/studio/http/views/ConfigView.java
(added)
+++ directory/sandbox/kayyagari/studio-http/src/org/apache/directory/studio/http/views/ConfigView.java
Sat Aug 21 16:55:46 2010
@@ -0,0 +1,275 @@
+package org.apache.directory.studio.http.views;
+
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This sample class demonstrates how to plug-in a new
+ * workbench view. The view shows data obtained from the
+ * model. The sample creates a dummy model on the fly,
+ * but a real implementation would connect to the model
+ * available either in this or another plug-in (e.g. the workspace).
+ * The view is connected to the model using a content provider.
+ * <p>
+ * The view uses a label provider to define how model
+ * objects should be presented in the view. Each
+ * view can present the same model objects using
+ * different labels and icons, if needed. Alternatively,
+ * a single label provider can be shared between views
+ * in order to ensure that objects of the same type are
+ * presented in the same way everywhere.
+ * <p>
+ */
+
+public class ConfigView extends ViewPart
+{
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.apache.directory.studio.http.views.ConfigView";
+
+ private TableViewer viewer;
+ private Action action1;
+ private Action action2;
+ private Action doubleClickAction;
+
+ private CTabFolder tabFolder;
+
+ /*
+ * The content provider class is responsible for
+ * providing objects to the view. It can wrap
+ * existing objects in adapters or simply return
+ * objects as-is. These objects may be sensitive
+ * to the current input of the view, or ignore
+ * it and always show the same content
+ * (like Task List, for example).
+ */
+
+ class ViewContentProvider implements IStructuredContentProvider
+ {
+ public void inputChanged( Viewer v, Object oldInput, Object newInput )
+ {
+ }
+
+
+ public void dispose()
+ {
+ }
+
+
+ public Object[] getElements( Object parent )
+ {
+ return new String[]
+ { "One", "Two", "Three" };
+ }
+ }
+
+ class ViewLabelProvider extends LabelProvider implements ITableLabelProvider
+ {
+ public String getColumnText( Object obj, int index )
+ {
+ return getText( obj );
+ }
+
+
+ public Image getColumnImage( Object obj, int index )
+ {
+ return getImage( obj );
+ }
+
+
+ public Image getImage( Object obj )
+ {
+ return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJ_ELEMENT
);
+ }
+ }
+
+ class NameSorter extends ViewerSorter
+ {
+ }
+
+
+ /**
+ * The constructor.
+ */
+ public ConfigView()
+ {
+ }
+
+
+ /**
+ * This is a callback that will allow us
+ * to create the viewer and initialize it.
+ */
+ public void createPartControl( Composite parent )
+ {
+ parent.setLayout( new FillLayout() );
+
+ tabFolder = new CTabFolder( parent, SWT.NONE );
+
+ CTabItem item = new CTabItem( tabFolder, SWT.NONE );
+ item.setText( "Login View" );
+
+ viewer = new TableViewer( tabFolder );//, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL
);
+
+ viewer.setContentProvider( new ViewContentProvider() );
+ viewer.setLabelProvider( new ViewLabelProvider() );
+ viewer.setSorter( new NameSorter() );
+ viewer.setInput( getViewSite() );
+
+ item.setControl( viewer.getControl() );
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( viewer.getControl(), "studio-http.viewer"
);
+ makeActions();
+ hookContextMenu();
+ hookDoubleClickAction();
+ contributeToActionBars();
+
+ CTabItem item2 = new CTabItem( tabFolder, SWT.NONE );
+ item2.setText( "another View" );
+ }
+
+
+ private void hookContextMenu()
+ {
+ MenuManager menuMgr = new MenuManager( "#PopupMenu" );
+ menuMgr.setRemoveAllWhenShown( true );
+ menuMgr.addMenuListener( new IMenuListener()
+ {
+ public void menuAboutToShow( IMenuManager manager )
+ {
+ ConfigView.this.fillContextMenu( manager );
+ }
+ } );
+ Menu menu = menuMgr.createContextMenu( viewer.getControl() );
+ viewer.getControl().setMenu( menu );
+ getSite().registerContextMenu( menuMgr, viewer );
+ }
+
+
+ private void contributeToActionBars()
+ {
+ IActionBars bars = getViewSite().getActionBars();
+ fillLocalPullDown( bars.getMenuManager() );
+ fillLocalToolBar( bars.getToolBarManager() );
+ }
+
+
+ private void fillLocalPullDown( IMenuManager manager )
+ {
+ manager.add( action1 );
+ manager.add( new Separator() );
+ manager.add( action2 );
+ }
+
+
+ private void fillContextMenu( IMenuManager manager )
+ {
+ manager.add( action1 );
+ manager.add( action2 );
+ // Other plug-ins can contribute there actions here
+ manager.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
+ }
+
+
+ private void fillLocalToolBar( IToolBarManager manager )
+ {
+ manager.add( action1 );
+ manager.add( action2 );
+ }
+
+
+ private void makeActions()
+ {
+ action1 = new Action()
+ {
+ public void run()
+ {
+ showMessage( "Action 1 executed" );
+ }
+ };
+ action1.setText( "Action 1" );
+ action1.setToolTipText( "Action 1 tooltip" );
+ action1.setImageDescriptor( PlatformUI.getWorkbench().getSharedImages()
+ .getImageDescriptor( ISharedImages.IMG_OBJS_INFO_TSK ) );
+
+ action2 = new Action()
+ {
+ public void run()
+ {
+ showMessage( "Action 2 executed" );
+ }
+ };
+ action2.setText( "Action 2" );
+ action2.setToolTipText( "Action 2 tooltip" );
+ action2.setImageDescriptor( PlatformUI.getWorkbench().getSharedImages()
+ .getImageDescriptor( ISharedImages.IMG_OBJS_INFO_TSK ) );
+ doubleClickAction = new Action()
+ {
+ public void run()
+ {
+ ISelection selection = viewer.getSelection();
+ Object obj = ( ( IStructuredSelection ) selection ).getFirstElement();
+ showMessage( "Double-click detected on " + obj.toString() );
+ }
+ };
+ }
+
+
+ private void hookDoubleClickAction()
+ {
+ viewer.addDoubleClickListener( new IDoubleClickListener()
+ {
+ public void doubleClick( DoubleClickEvent event )
+ {
+ doubleClickAction.run();
+ }
+ } );
+ }
+
+
+ private void showMessage( String message )
+ {
+ MessageDialog.openInformation( viewer.getControl().getShell(), "Configuration View",
message );
+ }
+
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ public void setFocus()
+ {
+ viewer.getControl().setFocus();
+ }
+}
\ No newline at end of file
Added: directory/sandbox/kayyagari/studio-http/src/studio_http/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/studio-http/src/studio_http/Activator.java?rev=987789&view=auto
==============================================================================
--- directory/sandbox/kayyagari/studio-http/src/studio_http/Activator.java (added)
+++ directory/sandbox/kayyagari/studio-http/src/studio_http/Activator.java Sat Aug 21 16:55:46
2010
@@ -0,0 +1,74 @@
+package studio_http;
+
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin
+{
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "studio-http"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+
+ /**
+ * The constructor
+ */
+ public Activator()
+ {
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start( BundleContext context ) throws Exception
+ {
+ super.start( context );
+ plugin = this;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop( BundleContext context ) throws Exception
+ {
+ plugin = null;
+ super.stop( context );
+ }
+
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor( String path )
+ {
+ return imageDescriptorFromPlugin( PLUGIN_ID, path );
+ }
+}
|