Java Code Examples for org.eclipse.jface.wizard.WizardDialog#setHelpAvailable()

The following examples show how to use org.eclipse.jface.wizard.WizardDialog#setHelpAvailable() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: tlaplus   File: TraceExplorerComposite.java    License: MIT License 6 votes vote down vote up
/**
   * Opens a dialog for formula processing and returns the edited formula  
   * @param formula initial formula, can be <code>null</code>
   * @return result of editing or <code>null</code>, if editing canceled
   */
  protected Formula doEditFormula(Formula formula)
  {
      // Create the wizard
FormulaWizard wizard = new FormulaWizard(section.getText(),
		"Enter an expression to be evaluated at each state of the trace.",
		String.format(
				"The expression may be named and may include the %s and %s operators (click question mark below for details).",
				TLAConstants.TraceExplore.TRACE, TLAConstants.TraceExplore.POSITION),
		"ErrorTraceExplorerExpression");
wizard.setFormula(formula);

      // Create the wizard dialog
      WizardDialog dialog = new WizardDialog(getTableViewer().getTable().getShell(), wizard);
      dialog.setHelpAvailable(true);

      // Open the wizard dialog
      if (Window.OK == dialog.open())
      {
          return wizard.getFormula();
      } else
      {
          return null;
      }
  }
 
Example 2
protected Assignment doEditFormula(Assignment formula) // gets called when editing a constant and ...
{
    Assert.isNotNull(formula);

    // Create the wizard
    AssignmentWizard wizard = new AssignmentWizard(getSection().getText(), getSection().getDescription(),
            (Assignment) formula, AssignmentWizard.SHOW_OPTION, AssignmentWizardPage.CONSTANT_WIZARD_ID);
    // Create the wizard dialog
    WizardDialog dialog = new WizardDialog(getTableViewer().getTable().getShell(), wizard);
    wizard.setWizardDialog(dialog);
    dialog.setHelpAvailable(true);

    // Open the wizard dialog
    if (Window.OK == dialog.open())
    {
        return wizard.getFormula();
    } else
    {
        return null;  // We get here if the user cancels.
    }
}
 
Example 3
/**
 * Must be called in the UI thread.
 * @param sel will define what appears initially in the project/source folder/name.
 */
public static void startWizard(AbstractPythonWizard wizard, String title, IStructuredSelection sel) {
    IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();

    wizard.init(part.getSite().getWorkbenchWindow().getWorkbench(), sel);
    wizard.setWindowTitle(title);

    Shell shell = part.getSite().getShell();
    if (shell == null) {
        shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    }
    WizardDialog dialog = new WizardDialog(shell, wizard);
    dialog.setPageSize(350, 500);
    dialog.setHelpAvailable(false);
    dialog.create();
    dialog.open();
}
 
Example 4
@Override
public void run() {

  ColorChooserWizard wizard = new ColorChooserWizard();

  WizardDialog dialog = new WizardDialog(SWTUtils.getShell(), wizard);
  dialog.setHelpAvailable(false);

  dialog.setBlockOnOpen(true);
  dialog.create();

  if (dialog.open() != Window.OK) return;

  ISarosSession session = sessionManager.getSession();

  if (session == null) return;

  int colorID = wizard.getChosenColor();

  if (!session.getUnavailableColors().contains(colorID)) session.changeColor(colorID);
  else
    MessageDialog.openInformation(
        SWTUtils.getShell(),
        Messages.ChangeColorAction_message_title,
        Messages.ChangeColorAction_message_text);
}
 
Example 5
Source Project: tlaplus   File: NewSpecHandler.java    License: MIT License 5 votes vote down vote up
/**
 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 */
public Object execute(ExecutionEvent event) throws ExecutionException
{
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);

    // Create the wizard
    NewSpecWizard wizard = new NewSpecWizard(event.getParameter(PARAM_PATH));
    // we pass null for structured selection, cause we just not using it
    wizard.init(window.getWorkbench(), null);
    Shell parentShell = window.getShell();
    // Create the wizard dialog
    WizardDialog dialog = new WizardDialog(parentShell, wizard);
    dialog.setHelpAvailable(true);
    
    // Open the wizard dialog
    if (Window.OK == dialog.open() && wizard.getRootFilename() != null)
    {
    	// read UI values from the wizard page
    	final boolean importExisting = wizard.isImportExisting();
    	final String specName = wizard.getSpecName();
    	final String rootFilename = wizard.getRootFilename();
        
        // the moment the user clicks finish on the wizard page does
        // not correspond with the availability of the spec object
        // it first has to be created/parsed fully before it can be shown in
        // the editor. Thus, delay opening the editor until parsing is done.        	
        createModuleAndSpecInNonUIThread(rootFilename, importExisting, specName);
    }

    return null;
}
 
Example 6
@Override
protected void doRun() {
    ISelection selection = getSelection();
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    IRepositoryNode node = (IRepositoryNode) obj;

    IPath path = RepositoryNodeUtilities.getPath(node);
    String originalName = node.getObject().getLabel();

    RepositoryObject repositoryObj = new RepositoryObject(node.getObject().getProperty());
    repositoryObj.setRepositoryNode(node.getObject().getRepositoryNode());
    OpenCamelExistVersionProcessWizard wizard = new OpenCamelExistVersionProcessWizard(repositoryObj);
    WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    dialog.setHelpAvailable(false);
    dialog.setPageSize(300, 250);
    dialog.setTitle(Messages.getString("OpenExistVersionProcess.open.dialog")); //$NON-NLS-1$
    if (dialog.open() == Dialog.OK) {
        refresh(node);
        // refresh the corresponding editor's name
        IEditorPart part = getCorrespondingEditor(node);
        if (part != null && part instanceof IUIRefresher) {
            ((IUIRefresher) part).refreshName();
        } else {
            processRoutineRenameOperation(originalName, node, path);
        }
    }
}
 
Example 7
@Override
@SuppressWarnings("unchecked")  // Generic casting...
protected Assignment doEditFormula(Assignment formula)
{
    // add -> let the user select the definition to override
    if (formula == null)
    {
        // Set names to an array of names of definitions that have already
        // been overridden. Note that this is the name by which the operator
        // is known in the root module, which may be something like
        // "frob!bar!Id"
        String[] names = null;
        Object input = this.getTableViewer().getInput();
        // I think that input is a Vector of Assignment objects.
        // If I'm wrong, we just set names[] to a zero-length array.
        if ((input != null) && (input instanceof Vector))
        {
            Vector<Object> inputVec = (Vector<Object>) input;
            names = new String[inputVec.size()];
            for (int i = 0; i < names.length; i++)
            {
                Object next = inputVec.elementAt(i);
                // next should be a non-null Assignment object,
                // but if it isn't, we just set names[i] to ""
                if ((next != null) && (next instanceof Assignment))
                {
                    Assignment nextAss = (Assignment) next;
                    names[i] = nextAss.getLabel();
                } else
                {
                    names[i] = "";
                }
            }
        } else
        {
            names = new String[0];
        }

        FilteredDefinitionSelectionDialog definitionSelection = new FilteredDefinitionSelectionDialog(this
                .getSection().getShell(), false, ToolboxHandle.getCurrentSpec().getValidRootModule(), names);

        definitionSelection.setTitle("Select Definition to Override");
        // It would be nice to add help to this dialog. The following command will
        // add a help button. However, I have no idea how to attach an help
        // to that button.
        //
        // definitionSelection.setHelpAvailable(true);

        definitionSelection
                .setMessage("Type definition to override or select from the list below\n(?= any character, *= any string)");
        definitionSelection.setInitialPattern("?");
        if (Window.OK == definitionSelection.open()) // this raises the Window for selecting a definition to
                                                     // override
        {
            OpDefNode result = (OpDefNode) (definitionSelection.getResult())[0];
            formula = new Assignment(result.getName().toString(), Assignment.getArrayOfEmptyStrings(result
                    .getSource().getNumberOfArgs()), "");
        } else
        {
            return null;
        }
    }

    // check if number of params defined in modules still matches number of
    // params in definition override
    // if it does not, change number of params to match

    // The following is pretty weird. The variable result above appears to be the OpDefNode
    // that Simon is now computing.
    OpDefNode opDefNode = (OpDefNode) ModelHelper.getOpDefNode(formula.getLabel());
    if (opDefNode != null && opDefNode.getSource().getNumberOfArgs() != formula.getParams().length)
    {
        String[] newParams = new String[opDefNode.getSource().getNumberOfArgs()];
        for (int i = 0; i < newParams.length; i++)
        {
            newParams[i] = "";
        }
        formula.setParams(newParams);
    }
    // Create the wizard
    AssignmentWizard wizard = new AssignmentWizard(getSection().getText(), getSection().getDescription(),
            (Assignment) formula, AssignmentWizard.SHOW_MODEL_VALUE_OPTION,
            AssignmentWizardPage.DEF_OVERRIDE_WIZARD_ID);
    // Create the wizard dialog
    WizardDialog dialog = new WizardDialog(getTableViewer().getTable().getShell(), wizard);
    wizard.setWizardDialog(dialog);
    dialog.setHelpAvailable(true);

    // Open the wizard dialog that asks for the overriding definition
    if (Window.OK == dialog.open())
    {
        return wizard.getFormula();
    } else
    {
        return null;
    }

}