Java Code Examples for org.eclipse.jface.dialogs.Dialog#OK

The following examples show how to use org.eclipse.jface.dialogs.Dialog#OK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VariablesNodeProvider.java    From birt with Eclipse Public License 1.0 8 votes vote down vote up
@Override
protected boolean doAction( ) throws Exception
{
	isDone = false;
	ReportDesignHandle designHandle = (ReportDesignHandle) SessionHandleAdapter.getInstance( )
			.getReportDesignHandle( );
	VariableElementHandle variable = (VariableElementHandle) ElementProcessorFactory.createProcessor( ReportDesignConstants.VARIABLE_ELEMENT )
			.createElement( null );
	VariableDialog dialog = new VariableDialog( Messages.getString( "VariablesNodeProvider.Dialog.Title" ), //$NON-NLS-1$
			designHandle,
			variable );
	if ( dialog.open( ) == Dialog.OK )
		designHandle.getPropertyHandle( IReportDesignModel.PAGE_VARIABLES_PROP )
				.add( variable );
	isDone = true;
	createElement = variable;
	return true;
}
 
Example 2
Source File: ConnectorSection.java    From bonita-studio with GNU General Public License v2.0 7 votes vote down vote up
private void updateConnectorAction() {
    final IStructuredSelection selection = (IStructuredSelection) tableViewer
            .getSelection();
    if (selection.size() != 1) {
        MessageDialog.openInformation(
                Display.getCurrent().getActiveShell(),
                Messages.selectOnlyOneElementTitle,
                Messages.selectOnlyOneElementMessage);
    } else {
        final Connector connector = (Connector) selection.getFirstElement();
        final ConnectorDefRepositoryStore connectorDefStore = RepositoryManager
                .getInstance().getRepositoryStore(
                        ConnectorDefRepositoryStore.class);
        final ConnectorDefinition def = connectorDefStore.getDefinition(
                connector.getDefinitionId(),
                connector.getDefinitionVersion());
        if (def != null) {
            final WizardDialog wizardDialog = new ConnectorDefinitionWizardDialog(
                    Display.getCurrent().getActiveShell(),
                    createEditConnectorWizard(connector));
            if (wizardDialog.open() == Dialog.OK) {
                tableViewer.refresh();
            }
        }
    }
}
 
Example 3
Source File: KonsListe.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void makeActions(){
	filterAction = new Action(Messages.KonsListe_FilterListAction, Action.AS_CHECK_BOX) { //$NON-NLS-1$
			{
				setImageDescriptor(Images.IMG_FILTER.getImageDescriptor());
				setToolTipText(Messages.KonsListe_FilterListToolTip); //$NON-NLS-1$
			}
			
			@Override
			public void run(){
				if (!isChecked()) {
					filter = null;
				} else {
					KonsFilterDialog kfd = new KonsFilterDialog(actPatient, filter);
					if (kfd.open() == Dialog.OK) {
						filter = kfd.getResult();
					} else {
						kfd = null;
						setChecked(false);
					}
				}
			restart(null);
			}
		};
}
 
Example 4
Source File: ChartColumnBindingDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void handleEditEvent( )
{
	ComputedColumnHandle bindingHandle = null;
	int pos = getColumnBindingIndexFromTableSelection( );
	if ( pos > -1 )
	{
		bindingHandle = (ComputedColumnHandle) ( DEUtil.getBindingHolder( inputElement ) ).getColumnBindings( )
				.getAt( pos );
	}
	if ( bindingHandle == null )
		return;

	DataColumnBindingDialog dialog = new DataColumnBindingDialog( false );
	dialog.setInput( inputElement, bindingHandle, context );
	dialog.setExpressionProvider( expressionProvider );
	if ( dialog.open( ) == Dialog.OK )
	{
		if ( bindingTable != null )
			bindingTable.getTable( ).setSelection( pos );
	}
}
 
Example 5
Source File: EditConnectorDefinitionHandler.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    SelectUserConnectorDefinitionWizard selectWizard = new SelectUserConnectorDefinitionWizard();
    WizardDialog selectDialog = new CustomWizardDialog(Display.getCurrent().getActiveShell(), selectWizard,
            Messages.Edit);
    if (selectDialog.open() == Dialog.OK) {
        ConnectorDefRepositoryStore defStore = RepositoryManager.getInstance()
                .getRepositoryStore(ConnectorDefRepositoryStore.class);
        final DefinitionResourceProvider messageProvider = DefinitionResourceProvider.getInstance(defStore,
                ConnectorPlugin.getDefault().getBundle());
        final ConnectorDefinitionWizard wizard = new ConnectorDefinitionWizard(selectWizard.getDefinition(),
                messageProvider);
        WizardDialog wd = new ConnectorDefinitionWizardDialog(Display.getCurrent().getActiveShell(), wizard,
                messageProvider);
        wd.open();
    }
    return null;
}
 
Example 6
Source File: PatientDetailView.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void makeAdditionalAddressActions(){
	removeAdditionalAddressAction = new Action(Messages.Patientenblatt2_removeAddress) {
		@Override
		public void run(){
				ZusatzAdresse a = (ZusatzAdresse) additionalAddresses.getSelection();
				a.delete();
			setPatient(ElexisEventDispatcher.getSelectedPatient());
			
		}
	};
	
	showAdditionalAddressAction = new Action(Messages.Patientenblatt2_showAddress) {
		@Override
		public void run(){
			Patient actPatient = ElexisEventDispatcher.getSelectedPatient();
			ZusatzAdresse zusatzAdresse = (ZusatzAdresse) additionalAddresses.getSelection();
			ZusatzAdresseEingabeDialog aed =
				new ZusatzAdresseEingabeDialog(scrldfrm.getShell(), actPatient, zusatzAdresse,
					bLocked);
			if (aed.open() == Dialog.OK) {
				setPatient(actPatient);
			}
		}
	};
}
 
Example 7
Source File: FieldDisplayView.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
String run(){
	create();
	if (nodes.length > 1) {
		if (open() == Dialog.OK) {
			return result;
		}
		
	}
	return nodes[0];
}
 
Example 8
Source File: ExpressionBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void insertSelection( IStructuredSelection selection )
{
	if ( selection.getFirstElement( ) instanceof Object[] )
	{
		Object[] inputArray = (Object[]) selection.getFirstElement( );
		if ( inputArray.length == 2 && inputArray[1] instanceof ReportItemHandle )
		{
			ReportItemHandle handle = (ReportItemHandle) inputArray[1];
			handle.getModuleHandle( )
					.getCommandStack( )
					.startTrans( Messages.getString( "DataEditPart.stackMsg.edit" ) ); //$NON-NLS-1$
			ColumnBindingDialog dialog = new ColumnBindingDialog( handle,
					Messages.getString( "DataColumBindingDialog.title.EditDataBinding" ) ); //$NON-NLS-1$
			if ( dialog.open( ) == Dialog.OK )
			{
				handle.getModuleHandle( ).getCommandStack( ).commit( );
				functionTable.refresh( );
			}
			else
			{
				handle.getModuleHandle( ).getCommandStack( ).rollback( );
			}
			return;
		}
	}
	String insertText = provider.getInsertText( selection.getFirstElement( ) );
	if ( insertText != null )
	{
		insertText( insertText );
	}
}
 
Example 9
Source File: ApplicationFileStore.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Optional<String> retrieveNewName() {
    FileNameValidator validator = new FileNameValidator(store, ExtensionSupported.XML, getDisplayName());
    InputDialog dialog = new InputDialog(Display.getDefault().getActiveShell(), Messages.rename,
            Messages.renameFile, getDisplayName(), new InputValidatorWrapper(validator));
    if (dialog.open() == Dialog.OK
            && !getDisplayName().equals(stripExtension(dialog.getValue(), ".xml"))) {
        return Optional.of(stripExtension(dialog.getValue(), ".xml") + ".xml");
    }
    return Optional.empty();
}
 
Example 10
Source File: DuplicateDiagramAction.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void duplicate(MainProcess diagram) {
    String newProcessLabel = diagram.getName();
    String newProcessVersion = diagram.getVersion();
    DiagramRepositoryStore diagramRepositoryStore = repositoryAccessor.getRepositoryStore(DiagramRepositoryStore.class);
    final OpenNameAndVersionForDiagramDialog dialog = new OpenNameAndVersionForDiagramDialog(
            Display.getDefault().getActiveShell(),
            diagram, diagramRepositoryStore);
    dialog.forceNameUpdate();
    if (dialog.open() == Dialog.OK) {
        final Identifier identifier = dialog.getIdentifier();
        newProcessLabel = identifier.getName();
        newProcessVersion = dialog.getIdentifier().getVersion();
        List<ProcessesNameVersion> pools = dialog.getPools();
        final DuplicateDiagramOperation op = new DuplicateDiagramOperation();
        op.setDiagramToDuplicate(diagram);
        op.setNewDiagramName(newProcessLabel);
        op.setNewDiagramVersion(newProcessVersion);
        op.setPoolsRenamed(pools);
        final IProgressService service = PlatformUI.getWorkbench().getProgressService();
        try {
            service.run(true, false, op);
        } catch (InvocationTargetException | InterruptedException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
        DiagramFileStore store = diagramRepositoryStore.getDiagram(newProcessLabel, newProcessVersion);
        store.open();
    }
}
 
Example 11
Source File: TextView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public boolean saveAs(){
	log.debug("TextView.saveAs"); //$NON-NLS-1$
	InputDialog il =
		new InputDialog(getViewSite().getShell(), Messages.TextView_saveText,
			Messages.TextView_enterTitle, "", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	if (il.open() == Dialog.OK) {
		actBrief.setBetreff(il.getValue());
		return actBrief.save(txt.getPlugin().storeToByteArray(), txt.getPlugin()
			.getMimeType());
	}
	return false;
}
 
Example 12
Source File: PairFileHandler.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/** (non-Javadoc)
 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	PairFileBean bean = new PairFileBean();
	PairFileDialog dialog = new PairFileDialog(HandlerUtil.getActiveShell(event), bean);
	if (Dialog.OK == dialog.open()) {
		
	}
	return null;
}
 
Example 13
Source File: GroupHandleProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public boolean doEditItem( int pos )
	{
		ListingHandle listingHandle = (ListingHandle) input.get( 0 );
		GroupHandle groupHandle = (GroupHandle) listingHandle.getGroups( )
				.get( pos );
		GroupDialog dialog = new GroupDialog( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ) ,GroupDialog.GROUP_DLG_TITLE_EDIT);
		dialog.setInput( groupHandle );
//		dialog.setDataSetList( DEUtil.getDataSetList( listingHandle ) );
		return dialog.open( ) == Dialog.OK;
	}
 
Example 14
Source File: DefinesViewer.java    From cmake4eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private void handleDefineAddButton(TableViewer tableViewer) {
  final Shell shell = tableViewer.getControl().getShell();
  AddCmakeDefineDialog dlg = new AddCmakeDefineDialog(shell, cfgd, null);
  if (dlg.open() == Dialog.OK) {
    CmakeDefine cmakeDefine = dlg.getCmakeDefine();
    @SuppressWarnings("unchecked")
    ArrayList<CmakeDefine> defines = (ArrayList<CmakeDefine>) tableViewer
        .getInput();
    defines.add(cmakeDefine);
    tableViewer.add(cmakeDefine); // updates the display
  }
}
 
Example 15
Source File: EditableDataSourceNodeProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected boolean performEdit( ReportElementHandle handle )
{
	if ( !(handle instanceof ScriptDataSourceHandle) && handle.canEdit( ) )
	{
		DataSourceEditor dialog = new AdvancedDataSourceEditor( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ),
				(DataSourceHandle) handle );
		return dialog.open( ) == Dialog.OK;
	}
	return false;
}
 
Example 16
Source File: ImageBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void openBidingDialog( )
{
	ReportItemHandle handle = inputImage;
	ColumnBindingDialog dialog = new ColumnBindingDialog( handle,
			PlatformUI.getWorkbench( ).getDisplay( ).getActiveShell( ),
			true );
	if ( dialog.open( ) == Dialog.OK )
	{
		String columnExpr;
		Object obj = DEUtil.getFirstDataSource( handle );
		if ( obj != null && obj instanceof CubeHandle )
			columnExpr = DEUtil.getDataExpression( (String) dialog.getResult( ) );
		else
			columnExpr = DEUtil.getColumnExpression( (String) dialog.getResult( ) );
		uriEditor.setText( columnExpr );
		try
		{
			inputImage.setValueExpression( uriEditor.getText( ).trim( ) );
		}
		catch ( SemanticException e )
		{
			ExceptionHandler.handle( e );
		}
	}
	/*
	 * I don't understand the downward code, the dialog cancels then we
	 * don't should do anything. The author hlin had left company now.
	 * Comments it. / / else { if ( inputImage.getDataSet( ) == null ) {
	 * uriEditor.setText( "" ); } }
	 */
}
 
Example 17
Source File: TemplateCustomPropertiesPage.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Opens the class selection dialog.
 * 
 * @param tokenViewer
 *            the token {@link Viewer}
 * @param servicesTable
 *            the service {@link Viewer}
 * @param customProperties
 *            the {@link TemplateCustomProperties}
 */
private void openClassSelectionDialog(Viewer tokenViewer, Viewer servicesTable,
        final TemplateCustomProperties customProperties) {
    final IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
    final FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(
            Display.getCurrent().getActiveShell(), true, PlatformUI.getWorkbench().getProgressService(), scope,
            IJavaSearchConstants.CLASS);
    if (dialog.open() == Dialog.OK && dialog.getResult() != null && dialog.getResult().length != 0) {
        for (Object object : dialog.getResult()) {
            IPath parentPath = ((IType) object).getParent().getPath();
            if (parentPath.getFileExtension().equals("jar")) {
                int indexOfUnderscore = parentPath.lastSegment().indexOf('_');
                if (indexOfUnderscore > -1) {
                    final String pluginName = parentPath.lastSegment().substring(0, indexOfUnderscore);
                    customProperties.getServiceClasses().put(((IType) object).getFullyQualifiedName(), pluginName);
                } else {
                    customProperties.getServiceClasses().put(((IType) object).getFullyQualifiedName(), "");
                }
            } else {
                final String bundleName = getBundleName((IType) object);
                if (bundleName != null) {
                    customProperties.getServiceClasses().put(((IType) object).getFullyQualifiedName(), bundleName);
                } else {
                    customProperties.getServiceClasses().put(((IType) object).getFullyQualifiedName(),
                            ((IType) object).getJavaProject().getProject().getName());
                }
            }
        }
        tokenViewer.refresh();
        servicesTable.refresh();
        templateVariablesProperties.validatePage(customProperties);
    }
}
 
Example 18
Source File: ChartBindingGroupDescriptorProvider.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void resetDataSetReference( Object value, BindingInfo info, boolean clearHistory )
{
	try
	{
		startTrans( "" ); //$NON-NLS-1$
		getReportItemHandle( ).setDataBindingReference( null );
		DataSetHandle dataSet = null;
		if ( value != null && info != null && info.isDataSet( ) )
		{
			dataSet = SessionHandleAdapter.getInstance( )
					.getReportDesignHandle( )
					.findDataSet( value.toString( ) );
		}
		if ( getReportItemHandle( ).getDataBindingType( ) == ReportItemHandle.DATABINDING_TYPE_REPORT_ITEM_REF )
		{
			getReportItemHandle( ).setDataBindingReference( null );
		}
		getReportItemHandle( ).setCube( null );
		
		boolean isExtendedDataModel = false;
		if ( dataSet == null && value != null )
		{
			getReportItemHandle( ).setDataSet( null );
			isExtendedDataModel = new LinkedDataSetAdapter( ).setLinkedDataModel( getReportItemHandle( ),
					value );
		}
		else
		{
			new LinkedDataSetAdapter( ).setLinkedDataModel( getReportItemHandle( ),
					null );
			getReportItemHandle( ).setDataSet( dataSet );
		}
		if ( clearHistory )
		{
			getReportItemHandle( ).getColumnBindings( ).clearValue( );
			getReportItemHandle( ).getPropertyHandle( ReportItemHandle.PARAM_BINDINGS_PROP )
					.clearValue( );
		}
		
		if ( info != null )
		{
			DataSetBindingSelector selector = new DataSetBindingSelector( UIUtil.getDefaultShell( ),
					isExtendedDataModel ? Messages.getString( "BindingGroupDescriptorProvider.DataSetBindingSelector.Title.LinkModel" )//$NON-NLS-1$
							: Messages.getString( "BindingGroupDescriptorProvider.DataSetBindingSelector.Title.DataSet" ) ); //$NON-NLS-1$
			selector.setDataSet( info.getBindingValue( ), info.isDataSet( ) );
			if ( selector.open( ) == Dialog.OK )
			{
				Object[] columns = (Object[]) ( (Object[]) selector.getResult( ) )[1];
				getDependedProvider( ).generateBindingColumns( columns );
			}
		}

		commit( );
	}
	catch ( SemanticException e )
	{
		rollback( );
		ExceptionHandler.handle( e );
	}
	section.load( );
}
 
Example 19
Source File: BriefNewHandler.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
	Patient pat = ElexisEventDispatcher.getSelectedPatient();
	if (pat == null) {
		MessageDialog.openInformation(UiDesk.getTopShell(),
			Messages.BriefAuswahlNoPatientSelected, Messages.BriefAuswahlNoPatientSelected);
		return null;
	}
	
	Fall selectedFall = (Fall) ElexisEventDispatcher.getSelected(Fall.class);
	if (selectedFall == null) {
		SelectFallDialog sfd = new SelectFallDialog(UiDesk.getTopShell());
		sfd.open();
		if (sfd.result != null) {
			ElexisEventDispatcher.fireSelectionEvent(sfd.result);
		} else {
			MessageDialog.openInformation(UiDesk.getTopShell(),
				Messages.TextView_NoCaseSelected, //$NON-NLS-1$
				Messages.TextView_SaveNotPossibleNoCaseAndKonsSelected); //$NON-NLS-1$
			return null;
		}
	}
	
	Konsultation selectedKonsultation =
		(Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class);
	if (selectedKonsultation == null) {
		Konsultation k = pat.getLetzteKons(false);
		if (k == null) {
			k = ((Fall) ElexisEventDispatcher.getSelected(Fall.class)).neueKonsultation();
			k.setMandant(CoreHub.actMandant);
		}
		ElexisEventDispatcher.fireSelectionEvent(k);
	}
	
	TextView tv = null;
	try {
		DocumentSelectDialog bs = new DocumentSelectDialog(
			PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
			CoreHub.actMandant, DocumentSelectDialog.TYPE_CREATE_DOC_WITH_TEMPLATE);
		if (bs.open() == Dialog.OK) {
			tv = (TextView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
				.showView(TextView.ID);
			// trick: just supply a dummy address for creating the doc
			Kontakt address = null;
			if (DocumentSelectDialog
				.getDontAskForAddresseeForThisTemplate(bs.getSelectedDocument()))
				address = Kontakt.load("-1"); //$NON-NLS-1$
			tv.createDocument(bs.getSelectedDocument(), bs.getBetreff(), address);
			tv.setName();
			
			IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
				.getActivePage().findView(BriefAuswahl.ID);
			if (viewPart instanceof BriefAuswahl) {
				((BriefAuswahl) viewPart).refreshCV(CommonViewer.Message.update_keeplabels);
			}
		}
	} catch (Exception ex) {
		ExHandler.handle(ex);
	}
	return null;
}
 
Example 20
Source File: DataSetColumnBindingsFormHandleProvider.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public boolean doEditItem( int pos )
{
	ComputedColumnHandle bindingHandle = null;
	pos = getOriginalIndex( pos );
	if ( pos > -1 )
	{
		if ( bindingObject instanceof ReportItemHandle )
		{
			bindingHandle = (ComputedColumnHandle) ( (ReportItemHandle) bindingObject ).getColumnBindings( )
					.getAt( pos );
		}
	}
	if ( bindingHandle == null )
		return false;

	boolean isResultSetColumn = false;
	String resultSetName = null;
	if ( bindingObject instanceof DataItemHandle )
		resultSetName = ( (DataItemHandle) bindingObject ).getResultSetColumn( );
	if ( resultSetName != null
			&& bindingHandle.getName( ).equals( resultSetName ) )
		isResultSetColumn = true;

	DataColumnBindingDialog dialog = new DataColumnBindingDialog( false );
	dialog.setInput( (ReportItemHandle) bindingObject, bindingHandle );

	if ( dialog.open( ) == Dialog.OK )
	{
		if ( isResultSetColumn )
		{
			try
			{
				( (DataItemHandle) bindingObject ).setResultSetColumn( bindingHandle.getName( ) );
			}
			catch ( Exception e )
			{
				ExceptionUtil.handle( e );
			}
		}
		if ( viewer != null )
		{
			viewer.refresh( true );
			return true;
		}
	}
	return false;
}