
package org.eclipse.birt.report.designer.internal.ui.ide.propertyeditor;

import org.eclipse.birt.report.designer.core.model.SessionHandleAdapter;
import org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler;
import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.HyperLinkDescriptorProvider;
import org.eclipse.birt.report.designer.nls.Messages;
import org.eclipse.birt.report.designer.ui.dialogs.HyperlinkBuilder;
import org.eclipse.birt.report.designer.util.DEUtil;
import org.eclipse.birt.report.model.api.ActionHandle;
import org.eclipse.birt.report.model.api.CommandStack;
import org.eclipse.birt.report.model.api.ReportItemHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.ui.PlatformUI;

public class IDEHyperLinkDescriptorProvider extends HyperLinkDescriptorProvider
{

	public boolean hyperLinkSelected( )
	{
		boolean flag = true;
		HyperlinkBuilder dialog = new HyperlinkBuilder( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ) ,true );
		getActionStack( ).startTrans( Messages.getString( "HyperLinkPage.Menu.Save" ) ); //$NON-NLS-1$
		ActionHandle handle = getActionHandle( );
		if ( handle == null )
		{
			try
			{
				handle = DEUtil.setAction( (ReportItemHandle) DEUtil.getInputFirstElement( input ),
						StructureFactory.createAction( ) );
			}
			catch ( SemanticException e1 )
			{
				getActionStack( ).rollback( );
				ExceptionHandler.handle( e1 );
				return false;
			}
		}
		dialog.setInput( handle );
		needRefresh = false;
		boolean isOK = dialog.open( ) == Dialog.OK;
		needRefresh = true;
		if ( isOK )
		{
			getActionStack( ).commit( );
			flag = true;
		}
		else
		{
			getActionStack( ).rollback( );
			flag = false;
		}
		return flag;
	}

	private boolean needRefresh = true;

	private CommandStack getActionStack( )
	{
		return SessionHandleAdapter.getInstance( ).getCommandStack( );
	}

	private ActionHandle getActionHandle( )
	{
		return DEUtil.getActionHandle( (ReportItemHandle) DEUtil.getInputFirstElement( input ) );
	}
	
}

@@ -212,24 +212,136 @@
 ionHandler;%0A
+import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.GroupHyperLinkDescriptorProvider;%0A
 import org.e
@@ -1036,16 +1036,21 @@
 extends 
+Group
 HyperLin
@@ -2031,21 +2031,23 @@
 ue;%0A%0A%09pr
-ivate
+otected
  Command
@@ -2145,21 +2145,23 @@
 %0A%09%7D%0A%0A%09pr
-ivate
+otected
  ActionH

Append a group provider to set hyperlink on all selections.