Home » Eclipse Projects » Remote Application Platform (RAP) » ViewPart OnClose Event(ViewPart OnClose Event)
|
Re: ViewPart OnClose Event [message #544329 is a reply to message #544327] |
Fri, 02 July 2010 11:48 |
|
Try: view.getSite().getWorkbenchWindow().addPerspectiveListener(n ew
IPerspectiveListener2() { ... });
The method on IPerspectiveListener2 gets called before the view or its
controls are disposed, and the id parameter indicates which view is being
closed. Don't forget to remove the listener in your view's dispose method.
It would help to know more about what you're trying to do here. There may
be a cleaner way.
hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
|
|
| |
Re: ViewPart OnClose Event [message #544358 is a reply to message #544348] |
Fri, 02 July 2010 13:12 |
|
Well a standard view does not have a close button. Only an a close button if you give it a closable option in the plugin.xml. So if you remove the closable and do not have anny buttons that are couse the view to be closed. then yoru good. But your sounding likeyour talking about an Dialog.
hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
|
|
| | |
Re: ViewPart OnClose Event [message #544372 is a reply to message #544369] |
Fri, 02 July 2010 13:27 |
|
You could extend the view to SavablePart so you can use the Dirty state.
hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
|
|
| | | |
Re: ViewPart OnClose Event [message #544737 is a reply to message #544722] |
Mon, 05 July 2010 11:53 |
|
zabi wrote on Mon, 05 July 2010 13:26 | Hi,
yes it works but i how can i ovveride the text shown on the yes,no Dialog?
Thanks
|
What thext do you want to ovride?
hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
|
|
|
Re: ViewPart OnClose Event [message #544825 is a reply to message #544737] |
Mon, 05 July 2010 15:58 |
zabi Messages: 11 Registered: July 2009 |
Junior Member |
|
|
Hi,
thanks for your answers,
i just need now to create my own dialog with yes, no cancel. you know how to do this. i have a dialog here is the code but i doese not work with no button. just ok and cancel works.
here is the code:
/**
* This dialog should used to confirm a message and get decision between yes or no (OK or CANCEL). <br/>
* The title and icon of dialog can (should) to set with a action. Included text should set per separate action.
*
* @author
* @version $Revision$
*/
public final class YesNoAbortDialog extends DefaultDialog
{
/**
* constructor.
*
* @param parentShell Composite, where dialog is extended.
* @param action Set title, icon and a short description of dialog.
*/
private YesNoAbortDialog(Shell parentShell, Action action)
{
super(parentShell, action);
}
/**
* constructor.
*
* @param parentShell Composite, where dialog is extended.
* @param action Set title, icon and a short description of dialog.
*/
private YesNoAbortDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage)
{
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage);
}
/**
*
* This method call the constructor of this dialog and get the results and gives these back to the main frame. It is better to call this
*
* method for creating this dialog.
*
* @param parentShell Composite, where this dialog will be shown. Can be null
* @param action Action to call this dialog
* @param dialogMessage Values are parameter, that this dialog get from main frame to do anything
* @return A object, that can indeed more values. If no return value exist, than return null.
*/
public static boolean openDialog(final Shell parentShell, final Action action, final String dialogMessage)
{
Validate.notNull(dialogMessage);
inValues = dialogMessage;
return (new YesNoAbortDialog(parentShell, action).open() == IDialogConstants.OK_ID);
}
/**
*
* This method call the constructor of this dialog and get the results and gives these back to the main frame. It is better to call this
*
* method for creating this dialog.
*
* @param parentShell Composite, where this dialog will be shown. Can be null
* @param dialogMessage Values are parameter, that this dialog get from main frame to do anything
* @return A object, that can indeed more values. If no return value exist, than return null.
*/
public static int openDialog(final Shell parentShell, final String dialogMessage)
{
Validate.notNull(dialogMessage);
int code = new YesNoAbortDialog(parentShell, Resources.Frames.Dialog.Texts.CONFIRM_TITLE.getText(),
Resources.Frames.Dialog.Images.CONFIRM_IMAGE.getImage(), dialogMessage).open();
if (code == IDialogConstants.OK_ID)
{
return ISaveablePart2.YES;
}
else if (code == IDialogConstants.NO_ID)
{
return ISaveablePart2.NO;
}
else if (code == IDialogConstants.CANCEL_ID)
{
return ISaveablePart2.CANCEL;
}
else
{
return ISaveablePart2.DEFAULT;
}
}
/**
*
* {@inheritDoc}
*
* @see de.ebcot.prowim.portal.dialogs.DefaultDialog#createCustomAre a(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createCustomArea(Composite parent)
{
Control control = super.createCustomArea(parent);
return control;
}
/**
*
* {@inheritDoc}
*
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(o rg.eclipse.swt.widgets.Composite)
*/
@Override
protected void createButtonsForButtonBar(Composite parent)
{
// create OK and Cancel buttons by default
createButton(parent, IDialogConstants.OK_ID, Resources.Frames.Global.Texts.OK.getText(), true);
createButton(parent, IDialogConstants.NO_ID, Resources.Frames.Global.Texts.NO.getText(), true);
createButton(parent, IDialogConstants.CANCEL_ID, Resources.Frames.Global.Texts.CANCEL.getText(), false);
}
}
[Updated on: Mon, 05 July 2010 15:59] Report message to a moderator
|
|
|
Re: ViewPart OnClose Event [message #544938 is a reply to message #544825] |
Tue, 06 July 2010 07:15 |
|
Hi,
you can implement the ISaveablePart2 [1] interface to open your custom
dialog.
Regards, Ralf
[1]
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/ui/ISaveablePart2 .html
zabi wrote:
> Hi,
> thanks for your answers,
> i just need now to create my own dialog with yes, no cancel. you know
> how to do this. i have a dialog here is the code but i doese not work
> with no button. just ok and cancel works.
>
> here is the code:
>
> /*==========================================================
> ====================
> * File $Id$
> * Project: ProWim
> *
> * $LastChangedDate$
> * $LastChangedBy$
> * $HeadURL$
> * $LastChangedRevision$
> *-----------------------------------------------------------
> -------------------
> * (c) 05.07.2010 Ebcot Business Solutions GmbH. More info:
> http://www.ebcot.de
> * All rights reserved. Use is subject to license terms.
> *===========================================================
> ===================
> */
> package de.ebcot.prowim.portal.dialogs;
>
> import org.apache.commons.lang.Validate;
> import org.eclipse.jface.action.Action;
> import org.eclipse.jface.dialogs.IDialogConstants;
> import org.eclipse.swt.graphics.Image;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Control;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.ui.ISaveablePart2;
>
> import de.ebcot.prowim.portal.i18n.Resources;
>
>
> /**
> * This dialog should used to confirm a message and get decision between
> yes or no (OK or CANCEL). <br/>
> * The title and icon of dialog can (should) to set with a action.
> Included text should set per separate action.
> * * @author
> * @version $Revision$
> */
> public final class YesNoAbortDialog extends DefaultDialog
> {
>
> /**
> * constructor.
> * * @param parentShell Composite, where dialog is extended.
> * @param action Set title, icon and a short description of dialog.
> */
> private YesNoAbortDialog(Shell parentShell, Action action)
> {
> super(parentShell, action);
> }
>
> /**
> * constructor.
> * * @param parentShell Composite, where dialog is extended.
> * @param action Set title, icon and a short description of dialog.
> */
> private YesNoAbortDialog(Shell parentShell, String dialogTitle, Image
> dialogTitleImage, String dialogMessage)
> {
> super(parentShell, dialogTitle, dialogTitleImage, dialogMessage);
> }
>
> /**
> * * This method call the constructor of this dialog and get the
> results and gives these back to the main frame. It is better to call this
> * * method for creating this dialog.
> * * @param parentShell Composite, where this dialog will be
> shown. Can be null
> * @param action Action to call this dialog
> * @param dialogMessage Values are parameter, that this dialog get
> from main frame to do anything
> * @return A object, that can indeed more values. If no return value
> exist, than return null.
> */
> public static boolean openDialog(final Shell parentShell, final
> Action action, final String dialogMessage)
> {
> Validate.notNull(dialogMessage);
>
> inValues = dialogMessage;
>
> return (new YesNoAbortDialog(parentShell, action).open() ==
> IDialogConstants.OK_ID);
> }
>
> /**
> * * This method call the constructor of this dialog and get the
> results and gives these back to the main frame. It is better to call this
> * * method for creating this dialog.
> * * @param parentShell Composite, where this dialog will be
> shown. Can be null
> * @param dialogMessage Values are parameter, that this dialog get
> from main frame to do anything
> * @return A object, that can indeed more values. If no return value
> exist, than return null.
> */
>
> public static int openDialog(final Shell parentShell, final String
> dialogMessage)
> {
> Validate.notNull(dialogMessage);
>
> int code = new YesNoAbortDialog(parentShell,
> Resources.Frames.Dialog.Texts.CONFIRM_TITLE.getText(),
>
> Resources.Frames.Dialog.Images.CONFIRM_IMAGE.getImage(),
> dialogMessage).open();
>
> if (code == IDialogConstants.OK_ID)
> {
> return ISaveablePart2.YES;
> }
> else if (code == IDialogConstants.NO_ID)
> {
> return ISaveablePart2.NO;
> }
> else if (code == IDialogConstants.CANCEL_ID)
> {
> return ISaveablePart2.CANCEL;
> }
>
> else
> {
> return ISaveablePart2.DEFAULT;
> }
>
> }
>
> /**
> * * {@inheritDoc}
> * * @see
> de.ebcot.prowim.portal.dialogs.DefaultDialog#createCustomAre
> a(org.eclipse.swt.widgets.Composite)
> */
> @Override
> protected Control createCustomArea(Composite parent)
> {
> Control control = super.createCustomArea(parent);
>
> return control;
> }
>
> /**
> * * {@inheritDoc}
> * * @see
> org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(o
> rg.eclipse.swt.widgets.Composite)
> */
> @Override
> protected void createButtonsForButtonBar(Composite parent)
> {
> // create OK and Cancel buttons by default
> createButton(parent, IDialogConstants.OK_ID,
> Resources.Frames.Global.Texts.OK.getText(), true);
> createButton(parent, IDialogConstants.NO_ID,
> Resources.Frames.Global.Texts.NO.getText(), true);
>
> createButton(parent, IDialogConstants.CANCEL_ID,
> Resources.Frames.Global.Texts.CANCEL.getText(), false);
>
> }
>
> }
>
|
|
|
Goto Forum:
Current Time: Wed Sep 25 17:38:56 GMT 2024
Powered by FUDForum. Page generated in 0.03995 seconds
|