MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
JanPfeifer
Post subject: JSP Editor replace plugin  PostPosted: Jan 13, 2011 - 12:20 PM



Joined: Jan 13, 2011
Posts: 3

Hi

I try to develop kind of replace-text plugin. I actually have working plugin but only in JAVA and plain text editors.

The question is how to replace text in JSP editor or how to obtain IDocument.

I have following code for JAVA editor:

Code:

...
IEditorPart editorPart = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow()
                       .getActivePage().getActiveEditor();

ITextEditor editor = (ITextEditor) editorPart;           
            IDocumentProvider dp = editor.getDocumentProvider();       
            IDocument doc = dp.getDocument(editor.getEditorInput());         
                       
            doc.replace(offset, length, myText);
...


Somewhere on chinese blog I found this

Code:

import com.genuitec.eclipse.webdesigner3.editors.*;
...
WebDesignerMultiPageEditor part = (WebDesignerMultiPageEditor) editorPart;
           IDocument doc = part.getSourceEditor().getDocumentProvider().getDocument(part.getEditorInput());
           
           doc.replace(offset, length, textOutput);


But even if I compile it I am unable to make it work with class not found exception.

Mainfest.mf
Code:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: S4W Eclipse plugin
Bundle-SymbolicName: org.s4w.eclipse.lp;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.s4w.eclipse.lp.Activator
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 org.eclipse.jface.text,
 com.genuitec.eclipse.webdesigner3;bundle-version="9.0.0",
 org.eclipse.ui.workbench.texteditor;bundle-version="3.6.0",
 org.eclipse.core.resources;bundle-version="3.6.0",
 org.eclipse.wst.sse.ui;bundle-version="1.2.0"
Eclipse-LazyStart: true
Bundle-Vendor: Jan Pfeifer
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .


Error log
Code:
!ENTRY org.eclipse.equinox.registry 4 1 2011-01-13 13:18:37.593
!MESSAGE Plug-in "org.s4w.eclipse.lp" was unable to instantiate class "org.s4w.eclipse.lp.actions.Translate".
!STACK 0
java.lang.NoClassDefFoundError: com/genuitec/eclipse/webdesigner3/editors/WebDesignerMultiPageEditor
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
    at java.lang.Class.getConstructor0(Class.java:2671)
    at java.lang.Class.newInstance0(Class.java:321)
    at java.lang.Class.newInstance(Class.java:303)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:184)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:904)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:259)
    at org.eclipse.ui.internal.PluginAction.createDelegate(PluginAction.java:122)
    at org.eclipse.ui.internal.PluginAction.selectionChanged(PluginAction.java:275)
    at org.eclipse.ui.internal.ObjectActionContributor$1.run(ObjectActionContributor.java:157)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.ObjectActionContributor.contributeObjectActions(ObjectActionContributor.java:160)
    at org.eclipse.ui.internal.ObjectActionContributorManager.contributeObjectActions(ObjectActionContributorManager.java:97)
    at org.eclipse.ui.internal.PopupMenuExtender.addEditorActions(PopupMenuExtender.java:250)
    at org.eclipse.ui.internal.PopupMenuExtender.menuAboutToShow(PopupMenuExtender.java:337)
    at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:338)
    at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:469)
    at org.eclipse.jface.action.MenuManager.access$1(MenuManager.java:465)
    at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:491)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:241)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
    at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:4485)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4188)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
    at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1598)
    at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2038)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873)
    at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
    at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:256)
    at org.eclipse.swt.widgets.Display.runPopups(Display.java:4107)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1407)


Thanks in advance
 
 View user's profile Send private message  
Reply with quote Back to top
support-joy
Post subject: RE: JSP Editor replace plugin  PostPosted: Jan 17, 2011 - 11:58 AM
Registered Member
Registered Member


Joined: Feb 03, 2009
Posts: 3442

JanPfeifer,

I am afraid this is not the right forum. Your question is specific to developing specific plugin projects. I would recommend you crosspost on relevant forums.

_________________
Joy
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits