Java Code Examples for org.eclipse.jface.dialogs.MessageDialog#QUESTION

The following examples show how to use org.eclipse.jface.dialogs.MessageDialog#QUESTION . 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: Question.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
public static int askWithAll(String title, String message) {
	String[] labels = new String[] {
			IDialogConstants.YES_LABEL,
			IDialogConstants.YES_TO_ALL_LABEL,
			IDialogConstants.NO_LABEL,
			IDialogConstants.CANCEL_LABEL };
	MessageDialog dialog = new MessageDialog(
			UI.shell(), title, null, message,
			MessageDialog.QUESTION, labels, 0);
	int result = dialog.open();
	if (result == 0)
		return IDialogConstants.YES_ID;
	if (result == 1)
		return IDialogConstants.YES_TO_ALL_ID;
	if (result == 2)
		return IDialogConstants.NO_ID;
	if (result == 3)
		return IDialogConstants.NO_TO_ALL_ID;
	return IDialogConstants.CANCEL_ID;
}
 
Example 2
Source File: BuildPathsPropertyPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public boolean okToLeave() {
	if (fBuildPathsBlock != null && fBuildPathsBlock.hasChangesInDialog()) {
		String title= PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_title;
		String message= PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_message;
		String[] buttonLabels= new String[] {
				PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_button_save,
				PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_button_discard,
				PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_button_ignore
		};
		MessageDialog dialog= new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION, buttonLabels, 0);
		int res= dialog.open();
		if (res == 0) { //save
			fBlockOnApply= true;
			return performOk() && super.okToLeave();
		} else if (res == 1) { // discard
			fBuildPathsBlock.init(JavaCore.create(getProject()), null, null);
		} else {
			// keep unsaved
		}
	}
	return super.okToLeave();
}
 
Example 3
Source File: XViewerCustomizeDialog.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void handleRenameButton() {
   XViewerColumn xCol = getVisibleTableSelection().iterator().next();
   DialogWithEntry ed = new DialogWithEntry(Display.getCurrent().getActiveShell(), XViewerText.get("button.rename"), //$NON-NLS-1$
      null, XViewerText.get("XViewerCustomizeDialog.rename.new"), //$NON-NLS-1$
      MessageDialog.QUESTION,
      new String[] {
         XViewerText.get("button.ok"), //$NON-NLS-1$
         XViewerText.get("XViewerCustomizeDialog.rename.default"), //$NON-NLS-1$
         XViewerText.get("button.cancel")}, //$NON-NLS-1$
      0);
   int result = ed.open();
   if (result == 2) {
      return;
   }
   if (result == 0) {
      xViewerToCustomize.getCustomizeMgr().customizeColumnName(xCol, ed.getEntry());
   } else if (result == 1) {
      xViewerToCustomize.getCustomizeMgr().customizeColumnName(xCol, ""); //$NON-NLS-1$
   }
   visibleColTable.getViewer().update(xCol, null);
}
 
Example 4
Source File: SWTHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public void run(){
	Shell shell = UiDesk.getTopShell();
	MessageDialog dialog = new MessageDialog(shell, title, null, // accept
		// the
		// default
		// window
		// icon
		message, MessageDialog.QUESTION, new String[] {
			Messages.SWTHelper_yes, Messages.SWTHelper_no, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
			Messages.SWTHelper_cancel
		}, 0);
	// ok is the default
	int result = dialog.open();
	if (result != 2) {
		ret = result == 0;
	}
}
 
Example 5
Source File: NativeBinaryDestinationPage.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public String queryOverwrite(String pathString) {

	final MessageDialog dialog = new MessageDialog(getShell(), 
			"Overwrite Files?", 
			null, 
			 pathString+ " already exists. Would you like to overwrite it?",
			 MessageDialog.QUESTION,
			 new String[] { IDialogConstants.YES_LABEL,
                        IDialogConstants.NO_LABEL,
                        IDialogConstants.CANCEL_LABEL },
                        0);
	String[] response = new String[] { YES,  NO, CANCEL };
       //most likely to be called from non-ui thread
	getControl().getDisplay().syncExec(new Runnable() {
           public void run() {
               dialog.open();
           }
       });
       return dialog.getReturnCode() < 0 ? CANCEL : response[dialog
               .getReturnCode()];
}
 
Example 6
Source File: SVNHistoryPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Ask the user to confirm the overwrite of the file if the file has been
 * modified since last commit
 */
private boolean confirmOverwrite() {
   IFile file = (IFile) resource;
   if(file != null && file.exists()) {
     ISVNLocalFile svnFile = SVNWorkspaceRoot.getSVNFileFor(file);
     try {
       if(svnFile.isDirty()) {
         String title = Policy.bind("HistoryView.overwriteTitle"); //$NON-NLS-1$
         String msg = Policy.bind("HistoryView.overwriteMsg"); //$NON-NLS-1$
         final MessageDialog dialog = new MessageDialog(getSite().getShell(), title, null, msg,
             MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
         final int[] result = new int[ 1];
         getSite().getShell().getDisplay().syncExec(new Runnable() {
           public void run() {
             result[ 0] = dialog.open();
           }
         });
         if(result[ 0] != 0) {
           // cancel
           return false;
         }
       }
     } catch(SVNException e) {
       SVNUIPlugin.log(e.getStatus());
     }
   }
   return true;
 }
 
Example 7
Source File: WizardFolderImportPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * The <code>WizardDataTransfer</code> implementation of this <code>IOverwriteQuery</code> method asks the user
 * whether the existing resource at the given path should be overwritten.
 * 
 * @param pathString
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, <code>"ALL"</code>, or
 *         <code>"CANCEL"</code>
 */
public String queryOverwrite(String pathString)
{

	Path path = new Path(pathString);

	String messageString;
	// Break the message up if there is a file name and a directory
	// and there are at least 2 segments.
	if (path.getFileExtension() == null || path.segmentCount() < 2)
	{
		messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString);
	}

	else
	{
		messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
				path.lastSegment(), path.removeLastSegments(1).toOSString());
	}

	final MessageDialog dialog = new MessageDialog(getContainer().getShell(), IDEWorkbenchMessages.Question, null,
			messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL,
					IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
					IDialogConstants.CANCEL_LABEL }, 0);
	String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
	// run in syncExec because callback is from an operation,
	// which is probably not running in the UI thread.
	getControl().getDisplay().syncExec(new Runnable()
	{
		public void run()
		{
			dialog.open();
		}
	});
	return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}
 
Example 8
Source File: StandardDeployCommandHandler.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
protected boolean checkJspConfiguration(Shell shell, IProject project) throws CoreException {
  // If we have JSPs, ensure the project is configured with a JDK: required by staging
  // which precompiles the JSPs.  We could try to find a compatible JDK, but there's
  // a possibility that we select an inappropriate one and introduce problems.
  if (!WebProjectUtil.hasJsps(project)) {
    return true;
  }

  IJavaProject javaProject = JavaCore.create(project);
  IVMInstall vmInstall = JavaRuntime.getVMInstall(javaProject);
  if (JreDetector.isDevelopmentKit(vmInstall)) {
    return true;
  }

  String title = Messages.getString("vm.is.jre.title");
  String message =
      Messages.getString(
          "vm.is.jre.proceed",
          project.getName(),
          describeVm(vmInstall),
          vmInstall.getInstallLocation());
  String[] buttonLabels =
      new String[] {Messages.getString("deploy.button"), IDialogConstants.CANCEL_LABEL};
  MessageDialog dialog =
      new MessageDialog(shell, title, null, message, MessageDialog.QUESTION, 0, buttonLabels);
  return dialog.open() == 0;
}
 
Example 9
Source File: Initializer.java    From EasyShell with Eclipse Public License 2.0 5 votes vote down vote up
private void migrate_check_pref_and_ask_user(IStore store, Version version, List<String> prefList) {
    // if cancel or no just skip this time
    if (migrateState == 1 || migrateState == 2) {
        return;
    }
    boolean migrationPossible = false;
    for (String pref : prefList) {
        if (!store.getStore().isDefault(pref)) {
            migrationPossible = true;
            break;
        }
    }
    if (migrationPossible) {
        // ask user if not already asked and said yes
        if (migrateState != 0) {
            String title = Activator.getResourceString("easyshell.plugin.name");
            String question = MessageFormat.format(
                    Activator.getResourceString("easyshell.question.migrate"),
                    version.getName());
            MessageDialog dialog = new MessageDialog(
                    null, title, null, question,
                    MessageDialog.QUESTION,
                    new String[] {"Yes", "No", "Cancel"},
                    0); // no is the default
            migrateState = dialog.open();
        }
    }
}
 
Example 10
Source File: JavadocWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void setAllJavadocLocations(IJavaProject[] projects, URL newURL) {
	Shell shell= getShell();
	String[] buttonlabels= new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL };

	for (int j= 0; j < projects.length; j++) {
		IJavaProject iJavaProject= projects[j];
		String message= Messages.format(JavadocExportMessages.JavadocWizard_updatejavadoclocation_message, new String[] { BasicElementLabels.getJavaElementName(iJavaProject.getElementName()), BasicElementLabels.getPathLabel(fDestination, true) });
		MessageDialog dialog= new MessageDialog(shell, JavadocExportMessages.JavadocWizard_updatejavadocdialog_label, null, message, MessageDialog.QUESTION, buttonlabels, 1);

		switch (dialog.open()) {
			case YES :
				JavaUI.setProjectJavadocLocation(iJavaProject, newURL);
				break;
			case YES_TO_ALL :
				for (int i= j; i < projects.length; i++) {
					iJavaProject= projects[i];
					JavaUI.setProjectJavadocLocation(iJavaProject, newURL);
					j++;
				}
				break;
			case NO_TO_ALL :
				j= projects.length;
				break;
			case NO :
			default :
				break;
		}
	}
}
 
Example 11
Source File: XPromptChange.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static Boolean promptChangeBoolean(String displayName, String toggleMessage, boolean currSelection) {
   MessageDialogWithToggle md =
      new MessageDialogWithToggle(Display.getCurrent().getActiveShell(), displayName, null, displayName,
         MessageDialog.QUESTION,
         new String[] {XViewerText.get("button.ok"), XViewerText.get("button.cancel")}, Window.OK, //$NON-NLS-1$ //$NON-NLS-2$
         (toggleMessage != null ? toggleMessage : displayName), currSelection);
   int result = md.open();
   if (result == Window.OK) {
      return md.getToggleState();
   }
   return null;
}
 
Example 12
Source File: ExportElementDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private int confirmOverride( String confirmTitle, String confirmMsg )
{
	String[] buttons = new String[]{
			IDialogConstants.YES_LABEL,
			IDialogConstants.NO_LABEL,
			IDialogConstants.CANCEL_LABEL
	};

	if ( confirmTitle == null || confirmTitle.trim( ).length( ) == 0 )
	{
		confirmTitle = Messages.getString( "ExportElementDialog.WarningMessageDuplicate.Title" ); //$NON-NLS-1$
	}
	if ( confirmMsg == null || confirmMsg.trim( ).length( ) == 0 )
	{
		confirmMsg = Messages.getFormattedString( "ExportElementDialog.WarningMessageDuplicate.Message", //$NON-NLS-1$
				buttons );
	}

	MessageDialog dialog = new MessageDialog( UIUtil.getDefaultShell( ),
			confirmTitle,
			null,
			confirmMsg,
			MessageDialog.QUESTION,
			buttons,
			0 );

	return dialog.open( );

}
 
Example 13
Source File: DataColumnBindingDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void okPressed( )
{
	try
	{
		ComputedColumnHandle newBindingColumn = null;
		if ( bindingColumn != null )
		{
			if ( dialogHelper.differs( bindingColumn ) )
			{
				if (isNeedPrompt( ) && isBindingMultipleReferenced( ) )
				{
					MessageDialog dialog = new MessageDialog( UIUtil.getDefaultShell( ),
							Messages.getString( "DataColumnBindingDialog.NewBindingDialogTitle" ), //$NON-NLS-1$
							null,
							Messages.getString( "DataColumnBindingDialog.NewBindingDialogMessage" ), //$NON-NLS-1$
							MessageDialog.QUESTION,
							new String[]{
									Messages.getString( "DataColumnBindingDialog.NewBindingDialogButtonYes" ), Messages.getString( "DataColumnBindingDialog.NewBindingDialogButtonNo" ), Messages.getString( "DataColumnBindingDialog.NewBindingDialogButtonCancel" ) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
							},
							0 );
					int dialogClick = dialog.open( );
					if ( dialogClick == 0 )
					{
						InputDialog inputDialog = new InputDialog( UIUtil.getDefaultShell( ),
								Messages.getString( "DataColumnBindingDialog.NewBindingDialogInputNewNameTitle" ), //$NON-NLS-1$
								Messages.getString( "DataColumnBindingDialog.NewBindingDialogInputNewNameMessage" ), //$NON-NLS-1$
								"", //$NON-NLS-1$
								new IInputValidator( ) {

									public String isValid( String newText )
									{

										for ( Iterator iterator = DEUtil.getBindingHolder( bindingObject )
												.getColumnBindings( )
												.iterator( ); iterator.hasNext( ); )
										{
											ComputedColumnHandle computedColumn = (ComputedColumnHandle) iterator.next( );
											if ( computedColumn.getName( )
													.equals( newText ) )
											{
												return Messages.getFormattedString( "BindingDialogHelper.error.nameduplicate", //$NON-NLS-1$
														new Object[]{
															newText
														} );
											}
										}
										return null;
									}
								} );
						if ( inputDialog.open( ) == Window.OK )
						{
							bindingColumn = dialogHelper.newBinding( DEUtil.getBindingHolder( bindingObject ),
									inputDialog.getValue( ) );
							super.okPressed( );
							return;
						}
						else
						{
							return;
						}
					}
					else if ( dialogClick == 2 )
					{
						return;
					}
				}
				if ( !dialogHelper.canProcessWithWarning( ) )
					return;
				bindingColumn = dialogHelper.editBinding( bindingColumn );
			}
		}
		else
		{
			if ( !dialogHelper.canProcessWithWarning( ) )
				return;
			if ( bindSelf )
				bindingColumn = dialogHelper.newBinding( bindingObject,
						null );
			else
				bindingColumn = dialogHelper.newBinding( DEUtil.getBindingHolder( bindingObject ),
						null );
			newBindingColumn = bindingColumn;
		}
		if( ExtendedDataModelUIAdapterHelper.isBoundToExtendedData( DEUtil.getBindingHolder( bindingObject ) ) )
		{
			DataModelAdapterStatus status = DataModelAdapterUtil.validateRelativeTimePeriod(DEUtil.getBindingHolder( bindingObject ), bindingColumn);
			if( status.getStatus( ) == DataModelAdapterStatus.Status.FAIL )
			{
				MessageDialog.openError( UIUtil.getDefaultShell( ), null, status.getMessage( ) );
				removeColumnBinding(newBindingColumn);
				return;
			}
		}
		super.okPressed( );
	}
	catch ( Exception e )
	{
		ExceptionHandler.handle( e );
	}
}
 
Example 14
Source File: WizardSaveAsPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public IPath getResult( )
{

	IPath path = support.getFileLocationFullPath( )
			.append( support.getFileName( ) );

	// If the user does not supply a file extension and if the save
	// as dialog was provided a default file name append the extension
	// of the default filename to the new name
	if ( ReportPlugin.getDefault( )
			.isReportDesignFile( support.getInitialFileName( ) )
			&& !ReportPlugin.getDefault( )
					.isReportDesignFile( path.toOSString( ) ) )
	{
		String[] parts = support.getInitialFileName( ).split( "\\." ); //$NON-NLS-1$
		path = path.addFileExtension( parts[parts.length - 1] );
	}
	else if ( support.getInitialFileName( )
			.endsWith( IReportEditorContants.TEMPLATE_FILE_EXTENTION )
			&& !path.toOSString( )
					.endsWith( IReportEditorContants.TEMPLATE_FILE_EXTENTION ) )
	{
		path = path.addFileExtension( "rpttemplate" ); //$NON-NLS-1$
	}
	// If the path already exists then confirm overwrite.
	File file = path.toFile( );
	if ( file.exists( ) )
	{
		String[] buttons = new String[]{
				IDialogConstants.YES_LABEL,
				IDialogConstants.NO_LABEL,
				IDialogConstants.CANCEL_LABEL
		};

		String question = Messages.getFormattedString( "SaveAsDialog.overwriteQuestion", //$NON-NLS-1$
				new Object[]{
					path.toOSString( )
				} );
		MessageDialog d = new MessageDialog( getShell( ),
				Messages.getString( "SaveAsDialog.Question" ), //$NON-NLS-1$
				null,
				question,
				MessageDialog.QUESTION,
				buttons,
				0 );
		int overwrite = d.open( );
		switch ( overwrite )
		{
			case 0 : // Yes
				break;
			case 1 : // No
				return null;
			case 2 : // Cancel
			default :
				return Path.EMPTY;
		}
	}

	return path;
}
 
Example 15
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void confirmSave( )
{

	if ( fIsHandlingActivation )
		return;
	if ( !isExistModelFile( ) && !isClose )
	{
		// Thread.dumpStack( );
		fIsHandlingActivation = true;
		MessageDialog dialog = new MessageDialog( UIUtil.getDefaultShell( ),
				Messages.getString( "MultiPageReportEditor.ConfirmTitle" ), //$NON-NLS-1$
				null,
				Messages.getString( "MultiPageReportEditor.SaveConfirmMessage" ), //$NON-NLS-1$
				MessageDialog.QUESTION,
				new String[]{
						Messages.getString( "MultiPageReportEditor.SaveButton" ), Messages.getString( "MultiPageReportEditor.CloseButton" )}, 0 ); //$NON-NLS-1$ //$NON-NLS-2$
		try
		{
			if ( dialog.open( ) == 0 )
			{
				doSave( null );
				isClose = false;
			}
			else
			{
				Display display = getSite( ).getShell( ).getDisplay( );
				display.asyncExec( new Runnable( ) {

					public void run( )
					{
						closeEditor( false );
					}
				} );
				isClose = true;

			}
		}
		finally
		{
			fIsHandlingActivation = false;
			needReset = false;
			needReload = false;
		}

	}
}
 
Example 16
Source File: ImportArticleDialog.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
private void doImport(){
	
	StringBuffer buf = new StringBuffer();
	
	// check for store availability
	
	// check for stock availability
	StructuredSelection iSelection = (StructuredSelection) comboStockType.getSelection();
	if (iSelection.isEmpty()) {
		buf.append("Bitte wählen Sie ein Lager aus.");
	} else {
		final Stock stock = (Stock) iSelection.getFirstElement();
		
		// check src file
		String path = tFilePath.getText();
		if (path != null && !path.isEmpty() && path.toLowerCase().endsWith("xls")) {
			
			try (FileInputStream is = new FileInputStream(tFilePath.getText())) {
				ExcelWrapper xl = new ExcelWrapper();
				if (xl.load(is, 0)) {
					xl.setFieldTypes(new Class[] {
						Integer.class, String.class, String.class, String.class, String.class,
						String.class, Integer.class, String.class, String.class, String.class
					});
					MessageDialog dialog = new MessageDialog(getShell(), "Datenimport", null,
						"Wie sollen die Datenbestände importiert werden ?",
						MessageDialog.QUESTION, 0, "Datenbestand 'exakt' importieren",
						"Datenbestand 'aufaddieren'");
					int ret = dialog.open();
					if (ret >= 0) {
						runImport(buf, stock, xl, ret == 0);
					}
					return;
				}
			} catch (IOException e) {
				MessageDialog.openError(getShell(), "Import error",
					"Import fehlgeschlagen.\nDatei nicht importierbar: " + path);
				LoggerFactory.getLogger(ImportArticleDialog.class)
					.error("cannot import file at " + path, e);
			}
		} else {
			buf.append(
				"Die Quelldatei ist ungültig. Bitte überprüfen Sie diese Datei.\n" + path);
		}
	}
	
	if (buf.length() > 0) {
		MessageDialog.openInformation(getShell(), "Import Ergebnis", buf.toString());
	} else {
		MessageDialog.openWarning(getShell(), "Import Ergebnis",
			"Import nicht möglich.\nÜberprüfen Sie das Log-File.");
	}
}
 
Example 17
Source File: DataSetColumnBindingsFormHandleProvider.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void generateOutputParmsBindings( DataSetHandle datasetHandle )
{
	List<DataSetParameterHandle> outputParams = new ArrayList<DataSetParameterHandle>( );
	for ( Iterator iter = datasetHandle.parametersIterator( ); iter.hasNext( ); )
	{
		Object obj = iter.next( );
		if ( ( obj instanceof DataSetParameterHandle )
				&& ( (DataSetParameterHandle) obj ).isOutput( ) == true )
		{
			outputParams.add( (DataSetParameterHandle) obj );
		}
	}

	int ret = -1;
	if ( outputParams.size( ) > 0 )
	{
		MessageDialog prefDialog = new MessageDialog( UIUtil.getDefaultShell( ),
				Messages.getString( "dataBinding.title.generateOutputParam" ),//$NON-NLS-1$
				null,
				Messages.getString( "dataBinding.msg.generateOutputParam" ),//$NON-NLS-1$
				MessageDialog.QUESTION,
				new String[]{
						Messages.getString( "AttributeView.dialg.Message.Yes" ),//$NON-NLS-1$
						Messages.getString( "AttributeView.dialg.Message.No" )},//$NON-NLS-1$
				0 );//$NON-NLS-1$

		ret = prefDialog.open( );
	}

	if ( ret == 0 )
		for ( int i = 0; i < outputParams.size( ); i++ )
		{
			DataSetParameterHandle param = outputParams.get( i );
			ComputedColumn bindingColumn = StructureFactory.newComputedColumn( bindingObject,
					param.getName( ) );
			bindingColumn.setDataType( param.getDataType( ) );
			String groupType = DEUtil.getGroupControlType( bindingObject );
			List groupList = DEUtil.getGroups( bindingObject );
			ExpressionUtility.setBindingColumnExpression( param,
					bindingColumn,
					true );

			if ( bindingObject instanceof ReportItemHandle )
			{
				try
				{
					( (ReportItemHandle) bindingObject ).addColumnBinding( bindingColumn,
							false );
				}
				catch ( SemanticException e )
				{
					ExceptionHandler.handle( e );
				}
				continue;
			}

			if ( ExpressionUtil.hasAggregation( bindingColumn.getExpression( ) ) )
			{
				if ( groupType.equals( DEUtil.TYPE_GROUP_GROUP ) )
					bindingColumn.setAggregrateOn( ( (GroupHandle) groupList.get( 0 ) ).getName( ) );
				else if ( groupType.equals( DEUtil.TYPE_GROUP_LISTING ) )
					bindingColumn.setAggregrateOn( null );
			}
		}
}
 
Example 18
Source File: GWTProjectPropertyPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public void addGWT(IProject project, GwtSdk runtime)
    throws BackingStoreException, FileNotFoundException, CoreException {
  IJavaProject javaProject = JavaCore.create(project);

  // TODO this causes some issue with dialog popup and war output folder selection
  WebAppProjectProperties.maybeSetWebAppPropertiesForDynamicWebProject(project);

  // if (sdkSelectionBlock.hasSdkChanged() &&
  // !GWTProjectsRuntime.isGWTRuntimeProject(javaProject)) {

  boolean isDefault = false;
  GwtSdk newSdk = runtime;
  GwtSdk oldSdk = runtime;

  UpdateType updateType = GWTUpdateProjectSdkCommand.computeUpdateType(oldSdk, newSdk, isDefault);

  GWTUpdateProjectSdkCommand updateProjectSdkCommand =
      new GWTUpdateProjectSdkCommand(javaProject, oldSdk, newSdk, updateType, null);

  /*
   * Update the project classpath which will trigger the <WAR>/WEB-INF/lib jars to be updated.
   */
  updateProjectSdkCommand.execute();
  // }

  GWTNature.addNatureToProject(project);

  // Need to rebuild to get GWT errors to appear
  BuilderUtilities.scheduleRebuild(project);

  // only prompt to reopen editors if the transition from disabled -> enabled
  if (!initialUseGWT && useGWT) {
    // Get the list of Java editors opened on files in this project
    IEditorReference[] openEditors = getOpenJavaEditors(project);
    if (openEditors.length > 0) {
      MessageDialog dlg = new MessageDialog(GWTPlugin.getActiveWorkbenchShell(), GWTPlugin.getName(), null,
          "GWT editing functionality, such as syntax-colored JSNI blocks, "
              + "will only be enabled after you re-open your Java editors.\n\nDo "
              + "you want to re-open your editors now?",
          MessageDialog.QUESTION, new String[] {"Re-open Java editors", "No"}, 0);
      if (dlg.open() == IDialogConstants.OK_ID) {
        reopenWithGWTJavaEditor(openEditors);
      }
    }
  }
}
 
Example 19
Source File: M2DocOptionDialog.java    From M2Doc with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param parentShell
 *            the parent {@link Shell}
 * @param generation
 *            the {@link Generation}
 * @param option
 *            the {@link Option} to editr
 */
public M2DocOptionDialog(Shell parentShell, Generation generation, Option option) {
    super(parentShell, "Set option name and value.", null, "Set option name and value.", MessageDialog.QUESTION,
            new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
    this.generation = generation;
    this.option = option;
}