MultipageEditorPart [message #323798] |
Tue, 08 January 2008 21:23  |
Eclipse User |
|
|
|
Originally posted by: sandip.sahoo1980.gmail.com
Hi,
I am implementing MultipageEditorPart. Whether it is possible to know
whether the Editor is open/active or not inside the EditorPart? As far as I
know there is no such API provided such as isActive().
Would anybody please provide me any solution for the above?
Regards,
Sandip
|
|
|
Re: MultipageEditorPart [message #323805 is a reply to message #323798] |
Wed, 09 January 2008 02:59   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------030300030607020903070706
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Sandip,
Using the type of technique below within an editor, you can monitor
activation and deactivation of your editor. Maybe you can test
"getSite().getPage().getActiveEditor() == this" but I'm not sure if
that's true when the editor doesn't have focus...
protected IPartListener partListener =
new IPartListener()
{
public void partActivated(IWorkbenchPart p)
{
if (p instanceof ContentOutline)
{
if (((ContentOutline)p).getCurrentPage() == contentOutlinePage)
{
getActionBarContributor().setActiveEditor(LibraryEditor.this );
setCurrentViewer(contentOutlineViewer);
}
}
else if (p instanceof PropertySheet)
{
if (((PropertySheet)p).getCurrentPage() == propertySheetPage)
{
getActionBarContributor().setActiveEditor(LibraryEditor.this );
handleActivate();
}
}
else if (p == LibraryEditor.this)
{
handleActivate();
}
}
public void partBroughtToTop(IWorkbenchPart p)
{
// Ignore.
}
public void partClosed(IWorkbenchPart p)
{
// Ignore.
}
public void partDeactivated(IWorkbenchPart p)
{
// Ignore.
}
public void partOpened(IWorkbenchPart p)
{
// Ignore.
}
};
public void init(IEditorSite site, IEditorInput editorInput)
{
setSite(site);
setInputWithNotify(editorInput);
setPartName(editorInput.getName());
site.setSelectionProvider(this);
site.getPage().addPartListener(*partListener*);
}
public void dispose()
{
updateProblemIndication = false;
getSite().getPage().removePartListener(*partListener*);
adapterFactory.dispose();
if (getActionBarContributor().getActiveEditor() == this)
{
getActionBarContributor().setActiveEditor(null);
}
if (propertySheetPage != null)
{
propertySheetPage.dispose();
}
if (contentOutlinePage != null)
{
contentOutlinePage.dispose();
}
super.dispose();
}
Sandip Sahoo wrote:
> Hi,
>
> I am implementing MultipageEditorPart. Whether it is possible to know
> whether the Editor is open/active or not inside the EditorPart? As far as I
> know there is no such API provided such as isActive().
>
> Would anybody please provide me any solution for the above?
>
> Regards,
> Sandip
>
>
>
--------------030300030607020903070706
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sandip,<br>
<br>
Using the type of technique below within an editor, you can monitor
activation and deactivation of your editor. Maybe you can test
"getSite().getPage().getActiveEditor() == this" but I'm not sure if
that's true when the editor doesn't have focus...<br>
<br>
<small> protected IPartListener partListener =<br>
new IPartListener()<br>
{<br>
public void partActivated(IWorkbenchPart p)<br>
{<br>
if (p instanceof ContentOutline)<br>
{<br>
if (((ContentOutline)p).getCurrentPage() ==
contentOutlinePage)<br>
{<br>
getActionBarContributor().setActiveEditor(LibraryEditor.this ); <br>
<br>
setCurrentViewer(contentOutlineViewer);<br>
}<br>
}<br>
else if (p instanceof PropertySheet)<br>
{<br>
if (((PropertySheet)p).getCurrentPage() == propertySheetPage)<br>
{<br>
getActionBarContributor().setActiveEditor(LibraryEditor.this ); <br>
handleActivate();<br>
}<br>
}<br>
else if (p == LibraryEditor.this)<br>
{<br>
handleActivate();<br>
}<br>
}<br>
public void partBroughtToTop(IWorkbenchPart p)<br>
{<br>
// Ignore.<br>
}<br>
public void partClosed(IWorkbenchPart p)<br>
{<br>
// Ignore.<br>
}<br>
public void partDeactivated(IWorkbenchPart p)<br>
{<br>
// Ignore.<br>
}<br>
public void partOpened(IWorkbenchPart p)<br>
{<br>
// Ignore.<br>
}<br>
};</small><br>
<br>
<br>
<small> public void init(IEditorSite site, IEditorInput editorInput)<br>
{<br>
setSite(site);<br>
setInputWithNotify(editorInput);<br>
setPartName(editorInput.getName());<br>
site.setSelectionProvider(this);<br>
site.getPage().addPartListener(<b>partListener</b>);<br >
}<br>
</small><br>
<br>
<small> public void dispose()<br>
{<br>
updateProblemIndication = false;<br>
<br>
getSite().getPage().removePartListener(<b>partListener</b >);<br>
<br>
adapterFactory.dispose();<br>
<br>
if (getActionBarContributor().getActiveEditor() == this)<br>
{<br>
getActionBarContributor().setActiveEditor(null);<br>
}<br>
<br>
if (propertySheetPage != null)<br>
{<br>
propertySheetPage.dispose();<br>
}<br>
<br>
if (contentOutlinePage != null)<br>
{<br>
contentOutlinePage.dispose();<br>
}<br>
<br>
super.dispose();<br>
}</small><br>
<br>
<br>
Sandip Sahoo wrote:
<blockquote cite="mid:fm1b7m$4r6$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,
I am implementing MultipageEditorPart. Whether it is possible to know
whether the Editor is open/active or not inside the EditorPart? As far as I
know there is no such API provided such as isActive().
Would anybody please provide me any solution for the above?
Regards,
Sandip
</pre>
</blockquote>
<br>
</body>
</html>
--------------030300030607020903070706--
|
|
|
|
Re: MultipageEditorPart [message #323839 is a reply to message #323805] |
Wed, 09 January 2008 13:25  |
Eclipse User |
|
|
|
Originally posted by: sandip.sahoo1980.gmail.com
This is a multi-part message in MIME format.
------=_NextPart_000_0015_01C852A9.FE748960
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Ed,
Thanks.
Itz working.
Even I have tried with below. seems working also.
@Override
public void setFocus() {
super.setFocus();
}
Regards,
Sandip
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fm1uos$9v2$1@build.eclipse.org...
Sandip,
Using the type of technique below within an editor, you can monitor =
activation and deactivation of your editor. Maybe you can test =
"getSite().getPage().getActiveEditor() =3D=3D this" but I'm not sure if =
that's true when the editor doesn't have focus...
protected IPartListener partListener =3D
new IPartListener()
{
public void partActivated(IWorkbenchPart p)
{
if (p instanceof ContentOutline)
{
if (((ContentOutline)p).getCurrentPage() =3D=3D =
contentOutlinePage)
{
=
getActionBarContributor().setActiveEditor(LibraryEditor.this );
setCurrentViewer(contentOutlineViewer);
}
}
else if (p instanceof PropertySheet)
{
if (((PropertySheet)p).getCurrentPage() =3D=3D =
propertySheetPage)
{
=
getActionBarContributor().setActiveEditor(LibraryEditor.this );
handleActivate();
}
}
else if (p =3D=3D LibraryEditor.this)
{
handleActivate();
}
}
public void partBroughtToTop(IWorkbenchPart p)
{
// Ignore.
}
public void partClosed(IWorkbenchPart p)
{
// Ignore.
}
public void partDeactivated(IWorkbenchPart p)
{
// Ignore.
}
public void partOpened(IWorkbenchPart p)
{
// Ignore.
}
};
public void init(IEditorSite site, IEditorInput editorInput)
{
setSite(site);
setInputWithNotify(editorInput);
setPartName(editorInput.getName());
site.setSelectionProvider(this);
site.getPage().addPartListener(partListener);
}
public void dispose()
{
updateProblemIndication =3D false;
getSite().getPage().removePartListener(partListener);
adapterFactory.dispose();
if (getActionBarContributor().getActiveEditor() =3D=3D this)
{
getActionBarContributor().setActiveEditor(null);
}
if (propertySheetPage !=3D null)
{
propertySheetPage.dispose();
}
if (contentOutlinePage !=3D null)
{
contentOutlinePage.dispose();
}
super.dispose();
}
Sandip Sahoo wrote:=20
Hi,
I am implementing MultipageEditorPart. Whether it is possible to know=20
whether the Editor is open/active or not inside the EditorPart? As far =
as I=20
know there is no such API provided such as isActive().
Would anybody please provide me any solution for the above?
Regards,
Sandip=20
=20
------=_NextPart_000_0015_01C852A9.FE748960
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.3157" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Itz working.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Even I have tried with below. seems =
working=20
also.</FONT></DIV>
<DIV><FONT color=3D#646464 size=3D2>
<P align=3Dleft>@Override</P></FONT><FONT size=3D2>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>public</B></FONT><FONT=20
size=3D2> </FONT><B><FONT color=3D#7f0055 size=3D2>void</B></FONT><FONT =
size=3D2>=20
setFocus() {</P>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>super</B></FONT><FONT=20
size=3D2>.setFocus();</P>
<P>}</P>
<P><FONT face=3DArial>Regards,</FONT></P>
<P><FONT face=3DArial>Sandip</FONT></P></FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" <<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>>=20
wrote in message <A=20
=
href=3D"news:fm1uos$9v2$1@build.eclipse.org">news:fm1uos$9v2$1@build.ecli=
pse.org</A>...</DIV>Sandip,<BR><BR>Using=20
the type of technique below within an editor, you can monitor =
activation and=20
deactivation of your editor. Maybe you can test=20
"getSite().getPage().getActiveEditor() =3D=3D this" but I'm not sure =
if that's=20
true when the editor doesn't have focus...<BR><BR><SMALL> =
protected=20
IPartListener partListener =3D<BR> new=20
IPartListener()<BR> =
{<BR> =20
public void partActivated(IWorkbenchPart =
p)<BR> =20
{<BR> if (p instanceof=20
ContentOutline)<BR> =20
{<BR> if=20
(((ContentOutline)p).getCurrentPage() =3D=3D=20
=
contentOutlinePage)<BR> &n=
bsp;=20
=
{<BR> =20
=
getActionBarContributor().setActiveEditor(LibraryEditor.this ); <BR><BR>&nb=
sp; &nb sp; =20
=
setCurrentViewer(contentOutlineViewer);<BR> =
=20
}<BR> =20
}<BR> else if (p instanceof=20
PropertySheet)<BR> =20
{<BR> if=20
(((PropertySheet)p).getCurrentPage() =3D=3D=20
=
propertySheetPage)<BR> &nb=
sp;=20
=
{<BR> =20
=
getActionBarContributor().setActiveEditor(LibraryEditor.this ); <BR> &=
nbsp; & nbsp; =20
=
handleActivate();<BR> &nbs=
p;=20
}<BR> =20
}<BR> else if (p =3D=3D=20
LibraryEditor.this)<BR> =20
{<BR> =20
handleActivate();<BR> =20
}<BR> =
}<BR> public=20
void partBroughtToTop(IWorkbenchPart =
p)<BR> =20
{<BR> //=20
Ignore.<BR> =
}<BR> =20
public void partClosed(IWorkbenchPart =
p)<BR> =20
{<BR> //=20
Ignore.<BR> =
}<BR> =20
public void partDeactivated(IWorkbenchPart=20
p)<BR> =20
{<BR> //=20
Ignore.<BR> =
}<BR> =20
public void partOpened(IWorkbenchPart =
p)<BR> =20
{<BR> //=20
Ignore.<BR> }<BR> =20
};</SMALL><BR><BR><BR><SMALL> public void init(IEditorSite site, =
IEditorInput editorInput)<BR> {<BR> =20
setSite(site);<BR> =20
setInputWithNotify(editorInput);<BR> =20
setPartName(editorInput.getName());<BR> =20
site.setSelectionProvider(this);<BR> =20
site.getPage().addPartListener(<B>partListener</B>);<BR > =20
}<BR></SMALL><BR><BR><SMALL> public void dispose()<BR> =20
{<BR> updateProblemIndication =3D=20
false;<BR><BR> =20
=
getSite().getPage().removePartListener(<B>partListener</B >);<BR><BR> =
; =20
adapterFactory.dispose();<BR><BR> if=20
(getActionBarContributor().getActiveEditor() =3D=3D =
this)<BR> =20
{<BR> =20
getActionBarContributor().setActiveEditor(null);<BR> =
}<BR><BR> if (propertySheetPage !=3D=20
null)<BR> {<BR> =20
propertySheetPage.dispose();<BR> =
}<BR><BR> =20
if (contentOutlinePage !=3D null)<BR> =20
{<BR> =20
contentOutlinePage.dispose();<BR> =20
}<BR><BR> super.dispose();<BR> =20
}</SMALL><BR><BR><BR>Sandip Sahoo wrote:=20
<BLOCKQUOTE cite=3Dmid:fm1b7m$4r6$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hi,
I am implementing MultipageEditorPart. Whether it is possible to know=20
whether the Editor is open/active or not inside the EditorPart? As far =
as I=20
know there is no such API provided such as isActive().
Would anybody please provide me any solution for the above?
Regards,
Sandip=20
</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0015_01C852A9.FE748960--
|
|
|
Powered by
FUDForum. Page generated in 0.03431 seconds