Getting Started with Eclipse RCP development study notes - 04. In Windows, use the Active X control
Advertisements
Study: http://www.blogjava.net/youxia/archive/2006/11/28/84013.html
-------------------------------------------------- -------------------------------------------------
1. New OleView:
package hellorcp.ole;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
public class OleView extends ViewPart {
public OleFrame frame;
public static final String ID = "hellorcp.view.OleView"; //$NON-NLS-1$
/**
* Create contents of the view part
*
* @param parent
*/
@Override
public void createPartControl(Composite parent) {
// Create a OleFrame object
frame = new OleFrame(parent, SWT.NONE);
//
createActions();
initializeToolBar();
initializeMenu();
}
/**
* Create the actions
*/
private void createActions() {
// Create the actions
}
/**
* Initialize the toolbar
*/
private void initializeToolBar() {
IToolBarManager toolbarManager = getViewSite().getActionBars()
.getToolBarManager();
}
/**
* Initialize the menu
*/
private void initializeMenu() {
IMenuManager menuManager = getViewSite().getActionBars()
.getMenuManager();
}
@Override
public void setFocus() {
// Set the focus
}
}
2. New OpenFileAction:
package hellorcp.ole;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.OleClientSite;
import org.eclipse.swt.ole.win32.Variant;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class OpenFileAction implements IWorkbenchWindowActionDelegate {
IWorkbenchWindow window;
public void dispose() {
// TODO Automatically generate method stub
}
public void init(IWorkbenchWindow window) {
this.window = window;
}
public void run(IAction action) {
IViewReference[] vfs = window.getActivePage().getViewReferences();
IViewPart vw;
for (int i = 0; i < vfs.length; i++) {
vw = vfs[i].getView(false);
if (vw.getTitle().equals(" Use the active X control ")) {
OleClientSite client = new OleClientSite(((OleView) vw).frame,
SWT.NONE, "Shell.Explorer.2");
client.doVerb(OLE.OLEIVERB_SHOW);
OleAutomation oa = new OleAutomation(client);
Variant str = new Variant("http://www.javaeye.com/");
oa.invoke(104, new Variant[] { str });
}
}
}
public void selectionChanged(IAction action, ISelection selection) {
// TODO Automatically generate method stub
}
}
3. Modify Perspective.java, revised:
package hellorcp;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
// FirstView
String editorArea = layout.getEditorArea();
// layout.addView("hellorcp.view.FirstView", IPageLayout.RIGHT, 0.2f,
// editorArea);
// SecondView
// layout.setEditorAreaVisible(false);
// layout.addView("hellorcp.view.SecondView", IPageLayout.RIGHT, 0.5f,
// editorArea);
// OleView
layout.addView("hellorcp.ole.OleView", IPageLayout.RIGHT, 0.5f,
editorArea);
}
}
4. Configuration plugin.xml:
1) action configuration snippet:
<action
class ="hellorcp.ole.OpenFileAction"
icon ="icons/alt_window_16.gif"
id ="hellorcp.ole.OpenFileAction"
label ="Ole Menu items "
menubarPath ="hellorcp.firstmenu/additions"
style ="push"
toolbarPath ="additions"
tooltip ="Ole Menu items " />
2) view configuration snippet:
<view
name=" Use the active X control " />
5. Save, run (click on Tools first one icon), the effect is as follows:
Related Posts of Getting Started with Eclipse RCP development study notes - 04. In Windows, use the Active X control
-
OSGI service must be started
OSGI must start the service: 0 ACTIVE org.eclipse.osgi_3.4.2.R34x_v20080826-1230 1 ACTIVE org.eclipse.equinox.http.jetty_1.1.0.v20080425 2 ACTIVE org.eclipse.osgi.services_3.1.200.v20071203 3 ACTIVE javax.servlet.jsp_2.0.0.v200806031607 4 ACTIVE org.eclip
-
Getting Started with Eclipse RCP development study notes - 03. View
-------------------------------------------------- ---------------------------------------------- Study: http://www.blogjava.net/youxia/archive/2006/11/24/83377.html -------------------------------------------------- --------------------------------- ...
-
Getting Started with Eclipse RCP development study notes - 02. Menus and dialog boxes
-------------------------------------------------- -------------------------------------------- Study: http://www.blogjava.net/youxia/archive/2006/11/20/82388.html -------------------------------------------------- ----------------------------------------
-
Getting Started with Eclipse RCP development study notes - 07. Summary
Follow the "Seaside Momo" series of articles had started studying the development of the RCP has been a general understanding of the increasing interest in this area, of course, if you really want to develop a practical small Dongdong years, Lea
-
Oracle study notes (data dictionary control file rewrite the log file)
Recent study Oracle, did some study notes, mainly digital dictionary control file and redo log file contents 1. Start iSQL * Plus tool: to ensure the iSQL * Plus application server has started (usually installed by default are automatically activated ...
-
Getting Started with Eclipse RCP Developer Study Notes - 05.2D Drawing
-------------------------------------------------- -------------------------------------------------- Study: http://www.blogjava.net/youxia/archive/2006/12/01/84855.html -------------------------------------------------- ----------------------------- ...
-
Getting Started with Eclipse RCP Developer Study Notes - 06.OpenGL
-------------------------------------------------- ------------------------------------------------- Study: http://www.blogjava.net/youxia/archive/2006/12/09/86513.html -------------------------------------------------- -----------------------------------
-
Android Study Notes (2) - build Android development platform
Eclipse + Android SDK First, download the Eclipse http://www.eclipse.org/downloads/ Select Eclipse IDE for Java Developers (85 MB) version Second, download the Android SDK http://developer.android.com/sdk/download.html?v=android-sdk-windows-1.1_r1.zip I c
-
[Transfer] SAP Study Notes (SAP Portal Study Notes 1)
SAP Study Notes (SAP Portal Study Notes 1) In general SAP Portal project consultants, including most of the configuration and development issues, development, then very flexible to provide the technology for SAP are WebDynpro (Java and ABAP can be) a
-
Getting Started with Eclipse RCP Developer Study Notes - 01.Hello RCP
Recent eager to want to learn all aspects of the desktop client development, in addition to work is only beginning to learn a bit of time outside of Delphi, as well as U read a little bit of time VB, VC contacts, in this area can be called super do not qu












